diff --git a/etc/api/acceleratedmobilepageurl/v1/acceleratedmobilepageurl-api.json b/etc/api/acceleratedmobilepageurl/v1/acceleratedmobilepageurl-api.json index e69de29bb2..0d82ac8430 100644 --- a/etc/api/acceleratedmobilepageurl/v1/acceleratedmobilepageurl-api.json +++ b/etc/api/acceleratedmobilepageurl/v1/acceleratedmobilepageurl-api.json @@ -0,0 +1,236 @@ +{ + "id": "acceleratedmobilepageurl:v1", + "description": "This API contains a single method, batchGet. Call this method to retrieve the AMP URL (and equivalent AMP Cache URL) for given public URL(s).\n", + "protocol": "rest", + "title": "Accelerated Mobile Pages (AMP) URL API", + "resources": { + "ampUrls": { + "methods": { + "batchGet": { + "id": "acceleratedmobilepageurl.ampUrls.batchGet", + "response": { + "$ref": "BatchGetAmpUrlsResponse" + }, + "parameterOrder": [], + "description": "Returns AMP URL(s) and equivalent\n[AMP Cache URL(s)](/amp/cache/overview#amp-cache-url-format).", + "request": { + "$ref": "BatchGetAmpUrlsRequest" + }, + "flatPath": "v1/ampUrls:batchGet", + "httpMethod": "POST", + "parameters": {}, + "path": "v1/ampUrls:batchGet" + } + } + } + }, + "schemas": { + "AmpUrl": { + "description": "AMP URL response for a requested URL.", + "type": "object", + "properties": { + "ampUrl": { + "description": "The AMP URL pointing to the publisher's web server.", + "type": "string" + }, + "originalUrl": { + "description": "The original non-AMP URL.", + "type": "string" + }, + "cdnAmpUrl": { + "description": "The [AMP Cache URL](/amp/cache/overview#amp-cache-url-format) pointing to\nthe cached document in the Google AMP Cache.", + "type": "string" + } + }, + "id": "AmpUrl" + }, + "AmpUrlError": { + "description": "AMP URL Error resource for a requested URL that couldn't be found.", + "type": "object", + "properties": { + "originalUrl": { + "description": "The original non-AMP URL.", + "type": "string" + }, + "errorCode": { + "description": "The error code of an API call.", + "enum": [ + "ERROR_CODE_UNSPECIFIED", + "INPUT_URL_NOT_FOUND", + "NO_AMP_URL", + "APPLICATION_ERROR", + "URL_IS_VALID_AMP", + "URL_IS_INVALID_AMP" + ], + "enumDescriptions": [ + "Not specified error.", + "Indicates the requested URL is not found in the index, possibly because\nit's unable to be found, not able to be accessed by Googlebot, or some\nother error.", + "Indicates no AMP URL has been found that corresponds to the requested\nURL.", + "Indicates some kind of application error occurred at the server.\nClient advised to retry.", + "DEPRECATED: Indicates the requested URL is a valid AMP URL. This is a\nnon-error state, should not be relied upon as a sign of success or\nfailure. It will be removed in future versions of the API.", + "Indicates that an AMP URL has been found that corresponds to the request\nURL, but it is not valid AMP HTML." + ], + "type": "string" + }, + "errorMessage": { + "description": "An optional descriptive error message.", + "type": "string" + } + }, + "id": "AmpUrlError" + }, + "BatchGetAmpUrlsRequest": { + "description": "AMP URL request for a batch of URLs.", + "type": "object", + "properties": { + "lookupStrategy": { + "description": "The lookup_strategy being requested.", + "enum": [ + "FETCH_LIVE_DOC", + "IN_INDEX_DOC" + ], + "enumDescriptions": [ + "FETCH_LIVE_DOC strategy involves live document fetch of URLs not found in\nthe index. Any request URL not found in the index is crawled in realtime\nto validate if there is a corresponding AMP URL. This strategy has higher\ncoverage but with extra latency introduced by realtime crawling. This is\nthe default strategy. Applications using this strategy should set higher\nHTTP timeouts of the API calls.", + "IN_INDEX_DOC strategy skips fetching live documents of URL(s) not found\nin index. For applications which need low latency use of IN_INDEX_DOC\nstrategy is recommended." + ], + "type": "string" + }, + "urls": { + "description": "List of URLs to look up for the paired AMP URLs.\nThe URLs are case-sensitive. Up to 50 URLs per lookup\n(see [Usage Limits](/amp/cache/reference/limits)).", + "type": "array", + "items": { + "type": "string" + } + } + }, + "id": "BatchGetAmpUrlsRequest" + }, + "BatchGetAmpUrlsResponse": { + "description": "Batch AMP URL response.", + "type": "object", + "properties": { + "urlErrors": { + "description": "The errors for requested URLs that have no AMP URL.", + "type": "array", + "items": { + "$ref": "AmpUrlError" + } + }, + "ampUrls": { + "description": "For each URL in BatchAmpUrlsRequest, the URL response. The response might\nnot be in the same order as URLs in the batch request.\nIf BatchAmpUrlsRequest contains duplicate URLs, AmpUrl is generated\nonly once.", + "type": "array", + "items": { + "$ref": "AmpUrl" + } + } + }, + "id": "BatchGetAmpUrlsResponse" + } + }, + "revision": "20161213", + "basePath": "", + "icons": { + "x32": "http://www.google.com/images/icons/product/search-32.gif", + "x16": "http://www.google.com/images/icons/product/search-16.gif" + }, + "version_module": "True", + "discoveryVersion": "v1", + "baseUrl": "https://acceleratedmobilepageurl.googleapis.com/", + "name": "acceleratedmobilepageurl", + "parameters": { + "access_token": { + "description": "OAuth access token.", + "type": "string", + "location": "query" + }, + "prettyPrint": { + "description": "Returns response with indentations and line breaks.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "key": { + "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", + "type": "string", + "location": "query" + }, + "quotaUser": { + "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.", + "type": "string", + "location": "query" + }, + "pp": { + "description": "Pretty-print response.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "fields": { + "description": "Selector specifying which fields to include in a partial response.", + "type": "string", + "location": "query" + }, + "alt": { + "description": "Data format for response.", + "location": "query", + "enum": [ + "json", + "media", + "proto" + ], + "default": "json", + "enumDescriptions": [ + "Responses with Content-Type of application/json", + "Media download with context-dependent Content-Type", + "Responses with Content-Type of application/x-protobuf" + ], + "type": "string" + }, + "$.xgafv": { + "description": "V1 error format.", + "enum": [ + "1", + "2" + ], + "enumDescriptions": [ + "v1 error format", + "v2 error format" + ], + "type": "string", + "location": "query" + }, + "callback": { + "description": "JSONP", + "type": "string", + "location": "query" + }, + "oauth_token": { + "description": "OAuth 2.0 token for the current user.", + "type": "string", + "location": "query" + }, + "uploadType": { + "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").", + "type": "string", + "location": "query" + }, + "bearer_token": { + "description": "OAuth bearer token.", + "type": "string", + "location": "query" + }, + "upload_protocol": { + "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").", + "type": "string", + "location": "query" + } + }, + "documentationLink": "https://developers.google.com/amp/cache/", + "ownerDomain": "google.com", + "batchPath": "batch", + "servicePath": "", + "ownerName": "Google", + "version": "v1", + "rootUrl": "https://acceleratedmobilepageurl.googleapis.com/", + "kind": "discovery#restDescription" +} diff --git a/etc/api/adexchangebuyer/v1.2/adexchangebuyer-api.json b/etc/api/adexchangebuyer/v1.2/adexchangebuyer-api.json index 51c49fbf1a..5fa2064a9d 100644 --- a/etc/api/adexchangebuyer/v1.2/adexchangebuyer-api.json +++ b/etc/api/adexchangebuyer/v1.2/adexchangebuyer-api.json @@ -1,12 +1,12 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/P8rJ3iX9MbkJGAvsY3P6mePkFI8\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/0kwihhvVMiMrsDgm6RBckyUuCfE\"", "discoveryVersion": "v1", "id": "adexchangebuyer:v1.2", "name": "adexchangebuyer", "canonicalName": "Ad Exchange Buyer", "version": "v1.2", - "revision": "20160831", + "revision": "20161020", "title": "Ad Exchange Buyer API", "description": "Accesses your bidding-account information, submits creatives for validation, finds available direct deals, and retrieves performance reports.", "ownerDomain": "google.com", diff --git a/etc/api/adexchangebuyer/v1.3/adexchangebuyer-api.json b/etc/api/adexchangebuyer/v1.3/adexchangebuyer-api.json index c99c0bc9a0..c79c4b1dbe 100644 --- a/etc/api/adexchangebuyer/v1.3/adexchangebuyer-api.json +++ b/etc/api/adexchangebuyer/v1.3/adexchangebuyer-api.json @@ -1,12 +1,12 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/bx00dhCeT3Y8291uk8ElnLRZiBs\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/mo0qLr7wMmlAX-U4DWVexdxTH80\"", "discoveryVersion": "v1", "id": "adexchangebuyer:v1.3", "name": "adexchangebuyer", "canonicalName": "Ad Exchange Buyer", "version": "v1.3", - "revision": "20160831", + "revision": "20161020", "title": "Ad Exchange Buyer API", "description": "Accesses your bidding-account information, submits creatives for validation, finds available direct deals, and retrieves performance reports.", "ownerDomain": "google.com", @@ -545,7 +545,7 @@ }, "videoURL": { "type": "string", - "description": "The url to fetch a video ad. If set, HTMLSnippet should not be set." + "description": "The URL to fetch a video ad. If set, HTMLSnippet and the nativeAd should not be set." }, "width": { "type": "integer", diff --git a/etc/api/adexchangebuyer/v1.4/adexchangebuyer-api.json b/etc/api/adexchangebuyer/v1.4/adexchangebuyer-api.json index d981dcea12..78bf5cb2a8 100644 --- a/etc/api/adexchangebuyer/v1.4/adexchangebuyer-api.json +++ b/etc/api/adexchangebuyer/v1.4/adexchangebuyer-api.json @@ -1,12 +1,12 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/TVMTzMzY2Oz9Cw6N35WlTiR7OUE\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/EvKs3Hkvcx40X69CkSu-499XWyU\"", "discoveryVersion": "v1", "id": "adexchangebuyer:v1.4", "name": "adexchangebuyer", "canonicalName": "Ad Exchange Buyer", "version": "v1.4", - "revision": "20160831", + "revision": "20161020", "title": "Ad Exchange Buyer API", "description": "Accesses your bidding-account information, submits creatives for validation, finds available direct deals, and retrieves performance reports.", "ownerDomain": "google.com", @@ -90,7 +90,7 @@ "properties": { "bidProtocol": { "type": "string", - "description": "The protocol that the bidder endpoint is using. By default, OpenRTB protocols use JSON, except PROTOCOL_OPENRTB_PROTOBUF. PROTOCOL_OPENRTB_PROTOBUF uses protobuf encoding over the latest OpenRTB protocol version, which is 2.3 right now. Allowed values: \n- PROTOCOL_ADX \n- PROTOCOL_OPENRTB_2_2 \n- PROTOCOL_OPENRTB_2_3 \n- PROTOCOL_OPENRTB_PROTOBUF" + "description": "The protocol that the bidder endpoint is using. By default, OpenRTB protocols use JSON, except PROTOCOL_OPENRTB_PROTOBUF. PROTOCOL_OPENRTB_PROTOBUF uses protobuf encoding over the latest OpenRTB protocol version, which is 2.4 right now. Allowed values: \n- PROTOCOL_ADX \n- PROTOCOL_OPENRTB_2_2 \n- PROTOCOL_OPENRTB_2_3 \n- PROTOCOL_OPENRTB_2_4 \n- PROTOCOL_OPENRTB_PROTOBUF" }, "maximumQps": { "type": "integer", @@ -568,7 +568,7 @@ }, "nativeAd": { "type": "object", - "description": "If nativeAd is set, HTMLSnippet and videoURL should not be set.", + "description": "If nativeAd is set, HTMLSnippet and the videoURL outside of nativeAd should not be set. (The videoURL inside nativeAd can be set.)", "properties": { "advertiser": { "type": "string" @@ -598,6 +598,10 @@ "type": "string", "description": "A label for the button that the user is supposed to click." }, + "clickLinkUrl": { + "type": "string", + "description": "The URL that the browser/SDK will load when the user clicks the ad." + }, "clickTrackingUrl": { "type": "string", "description": "The URL to use for click tracking." @@ -659,6 +663,10 @@ "store": { "type": "string", "description": "The URL to the app store to purchase/download the promoted app." + }, + "videoURL": { + "type": "string", + "description": "The URL of the XML VAST for a native ad. Note this is a separate field from resource.video_url." } } }, @@ -773,7 +781,7 @@ }, "videoURL": { "type": "string", - "description": "The url to fetch a video ad. If set, HTMLSnippet should not be set." + "description": "The URL to fetch a video ad. If set, HTMLSnippet and the nativeAd should not be set. Note, this is different from resource.native_ad.video_url above." }, "width": { "type": "integer", @@ -787,6 +795,41 @@ } } }, + "CreativeDealIds": { + "id": "CreativeDealIds", + "type": "object", + "description": "The external deal ids associated with a creative.", + "properties": { + "dealStatuses": { + "type": "array", + "description": "A list of external deal ids and ARC approval status.", + "items": { + "type": "object", + "properties": { + "arcStatus": { + "type": "string", + "description": "ARC approval status." + }, + "dealId": { + "type": "string", + "description": "External deal ID.", + "format": "int64" + }, + "webPropertyId": { + "type": "integer", + "description": "Publisher ID.", + "format": "int32" + } + } + } + }, + "kind": { + "type": "string", + "description": "Resource type.", + "default": "adexchangebuyer#creativeDealIds" + } + } + }, "CreativesList": { "id": "CreativesList", "type": "object", @@ -1264,6 +1307,10 @@ "type": "string", "description": "Description for the deal terms. (updatable)" }, + "isRfpTemplate": { + "type": "boolean", + "description": "Indicates whether the current deal is a RFP template. RFP template is created by buyer and not based on seller created products." + }, "kind": { "type": "string", "description": "Identifies what kind of resource this is. Value: the fixed string \"adexchangebuyer#marketplaceDeal\".", @@ -1716,6 +1763,13 @@ "format": "int64" } }, + "userIdentifierDataRequired": { + "type": "array", + "description": "Requests containing the specified type of user data will match. Possible values are HOSTED_MATCH_DATA, which means the request is cookie-targetable and has a match in the buyer's hosted match table, and COOKIE_OR_IDFA, which means the request has either a targetable cookie or an iOS IDFA.", + "items": { + "type": "string" + } + }, "userLists": { "type": "array", "description": "Requests containing any of these user list ids will match.", @@ -1977,6 +2031,13 @@ "$ref": "PrivateData", "description": "Private data for buyer. (hidden from seller)." }, + "dbmAdvertiserIds": { + "type": "array", + "description": "IDs of DBM advertisers permission to this proposal.", + "items": { + "type": "string" + } + }, "hasBuyerSignedOff": { "type": "boolean", "description": "When an proposal is in an accepted state, indicates whether the buyer has signed off. Once both sides have signed off on a deal, the proposal can be finalized by the seller. (seller-readonly)" @@ -2764,6 +2825,37 @@ "https://www.googleapis.com/auth/adexchange.buyer" ] }, + "listDeals": { + "id": "adexchangebuyer.creatives.listDeals", + "path": "creatives/{accountId}/{buyerCreativeId}/listDeals", + "httpMethod": "GET", + "description": "Lists the external deal ids associated with the creative.", + "parameters": { + "accountId": { + "type": "integer", + "description": "The id for the account that will serve this creative.", + "required": true, + "format": "int32", + "location": "path" + }, + "buyerCreativeId": { + "type": "string", + "description": "The buyer-specific id for this creative.", + "required": true, + "location": "path" + } + }, + "parameterOrder": [ + "accountId", + "buyerCreativeId" + ], + "response": { + "$ref": "CreativeDealIds" + }, + "scopes": [ + "https://www.googleapis.com/auth/adexchange.buyer" + ] + }, "removeDeal": { "id": "adexchangebuyer.creatives.removeDeal", "path": "creatives/{accountId}/{buyerCreativeId}/removeDeal/{dealId}", diff --git a/etc/api/adexchangebuyer2/v2beta1/adexchangebuyer2-api.json b/etc/api/adexchangebuyer2/v2beta1/adexchangebuyer2-api.json index e69de29bb2..31240b3d58 100644 --- a/etc/api/adexchangebuyer2/v2beta1/adexchangebuyer2-api.json +++ b/etc/api/adexchangebuyer2/v2beta1/adexchangebuyer2-api.json @@ -0,0 +1,709 @@ +{ + "id": "adexchangebuyer2:v2beta1", + "auth": { + "oauth2": { + "scopes": { + "https://www.googleapis.com/auth/adexchange.buyer": { + "description": "Manage your Ad Exchange buyer account configuration" + } + } + } + }, + "description": "Accesses the latest features for managing Ad Exchange accounts, Real-Time Bidding configurations and auction metrics, and Marketplace programmatic deals.", + "protocol": "rest", + "title": "Ad Exchange Buyer API II", + "resources": { + "accounts": { + "resources": { + "clients": { + "resources": { + "users": { + "methods": { + "update": { + "id": "adexchangebuyer2.accounts.clients.users.update", + "response": { + "$ref": "ClientUser" + }, + "parameterOrder": [ + "accountId", + "clientAccountId", + "userId" + ], + "description": "Updates an existing client user.\nOnly the user status can be changed on update.", + "request": { + "$ref": "ClientUser" + }, + "flatPath": "v2beta1/accounts/{accountId}/clients/{clientAccountId}/users/{userId}", + "httpMethod": "PUT", + "parameters": { + "clientAccountId": { + "description": "Numerical account ID of the client buyer that the user to be retrieved\nis associated with. (required)", + "required": true, + "location": "path", + "type": "string", + "format": "int64" + }, + "userId": { + "description": "Numerical identifier of the user to retrieve. (required)", + "required": true, + "location": "path", + "type": "string", + "format": "int64" + }, + "accountId": { + "description": "Numerical account ID of the client's sponsor buyer. (required)", + "required": true, + "location": "path", + "type": "string", + "format": "int64" + } + }, + "path": "v2beta1/accounts/{accountId}/clients/{clientAccountId}/users/{userId}", + "scopes": [ + "https://www.googleapis.com/auth/adexchange.buyer" + ] + }, + "get": { + "id": "adexchangebuyer2.accounts.clients.users.get", + "response": { + "$ref": "ClientUser" + }, + "parameterOrder": [ + "accountId", + "clientAccountId", + "userId" + ], + "description": "Retrieves an existing client user.", + "flatPath": "v2beta1/accounts/{accountId}/clients/{clientAccountId}/users/{userId}", + "httpMethod": "GET", + "parameters": { + "clientAccountId": { + "description": "Numerical account ID of the client buyer\nthat the user to be retrieved is associated with. (required)", + "required": true, + "location": "path", + "type": "string", + "format": "int64" + }, + "userId": { + "description": "Numerical identifier of the user to retrieve. (required)", + "required": true, + "location": "path", + "type": "string", + "format": "int64" + }, + "accountId": { + "description": "Numerical account ID of the client's sponsor buyer. (required)", + "required": true, + "location": "path", + "type": "string", + "format": "int64" + } + }, + "path": "v2beta1/accounts/{accountId}/clients/{clientAccountId}/users/{userId}", + "scopes": [ + "https://www.googleapis.com/auth/adexchange.buyer" + ] + }, + "list": { + "id": "adexchangebuyer2.accounts.clients.users.list", + "response": { + "$ref": "ListClientUsersResponse" + }, + "parameterOrder": [ + "accountId", + "clientAccountId" + ], + "description": "Lists all the known client users for a specified\nsponsor buyer account ID.", + "flatPath": "v2beta1/accounts/{accountId}/clients/{clientAccountId}/users", + "httpMethod": "GET", + "parameters": { + "clientAccountId": { + "description": "The account ID of the client buyer to list users for. (required)\nYou must specify either a string representation of a\nnumerical account identifier or the `-` character\nto list all the client users for all the clients\nof a given sponsor buyer.", + "required": true, + "location": "path", + "type": "string" + }, + "pageSize": { + "description": "Requested page size. The server may return fewer clients than requested.\nIf unspecified, the server will pick an appropriate default.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "accountId": { + "description": "Numerical account ID of the sponsor buyer of the client to list users for.\n(required)", + "required": true, + "location": "path", + "type": "string", + "format": "int64" + }, + "pageToken": { + "description": "A token identifying a page of results the server should return.\nTypically, this is the value of\nListClientUsersResponse.nextPageToken\nreturned from the previous call to the\naccounts.clients.users.list method.", + "location": "query", + "type": "string" + } + }, + "path": "v2beta1/accounts/{accountId}/clients/{clientAccountId}/users", + "scopes": [ + "https://www.googleapis.com/auth/adexchange.buyer" + ] + } + } + }, + "invitations": { + "methods": { + "create": { + "id": "adexchangebuyer2.accounts.clients.invitations.create", + "response": { + "$ref": "ClientUserInvitation" + }, + "parameterOrder": [ + "accountId", + "clientAccountId" + ], + "description": "Creates and sends out an email invitation to access\nan Ad Exchange client buyer account.", + "request": { + "$ref": "ClientUserInvitation" + }, + "flatPath": "v2beta1/accounts/{accountId}/clients/{clientAccountId}/invitations", + "httpMethod": "POST", + "parameters": { + "clientAccountId": { + "description": "Numerical account ID of the client buyer that the user\nshould be associated with. (required)", + "required": true, + "location": "path", + "type": "string", + "format": "int64" + }, + "accountId": { + "description": "Numerical account ID of the client's sponsor buyer. (required)", + "required": true, + "location": "path", + "type": "string", + "format": "int64" + } + }, + "path": "v2beta1/accounts/{accountId}/clients/{clientAccountId}/invitations", + "scopes": [ + "https://www.googleapis.com/auth/adexchange.buyer" + ] + }, + "get": { + "id": "adexchangebuyer2.accounts.clients.invitations.get", + "response": { + "$ref": "ClientUserInvitation" + }, + "parameterOrder": [ + "accountId", + "clientAccountId", + "invitationId" + ], + "description": "Retrieves an existing client user invitation.", + "flatPath": "v2beta1/accounts/{accountId}/clients/{clientAccountId}/invitations/{invitationId}", + "httpMethod": "GET", + "parameters": { + "clientAccountId": { + "description": "Numerical account ID of the client buyer that the user invitation\nto be retrieved is associated with. (required)", + "required": true, + "location": "path", + "type": "string", + "format": "int64" + }, + "invitationId": { + "description": "Numerical identifier of the user invitation to retrieve. (required)", + "required": true, + "location": "path", + "type": "string", + "format": "int64" + }, + "accountId": { + "description": "Numerical account ID of the client's sponsor buyer. (required)", + "required": true, + "location": "path", + "type": "string", + "format": "int64" + } + }, + "path": "v2beta1/accounts/{accountId}/clients/{clientAccountId}/invitations/{invitationId}", + "scopes": [ + "https://www.googleapis.com/auth/adexchange.buyer" + ] + }, + "list": { + "id": "adexchangebuyer2.accounts.clients.invitations.list", + "response": { + "$ref": "ListClientUserInvitationsResponse" + }, + "parameterOrder": [ + "accountId", + "clientAccountId" + ], + "description": "Lists all the client users invitations for a client\nwith a given account ID.", + "flatPath": "v2beta1/accounts/{accountId}/clients/{clientAccountId}/invitations", + "httpMethod": "GET", + "parameters": { + "clientAccountId": { + "description": "Numerical account ID of the client buyer to list invitations for.\n(required)\nYou must either specify a string representation of a\nnumerical account identifier or the `-` character\nto list all the invitations for all the clients\nof a given sponsor buyer.", + "required": true, + "location": "path", + "type": "string" + }, + "pageSize": { + "description": "Requested page size. Server may return fewer clients than requested.\nIf unspecified, server will pick an appropriate default.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "accountId": { + "description": "Numerical account ID of the client's sponsor buyer. (required)", + "required": true, + "location": "path", + "type": "string", + "format": "int64" + }, + "pageToken": { + "description": "A token identifying a page of results the server should return.\nTypically, this is the value of\nListClientUserInvitationsResponse.nextPageToken\nreturned from the previous call to the\nclients.invitations.list\nmethod.", + "location": "query", + "type": "string" + } + }, + "path": "v2beta1/accounts/{accountId}/clients/{clientAccountId}/invitations", + "scopes": [ + "https://www.googleapis.com/auth/adexchange.buyer" + ] + } + } + } + }, + "methods": { + "update": { + "id": "adexchangebuyer2.accounts.clients.update", + "response": { + "$ref": "Client" + }, + "parameterOrder": [ + "accountId", + "clientAccountId" + ], + "description": "Updates an existing client buyer.", + "request": { + "$ref": "Client" + }, + "flatPath": "v2beta1/accounts/{accountId}/clients/{clientAccountId}", + "httpMethod": "PUT", + "parameters": { + "clientAccountId": { + "description": "Unique numerical account ID of the client to update. (required)", + "required": true, + "location": "path", + "type": "string", + "format": "int64" + }, + "accountId": { + "description": "Unique numerical account ID for the buyer of which the client buyer\nis a customer; the sponsor buyer to update a client for. (required)", + "required": true, + "location": "path", + "type": "string", + "format": "int64" + } + }, + "path": "v2beta1/accounts/{accountId}/clients/{clientAccountId}", + "scopes": [ + "https://www.googleapis.com/auth/adexchange.buyer" + ] + }, + "get": { + "id": "adexchangebuyer2.accounts.clients.get", + "response": { + "$ref": "Client" + }, + "parameterOrder": [ + "accountId", + "clientAccountId" + ], + "description": "Gets a client buyer with a given client account ID.", + "flatPath": "v2beta1/accounts/{accountId}/clients/{clientAccountId}", + "httpMethod": "GET", + "parameters": { + "clientAccountId": { + "description": "Numerical account ID of the client buyer to retrieve. (required)", + "required": true, + "location": "path", + "type": "string", + "format": "int64" + }, + "accountId": { + "description": "Numerical account ID of the client's sponsor buyer. (required)", + "required": true, + "location": "path", + "type": "string", + "format": "int64" + } + }, + "path": "v2beta1/accounts/{accountId}/clients/{clientAccountId}", + "scopes": [ + "https://www.googleapis.com/auth/adexchange.buyer" + ] + }, + "create": { + "id": "adexchangebuyer2.accounts.clients.create", + "response": { + "$ref": "Client" + }, + "parameterOrder": [ + "accountId" + ], + "description": "Creates a new client buyer.", + "request": { + "$ref": "Client" + }, + "flatPath": "v2beta1/accounts/{accountId}/clients", + "httpMethod": "POST", + "parameters": { + "accountId": { + "description": "Unique numerical account ID for the buyer of which the client buyer\nis a customer; the sponsor buyer to create a client for. (required)", + "required": true, + "location": "path", + "type": "string", + "format": "int64" + } + }, + "path": "v2beta1/accounts/{accountId}/clients", + "scopes": [ + "https://www.googleapis.com/auth/adexchange.buyer" + ] + }, + "list": { + "id": "adexchangebuyer2.accounts.clients.list", + "response": { + "$ref": "ListClientsResponse" + }, + "parameterOrder": [ + "accountId" + ], + "description": "Lists all the clients for the current sponsor buyer.", + "flatPath": "v2beta1/accounts/{accountId}/clients", + "httpMethod": "GET", + "parameters": { + "pageSize": { + "description": "Requested page size. The server may return fewer clients than requested.\nIf unspecified, the server will pick an appropriate default.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "accountId": { + "description": "Unique numerical account ID of the sponsor buyer to list the clients for.", + "required": true, + "location": "path", + "type": "string", + "format": "int64" + }, + "pageToken": { + "description": "A token identifying a page of results the server should return.\nTypically, this is the value of\nListClientsResponse.nextPageToken\nreturned from the previous call to the\naccounts.clients.list method.", + "location": "query", + "type": "string" + } + }, + "path": "v2beta1/accounts/{accountId}/clients", + "scopes": [ + "https://www.googleapis.com/auth/adexchange.buyer" + ] + } + } + } + } + } + }, + "schemas": { + "ClientUser": { + "description": "A client user is created under a client buyer and has restricted access to\nthe Ad Exchange Marketplace and certain other sections\nof the Ad Exchange Buyer UI based on the role\ngranted to the associated client buyer.\n\nThe only way a new client user can be created is via accepting an\nemail invitation\n(see the\naccounts.clients.invitations.create\nmethod).\n\nAll fields are required unless otherwise specified.", + "type": "object", + "properties": { + "email": { + "description": "User's email address. The value of this field\nis ignored in an update operation.", + "type": "string" + }, + "clientAccountId": { + "description": "Numerical account ID of the client buyer\nwith which the user is associated; the\nbuyer must be a client of the current sponsor buyer.\nThe value of this field is ignored in an update operation.", + "type": "string", + "format": "int64" + }, + "status": { + "description": "The status of the client user.", + "enum": [ + "USER_STATUS_UNSPECIFIED", + "PENDING", + "ACTIVE", + "DISABLED" + ], + "enumDescriptions": [ + "A placeholder for an undefined user status.", + "A user who was already created but hasn't accepted the invitation yet.", + "A user that is currently active.", + "A user that is currently disabled." + ], + "type": "string" + }, + "userId": { + "description": "The unique numerical ID of the client user\nthat has accepted an invitation.\nThe value of this field is ignored in an update operation.", + "type": "string", + "format": "int64" + } + }, + "id": "ClientUser" + }, + "ClientUserInvitation": { + "description": "An invitation for a new client user to get access to the Ad Exchange\nBuyer UI.\nAll fields are required unless otherwise specified.", + "type": "object", + "properties": { + "email": { + "description": "The email address to which the invitation is sent. Email\naddresses should be unique among all client users under each sponsor\nbuyer.", + "type": "string" + }, + "clientAccountId": { + "description": "Numerical account ID of the client buyer\nthat the invited user is associated with.\nThe value of this field is ignored in create operations.", + "type": "string", + "format": "int64" + }, + "invitationId": { + "description": "The unique numerical ID of the invitation that is sent to the user.\nThe value of this field is ignored in create operations.", + "type": "string", + "format": "int64" + } + }, + "id": "ClientUserInvitation" + }, + "ListClientUserInvitationsResponse": { + "type": "object", + "properties": { + "nextPageToken": { + "description": "A token to retrieve the next page of results.\nPass this value in the\nListClientUserInvitationsRequest.pageToken\nfield in the subsequent call to the\nclients.invitations.list\nmethod to retrieve the next\npage of results.", + "type": "string" + }, + "invitations": { + "description": "The returned list of client users.", + "type": "array", + "items": { + "$ref": "ClientUserInvitation" + } + } + }, + "id": "ListClientUserInvitationsResponse" + }, + "ListClientUsersResponse": { + "type": "object", + "properties": { + "users": { + "description": "The returned list of client users.", + "type": "array", + "items": { + "$ref": "ClientUser" + } + }, + "nextPageToken": { + "description": "A token to retrieve the next page of results.\nPass this value in the\nListClientUsersRequest.pageToken\nfield in the subsequent call to the\nclients.invitations.list\nmethod to retrieve the next\npage of results.", + "type": "string" + } + }, + "id": "ListClientUsersResponse" + }, + "Client": { + "description": "A client resource represents a client buyer—an agency,\na brand, or an advertiser customer of the sponsor buyer.\nUsers associated with the client buyer have restricted access to\nthe Ad Exchange Marketplace and certain other sections\nof the Ad Exchange Buyer UI based on the role\ngranted to the client buyer.\nAll fields are required unless otherwise specified.", + "type": "object", + "properties": { + "visibleToSeller": { + "description": "Whether the client buyer will be visible to sellers.", + "type": "boolean" + }, + "status": { + "description": "The status of the client buyer.", + "enum": [ + "CLIENT_STATUS_UNSPECIFIED", + "DISABLED", + "ACTIVE" + ], + "enumDescriptions": [ + "A placeholder for an undefined client status.", + "A client that is currently disabled.", + "A client that is currently active." + ], + "type": "string" + }, + "entityType": { + "description": "The type of the client entity: `ADVERTISER`, `BRAND`, or `AGENCY`.", + "enum": [ + "ENTITY_TYPE_UNSPECIFIED", + "ADVERTISER", + "BRAND", + "AGENCY" + ], + "enumDescriptions": [ + "A placeholder for an undefined client entity type. Should not be used.", + "An advertiser.", + "A brand.", + "An advertising agency." + ], + "type": "string" + }, + "role": { + "description": "The role which is assigned to the client buyer. Each role implies a set of\npermissions granted to the client. Must be one of `CLIENT_DEAL_VIEWER`,\n`CLIENT_DEAL_NEGOTIATOR` or `CLIENT_DEAL_APPROVER`.", + "enum": [ + "CLIENT_ROLE_UNSPECIFIED", + "CLIENT_DEAL_VIEWER", + "CLIENT_DEAL_NEGOTIATOR", + "CLIENT_DEAL_APPROVER" + ], + "enumDescriptions": [ + "A placeholder for an undefined client role.", + "Users associated with this client can see publisher deal offers\nin the Marketplace.\nThey can neither negotiate proposals nor approve deals.\nIf this client is visible to publishers, they can send deal proposals\nto this client.", + "Users associated with this client can respond to deal proposals\nsent to them by publishers. They can also initiate deal proposals\nof their own.", + "Users associated with this client can approve eligible deals\non your behalf. Some deals may still explicitly require publisher\nfinalization. If this role is not selected, the sponsor buyer\nwill need to manually approve each of their deals." + ], + "type": "string" + }, + "clientName": { + "description": "Name used to represent this client to publishers.\nYou may have multiple clients that map to the same entity,\nbut for each client the combination of `clientName` and entity\nmust be unique.\nYou can specify this field as empty.", + "type": "string" + }, + "clientAccountId": { + "description": "The globally-unique numerical ID of the client.\nThe value of this field is ignored in create and update operations.", + "type": "string", + "format": "int64" + }, + "entityId": { + "description": "Numerical identifier of the client entity.\nThe entity can be an advertiser, a brand, or an agency.\nThis identifier is unique among all the entities with the same type.\n\nA list of all known advertisers with their identifiers is available in the\n[advertisers.txt](https://storage.googleapis.com/adx-rtb-dictionaries/advertisers.txt)\nfile.\n\nA list of all known brands with their identifiers is available in the\n[brands.txt](https://storage.googleapis.com/adx-rtb-dictionaries/brands.txt)\nfile.\n\nA list of all known agencies with their identifiers is available in the\n[agencies.txt](https://storage.googleapis.com/adx-rtb-dictionaries/agencies.txt)\nfile.", + "type": "string", + "format": "int64" + }, + "entityName": { + "description": "The name of the entity. This field is automatically fetched based on\nthe type and ID.\nThe value of this field is ignored in create and update operations.", + "type": "string" + } + }, + "id": "Client" + }, + "ListClientsResponse": { + "type": "object", + "properties": { + "nextPageToken": { + "description": "A token to retrieve the next page of results.\nPass this value in the\nListClientsRequest.pageToken\nfield in the subsequent call to the\naccounts.clients.list method\nto retrieve the next page of results.", + "type": "string" + }, + "clients": { + "description": "The returned list of clients.", + "type": "array", + "items": { + "$ref": "Client" + } + } + }, + "id": "ListClientsResponse" + } + }, + "revision": "20161208", + "basePath": "", + "icons": { + "x32": "http://www.google.com/images/icons/product/search-32.gif", + "x16": "http://www.google.com/images/icons/product/search-16.gif" + }, + "version_module": "True", + "canonicalName": "AdExchangeBuyerII", + "discoveryVersion": "v1", + "baseUrl": "https://adexchangebuyer.googleapis.com/", + "name": "adexchangebuyer2", + "parameters": { + "access_token": { + "description": "OAuth access token.", + "type": "string", + "location": "query" + }, + "prettyPrint": { + "description": "Returns response with indentations and line breaks.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "key": { + "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", + "type": "string", + "location": "query" + }, + "quotaUser": { + "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.", + "type": "string", + "location": "query" + }, + "pp": { + "description": "Pretty-print response.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "fields": { + "description": "Selector specifying which fields to include in a partial response.", + "type": "string", + "location": "query" + }, + "alt": { + "description": "Data format for response.", + "location": "query", + "enum": [ + "json", + "media", + "proto" + ], + "default": "json", + "enumDescriptions": [ + "Responses with Content-Type of application/json", + "Media download with context-dependent Content-Type", + "Responses with Content-Type of application/x-protobuf" + ], + "type": "string" + }, + "$.xgafv": { + "description": "V1 error format.", + "enum": [ + "1", + "2" + ], + "enumDescriptions": [ + "v1 error format", + "v2 error format" + ], + "type": "string", + "location": "query" + }, + "callback": { + "description": "JSONP", + "type": "string", + "location": "query" + }, + "oauth_token": { + "description": "OAuth 2.0 token for the current user.", + "type": "string", + "location": "query" + }, + "uploadType": { + "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").", + "type": "string", + "location": "query" + }, + "bearer_token": { + "description": "OAuth bearer token.", + "type": "string", + "location": "query" + }, + "upload_protocol": { + "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").", + "type": "string", + "location": "query" + } + }, + "documentationLink": "https://developers.google.com/ad-exchange/buyer-rest/guides/client-access/", + "ownerDomain": "google.com", + "batchPath": "batch", + "servicePath": "", + "ownerName": "Google", + "version": "v2beta1", + "rootUrl": "https://adexchangebuyer.googleapis.com/", + "kind": "discovery#restDescription" +} diff --git a/etc/api/adexchangeseller/v1.1/adexchangeseller-api.json b/etc/api/adexchangeseller/v1.1/adexchangeseller-api.json index 0088264414..f8fb3a7ec3 100644 --- a/etc/api/adexchangeseller/v1.1/adexchangeseller-api.json +++ b/etc/api/adexchangeseller/v1.1/adexchangeseller-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/Dz_LMqDcbtnyBd4CwnrsbswCFU4\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/Dz_LMqDcbtnyBd4CwnrsbswCFU4\"", "discoveryVersion": "v1", "id": "adexchangeseller:v1.1", "name": "adexchangeseller", diff --git a/etc/api/adexchangeseller/v1/adexchangeseller-api.json b/etc/api/adexchangeseller/v1/adexchangeseller-api.json index 71bb30c136..1756f6b130 100644 --- a/etc/api/adexchangeseller/v1/adexchangeseller-api.json +++ b/etc/api/adexchangeseller/v1/adexchangeseller-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/EberIAMM9RntL16aqUh0FmyQxWY\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/EberIAMM9RntL16aqUh0FmyQxWY\"", "discoveryVersion": "v1", "id": "adexchangeseller:v1", "name": "adexchangeseller", diff --git a/etc/api/adexchangeseller/v2.0/adexchangeseller-api.json b/etc/api/adexchangeseller/v2.0/adexchangeseller-api.json index b1315441a8..495e492bc8 100644 --- a/etc/api/adexchangeseller/v2.0/adexchangeseller-api.json +++ b/etc/api/adexchangeseller/v2.0/adexchangeseller-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/1XDufO4826VKTkrV2WU9EmKApiQ\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/1XDufO4826VKTkrV2WU9EmKApiQ\"", "discoveryVersion": "v1", "id": "adexchangeseller:v2.0", "name": "adexchangeseller", diff --git a/etc/api/admin/datatransfer_v1/admin-api.json b/etc/api/admin/datatransfer_v1/admin-api.json index 004935775c..cf4d5f0d62 100644 --- a/etc/api/admin/datatransfer_v1/admin-api.json +++ b/etc/api/admin/datatransfer_v1/admin-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/YLr8KxlFkw8ar-xZYzcCGhmF9B0\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/69RNEuIs-2cMvhRHgpkaoTAmcFU\"", "discoveryVersion": "v1", "id": "admin:datatransfer_v1", "name": "admin", @@ -13,8 +13,8 @@ "ownerName": "Google", "packagePath": "admin", "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" }, "documentationLink": "https://developers.google.com/admin-sdk/data-transfer/", "protocol": "rest", diff --git a/etc/api/admin/directory_v1/admin-api.json b/etc/api/admin/directory_v1/admin-api.json index e9960d947f..5bc2dea77c 100644 --- a/etc/api/admin/directory_v1/admin-api.json +++ b/etc/api/admin/directory_v1/admin-api.json @@ -1,20 +1,20 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/tVkq2fforoBT9yvJW6dzQX6ja6Q\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/MJXmm78_R4W8L6tex9cqkPyvKmM\"", "discoveryVersion": "v1", "id": "admin:directory_v1", "name": "admin", "canonicalName": "directory", "version": "directory_v1", - "revision": "20160824", + "revision": "20161124", "title": "Admin Directory API", "description": "The Admin SDK Directory API lets you view and manage enterprise resources such as users and groups, administrative notifications, security features, and more.", "ownerDomain": "google.com", "ownerName": "Google", "packagePath": "admin", "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" }, "documentationLink": "https://developers.google.com/admin-sdk/directory/", "protocol": "rest", @@ -533,6 +533,25 @@ } } }, + "ChromeOsDeviceAction": { + "id": "ChromeOsDeviceAction", + "type": "object", + "description": "JSON request template for firing actions on ChromeOs Device in Directory Devices API.", + "properties": { + "action": { + "type": "string", + "description": "Action to be taken on the ChromeOs Device", + "annotations": { + "required": [ + "directory.chromeosdevices.action" + ] + } + }, + "deprovisionReason": { + "type": "string" + } + } + }, "ChromeOsDevices": { "id": "ChromeOsDevices", "type": "object", @@ -973,6 +992,14 @@ "type": "string", "description": "Mobile Device Baseband version (Read-only)" }, + "bootloaderVersion": { + "type": "string", + "description": "Mobile Device Bootloader version (Read-only)" + }, + "brand": { + "type": "string", + "description": "Mobile Device Brand (Read-only)" + }, "buildNumber": { "type": "string", "description": "Mobile Device Build number (Read-only)" @@ -993,6 +1020,10 @@ "type": "string", "description": "Mobile Device serial number (Read-only)" }, + "devicePasswordStatus": { + "type": "string", + "description": "DevicePasswordStatus (Read-only)" + }, "email": { "type": "array", "description": "List of owner user's email addresses (Read-only)", @@ -1000,6 +1031,10 @@ "type": "string" } }, + "encryptionStatus": { + "type": "string", + "description": "Mobile Device Encryption Status (Read-only)" + }, "etag": { "type": "string", "description": "ETag of the resource." @@ -1009,6 +1044,10 @@ "description": "Date and time the device was first synchronized with the policy settings in the Google Apps administrator control panel (Read-only)", "format": "date-time" }, + "hardware": { + "type": "string", + "description": "Mobile Device Hardware (Read-only)" + }, "hardwareId": { "type": "string", "description": "Mobile Device Hardware Id (Read-only)" @@ -1035,6 +1074,10 @@ "type": "boolean", "description": "Boolean indicating if this account is on owner/primary profile or not (Read-only)" }, + "manufacturer": { + "type": "string", + "description": "Mobile Device manufacturer (Read-only)" + }, "meid": { "type": "string", "description": "Mobile Device MEID number (Read-only)" @@ -1065,10 +1108,23 @@ "type": "string" } }, + "privilege": { + "type": "string", + "description": "DMAgentPermission (Read-only)" + }, + "releaseVersion": { + "type": "string", + "description": "Mobile Device release version version (Read-only)" + }, "resourceId": { "type": "string", "description": "Unique identifier of Mobile Device (Read-only)" }, + "securityPatchLevel": { + "type": "string", + "description": "Mobile Device Security patch level (Read-only)", + "format": "int64" + }, "serialNumber": { "type": "string", "description": "Mobile Device SSN or Serial Number (Read-only)" @@ -2452,6 +2508,36 @@ }, "chromeosdevices": { "methods": { + "action": { + "id": "directory.chromeosdevices.action", + "path": "customer/{customerId}/devices/chromeos/{resourceId}/action", + "httpMethod": "POST", + "description": "Take action on Chrome OS Device", + "parameters": { + "customerId": { + "type": "string", + "description": "Immutable id of the Google Apps account", + "required": true, + "location": "path" + }, + "resourceId": { + "type": "string", + "description": "Immutable id of Chrome OS Device", + "required": true, + "location": "path" + } + }, + "parameterOrder": [ + "customerId", + "resourceId" + ], + "request": { + "$ref": "ChromeOsDeviceAction" + }, + "scopes": [ + "https://www.googleapis.com/auth/admin.directory.device.chromeos" + ] + }, "get": { "id": "directory.chromeosdevices.get", "path": "customer/{customerId}/devices/chromeos/{deviceId}", diff --git a/etc/api/admin/reports_v1/admin-api.json b/etc/api/admin/reports_v1/admin-api.json index 4ba0fff311..343d128410 100644 --- a/etc/api/admin/reports_v1/admin-api.json +++ b/etc/api/admin/reports_v1/admin-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/JOd2IF5OejEZFbpk9z7_VoeqW5U\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/QGy4Wv90L7XHcKxA0VDj0fNkDc0\"", "discoveryVersion": "v1", "id": "admin:reports_v1", "name": "admin", @@ -13,8 +13,8 @@ "ownerName": "Google", "packagePath": "admin", "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" }, "documentationLink": "https://developers.google.com/admin-sdk/reports/", "protocol": "rest", diff --git a/etc/api/adsense/v1.3/adsense-api.json b/etc/api/adsense/v1.3/adsense-api.json index 659861b150..4abdb58a01 100644 --- a/etc/api/adsense/v1.3/adsense-api.json +++ b/etc/api/adsense/v1.3/adsense-api.json @@ -1,12 +1,12 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/C00o7wucTJAcP39P-cEOrRc9pLA\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/O4Gi4w2H5lck6YfTHArV5gfcJY8\"", "discoveryVersion": "v1", "id": "adsense:v1.3", "name": "adsense", "canonicalName": "AdSense", "version": "v1.3", - "revision": "20160907", + "revision": "20161206", "title": "AdSense Management API", "description": "Accesses AdSense publishers' inventory and generates performance reports.", "ownerDomain": "google.com", @@ -238,7 +238,7 @@ }, "corners": { "type": "string", - "description": "The style of the corners in the ad." + "description": "The style of the corners in the ad (deprecated: never populated, ignored)." }, "font": { "type": "object", diff --git a/etc/api/adsense/v1.4/adsense-api.json b/etc/api/adsense/v1.4/adsense-api.json index 9c47c4c644..4ad3d43c98 100644 --- a/etc/api/adsense/v1.4/adsense-api.json +++ b/etc/api/adsense/v1.4/adsense-api.json @@ -1,12 +1,12 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/mzAWTwgWWJnzBtwDU9h80pGL_MA\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/9rW_iSYGkNTcKHQcRbE8edxeIL0\"", "discoveryVersion": "v1", "id": "adsense:v1.4", "name": "adsense", "canonicalName": "AdSense", "version": "v1.4", - "revision": "20160907", + "revision": "20161206", "title": "AdSense Management API", "description": "Accesses AdSense publishers' inventory and generates performance reports.", "ownerDomain": "google.com", @@ -246,7 +246,7 @@ }, "corners": { "type": "string", - "description": "The style of the corners in the ad." + "description": "The style of the corners in the ad (deprecated: never populated, ignored)." }, "font": { "type": "object", diff --git a/etc/api/adsensehost/v4.1/adsensehost-api.json b/etc/api/adsensehost/v4.1/adsensehost-api.json index bfc7a02158..a18646ba11 100644 --- a/etc/api/adsensehost/v4.1/adsensehost-api.json +++ b/etc/api/adsensehost/v4.1/adsensehost-api.json @@ -1,12 +1,12 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/1O6SL_KmRSdPQjZoTIixUZdD99Y\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/Lu4otnxJaoGqp6ZeALzdWUnJjmk\"", "discoveryVersion": "v1", "id": "adsensehost:v4.1", "name": "adsensehost", "canonicalName": "AdSense Host", "version": "v4.1", - "revision": "20160907", + "revision": "20161206", "title": "AdSense Host API", "description": "Generates performance reports, generates ad codes, and provides publisher management capabilities for AdSense Hosts.", "ownerDomain": "google.com", @@ -227,7 +227,7 @@ }, "corners": { "type": "string", - "description": "The style of the corners in the ad. Possible values are SQUARE, SLIGHTLY_ROUNDED and VERY_ROUNDED." + "description": "The style of the corners in the ad (deprecated: never populated, ignored)." }, "font": { "type": "object", diff --git a/etc/api/analytics/v2.4/analytics-api.json b/etc/api/analytics/v2.4/analytics-api.json index a6c9b8cf27..30c0ec74e2 100644 --- a/etc/api/analytics/v2.4/analytics-api.json +++ b/etc/api/analytics/v2.4/analytics-api.json @@ -1,11 +1,11 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/nDekPAYRSzRXXRFOQaI0Em-G4Rc\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/cmdroRcoxpGmDDzSn3LW27FM6Ag\"", "discoveryVersion": "v1", "id": "analytics:v2.4", "name": "analytics", "version": "v2.4", - "revision": "20160805", + "revision": "20161004", "title": "Google Analytics API", "description": "Views and manages your Google Analytics data.", "ownerDomain": "google.com", diff --git a/etc/api/analytics/v3/analytics-api.json b/etc/api/analytics/v3/analytics-api.json index 9a6b746967..887024ca6b 100644 --- a/etc/api/analytics/v3/analytics-api.json +++ b/etc/api/analytics/v3/analytics-api.json @@ -1,11 +1,11 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/RVrwVyPQJLlTFI7LM0WsqSWaDpE\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/CEwIV9fdNgUw9Oy31M8HLJeTPyQ\"", "discoveryVersion": "v1", "id": "analytics:v3", "name": "analytics", "version": "v3", - "revision": "20160805", + "revision": "20161004", "title": "Google Analytics API", "description": "Views and manages your Google Analytics data.", "ownerDomain": "google.com", @@ -1610,6 +1610,11 @@ "type": "boolean", "description": "Determines if Analytics data contains samples." }, + "dataLastRefreshed": { + "type": "string", + "description": "The last refreshed time in seconds for Analytics data.", + "format": "int64" + }, "dataTable": { "type": "object", "properties": { @@ -2059,7 +2064,7 @@ }, "membershipDurationDays": { "type": "integer", - "description": "Number of days a user remains in the audience. Use any integer from 1-540. In remarketing audiences for search ads, membership duration is truncated to 180 days.", + "description": "Number of days (in the range 1 to 540) a user remains in the audience.", "format": "int32" }, "segment": { @@ -2357,7 +2362,7 @@ }, "currency": { "type": "string", - "description": "The currency type associated with this view (profile), defaults to USD. The supported values are:\nARS, AUD, BGN, BRL, CAD, CHF, CNY, CZK, DKK, EUR, GBP, HKD, HUF, IDR, INR, JPY, KRW, LTL, MXN, NOK, NZD, PHP, PLN, RUB, SEK, THB, TRY, TWD, USD, VND, ZAR" + "description": "The currency type associated with this view (profile), defaults to USD. The supported values are:\nUSD, JPY, EUR, GBP, AUD, KRW, BRL, CNY, DKK, RUB, SEK, NOK, PLN, TRY, TWD, HKD, THB, IDR, ARS, MXN, VND, PHP, INR, CHF, CAD, CZK, NZD, HUF, BGN, LTL, ZAR, UAH, AED, BOB, CLP, COP, EGP, HRK, ILS, MAD, MYR, PEN, PKR, RON, RSD, SAR, SGD, VEF, LVL" }, "defaultPage": { "type": "string", @@ -5943,23 +5948,23 @@ "id": "analytics.management.remarketingAudience.get", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/remarketingAudiences/{remarketingAudienceId}", "httpMethod": "GET", - "description": "Gets remarketing audiences to which the user has access.", + "description": "Gets a remarketing audience to which the user has access.", "parameters": { "accountId": { "type": "string", - "description": "Account ID for the remarketing audience to retrieve.", + "description": "The account ID of the remarketing audience to retrieve.", "required": true, "location": "path" }, "remarketingAudienceId": { "type": "string", - "description": "The ID to retrieve the Remarketing Audience for.", + "description": "The ID of the remarketing audience to retrieve.", "required": true, "location": "path" }, "webPropertyId": { "type": "string", - "description": "Web property ID for the remarketing audience to retrieve.", + "description": "The web property ID of the remarketing audience to retrieve.", "required": true, "location": "path" } @@ -5981,17 +5986,17 @@ "id": "analytics.management.remarketingAudience.insert", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/remarketingAudiences", "httpMethod": "POST", - "description": "Creates a new remarketing audiences.", + "description": "Creates a new remarketing audience.", "parameters": { "accountId": { "type": "string", - "description": "Account ID to create the remarketing audience for.", + "description": "The account ID for which to create the remarketing audience.", "required": true, "location": "path" }, "webPropertyId": { "type": "string", - "description": "Web property ID to create the remarketing audience for.", + "description": "Web property ID for which to create the remarketing audience.", "required": true, "location": "path" } @@ -6018,7 +6023,7 @@ "parameters": { "accountId": { "type": "string", - "description": "Account ID for the remarketing audience to retrieve.", + "description": "The account ID of the remarketing audiences to retrieve.", "required": true, "location": "path" }, @@ -6042,7 +6047,7 @@ }, "webPropertyId": { "type": "string", - "description": "Web property ID for the remarketing audience to retrieve.", + "description": "The web property ID of the remarketing audiences to retrieve.", "required": true, "location": "path" } @@ -6063,23 +6068,23 @@ "id": "analytics.management.remarketingAudience.patch", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/remarketingAudiences/{remarketingAudienceId}", "httpMethod": "PATCH", - "description": "Updates an existing remarketing audiences. This method supports patch semantics.", + "description": "Updates an existing remarketing audience. This method supports patch semantics.", "parameters": { "accountId": { "type": "string", - "description": "Account ID for the remarketing audience to update.", + "description": "The account ID of the remarketing audience to update.", "required": true, "location": "path" }, "remarketingAudienceId": { "type": "string", - "description": "Remarketing audience ID of the remarketing audience to update.", + "description": "The ID of the remarketing audience to update.", "required": true, "location": "path" }, "webPropertyId": { "type": "string", - "description": "Web property ID for the remarketing audience to update.", + "description": "The web property ID of the remarketing audience to update.", "required": true, "location": "path" } @@ -6103,23 +6108,23 @@ "id": "analytics.management.remarketingAudience.update", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/remarketingAudiences/{remarketingAudienceId}", "httpMethod": "PUT", - "description": "Updates an existing remarketing audiences.", + "description": "Updates an existing remarketing audience.", "parameters": { "accountId": { "type": "string", - "description": "Account ID for the remarketing audience to update.", + "description": "The account ID of the remarketing audience to update.", "required": true, "location": "path" }, "remarketingAudienceId": { "type": "string", - "description": "Remarketing audience ID of the remarketing audience to update.", + "description": "The ID of the remarketing audience to update.", "required": true, "location": "path" }, "webPropertyId": { "type": "string", - "description": "Web property ID for the remarketing audience to update.", + "description": "The web property ID of the remarketing audience to update.", "required": true, "location": "path" } diff --git a/etc/api/analyticsreporting/v4/analyticsreporting-api.json b/etc/api/analyticsreporting/v4/analyticsreporting-api.json index e69de29bb2..3cfc263123 100644 --- a/etc/api/analyticsreporting/v4/analyticsreporting-api.json +++ b/etc/api/analyticsreporting/v4/analyticsreporting-api.json @@ -0,0 +1,1163 @@ +{ + "id": "analyticsreporting:v4", + "auth": { + "oauth2": { + "scopes": { + "https://www.googleapis.com/auth/analytics.readonly": { + "description": "View your Google Analytics data" + }, + "https://www.googleapis.com/auth/analytics": { + "description": "View and manage your Google Analytics data" + } + } + } + }, + "description": "Accesses Analytics report data.", + "protocol": "rest", + "title": "Google Analytics Reporting API", + "resources": { + "reports": { + "methods": { + "batchGet": { + "id": "analyticsreporting.reports.batchGet", + "response": { + "$ref": "GetReportsResponse" + }, + "parameterOrder": [], + "description": "Returns the Analytics data.", + "request": { + "$ref": "GetReportsRequest" + }, + "flatPath": "v4/reports:batchGet", + "httpMethod": "POST", + "parameters": {}, + "path": "v4/reports:batchGet", + "scopes": [ + "https://www.googleapis.com/auth/analytics", + "https://www.googleapis.com/auth/analytics.readonly" + ] + } + } + } + }, + "schemas": { + "PivotHeader": { + "description": "The headers for each of the pivot sections defined in the request.", + "type": "object", + "properties": { + "totalPivotGroupsCount": { + "description": "The total number of groups for this pivot.", + "type": "integer", + "format": "int32" + }, + "pivotHeaderEntries": { + "description": "A single pivot section header.", + "type": "array", + "items": { + "$ref": "PivotHeaderEntry" + } + } + }, + "id": "PivotHeader" + }, + "Metric": { + "description": "[Metrics](https://support.google.com/analytics/answer/1033861)\nare the quantitative measurements. For example, the metric `ga:users`\nindicates the total number of users for the requested time period.", + "type": "object", + "properties": { + "alias": { + "description": "An alias for the metric expression is an alternate name for the\nexpression. The alias can be used for filtering and sorting. This field\nis optional and is useful if the expression is not a single metric but\na complex expression which cannot be used in filtering and sorting.\nThe alias is also used in the response column header.", + "type": "string" + }, + "formattingType": { + "description": "Specifies how the metric expression should be formatted, for example\n`INTEGER`.", + "enum": [ + "METRIC_TYPE_UNSPECIFIED", + "INTEGER", + "FLOAT", + "CURRENCY", + "PERCENT", + "TIME" + ], + "enumDescriptions": [ + "Metric type is unspecified.", + "Integer metric.", + "Float metric.", + "Currency metric.", + "Percentage metric.", + "Time metric in `HH:MM:SS` format." + ], + "type": "string" + }, + "expression": { + "description": "A metric expression in the request. An expression is constructed from one\nor more metrics and numbers. Accepted operators include: Plus (+), Minus\n(-), Negation (Unary -), Divided by (/), Multiplied by (*), Parenthesis,\nPositive cardinal numbers (0-9), can include decimals and is limited to\n1024 characters. Example `ga:totalRefunds/ga:users`, in most cases the\nmetric expression is just a single metric name like `ga:users`.\nAdding mixed `MetricType` (E.g., `CURRENCY` + `PERCENTAGE`) metrics\nwill result in unexpected results.", + "type": "string" + } + }, + "id": "Metric" + }, + "ColumnHeader": { + "description": "Column headers.", + "type": "object", + "properties": { + "dimensions": { + "description": "The dimension names in the response.", + "type": "array", + "items": { + "type": "string" + } + }, + "metricHeader": { + "description": "Metric headers for the metrics in the response.", + "$ref": "MetricHeader" + } + }, + "id": "ColumnHeader" + }, + "DynamicSegment": { + "description": "Dynamic segment definition for defining the segment within the request.\nA segment can select users, sessions or both.", + "type": "object", + "properties": { + "sessionSegment": { + "description": "Session Segment to select sessions to include in the segment.", + "$ref": "SegmentDefinition" + }, + "name": { + "description": "The name of the dynamic segment.", + "type": "string" + }, + "userSegment": { + "description": "User Segment to select users to include in the segment.", + "$ref": "SegmentDefinition" + } + }, + "id": "DynamicSegment" + }, + "MetricHeader": { + "description": "The headers for the metrics.", + "type": "object", + "properties": { + "metricHeaderEntries": { + "description": "Headers for the metrics in the response.", + "type": "array", + "items": { + "$ref": "MetricHeaderEntry" + } + }, + "pivotHeaders": { + "description": "Headers for the pivots in the response.", + "type": "array", + "items": { + "$ref": "PivotHeader" + } + } + }, + "id": "MetricHeader" + }, + "Report": { + "description": "The data response corresponding to the request.", + "type": "object", + "properties": { + "columnHeader": { + "description": "The column headers.", + "$ref": "ColumnHeader" + }, + "data": { + "description": "Response data.", + "$ref": "ReportData" + }, + "nextPageToken": { + "description": "Page token to retrieve the next page of results in the list.", + "type": "string" + } + }, + "id": "Report" + }, + "SegmentFilterClause": { + "description": "Filter Clause to be used in a segment definition, can be wither a metric or\na dimension filter.", + "type": "object", + "properties": { + "dimensionFilter": { + "description": "Dimension Filter for the segment definition.", + "$ref": "SegmentDimensionFilter" + }, + "metricFilter": { + "description": "Metric Filter for the segment definition.", + "$ref": "SegmentMetricFilter" + }, + "not": { + "description": "Matches the complement (`!`) of the filter.", + "type": "boolean" + } + }, + "id": "SegmentFilterClause" + }, + "DimensionFilter": { + "description": "Dimension filter specifies the filtering options on a dimension.", + "type": "object", + "properties": { + "dimensionName": { + "description": "The dimension to filter on. A DimensionFilter must contain a dimension.", + "type": "string" + }, + "operator": { + "description": "How to match the dimension to the expression. The default is REGEXP.", + "enum": [ + "OPERATOR_UNSPECIFIED", + "REGEXP", + "BEGINS_WITH", + "ENDS_WITH", + "PARTIAL", + "EXACT", + "NUMERIC_EQUAL", + "NUMERIC_GREATER_THAN", + "NUMERIC_LESS_THAN", + "IN_LIST" + ], + "enumDescriptions": [ + "If the match type is unspecified, it is treated as a `REGEXP`.", + "The match expression is treated as a regular expression. All match types\nare not treated as regular expressions.", + "Matches the value which begin with the match expression provided.", + "Matches the values which end with the match expression provided.", + "Substring match.", + "The value should match the match expression entirely.", + "Integer comparison filters.\ncase sensitivity is ignored for these and the expression\nis assumed to be a string representing an integer.\nFailure conditions:\n\n- If expression is not a valid int64, the client should expect\n an error.\n- Input dimensions that are not valid int64 values will never match the\n filter.", + "Checks if the dimension is numerically greater than the match\nexpression. Read the description for `NUMERIC_EQUALS` for restrictions.", + "Checks if the dimension is numerically less than the match expression.\nRead the description for `NUMERIC_EQUALS` for restrictions.", + "This option is used to specify a dimension filter whose expression can\ntake any value from a selected list of values. This helps avoiding\nevaluating multiple exact match dimension filters which are OR'ed for\nevery single response row. For example:\n\n expressions: [\"A\", \"B\", \"C\"]\n\nAny response row whose dimension has it is value as A, B or C, matches\nthis DimensionFilter." + ], + "type": "string" + }, + "caseSensitive": { + "description": "Should the match be case sensitive? Default is false.", + "type": "boolean" + }, + "expressions": { + "description": "Strings or regular expression to match against. Only the first value of\nthe list is used for comparison unless the operator is `IN_LIST`.\nIf `IN_LIST` operator, then the entire list is used to filter the\ndimensions as explained in the description of the `IN_LIST` operator.", + "type": "array", + "items": { + "type": "string" + } + }, + "not": { + "description": "Logical `NOT` operator. If this boolean is set to true, then the matching\ndimension values will be excluded in the report. The default is false.", + "type": "boolean" + } + }, + "id": "DimensionFilter" + }, + "SegmentDimensionFilter": { + "description": "Dimension filter specifies the filtering options on a dimension.", + "type": "object", + "properties": { + "maxComparisonValue": { + "description": "Maximum comparison values for `BETWEEN` match type.", + "type": "string" + }, + "dimensionName": { + "description": "Name of the dimension for which the filter is being applied.", + "type": "string" + }, + "caseSensitive": { + "description": "Should the match be case sensitive, ignored for `IN_LIST` operator.", + "type": "boolean" + }, + "operator": { + "description": "The operator to use to match the dimension with the expressions.", + "enum": [ + "OPERATOR_UNSPECIFIED", + "REGEXP", + "BEGINS_WITH", + "ENDS_WITH", + "PARTIAL", + "EXACT", + "IN_LIST", + "NUMERIC_LESS_THAN", + "NUMERIC_GREATER_THAN", + "NUMERIC_BETWEEN" + ], + "enumDescriptions": [ + "If the match type is unspecified, it is treated as a REGEXP.", + "The match expression is treated as a regular expression. All other match\ntypes are not treated as regular expressions.", + "Matches the values which begin with the match expression provided.", + "Matches the values which end with the match expression provided.", + "Substring match.", + "The value should match the match expression entirely.", + "This option is used to specify a dimension filter whose expression can\ntake any value from a selected list of values. This helps avoiding\nevaluating multiple exact match dimension filters which are OR'ed for\nevery single response row. For example:\n\n expressions: [\"A\", \"B\", \"C\"]\n\nAny response row whose dimension has it is value as A, B or C, matches\nthis DimensionFilter.", + "Integer comparison filters.\ncase sensitivity is ignored for these and the expression\nis assumed to be a string representing an integer.\nFailure conditions:\n\n- if expression is not a valid int64, the client should expect\n an error.\n- input dimensions that are not valid int64 values will never match the\n filter.\n\nChecks if the dimension is numerically less than the match expression.", + "Checks if the dimension is numerically greater than the match\nexpression.", + "Checks if the dimension is numerically between the minimum and maximum\nof the match expression, boundaries excluded." + ], + "type": "string" + }, + "expressions": { + "description": "The list of expressions, only the first element is used for all operators", + "type": "array", + "items": { + "type": "string" + } + }, + "minComparisonValue": { + "description": "Minimum comparison values for `BETWEEN` match type.", + "type": "string" + } + }, + "id": "SegmentDimensionFilter" + }, + "ReportRequest": { + "description": "The main request class which specifies the Reporting API request.", + "type": "object", + "properties": { + "cohortGroup": { + "description": "Cohort group associated with this request. If there is a cohort group\nin the request the `ga:cohort` dimension must be present.\nEvery [ReportRequest](#ReportRequest) within a `batchGet` method must\ncontain the same `cohortGroup` definition.", + "$ref": "CohortGroup" + }, + "dimensions": { + "description": "The dimensions requested.\nRequests can have a total of 7 dimensions.", + "type": "array", + "items": { + "$ref": "Dimension" + } + }, + "metricFilterClauses": { + "description": "The metric filter clauses. They are logically combined with the `AND`\noperator. Metric filters look at only the first date range and not the\ncomparing date range. Note that filtering on metrics occurs after the\nmetrics are aggregated.", + "type": "array", + "items": { + "$ref": "MetricFilterClause" + } + }, + "hideTotals": { + "description": "If set to true, hides the total of all metrics for all the matching rows,\nfor every date range. The default false and will return the totals.", + "type": "boolean" + }, + "includeEmptyRows": { + "description": "If set to false, the response does not include rows if all the retrieved\nmetrics are equal to zero. The default is false which will exclude these\nrows.", + "type": "boolean" + }, + "dimensionFilterClauses": { + "description": "The dimension filter clauses for filtering Dimension Values. They are\nlogically combined with the `AND` operator. Note that filtering occurs\nbefore any dimensions are aggregated, so that the returned metrics\nrepresent the total for only the relevant dimensions.", + "type": "array", + "items": { + "$ref": "DimensionFilterClause" + } + }, + "pivots": { + "description": "The pivot definitions. Requests can have a maximum of 2 pivots.", + "type": "array", + "items": { + "$ref": "Pivot" + } + }, + "dateRanges": { + "description": "Date ranges in the request. The request can have a maximum of 2 date\nranges. The response will contain a set of metric values for each\ncombination of the dimensions for each date range in the request. So, if\nthere are two date ranges, there will be two set of metric values, one for\nthe original date range and one for the second date range.\nThe `reportRequest.dateRanges` field should not be specified for cohorts\nor Lifetime value requests.\nIf a date range is not provided, the default date range is (startDate:\ncurrent date - 7 days, endDate: current date - 1 day). Every\n[ReportRequest](#ReportRequest) within a `batchGet` method must\ncontain the same `dateRanges` definition.", + "type": "array", + "items": { + "$ref": "DateRange" + } + }, + "segments": { + "description": "Segment the data returned for the request. A segment definition helps look\nat a subset of the segment request. A request can contain up to four\nsegments. Every [ReportRequest](#ReportRequest) within a\n`batchGet` method must contain the same `segments` definition. Requests\nwith segments must have the `ga:segment` dimension.", + "type": "array", + "items": { + "$ref": "Segment" + } + }, + "samplingLevel": { + "description": "The desired report\n[sample](https://support.google.com/analytics/answer/2637192) size.\nIf the the `samplingLevel` field is unspecified the `DEFAULT` sampling\nlevel is used. Every [ReportRequest](#ReportRequest) within a\n`batchGet` method must contain the same `samplingLevel` definition. See\n[developer guide](/analytics/devguides/reporting/core/v4/basics#sampling)\n for details.", + "enum": [ + "SAMPLING_UNSPECIFIED", + "DEFAULT", + "SMALL", + "LARGE" + ], + "enumDescriptions": [ + "If the `samplingLevel` field is unspecified the `DEFAULT` sampling level\nis used.", + "Returns response with a sample size that balances speed and\naccuracy.", + "It returns a fast response with a smaller sampling size.", + "Returns a more accurate response using a large sampling size. But this\nmay result in response being slower." + ], + "type": "string" + }, + "metrics": { + "description": "The metrics requested.\nRequests must specify at least one metric. Requests can have a\ntotal of 10 metrics.", + "type": "array", + "items": { + "$ref": "Metric" + } + }, + "pageSize": { + "description": "Page size is for paging and specifies the maximum number of returned rows.\nPage size should be \u003e= 0. A query returns the default of 1,000 rows.\nThe Analytics Core Reporting API returns a maximum of 10,000 rows per\nrequest, no matter how many you ask for. It can also return fewer rows\nthan requested, if there aren't as many dimension segments as you expect.\nFor instance, there are fewer than 300 possible values for `ga:country`,\nso when segmenting only by country, you can't get more than 300 rows,\neven if you set `pageSize` to a higher value.", + "type": "integer", + "format": "int32" + }, + "orderBys": { + "description": "Sort order on output rows. To compare two rows, the elements of the\nfollowing are applied in order until a difference is found. All date\nranges in the output get the same row order.", + "type": "array", + "items": { + "$ref": "OrderBy" + } + }, + "filtersExpression": { + "description": "Dimension or metric filters that restrict the data returned for your\nrequest. To use the `filtersExpression`, supply a dimension or metric on\nwhich to filter, followed by the filter expression. For example, the\nfollowing expression selects `ga:browser` dimension which starts with\nFirefox; `ga:browser=~^Firefox`. For more information on dimensions\nand metric filters, see\n[Filters reference](https://developers.google.com/analytics/devguides/reporting/core/v3/reference#filters).", + "type": "string" + }, + "hideValueRanges": { + "description": "If set to true, hides the minimum and maximum across all matching rows.\nThe default is false and the value ranges are returned.", + "type": "boolean" + }, + "viewId": { + "description": "The Analytics\n[view ID](https://support.google.com/analytics/answer/1009618)\nfrom which to retrieve data. Every [ReportRequest](#ReportRequest)\nwithin a `batchGet` method must contain the same `viewId`.", + "type": "string" + }, + "pageToken": { + "description": "A continuation token to get the next page of the results. Adding this to\nthe request will return the rows after the pageToken. The pageToken should\nbe the value returned in the nextPageToken parameter in the response to\nthe GetReports request.", + "type": "string" + } + }, + "id": "ReportRequest" + }, + "SimpleSegment": { + "description": "A Simple segment conditions consist of one or more dimension/metric\nconditions that can be combined.", + "type": "object", + "properties": { + "orFiltersForSegment": { + "description": "A list of segment filters groups which are combined with logical `AND`\noperator.", + "type": "array", + "items": { + "$ref": "OrFiltersForSegment" + } + } + }, + "id": "SimpleSegment" + }, + "SegmentDefinition": { + "description": "SegmentDefinition defines the segment to be a set of SegmentFilters which\nare combined together with a logical `AND` operation.", + "type": "object", + "properties": { + "segmentFilters": { + "description": "A segment is defined by a set of segment filters which are combined\ntogether with a logical `AND` operation.", + "type": "array", + "items": { + "$ref": "SegmentFilter" + } + } + }, + "id": "SegmentDefinition" + }, + "SegmentMetricFilter": { + "description": "Metric filter to be used in a segment filter clause.", + "type": "object", + "properties": { + "metricName": { + "description": "The metric that will be filtered on. A `metricFilter` must contain a\nmetric name.", + "type": "string" + }, + "operator": { + "description": "Specifies is the operation to perform to compare the metric. The default\nis `EQUAL`.", + "enum": [ + "UNSPECIFIED_OPERATOR", + "LESS_THAN", + "GREATER_THAN", + "EQUAL", + "BETWEEN" + ], + "enumDescriptions": [ + "Unspecified operator is treated as `LESS_THAN` operator.", + "Checks if the metric value is less than comparison value.", + "Checks if the metric value is greater than comparison value.", + "Equals operator.", + "For between operator, both the minimum and maximum are exclusive.\nWe will use `LT` and `GT` for comparison." + ], + "type": "string" + }, + "comparisonValue": { + "description": "The value to compare against. If the operator is `BETWEEN`, this value is\ntreated as minimum comparison value.", + "type": "string" + }, + "scope": { + "description": "Scope for a metric defines the level at which that metric is defined. The\nspecified metric scope must be equal to or greater than its primary scope\nas defined in the data model. The primary scope is defined by if the\nsegment is selecting users or sessions.", + "enum": [ + "UNSPECIFIED_SCOPE", + "PRODUCT", + "HIT", + "SESSION", + "USER" + ], + "enumDescriptions": [ + "If the scope is unspecified, it defaults to the condition scope,\n`USER` or `SESSION` depending on if the segment is trying to choose\nusers or sessions.", + "Product scope.", + "Hit scope.", + "Session scope.", + "User scope." + ], + "type": "string" + }, + "maxComparisonValue": { + "description": "Max comparison value is only used for `BETWEEN` operator.", + "type": "string" + } + }, + "id": "SegmentMetricFilter" + }, + "ReportData": { + "description": "The data part of the report.", + "type": "object", + "properties": { + "rowCount": { + "description": "Total number of matching rows for this query.", + "type": "integer", + "format": "int32" + }, + "samplingSpaceSizes": { + "description": "If the results are\n[sampled](https://support.google.com/analytics/answer/2637192),\nthis returns the total number of\nsamples present, one entry per date range. If the results are not sampled\nthis field will not be defined. See\n[developer guide](/analytics/devguides/reporting/core/v4/basics#sampling)\nfor details.", + "type": "array", + "items": { + "type": "string", + "format": "int64" + } + }, + "maximums": { + "description": "Minimum and maximum values seen over all matching rows. These are both\nempty when `hideValueRanges` in the request is false, or when\nrowCount is zero.", + "type": "array", + "items": { + "$ref": "DateRangeValues" + } + }, + "samplesReadCounts": { + "description": "If the results are\n[sampled](https://support.google.com/analytics/answer/2637192),\nthis returns the total number of samples read, one entry per date range.\nIf the results are not sampled this field will not be defined. See\n[developer guide](/analytics/devguides/reporting/core/v4/basics#sampling)\nfor details.", + "type": "array", + "items": { + "type": "string", + "format": "int64" + } + }, + "minimums": { + "description": "Minimum and maximum values seen over all matching rows. These are both\nempty when `hideValueRanges` in the request is false, or when\nrowCount is zero.", + "type": "array", + "items": { + "$ref": "DateRangeValues" + } + }, + "rows": { + "description": "There's one ReportRow for every unique combination of dimensions.", + "type": "array", + "items": { + "$ref": "ReportRow" + } + }, + "dataLastRefreshed": { + "description": "The last time the data in the report was refreshed. All the hits received\nbefore this timestamp are included in the calculation of the report.", + "type": "string", + "format": "google-datetime" + }, + "totals": { + "description": "For each requested date range, for the set of all rows that match\nthe query, every requested value format gets a total. The total\nfor a value format is computed by first totaling the metrics\nmentioned in the value format and then evaluating the value\nformat as a scalar expression. E.g., The \"totals\" for\n`3 / (ga:sessions + 2)` we compute\n`3 / ((sum of all relevant ga:sessions) + 2)`.\nTotals are computed before pagination.", + "type": "array", + "items": { + "$ref": "DateRangeValues" + } + }, + "isDataGolden": { + "description": "Indicates if response to this request is golden or not. Data is\ngolden when the exact same request will not produce any new results if\nasked at a later point in time.", + "type": "boolean" + } + }, + "id": "ReportData" + }, + "GetReportsRequest": { + "description": "The batch request containing multiple report request.", + "type": "object", + "properties": { + "reportRequests": { + "description": "Requests, each request will have a separate response.\nThere can be a maximum of 5 requests. All requests should have the same\n`dateRanges`, `viewId`, `segments`, `samplingLevel`, and `cohortGroup`.", + "type": "array", + "items": { + "$ref": "ReportRequest" + } + } + }, + "id": "GetReportsRequest" + }, + "OrderBy": { + "description": "Specifies the sorting options.", + "type": "object", + "properties": { + "sortOrder": { + "description": "The sorting order for the field.", + "enum": [ + "SORT_ORDER_UNSPECIFIED", + "ASCENDING", + "DESCENDING" + ], + "enumDescriptions": [ + "If the sort order is unspecified, the default is ascending.", + "Ascending sort. The field will be sorted in an ascending manner.", + "Descending sort. The field will be sorted in a descending manner." + ], + "type": "string" + }, + "orderType": { + "description": "The order type. The default orderType is `VALUE`.", + "enum": [ + "ORDER_TYPE_UNSPECIFIED", + "VALUE", + "DELTA", + "SMART", + "HISTOGRAM_BUCKET", + "DIMENSION_AS_INTEGER" + ], + "enumDescriptions": [ + "Unspecified order type will be treated as sort based on value.", + "The sort order is based on the value of the chosen column; looks only at\nthe first date range.", + "The sort order is based on the difference of the values of the chosen\ncolumn between the first two date ranges. Usable only if there are\nexactly two date ranges.", + "The sort order is based on weighted value of the chosen column. If\ncolumn has n/d format, then weighted value of this ratio will\nbe `(n + totals.n)/(d + totals.d)` Usable only for metrics that\nrepresent ratios.", + "Histogram order type is applicable only to dimension columns with\nnon-empty histogram-buckets.", + "If the dimensions are fixed length numbers, ordinary sort would just\nwork fine. `DIMENSION_AS_INTEGER` can be used if the dimensions are\nvariable length numbers." + ], + "type": "string" + }, + "fieldName": { + "description": "The field which to sort by. The default sort order is ascending. Example:\n`ga:browser`.\nNote, that you can only specify one field for sort here. For example,\n`ga:browser, ga:city` is not valid.", + "type": "string" + } + }, + "id": "OrderBy" + }, + "Cohort": { + "description": "Defines a cohort. A cohort is a group of users who share a common\ncharacteristic. For example, all users with the same acquisition date\nbelong to the same cohort.", + "type": "object", + "properties": { + "type": { + "description": "Type of the cohort. The only supported type as of now is\n`FIRST_VISIT_DATE`. If this field is unspecified the cohort is treated\nas `FIRST_VISIT_DATE` type cohort.", + "enum": [ + "UNSPECIFIED_COHORT_TYPE", + "FIRST_VISIT_DATE" + ], + "enumDescriptions": [ + "If unspecified it's treated as `FIRST_VISIT_DATE`.", + "Cohorts that are selected based on first visit date." + ], + "type": "string" + }, + "dateRange": { + "description": "This is used for `FIRST_VISIT_DATE` cohort, the cohort selects users\nwhose first visit date is between start date and end date defined in the\nDateRange. The date ranges should be aligned for cohort requests. If the\nrequest contains `ga:cohortNthDay` it should be exactly one day long,\nif `ga:cohortNthWeek` it should be aligned to the week boundary (starting\nat Sunday and ending Saturday), and for `ga:cohortNthMonth` the date range\nshould be aligned to the month (starting at the first and ending on the\nlast day of the month).\nFor LTV requests there are no such restrictions.\nYou do not need to supply a date range for the\n`reportsRequest.dateRanges` field.", + "$ref": "DateRange" + }, + "name": { + "description": "A unique name for the cohort. If not defined name will be auto-generated\nwith values cohort_[1234...].", + "type": "string" + } + }, + "id": "Cohort" + }, + "OrFiltersForSegment": { + "description": "A list of segment filters in the `OR` group are combined with the logical OR\noperator.", + "type": "object", + "properties": { + "segmentFilterClauses": { + "description": "List of segment filters to be combined with a `OR` operator.", + "type": "array", + "items": { + "$ref": "SegmentFilterClause" + } + } + }, + "id": "OrFiltersForSegment" + }, + "SequenceSegment": { + "description": "Sequence conditions consist of one or more steps, where each step is defined\nby one or more dimension/metric conditions. Multiple steps can be combined\nwith special sequence operators.", + "type": "object", + "properties": { + "firstStepShouldMatchFirstHit": { + "description": "If set, first step condition must match the first hit of the visitor (in\nthe date range).", + "type": "boolean" + }, + "segmentSequenceSteps": { + "description": "The list of steps in the sequence.", + "type": "array", + "items": { + "$ref": "SegmentSequenceStep" + } + } + }, + "id": "SequenceSegment" + }, + "SegmentFilter": { + "description": "SegmentFilter defines the segment to be either a simple or a sequence\nsegment. A simple segment condition contains dimension and metric conditions\nto select the sessions or users. A sequence segment condition can be used to\nselect users or sessions based on sequential conditions.", + "type": "object", + "properties": { + "sequenceSegment": { + "description": "Sequence conditions consist of one or more steps, where each step is\ndefined by one or more dimension/metric conditions. Multiple steps can\nbe combined with special sequence operators.", + "$ref": "SequenceSegment" + }, + "not": { + "description": "If true, match the complement of simple or sequence segment.\nFor example, to match all visits not from \"New York\", we can define the\nsegment as follows:\n\n \"sessionSegment\": {\n \"segmentFilters\": [{\n \"simpleSegment\" :{\n \"orFiltersForSegment\": [{\n \"segmentFilterClauses\":[{\n \"dimensionFilter\": {\n \"dimensionName\": \"ga:city\",\n \"expressions\": [\"New York\"]\n }\n }]\n }]\n },\n \"not\": \"True\"\n }]\n },", + "type": "boolean" + }, + "simpleSegment": { + "description": "A Simple segment conditions consist of one or more dimension/metric\nconditions that can be combined", + "$ref": "SimpleSegment" + } + }, + "id": "SegmentFilter" + }, + "PivotHeaderEntry": { + "description": "The headers for the each of the metric column corresponding to the metrics\nrequested in the pivots section of the response.", + "type": "object", + "properties": { + "dimensionNames": { + "description": "The name of the dimensions in the pivot response.", + "type": "array", + "items": { + "type": "string" + } + }, + "dimensionValues": { + "description": "The values for the dimensions in the pivot.", + "type": "array", + "items": { + "type": "string" + } + }, + "metric": { + "description": "The metric header for the metric in the pivot.", + "$ref": "MetricHeaderEntry" + } + }, + "id": "PivotHeaderEntry" + }, + "DimensionFilterClause": { + "description": "A group of dimension filters. Set the operator value to specify how\nthe filters are logically combined.", + "type": "object", + "properties": { + "operator": { + "description": "The operator for combining multiple dimension filters. If unspecified, it\nis treated as an `OR`.", + "enum": [ + "OPERATOR_UNSPECIFIED", + "OR", + "AND" + ], + "enumDescriptions": [ + "Unspecified operator. It is treated as an `OR`.", + "The logical `OR` operator.", + "The logical `AND` operator." + ], + "type": "string" + }, + "filters": { + "description": "The repeated set of filters. They are logically combined based on the\noperator specified.", + "type": "array", + "items": { + "$ref": "DimensionFilter" + } + } + }, + "id": "DimensionFilterClause" + }, + "SegmentSequenceStep": { + "description": "A segment sequence definition.", + "type": "object", + "properties": { + "matchType": { + "description": "Specifies if the step immediately precedes or can be any time before the\nnext step.", + "enum": [ + "UNSPECIFIED_MATCH_TYPE", + "PRECEDES", + "IMMEDIATELY_PRECEDES" + ], + "enumDescriptions": [ + "Unspecified match type is treated as precedes.", + "Operator indicates that the previous step precedes the next step.", + "Operator indicates that the previous step immediately precedes the next\nstep." + ], + "type": "string" + }, + "orFiltersForSegment": { + "description": "A sequence is specified with a list of Or grouped filters which are\ncombined with `AND` operator.", + "type": "array", + "items": { + "$ref": "OrFiltersForSegment" + } + } + }, + "id": "SegmentSequenceStep" + }, + "Pivot": { + "description": "The Pivot describes the pivot section in the request.\nThe Pivot helps rearrange the information in the table for certain reports\nby pivoting your data on a second dimension.", + "type": "object", + "properties": { + "dimensions": { + "description": "A list of dimensions to show as pivot columns. A Pivot can have a maximum\nof 4 dimensions. Pivot dimensions are part of the restriction on the\ntotal number of dimensions allowed in the request.", + "type": "array", + "items": { + "$ref": "Dimension" + } + }, + "metrics": { + "description": "The pivot metrics. Pivot metrics are part of the\nrestriction on total number of metrics allowed in the request.", + "type": "array", + "items": { + "$ref": "Metric" + } + }, + "maxGroupCount": { + "description": "Specifies the maximum number of groups to return.\nThe default value is 10, also the maximum value is 1,000.", + "type": "integer", + "format": "int32" + }, + "dimensionFilterClauses": { + "description": "DimensionFilterClauses are logically combined with an `AND` operator: only\ndata that is included by all these DimensionFilterClauses contributes to\nthe values in this pivot region. Dimension filters can be used to restrict\nthe columns shown in the pivot region. For example if you have\n`ga:browser` as the requested dimension in the pivot region, and you\nspecify key filters to restrict `ga:browser` to only \"IE\" or \"Firefox\",\nthen only those two browsers would show up as columns.", + "type": "array", + "items": { + "$ref": "DimensionFilterClause" + } + }, + "startGroup": { + "description": "If k metrics were requested, then the response will contain some\ndata-dependent multiple of k columns in the report. E.g., if you pivoted\non the dimension `ga:browser` then you'd get k columns for \"Firefox\", k\ncolumns for \"IE\", k columns for \"Chrome\", etc. The ordering of the groups\nof columns is determined by descending order of \"total\" for the first of\nthe k values. Ties are broken by lexicographic ordering of the first\npivot dimension, then lexicographic ordering of the second pivot\ndimension, and so on. E.g., if the totals for the first value for\nFirefox, IE, and Chrome were 8, 2, 8, respectively, the order of columns\nwould be Chrome, Firefox, IE.\n\nThe following let you choose which of the groups of k columns are\nincluded in the response.", + "type": "integer", + "format": "int32" + } + }, + "id": "Pivot" + }, + "DateRangeValues": { + "description": "Used to return a list of metrics for a single DateRange / dimension\ncombination", + "type": "object", + "properties": { + "values": { + "description": "Each value corresponds to each Metric in the request.", + "type": "array", + "items": { + "type": "string" + } + }, + "pivotValueRegions": { + "description": "The values of each pivot region.", + "type": "array", + "items": { + "$ref": "PivotValueRegion" + } + } + }, + "id": "DateRangeValues" + }, + "MetricFilterClause": { + "description": "Represents a group of metric filters.\nSet the operator value to specify how the filters are logically combined.", + "type": "object", + "properties": { + "operator": { + "description": "The operator for combining multiple metric filters. If unspecified, it is\ntreated as an `OR`.", + "enum": [ + "OPERATOR_UNSPECIFIED", + "OR", + "AND" + ], + "enumDescriptions": [ + "Unspecified operator. It is treated as an `OR`.", + "The logical `OR` operator.", + "The logical `AND` operator." + ], + "type": "string" + }, + "filters": { + "description": "The repeated set of filters. They are logically combined based on the\noperator specified.", + "type": "array", + "items": { + "$ref": "MetricFilter" + } + } + }, + "id": "MetricFilterClause" + }, + "Segment": { + "description": "The segment definition, if the report needs to be segmented.\nA Segment is a subset of the Analytics data. For example, of the entire\nset of users, one Segment might be users from a particular country or city.", + "type": "object", + "properties": { + "dynamicSegment": { + "description": "A dynamic segment definition in the request.", + "$ref": "DynamicSegment" + }, + "segmentId": { + "description": "The segment ID of a built-in or custom segment, for example `gaid::-3`.", + "type": "string" + } + }, + "id": "Segment" + }, + "DateRange": { + "description": "A contiguous set of days: startDate, startDate + 1 day, ..., endDate.\nThe start and end dates are specified in\n[ISO8601](https://en.wikipedia.org/wiki/ISO_8601) date format `YYYY-MM-DD`.", + "type": "object", + "properties": { + "startDate": { + "description": "The start date for the query in the format `YYYY-MM-DD`.", + "type": "string" + }, + "endDate": { + "description": "The end date for the query in the format `YYYY-MM-DD`.", + "type": "string" + } + }, + "id": "DateRange" + }, + "ReportRow": { + "description": "A row in the report.", + "type": "object", + "properties": { + "dimensions": { + "description": "List of requested dimensions.", + "type": "array", + "items": { + "type": "string" + } + }, + "metrics": { + "description": "List of metrics for each requested DateRange.", + "type": "array", + "items": { + "$ref": "DateRangeValues" + } + } + }, + "id": "ReportRow" + }, + "CohortGroup": { + "description": "Defines a cohort group.\nFor example:\n\n \"cohortGroup\": {\n \"cohorts\": [{\n \"name\": \"cohort 1\",\n \"type\": \"FIRST_VISIT_DATE\",\n \"dateRange\": { \"startDate\": \"2015-08-01\", \"endDate\": \"2015-08-01\" }\n },{\n \"name\": \"cohort 2\"\n \"type\": \"FIRST_VISIT_DATE\"\n \"dateRange\": { \"startDate\": \"2015-07-01\", \"endDate\": \"2015-07-01\" }\n }]\n }", + "type": "object", + "properties": { + "lifetimeValue": { + "description": "Enable Life Time Value (LTV). LTV measures lifetime value for users\nacquired through different channels.\nPlease see:\n[Cohort Analysis](https://support.google.com/analytics/answer/6074676) and\n[Lifetime Value](https://support.google.com/analytics/answer/6182550)\nIf the value of lifetimeValue is false:\n\n- The metric values are similar to the values in the web interface cohort\n report.\n- The cohort definition date ranges must be aligned to the calendar week\n and month. i.e. while requesting `ga:cohortNthWeek` the `startDate` in\n the cohort definition should be a Sunday and the `endDate` should be the\n following Saturday, and for `ga:cohortNthMonth`, the `startDate`\n should be the 1st of the month and `endDate` should be the last day\n of the month.\n\nWhen the lifetimeValue is true:\n\n- The metric values will correspond to the values in the web interface\n LifeTime value report.\n- The Lifetime Value report shows you how user value (Revenue) and\n engagement (Appviews, Goal Completions, Sessions, and Session Duration)\n grow during the 90 days after a user is acquired.\n- The metrics are calculated as a cumulative average per user per the time\n increment.\n- The cohort definition date ranges need not be aligned to the calendar\n week and month boundaries.\n- The `viewId` must be an\n [app view ID](https://support.google.com/analytics/answer/2649553#WebVersusAppViews)", + "type": "boolean" + }, + "cohorts": { + "description": "The definition for the cohort.", + "type": "array", + "items": { + "$ref": "Cohort" + } + } + }, + "id": "CohortGroup" + }, + "GetReportsResponse": { + "description": "The main response class which holds the reports from the Reporting API\n`batchGet` call.", + "type": "object", + "properties": { + "reports": { + "description": "Responses corresponding to each of the request.", + "type": "array", + "items": { + "$ref": "Report" + } + } + }, + "id": "GetReportsResponse" + }, + "MetricHeaderEntry": { + "description": "Header for the metrics.", + "type": "object", + "properties": { + "type": { + "description": "The type of the metric, for example `INTEGER`.", + "enum": [ + "METRIC_TYPE_UNSPECIFIED", + "INTEGER", + "FLOAT", + "CURRENCY", + "PERCENT", + "TIME" + ], + "enumDescriptions": [ + "Metric type is unspecified.", + "Integer metric.", + "Float metric.", + "Currency metric.", + "Percentage metric.", + "Time metric in `HH:MM:SS` format." + ], + "type": "string" + }, + "name": { + "description": "The name of the header.", + "type": "string" + } + }, + "id": "MetricHeaderEntry" + }, + "MetricFilter": { + "description": "MetricFilter specifies the filter on a metric.", + "type": "object", + "properties": { + "metricName": { + "description": "The metric that will be filtered on. A metricFilter must contain a metric\nname. A metric name can be an alias earlier defined as a metric or it can\nalso be a metric expression.", + "type": "string" + }, + "operator": { + "description": "Is the metric `EQUAL`, `LESS_THAN` or `GREATER_THAN` the\ncomparisonValue, the default is `EQUAL`. If the operator is\n`IS_MISSING`, checks if the metric is missing and would ignore the\ncomparisonValue.", + "enum": [ + "OPERATOR_UNSPECIFIED", + "EQUAL", + "LESS_THAN", + "GREATER_THAN", + "IS_MISSING" + ], + "enumDescriptions": [ + "If the operator is not specified, it is treated as `EQUAL`.", + "Should the value of the metric be exactly equal to the comparison value.", + "Should the value of the metric be less than to the comparison value.", + "Should the value of the metric be greater than to the comparison value.", + "Validates if the metric is missing.\nDoesn't take comparisonValue into account." + ], + "type": "string" + }, + "comparisonValue": { + "description": "The value to compare against.", + "type": "string" + }, + "not": { + "description": "Logical `NOT` operator. If this boolean is set to true, then the matching\nmetric values will be excluded in the report. The default is false.", + "type": "boolean" + } + }, + "id": "MetricFilter" + }, + "Dimension": { + "description": "[Dimensions](https://support.google.com/analytics/answer/1033861)\nare attributes of your data. For example, the dimension `ga:city`\nindicates the city, for example, \"Paris\" or \"New York\", from which\na session originates.", + "type": "object", + "properties": { + "histogramBuckets": { + "description": "If non-empty, we place dimension values into buckets after string to\nint64. Dimension values that are not the string representation of an\nintegral value will be converted to zero. The bucket values have to be in\nincreasing order. Each bucket is closed on the lower end, and open on the\nupper end. The \"first\" bucket includes all values less than the first\nboundary, the \"last\" bucket includes all values up to infinity. Dimension\nvalues that fall in a bucket get transformed to a new dimension value. For\nexample, if one gives a list of \"0, 1, 3, 4, 7\", then we return the\nfollowing buckets:\n\n- bucket #1: values \u003c 0, dimension value \"\u003c0\"\n- bucket #2: values in [0,1), dimension value \"0\"\n- bucket #3: values in [1,3), dimension value \"1-2\"\n- bucket #4: values in [3,4), dimension value \"3\"\n- bucket #5: values in [4,7), dimension value \"4-6\"\n- bucket #6: values \u003e= 7, dimension value \"7+\"\n\nNOTE: If you are applying histogram mutation on any dimension, and using\nthat dimension in sort, you will want to use the sort type\n`HISTOGRAM_BUCKET` for that purpose. Without that the dimension values\nwill be sorted according to dictionary\n(lexicographic) order. For example the ascending dictionary order is:\n\n \"\u003c50\", \"1001+\", \"121-1000\", \"50-120\"\n\nAnd the ascending `HISTOGRAM_BUCKET` order is:\n\n \"\u003c50\", \"50-120\", \"121-1000\", \"1001+\"\n\nThe client has to explicitly request `\"orderType\": \"HISTOGRAM_BUCKET\"`\nfor a histogram-mutated dimension.", + "type": "array", + "items": { + "type": "string", + "format": "int64" + } + }, + "name": { + "description": "Name of the dimension to fetch, for example `ga:browser`.", + "type": "string" + } + }, + "id": "Dimension" + }, + "PivotValueRegion": { + "description": "The metric values in the pivot region.", + "type": "object", + "properties": { + "values": { + "description": "The values of the metrics in each of the pivot regions.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "id": "PivotValueRegion" + } + }, + "revision": "20161129", + "basePath": "", + "icons": { + "x32": "http://www.google.com/images/icons/product/search-32.gif", + "x16": "http://www.google.com/images/icons/product/search-16.gif" + }, + "version_module": "True", + "canonicalName": "AnalyticsReporting", + "discoveryVersion": "v1", + "baseUrl": "https://analyticsreporting.googleapis.com/", + "name": "analyticsreporting", + "parameters": { + "access_token": { + "description": "OAuth access token.", + "type": "string", + "location": "query" + }, + "prettyPrint": { + "description": "Returns response with indentations and line breaks.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "key": { + "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", + "type": "string", + "location": "query" + }, + "quotaUser": { + "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.", + "type": "string", + "location": "query" + }, + "pp": { + "description": "Pretty-print response.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "fields": { + "description": "Selector specifying which fields to include in a partial response.", + "type": "string", + "location": "query" + }, + "alt": { + "description": "Data format for response.", + "location": "query", + "enum": [ + "json", + "media", + "proto" + ], + "default": "json", + "enumDescriptions": [ + "Responses with Content-Type of application/json", + "Media download with context-dependent Content-Type", + "Responses with Content-Type of application/x-protobuf" + ], + "type": "string" + }, + "$.xgafv": { + "description": "V1 error format.", + "enum": [ + "1", + "2" + ], + "enumDescriptions": [ + "v1 error format", + "v2 error format" + ], + "type": "string", + "location": "query" + }, + "callback": { + "description": "JSONP", + "type": "string", + "location": "query" + }, + "oauth_token": { + "description": "OAuth 2.0 token for the current user.", + "type": "string", + "location": "query" + }, + "uploadType": { + "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").", + "type": "string", + "location": "query" + }, + "bearer_token": { + "description": "OAuth bearer token.", + "type": "string", + "location": "query" + }, + "upload_protocol": { + "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").", + "type": "string", + "location": "query" + } + }, + "documentationLink": "https://developers.google.com/analytics/devguides/reporting/core/v4/", + "ownerDomain": "google.com", + "batchPath": "batch", + "servicePath": "", + "ownerName": "Google", + "version": "v4", + "rootUrl": "https://analyticsreporting.googleapis.com/", + "kind": "discovery#restDescription" +} diff --git a/etc/api/androidenterprise/v1/androidenterprise-api.json b/etc/api/androidenterprise/v1/androidenterprise-api.json index 0d2d8c6843..3104fc8069 100644 --- a/etc/api/androidenterprise/v1/androidenterprise-api.json +++ b/etc/api/androidenterprise/v1/androidenterprise-api.json @@ -1,12 +1,12 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/ebT1VU-volvkxDEmtUji3_N4Omw\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/C94wtsy8mrHkcQY94KxE1tVMlOU\"", "discoveryVersion": "v1", "id": "androidenterprise:v1", "name": "androidenterprise", "canonicalName": "Android Enterprise", "version": "v1", - "revision": "20160831", + "revision": "20161207", "title": "Google Play EMM API", "description": "Manages the deployment of apps to Android for Work users.", "ownerDomain": "google.com", @@ -88,6 +88,45 @@ } } }, + "AdministratorWebToken": { + "id": "AdministratorWebToken", + "type": "object", + "description": "A token authorizing an administrator to access an iframe.", + "properties": { + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"androidenterprise#administratorWebToken\".", + "default": "androidenterprise#administratorWebToken" + }, + "token": { + "type": "string", + "description": "An opaque token to be passed to the Play front-end to generate an iframe." + } + } + }, + "AdministratorWebTokenSpec": { + "id": "AdministratorWebTokenSpec", + "type": "object", + "description": "Specification for a token used to generate iframes. The token specifies what data the admin is allowed to modify and the URI the iframe is allowed to communiate with.", + "properties": { + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"androidenterprise#administratorWebTokenSpec\".", + "default": "androidenterprise#administratorWebTokenSpec" + }, + "parent": { + "type": "string", + "description": "The URI of the parent frame hosting the iframe. To prevent XSS, the iframe may not be hosted at other URIs. This URI must be https." + }, + "permission": { + "type": "array", + "description": "The list of permissions the admin is granted within the iframe. The admin will only be allowed to view an iframe if they have all of the permissions associated with it. The only valid value is \"approveApps\" that will allow the admin to access the iframe in \"approve\" mode.", + "items": { + "type": "string" + } + } + } + }, "AppRestrictionsSchema": { "id": "AppRestrictionsSchema", "type": "object", @@ -125,7 +164,7 @@ "properties": { "defaultValue": { "$ref": "AppRestrictionsSchemaRestrictionRestrictionValue", - "description": "The default value of the restriction." + "description": "The default value of the restriction. bundle and bundleArray restrictions never have a default value." }, "description": { "type": "string", @@ -140,7 +179,7 @@ }, "entryValue": { "type": "array", - "description": "For choice or multiselect restrictions, the list of possible entries' machine-readable values.", + "description": "For choice or multiselect restrictions, the list of possible entries' machine-readable values. These values should be used in the configuration, either as a single string value for a choice restriction or in a stringArray for a multiselect restriction.", "items": { "type": "string" } @@ -151,7 +190,7 @@ }, "nestedRestriction": { "type": "array", - "description": "For bundle or bundleArray restrictions, the list of nested restrictions.", + "description": "For bundle or bundleArray restrictions, the list of nested restrictions. A bundle restriction is always nested within a bundleArray restriction, and a bundleArray restriction is at most two levels deep.", "items": { "$ref": "AppRestrictionsSchemaRestriction" } @@ -353,7 +392,7 @@ }, "managementType": { "type": "string", - "description": "Identifies the extent to which the device is controlled by an Android for Work EMM in various deployment configurations.\nPossible values include: \n- \"managedDevice\"—A device that has the EMM's device policy controller (DPC) as the device owner.\n- \"managedProfile\"—A device that has a work profile managed by the DPC (DPC is profile owner) in addition to a separate, personal profile that is unavailable to the DPC.\n- \"containerApp\"—A device running the Android for Work App. The Android for Work App is managed by the DPC.\n- \"unmanagedProfile\"—A device that has been allowed (by the domain's admin, using the Admin Console to enable the privilege) to use Android for Work apps or Google Apps for Work, but the profile is itself not owned by a DPC." + "description": "Identifies the extent to which the device is controlled by an Android for Work EMM in various deployment configurations.\n\nPossible values include: \n- \"managedDevice\", a device that has the EMM's device policy controller (DPC) as the device owner, \n- \"managedProfile\", a device that has a work profile managed by the DPC (DPC is profile owner) in addition to a separate, personal profile that is unavailable to the DPC, \n- \"containerApp\", a device running the Android for Work App. The Android for Work App is managed by the DPC, \n- \"unmanagedProfile\", a device that has been allowed (by the domain's admin, using the Admin Console to enable the privilege) to use Android for Work apps or Google Apps for Work, but the profile is itself not owned by a DPC." } } }, @@ -1069,6 +1108,10 @@ "items": { "type": "string" } + }, + "productSetBehavior": { + "type": "string", + "description": "The interpretation of this product set. \"unknown\" should never be sent and ignored if received. \"whitelist\" means that this product set constitutes a whitelist. \"includeAll\" means that all products are accessible, including products that are approved, not approved, and even products where approval has been revoked. If the value is \"includeAll\", the value of the productId field is therefore ignored. If a value is not supplied, it is interpreted to be \"whitelist\" for backwards compatibility." } } }, @@ -1157,6 +1200,10 @@ "description": "Identifies what kind of resource this is. Value: the fixed string \"androidenterprise#serviceAccountKey\".", "default": "androidenterprise#serviceAccountKey" }, + "publicData": { + "type": "string", + "description": "Public key data for the credentials file. This is an X.509 cert. If you are using the googleCredentials key type, this is identical to the cert that can be retrieved by using the X.509 cert url inside of the credentials file." + }, "type": { "type": "string", "description": "The file format of the generated key data.", @@ -1248,6 +1295,10 @@ "type": "string", "description": "Identifies what kind of resource this is. Value: the fixed string \"androidenterprise#storeLayout\".", "default": "androidenterprise#storeLayout" + }, + "storeLayoutType": { + "type": "string", + "description": "The store layout type. By default, this value is set to \"basic\". If set to \"custom\", \"homepageId\" must be specified. If set to \"basic\", the layout will consist of all approved apps accessible by the user, split in pages of 100 each; in this case, \"homepageId\" must not be specified. The \"basic\" setting takes precedence over any existing collections setup for this enterprise (if any). Should the enterprise use collectionViewers for controlling access rights, these will still be respected." } } }, @@ -1969,6 +2020,32 @@ "https://www.googleapis.com/auth/androidenterprise" ] }, + "createWebToken": { + "id": "androidenterprise.enterprises.createWebToken", + "path": "enterprises/{enterpriseId}/createWebToken", + "httpMethod": "POST", + "description": "Returns a unique token to access an embeddable UI. To generate a web UI, pass the generated token into the Play for Work javascript API. Each token may only be used to start one UI session. See the javascript API documentation for further information.", + "parameters": { + "enterpriseId": { + "type": "string", + "description": "The ID of the enterprise.", + "required": true, + "location": "path" + } + }, + "parameterOrder": [ + "enterpriseId" + ], + "request": { + "$ref": "AdministratorWebTokenSpec" + }, + "response": { + "$ref": "AdministratorWebToken" + }, + "scopes": [ + "https://www.googleapis.com/auth/androidenterprise" + ] + }, "delete": { "id": "androidenterprise.enterprises.delete", "path": "enterprises/{enterpriseId}", @@ -2169,11 +2246,11 @@ "id": "androidenterprise.enterprises.pullNotificationSet", "path": "enterprises/pullNotificationSet", "httpMethod": "POST", - "description": "Pulls and returns a notification set for the enterprises associated with the service account authenticated for the request. The notification set may be empty if no notification are pending.\nA notification set returned needs to be acknowledged within 20 seconds by calling Enterprises.AcknowledgeNotificationSet, unless the notification set is empty.\nNotifications that are not acknowledged within the 20 seconds will eventually be included again in the response to another PullNotificationSet request, and those that are never acknowledged will ultimately be deleted according to the Google Cloud Platform Pub/Sub system policy.\nMultiple requests might be performed concurrently to retrieve notifications, in which case the pending notifications (if any) will be split among each caller, if any are pending.", + "description": "Pulls and returns a notification set for the enterprises associated with the service account authenticated for the request. The notification set may be empty if no notification are pending.\nA notification set returned needs to be acknowledged within 20 seconds by calling Enterprises\u200b.AcknowledgeNotificationSet, unless the notification set is empty.\nNotifications that are not acknowledged within the 20 seconds will eventually be included again in the response to another PullNotificationSet request, and those that are never acknowledged will ultimately be deleted according to the Google Cloud Platform Pub/Sub system policy.\nMultiple requests might be performed concurrently to retrieve notifications, in which case the pending notifications (if any) will be split among each caller, if any are pending.\nIf no notifications are present, an empty notification list is returned. Subsequent requests may return more notifications once they become available.", "parameters": { "requestMode": { "type": "string", - "description": "The request mode for pulling notifications. If omitted, defaults to WAIT_FOR_NOTIFCATIONS.\nIf this is set to WAIT_FOR_NOTIFCATIONS, the request will eventually timeout, in which case it should be retried.", + "description": "The request mode for pulling notifications.\nSpecifying waitForNotifications will cause the request to block and wait until one or more notifications are present, or return an empty notification list if no notifications are present after some time.\nSpeciying returnImmediately will cause the request to immediately return the pending notifications, or an empty list if no notifications are present.\nIf omitted, defaults to waitForNotifications.", "enum": [ "returnImmediately", "waitForNotifications" @@ -2245,7 +2322,7 @@ "id": "androidenterprise.enterprises.setStoreLayout", "path": "enterprises/{enterpriseId}/storeLayout", "httpMethod": "PUT", - "description": "Sets the store layout for the enterprise.", + "description": "Sets the store layout for the enterprise. By default, storeLayoutType is set to \"basic\" and the basic store layout is enabled. The basic layout only contains apps approved by the administrator, and that have been added to the available product set for a user (using the setAvailableProductSet call). Apps on the page are sorted in order of their product ID value. If you create a custom store layout (by setting storeLayoutType = \"custom\"), the basic store layout is disabled.", "parameters": { "enterpriseId": { "type": "string", @@ -4137,7 +4214,7 @@ "id": "androidenterprise.users.insert", "path": "enterprises/{enterpriseId}/users", "httpMethod": "POST", - "description": "Creates a new EMM-managed user.\n\nThe Users resource passed in the body of the request should include an accountIdentifier and an accountType.", + "description": "Creates a new EMM-managed user.\n\nThe Users resource passed in the body of the request should include an accountIdentifier and an accountType.\nIf a corresponding user already exists with the same account identifier, the user will be updated with the resource. In this case only the displayName field can be changed.", "parameters": { "enterpriseId": { "type": "string", diff --git a/etc/api/androidpublisher/v1.1/androidpublisher-api.json b/etc/api/androidpublisher/v1.1/androidpublisher-api.json index e4d8c3e3d9..4d84c2f4be 100644 --- a/etc/api/androidpublisher/v1.1/androidpublisher-api.json +++ b/etc/api/androidpublisher/v1.1/androidpublisher-api.json @@ -1,12 +1,12 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/fQeWIwZEL9ttN_Qbngm4RE2J7to\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/uePHydzmUhZLWLtyPJ_GHjROU1A\"", "discoveryVersion": "v1", "id": "androidpublisher:v1.1", "name": "androidpublisher", "canonicalName": "Android Publisher", "version": "v1.1", - "revision": "20160817", + "revision": "20161212", "title": "Google Play Developer API", "description": "Lets Android application developers access their Google Play accounts.", "ownerDomain": "google.com", diff --git a/etc/api/androidpublisher/v1/androidpublisher-api.json b/etc/api/androidpublisher/v1/androidpublisher-api.json index 813cc041fe..5dbf10509b 100644 --- a/etc/api/androidpublisher/v1/androidpublisher-api.json +++ b/etc/api/androidpublisher/v1/androidpublisher-api.json @@ -1,12 +1,12 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/fNzp1BQHKDVJN-Ih8qfrclbLbv0\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/u6dk5tV6sEWmibYvR51NT009Z2c\"", "discoveryVersion": "v1", "id": "androidpublisher:v1", "name": "androidpublisher", "canonicalName": "Android Publisher", "version": "v1", - "revision": "20160817", + "revision": "20161212", "title": "Google Play Developer API", "description": "Lets Android application developers access their Google Play accounts.", "ownerDomain": "google.com", diff --git a/etc/api/androidpublisher/v2/androidpublisher-api.json b/etc/api/androidpublisher/v2/androidpublisher-api.json index 202714fb84..afd903ae5e 100644 --- a/etc/api/androidpublisher/v2/androidpublisher-api.json +++ b/etc/api/androidpublisher/v2/androidpublisher-api.json @@ -1,12 +1,12 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/UDk0LqlPPxkx5NU81sNZcbwgkD4\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/PcoD2XCBeKQPYDG0dclnfJ5T-Ho\"", "discoveryVersion": "v1", "id": "androidpublisher:v2", "name": "androidpublisher", "canonicalName": "Android Publisher", "version": "v2", - "revision": "20160817", + "revision": "20161212", "title": "Google Play Developer API", "description": "Lets Android application developers access their Google Play accounts.", "ownerDomain": "google.com", @@ -222,6 +222,26 @@ } } }, + "DeobfuscationFile": { + "id": "DeobfuscationFile", + "type": "object", + "description": "Represents a deobfuscation file.", + "properties": { + "symbolType": { + "type": "string", + "description": "The type of the deobfuscation file." + } + } + }, + "DeobfuscationFilesUploadResponse": { + "id": "DeobfuscationFilesUploadResponse", + "type": "object", + "properties": { + "deobfuscationFile": { + "$ref": "DeobfuscationFile" + } + } + }, "DeveloperComment": { "id": "DeveloperComment", "type": "object", @@ -236,6 +256,61 @@ } } }, + "DeviceMetadata": { + "id": "DeviceMetadata", + "type": "object", + "properties": { + "cpuMake": { + "type": "string", + "description": "Device CPU make e.g. \"Qualcomm\"" + }, + "cpuModel": { + "type": "string", + "description": "Device CPU model e.g. \"MSM8974\"" + }, + "deviceClass": { + "type": "string", + "description": "Device class (e.g. tablet)" + }, + "glEsVersion": { + "type": "integer", + "description": "OpenGL version", + "format": "int32" + }, + "manufacturer": { + "type": "string", + "description": "Device manufacturer (e.g. Motorola)" + }, + "nativePlatform": { + "type": "string", + "description": "Comma separated list of native platforms (e.g. \"arm\", \"arm7\")" + }, + "productName": { + "type": "string", + "description": "Device model name (e.g. Droid)" + }, + "ramMb": { + "type": "integer", + "description": "Device RAM in Megabytes e.g. \"2048\"", + "format": "int32" + }, + "screenDensityDpi": { + "type": "integer", + "description": "Screen density in DPI", + "format": "int32" + }, + "screenHeightPx": { + "type": "integer", + "description": "Screen height in pixels", + "format": "int32" + }, + "screenWidthPx": { + "type": "integer", + "description": "Screen width in pixels", + "format": "int32" + } + } + }, "Entitlement": { "id": "Entitlement", "type": "object", @@ -1068,10 +1143,18 @@ "type": "string", "description": "Codename for the reviewer's device, e.g. klte, flounder. May be absent." }, + "deviceMetadata": { + "$ref": "DeviceMetadata", + "description": "Some information about the characteristics of the user's device" + }, "lastModified": { "$ref": "Timestamp", "description": "The last time at which this comment was updated." }, + "originalText": { + "type": "string", + "description": "Untranslated text of the review, in the case where the review has been translated. If the review has not been translated this is left blank." + }, "reviewerLanguage": { "type": "string", "description": "Language code for the reviewer. This is taken from the device settings so is not guaranteed to match the language the review is written in. May be absent." @@ -1084,6 +1167,60 @@ "text": { "type": "string", "description": "The content of the comment, i.e. review body. In some cases users have been able to write a review with separate title and body; in those cases the title and body are concatenated and separated by a tab character." + }, + "thumbsDownCount": { + "type": "integer", + "description": "Number of users who have given this review a thumbs down", + "format": "int32" + }, + "thumbsUpCount": { + "type": "integer", + "description": "Number of users who have given this review a thumbs up", + "format": "int32" + } + } + }, + "VoidedPurchase": { + "id": "VoidedPurchase", + "type": "object", + "description": "A VoidedPurchase resource indicates the purchase was either cancelled/refunded/charged-back.", + "properties": { + "kind": { + "type": "string", + "description": "This kind represents a voided purchase object in the androidpublisher service.", + "default": "androidpublisher#voidedPurchase" + }, + "purchaseTimeMillis": { + "type": "string", + "description": "The time the purchase was made, in milliseconds since the epoch (Jan 1, 1970).", + "format": "int64" + }, + "purchaseToken": { + "type": "string", + "description": "The token that was generated when a purchase was made and uniquely identifies a purchase." + }, + "voidedTimeMillis": { + "type": "string", + "description": "The time when the purchase was cancelled/refunded/chargeback, in milliseconds since the epoch (Jan 1, 1970).", + "format": "int64" + } + } + }, + "VoidedPurchasesListResponse": { + "id": "VoidedPurchasesListResponse", + "type": "object", + "properties": { + "pageInfo": { + "$ref": "PageInfo" + }, + "tokenPagination": { + "$ref": "TokenPagination" + }, + "voidedPurchases": { + "type": "array", + "items": { + "$ref": "VoidedPurchase" + } } } } @@ -1609,6 +1746,77 @@ } } }, + "deobfuscationfiles": { + "methods": { + "upload": { + "id": "androidpublisher.edits.deobfuscationfiles.upload", + "path": "{packageName}/edits/{editId}/apks/{apkVersionCode}/deobfuscationFiles/{deobfuscationFileType}", + "httpMethod": "POST", + "description": "Uploads the deobfuscation file of the specified APK. If a deobfuscation file already exists, it will be replaced.", + "parameters": { + "apkVersionCode": { + "type": "integer", + "description": "The version code of the APK whose deobfuscation file is being uploaded.", + "required": true, + "format": "int32", + "location": "path" + }, + "deobfuscationFileType": { + "type": "string", + "required": true, + "enum": [ + "proguard" + ], + "enumDescriptions": [ + "" + ], + "location": "path" + }, + "editId": { + "type": "string", + "description": "Unique identifier for this edit.", + "required": true, + "location": "path" + }, + "packageName": { + "type": "string", + "description": "Unique identifier of the Android app for which the deobfuscatiuon files are being uploaded; for example, \"com.spiffygame\".", + "required": true, + "location": "path" + } + }, + "parameterOrder": [ + "packageName", + "editId", + "apkVersionCode", + "deobfuscationFileType" + ], + "response": { + "$ref": "DeobfuscationFilesUploadResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/androidpublisher" + ], + "supportsMediaUpload": true, + "mediaUpload": { + "accept": [ + "application/octet-stream" + ], + "maxSize": "300MB", + "protocols": { + "simple": { + "multipart": true, + "path": "/upload/androidpublisher/v2/applications/{packageName}/edits/{editId}/apks/{apkVersionCode}/deobfuscationFiles/{deobfuscationFileType}" + }, + "resumable": { + "multipart": true, + "path": "/resumable/upload/androidpublisher/v2/applications/{packageName}/edits/{editId}/apks/{apkVersionCode}/deobfuscationFiles/{deobfuscationFileType}" + } + } + } + } + } + }, "details": { "methods": { "get": { @@ -3267,6 +3475,59 @@ ] } } + }, + "voidedpurchases": { + "methods": { + "list": { + "id": "androidpublisher.purchases.voidedpurchases.list", + "path": "{packageName}/purchases/voidedpurchases", + "httpMethod": "GET", + "description": "Lists the purchases that were cancelled, refunded or charged-back.", + "parameters": { + "endTime": { + "type": "string", + "description": "The end time of list window, in milliseconds since the epoch (Jan 1, 1970). If not specified, default to current time, which is also the latest accepted end time. This parameter will be ignored if pagination token is set.", + "format": "int64", + "location": "query" + }, + "maxResults": { + "type": "integer", + "format": "uint32", + "location": "query" + }, + "packageName": { + "type": "string", + "description": "The package name of the application for which voided purchases need to be returned (for example, 'com.some.thing').", + "required": true, + "location": "path" + }, + "startIndex": { + "type": "integer", + "format": "uint32", + "location": "query" + }, + "startTime": { + "type": "string", + "description": "The start time of list window, in milliseconds since the epoch (Jan 1, 1970). If not specified, default to current time - 30 days, which is also the earlies accepted start time. This parameter will be ignored if pagination token is set.", + "format": "int64", + "location": "query" + }, + "token": { + "type": "string", + "location": "query" + } + }, + "parameterOrder": [ + "packageName" + ], + "response": { + "$ref": "VoidedPurchasesListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/androidpublisher" + ] + } + } } } }, @@ -3288,6 +3549,10 @@ "type": "string", "required": true, "location": "path" + }, + "translationLanguage": { + "type": "string", + "location": "query" } }, "parameterOrder": [ @@ -3326,6 +3591,10 @@ "token": { "type": "string", "location": "query" + }, + "translationLanguage": { + "type": "string", + "location": "query" } }, "parameterOrder": [ diff --git a/etc/api/api-list.yaml b/etc/api/api-list.yaml index cdbc8ab0be..d8dbc8412a 100644 --- a/etc/api/api-list.yaml +++ b/etc/api/api-list.yaml @@ -103,6 +103,7 @@ api: - v2.4 - v2.5 - v2.6 + - v2.7 discovery: - v1 dns: @@ -114,6 +115,8 @@ api: drive: - v2 - v3 + firebasedynamiclinks: + - v1 firebaserules: - v1 fitness: @@ -146,17 +149,23 @@ api: kgsearch: - v1 language: + - v1 - v1beta1 licensing: - v1 logging: + - v2 - v2beta1 manager: - v1beta2 + manufacturers: + - v1 mapsengine: - v1 mirror: - v1 + ml: + - v1beta1 monitoring: - v3 oauth2: @@ -191,6 +200,7 @@ api: resourceviews: - v1beta2 runtimeconfig: + - v1 - v1beta1 safebrowsing: - v4 @@ -206,6 +216,8 @@ api: - v4 siteverification: - v1 + slides: + - v1 spectrum: - v1explorer speech: @@ -216,6 +228,8 @@ api: - v1 storagetransfer: - v1 + surveys: + - v2 tagmanager: - v1 taskqueue: diff --git a/etc/api/appengine/v1/appengine-api.json b/etc/api/appengine/v1/appengine-api.json index 936867df1b..738a81d13d 100644 --- a/etc/api/appengine/v1/appengine-api.json +++ b/etc/api/appengine/v1/appengine-api.json @@ -1,11 +1,11 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/XwXcNyhHrL2U4OFiJYzAKkeZ6k4\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/CydBYfZ8LICDy6eugptbrOxuOz0\"", "discoveryVersion": "v1", "id": "appengine:v1", "name": "appengine", "version": "v1", - "revision": "20160802", + "revision": "20161208", "title": "Google App Engine Admin API", "description": "Provisions and manages App Engine applications.", "ownerDomain": "google.com", @@ -104,13 +104,37 @@ "auth": { "oauth2": { "scopes": { + "https://www.googleapis.com/auth/appengine.admin": { + "description": "View and manage your applications deployed on Google App Engine" + }, "https://www.googleapis.com/auth/cloud-platform": { "description": "View and manage your data across Google Cloud Platform services" + }, + "https://www.googleapis.com/auth/cloud-platform.read-only": { + "description": "View your data across Google Cloud Platform services" } } } }, "schemas": { + "ListOperationsResponse": { + "id": "ListOperationsResponse", + "type": "object", + "description": "The response message for Operations.ListOperations.", + "properties": { + "operations": { + "type": "array", + "description": "A list of operations that matches the specified filter in the request.", + "items": { + "$ref": "Operation" + } + }, + "nextPageToken": { + "type": "string", + "description": "The standard List next-page token." + } + } + }, "Operation": { "id": "Operation", "type": "object", @@ -118,7 +142,7 @@ "properties": { "name": { "type": "string", - "description": "The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should have the format of `operations/some/unique/name`." + "description": "The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the name should have the format of operations/some/unique/name." }, "metadata": { "type": "object", @@ -130,15 +154,15 @@ }, "done": { "type": "boolean", - "description": "If the value is `false`, it means the operation is still in progress. If true, the operation is completed, and either `error` or `response` is available." + "description": "If the value is false, it means the operation is still in progress. If true, the operation is completed, and either error or response is available." }, "error": { "$ref": "Status", - "description": "The error result of the operation in case of failure." + "description": "The error result of the operation in case of failure or cancellation." }, "response": { "type": "object", - "description": "The normal response of the operation in case of success. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.", + "description": "The normal response of the operation in case of success. If the original method returns no data on success, such as Delete, the response is google.protobuf.Empty. If the original method is standard Get/Create/Update, the response should be the resource. For other methods, the response should have the type XxxResponse, where Xxx is the original method name. For example, if the original method name is TakeSnapshot(), the inferred response type is TakeSnapshotResponse.", "additionalProperties": { "type": "any", "description": "Properties of the object. Contains field @type with type URL." @@ -149,7 +173,7 @@ "Status": { "id": "Status", "type": "object", - "description": "The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). The error model is designed to be: - Simple to use and understand for most users - Flexible enough to meet unexpected needs # Overview The `Status` message contains three pieces of data: error code, error message, and error details. The error code should be an enum value of google.rpc.Code, but it may accept additional error codes if needed. The error message should be a developer-facing English message that helps developers *understand* and *resolve* the error. If a localized user-facing error message is needed, put the localized message in the error details or localize it in the client. The optional error details may contain arbitrary information about the error. There is a predefined set of error detail types in the package `google.rpc` which can be used for common error conditions. # Language mapping The `Status` message is the logical representation of the error model, but it is not necessarily the actual wire format. When the `Status` message is exposed in different client libraries and different wire protocols, it can be mapped differently. For example, it will likely be mapped to some exceptions in Java, but more likely mapped to some error codes in C. # Other uses The error model and the `Status` message can be used in a variety of environments, either with or without APIs, to provide a consistent developer experience across different environments. Example uses of this error model include: - Partial errors. If a service needs to return partial errors to the client, it may embed the `Status` in the normal response to indicate the partial errors. - Workflow errors. A typical workflow has multiple steps. Each step may have a `Status` message for error reporting purpose. - Batch operations. If a client uses batch request and batch response, the `Status` message should be used directly inside batch response, one for each error sub-response. - Asynchronous operations. If an API call embeds asynchronous operation results in its response, the status of those operations should be represented directly using the `Status` message. - Logging. If some API errors are stored in logs, the message `Status` could be used directly after any stripping needed for security/privacy reasons.", + "description": "The Status type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by gRPC (https://github.com/grpc). The error model is designed to be: Simple to use and understand for most users Flexible enough to meet unexpected needsOverviewThe Status message contains three pieces of data: error code, error message, and error details. The error code should be an enum value of google.rpc.Code, but it may accept additional error codes if needed. The error message should be a developer-facing English message that helps developers understand and resolve the error. If a localized user-facing error message is needed, put the localized message in the error details or localize it in the client. The optional error details may contain arbitrary information about the error. There is a predefined set of error detail types in the package google.rpc which can be used for common error conditions.Language mappingThe Status message is the logical representation of the error model, but it is not necessarily the actual wire format. When the Status message is exposed in different client libraries and different wire protocols, it can be mapped differently. For example, it will likely be mapped to some exceptions in Java, but more likely mapped to some error codes in C.Other usesThe error model and the Status message can be used in a variety of environments, either with or without APIs, to provide a consistent developer experience across different environments.Example uses of this error model include: Partial errors. If a service needs to return partial errors to the client, it may embed the Status in the normal response to indicate the partial errors. Workflow errors. A typical workflow has multiple steps. Each step may have a Status message for error reporting purpose. Batch operations. If a client uses batch request and batch response, the Status message should be used directly inside batch response, one for each error sub-response. Asynchronous operations. If an API call embeds asynchronous operation results in its response, the status of those operations should be represented directly using the Status message. Logging. If some API errors are stored in logs, the message Status could be used directly after any stripping needed for security/privacy reasons.", "properties": { "code": { "type": "integer", @@ -173,24 +197,6 @@ } } }, - "ListOperationsResponse": { - "id": "ListOperationsResponse", - "type": "object", - "description": "The response message for Operations.ListOperations.", - "properties": { - "operations": { - "type": "array", - "description": "A list of operations that matches the specified filter in the request.", - "items": { - "$ref": "Operation" - } - }, - "nextPageToken": { - "type": "string", - "description": "The standard List next-page token." - } - } - }, "Application": { "id": "Application", "type": "object", @@ -198,42 +204,42 @@ "properties": { "name": { "type": "string", - "description": "Full path to the Application resource in the API. Example: `apps/myapp`. @OutputOnly" + "description": "Full path to the Application resource in the API. Example: apps/myapp.@OutputOnly" }, "id": { "type": "string", - "description": "Identifier of the Application resource. This identifier is equivalent to the project ID of the Google Cloud Platform project where you want to deploy your application. Example: `myapp`." + "description": "Identifier of the Application resource. This identifier is equivalent to the project ID of the Google Cloud Platform project where you want to deploy your application. Example: myapp." }, "dispatchRules": { "type": "array", - "description": "HTTP path dispatch rules for requests to the application that do not explicitly target a service or version. Rules are order-dependent. @OutputOnly", + "description": "HTTP path dispatch rules for requests to the application that do not explicitly target a service or version. Rules are order-dependent.@OutputOnly", "items": { "$ref": "UrlDispatchRule" } }, "authDomain": { "type": "string", - "description": "Google Apps authentication domain that controls which users can access this application. Defaults to open access for any Google Account." + "description": "Google Apps authentication domain that controls which users can access this application.Defaults to open access for any Google Account." }, "locationId": { "type": "string", - "description": "Location from which this application will be run. Application instances will run out of data centers in the chosen location, which is also where all of the application's end user content is stored. Defaults to `us-central`. Options are: `us-central` - Central US `europe-west` - Western Europe `us-east1` - Eastern US" + "description": "Location from which this application will be run. Application instances will run out of data centers in the chosen location, which is also where all of the application's end user content is stored.Defaults to us-central.Options are:us-central - Central USeurope-west - Western Europeus-east1 - Eastern US" }, "codeBucket": { "type": "string", - "description": "Google Cloud Storage bucket that can be used for storing files associated with this application. This bucket is associated with the application and can be used by the gcloud deployment commands. @OutputOnly" + "description": "Google Cloud Storage bucket that can be used for storing files associated with this application. This bucket is associated with the application and can be used by the gcloud deployment commands.@OutputOnly" }, "defaultCookieExpiration": { "type": "string", - "description": "Cookie expiration policy for this application. @OutputOnly" + "description": "Cookie expiration policy for this application." }, "defaultHostname": { "type": "string", - "description": "Hostname used to reach this application, as resolved by App Engine. @OutputOnly" + "description": "Hostname used to reach this application, as resolved by App Engine.@OutputOnly" }, "defaultBucket": { "type": "string", - "description": "Google Cloud Storage bucket that can be used by this application to store content. @OutputOnly" + "description": "Google Cloud Storage bucket that can be used by this application to store content.@OutputOnly" } } }, @@ -244,15 +250,15 @@ "properties": { "domain": { "type": "string", - "description": "Domain name to match against. The wildcard \"`*`\" is supported if specified before a period: \"`*.`\". Defaults to matching all domains: \"`*`\"." + "description": "Domain name to match against. The wildcard \"*\" is supported if specified before a period: \"*.\".Defaults to matching all domains: \"*\"." }, "path": { "type": "string", - "description": "Pathname within the host. Must start with a \"`/`\". A single \"`*`\" can be included at the end of the path. The sum of the lengths of the domain and path may not exceed 100 characters." + "description": "Pathname within the host. Must start with a \"/\". A single \"*\" can be included at the end of the path. The sum of the lengths of the domain and path may not exceed 100 characters." }, "service": { "type": "string", - "description": "Resource ID of a service in this application that should serve the matched request. The service must already exist. Example: `default`." + "description": "Resource ID of a service in this application that should serve the matched request. The service must already exist. Example: default." } } }, @@ -264,7 +270,7 @@ "ListServicesResponse": { "id": "ListServicesResponse", "type": "object", - "description": "Response message for `Services.ListServices`.", + "description": "Response message for Services.ListServices.", "properties": { "services": { "type": "array", @@ -286,11 +292,11 @@ "properties": { "name": { "type": "string", - "description": "Full path to the Service resource in the API. Example: `apps/myapp/services/default`. @OutputOnly" + "description": "Full path to the Service resource in the API. Example: apps/myapp/services/default.@OutputOnly" }, "id": { "type": "string", - "description": "Relative name of the service within the application. Example: `default`. @OutputOnly" + "description": "Relative name of the service within the application. Example: default.@OutputOnly" }, "split": { "$ref": "TrafficSplit", @@ -325,7 +331,7 @@ "ListVersionsResponse": { "id": "ListVersionsResponse", "type": "object", - "description": "Response message for `Versions.ListVersions`.", + "description": "Response message for Versions.ListVersions.", "properties": { "versions": { "type": "array", @@ -347,11 +353,11 @@ "properties": { "name": { "type": "string", - "description": "Full path to the Version resource in the API. Example: `apps/myapp/services/default/versions/v1`. @OutputOnly" + "description": "Full path to the Version resource in the API. Example: apps/myapp/services/default/versions/v1.@OutputOnly" }, "id": { "type": "string", - "description": "Relative name of the version within the service. Example: `v1`. Version names can contain only lowercase letters, numbers, or hyphens. Reserved names: \"default\", \"latest\", and any name with the prefix \"ah-\"." + "description": "Relative name of the version within the service. Example: v1. Version names can contain only lowercase letters, numbers, or hyphens. Reserved names: \"default\", \"latest\", and any name with the prefix \"ah-\"." }, "automaticScaling": { "$ref": "AutomaticScaling", @@ -396,7 +402,7 @@ }, "instanceClass": { "type": "string", - "description": "Instance class that is used to run this version. Valid values are: * AutomaticScaling: `F1`, `F2`, `F4`, `F4_1G` * ManualScaling or BasicScaling: `B1`, `B2`, `B4`, `B8`, `B4_1G` Defaults to `F1` for AutomaticScaling and `B1` for ManualScaling or BasicScaling." + "description": "Instance class that is used to run this version. Valid values are: AutomaticScaling: F1, F2, F4, F4_1G ManualScaling or BasicScaling: B1, B2, B4, B8, B4_1GDefaults to F1 for AutomaticScaling and B1 for ManualScaling or BasicScaling." }, "network": { "$ref": "Network", @@ -408,7 +414,7 @@ }, "runtime": { "type": "string", - "description": "Desired runtime. Example: `python27`." + "description": "Desired runtime. Example: python27." }, "threadsafe": { "type": "boolean", @@ -427,11 +433,11 @@ }, "env": { "type": "string", - "description": "App Engine execution environment for this version. Defaults to `standard`." + "description": "App Engine execution environment for this version.Defaults to standard." }, "servingStatus": { "type": "string", - "description": "Current serving status of this version. Only the versions with a `SERVING` status create instances and can be billed. `SERVING_STATUS_UNSPECIFIED` is an invalid value. Defaults to `SERVING`.", + "description": "Current serving status of this version. Only the versions with a SERVING status create instances and can be billed.SERVING_STATUS_UNSPECIFIED is an invalid value. Defaults to SERVING.", "enum": [ "SERVING_STATUS_UNSPECIFIED", "SERVING", @@ -440,68 +446,72 @@ }, "createdBy": { "type": "string", - "description": "Email address of the user who created this version. @OutputOnly" + "description": "Email address of the user who created this version.@OutputOnly" }, "createTime": { "type": "string", - "description": "Time that this version was created. @OutputOnly" + "description": "Time that this version was created.@OutputOnly" }, "diskUsageBytes": { "type": "string", - "description": "Total size in bytes of all the files that are included in this version and curerntly hosted on the App Engine disk. @OutputOnly", + "description": "Total size in bytes of all the files that are included in this version and curerntly hosted on the App Engine disk.@OutputOnly", "format": "int64" }, "handlers": { "type": "array", - "description": "An ordered list of URL-matching patterns that should be applied to incoming requests. The first matching URL handles the request and other request handlers are not attempted. Only returned in `GET` requests if `view=FULL` is set.", + "description": "An ordered list of URL-matching patterns that should be applied to incoming requests. The first matching URL handles the request and other request handlers are not attempted.Only returned in GET requests if view=FULL is set.", "items": { "$ref": "UrlMap" } }, "errorHandlers": { "type": "array", - "description": "Custom static error pages. Limited to 10KB per page. Only returned in `GET` requests if `view=FULL` is set.", + "description": "Custom static error pages. Limited to 10KB per page.Only returned in GET requests if view=FULL is set.", "items": { "$ref": "ErrorHandler" } }, "libraries": { "type": "array", - "description": "Configuration for third-party Python runtime libraries that are required by the application. Only returned in `GET` requests if `view=FULL` is set.", + "description": "Configuration for third-party Python runtime libraries that are required by the application.Only returned in GET requests if view=FULL is set.", "items": { "$ref": "Library" } }, "apiConfig": { "$ref": "ApiConfigHandler", - "description": "Serving configuration for [Google Cloud Endpoints](https://cloud.google.com/appengine/docs/python/endpoints/). Only returned in `GET` requests if `view=FULL` is set." + "description": "Serving configuration for Google Cloud Endpoints (https://cloud.google.com/appengine/docs/python/endpoints/).Only returned in GET requests if view=FULL is set." }, "envVariables": { "type": "object", - "description": "Environment variables available to the application. Only returned in `GET` requests if `view=FULL` is set.", + "description": "Environment variables available to the application.Only returned in GET requests if view=FULL is set.", "additionalProperties": { "type": "string" } }, "defaultExpiration": { "type": "string", - "description": "Duration that static files should be cached by web proxies and browsers. Only applicable if the corresponding [StaticFilesHandler](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#staticfileshandler) does not specify its own expiration time. Only returned in `GET` requests if `view=FULL` is set." + "description": "Duration that static files should be cached by web proxies and browsers. Only applicable if the corresponding StaticFilesHandler (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#staticfileshandler) does not specify its own expiration time.Only returned in GET requests if view=FULL is set." }, "healthCheck": { "$ref": "HealthCheck", - "description": "Configures health checking for VM instances. Unhealthy instances are stopped and replaced with new instances. Only applicable for VM runtimes. Only returned in `GET` requests if `view=FULL` is set." + "description": "Configures health checking for VM instances. Unhealthy instances are stopped and replaced with new instances. Only applicable for VM runtimes.Only returned in GET requests if view=FULL is set." }, "nobuildFilesRegex": { "type": "string", - "description": "Files that match this pattern will not be built into this version. Only applicable for Go runtimes. Only returned in `GET` requests if `view=FULL` is set." + "description": "Files that match this pattern will not be built into this version. Only applicable for Go runtimes.Only returned in GET requests if view=FULL is set." }, "deployment": { "$ref": "Deployment", - "description": "Code and application artifacts that make up this version. Only returned in `GET` requests if `view=FULL` is set." + "description": "Code and application artifacts that make up this version.Only returned in GET requests if view=FULL is set." }, "versionUrl": { "type": "string", - "description": "Serving URL for this version. Example: \"https://myversion-dot-myservice-dot-myapp.appspot.com\" @OutputOnly" + "description": "Serving URL for this version. Example: \"https://myversion-dot-myservice-dot-myapp.appspot.com\"@OutputOnly" + }, + "endpointsApiService": { + "$ref": "EndpointsApiService", + "description": "Cloud Endpoints configuration.If endpoints_api_service is set, the Cloud Endpoints Extensible Service Proxy will be provided to serve the API implemented by the app." } } }, @@ -512,7 +522,7 @@ "properties": { "coolDownPeriod": { "type": "string", - "description": "Amount of time that the [Autoscaler](https://cloud.google.com/compute/docs/autoscaler/) should wait between changes to the number of virtual machines. Only applicable for VM runtimes." + "description": "Amount of time that the Autoscaler (https://cloud.google.com/compute/docs/autoscaler/) should wait between changes to the number of virtual machines. Only applicable for VM runtimes." }, "cpuUtilization": { "$ref": "CpuUtilization", @@ -520,7 +530,7 @@ }, "maxConcurrentRequests": { "type": "integer", - "description": "Number of concurrent requests an automatic scaling instance can accept before the scheduler spawns a new instance. Defaults to a runtime-specific value.", + "description": "Number of concurrent requests an automatic scaling instance can accept before the scheduler spawns a new instance.Defaults to a runtime-specific value.", "format": "int32" }, "maxIdleInstances": { @@ -675,7 +685,7 @@ "properties": { "instances": { "type": "integer", - "description": "Number of instances to assign to the service at the start. This number can later be altered by using the [Modules API](https://cloud.google.com/appengine/docs/python/modules/functions) `set_num_instances()` function.", + "description": "Number of instances to assign to the service at the start. This number can later be altered by using the Modules API (https://cloud.google.com/appengine/docs/python/modules/functions) set_num_instances() function.", "format": "int32" } } @@ -698,7 +708,11 @@ }, "name": { "type": "string", - "description": "Google Cloud Platform network where the virtual machines are created. Specify the short name, not the resource path. Defaults to `default`." + "description": "Google Cloud Platform network where the virtual machines are created. Specify the short name, not the resource path.Defaults to default." + }, + "subnetworkName": { + "type": "string", + "description": "Google Cloud Platform sub-network where the virtual machines are created. Specify the short name, not the resource path.If a subnetwork name is specified, a network name will also be required unless it is for the default network. If the network the VM instance is being created in is a Legacy network, then the IP address is allocated from the IPv4Range. If the network the VM instance is being created in is an auto Subnet Mode Network, then only network name should be specified (not the subnetwork_name) and the IP address is created from the IPCidrRange of the subnetwork that exists in that zone for that network. If the network the VM instance is being created in is a custom Subnet Mode Network, then the subnetwork_name must be specified and the IP address is created from the IPCidrRange of the subnetwork.If specified, the subnetwork must exist in the same region as the Flex app." } } }, @@ -721,6 +735,33 @@ "type": "number", "description": "Memory (GB) needed.", "format": "double" + }, + "volumes": { + "type": "array", + "description": "User specified volumes.", + "items": { + "$ref": "Volume" + } + } + } + }, + "Volume": { + "id": "Volume", + "type": "object", + "description": "Volumes mounted within the app container. Only applicable for VM runtimes.", + "properties": { + "name": { + "type": "string", + "description": "Unique name for the volume." + }, + "volumeType": { + "type": "string", + "description": "Underlying volume type, e.g. 'tmpfs'." + }, + "sizeGb": { + "type": "number", + "description": "Volume size in gigabytes.", + "format": "double" } } }, @@ -768,7 +809,7 @@ }, "authFailAction": { "type": "string", - "description": "Action to take when users access resources that require authentication. Defaults to `redirect`.", + "description": "Action to take when users access resources that require authentication. Defaults to redirect.", "enum": [ "AUTH_FAIL_ACTION_UNSPECIFIED", "AUTH_FAIL_ACTION_REDIRECT", @@ -777,7 +818,7 @@ }, "redirectHttpResponseCode": { "type": "string", - "description": "`30x` code to use when performing redirects for the `secure` field. Defaults to `302`.", + "description": "30x code to use when performing redirects for the secure field. Defaults to 302.", "enum": [ "REDIRECT_HTTP_RESPONSE_CODE_UNSPECIFIED", "REDIRECT_HTTP_RESPONSE_CODE_301", @@ -810,7 +851,7 @@ }, "mimeType": { "type": "string", - "description": "MIME type used to serve all files served by this handler. Defaults to file-specific MIME types, which are derived from each file's filename extension." + "description": "MIME type used to serve all files served by this handler.Defaults to file-specific MIME types, which are derived from each file's filename extension." }, "expiration": { "type": "string", @@ -870,7 +911,7 @@ }, "mimeType": { "type": "string", - "description": "MIME type of file. Defaults to `text/html`." + "description": "MIME type of file. Defaults to text/html." } } }, @@ -892,11 +933,11 @@ "ApiConfigHandler": { "id": "ApiConfigHandler", "type": "object", - "description": "[Google Cloud Endpoints](https://cloud.google.com/appengine/docs/python/endpoints/) configuration for API handlers.", + "description": "Google Cloud Endpoints (https://cloud.google.com/appengine/docs/python/endpoints/) configuration for API handlers.", "properties": { "authFailAction": { "type": "string", - "description": "Action to take when users access resources that require authentication. Defaults to `redirect`.", + "description": "Action to take when users access resources that require authentication. Defaults to redirect.", "enum": [ "AUTH_FAIL_ACTION_UNSPECIFIED", "AUTH_FAIL_ACTION_REDIRECT", @@ -905,7 +946,7 @@ }, "login": { "type": "string", - "description": "Level of login required to access this resource. Defaults to `optional`.", + "description": "Level of login required to access this resource. Defaults to optional.", "enum": [ "LOGIN_UNSPECIFIED", "LOGIN_OPTIONAL", @@ -1001,7 +1042,7 @@ "properties": { "sourceUrl": { "type": "string", - "description": "URL source to use to fetch this file. Must be a URL to a resource in Google Cloud Storage in the form 'http(s)://storage.googleapis.com/\\/\\'." + "description": "URL source to use to fetch this file. Must be a URL to a resource in Google Cloud Storage in the form 'http(s)://storage.googleapis.com//'." }, "sha1Sum": { "type": "string", @@ -1009,7 +1050,7 @@ }, "mimeType": { "type": "string", - "description": "The MIME type of the file. Defaults to the value from Google Cloud Storage." + "description": "The MIME type of the file.Defaults to the value from Google Cloud Storage." } } }, @@ -1027,10 +1068,11 @@ "ZipInfo": { "id": "ZipInfo", "type": "object", + "description": "The zip file information for a zip deployment.", "properties": { "sourceUrl": { "type": "string", - "description": "URL of the zip file to deploy from. Must be a URL to a resource in Google Cloud Storage in the form 'http(s)://storage.googleapis.com/\\/\\'." + "description": "URL of the zip file to deploy from. Must be a URL to a resource in Google Cloud Storage in the form 'http(s)://storage.googleapis.com//'." }, "filesCount": { "type": "integer", @@ -1039,10 +1081,25 @@ } } }, + "EndpointsApiService": { + "id": "EndpointsApiService", + "type": "object", + "description": "Cloud Endpoints (https://cloud.google.com/endpoints) configuration. The Endpoints API Service provides tooling for serving Open API and gRPC endpoints via an NGINX proxy.The fields here refer to the name and configuration id of a \"service\" resource in the Service Management API (https://cloud.google.com/service-management/overview).", + "properties": { + "name": { + "type": "string", + "description": "Endpoints service name which is the name of the \"service\" resource in the Service Management API. For example \"myapi.endpoints.myproject.cloud.goog\"" + }, + "configId": { + "type": "string", + "description": "Endpoints service configuration id as specified by the Service Management API. For example \"2016-09-19r1\"" + } + } + }, "ListInstancesResponse": { "id": "ListInstancesResponse", "type": "object", - "description": "Response message for `Instances.ListInstances`.", + "description": "Response message for Instances.ListInstances.", "properties": { "instances": { "type": "array", @@ -1064,19 +1121,19 @@ "properties": { "name": { "type": "string", - "description": "Full path to the Instance resource in the API. Example: `apps/myapp/services/default/versions/v1/instances/instance-1`. @OutputOnly" + "description": "Full path to the Instance resource in the API. Example: apps/myapp/services/default/versions/v1/instances/instance-1.@OutputOnly" }, "id": { "type": "string", - "description": "Relative name of the instance within the version. Example: `instance-1`. @OutputOnly" + "description": "Relative name of the instance within the version. Example: instance-1.@OutputOnly" }, "appEngineRelease": { "type": "string", - "description": "App Engine release this instance is running on. @OutputOnly" + "description": "App Engine release this instance is running on.@OutputOnly" }, "availability": { "type": "string", - "description": "Availability of the instance. @OutputOnly", + "description": "Availability of the instance.@OutputOnly", "enum": [ "UNSPECIFIED", "RESIDENT", @@ -1085,59 +1142,69 @@ }, "vmName": { "type": "string", - "description": "Name of the virtual machine where this instance lives. Only applicable for instances in App Engine flexible environment. @OutputOnly" + "description": "Name of the virtual machine where this instance lives. Only applicable for instances in App Engine flexible environment.@OutputOnly" }, "vmZoneName": { "type": "string", - "description": "Zone where the virtual machine is located. Only applicable for instances in App Engine flexible environment. @OutputOnly" + "description": "Zone where the virtual machine is located. Only applicable for instances in App Engine flexible environment.@OutputOnly" }, "vmId": { "type": "string", - "description": "Virtual machine ID of this instance. Only applicable for instances in App Engine flexible environment. @OutputOnly" + "description": "Virtual machine ID of this instance. Only applicable for instances in App Engine flexible environment.@OutputOnly" }, "startTime": { "type": "string", - "description": "Time that this instance was started. @OutputOnly" + "description": "Time that this instance was started.@OutputOnly" }, "requests": { "type": "integer", - "description": "Number of requests since this instance was started. @OutputOnly", + "description": "Number of requests since this instance was started.@OutputOnly", "format": "int32" }, "errors": { "type": "integer", - "description": "Number of errors since this instance was started. @OutputOnly", + "description": "Number of errors since this instance was started.@OutputOnly", "format": "int32" }, "qps": { "type": "number", - "description": "Average queries per second (QPS) over the last minute. @OutputOnly", + "description": "Average queries per second (QPS) over the last minute.@OutputOnly", "format": "float" }, "averageLatency": { "type": "integer", - "description": "Average latency (ms) over the last minute. @OutputOnly", + "description": "Average latency (ms) over the last minute.@OutputOnly", "format": "int32" }, "memoryUsage": { "type": "string", - "description": "Total memory in use (bytes). @OutputOnly", + "description": "Total memory in use (bytes).@OutputOnly", "format": "int64" }, "vmStatus": { "type": "string", - "description": "Status of the virtual machine where this instance lives. Only applicable for instances in App Engine flexible environment. @OutputOnly" + "description": "Status of the virtual machine where this instance lives. Only applicable for instances in App Engine flexible environment.@OutputOnly" }, "vmDebugEnabled": { "type": "boolean", - "description": "Whether this instance is in debug mode. Only applicable for instances in App Engine flexible environment. @OutputOnly" + "description": "Whether this instance is in debug mode. Only applicable for instances in App Engine flexible environment.@OutputOnly" + }, + "vmIp": { + "type": "string", + "description": "The IP address of this instance. Only applicable for instances in App Engine flexible environment.@OutputOnly" } } }, "DebugInstanceRequest": { "id": "DebugInstanceRequest", "type": "object", - "description": "Request message for `Instances.DebugInstance`." + "description": "Request message for Instances.DebugInstance.", + "properties": { + "sshKey": { + "type": "string", + "description": "Public SSH key to add to the instance. Examples: [USERNAME]:ssh-rsa [KEY_VALUE] [USERNAME] [USERNAME]:ssh-rsa [KEY_VALUE] google-ssh {\"userName\":\"[USERNAME]\",\"expireOn\":\"[EXPIRE_TIME]\"}For more information, see Adding and Removing SSH Keys (https://cloud.google.com/compute/docs/instances/adding-removing-ssh-keys)." + } + } }, "ListLocationsResponse": { "id": "ListLocationsResponse", @@ -1164,11 +1231,11 @@ "properties": { "name": { "type": "string", - "description": "Resource name for the location, which may vary between implementations. For example: `\"projects/example-project/locations/us-east1\"`" + "description": "Resource name for the location, which may vary between implementations. For example: \"projects/example-project/locations/us-east1\"" }, "locationId": { "type": "string", - "description": "The cononical id for this location. For example: `\"us-east1\"`." + "description": "The canonical id for this location. For example: \"us-east1\"." }, "labels": { "type": "object", @@ -1187,6 +1254,33 @@ } } }, + "OperationMetadataExperimental": { + "id": "OperationMetadataExperimental", + "type": "object", + "description": "Metadata for the given google.longrunning.Operation.", + "properties": { + "method": { + "type": "string", + "description": "API method that initiated this operation. Example: google.appengine.experimental.CustomDomains.CreateCustomDomain.@OutputOnly" + }, + "insertTime": { + "type": "string", + "description": "Time that this operation was created.@OutputOnly" + }, + "endTime": { + "type": "string", + "description": "Time that this operation completed.@OutputOnly" + }, + "user": { + "type": "string", + "description": "User who requested this operation.@OutputOnly" + }, + "target": { + "type": "string", + "description": "Name of the resource that this operation is acting on. Example: apps/myapp/customDomains/example.com.@OutputOnly" + } + } + }, "OperationMetadata": { "id": "OperationMetadata", "type": "object", @@ -1194,27 +1288,27 @@ "properties": { "operationType": { "type": "string", - "description": "Type of this operation. Deprecated, use method field instead. Example: \"create_version\". @OutputOnly" + "description": "Type of this operation. Deprecated, use method field instead. Example: \"create_version\".@OutputOnly" }, "insertTime": { "type": "string", - "description": "Timestamp that this operation was created. @OutputOnly" + "description": "Timestamp that this operation was created.@OutputOnly" }, "endTime": { "type": "string", - "description": "Timestamp that this operation completed. @OutputOnly" + "description": "Timestamp that this operation completed.@OutputOnly" }, "user": { "type": "string", - "description": "User who requested this operation. @OutputOnly" + "description": "User who requested this operation.@OutputOnly" }, "target": { "type": "string", - "description": "Name of the resource that this operation is acting on. Example: `apps/myapp/modules/default`. @OutputOnly" + "description": "Name of the resource that this operation is acting on. Example: apps/myapp/modules/default.@OutputOnly" }, "method": { "type": "string", - "description": "API method that initiated this operation. Example: `google.appengine.v1beta4.Version.CreateVersion`. @OutputOnly" + "description": "API method that initiated this operation. Example: google.appengine.v1beta4.Version.CreateVersion.@OutputOnly" } } }, @@ -1225,23 +1319,23 @@ "properties": { "method": { "type": "string", - "description": "API method name that initiated this operation. Example: `google.appengine.v1beta5.Version.CreateVersion`. @OutputOnly" + "description": "API method name that initiated this operation. Example: google.appengine.v1beta5.Version.CreateVersion.@OutputOnly" }, "insertTime": { "type": "string", - "description": "Timestamp that this operation was created. @OutputOnly" + "description": "Timestamp that this operation was created.@OutputOnly" }, "endTime": { "type": "string", - "description": "Timestamp that this operation completed. @OutputOnly" + "description": "Timestamp that this operation completed.@OutputOnly" }, "user": { "type": "string", - "description": "User who requested this operation. @OutputOnly" + "description": "User who requested this operation.@OutputOnly" }, "target": { "type": "string", - "description": "Name of the resource that this operation is acting on. Example: `apps/myapp/services/default`. @OutputOnly" + "description": "Name of the resource that this operation is acting on. Example: apps/myapp/services/default.@OutputOnly" } } }, @@ -1252,23 +1346,34 @@ "properties": { "method": { "type": "string", - "description": "API method that initiated this operation. Example: `google.appengine.v1.Versions.CreateVersion`. @OutputOnly" + "description": "API method that initiated this operation. Example: google.appengine.v1.Versions.CreateVersion.@OutputOnly" }, "insertTime": { "type": "string", - "description": "Time that this operation was created. @OutputOnly" + "description": "Time that this operation was created.@OutputOnly" }, "endTime": { "type": "string", - "description": "Time that this operation completed. @OutputOnly" + "description": "Time that this operation completed.@OutputOnly" }, "user": { "type": "string", - "description": "User who requested this operation. @OutputOnly" + "description": "User who requested this operation.@OutputOnly" }, "target": { "type": "string", - "description": "Name of the resource that this operation is acting on. Example: `apps/myapp/services/default`. @OutputOnly" + "description": "Name of the resource that this operation is acting on. Example: apps/myapp/services/default.@OutputOnly" + }, + "ephemeralMessage": { + "type": "string", + "description": "Ephemeral message that may change every time the operation is polled. @OutputOnly" + }, + "warning": { + "type": "array", + "description": "Durable messages that persist on every operation poll. @OutputOnly", + "items": { + "type": "string" + } } } }, @@ -1279,11 +1384,11 @@ "properties": { "standardEnvironmentAvailable": { "type": "boolean", - "description": "App Engine Standard Environment is available in the given location. @OutputOnly" + "description": "App Engine Standard Environment is available in the given location.@OutputOnly" }, "flexibleEnvironmentAvailable": { "type": "boolean", - "description": "App Engine Flexible Environment is available in the given location. @OutputOnly" + "description": "App Engine Flexible Environment is available in the given location.@OutputOnly" } } } @@ -1299,7 +1404,7 @@ "parameters": { "appsId": { "type": "string", - "description": "Part of `name`. Name of the Application resource to get. Example: `apps/myapp`.", + "description": "Part of `name`. Name of the Application resource to get. Example: apps/myapp.", "required": true, "location": "path" } @@ -1310,6 +1415,54 @@ "response": { "$ref": "Application" }, + "scopes": [ + "https://www.googleapis.com/auth/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" + ] + }, + "create": { + "id": "appengine.apps.create", + "path": "v1/apps", + "httpMethod": "POST", + "description": "Creates an App Engine application for a Google Cloud Platform project. This requires a project that excludes an App Engine application. For details about creating a project without an application, see the Google Cloud Resource Manager create project topic (https://cloud.google.com/resource-manager/docs/creating-project).", + "request": { + "$ref": "Application" + }, + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "patch": { + "id": "appengine.apps.patch", + "path": "v1/apps/{appsId}", + "httpMethod": "PATCH", + "description": "Updates the specified Application resource. You can update the following fields: auth_domain (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps#Application.FIELDS.auth_domain) default_cookie_expiration (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps#Application.FIELDS.default_cookie_expiration)", + "parameters": { + "appsId": { + "type": "string", + "description": "Part of `name`. Name of the Application resource to update. Example: apps/myapp.", + "required": true, + "location": "path" + }, + "updateMask": { + "type": "string", + "description": "Standard field mask for the set of fields to be updated.", + "location": "query" + } + }, + "parameterOrder": [ + "appsId" + ], + "request": { + "$ref": "Application" + }, + "response": { + "$ref": "Operation" + }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform" ] @@ -1318,11 +1471,11 @@ "id": "appengine.apps.repair", "path": "v1/apps/{appsId}:repair", "httpMethod": "POST", - "description": "Recreates the required App Engine features for the application in your project, for example a Cloud Storage bucket or App Engine service account. Use this method if you receive an error message about a missing feature, for example \"*Error retrieving the App Engine service account*\".", + "description": "Recreates the required App Engine features for the specified App Engine application, for example a Cloud Storage bucket or App Engine service account. Use this method if you receive an error message about a missing feature, for example, Error retrieving the App Engine service account.", "parameters": { "appsId": { "type": "string", - "description": "Part of `name`. Name of the application to repair. Example: `apps/myapp`", + "description": "Part of `name`. Name of the application to repair. Example: apps/myapp", "required": true, "location": "path" } @@ -1344,41 +1497,11 @@ "resources": { "operations": { "methods": { - "get": { - "id": "appengine.apps.operations.get", - "path": "v1/apps/{appsId}/operations/{operationsId}", - "httpMethod": "GET", - "description": "Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.", - "parameters": { - "appsId": { - "type": "string", - "description": "Part of `name`. The name of the operation resource.", - "required": true, - "location": "path" - }, - "operationsId": { - "type": "string", - "description": "Part of `name`. See documentation of `appsId`.", - "required": true, - "location": "path" - } - }, - "parameterOrder": [ - "appsId", - "operationsId" - ], - "response": { - "$ref": "Operation" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform" - ] - }, "list": { "id": "appengine.apps.operations.list", "path": "v1/apps/{appsId}/operations", "httpMethod": "GET", - "description": "Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`. NOTE: the `name` binding below allows API services to override the binding to use different resource name schemes, such as `users/*/operations`.", + "description": "Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED.NOTE: the name binding below allows API services to override the binding to use different resource name schemes, such as users/*/operations.", "parameters": { "appsId": { "type": "string", @@ -1410,7 +1533,41 @@ "$ref": "ListOperationsResponse" }, "scopes": [ - "https://www.googleapis.com/auth/cloud-platform" + "https://www.googleapis.com/auth/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" + ] + }, + "get": { + "id": "appengine.apps.operations.get", + "path": "v1/apps/{appsId}/operations/{operationsId}", + "httpMethod": "GET", + "description": "Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.", + "parameters": { + "appsId": { + "type": "string", + "description": "Part of `name`. The name of the operation resource.", + "required": true, + "location": "path" + }, + "operationsId": { + "type": "string", + "description": "Part of `name`. See documentation of `appsId`.", + "required": true, + "location": "path" + } + }, + "parameterOrder": [ + "appsId", + "operationsId" + ], + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" ] } } @@ -1425,7 +1582,7 @@ "parameters": { "appsId": { "type": "string", - "description": "Part of `parent`. Name of the parent Application resource. Example: `apps/myapp`.", + "description": "Part of `parent`. Name of the parent Application resource. Example: apps/myapp.", "required": true, "location": "path" }, @@ -1448,7 +1605,9 @@ "$ref": "ListServicesResponse" }, "scopes": [ - "https://www.googleapis.com/auth/cloud-platform" + "https://www.googleapis.com/auth/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" ] }, "get": { @@ -1459,7 +1618,7 @@ "parameters": { "appsId": { "type": "string", - "description": "Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default`.", + "description": "Part of `name`. Name of the resource requested. Example: apps/myapp/services/default.", "required": true, "location": "path" }, @@ -1478,7 +1637,9 @@ "$ref": "Service" }, "scopes": [ - "https://www.googleapis.com/auth/cloud-platform" + "https://www.googleapis.com/auth/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" ] }, "patch": { @@ -1489,7 +1650,7 @@ "parameters": { "appsId": { "type": "string", - "description": "Part of `name`. Name of the resource to update. Example: `apps/myapp/services/default`.", + "description": "Part of `name`. Name of the resource to update. Example: apps/myapp/services/default.", "required": true, "location": "path" }, @@ -1506,7 +1667,7 @@ }, "migrateTraffic": { "type": "boolean", - "description": "Set to `true` to gradually shift traffic from one version to another single version. By default, traffic is shifted immediately. For gradual traffic migration, the target version must be located within instances that are configured for both [warmup requests](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#inboundservicetype) and [automatic scaling](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#automaticscaling). You must specify the [`shardBy`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services#shardby) field in the Service resource. Gradual traffic migration is not supported in the App Engine flexible environment. For examples, see [Migrating and Splitting Traffic](https://cloud.google.com/appengine/docs/admin-api/migrating-splitting-traffic).", + "description": "Set to true to gradually shift traffic from one version to another single version. By default, traffic is shifted immediately. For gradual traffic migration, the target version must be located within instances that are configured for both warmup requests (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#inboundservicetype) and automatic scaling (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#automaticscaling). You must specify the shardBy (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services#shardby) field in the Service resource. Gradual traffic migration is not supported in the App Engine flexible environment. For examples, see Migrating and Splitting Traffic (https://cloud.google.com/appengine/docs/admin-api/migrating-splitting-traffic).", "location": "query" } }, @@ -1532,7 +1693,7 @@ "parameters": { "appsId": { "type": "string", - "description": "Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default`.", + "description": "Part of `name`. Name of the resource requested. Example: apps/myapp/services/default.", "required": true, "location": "path" }, @@ -1566,7 +1727,7 @@ "parameters": { "appsId": { "type": "string", - "description": "Part of `parent`. Name of the parent Service resource. Example: `apps/myapp/services/default`.", + "description": "Part of `parent`. Name of the parent Service resource. Example: apps/myapp/services/default.", "required": true, "location": "path" }, @@ -1578,7 +1739,7 @@ }, "view": { "type": "string", - "description": "Controls the set of fields returned in the `List` response.", + "description": "Controls the set of fields returned in the List response.", "enum": [ "BASIC", "FULL" @@ -1605,18 +1766,20 @@ "$ref": "ListVersionsResponse" }, "scopes": [ - "https://www.googleapis.com/auth/cloud-platform" + "https://www.googleapis.com/auth/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" ] }, "get": { "id": "appengine.apps.services.versions.get", "path": "v1/apps/{appsId}/services/{servicesId}/versions/{versionsId}", "httpMethod": "GET", - "description": "Gets the specified Version resource. By default, only a `BASIC_VIEW` will be returned. Specify the `FULL_VIEW` parameter to get the full resource.", + "description": "Gets the specified Version resource. By default, only a BASIC_VIEW will be returned. Specify the FULL_VIEW parameter to get the full resource.", "parameters": { "appsId": { "type": "string", - "description": "Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default/versions/v1`.", + "description": "Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1.", "required": true, "location": "path" }, @@ -1634,7 +1797,7 @@ }, "view": { "type": "string", - "description": "Controls the set of fields returned in the `Get` response.", + "description": "Controls the set of fields returned in the Get response.", "enum": [ "BASIC", "FULL" @@ -1651,7 +1814,9 @@ "$ref": "Version" }, "scopes": [ - "https://www.googleapis.com/auth/cloud-platform" + "https://www.googleapis.com/auth/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" ] }, "create": { @@ -1662,7 +1827,7 @@ "parameters": { "appsId": { "type": "string", - "description": "Part of `parent`. Name of the parent resource to create this version under. Example: `apps/myapp/services/default`.", + "description": "Part of `parent`. Name of the parent resource to create this version under. Example: apps/myapp/services/default.", "required": true, "location": "path" }, @@ -1691,11 +1856,11 @@ "id": "appengine.apps.services.versions.patch", "path": "v1/apps/{appsId}/services/{servicesId}/versions/{versionsId}", "httpMethod": "PATCH", - "description": "Updates the specified Version resource. You can specify the following fields depending on the App Engine environment and type of scaling that the version resource uses: * [`serving_status`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.serving_status): For Version resources that use basic scaling, manual scaling, or run in the App Engine flexible environment. * [`instance_class`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.instance_class): For Version resources that run in the App Engine standard environment. * [`automatic_scaling.min_idle_instances`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment. * [`automatic_scaling.max_idle_instances`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment.", + "description": "Updates the specified Version resource. You can specify the following fields depending on the App Engine environment and type of scaling that the version resource uses: serving_status (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.serving_status): For Version resources that use basic scaling, manual scaling, or run in the App Engine flexible environment. instance_class (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.instance_class): For Version resources that run in the App Engine standard environment. automatic_scaling.min_idle_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment. automatic_scaling.max_idle_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment.", "parameters": { "appsId": { "type": "string", - "description": "Part of `name`. Name of the resource to update. Example: `apps/myapp/services/default/versions/1`.", + "description": "Part of `name`. Name of the resource to update. Example: apps/myapp/services/default/versions/1.", "required": true, "location": "path" }, @@ -1740,7 +1905,7 @@ "parameters": { "appsId": { "type": "string", - "description": "Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default/versions/v1`.", + "description": "Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1.", "required": true, "location": "path" }, @@ -1781,7 +1946,7 @@ "parameters": { "appsId": { "type": "string", - "description": "Part of `parent`. Name of the parent Version resource. Example: `apps/myapp/services/default/versions/v1`.", + "description": "Part of `parent`. Name of the parent Version resource. Example: apps/myapp/services/default/versions/v1.", "required": true, "location": "path" }, @@ -1818,7 +1983,9 @@ "$ref": "ListInstancesResponse" }, "scopes": [ - "https://www.googleapis.com/auth/cloud-platform" + "https://www.googleapis.com/auth/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" ] }, "get": { @@ -1829,7 +1996,7 @@ "parameters": { "appsId": { "type": "string", - "description": "Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default/versions/v1/instances/instance-1`.", + "description": "Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1/instances/instance-1.", "required": true, "location": "path" }, @@ -1862,7 +2029,9 @@ "$ref": "Instance" }, "scopes": [ - "https://www.googleapis.com/auth/cloud-platform" + "https://www.googleapis.com/auth/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" ] }, "delete": { @@ -1873,7 +2042,7 @@ "parameters": { "appsId": { "type": "string", - "description": "Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default/versions/v1/instances/instance-1`.", + "description": "Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1/instances/instance-1.", "required": true, "location": "path" }, @@ -1913,11 +2082,11 @@ "id": "appengine.apps.services.versions.instances.debug", "path": "v1/apps/{appsId}/services/{servicesId}/versions/{versionsId}/instances/{instancesId}:debug", "httpMethod": "POST", - "description": "Enables debugging on a VM instance. This allows you to use the SSH command to connect to the virtual machine where the instance lives. While in \"debug mode\", the instance continues to serve live traffic. You should delete the instance when you are done debugging and then allow the system to take over and determine if another instance should be started. Only applicable for instances in App Engine flexible environment.", + "description": "Enables debugging on a VM instance. This allows you to use the SSH command to connect to the virtual machine where the instance lives. While in \"debug mode\", the instance continues to serve live traffic. You should delete the instance when you are done debugging and then allow the system to take over and determine if another instance should be started.Only applicable for instances in App Engine flexible environment.", "parameters": { "appsId": { "type": "string", - "description": "Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default/versions/v1/instances/instance-1`.", + "description": "Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1/instances/instance-1.", "required": true, "location": "path" }, @@ -2000,7 +2169,9 @@ "$ref": "ListLocationsResponse" }, "scopes": [ - "https://www.googleapis.com/auth/cloud-platform" + "https://www.googleapis.com/auth/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" ] }, "get": { @@ -2030,7 +2201,9 @@ "$ref": "Location" }, "scopes": [ - "https://www.googleapis.com/auth/cloud-platform" + "https://www.googleapis.com/auth/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" ] } } diff --git a/etc/api/appengine/v1beta4/appengine-api.json b/etc/api/appengine/v1beta4/appengine-api.json index 06a6c7dda1..d30690bccd 100644 --- a/etc/api/appengine/v1beta4/appengine-api.json +++ b/etc/api/appengine/v1beta4/appengine-api.json @@ -1,11 +1,11 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/b39BKUXeyRHQFhweQbDoJSGyqUg\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/WPOHGBs1fdHtwU9urrOWmhzm9OM\"", "discoveryVersion": "v1", "id": "appengine:v1beta4", "name": "appengine", "version": "v1beta4", - "revision": "20160802", + "revision": "20161208", "title": "Google App Engine Admin API", "description": "Provisions and manages App Engine applications.", "ownerDomain": "google.com", @@ -103,75 +103,34 @@ "auth": { "oauth2": { "scopes": { + "https://www.googleapis.com/auth/appengine.admin": { + "description": "View and manage your applications deployed on Google App Engine" + }, "https://www.googleapis.com/auth/cloud-platform": { "description": "View and manage your data across Google Cloud Platform services" + }, + "https://www.googleapis.com/auth/cloud-platform.read-only": { + "description": "View your data across Google Cloud Platform services" } } } }, "schemas": { - "Application": { - "id": "Application", + "ListOperationsResponse": { + "id": "ListOperationsResponse", "type": "object", - "description": "An Application resource contains the top-level configuration of an App Engine application.", + "description": "The response message for Operations.ListOperations.", "properties": { - "name": { - "type": "string", - "description": "Full path to the Application resource in the API. Example: `apps/myapp`. @OutputOnly" - }, - "id": { - "type": "string", - "description": "Identifier of the Application resource. This identifier is equivalent to the project ID of the Google Cloud Platform project where you want to deploy your application. Example: `myapp`." - }, - "dispatchRules": { + "operations": { "type": "array", - "description": "HTTP path dispatch rules for requests to the application that do not explicitly target a module or version. Rules are order-dependent. @OutputOnly", + "description": "A list of operations that matches the specified filter in the request.", "items": { - "$ref": "UrlDispatchRule" + "$ref": "Operation" } }, - "authDomain": { + "nextPageToken": { "type": "string", - "description": "Google Apps authentication domain that controls which users can access this application. Defaults to open access for any Google Account." - }, - "location": { - "type": "string", - "description": "Location from which this application will be run. Application instances will run out of data centers in the chosen location, which is also where all of the application's end user content is stored. Defaults to `us-central`. Options are: `us-central` - Central US `europe-west` - Western Europe `us-east1` - Eastern US" - }, - "codeBucket": { - "type": "string", - "description": "Google Cloud Storage bucket that can be used for storing files associated with this application. This bucket is associated with the application and can be used by the gcloud deployment commands. @OutputOnly" - }, - "defaultCookieExpiration": { - "type": "string", - "description": "Cookie expiration policy for this application. @OutputOnly" - }, - "defaultHostname": { - "type": "string", - "description": "Hostname used to reach the application, as resolved by App Engine. @OutputOnly" - }, - "defaultBucket": { - "type": "string", - "description": "Google Cloud Storage bucket that can be used by this application to store content. @OutputOnly" - } - } - }, - "UrlDispatchRule": { - "id": "UrlDispatchRule", - "type": "object", - "description": "Rules to match an HTTP request and dispatch that request to a module.", - "properties": { - "domain": { - "type": "string", - "description": "Domain name to match against. The wildcard \"`*`\" is supported if specified before a period: \"`*.`\". Defaults to matching all domains: \"`*`\"." - }, - "path": { - "type": "string", - "description": "Pathname within the host. Must start with a \"`/`\". A single \"`*`\" can be included at the end of the path. The sum of the lengths of the domain and path may not exceed 100 characters." - }, - "module": { - "type": "string", - "description": "Resource ID of a module in this application that should serve the matched request. The module must already exist. Example: `default`." + "description": "The standard List next-page token." } } }, @@ -182,7 +141,7 @@ "properties": { "name": { "type": "string", - "description": "The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should have the format of `operations/some/unique/name`." + "description": "The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the name should have the format of operations/some/unique/name." }, "metadata": { "type": "object", @@ -194,15 +153,15 @@ }, "done": { "type": "boolean", - "description": "If the value is `false`, it means the operation is still in progress. If true, the operation is completed, and either `error` or `response` is available." + "description": "If the value is false, it means the operation is still in progress. If true, the operation is completed, and either error or response is available." }, "error": { "$ref": "Status", - "description": "The error result of the operation in case of failure." + "description": "The error result of the operation in case of failure or cancellation." }, "response": { "type": "object", - "description": "The normal response of the operation in case of success. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.", + "description": "The normal response of the operation in case of success. If the original method returns no data on success, such as Delete, the response is google.protobuf.Empty. If the original method is standard Get/Create/Update, the response should be the resource. For other methods, the response should have the type XxxResponse, where Xxx is the original method name. For example, if the original method name is TakeSnapshot(), the inferred response type is TakeSnapshotResponse.", "additionalProperties": { "type": "any", "description": "Properties of the object. Contains field @type with type URL." @@ -213,7 +172,7 @@ "Status": { "id": "Status", "type": "object", - "description": "The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). The error model is designed to be: - Simple to use and understand for most users - Flexible enough to meet unexpected needs # Overview The `Status` message contains three pieces of data: error code, error message, and error details. The error code should be an enum value of google.rpc.Code, but it may accept additional error codes if needed. The error message should be a developer-facing English message that helps developers *understand* and *resolve* the error. If a localized user-facing error message is needed, put the localized message in the error details or localize it in the client. The optional error details may contain arbitrary information about the error. There is a predefined set of error detail types in the package `google.rpc` which can be used for common error conditions. # Language mapping The `Status` message is the logical representation of the error model, but it is not necessarily the actual wire format. When the `Status` message is exposed in different client libraries and different wire protocols, it can be mapped differently. For example, it will likely be mapped to some exceptions in Java, but more likely mapped to some error codes in C. # Other uses The error model and the `Status` message can be used in a variety of environments, either with or without APIs, to provide a consistent developer experience across different environments. Example uses of this error model include: - Partial errors. If a service needs to return partial errors to the client, it may embed the `Status` in the normal response to indicate the partial errors. - Workflow errors. A typical workflow has multiple steps. Each step may have a `Status` message for error reporting purpose. - Batch operations. If a client uses batch request and batch response, the `Status` message should be used directly inside batch response, one for each error sub-response. - Asynchronous operations. If an API call embeds asynchronous operation results in its response, the status of those operations should be represented directly using the `Status` message. - Logging. If some API errors are stored in logs, the message `Status` could be used directly after any stripping needed for security/privacy reasons.", + "description": "The Status type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by gRPC (https://github.com/grpc). The error model is designed to be: Simple to use and understand for most users Flexible enough to meet unexpected needsOverviewThe Status message contains three pieces of data: error code, error message, and error details. The error code should be an enum value of google.rpc.Code, but it may accept additional error codes if needed. The error message should be a developer-facing English message that helps developers understand and resolve the error. If a localized user-facing error message is needed, put the localized message in the error details or localize it in the client. The optional error details may contain arbitrary information about the error. There is a predefined set of error detail types in the package google.rpc which can be used for common error conditions.Language mappingThe Status message is the logical representation of the error model, but it is not necessarily the actual wire format. When the Status message is exposed in different client libraries and different wire protocols, it can be mapped differently. For example, it will likely be mapped to some exceptions in Java, but more likely mapped to some error codes in C.Other usesThe error model and the Status message can be used in a variety of environments, either with or without APIs, to provide a consistent developer experience across different environments.Example uses of this error model include: Partial errors. If a service needs to return partial errors to the client, it may embed the Status in the normal response to indicate the partial errors. Workflow errors. A typical workflow has multiple steps. Each step may have a Status message for error reporting purpose. Batch operations. If a client uses batch request and batch response, the Status message should be used directly inside batch response, one for each error sub-response. Asynchronous operations. If an API call embeds asynchronous operation results in its response, the status of those operations should be represented directly using the Status message. Logging. If some API errors are stored in logs, the message Status could be used directly after any stripping needed for security/privacy reasons.", "properties": { "code": { "type": "integer", @@ -237,6 +196,71 @@ } } }, + "Application": { + "id": "Application", + "type": "object", + "description": "An Application resource contains the top-level configuration of an App Engine application.", + "properties": { + "name": { + "type": "string", + "description": "Full path to the Application resource in the API. Example: apps/myapp.@OutputOnly" + }, + "id": { + "type": "string", + "description": "Identifier of the Application resource. This identifier is equivalent to the project ID of the Google Cloud Platform project where you want to deploy your application. Example: myapp." + }, + "dispatchRules": { + "type": "array", + "description": "HTTP path dispatch rules for requests to the application that do not explicitly target a module or version. Rules are order-dependent.@OutputOnly", + "items": { + "$ref": "UrlDispatchRule" + } + }, + "authDomain": { + "type": "string", + "description": "Google Apps authentication domain that controls which users can access this application.Defaults to open access for any Google Account." + }, + "location": { + "type": "string", + "description": "Location from which this application will be run. Application instances will run out of data centers in the chosen location, which is also where all of the application's end user content is stored.Defaults to us-central.Options are:us-central - Central USeurope-west - Western Europeus-east1 - Eastern US" + }, + "codeBucket": { + "type": "string", + "description": "Google Cloud Storage bucket that can be used for storing files associated with this application. This bucket is associated with the application and can be used by the gcloud deployment commands.@OutputOnly" + }, + "defaultCookieExpiration": { + "type": "string", + "description": "Cookie expiration policy for this application." + }, + "defaultHostname": { + "type": "string", + "description": "Hostname used to reach the application, as resolved by App Engine.@OutputOnly" + }, + "defaultBucket": { + "type": "string", + "description": "Google Cloud Storage bucket that can be used by this application to store content.@OutputOnly" + } + } + }, + "UrlDispatchRule": { + "id": "UrlDispatchRule", + "type": "object", + "description": "Rules to match an HTTP request and dispatch that request to a module.", + "properties": { + "domain": { + "type": "string", + "description": "Domain name to match against. The wildcard \"*\" is supported if specified before a period: \"*.\".Defaults to matching all domains: \"*\"." + }, + "path": { + "type": "string", + "description": "Pathname within the host. Must start with a \"/\". A single \"*\" can be included at the end of the path. The sum of the lengths of the domain and path may not exceed 100 characters." + }, + "module": { + "type": "string", + "description": "Resource ID of a module in this application that should serve the matched request. The module must already exist. Example: default." + } + } + }, "Version": { "id": "Version", "type": "object", @@ -244,11 +268,11 @@ "properties": { "name": { "type": "string", - "description": "Full path to the Version resource in the API. Example: `apps/myapp/modules/default/versions/v1`. @OutputOnly" + "description": "Full path to the Version resource in the API. Example: apps/myapp/modules/default/versions/v1.@OutputOnly" }, "id": { "type": "string", - "description": "Relative name of the version within the module. Example: `v1`. Version names can contain only lowercase letters, numbers, or hyphens. Reserved names: \"default\", \"latest\", and any name with the prefix \"ah-\"." + "description": "Relative name of the version within the module. Example: v1. Version names can contain only lowercase letters, numbers, or hyphens. Reserved names: \"default\", \"latest\", and any name with the prefix \"ah-\"." }, "automaticScaling": { "$ref": "AutomaticScaling", @@ -293,7 +317,7 @@ }, "instanceClass": { "type": "string", - "description": "Instance class that is used to run this version. Valid values are: * AutomaticScaling: `F1`, `F2`, `F4`, `F4_1G` * ManualScaling or BasicScaling: `B1`, `B2`, `B4`, `B8`, `B4_1G` Defaults to `F1` for AutomaticScaling and `B1` for ManualScaling or BasicScaling." + "description": "Instance class that is used to run this version. Valid values are: AutomaticScaling: F1, F2, F4, F4_1G ManualScaling or BasicScaling: B1, B2, B4, B8, B4_1GDefaults to F1 for AutomaticScaling and B1 for ManualScaling or BasicScaling." }, "network": { "$ref": "Network", @@ -305,7 +329,7 @@ }, "runtime": { "type": "string", - "description": "Desired runtime. Example: `python27`." + "description": "Desired runtime. Example: python27." }, "threadsafe": { "type": "boolean", @@ -324,11 +348,11 @@ }, "env": { "type": "string", - "description": "App Engine execution environment to use for this version. Defaults to `1`." + "description": "App Engine execution environment to use for this version.Defaults to 1." }, "servingStatus": { "type": "string", - "description": "Current serving status of this version. Only the versions with a `SERVING` status create instances and can be billed. `SERVING_STATUS_UNSPECIFIED` is an invalid value. Defaults to `SERVING`.", + "description": "Current serving status of this version. Only the versions with a SERVING status create instances and can be billed.SERVING_STATUS_UNSPECIFIED is an invalid value. Defaults to SERVING.", "enum": [ "SERVING_STATUS_UNSPECIFIED", "SERVING", @@ -337,59 +361,59 @@ }, "deployer": { "type": "string", - "description": "Email address of the user who created this version. @OutputOnly" + "description": "Email address of the user who created this version.@OutputOnly" }, "creationTime": { "type": "string", - "description": "Time that this version was created. @OutputOnly" + "description": "Time that this version was created.@OutputOnly" }, "handlers": { "type": "array", - "description": "An ordered list of URL-matching patterns that should be applied to incoming requests. The first matching URL handles the request and other request handlers are not attempted. Only returned in `GET` requests if `view=FULL` is set.", + "description": "An ordered list of URL-matching patterns that should be applied to incoming requests. The first matching URL handles the request and other request handlers are not attempted.Only returned in GET requests if view=FULL is set.", "items": { "$ref": "UrlMap" } }, "errorHandlers": { "type": "array", - "description": "Custom static error pages. Limited to 10KB per page. Only returned in `GET` requests if `view=FULL` is set.", + "description": "Custom static error pages. Limited to 10KB per page.Only returned in GET requests if view=FULL is set.", "items": { "$ref": "ErrorHandler" } }, "libraries": { "type": "array", - "description": "Configuration for third-party Python runtime libraries required by the application. Only returned in `GET` requests if `view=FULL` is set.", + "description": "Configuration for third-party Python runtime libraries required by the application.Only returned in GET requests if view=FULL is set.", "items": { "$ref": "Library" } }, "apiConfig": { "$ref": "ApiConfigHandler", - "description": "Serving configuration for [Google Cloud Endpoints](https://cloud.google.com/appengine/docs/python/endpoints/). Only returned in `GET` requests if `view=FULL` is set." + "description": "Serving configuration for Google Cloud Endpoints (https://cloud.google.com/appengine/docs/python/endpoints/).Only returned in GET requests if view=FULL is set." }, "envVariables": { "type": "object", - "description": "Environment variables made available to the application. Only returned in `GET` requests if `view=FULL` is set.", + "description": "Environment variables made available to the application.Only returned in GET requests if view=FULL is set.", "additionalProperties": { "type": "string" } }, "defaultExpiration": { "type": "string", - "description": "Duration that static files should be cached by web proxies and browsers. Only applicable if the corresponding [StaticFilesHandler](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#staticfileshandler) does not specify its own expiration time. Only returned in `GET` requests if `view=FULL` is set." + "description": "Duration that static files should be cached by web proxies and browsers. Only applicable if the corresponding StaticFilesHandler (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#staticfileshandler) does not specify its own expiration time.Only returned in GET requests if view=FULL is set." }, "healthCheck": { "$ref": "HealthCheck", - "description": "Configures health checking for VM instances. Unhealthy instances are stopped and replaced with new instances. Only applicable for VM runtimes. Only returned in `GET` requests if `view=FULL` is set." + "description": "Configures health checking for VM instances. Unhealthy instances are stopped and replaced with new instances. Only applicable for VM runtimes.Only returned in GET requests if view=FULL is set." }, "nobuildFilesRegex": { "type": "string", - "description": "Files that match this pattern will not be built into this version. Only applicable for Go runtimes. Only returned in `GET` requests if `view=FULL` is set." + "description": "Files that match this pattern will not be built into this version. Only applicable for Go runtimes.Only returned in GET requests if view=FULL is set." }, "deployment": { "$ref": "Deployment", - "description": "Code and application artifacts that make up this version. Only returned in `GET` requests if `view=FULL` is set." + "description": "Code and application artifacts that make up this version.Only returned in GET requests if view=FULL is set." } } }, @@ -400,7 +424,7 @@ "properties": { "coolDownPeriod": { "type": "string", - "description": "Amount of time that the [Autoscaler](https://cloud.google.com/compute/docs/autoscaler/) should wait between changes to the number of virtual machines. Only applicable for VM runtimes." + "description": "Amount of time that the Autoscaler (https://cloud.google.com/compute/docs/autoscaler/) should wait between changes to the number of virtual machines. Only applicable for VM runtimes." }, "cpuUtilization": { "$ref": "CpuUtilization", @@ -408,7 +432,7 @@ }, "maxConcurrentRequests": { "type": "integer", - "description": "Number of concurrent requests an automatic scaling instance can accept before the scheduler spawns a new instance. Defaults to a runtime-specific value.", + "description": "Number of concurrent requests an automatic scaling instance can accept before the scheduler spawns a new instance.Defaults to a runtime-specific value.", "format": "int32" }, "maxIdleInstances": { @@ -563,7 +587,7 @@ "properties": { "instances": { "type": "integer", - "description": "Number of instances to assign to the module at the start. This number can later be altered by using the [Modules API](https://cloud.google.com/appengine/docs/python/modules/functions) `set_num_instances()` function.", + "description": "Number of instances to assign to the module at the start. This number can later be altered by using the Modules API (https://cloud.google.com/appengine/docs/python/modules/functions) set_num_instances() function.", "format": "int32" } } @@ -586,7 +610,7 @@ }, "name": { "type": "string", - "description": "Google Cloud Platform network where the virtual machines are created. Specify the short name, not the resource path. Defaults to `default`." + "description": "Google Cloud Platform network where the virtual machines are created. Specify the short name, not the resource path.Defaults to default." } } }, @@ -609,6 +633,33 @@ "type": "number", "description": "Memory (GB) needed.", "format": "double" + }, + "volumes": { + "type": "array", + "description": "User specified volumes.", + "items": { + "$ref": "Volume" + } + } + } + }, + "Volume": { + "id": "Volume", + "type": "object", + "description": "Volumes mounted within the app container. Only applicable for VM runtimes.", + "properties": { + "name": { + "type": "string", + "description": "Unique name for the volume." + }, + "volumeType": { + "type": "string", + "description": "Underlying volume type, e.g. 'tmpfs'." + }, + "sizeGb": { + "type": "number", + "description": "Volume size in gigabytes.", + "format": "double" } } }, @@ -627,7 +678,7 @@ }, "staticDirectory": { "$ref": "StaticDirectoryHandler", - "description": "Serves the entire contents of a directory as static files. This attribute is deprecated. You can mimic the behavior of static directories using static files." + "description": "Serves the entire contents of a directory as static files.This attribute is deprecated. You can mimic the behavior of static directories using static files." }, "script": { "$ref": "ScriptHandler", @@ -660,7 +711,7 @@ }, "authFailAction": { "type": "string", - "description": "Action to take when users access resources that require authentication. Defaults to `redirect`.", + "description": "Action to take when users access resources that require authentication. Defaults to redirect.", "enum": [ "AUTH_FAIL_ACTION_UNSPECIFIED", "AUTH_FAIL_ACTION_REDIRECT", @@ -669,7 +720,7 @@ }, "redirectHttpResponseCode": { "type": "string", - "description": "`30x` code to use when performing redirects for the `secure` field. Defaults to `302`.", + "description": "30x code to use when performing redirects for the secure field. Defaults to 302.", "enum": [ "REDIRECT_HTTP_RESPONSE_CODE_UNSPECIFIED", "REDIRECT_HTTP_RESPONSE_CODE_301", @@ -725,7 +776,7 @@ "properties": { "directory": { "type": "string", - "description": "Path to the directory containing the static files from the application root directory. Everything after the end of the matched URL pattern is appended to `static_dir` to form the full path to the requested file." + "description": "Path to the directory containing the static files from the application root directory. Everything after the end of the matched URL pattern is appended to static_dir to form the full path to the requested file." }, "httpHeaders": { "type": "object", @@ -796,7 +847,7 @@ }, "mimeType": { "type": "string", - "description": "MIME type of file. Defaults to `text/html`." + "description": "MIME type of file. Defaults to text/html." } } }, @@ -818,11 +869,11 @@ "ApiConfigHandler": { "id": "ApiConfigHandler", "type": "object", - "description": "[Google Cloud Endpoints](https://cloud.google.com/appengine/docs/python/endpoints/) configuration for API handlers.", + "description": "Google Cloud Endpoints (https://cloud.google.com/appengine/docs/python/endpoints/) configuration for API handlers.", "properties": { "authFailAction": { "type": "string", - "description": "Action to take when users access resources that require authentication. Defaults to `redirect`.", + "description": "Action to take when users access resources that require authentication. Defaults to redirect.", "enum": [ "AUTH_FAIL_ACTION_UNSPECIFIED", "AUTH_FAIL_ACTION_REDIRECT", @@ -831,7 +882,7 @@ }, "login": { "type": "string", - "description": "Level of login required to access this resource. Defaults to `optional`.", + "description": "Level of login required to access this resource. Defaults to optional.", "enum": [ "LOGIN_UNSPECIFIED", "LOGIN_OPTIONAL", @@ -930,7 +981,7 @@ "properties": { "sourceUrl": { "type": "string", - "description": "URL source to use to fetch this file. Must be a URL to a resource in Google Cloud Storage in the form 'http(s)://storage.googleapis.com/\\/\\'." + "description": "URL source to use to fetch this file. Must be a URL to a resource in Google Cloud Storage in the form 'http(s)://storage.googleapis.com//'." }, "sha1Sum": { "type": "string", @@ -938,7 +989,7 @@ }, "mimeType": { "type": "string", - "description": "The MIME type of the file. Defaults to the value from Google Cloud Storage." + "description": "The MIME type of the file.Defaults to the value from Google Cloud Storage." } } }, @@ -971,7 +1022,7 @@ "ListVersionsResponse": { "id": "ListVersionsResponse", "type": "object", - "description": "Response message for `Versions.ListVersions`.", + "description": "Response message for Versions.ListVersions.", "properties": { "versions": { "type": "array", @@ -993,11 +1044,11 @@ "properties": { "name": { "type": "string", - "description": "Full path to the Module resource in the API. Example: `apps/myapp/modules/default`. @OutputOnly" + "description": "Full path to the Module resource in the API. Example: apps/myapp/modules/default.@OutputOnly" }, "id": { "type": "string", - "description": "Relative name of the module within the application. Example: `default`. @OutputOnly" + "description": "Relative name of the module within the application. Example: default.@OutputOnly" }, "split": { "$ref": "TrafficSplit", @@ -1032,7 +1083,7 @@ "ListModulesResponse": { "id": "ListModulesResponse", "type": "object", - "description": "Response message for `Modules.ListModules`.", + "description": "Response message for Modules.ListModules.", "properties": { "modules": { "type": "array", @@ -1054,19 +1105,19 @@ "properties": { "name": { "type": "string", - "description": "Full path to the Instance resource in the API. Example: `apps/myapp/modules/default/versions/v1/instances/instance-1`. @OutputOnly" + "description": "Full path to the Instance resource in the API. Example: apps/myapp/modules/default/versions/v1/instances/instance-1.@OutputOnly" }, "id": { "type": "string", - "description": "Relative name of the instance within the version. Example: `instance-1`. @OutputOnly" + "description": "Relative name of the instance within the version. Example: instance-1.@OutputOnly" }, "appEngineRelease": { "type": "string", - "description": "App Engine release this instance is running on. @OutputOnly" + "description": "App Engine release this instance is running on.@OutputOnly" }, "availability": { "type": "string", - "description": "Availability of the instance. @OutputOnly", + "description": "Availability of the instance.@OutputOnly", "enum": [ "UNSPECIFIED", "RESIDENT", @@ -1075,59 +1126,63 @@ }, "vmName": { "type": "string", - "description": "Name of the virtual machine where this instance lives. Only applicable for instances in App Engine flexible environment. @OutputOnly" + "description": "Name of the virtual machine where this instance lives. Only applicable for instances in App Engine flexible environment.@OutputOnly" }, "vmZoneName": { "type": "string", - "description": "Zone where the virtual machine is located. Only applicable for instances in App Engine flexible environment. @OutputOnly" + "description": "Zone where the virtual machine is located. Only applicable for instances in App Engine flexible environment.@OutputOnly" }, "vmId": { "type": "string", - "description": "Virtual machine ID of this instance. Only applicable for instances in App Engine flexible environment. @OutputOnly" + "description": "Virtual machine ID of this instance. Only applicable for instances in App Engine flexible environment.@OutputOnly" }, "startTimestamp": { "type": "string", - "description": "Time that this instance was started. @OutputOnly" + "description": "Time that this instance was started.@OutputOnly" }, "requests": { "type": "integer", - "description": "Number of requests since this instance was started. @OutputOnly", + "description": "Number of requests since this instance was started.@OutputOnly", "format": "int32" }, "errors": { "type": "integer", - "description": "Number of errors since this instance was started. @OutputOnly", + "description": "Number of errors since this instance was started.@OutputOnly", "format": "uint32" }, "qps": { "type": "number", - "description": "Average queries per second (QPS) over the last minute. @OutputOnly", + "description": "Average queries per second (QPS) over the last minute.@OutputOnly", "format": "float" }, "averageLatency": { "type": "integer", - "description": "Average latency (ms) over the last minute. @OutputOnly", + "description": "Average latency (ms) over the last minute.@OutputOnly", "format": "int32" }, "memoryUsage": { "type": "string", - "description": "Total memory in use (bytes). @OutputOnly", + "description": "Total memory in use (bytes).@OutputOnly", "format": "int64" }, "vmStatus": { "type": "string", - "description": "Status of the virtual machine where this instance lives. Only applicable for instances in App Engine flexible environment. @OutputOnly" + "description": "Status of the virtual machine where this instance lives. Only applicable for instances in App Engine flexible environment.@OutputOnly" }, "vmUnlocked": { "type": "boolean", - "description": "Whether this instance is in debug mode. Only applicable for instances in App Engine flexible environment. @OutputOnly" + "description": "Whether this instance is in debug mode. Only applicable for instances in App Engine flexible environment.@OutputOnly" + }, + "vmIp": { + "type": "string", + "description": "The IP address of this instance. Only applicable for instances in App Engine flexible environment.@OutputOnly" } } }, "ListInstancesResponse": { "id": "ListInstancesResponse", "type": "object", - "description": "Response message for `Instances.ListInstances`.", + "description": "Response message for Instances.ListInstances.", "properties": { "instances": { "type": "array", @@ -1145,23 +1200,11 @@ "DebugInstanceRequest": { "id": "DebugInstanceRequest", "type": "object", - "description": "Request message for `Instances.DebugInstance`." - }, - "ListOperationsResponse": { - "id": "ListOperationsResponse", - "type": "object", - "description": "The response message for Operations.ListOperations.", + "description": "Request message for Instances.DebugInstance.", "properties": { - "operations": { - "type": "array", - "description": "A list of operations that matches the specified filter in the request.", - "items": { - "$ref": "Operation" - } - }, - "nextPageToken": { + "sshKey": { "type": "string", - "description": "The standard List next-page token." + "description": "Public SSH key to add to the instance. Examples: [USERNAME]:ssh-rsa [KEY_VALUE] [USERNAME] [USERNAME]:ssh-rsa [KEY_VALUE] google-ssh {\"userName\":\"[USERNAME]\",\"expireOn\":\"[EXPIRE_TIME]\"}For more information, see Adding and Removing SSH Keys (https://cloud.google.com/compute/docs/instances/adding-removing-ssh-keys)." } } }, @@ -1190,11 +1233,11 @@ "properties": { "name": { "type": "string", - "description": "Resource name for the location, which may vary between implementations. For example: `\"projects/example-project/locations/us-east1\"`" + "description": "Resource name for the location, which may vary between implementations. For example: \"projects/example-project/locations/us-east1\"" }, "locationId": { "type": "string", - "description": "The cononical id for this location. For example: `\"us-east1\"`." + "description": "The canonical id for this location. For example: \"us-east1\"." }, "labels": { "type": "object", @@ -1213,6 +1256,33 @@ } } }, + "OperationMetadataExperimental": { + "id": "OperationMetadataExperimental", + "type": "object", + "description": "Metadata for the given google.longrunning.Operation.", + "properties": { + "method": { + "type": "string", + "description": "API method that initiated this operation. Example: google.appengine.experimental.CustomDomains.CreateCustomDomain.@OutputOnly" + }, + "insertTime": { + "type": "string", + "description": "Time that this operation was created.@OutputOnly" + }, + "endTime": { + "type": "string", + "description": "Time that this operation completed.@OutputOnly" + }, + "user": { + "type": "string", + "description": "User who requested this operation.@OutputOnly" + }, + "target": { + "type": "string", + "description": "Name of the resource that this operation is acting on. Example: apps/myapp/customDomains/example.com.@OutputOnly" + } + } + }, "OperationMetadata": { "id": "OperationMetadata", "type": "object", @@ -1220,27 +1290,27 @@ "properties": { "operationType": { "type": "string", - "description": "Type of this operation. Deprecated, use method field instead. Example: \"create_version\". @OutputOnly" + "description": "Type of this operation. Deprecated, use method field instead. Example: \"create_version\".@OutputOnly" }, "insertTime": { "type": "string", - "description": "Timestamp that this operation was created. @OutputOnly" + "description": "Timestamp that this operation was created.@OutputOnly" }, "endTime": { "type": "string", - "description": "Timestamp that this operation completed. @OutputOnly" + "description": "Timestamp that this operation completed.@OutputOnly" }, "user": { "type": "string", - "description": "User who requested this operation. @OutputOnly" + "description": "User who requested this operation.@OutputOnly" }, "target": { "type": "string", - "description": "Name of the resource that this operation is acting on. Example: `apps/myapp/modules/default`. @OutputOnly" + "description": "Name of the resource that this operation is acting on. Example: apps/myapp/modules/default.@OutputOnly" }, "method": { "type": "string", - "description": "API method that initiated this operation. Example: `google.appengine.v1beta4.Version.CreateVersion`. @OutputOnly" + "description": "API method that initiated this operation. Example: google.appengine.v1beta4.Version.CreateVersion.@OutputOnly" } } }, @@ -1251,23 +1321,23 @@ "properties": { "method": { "type": "string", - "description": "API method name that initiated this operation. Example: `google.appengine.v1beta5.Version.CreateVersion`. @OutputOnly" + "description": "API method name that initiated this operation. Example: google.appengine.v1beta5.Version.CreateVersion.@OutputOnly" }, "insertTime": { "type": "string", - "description": "Timestamp that this operation was created. @OutputOnly" + "description": "Timestamp that this operation was created.@OutputOnly" }, "endTime": { "type": "string", - "description": "Timestamp that this operation completed. @OutputOnly" + "description": "Timestamp that this operation completed.@OutputOnly" }, "user": { "type": "string", - "description": "User who requested this operation. @OutputOnly" + "description": "User who requested this operation.@OutputOnly" }, "target": { "type": "string", - "description": "Name of the resource that this operation is acting on. Example: `apps/myapp/services/default`. @OutputOnly" + "description": "Name of the resource that this operation is acting on. Example: apps/myapp/services/default.@OutputOnly" } } }, @@ -1278,23 +1348,34 @@ "properties": { "method": { "type": "string", - "description": "API method that initiated this operation. Example: `google.appengine.v1.Versions.CreateVersion`. @OutputOnly" + "description": "API method that initiated this operation. Example: google.appengine.v1.Versions.CreateVersion.@OutputOnly" }, "insertTime": { "type": "string", - "description": "Time that this operation was created. @OutputOnly" + "description": "Time that this operation was created.@OutputOnly" }, "endTime": { "type": "string", - "description": "Time that this operation completed. @OutputOnly" + "description": "Time that this operation completed.@OutputOnly" }, "user": { "type": "string", - "description": "User who requested this operation. @OutputOnly" + "description": "User who requested this operation.@OutputOnly" }, "target": { "type": "string", - "description": "Name of the resource that this operation is acting on. Example: `apps/myapp/services/default`. @OutputOnly" + "description": "Name of the resource that this operation is acting on. Example: apps/myapp/services/default.@OutputOnly" + }, + "ephemeralMessage": { + "type": "string", + "description": "Ephemeral message that may change every time the operation is polled. @OutputOnly" + }, + "warning": { + "type": "array", + "description": "Durable messages that persist on every operation poll. @OutputOnly", + "items": { + "type": "string" + } } } }, @@ -1305,11 +1386,11 @@ "properties": { "standardEnvironmentAvailable": { "type": "boolean", - "description": "App Engine Standard Environment is available in the given location. @OutputOnly" + "description": "App Engine Standard Environment is available in the given location.@OutputOnly" }, "flexibleEnvironmentAvailable": { "type": "boolean", - "description": "App Engine Flexible Environment is available in the given location. @OutputOnly" + "description": "App Engine Flexible Environment is available in the given location.@OutputOnly" } } } @@ -1321,7 +1402,7 @@ "id": "appengine.apps.create", "path": "v1beta4/apps", "httpMethod": "POST", - "description": "Creates an App Engine application for a Google Cloud Platform project. This requires a project that excludes an App Engine application. For details about creating a project without an application, see the [Google Cloud Resource Manager create project topic](https://cloud.google.com/resource-manager/docs/creating-project).", + "description": "Creates an App Engine application for a Google Cloud Platform project. This requires a project that excludes an App Engine application. For details about creating a project without an application, see the Google Cloud Resource Manager create project topic (https://cloud.google.com/resource-manager/docs/creating-project).", "request": { "$ref": "Application" }, @@ -1340,13 +1421,13 @@ "parameters": { "appsId": { "type": "string", - "description": "Part of `name`. Name of the application to get. Example: `apps/myapp`.", + "description": "Part of `name`. Name of the application to get. Example: apps/myapp.", "required": true, "location": "path" }, "ensureResourcesExist": { "type": "boolean", - "description": "Certain resources associated with an application are created on-demand. Controls whether these resources should be created when performing the `GET` operation. If specified and any resources could not be created, the request will fail with an error code. Additionally, this parameter can cause the request to take longer to complete.", + "description": "Certain resources associated with an application are created on-demand. Controls whether these resources should be created when performing the GET operation. If specified and any resources could not be created, the request will fail with an error code. Additionally, this parameter can cause the request to take longer to complete.", "location": "query" } }, @@ -1359,9 +1440,117 @@ "scopes": [ "https://www.googleapis.com/auth/cloud-platform" ] + }, + "patch": { + "id": "appengine.apps.patch", + "path": "v1beta4/apps/{appsId}", + "httpMethod": "PATCH", + "description": "Updates the specified Application resource. You can update the following fields: auth_domain (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps#Application.FIELDS.auth_domain) default_cookie_expiration (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps#Application.FIELDS.default_cookie_expiration)", + "parameters": { + "appsId": { + "type": "string", + "description": "Part of `name`. Name of the Application resource to update. Example: apps/myapp.", + "required": true, + "location": "path" + }, + "mask": { + "type": "string", + "description": "Standard field mask for the set of fields to be updated.", + "location": "query" + } + }, + "parameterOrder": [ + "appsId" + ], + "request": { + "$ref": "Application" + }, + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] } }, "resources": { + "operations": { + "methods": { + "list": { + "id": "appengine.apps.operations.list", + "path": "v1beta4/apps/{appsId}/operations", + "httpMethod": "GET", + "description": "Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED.NOTE: the name binding below allows API services to override the binding to use different resource name schemes, such as users/*/operations.", + "parameters": { + "appsId": { + "type": "string", + "description": "Part of `name`. The name of the operation collection.", + "required": true, + "location": "path" + }, + "filter": { + "type": "string", + "description": "The standard list filter.", + "location": "query" + }, + "pageSize": { + "type": "integer", + "description": "The standard list page size.", + "format": "int32", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "The standard list page token.", + "location": "query" + } + }, + "parameterOrder": [ + "appsId" + ], + "response": { + "$ref": "ListOperationsResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" + ] + }, + "get": { + "id": "appengine.apps.operations.get", + "path": "v1beta4/apps/{appsId}/operations/{operationsId}", + "httpMethod": "GET", + "description": "Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.", + "parameters": { + "appsId": { + "type": "string", + "description": "Part of `name`. The name of the operation resource.", + "required": true, + "location": "path" + }, + "operationsId": { + "type": "string", + "description": "Part of `name`. See documentation of `appsId`.", + "required": true, + "location": "path" + } + }, + "parameterOrder": [ + "appsId", + "operationsId" + ], + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" + ] + } + } + }, "modules": { "methods": { "delete": { @@ -1372,7 +1561,7 @@ "parameters": { "appsId": { "type": "string", - "description": "Part of `name`. Name of the resource requested. Example: `apps/myapp/modules/default`.", + "description": "Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default.", "required": true, "location": "path" }, @@ -1402,7 +1591,7 @@ "parameters": { "appsId": { "type": "string", - "description": "Part of `name`. Name of the resource requested. Example: `apps/myapp/modules/default`.", + "description": "Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default.", "required": true, "location": "path" }, @@ -1421,7 +1610,9 @@ "$ref": "Module" }, "scopes": [ - "https://www.googleapis.com/auth/cloud-platform" + "https://www.googleapis.com/auth/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" ] }, "list": { @@ -1432,7 +1623,7 @@ "parameters": { "appsId": { "type": "string", - "description": "Part of `name`. Name of the resource requested. Example: `apps/myapp`.", + "description": "Part of `name`. Name of the resource requested. Example: apps/myapp.", "required": true, "location": "path" }, @@ -1455,7 +1646,9 @@ "$ref": "ListModulesResponse" }, "scopes": [ - "https://www.googleapis.com/auth/cloud-platform" + "https://www.googleapis.com/auth/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" ] }, "patch": { @@ -1466,7 +1659,7 @@ "parameters": { "appsId": { "type": "string", - "description": "Part of `name`. Name of the resource to update. Example: `apps/myapp/modules/default`.", + "description": "Part of `name`. Name of the resource to update. Example: apps/myapp/modules/default.", "required": true, "location": "path" }, @@ -1483,7 +1676,7 @@ }, "migrateTraffic": { "type": "boolean", - "description": "Set to `true` to gradually shift traffic from one version to another single version. By default, traffic is shifted immediately. For gradual traffic migration, the target version must be located within instances that are configured for both [warmup requests](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#inboundservicetype) and [automatic scaling](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#automaticscaling). You must specify the [`shardBy`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules#shardby) field in the Module resource. Gradual traffic migration is not supported in the App Engine flexible environment. For examples, see [Migrating and Splitting Traffic](https://cloud.google.com/appengine/docs/admin-api/migrating-splitting-traffic).", + "description": "Set to true to gradually shift traffic from one version to another single version. By default, traffic is shifted immediately. For gradual traffic migration, the target version must be located within instances that are configured for both warmup requests (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#inboundservicetype) and automatic scaling (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#automaticscaling). You must specify the shardBy (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules#shardby) field in the Module resource. Gradual traffic migration is not supported in the App Engine flexible environment. For examples, see Migrating and Splitting Traffic (https://cloud.google.com/appengine/docs/admin-api/migrating-splitting-traffic).", "location": "query" } }, @@ -1513,7 +1706,7 @@ "parameters": { "appsId": { "type": "string", - "description": "Part of `name`. Name of the resource to update. Example: `apps/myapp/modules/default`.", + "description": "Part of `name`. Name of the resource to update. Example: apps/myapp/modules/default.", "required": true, "location": "path" }, @@ -1546,7 +1739,7 @@ "parameters": { "appsId": { "type": "string", - "description": "Part of `name`. Name of the resource requested. Example: `apps/myapp/modules/default/versions/v1`.", + "description": "Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default/versions/v1.", "required": true, "location": "path" }, @@ -1579,11 +1772,11 @@ "id": "appengine.apps.modules.versions.get", "path": "v1beta4/apps/{appsId}/modules/{modulesId}/versions/{versionsId}", "httpMethod": "GET", - "description": "Gets the specified Version resource. By default, only a `BASIC_VIEW` will be returned. Specify the `FULL_VIEW` parameter to get the full resource.", + "description": "Gets the specified Version resource. By default, only a BASIC_VIEW will be returned. Specify the FULL_VIEW parameter to get the full resource.", "parameters": { "appsId": { "type": "string", - "description": "Part of `name`. Name of the resource requested. Example: `apps/myapp/modules/default/versions/v1`.", + "description": "Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default/versions/v1.", "required": true, "location": "path" }, @@ -1601,7 +1794,7 @@ }, "view": { "type": "string", - "description": "Controls the set of fields returned in the `Get` response.", + "description": "Controls the set of fields returned in the Get response.", "enum": [ "BASIC", "FULL" @@ -1618,7 +1811,9 @@ "$ref": "Version" }, "scopes": [ - "https://www.googleapis.com/auth/cloud-platform" + "https://www.googleapis.com/auth/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" ] }, "list": { @@ -1629,7 +1824,7 @@ "parameters": { "appsId": { "type": "string", - "description": "Part of `name`. Name of the resource requested. Example: `apps/myapp/modules/default`.", + "description": "Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default.", "required": true, "location": "path" }, @@ -1641,7 +1836,7 @@ }, "view": { "type": "string", - "description": "Controls the set of fields returned in the `List` response.", + "description": "Controls the set of fields returned in the List response.", "enum": [ "BASIC", "FULL" @@ -1668,18 +1863,20 @@ "$ref": "ListVersionsResponse" }, "scopes": [ - "https://www.googleapis.com/auth/cloud-platform" + "https://www.googleapis.com/auth/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" ] }, "patch": { "id": "appengine.apps.modules.versions.patch", "path": "v1beta4/apps/{appsId}/modules/{modulesId}/versions/{versionsId}", "httpMethod": "PATCH", - "description": "Updates the specified Version resource. You can specify the following fields depending on the App Engine environment and type of scaling that the version resource uses: * [`serving_status`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#Version.FIELDS.serving_status): For Version resources that use basic scaling, manual scaling, or run in the App Engine flexible environment. * [`instance_class`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#Version.FIELDS.instance_class): For Version resources that run in the App Engine standard environment. * [`automatic_scaling.min_idle_instances`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment. * [`automatic_scaling.max_idle_instances`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment.", + "description": "Updates the specified Version resource. You can specify the following fields depending on the App Engine environment and type of scaling that the version resource uses: serving_status (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#Version.FIELDS.serving_status): For Version resources that use basic scaling, manual scaling, or run in the App Engine flexible environment. instance_class (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#Version.FIELDS.instance_class): For Version resources that run in the App Engine standard environment. automatic_scaling.min_idle_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment. automatic_scaling.max_idle_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment.", "parameters": { "appsId": { "type": "string", - "description": "Part of `name`. Name of the resource to update. Example: `apps/myapp/modules/default/versions/1`.", + "description": "Part of `name`. Name of the resource to update. Example: apps/myapp/modules/default/versions/1.", "required": true, "location": "path" }, @@ -1728,7 +1925,7 @@ "parameters": { "appsId": { "type": "string", - "description": "Part of `name`. Name of the resource requested. Example: `apps/myapp/modules/default/versions/v1/instances/instance-1`.", + "description": "Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default/versions/v1/instances/instance-1.", "required": true, "location": "path" }, @@ -1772,7 +1969,7 @@ "parameters": { "appsId": { "type": "string", - "description": "Part of `name`. Name of the resource requested. Example: `apps/myapp/modules/default/versions/v1/instances/instance-1`.", + "description": "Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default/versions/v1/instances/instance-1.", "required": true, "location": "path" }, @@ -1805,7 +2002,9 @@ "$ref": "Instance" }, "scopes": [ - "https://www.googleapis.com/auth/cloud-platform" + "https://www.googleapis.com/auth/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" ] }, "list": { @@ -1816,7 +2015,7 @@ "parameters": { "appsId": { "type": "string", - "description": "Part of `name`. Name of the resource requested. Example: `apps/myapp/modules/default/versions/v1`.", + "description": "Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default/versions/v1.", "required": true, "location": "path" }, @@ -1853,18 +2052,20 @@ "$ref": "ListInstancesResponse" }, "scopes": [ - "https://www.googleapis.com/auth/cloud-platform" + "https://www.googleapis.com/auth/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" ] }, "debug": { "id": "appengine.apps.modules.versions.instances.debug", "path": "v1beta4/apps/{appsId}/modules/{modulesId}/versions/{versionsId}/instances/{instancesId}:debug", "httpMethod": "POST", - "description": "Enables debugging on a VM instance. This allows you to use the SSH command to connect to the virtual machine where the instance lives. While in \"debug mode\", the instance continues to serve live traffic. You should delete the instance when you are done debugging and then allow the system to take over and determine if another instance should be started. Only applicable for instances in App Engine flexible environment.", + "description": "Enables debugging on a VM instance. This allows you to use the SSH command to connect to the virtual machine where the instance lives. While in \"debug mode\", the instance continues to serve live traffic. You should delete the instance when you are done debugging and then allow the system to take over and determine if another instance should be started.Only applicable for instances in App Engine flexible environment.", "parameters": { "appsId": { "type": "string", - "description": "Part of `name`. Name of the resource requested. Example: `apps/myapp/modules/default/versions/v1/instances/instance-1`.", + "description": "Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default/versions/v1/instances/instance-1.", "required": true, "location": "path" }, @@ -1909,79 +2110,6 @@ } } }, - "operations": { - "methods": { - "get": { - "id": "appengine.apps.operations.get", - "path": "v1beta4/apps/{appsId}/operations/{operationsId}", - "httpMethod": "GET", - "description": "Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.", - "parameters": { - "appsId": { - "type": "string", - "description": "Part of `name`. The name of the operation resource.", - "required": true, - "location": "path" - }, - "operationsId": { - "type": "string", - "description": "Part of `name`. See documentation of `appsId`.", - "required": true, - "location": "path" - } - }, - "parameterOrder": [ - "appsId", - "operationsId" - ], - "response": { - "$ref": "Operation" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform" - ] - }, - "list": { - "id": "appengine.apps.operations.list", - "path": "v1beta4/apps/{appsId}/operations", - "httpMethod": "GET", - "description": "Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`. NOTE: the `name` binding below allows API services to override the binding to use different resource name schemes, such as `users/*/operations`.", - "parameters": { - "appsId": { - "type": "string", - "description": "Part of `name`. The name of the operation collection.", - "required": true, - "location": "path" - }, - "filter": { - "type": "string", - "description": "The standard list filter.", - "location": "query" - }, - "pageSize": { - "type": "integer", - "description": "The standard list page size.", - "format": "int32", - "location": "query" - }, - "pageToken": { - "type": "string", - "description": "The standard list page token.", - "location": "query" - } - }, - "parameterOrder": [ - "appsId" - ], - "response": { - "$ref": "ListOperationsResponse" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform" - ] - } - } - }, "locations": { "methods": { "list": { @@ -2020,7 +2148,9 @@ "$ref": "ListLocationsResponse" }, "scopes": [ - "https://www.googleapis.com/auth/cloud-platform" + "https://www.googleapis.com/auth/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" ] }, "get": { @@ -2050,7 +2180,9 @@ "$ref": "Location" }, "scopes": [ - "https://www.googleapis.com/auth/cloud-platform" + "https://www.googleapis.com/auth/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" ] } } diff --git a/etc/api/appengine/v1beta5/appengine-api.json b/etc/api/appengine/v1beta5/appengine-api.json index a5265e547b..a4f2bfae30 100644 --- a/etc/api/appengine/v1beta5/appengine-api.json +++ b/etc/api/appengine/v1beta5/appengine-api.json @@ -1,11 +1,11 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/WgHFQRJNa9ABhjOi9ooEWesv8kc\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/UEz2jJACNpYPzXjVH7xBeGPwZAM\"", "discoveryVersion": "v1", "id": "appengine:v1beta5", "name": "appengine", "version": "v1beta5", - "revision": "20160802", + "revision": "20161208", "title": "Google App Engine Admin API", "description": "Provisions and manages App Engine applications.", "ownerDomain": "google.com", @@ -103,13 +103,37 @@ "auth": { "oauth2": { "scopes": { + "https://www.googleapis.com/auth/appengine.admin": { + "description": "View and manage your applications deployed on Google App Engine" + }, "https://www.googleapis.com/auth/cloud-platform": { "description": "View and manage your data across Google Cloud Platform services" + }, + "https://www.googleapis.com/auth/cloud-platform.read-only": { + "description": "View your data across Google Cloud Platform services" } } } }, "schemas": { + "ListOperationsResponse": { + "id": "ListOperationsResponse", + "type": "object", + "description": "The response message for Operations.ListOperations.", + "properties": { + "operations": { + "type": "array", + "description": "A list of operations that matches the specified filter in the request.", + "items": { + "$ref": "Operation" + } + }, + "nextPageToken": { + "type": "string", + "description": "The standard List next-page token." + } + } + }, "Operation": { "id": "Operation", "type": "object", @@ -117,7 +141,7 @@ "properties": { "name": { "type": "string", - "description": "The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should have the format of `operations/some/unique/name`." + "description": "The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the name should have the format of operations/some/unique/name." }, "metadata": { "type": "object", @@ -129,15 +153,15 @@ }, "done": { "type": "boolean", - "description": "If the value is `false`, it means the operation is still in progress. If true, the operation is completed, and either `error` or `response` is available." + "description": "If the value is false, it means the operation is still in progress. If true, the operation is completed, and either error or response is available." }, "error": { "$ref": "Status", - "description": "The error result of the operation in case of failure." + "description": "The error result of the operation in case of failure or cancellation." }, "response": { "type": "object", - "description": "The normal response of the operation in case of success. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.", + "description": "The normal response of the operation in case of success. If the original method returns no data on success, such as Delete, the response is google.protobuf.Empty. If the original method is standard Get/Create/Update, the response should be the resource. For other methods, the response should have the type XxxResponse, where Xxx is the original method name. For example, if the original method name is TakeSnapshot(), the inferred response type is TakeSnapshotResponse.", "additionalProperties": { "type": "any", "description": "Properties of the object. Contains field @type with type URL." @@ -148,7 +172,7 @@ "Status": { "id": "Status", "type": "object", - "description": "The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). The error model is designed to be: - Simple to use and understand for most users - Flexible enough to meet unexpected needs # Overview The `Status` message contains three pieces of data: error code, error message, and error details. The error code should be an enum value of google.rpc.Code, but it may accept additional error codes if needed. The error message should be a developer-facing English message that helps developers *understand* and *resolve* the error. If a localized user-facing error message is needed, put the localized message in the error details or localize it in the client. The optional error details may contain arbitrary information about the error. There is a predefined set of error detail types in the package `google.rpc` which can be used for common error conditions. # Language mapping The `Status` message is the logical representation of the error model, but it is not necessarily the actual wire format. When the `Status` message is exposed in different client libraries and different wire protocols, it can be mapped differently. For example, it will likely be mapped to some exceptions in Java, but more likely mapped to some error codes in C. # Other uses The error model and the `Status` message can be used in a variety of environments, either with or without APIs, to provide a consistent developer experience across different environments. Example uses of this error model include: - Partial errors. If a service needs to return partial errors to the client, it may embed the `Status` in the normal response to indicate the partial errors. - Workflow errors. A typical workflow has multiple steps. Each step may have a `Status` message for error reporting purpose. - Batch operations. If a client uses batch request and batch response, the `Status` message should be used directly inside batch response, one for each error sub-response. - Asynchronous operations. If an API call embeds asynchronous operation results in its response, the status of those operations should be represented directly using the `Status` message. - Logging. If some API errors are stored in logs, the message `Status` could be used directly after any stripping needed for security/privacy reasons.", + "description": "The Status type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by gRPC (https://github.com/grpc). The error model is designed to be: Simple to use and understand for most users Flexible enough to meet unexpected needsOverviewThe Status message contains three pieces of data: error code, error message, and error details. The error code should be an enum value of google.rpc.Code, but it may accept additional error codes if needed. The error message should be a developer-facing English message that helps developers understand and resolve the error. If a localized user-facing error message is needed, put the localized message in the error details or localize it in the client. The optional error details may contain arbitrary information about the error. There is a predefined set of error detail types in the package google.rpc which can be used for common error conditions.Language mappingThe Status message is the logical representation of the error model, but it is not necessarily the actual wire format. When the Status message is exposed in different client libraries and different wire protocols, it can be mapped differently. For example, it will likely be mapped to some exceptions in Java, but more likely mapped to some error codes in C.Other usesThe error model and the Status message can be used in a variety of environments, either with or without APIs, to provide a consistent developer experience across different environments.Example uses of this error model include: Partial errors. If a service needs to return partial errors to the client, it may embed the Status in the normal response to indicate the partial errors. Workflow errors. A typical workflow has multiple steps. Each step may have a Status message for error reporting purpose. Batch operations. If a client uses batch request and batch response, the Status message should be used directly inside batch response, one for each error sub-response. Asynchronous operations. If an API call embeds asynchronous operation results in its response, the status of those operations should be represented directly using the Status message. Logging. If some API errors are stored in logs, the message Status could be used directly after any stripping needed for security/privacy reasons.", "properties": { "code": { "type": "integer", @@ -172,24 +196,6 @@ } } }, - "ListOperationsResponse": { - "id": "ListOperationsResponse", - "type": "object", - "description": "The response message for Operations.ListOperations.", - "properties": { - "operations": { - "type": "array", - "description": "A list of operations that matches the specified filter in the request.", - "items": { - "$ref": "Operation" - } - }, - "nextPageToken": { - "type": "string", - "description": "The standard List next-page token." - } - } - }, "Application": { "id": "Application", "type": "object", @@ -197,42 +203,42 @@ "properties": { "name": { "type": "string", - "description": "Full path to the Application resource in the API. Example: `apps/myapp`. @OutputOnly" + "description": "Full path to the Application resource in the API. Example: apps/myapp.@OutputOnly" }, "id": { "type": "string", - "description": "Identifier of the Application resource. This identifier is equivalent to the project ID of the Google Cloud Platform project where you want to deploy your application. Example: `myapp`." + "description": "Identifier of the Application resource. This identifier is equivalent to the project ID of the Google Cloud Platform project where you want to deploy your application. Example: myapp." }, "dispatchRules": { "type": "array", - "description": "HTTP path dispatch rules for requests to the application that do not explicitly target a service or version. Rules are order-dependent. @OutputOnly", + "description": "HTTP path dispatch rules for requests to the application that do not explicitly target a service or version. Rules are order-dependent.@OutputOnly", "items": { "$ref": "UrlDispatchRule" } }, "authDomain": { "type": "string", - "description": "Google Apps authentication domain that controls which users can access this application. Defaults to open access for any Google Account." + "description": "Google Apps authentication domain that controls which users can access this application.Defaults to open access for any Google Account." }, "location": { "type": "string", - "description": "Location from which this application will be run. Application instances will run out of data centers in the chosen location, which is also where all of the application's end user content is stored. Defaults to `us-central`. Options are: `us-central` - Central US `europe-west` - Western Europe `us-east1` - Eastern US" + "description": "Location from which this application will be run. Application instances will run out of data centers in the chosen location, which is also where all of the application's end user content is stored.Defaults to us-central.Options are:us-central - Central USeurope-west - Western Europeus-east1 - Eastern US" }, "codeBucket": { "type": "string", - "description": "A Google Cloud Storage bucket that can be used for storing files associated with this application. This bucket is associated with the application and can be used by the gcloud deployment commands. @OutputOnly" + "description": "A Google Cloud Storage bucket that can be used for storing files associated with this application. This bucket is associated with the application and can be used by the gcloud deployment commands.@OutputOnly" }, "defaultCookieExpiration": { "type": "string", - "description": "Cookie expiration policy for this application. @OutputOnly" + "description": "Cookie expiration policy for this application." }, "defaultHostname": { "type": "string", - "description": "Hostname used to reach the application, as resolved by App Engine. @OutputOnly" + "description": "Hostname used to reach the application, as resolved by App Engine.@OutputOnly" }, "defaultBucket": { "type": "string", - "description": "A Google Cloud Storage bucket that can be used by the application to store content. @OutputOnly" + "description": "A Google Cloud Storage bucket that can be used by the application to store content.@OutputOnly" } } }, @@ -243,15 +249,15 @@ "properties": { "domain": { "type": "string", - "description": "Domain name to match against. The wildcard \"`*`\" is supported if specified before a period: \"`*.`\". Defaults to matching all domains: \"`*`\"." + "description": "Domain name to match against. The wildcard \"*\" is supported if specified before a period: \"*.\".Defaults to matching all domains: \"*\"." }, "path": { "type": "string", - "description": "Pathname within the host. Must start with a \"`/`\". A single \"`*`\" can be included at the end of the path. The sum of the lengths of the domain and path may not exceed 100 characters." + "description": "Pathname within the host. Must start with a \"/\". A single \"*\" can be included at the end of the path. The sum of the lengths of the domain and path may not exceed 100 characters." }, "service": { "type": "string", - "description": "Resource id of a service in this application that should serve the matched request. The service must already exist. Example: `default`." + "description": "Resource id of a service in this application that should serve the matched request. The service must already exist. Example: default." } } }, @@ -262,11 +268,11 @@ "properties": { "name": { "type": "string", - "description": "Full path to the Version resource in the API. Example: `apps/myapp/services/default/versions/v1`. @OutputOnly" + "description": "Full path to the Version resource in the API. Example: apps/myapp/services/default/versions/v1.@OutputOnly" }, "id": { "type": "string", - "description": "Relative name of the version within the module. Example: `v1`. Version names can contain only lowercase letters, numbers, or hyphens. Reserved names: \"default\", \"latest\", and any name with the prefix \"ah-\"." + "description": "Relative name of the version within the module. Example: v1. Version names can contain only lowercase letters, numbers, or hyphens. Reserved names: \"default\", \"latest\", and any name with the prefix \"ah-\"." }, "automaticScaling": { "$ref": "AutomaticScaling", @@ -311,7 +317,7 @@ }, "instanceClass": { "type": "string", - "description": "Instance class that is used to run this version. Valid values are: * AutomaticScaling: `F1`, `F2`, `F4`, `F4_1G` * ManualScaling or BasicScaling: `B1`, `B2`, `B4`, `B8`, `B4_1G` Defaults to `F1` for AutomaticScaling and `B1` for ManualScaling or BasicScaling." + "description": "Instance class that is used to run this version. Valid values are: AutomaticScaling: F1, F2, F4, F4_1G ManualScaling or BasicScaling: B1, B2, B4, B8, B4_1GDefaults to F1 for AutomaticScaling and B1 for ManualScaling or BasicScaling." }, "network": { "$ref": "Network", @@ -323,7 +329,7 @@ }, "runtime": { "type": "string", - "description": "Desired runtime. Example: `python27`." + "description": "Desired runtime. Example: python27." }, "threadsafe": { "type": "boolean", @@ -342,11 +348,11 @@ }, "env": { "type": "string", - "description": "App Engine execution environment to use for this version. Defaults to `1`." + "description": "App Engine execution environment to use for this version.Defaults to 1." }, "servingStatus": { "type": "string", - "description": "Current serving status of this version. Only the versions with a `SERVING` status create instances and can be billed. `SERVING_STATUS_UNSPECIFIED` is an invalid value. Defaults to `SERVING`.", + "description": "Current serving status of this version. Only the versions with a SERVING status create instances and can be billed.SERVING_STATUS_UNSPECIFIED is an invalid value. Defaults to SERVING.", "enum": [ "SERVING_STATUS_UNSPECIFIED", "SERVING", @@ -355,64 +361,68 @@ }, "deployer": { "type": "string", - "description": "Email address of the user who created this version. @OutputOnly" + "description": "Email address of the user who created this version.@OutputOnly" }, "creationTime": { "type": "string", - "description": "Time that this version was created. @OutputOnly" + "description": "Time that this version was created.@OutputOnly" }, "diskUsageBytes": { "type": "string", - "description": "Total size of version files hosted on App Engine disk in bytes. @OutputOnly", + "description": "Total size of version files hosted on App Engine disk in bytes.@OutputOnly", "format": "int64" }, "handlers": { "type": "array", - "description": "An ordered list of URL-matching patterns that should be applied to incoming requests. The first matching URL handles the request and other request handlers are not attempted. Only returned in `GET` requests if `view=FULL` is set.", + "description": "An ordered list of URL-matching patterns that should be applied to incoming requests. The first matching URL handles the request and other request handlers are not attempted.Only returned in GET requests if view=FULL is set.", "items": { "$ref": "UrlMap" } }, "errorHandlers": { "type": "array", - "description": "Custom static error pages. Limited to 10KB per page. Only returned in `GET` requests if `view=FULL` is set.", + "description": "Custom static error pages. Limited to 10KB per page.Only returned in GET requests if view=FULL is set.", "items": { "$ref": "ErrorHandler" } }, "libraries": { "type": "array", - "description": "Configuration for third-party Python runtime libraries required by the application. Only returned in `GET` requests if `view=FULL` is set.", + "description": "Configuration for third-party Python runtime libraries required by the application.Only returned in GET requests if view=FULL is set.", "items": { "$ref": "Library" } }, "apiConfig": { "$ref": "ApiConfigHandler", - "description": "Serving configuration for [Google Cloud Endpoints](https://cloud.google.com/appengine/docs/python/endpoints/). Only returned in `GET` requests if `view=FULL` is set." + "description": "Serving configuration for Google Cloud Endpoints (https://cloud.google.com/appengine/docs/python/endpoints/).Only returned in GET requests if view=FULL is set." }, "envVariables": { "type": "object", - "description": "Environment variables made available to the application. Only returned in `GET` requests if `view=FULL` is set.", + "description": "Environment variables made available to the application.Only returned in GET requests if view=FULL is set.", "additionalProperties": { "type": "string" } }, "defaultExpiration": { "type": "string", - "description": "Duration that static files should be cached by web proxies and browsers. Only applicable if the corresponding [StaticFilesHandler](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#staticfileshandler) does not specify its own expiration time. Only returned in `GET` requests if `view=FULL` is set." + "description": "Duration that static files should be cached by web proxies and browsers. Only applicable if the corresponding StaticFilesHandler (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#staticfileshandler) does not specify its own expiration time.Only returned in GET requests if view=FULL is set." }, "healthCheck": { "$ref": "HealthCheck", - "description": "Configures health checking for VM instances. Unhealthy instances are be stopped and replaced with new instances. Only applicable for VM runtimes. Only returned in `GET` requests if `view=FULL` is set." + "description": "Configures health checking for VM instances. Unhealthy instances are be stopped and replaced with new instances. Only applicable for VM runtimes.Only returned in GET requests if view=FULL is set." }, "nobuildFilesRegex": { "type": "string", - "description": "Files that match this pattern will not be built into this version. Only applicable for Go runtimes. Only returned in `GET` requests if `view=FULL` is set." + "description": "Files that match this pattern will not be built into this version. Only applicable for Go runtimes.Only returned in GET requests if view=FULL is set." }, "deployment": { "$ref": "Deployment", - "description": "Code and application artifacts that make up this version. Only returned in `GET` requests if `view=FULL` is set." + "description": "Code and application artifacts that make up this version.Only returned in GET requests if view=FULL is set." + }, + "endpointsApiService": { + "$ref": "EndpointsApiService", + "description": "Cloud Endpoints configuration.If endpoints_api_service is set, the Cloud Endpoints Extensible Service Proxy will be provided to serve the API implemented by the app." } } }, @@ -423,7 +433,7 @@ "properties": { "coolDownPeriod": { "type": "string", - "description": "Amount of time that the [Autoscaler](https://cloud.google.com/compute/docs/autoscaler/) should wait between changes to the number of virtual machines. Only applicable for VM runtimes." + "description": "Amount of time that the Autoscaler (https://cloud.google.com/compute/docs/autoscaler/) should wait between changes to the number of virtual machines. Only applicable for VM runtimes." }, "cpuUtilization": { "$ref": "CpuUtilization", @@ -431,7 +441,7 @@ }, "maxConcurrentRequests": { "type": "integer", - "description": "Number of concurrent requests an automatic scaling instance can accept before the scheduler spawns a new instance. Defaults to a runtime-specific value.", + "description": "Number of concurrent requests an automatic scaling instance can accept before the scheduler spawns a new instance.Defaults to a runtime-specific value.", "format": "int32" }, "maxIdleInstances": { @@ -586,7 +596,7 @@ "properties": { "instances": { "type": "integer", - "description": "Number of instances to assign to the service at the start. This number can later be altered by using the [Modules API](https://cloud.google.com/appengine/docs/python/modules/functions) `set_num_instances()` function.", + "description": "Number of instances to assign to the service at the start. This number can later be altered by using the Modules API (https://cloud.google.com/appengine/docs/python/modules/functions) set_num_instances() function.", "format": "int32" } } @@ -609,7 +619,11 @@ }, "name": { "type": "string", - "description": "Google Cloud Platform network where the virtual machines are created. Specify the short name, not the resource path. Defaults to `default`." + "description": "Google Cloud Platform network where the virtual machines are created. Specify the short name, not the resource path.Defaults to default." + }, + "subnetworkName": { + "type": "string", + "description": "Google Cloud Platform sub-network where the virtual machines are created. Specify the short name, not the resource path.If a subnetwork name is specified, a network name will also be required unless it is for the default network. If the network the VM instance is being created in is a Legacy network, then the IP address is allocated from the IPv4Range. If the network the VM instance is being created in is an auto Subnet Mode Network, then only network name should be specified (not the subnetwork_name) and the IP address is created from the IPCidrRange of the subnetwork that exists in that zone for that network. If the network the VM instance is being created in is a custom Subnet Mode Network, then the subnetwork_name must be specified and the IP address is created from the IPCidrRange of the subnetwork.If specified, the subnetwork must exist in the same region as the Flex app." } } }, @@ -632,6 +646,33 @@ "type": "number", "description": "Memory (GB) needed.", "format": "double" + }, + "volumes": { + "type": "array", + "description": "Volumes mounted within the app container.", + "items": { + "$ref": "Volume" + } + } + } + }, + "Volume": { + "id": "Volume", + "type": "object", + "description": "Volumes mounted within the app container. Only applicable for VM runtimes.", + "properties": { + "name": { + "type": "string", + "description": "Unique name for the volume." + }, + "volumeType": { + "type": "string", + "description": "Underlying volume type, e.g. 'tmpfs'." + }, + "sizeGb": { + "type": "number", + "description": "Volume size in gigabytes.", + "format": "double" } } }, @@ -679,7 +720,7 @@ }, "authFailAction": { "type": "string", - "description": "Action to take when users access resources that require authentication. Defaults to `redirect`.", + "description": "Action to take when users access resources that require authentication. Defaults to redirect.", "enum": [ "AUTH_FAIL_ACTION_UNSPECIFIED", "AUTH_FAIL_ACTION_REDIRECT", @@ -688,7 +729,7 @@ }, "redirectHttpResponseCode": { "type": "string", - "description": "`30x` code to use when performing redirects for the `secure` field. Defaults to `302`.", + "description": "30x code to use when performing redirects for the secure field. Defaults to 302.", "enum": [ "REDIRECT_HTTP_RESPONSE_CODE_UNSPECIFIED", "REDIRECT_HTTP_RESPONSE_CODE_301", @@ -781,7 +822,7 @@ }, "mimeType": { "type": "string", - "description": "MIME type of file. Defaults to `text/html`." + "description": "MIME type of file. Defaults to text/html." } } }, @@ -803,11 +844,11 @@ "ApiConfigHandler": { "id": "ApiConfigHandler", "type": "object", - "description": "[Google Cloud Endpoints](https://cloud.google.com/appengine/docs/python/endpoints/) configuration for API handlers.", + "description": "Google Cloud Endpoints (https://cloud.google.com/appengine/docs/python/endpoints/) configuration for API handlers.", "properties": { "authFailAction": { "type": "string", - "description": "Action to take when users access resources that require authentication. Defaults to `redirect`.", + "description": "Action to take when users access resources that require authentication. Defaults to redirect.", "enum": [ "AUTH_FAIL_ACTION_UNSPECIFIED", "AUTH_FAIL_ACTION_REDIRECT", @@ -816,7 +857,7 @@ }, "login": { "type": "string", - "description": "Level of login required to access this resource. Defaults to `optional`.", + "description": "Level of login required to access this resource. Defaults to optional.", "enum": [ "LOGIN_UNSPECIFIED", "LOGIN_OPTIONAL", @@ -915,7 +956,7 @@ "properties": { "sourceUrl": { "type": "string", - "description": "URL source to use to fetch this file. Must be a URL to a resource in Google Cloud Storage in the form 'http(s)://storage.googleapis.com/\\/\\'." + "description": "URL source to use to fetch this file. Must be a URL to a resource in Google Cloud Storage in the form 'http(s)://storage.googleapis.com//'." }, "sha1Sum": { "type": "string", @@ -923,7 +964,7 @@ }, "mimeType": { "type": "string", - "description": "The MIME type of the file. Defaults to the value from Google Cloud Storage." + "description": "The MIME type of the file.Defaults to the value from Google Cloud Storage." } } }, @@ -953,10 +994,25 @@ } } }, + "EndpointsApiService": { + "id": "EndpointsApiService", + "type": "object", + "description": "Cloud Endpoints (https://cloud.google.com/endpoints) configuration. The Endpoints API Service provides tooling for serving Open API and gRPC endpoints via an NGINX proxy.The fields here refer to the name and configuration id of a \"service\" resource in the Service Management API (https://cloud.google.com/service-management/overview).", + "properties": { + "name": { + "type": "string", + "description": "Endpoints service name which is the name of the \"service\" resource in the Service Management API. For example \"myapi.endpoints.myproject.cloud.goog\"" + }, + "configId": { + "type": "string", + "description": "Endpoints service configuration id as specified by the Service Management API. For example \"2016-09-19r1\"" + } + } + }, "ListVersionsResponse": { "id": "ListVersionsResponse", "type": "object", - "description": "Response message for `Versions.ListVersions`.", + "description": "Response message for Versions.ListVersions.", "properties": { "versions": { "type": "array", @@ -978,11 +1034,11 @@ "properties": { "name": { "type": "string", - "description": "Full path to the Service resource in the API. Example: `apps/myapp/services/default`. @OutputOnly" + "description": "Full path to the Service resource in the API. Example: apps/myapp/services/default.@OutputOnly" }, "id": { "type": "string", - "description": "Relative name of the service within the application. Example: `default`. @OutputOnly" + "description": "Relative name of the service within the application. Example: default.@OutputOnly" }, "split": { "$ref": "TrafficSplit", @@ -1017,7 +1073,7 @@ "ListServicesResponse": { "id": "ListServicesResponse", "type": "object", - "description": "Response message for `Services.ListServices`.", + "description": "Response message for Services.ListServices.", "properties": { "services": { "type": "array", @@ -1039,19 +1095,19 @@ "properties": { "name": { "type": "string", - "description": "Full path to the Instance resource in the API. Example: `apps/myapp/services/default/versions/v1/instances/instance-1`. @OutputOnly" + "description": "Full path to the Instance resource in the API. Example: apps/myapp/services/default/versions/v1/instances/instance-1.@OutputOnly" }, "id": { "type": "string", - "description": "Relative name of the instance within the version. Example: `instance-1`. @OutputOnly" + "description": "Relative name of the instance within the version. Example: instance-1.@OutputOnly" }, "appEngineRelease": { "type": "string", - "description": "App Engine release this instance is running on. @OutputOnly" + "description": "App Engine release this instance is running on.@OutputOnly" }, "availability": { "type": "string", - "description": "Availability of the instance. @OutputOnly", + "description": "Availability of the instance.@OutputOnly", "enum": [ "UNSPECIFIED", "RESIDENT", @@ -1060,59 +1116,63 @@ }, "vmName": { "type": "string", - "description": "Name of the virtual machine where this instance lives. Only applicable for instances in App Engine flexible environment. @OutputOnly" + "description": "Name of the virtual machine where this instance lives. Only applicable for instances in App Engine flexible environment.@OutputOnly" }, "vmZoneName": { "type": "string", - "description": "Zone where the virtual machine is located. Only applicable for instances in App Engine flexible environment. @OutputOnly" + "description": "Zone where the virtual machine is located. Only applicable for instances in App Engine flexible environment.@OutputOnly" }, "vmId": { "type": "string", - "description": "Virtual machine ID of this instance. Only applicable for instances in App Engine flexible environment. @OutputOnly" + "description": "Virtual machine ID of this instance. Only applicable for instances in App Engine flexible environment.@OutputOnly" }, "startTimestamp": { "type": "string", - "description": "Time that this instance was started. @OutputOnly" + "description": "Time that this instance was started.@OutputOnly" }, "requests": { "type": "integer", - "description": "Number of requests since this instance was started. @OutputOnly", + "description": "Number of requests since this instance was started.@OutputOnly", "format": "int32" }, "errors": { "type": "integer", - "description": "Number of errors since this instance was started. @OutputOnly", + "description": "Number of errors since this instance was started.@OutputOnly", "format": "uint32" }, "qps": { "type": "number", - "description": "Average queries per second (QPS) over the last minute. @OutputOnly", + "description": "Average queries per second (QPS) over the last minute.@OutputOnly", "format": "float" }, "averageLatency": { "type": "integer", - "description": "Average latency (ms) over the last minute. @OutputOnly", + "description": "Average latency (ms) over the last minute.@OutputOnly", "format": "int32" }, "memoryUsage": { "type": "string", - "description": "Total memory in use (bytes). @OutputOnly", + "description": "Total memory in use (bytes).@OutputOnly", "format": "int64" }, "vmStatus": { "type": "string", - "description": "Status of the virtual machine where this instance lives. Only applicable for instances in App Engine flexible environment. @OutputOnly" + "description": "Status of the virtual machine where this instance lives. Only applicable for instances in App Engine flexible environment.@OutputOnly" }, "vmUnlocked": { "type": "boolean", - "description": "Whether this instance is in debug mode. Only applicable for instances in App Engine flexible environment. @OutputOnly" + "description": "Whether this instance is in debug mode. Only applicable for instances in App Engine flexible environment.@OutputOnly" + }, + "vmIp": { + "type": "string", + "description": "The IP address of this instance. Only applicable for instances in App Engine flexible environment.@OutputOnly" } } }, "ListInstancesResponse": { "id": "ListInstancesResponse", "type": "object", - "description": "Response message for `Instances.ListInstances`.", + "description": "Response message for Instances.ListInstances.", "properties": { "instances": { "type": "array", @@ -1130,7 +1190,13 @@ "DebugInstanceRequest": { "id": "DebugInstanceRequest", "type": "object", - "description": "Request message for `Instances.DebugInstance`." + "description": "Request message for Instances.DebugInstance.", + "properties": { + "sshKey": { + "type": "string", + "description": "Public SSH key to add to the instance. Examples: [USERNAME]:ssh-rsa [KEY_VALUE] [USERNAME] [USERNAME]:ssh-rsa [KEY_VALUE] google-ssh {\"userName\":\"[USERNAME]\",\"expireOn\":\"[EXPIRE_TIME]\"}For more information, see Adding and Removing SSH Keys (https://cloud.google.com/compute/docs/instances/adding-removing-ssh-keys)." + } + } }, "ListLocationsResponse": { "id": "ListLocationsResponse", @@ -1157,11 +1223,11 @@ "properties": { "name": { "type": "string", - "description": "Resource name for the location, which may vary between implementations. For example: `\"projects/example-project/locations/us-east1\"`" + "description": "Resource name for the location, which may vary between implementations. For example: \"projects/example-project/locations/us-east1\"" }, "locationId": { "type": "string", - "description": "The cononical id for this location. For example: `\"us-east1\"`." + "description": "The canonical id for this location. For example: \"us-east1\"." }, "labels": { "type": "object", @@ -1180,6 +1246,33 @@ } } }, + "OperationMetadataExperimental": { + "id": "OperationMetadataExperimental", + "type": "object", + "description": "Metadata for the given google.longrunning.Operation.", + "properties": { + "method": { + "type": "string", + "description": "API method that initiated this operation. Example: google.appengine.experimental.CustomDomains.CreateCustomDomain.@OutputOnly" + }, + "insertTime": { + "type": "string", + "description": "Time that this operation was created.@OutputOnly" + }, + "endTime": { + "type": "string", + "description": "Time that this operation completed.@OutputOnly" + }, + "user": { + "type": "string", + "description": "User who requested this operation.@OutputOnly" + }, + "target": { + "type": "string", + "description": "Name of the resource that this operation is acting on. Example: apps/myapp/customDomains/example.com.@OutputOnly" + } + } + }, "OperationMetadata": { "id": "OperationMetadata", "type": "object", @@ -1187,27 +1280,27 @@ "properties": { "operationType": { "type": "string", - "description": "Type of this operation. Deprecated, use method field instead. Example: \"create_version\". @OutputOnly" + "description": "Type of this operation. Deprecated, use method field instead. Example: \"create_version\".@OutputOnly" }, "insertTime": { "type": "string", - "description": "Timestamp that this operation was created. @OutputOnly" + "description": "Timestamp that this operation was created.@OutputOnly" }, "endTime": { "type": "string", - "description": "Timestamp that this operation completed. @OutputOnly" + "description": "Timestamp that this operation completed.@OutputOnly" }, "user": { "type": "string", - "description": "User who requested this operation. @OutputOnly" + "description": "User who requested this operation.@OutputOnly" }, "target": { "type": "string", - "description": "Name of the resource that this operation is acting on. Example: `apps/myapp/modules/default`. @OutputOnly" + "description": "Name of the resource that this operation is acting on. Example: apps/myapp/modules/default.@OutputOnly" }, "method": { "type": "string", - "description": "API method that initiated this operation. Example: `google.appengine.v1beta4.Version.CreateVersion`. @OutputOnly" + "description": "API method that initiated this operation. Example: google.appengine.v1beta4.Version.CreateVersion.@OutputOnly" } } }, @@ -1218,23 +1311,23 @@ "properties": { "method": { "type": "string", - "description": "API method name that initiated this operation. Example: `google.appengine.v1beta5.Version.CreateVersion`. @OutputOnly" + "description": "API method name that initiated this operation. Example: google.appengine.v1beta5.Version.CreateVersion.@OutputOnly" }, "insertTime": { "type": "string", - "description": "Timestamp that this operation was created. @OutputOnly" + "description": "Timestamp that this operation was created.@OutputOnly" }, "endTime": { "type": "string", - "description": "Timestamp that this operation completed. @OutputOnly" + "description": "Timestamp that this operation completed.@OutputOnly" }, "user": { "type": "string", - "description": "User who requested this operation. @OutputOnly" + "description": "User who requested this operation.@OutputOnly" }, "target": { "type": "string", - "description": "Name of the resource that this operation is acting on. Example: `apps/myapp/services/default`. @OutputOnly" + "description": "Name of the resource that this operation is acting on. Example: apps/myapp/services/default.@OutputOnly" } } }, @@ -1245,23 +1338,34 @@ "properties": { "method": { "type": "string", - "description": "API method that initiated this operation. Example: `google.appengine.v1.Versions.CreateVersion`. @OutputOnly" + "description": "API method that initiated this operation. Example: google.appengine.v1.Versions.CreateVersion.@OutputOnly" }, "insertTime": { "type": "string", - "description": "Time that this operation was created. @OutputOnly" + "description": "Time that this operation was created.@OutputOnly" }, "endTime": { "type": "string", - "description": "Time that this operation completed. @OutputOnly" + "description": "Time that this operation completed.@OutputOnly" }, "user": { "type": "string", - "description": "User who requested this operation. @OutputOnly" + "description": "User who requested this operation.@OutputOnly" }, "target": { "type": "string", - "description": "Name of the resource that this operation is acting on. Example: `apps/myapp/services/default`. @OutputOnly" + "description": "Name of the resource that this operation is acting on. Example: apps/myapp/services/default.@OutputOnly" + }, + "ephemeralMessage": { + "type": "string", + "description": "Ephemeral message that may change every time the operation is polled. @OutputOnly" + }, + "warning": { + "type": "array", + "description": "Durable messages that persist on every operation poll. @OutputOnly", + "items": { + "type": "string" + } } } }, @@ -1272,11 +1376,11 @@ "properties": { "standardEnvironmentAvailable": { "type": "boolean", - "description": "App Engine Standard Environment is available in the given location. @OutputOnly" + "description": "App Engine Standard Environment is available in the given location.@OutputOnly" }, "flexibleEnvironmentAvailable": { "type": "boolean", - "description": "App Engine Flexible Environment is available in the given location. @OutputOnly" + "description": "App Engine Flexible Environment is available in the given location.@OutputOnly" } } } @@ -1288,7 +1392,7 @@ "id": "appengine.apps.create", "path": "v1beta5/apps", "httpMethod": "POST", - "description": "Creates an App Engine application for a Google Cloud Platform project. This requires a project that excludes an App Engine application. For details about creating a project without an application, see the [Google Cloud Resource Manager create project topic](https://cloud.google.com/resource-manager/docs/creating-project).", + "description": "Creates an App Engine application for a Google Cloud Platform project. This requires a project that excludes an App Engine application. For details about creating a project without an application, see the Google Cloud Resource Manager create project topic (https://cloud.google.com/resource-manager/docs/creating-project).", "request": { "$ref": "Application" }, @@ -1307,13 +1411,13 @@ "parameters": { "appsId": { "type": "string", - "description": "Part of `name`. Name of the application to get. Example: `apps/myapp`.", + "description": "Part of `name`. Name of the application to get. Example: apps/myapp.", "required": true, "location": "path" }, "ensureResourcesExist": { "type": "boolean", - "description": "Certain resources associated with an application are created on-demand. Controls whether these resources should be created when performing the `GET` operation. If specified and any resources could not be created, the request will fail with an error code. Additionally, this parameter can cause the request to take longer to complete. Note: This parameter will be deprecated in a future version of the API.", + "description": "Certain resources associated with an application are created on-demand. Controls whether these resources should be created when performing the GET operation. If specified and any resources could not be created, the request will fail with an error code. Additionally, this parameter can cause the request to take longer to complete. Note: This parameter will be deprecated in a future version of the API.", "location": "query" } }, @@ -1326,46 +1430,47 @@ "scopes": [ "https://www.googleapis.com/auth/cloud-platform" ] + }, + "patch": { + "id": "appengine.apps.patch", + "path": "v1beta5/apps/{appsId}", + "httpMethod": "PATCH", + "description": "Updates the specified Application resource. You can update the following fields: auth_domain (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps#Application.FIELDS.auth_domain) default_cookie_expiration (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps#Application.FIELDS.default_cookie_expiration)", + "parameters": { + "appsId": { + "type": "string", + "description": "Part of `name`. Name of the Application resource to update. Example: apps/myapp.", + "required": true, + "location": "path" + }, + "mask": { + "type": "string", + "description": "Standard field mask for the set of fields to be updated.", + "location": "query" + } + }, + "parameterOrder": [ + "appsId" + ], + "request": { + "$ref": "Application" + }, + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] } }, "resources": { "operations": { "methods": { - "get": { - "id": "appengine.apps.operations.get", - "path": "v1beta5/apps/{appsId}/operations/{operationsId}", - "httpMethod": "GET", - "description": "Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.", - "parameters": { - "appsId": { - "type": "string", - "description": "Part of `name`. The name of the operation resource.", - "required": true, - "location": "path" - }, - "operationsId": { - "type": "string", - "description": "Part of `name`. See documentation of `appsId`.", - "required": true, - "location": "path" - } - }, - "parameterOrder": [ - "appsId", - "operationsId" - ], - "response": { - "$ref": "Operation" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform" - ] - }, "list": { "id": "appengine.apps.operations.list", "path": "v1beta5/apps/{appsId}/operations", "httpMethod": "GET", - "description": "Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`. NOTE: the `name` binding below allows API services to override the binding to use different resource name schemes, such as `users/*/operations`.", + "description": "Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED.NOTE: the name binding below allows API services to override the binding to use different resource name schemes, such as users/*/operations.", "parameters": { "appsId": { "type": "string", @@ -1397,7 +1502,41 @@ "$ref": "ListOperationsResponse" }, "scopes": [ - "https://www.googleapis.com/auth/cloud-platform" + "https://www.googleapis.com/auth/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" + ] + }, + "get": { + "id": "appengine.apps.operations.get", + "path": "v1beta5/apps/{appsId}/operations/{operationsId}", + "httpMethod": "GET", + "description": "Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.", + "parameters": { + "appsId": { + "type": "string", + "description": "Part of `name`. The name of the operation resource.", + "required": true, + "location": "path" + }, + "operationsId": { + "type": "string", + "description": "Part of `name`. See documentation of `appsId`.", + "required": true, + "location": "path" + } + }, + "parameterOrder": [ + "appsId", + "operationsId" + ], + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" ] } } @@ -1412,7 +1551,7 @@ "parameters": { "appsId": { "type": "string", - "description": "Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default`.", + "description": "Part of `name`. Name of the resource requested. Example: apps/myapp/services/default.", "required": true, "location": "path" }, @@ -1442,7 +1581,7 @@ "parameters": { "appsId": { "type": "string", - "description": "Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default`.", + "description": "Part of `name`. Name of the resource requested. Example: apps/myapp/services/default.", "required": true, "location": "path" }, @@ -1461,7 +1600,9 @@ "$ref": "Service" }, "scopes": [ - "https://www.googleapis.com/auth/cloud-platform" + "https://www.googleapis.com/auth/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" ] }, "list": { @@ -1472,7 +1613,7 @@ "parameters": { "appsId": { "type": "string", - "description": "Part of `name`. Name of the resource requested. Example: `apps/myapp`.", + "description": "Part of `name`. Name of the resource requested. Example: apps/myapp.", "required": true, "location": "path" }, @@ -1495,7 +1636,9 @@ "$ref": "ListServicesResponse" }, "scopes": [ - "https://www.googleapis.com/auth/cloud-platform" + "https://www.googleapis.com/auth/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" ] }, "patch": { @@ -1506,7 +1649,7 @@ "parameters": { "appsId": { "type": "string", - "description": "Part of `name`. Name of the resource to update. Example: `apps/myapp/services/default`.", + "description": "Part of `name`. Name of the resource to update. Example: apps/myapp/services/default.", "required": true, "location": "path" }, @@ -1523,7 +1666,7 @@ }, "migrateTraffic": { "type": "boolean", - "description": "Set to `true` to gradually shift traffic from one version to another single version. By default, traffic is shifted immediately. For gradual traffic migration, the target version must be located within instances that are configured for both [warmup requests](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps.services.versions#inboundservicetype) and [automatic scaling](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps.services.versions#automaticscaling). You must specify the [`shardBy`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps.services#shardby) field in the Service resource. Gradual traffic migration is not supported in the App Engine flexible environment. For examples, see [Migrating and Splitting Traffic](https://cloud.google.com/appengine/docs/admin-api/migrating-splitting-traffic).", + "description": "Set to true to gradually shift traffic from one version to another single version. By default, traffic is shifted immediately. For gradual traffic migration, the target version must be located within instances that are configured for both warmup requests (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps.services.versions#inboundservicetype) and automatic scaling (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps.services.versions#automaticscaling). You must specify the shardBy (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps.services#shardby) field in the Service resource. Gradual traffic migration is not supported in the App Engine flexible environment. For examples, see Migrating and Splitting Traffic (https://cloud.google.com/appengine/docs/admin-api/migrating-splitting-traffic).", "location": "query" } }, @@ -1586,7 +1729,7 @@ "parameters": { "appsId": { "type": "string", - "description": "Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default/versions/v1`.", + "description": "Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1.", "required": true, "location": "path" }, @@ -1619,11 +1762,11 @@ "id": "appengine.apps.services.versions.get", "path": "v1beta5/apps/{appsId}/services/{servicesId}/versions/{versionsId}", "httpMethod": "GET", - "description": "Gets the specified Version resource. By default, only a `BASIC_VIEW` will be returned. Specify the `FULL_VIEW` parameter to get the full resource.", + "description": "Gets the specified Version resource. By default, only a BASIC_VIEW will be returned. Specify the FULL_VIEW parameter to get the full resource.", "parameters": { "appsId": { "type": "string", - "description": "Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default/versions/v1`.", + "description": "Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1.", "required": true, "location": "path" }, @@ -1641,7 +1784,7 @@ }, "view": { "type": "string", - "description": "Controls the set of fields returned in the `Get` response.", + "description": "Controls the set of fields returned in the Get response.", "enum": [ "BASIC", "FULL" @@ -1658,7 +1801,9 @@ "$ref": "Version" }, "scopes": [ - "https://www.googleapis.com/auth/cloud-platform" + "https://www.googleapis.com/auth/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" ] }, "list": { @@ -1669,7 +1814,7 @@ "parameters": { "appsId": { "type": "string", - "description": "Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default`.", + "description": "Part of `name`. Name of the resource requested. Example: apps/myapp/services/default.", "required": true, "location": "path" }, @@ -1681,7 +1826,7 @@ }, "view": { "type": "string", - "description": "Controls the set of fields returned in the `List` response.", + "description": "Controls the set of fields returned in the List response.", "enum": [ "BASIC", "FULL" @@ -1708,18 +1853,20 @@ "$ref": "ListVersionsResponse" }, "scopes": [ - "https://www.googleapis.com/auth/cloud-platform" + "https://www.googleapis.com/auth/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" ] }, "patch": { "id": "appengine.apps.services.versions.patch", "path": "v1beta5/apps/{appsId}/services/{servicesId}/versions/{versionsId}", "httpMethod": "PATCH", - "description": "Updates the specified Version resource. You can specify the following fields depending on the App Engine environment and type of scaling that the version resource uses: * [`serving_status`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps.services.versions#Version.FIELDS.serving_status): For Version resources that use basic scaling, manual scaling, or run in the App Engine flexible environment. * [`instance_class`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps.services.versions#Version.FIELDS.instance_class): For Version resources that run in the App Engine standard environment. * [`automatic_scaling.min_idle_instances`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps.services.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment. * [`automatic_scaling.max_idle_instances`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps.services.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment.", + "description": "Updates the specified Version resource. You can specify the following fields depending on the App Engine environment and type of scaling that the version resource uses: serving_status (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps.services.versions#Version.FIELDS.serving_status): For Version resources that use basic scaling, manual scaling, or run in the App Engine flexible environment. instance_class (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps.services.versions#Version.FIELDS.instance_class): For Version resources that run in the App Engine standard environment. automatic_scaling.min_idle_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps.services.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment. automatic_scaling.max_idle_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps.services.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment.", "parameters": { "appsId": { "type": "string", - "description": "Part of `name`. Name of the resource to update. Example: `apps/myapp/services/default/versions/1`.", + "description": "Part of `name`. Name of the resource to update. Example: apps/myapp/services/default/versions/1.", "required": true, "location": "path" }, @@ -1812,7 +1959,7 @@ "parameters": { "appsId": { "type": "string", - "description": "Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default/versions/v1/instances/instance-1`.", + "description": "Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1/instances/instance-1.", "required": true, "location": "path" }, @@ -1845,7 +1992,9 @@ "$ref": "Instance" }, "scopes": [ - "https://www.googleapis.com/auth/cloud-platform" + "https://www.googleapis.com/auth/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" ] }, "list": { @@ -1856,7 +2005,7 @@ "parameters": { "appsId": { "type": "string", - "description": "Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default/versions/v1`.", + "description": "Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1.", "required": true, "location": "path" }, @@ -1893,18 +2042,20 @@ "$ref": "ListInstancesResponse" }, "scopes": [ - "https://www.googleapis.com/auth/cloud-platform" + "https://www.googleapis.com/auth/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" ] }, "debug": { "id": "appengine.apps.services.versions.instances.debug", "path": "v1beta5/apps/{appsId}/services/{servicesId}/versions/{versionsId}/instances/{instancesId}:debug", "httpMethod": "POST", - "description": "Enables debugging on a VM instance. This allows you to use the SSH command to connect to the virtual machine where the instance lives. While in \"debug mode\", the instance continues to serve live traffic. You should delete the instance when you are done debugging and then allow the system to take over and determine if another instance should be started. Only applicable for instances in App Engine flexible environment.", + "description": "Enables debugging on a VM instance. This allows you to use the SSH command to connect to the virtual machine where the instance lives. While in \"debug mode\", the instance continues to serve live traffic. You should delete the instance when you are done debugging and then allow the system to take over and determine if another instance should be started.Only applicable for instances in App Engine flexible environment.", "parameters": { "appsId": { "type": "string", - "description": "Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default/versions/v1/instances/instance-1`.", + "description": "Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1/instances/instance-1.", "required": true, "location": "path" }, @@ -1987,7 +2138,9 @@ "$ref": "ListLocationsResponse" }, "scopes": [ - "https://www.googleapis.com/auth/cloud-platform" + "https://www.googleapis.com/auth/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" ] }, "get": { @@ -2017,7 +2170,9 @@ "$ref": "Location" }, "scopes": [ - "https://www.googleapis.com/auth/cloud-platform" + "https://www.googleapis.com/auth/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" ] } } diff --git a/etc/api/appsactivity/v1/appsactivity-api.json b/etc/api/appsactivity/v1/appsactivity-api.json index baf1924b02..6588e9d5e5 100644 --- a/etc/api/appsactivity/v1/appsactivity-api.json +++ b/etc/api/appsactivity/v1/appsactivity-api.json @@ -1,18 +1,18 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/Yn-vD22SJyy2Enea8C6suJXByIU\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/JeTIzxCSn99gVwop4eTRu5wI2HY\"", "discoveryVersion": "v1", "id": "appsactivity:v1", "name": "appsactivity", "version": "v1", - "revision": "20160805", + "revision": "20161202", "title": "Google Apps Activity API", "description": "Provides a historical view of activity.", "ownerDomain": "google.com", "ownerName": "Google", "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" }, "documentationLink": "https://developers.google.com/google-apps/activity/", "protocol": "rest", @@ -396,6 +396,10 @@ "type": "boolean", "description": "A boolean which indicates whether the specified User was deleted. If true, name, photo and permission_id will be omitted." }, + "isMe": { + "type": "boolean", + "description": "Whether the user is the authenticated user." + }, "name": { "type": "string", "description": "The displayable name of the user." diff --git a/etc/api/appstate/v1/appstate-api.json b/etc/api/appstate/v1/appstate-api.json index e4d0ac8885..f8527d0c05 100644 --- a/etc/api/appstate/v1/appstate-api.json +++ b/etc/api/appstate/v1/appstate-api.json @@ -1,19 +1,19 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/H2gPE9k-JTZqVa4GXSjOgiuxTK0\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/zCuutgfn2bO8U3OEBc5yUB2So-0\"", "discoveryVersion": "v1", "id": "appstate:v1", "name": "appstate", "canonicalName": "App State", "version": "v1", - "revision": "20160901", + "revision": "20161207", "title": "Google App State API", "description": "The Google App State API.", "ownerDomain": "google.com", "ownerName": "Google", "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" }, "documentationLink": "https://developers.google.com/games/services/web/api/states", "protocol": "rest", diff --git a/etc/api/bigquery/v2/bigquery-api.json b/etc/api/bigquery/v2/bigquery-api.json index a2d5c9f6a3..c9f63e38c6 100644 --- a/etc/api/bigquery/v2/bigquery-api.json +++ b/etc/api/bigquery/v2/bigquery-api.json @@ -1,11 +1,11 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/VlhO-7U_LLGUoZP3BlsW4eOrFfk\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/wyP_l3wPjLK3LUrJqeSGHNESSW0\"", "discoveryVersion": "v1", "id": "bigquery:v2", "name": "bigquery", "version": "v2", - "revision": "20160903", + "revision": "20161130", "title": "BigQuery API", "description": "A data platform for customers to create, manage, share and query data.", "ownerDomain": "google.com", @@ -687,6 +687,13 @@ "$ref": "JobConfigurationExtract", "description": "[Pick one] Configures an extract job." }, + "labels": { + "type": "object", + "description": "[Experimental] The labels associated with this job. You can use these to organize and group your jobs. Label keys and values can be no longer than 63 characters, can only contain letters, numeric characters, underscores and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter and must be unique within a dataset. Both keys and values are additionally constrained to be \u003c= 128 bytes in size.", + "additionalProperties": { + "type": "string" + } + }, "load": { "$ref": "JobConfigurationLoad", "description": "[Pick one] Configures a load job." @@ -776,6 +783,10 @@ "description": "[Optional] The maximum number of bad records that BigQuery can ignore when running the job. If the number of bad records exceeds this value, an invalid error is returned in the job result. The default value is 0, which requires that all records are valid.", "format": "int32" }, + "nullMarker": { + "type": "string", + "description": "[Optional] This string will be interpreted as a null value when it appears in a CSV file. The default value is the empty string. Please refer to the documentation for further information." + }, "projectionFields": { "type": "array", "description": "[Experimental] If sourceFormat is set to \"DATASTORE_BACKUP\", indicates which entity properties to load into BigQuery from a Cloud Datastore backup. Property names are case sensitive and must be top-level properties. If no properties are specified, BigQuery loads all properties. If any named property isn't found in the Cloud Datastore backup, an invalid error is returned in the job result.", @@ -884,14 +895,14 @@ }, "queryParameters": { "type": "array", - "description": "[Experimental] Query parameters for Standard SQL queries.", + "description": "Query parameters for standard SQL queries.", "items": { "$ref": "QueryParameter" } }, "schemaUpdateOptions": { "type": "array", - "description": "[Experimental] Allows the schema of the desitination table to be updated as a side effect of the query job. Schema update options are supported in two cases: when writeDisposition is WRITE_APPEND; when writeDisposition is WRITE_TRUNCATE and the destination table is a partition of a table, specified by partition decorators. For normal tables, WRITE_TRUNCATE will always overwrite the schema. One or more of the following values are specified: ALLOW_FIELD_ADDITION: allow adding a nullable field to the schema. ALLOW_FIELD_RELAXATION: allow relaxing a required field in the original schema to nullable.", + "description": "[Experimental] Allows the schema of the destination table to be updated as a side effect of the query job. Schema update options are supported in two cases: when writeDisposition is WRITE_APPEND; when writeDisposition is WRITE_TRUNCATE and the destination table is a partition of a table, specified by partition decorators. For normal tables, WRITE_TRUNCATE will always overwrite the schema. One or more of the following values are specified: ALLOW_FIELD_ADDITION: allow adding a nullable field to the schema. ALLOW_FIELD_RELAXATION: allow relaxing a required field in the original schema to nullable.", "items": { "type": "string" } @@ -905,7 +916,7 @@ }, "useLegacySql": { "type": "boolean", - "description": "[Experimental] Specifies whether to use BigQuery's legacy SQL dialect for this query. The default value is true. If set to false, the query will use BigQuery's standard SQL: https://cloud.google.com/bigquery/sql-reference/ When useLegacySql is set to false, the values of allowLargeResults and flattenResults are ignored; query will be run as if allowLargeResults is true and flattenResults is false." + "description": "Specifies whether to use BigQuery's legacy SQL dialect for this query. The default value is true. If set to false, the query will use BigQuery's standard SQL: https://cloud.google.com/bigquery/sql-reference/ When useLegacySql is set to false, the values of allowLargeResults and flattenResults are ignored; query will be run as if allowLargeResults is true and flattenResults is false." }, "useQueryCache": { "type": "boolean", @@ -1117,6 +1128,10 @@ "$ref": "TableSchema", "description": "[Output-only, Experimental] The schema of the results. Present only for successful dry run of non-legacy SQL queries." }, + "statementType": { + "type": "string", + "description": "[Output-only, Experimental] The type of query statement, if valid." + }, "totalBytesBilled": { "type": "string", "description": "[Output-only] Total bytes billed for the job.", @@ -1404,7 +1419,7 @@ }, "useLegacySql": { "type": "boolean", - "description": "[Experimental] Specifies whether to use BigQuery's legacy SQL dialect for this query. The default value is true. If set to false, the query will use BigQuery's standard SQL: https://cloud.google.com/bigquery/sql-reference/ When useLegacySql is set to false, the values of allowLargeResults and flattenResults are ignored; query will be run as if allowLargeResults is true and flattenResults is false.", + "description": "Specifies whether to use BigQuery's legacy SQL dialect for this query. The default value is true. If set to false, the query will use BigQuery's standard SQL: https://cloud.google.com/bigquery/sql-reference/ When useLegacySql is set to false, the values of allowLargeResults and flattenResults are ignored; query will be run as if allowLargeResults is true and flattenResults is false.", "default": "true" }, "useQueryCache": { @@ -1534,6 +1549,13 @@ "description": "[Output-only] The type of the resource.", "default": "bigquery#table" }, + "labels": { + "type": "object", + "description": "[Experimental] The labels associated with this table. You can use these to organize and group your tables. Label keys and values can be no longer than 63 characters, can only contain letters, numeric characters, underscores and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter and must be unique within a dataset. Both keys and values are additionally constrained to be \u003c= 128 bytes in size.", + "additionalProperties": { + "type": "string" + } + }, "lastModifiedTime": { "type": "string", "description": "[Output-only] The time when this table was last modified, in milliseconds since the epoch.", @@ -1725,7 +1747,7 @@ }, "type": { "type": "string", - "description": "[Required] The field data type. Possible values include STRING, BYTES, INTEGER, FLOAT, BOOLEAN, TIMESTAMP or RECORD (where RECORD indicates that the field contains a nested schema)." + "description": "[Required] The field data type. Possible values include STRING, BYTES, INTEGER, INT64 (same as INTEGER), FLOAT, FLOAT64 (same as FLOAT), BOOLEAN, BOOL (same as BOOLEAN), TIMESTAMP, DATE, TIME, DATETIME, RECORD (where RECORD indicates that the field contains a nested schema) or STRUCT (same as RECORD)." } } }, @@ -1765,6 +1787,13 @@ "description": "The resource type.", "default": "bigquery#table" }, + "labels": { + "type": "object", + "description": "[Experimental] The labels associated with this table. You can use these to organize and group your tables.", + "additionalProperties": { + "type": "string" + } + }, "tableReference": { "$ref": "TableReference", "description": "A reference uniquely identifying the table." @@ -1881,7 +1910,7 @@ }, "useLegacySql": { "type": "boolean", - "description": "[Experimental] Specifies whether to use BigQuery's legacy SQL for this view. The default value is true. If set to false, the view will use BigQuery's standard SQL: https://cloud.google.com/bigquery/sql-reference/ Queries and views that reference this view must use the same flag value." + "description": "Specifies whether to use BigQuery's legacy SQL for this view. The default value is true. If set to false, the view will use BigQuery's standard SQL: https://cloud.google.com/bigquery/sql-reference/ Queries and views that reference this view must use the same flag value." }, "userDefinedFunctionResources": { "type": "array", diff --git a/etc/api/blogger/v2/blogger-api.json b/etc/api/blogger/v2/blogger-api.json index e8a736cef8..228e1480fd 100644 --- a/etc/api/blogger/v2/blogger-api.json +++ b/etc/api/blogger/v2/blogger-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/Mm4a0u3lPNBqEzKCYhfhIpC2Mw4\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/Mm4a0u3lPNBqEzKCYhfhIpC2Mw4\"", "discoveryVersion": "v1", "id": "blogger:v2", "name": "blogger", diff --git a/etc/api/blogger/v3/blogger-api.json b/etc/api/blogger/v3/blogger-api.json index f7939da06c..72c9d78170 100644 --- a/etc/api/blogger/v3/blogger-api.json +++ b/etc/api/blogger/v3/blogger-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/Goh5bsNuqq7lTY-yMf_QcKSL760\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/Goh5bsNuqq7lTY-yMf_QcKSL760\"", "discoveryVersion": "v1", "id": "blogger:v3", "name": "blogger", diff --git a/etc/api/books/v1/books-api.json b/etc/api/books/v1/books-api.json index f4c65c9bff..25215fd002 100644 --- a/etc/api/books/v1/books-api.json +++ b/etc/api/books/v1/books-api.json @@ -1,11 +1,11 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/uxsTh9MpfXBIfQELnET3_c75CbQ\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/jiS-k8EAx6v4TcA5Qg2LzgfBvoI\"", "discoveryVersion": "v1", "id": "books:v1", "name": "books", "version": "v1", - "revision": "20160823", + "revision": "20161206", "title": "Books API", "description": "Searches for books and manages your Google Books library.", "ownerDomain": "google.com", @@ -1166,6 +1166,9 @@ "description": "Resource type.", "default": "books#notification" }, + "notificationGroup": { + "type": "string" + }, "notification_type": { "type": "string" }, diff --git a/etc/api/calendar/v3/calendar-api.json b/etc/api/calendar/v3/calendar-api.json index 1697722fb1..7b72548fc4 100644 --- a/etc/api/calendar/v3/calendar-api.json +++ b/etc/api/calendar/v3/calendar-api.json @@ -1,11 +1,11 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/nazGrDu3ytNkqOugrCdxmMJj71Y\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/Cbqw6SyhEKakWSF49vX9PZlU5es\"", "discoveryVersion": "v1", "id": "calendar:v3", "name": "calendar", "version": "v3", - "revision": "20160830", + "revision": "20161211", "title": "Calendar API", "description": "Manipulates events and other calendar data.", "ownerDomain": "google.com", @@ -2129,6 +2129,7 @@ "maxResults": { "type": "integer", "description": "Maximum number of events returned on one result page. By default the value is 250 events. The page size can never be larger than 2500 events. Optional.", + "default": "250", "format": "int32", "minimum": "1", "location": "query" @@ -2443,6 +2444,7 @@ "maxResults": { "type": "integer", "description": "Maximum number of events returned on one result page. By default the value is 250 events. The page size can never be larger than 2500 events. Optional.", + "default": "250", "format": "int32", "minimum": "1", "location": "query" diff --git a/etc/api/civicinfo/v2/civicinfo-api.json b/etc/api/civicinfo/v2/civicinfo-api.json index d1183ccb7c..ec4d1ab736 100644 --- a/etc/api/civicinfo/v2/civicinfo-api.json +++ b/etc/api/civicinfo/v2/civicinfo-api.json @@ -1,19 +1,19 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/0RRptSlHJI7MXoKAqjNEurqVvHk\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/sNrwy4GBJh0JDl02KcW1-1MdJOM\"", "discoveryVersion": "v1", "id": "civicinfo:v2", "name": "civicinfo", "canonicalName": "Civic Info", "version": "v2", - "revision": "20160823", + "revision": "20161102", "title": "Google Civic Information API", "description": "Provides polling places, early vote locations, contest data, election officials, and government representatives for U.S. residential addresses.", "ownerDomain": "google.com", "ownerName": "Google", "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" }, "documentationLink": "https://developers.google.com/civic-information", "protocol": "rest", @@ -191,7 +191,7 @@ }, "name": { "type": "string", - "description": "The candidate's name." + "description": "The candidate's name. If this is a joint ticket it will indicate the name of the candidate at the top of a ticket followed by a / and that name of candidate at the bottom of the ticket. e.g. \"Mitt Romney / Paul Ryan\"" }, "orderOnBallot": { "type": "string", @@ -348,6 +348,35 @@ } } }, + "ContextParams": { + "id": "ContextParams", + "type": "object", + "properties": { + "clientProfile": { + "type": "string" + } + } + }, + "DivisionRepresentativeInfoRequest": { + "id": "DivisionRepresentativeInfoRequest", + "type": "object", + "description": "A request to look up representative information for a single division.", + "properties": { + "contextParams": { + "$ref": "ContextParams" + } + } + }, + "DivisionSearchRequest": { + "id": "DivisionSearchRequest", + "type": "object", + "description": "A search request for political geographies.", + "properties": { + "contextParams": { + "$ref": "ContextParams" + } + } + }, "DivisionSearchResponse": { "id": "DivisionSearchResponse", "type": "object", @@ -439,6 +468,15 @@ } } }, + "ElectionsQueryRequest": { + "id": "ElectionsQueryRequest", + "type": "object", + "properties": { + "contextParams": { + "$ref": "ContextParams" + } + } + }, "ElectionsQueryResponse": { "id": "ElectionsQueryResponse", "type": "object", @@ -650,6 +688,108 @@ } } }, + "PostalAddress": { + "id": "PostalAddress", + "type": "object", + "properties": { + "addressLines": { + "type": "array", + "items": { + "type": "string" + } + }, + "administrativeAreaName": { + "type": "string" + }, + "countryName": { + "type": "string" + }, + "countryNameCode": { + "type": "string" + }, + "dependentLocalityName": { + "type": "string" + }, + "dependentThoroughfareLeadingType": { + "type": "string" + }, + "dependentThoroughfareName": { + "type": "string" + }, + "dependentThoroughfarePostDirection": { + "type": "string" + }, + "dependentThoroughfarePreDirection": { + "type": "string" + }, + "dependentThoroughfareTrailingType": { + "type": "string" + }, + "dependentThoroughfaresConnector": { + "type": "string" + }, + "dependentThoroughfaresIndicator": { + "type": "string" + }, + "dependentThoroughfaresType": { + "type": "string" + }, + "firmName": { + "type": "string" + }, + "isDisputed": { + "type": "boolean" + }, + "languageCode": { + "type": "string" + }, + "localityName": { + "type": "string" + }, + "postBoxNumber": { + "type": "string" + }, + "postalCodeNumber": { + "type": "string" + }, + "postalCodeNumberExtension": { + "type": "string" + }, + "premiseName": { + "type": "string" + }, + "recipientName": { + "type": "string" + }, + "sortingCode": { + "type": "string" + }, + "subAdministrativeAreaName": { + "type": "string" + }, + "subPremiseName": { + "type": "string" + }, + "thoroughfareLeadingType": { + "type": "string" + }, + "thoroughfareName": { + "type": "string" + }, + "thoroughfareNumber": { + "type": "string" + }, + "thoroughfarePostDirection": { + "type": "string" + }, + "thoroughfarePreDirection": { + "type": "string" + }, + "thoroughfareTrailingType": { + "type": "string" + } + } + }, "RepresentativeInfoData": { "id": "RepresentativeInfoData", "type": "object", @@ -678,6 +818,16 @@ } } }, + "RepresentativeInfoRequest": { + "id": "RepresentativeInfoRequest", + "type": "object", + "description": "A request for political geography and representative information for an address.", + "properties": { + "contextParams": { + "$ref": "ContextParams" + } + } + }, "RepresentativeInfoResponse": { "id": "RepresentativeInfoResponse", "type": "object", @@ -766,6 +916,19 @@ } } }, + "VoterInfoRequest": { + "id": "VoterInfoRequest", + "type": "object", + "description": "A request for information about a voter.", + "properties": { + "contextParams": { + "$ref": "ContextParams" + }, + "voterInfoSegmentResult": { + "$ref": "VoterInfoSegmentResult" + } + } + }, "VoterInfoResponse": { "id": "VoterInfoResponse", "type": "object", @@ -834,6 +997,25 @@ } } } + }, + "VoterInfoSegmentResult": { + "id": "VoterInfoSegmentResult", + "type": "object", + "properties": { + "generatedMillis": { + "type": "string", + "format": "int64" + }, + "postalAddress": { + "$ref": "PostalAddress" + }, + "request": { + "$ref": "VoterInfoRequest" + }, + "response": { + "$ref": "VoterInfoResponse" + } + } } }, "resources": { @@ -851,6 +1033,9 @@ "location": "query" } }, + "request": { + "$ref": "DivisionSearchRequest" + }, "response": { "$ref": "DivisionSearchResponse" } @@ -864,6 +1049,9 @@ "path": "elections", "httpMethod": "GET", "description": "List of available elections to query.", + "request": { + "$ref": "ElectionsQueryRequest" + }, "response": { "$ref": "ElectionsQueryResponse" } @@ -903,6 +1091,9 @@ "parameterOrder": [ "address" ], + "request": { + "$ref": "VoterInfoRequest" + }, "response": { "$ref": "VoterInfoResponse" } @@ -989,6 +1180,9 @@ "location": "query" } }, + "request": { + "$ref": "RepresentativeInfoRequest" + }, "response": { "$ref": "RepresentativeInfoResponse" } @@ -1074,6 +1268,9 @@ "parameterOrder": [ "ocdId" ], + "request": { + "$ref": "DivisionRepresentativeInfoRequest" + }, "response": { "$ref": "RepresentativeInfoData" } diff --git a/etc/api/classroom/v1/classroom-api.json b/etc/api/classroom/v1/classroom-api.json index d7af292310..9c01429752 100644 --- a/etc/api/classroom/v1/classroom-api.json +++ b/etc/api/classroom/v1/classroom-api.json @@ -1,11 +1,11 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/YsDe4FXJlhWXueJei0_RXQqm_4I\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/mk_oLjlaBwJ1BcBJ5yykCFb6u3w\"", "discoveryVersion": "v1", "id": "classroom:v1", "name": "classroom", "version": "v1", - "revision": "20160816", + "revision": "20161006", "title": "Google Classroom API", "description": "Manages classes, rosters, and invitations in Google Classroom.", "ownerDomain": "google.com", @@ -224,6 +224,10 @@ "items": { "$ref": "CourseMaterialSet" } + }, + "guardiansEnabled": { + "type": "boolean", + "description": "Whether or not guardian notifications are enabled for this course. Read-only." } } }, @@ -1270,6 +1274,19 @@ "description": "Restricts returned courses to those having a teacher with the specified identifier. The identifier can be one of the following: * the numeric identifier for the user * the email address of the user * the string literal `\"me\"`, indicating the requesting user", "location": "query" }, + "courseStates": { + "type": "string", + "description": "Restricts returned courses to those in one of the specified states", + "enum": [ + "COURSE_STATE_UNSPECIFIED", + "ACTIVE", + "ARCHIVED", + "PROVISIONED", + "DECLINED" + ], + "repeated": true, + "location": "query" + }, "pageSize": { "type": "integer", "description": "Maximum number of items to return. Zero or unspecified indicates that the server may assign a maximum. The server may return fewer than the specified number of results.", @@ -2143,11 +2160,11 @@ "id": "classroom.userProfiles.guardianInvitations.list", "path": "v1/userProfiles/{studentId}/guardianInvitations", "httpMethod": "GET", - "description": "Returns a list of guardian invitations that the requesting user is permitted to view, filtered by the parameters provided. This method returns the following error codes: * `PERMISSION_DENIED` if a `student_id` is specified, and the requesting user is not permitted to view guardian invitations for that student, if guardians are not enabled for the domain in question, or for other access errors. * `INVALID_ARGUMENT` if a `student_id` is specified, but its format cannot be recognized (it is not an email address, nor a `student_id` from the API, nor the literal string `me`). May also be returned if an invalid `page_token` or `state` is provided. * `NOT_FOUND` if a `student_id` is specified, and its format can be recognized, but Classroom has no record of that student.", + "description": "Returns a list of guardian invitations that the requesting user is permitted to view, filtered by the parameters provided. This method returns the following error codes: * `PERMISSION_DENIED` if a `student_id` is specified, and the requesting user is not permitted to view guardian invitations for that student, if `\"-\"` is specified as the `student_id` and the user is not a domain administrator, if guardians are not enabled for the domain in question, or for other access errors. * `INVALID_ARGUMENT` if a `student_id` is specified, but its format cannot be recognized (it is not an email address, nor a `student_id` from the API, nor the literal string `me`). May also be returned if an invalid `page_token` or `state` is provided. * `NOT_FOUND` if a `student_id` is specified, and its format can be recognized, but Classroom has no record of that student.", "parameters": { "studentId": { "type": "string", - "description": "The ID of the student whose guardian invitations are to be returned. The identifier can be one of the following: * the numeric identifier for the user * the email address of the user * the string literal `\"me\"`, indicating the requesting user", + "description": "The ID of the student whose guardian invitations are to be returned. The identifier can be one of the following: * the numeric identifier for the user * the email address of the user * the string literal `\"me\"`, indicating the requesting user * the string literal `\"-\"`, indicating that results should be returned for all students that the requesting user is permitted to view guardian invitations.", "required": true, "location": "path" }, @@ -2279,11 +2296,11 @@ "id": "classroom.userProfiles.guardians.list", "path": "v1/userProfiles/{studentId}/guardians", "httpMethod": "GET", - "description": "Returns a list of guardians that the requesting user is permitted to view, restricted to those that match the request. This method returns the following error codes: * `PERMISSION_DENIED` if a `student_id` is specified, and the requesting user is not permitted to view guardian information for that student, if guardians are not enabled for the domain in question, if the `invited_email_address` filter is set by a user who is not a domain administrator, or for other access errors. * `INVALID_ARGUMENT` if a `student_id` is specified, but its format cannot be recognized (it is not an email address, nor a `student_id` from the API, nor the literal string `me`). May also be returned if an invalid `page_token` is provided. * `NOT_FOUND` if a `student_id` is specified, and its format can be recognized, but Classroom has no record of that student.", + "description": "Returns a list of guardians that the requesting user is permitted to view, restricted to those that match the request. To list guardians for any student that the requesting user may view guardians for, use the literal character `-` for the student ID. This method returns the following error codes: * `PERMISSION_DENIED` if a `student_id` is specified, and the requesting user is not permitted to view guardian information for that student, if `\"-\"` is specified as the `student_id` and the user is not a domain administrator, if guardians are not enabled for the domain in question, if the `invited_email_address` filter is set by a user who is not a domain administrator, or for other access errors. * `INVALID_ARGUMENT` if a `student_id` is specified, but its format cannot be recognized (it is not an email address, nor a `student_id` from the API, nor the literal string `me`). May also be returned if an invalid `page_token` is provided. * `NOT_FOUND` if a `student_id` is specified, and its format can be recognized, but Classroom has no record of that student.", "parameters": { "studentId": { "type": "string", - "description": "Filter results by the student who the guardian is linked to. The identifier can be one of the following: * the numeric identifier for the user * the email address of the user * the string literal `\"me\"`, indicating the requesting user", + "description": "Filter results by the student who the guardian is linked to. The identifier can be one of the following: * the numeric identifier for the user * the email address of the user * the string literal `\"me\"`, indicating the requesting user * the string literal `\"-\"`, indicating that results should be returned for all students that the requesting user has access to view.", "required": true, "location": "path" }, diff --git a/etc/api/cloudbilling/v1/cloudbilling-api.json b/etc/api/cloudbilling/v1/cloudbilling-api.json index 7debc30c1f..91cb0eb321 100644 --- a/etc/api/cloudbilling/v1/cloudbilling-api.json +++ b/etc/api/cloudbilling/v1/cloudbilling-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/M2VzqGfwqR0FviWkPggfCzE5zZU\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/M2VzqGfwqR0FviWkPggfCzE5zZU\"", "discoveryVersion": "v1", "id": "cloudbilling:v1", "name": "cloudbilling", diff --git a/etc/api/cloudbuild/v1/cloudbuild-api.json b/etc/api/cloudbuild/v1/cloudbuild-api.json index e69de29bb2..92a04aa4ff 100644 --- a/etc/api/cloudbuild/v1/cloudbuild-api.json +++ b/etc/api/cloudbuild/v1/cloudbuild-api.json @@ -0,0 +1,1029 @@ +{ + "id": "cloudbuild:v1", + "auth": { + "oauth2": { + "scopes": { + "https://www.googleapis.com/auth/cloud-platform": { + "description": "View and manage your data across Google Cloud Platform services" + } + } + } + }, + "description": "Builds container images in the cloud.", + "protocol": "rest", + "title": "Google Cloud Container Builder API", + "resources": { + "projects": { + "resources": { + "triggers": { + "methods": { + "create": { + "id": "cloudbuild.projects.triggers.create", + "response": { + "$ref": "BuildTrigger" + }, + "parameterOrder": [ + "projectId" + ], + "description": "Creates a new BuildTrigger.\n\nThis API is experimental.", + "request": { + "$ref": "BuildTrigger" + }, + "flatPath": "v1/projects/{projectId}/triggers", + "httpMethod": "POST", + "parameters": { + "projectId": { + "description": "ID of the project for which to configure automatic builds.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1/projects/{projectId}/triggers", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "get": { + "id": "cloudbuild.projects.triggers.get", + "response": { + "$ref": "BuildTrigger" + }, + "parameterOrder": [ + "projectId", + "triggerId" + ], + "description": "Gets information about a BuildTrigger.\n\nThis API is experimental.", + "flatPath": "v1/projects/{projectId}/triggers/{triggerId}", + "httpMethod": "GET", + "parameters": { + "projectId": { + "description": "ID of the project that owns the trigger.", + "required": true, + "location": "path", + "type": "string" + }, + "triggerId": { + "description": "ID of the BuildTrigger to get.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1/projects/{projectId}/triggers/{triggerId}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "list": { + "id": "cloudbuild.projects.triggers.list", + "response": { + "$ref": "ListBuildTriggersResponse" + }, + "parameterOrder": [ + "projectId" + ], + "description": "Lists existing BuildTrigger.\n\nThis API is experimental.", + "flatPath": "v1/projects/{projectId}/triggers", + "httpMethod": "GET", + "parameters": { + "projectId": { + "description": "ID of the project for which to list BuildTriggers.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1/projects/{projectId}/triggers", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "delete": { + "id": "cloudbuild.projects.triggers.delete", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "projectId", + "triggerId" + ], + "description": "Deletes an BuildTrigger by its project ID and trigger ID.\n\nThis API is experimental.", + "flatPath": "v1/projects/{projectId}/triggers/{triggerId}", + "httpMethod": "DELETE", + "parameters": { + "projectId": { + "description": "ID of the project that owns the trigger.", + "required": true, + "location": "path", + "type": "string" + }, + "triggerId": { + "description": "ID of the BuildTrigger to delete.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1/projects/{projectId}/triggers/{triggerId}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "patch": { + "id": "cloudbuild.projects.triggers.patch", + "response": { + "$ref": "BuildTrigger" + }, + "parameterOrder": [ + "projectId", + "triggerId" + ], + "description": "Updates an BuildTrigger by its project ID and trigger ID.\n\nThis API is experimental.", + "request": { + "$ref": "BuildTrigger" + }, + "flatPath": "v1/projects/{projectId}/triggers/{triggerId}", + "httpMethod": "PATCH", + "parameters": { + "projectId": { + "description": "ID of the project that owns the trigger.", + "required": true, + "location": "path", + "type": "string" + }, + "triggerId": { + "description": "ID of the BuildTrigger to update.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1/projects/{projectId}/triggers/{triggerId}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + } + } + }, + "builds": { + "methods": { + "create": { + "id": "cloudbuild.projects.builds.create", + "response": { + "$ref": "Operation" + }, + "parameterOrder": [ + "projectId" + ], + "description": "Starts a build with the specified configuration.\n\nThe long-running Operation returned by this method will include the ID of\nthe build, which can be passed to GetBuild to determine its status (e.g.,\nsuccess or failure).", + "request": { + "$ref": "Build" + }, + "flatPath": "v1/projects/{projectId}/builds", + "httpMethod": "POST", + "parameters": { + "projectId": { + "description": "ID of the project.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1/projects/{projectId}/builds", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "get": { + "id": "cloudbuild.projects.builds.get", + "response": { + "$ref": "Build" + }, + "parameterOrder": [ + "projectId", + "id" + ], + "description": "Returns information about a previously requested build.\n\nThe Build that is returned includes its status (e.g., success or failure,\nor in-progress), and timing information.", + "flatPath": "v1/projects/{projectId}/builds/{id}", + "httpMethod": "GET", + "parameters": { + "projectId": { + "description": "ID of the project.", + "required": true, + "location": "path", + "type": "string" + }, + "id": { + "description": "ID of the build.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1/projects/{projectId}/builds/{id}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "list": { + "id": "cloudbuild.projects.builds.list", + "response": { + "$ref": "ListBuildsResponse" + }, + "parameterOrder": [ + "projectId" + ], + "description": "Lists previously requested builds.\n\nPreviously requested builds may still be in-progress, or may have finished\nsuccessfully or unsuccessfully.", + "flatPath": "v1/projects/{projectId}/builds", + "httpMethod": "GET", + "parameters": { + "pageSize": { + "description": "Number of results to return in the list.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "filter": { + "description": "The raw filter text to constrain the results.", + "location": "query", + "type": "string" + }, + "projectId": { + "description": "ID of the project.", + "required": true, + "location": "path", + "type": "string" + }, + "pageToken": { + "description": "Token to provide to skip to a particular spot in the list.", + "location": "query", + "type": "string" + } + }, + "path": "v1/projects/{projectId}/builds", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "cancel": { + "id": "cloudbuild.projects.builds.cancel", + "response": { + "$ref": "Build" + }, + "parameterOrder": [ + "projectId", + "id" + ], + "description": "Cancels a requested build in progress.", + "request": { + "$ref": "CancelBuildRequest" + }, + "flatPath": "v1/projects/{projectId}/builds/{id}:cancel", + "httpMethod": "POST", + "parameters": { + "projectId": { + "description": "ID of the project.", + "required": true, + "location": "path", + "type": "string" + }, + "id": { + "description": "ID of the build.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1/projects/{projectId}/builds/{id}:cancel", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + } + } + } + } + }, + "operations": { + "methods": { + "get": { + "id": "cloudbuild.operations.get", + "response": { + "$ref": "Operation" + }, + "parameterOrder": [ + "name" + ], + "description": "Gets the latest state of a long-running operation. Clients can use this\nmethod to poll the operation result at intervals as recommended by the API\nservice.", + "flatPath": "v1/operations/{operationsId}", + "httpMethod": "GET", + "parameters": { + "name": { + "description": "The name of the operation resource.", + "required": true, + "pattern": "^operations/.+$", + "location": "path", + "type": "string" + } + }, + "path": "v1/{+name}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "list": { + "id": "cloudbuild.operations.list", + "response": { + "$ref": "ListOperationsResponse" + }, + "parameterOrder": [ + "name" + ], + "description": "Lists operations that match the specified filter in the request. If the\nserver doesn't support this method, it returns `UNIMPLEMENTED`.\n\nNOTE: the `name` binding below allows API services to override the binding\nto use different resource name schemes, such as `users/*/operations`.", + "flatPath": "v1/operations", + "httpMethod": "GET", + "parameters": { + "pageSize": { + "description": "The standard list page size.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "filter": { + "description": "The standard list filter.", + "location": "query", + "type": "string" + }, + "name": { + "description": "The name of the operation collection.", + "required": true, + "pattern": "^operations$", + "location": "path", + "type": "string" + }, + "pageToken": { + "description": "The standard list page token.", + "location": "query", + "type": "string" + } + }, + "path": "v1/{+name}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "cancel": { + "id": "cloudbuild.operations.cancel", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "name" + ], + "description": "Starts asynchronous cancellation on a long-running operation. The server\nmakes a best effort to cancel the operation, but success is not\nguaranteed. If the server doesn't support this method, it returns\n`google.rpc.Code.UNIMPLEMENTED`. Clients can use\nOperations.GetOperation or\nother methods to check whether the cancellation succeeded or whether the\noperation completed despite cancellation. On successful cancellation,\nthe operation is not deleted; instead, it becomes an operation with\nan Operation.error value with a google.rpc.Status.code of 1,\ncorresponding to `Code.CANCELLED`.", + "request": { + "$ref": "CancelOperationRequest" + }, + "flatPath": "v1/operations/{operationsId}:cancel", + "httpMethod": "POST", + "parameters": { + "name": { + "description": "The name of the operation resource to be cancelled.", + "required": true, + "pattern": "^operations/.+$", + "location": "path", + "type": "string" + } + }, + "path": "v1/{+name}:cancel", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + } + } + } + }, + "schemas": { + "Status": { + "description": "The `Status` type defines a logical error model that is suitable for different\nprogramming environments, including REST APIs and RPC APIs. It is used by\n[gRPC](https://github.com/grpc). The error model is designed to be:\n\n- Simple to use and understand for most users\n- Flexible enough to meet unexpected needs\n\n# Overview\n\nThe `Status` message contains three pieces of data: error code, error message,\nand error details. The error code should be an enum value of\ngoogle.rpc.Code, but it may accept additional error codes if needed. The\nerror message should be a developer-facing English message that helps\ndevelopers *understand* and *resolve* the error. If a localized user-facing\nerror message is needed, put the localized message in the error details or\nlocalize it in the client. The optional error details may contain arbitrary\ninformation about the error. There is a predefined set of error detail types\nin the package `google.rpc` which can be used for common error conditions.\n\n# Language mapping\n\nThe `Status` message is the logical representation of the error model, but it\nis not necessarily the actual wire format. When the `Status` message is\nexposed in different client libraries and different wire protocols, it can be\nmapped differently. For example, it will likely be mapped to some exceptions\nin Java, but more likely mapped to some error codes in C.\n\n# Other uses\n\nThe error model and the `Status` message can be used in a variety of\nenvironments, either with or without APIs, to provide a\nconsistent developer experience across different environments.\n\nExample uses of this error model include:\n\n- Partial errors. If a service needs to return partial errors to the client,\n it may embed the `Status` in the normal response to indicate the partial\n errors.\n\n- Workflow errors. A typical workflow has multiple steps. Each step may\n have a `Status` message for error reporting purpose.\n\n- Batch operations. If a client uses batch request and batch response, the\n `Status` message should be used directly inside batch response, one for\n each error sub-response.\n\n- Asynchronous operations. If an API call embeds asynchronous operation\n results in its response, the status of those operations should be\n represented directly using the `Status` message.\n\n- Logging. If some API errors are stored in logs, the message `Status` could\n be used directly after any stripping needed for security/privacy reasons.", + "type": "object", + "properties": { + "code": { + "description": "The status code, which should be an enum value of google.rpc.Code.", + "type": "integer", + "format": "int32" + }, + "details": { + "description": "A list of messages that carry the error details. There will be a\ncommon set of message types for APIs to use.", + "type": "array", + "items": { + "additionalProperties": { + "description": "Properties of the object. Contains field @type with type URL.", + "type": "any" + }, + "type": "object" + } + }, + "message": { + "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\ngoogle.rpc.Status.details field, or localized by the client.", + "type": "string" + } + }, + "id": "Status" + }, + "BuildOperationMetadata": { + "description": "Metadata for build operations.", + "type": "object", + "properties": { + "build": { + "description": "The build that the operation is tracking.", + "$ref": "Build" + } + }, + "id": "BuildOperationMetadata" + }, + "Source": { + "description": "Source describes the location of the source in a supported storage\nservice.", + "type": "object", + "properties": { + "storageSource": { + "description": "If provided, get the source from this location in in Google Cloud\nStorage.", + "$ref": "StorageSource" + }, + "repoSource": { + "description": "If provided, get source from this location in a Cloud Repo.", + "$ref": "RepoSource" + } + }, + "id": "Source" + }, + "SourceProvenance": { + "description": "Provenance of the source. Ways to find the original source, or verify that\nsome source was used for this build.", + "type": "object", + "properties": { + "resolvedRepoSource": { + "description": "A copy of the build's source.repo_source, if exists, with any\nrevisions resolved.", + "$ref": "RepoSource" + }, + "resolvedStorageSource": { + "description": "A copy of the build's source.storage_source, if exists, with any\ngenerations resolved.", + "$ref": "StorageSource" + }, + "fileHashes": { + "description": "Hash(es) of the build source, which can be used to verify that the original\nsource integrity was maintained in the build. Note that FileHashes will\nonly be populated if BuildOptions has requested a SourceProvenanceHash.\n\nThe keys to this map are file paths used as build source and the values\ncontain the hash values for those files.\n\nIf the build source came in a single package such as a gzipped tarfile\n(.tar.gz), the FileHash will be for the single path to that file.\n@OutputOnly", + "additionalProperties": { + "$ref": "FileHashes" + }, + "type": "object" + } + }, + "id": "SourceProvenance" + }, + "Operation": { + "description": "This resource represents a long-running operation that is the result of a\nnetwork API call.", + "type": "object", + "properties": { + "error": { + "description": "The error result of the operation in case of failure or cancellation.", + "$ref": "Status" + }, + "done": { + "description": "If the value is `false`, it means the operation is still in progress.\nIf true, the operation is completed, and either `error` or `response` is\navailable.", + "type": "boolean" + }, + "metadata": { + "description": "Service-specific metadata associated with the operation. It typically\ncontains progress information and common metadata such as create time.\nSome services might not provide such metadata. Any method that returns a\nlong-running operation should document the metadata type, if any.", + "additionalProperties": { + "description": "Properties of the object. Contains field @type with type URL.", + "type": "any" + }, + "type": "object" + }, + "response": { + "description": "The normal response of the operation in case of success. If the original\nmethod returns no data on success, such as `Delete`, the response is\n`google.protobuf.Empty`. If the original method is standard\n`Get`/`Create`/`Update`, the response should be the resource. For other\nmethods, the response should have the type `XxxResponse`, where `Xxx`\nis the original method name. For example, if the original method name\nis `TakeSnapshot()`, the inferred response type is\n`TakeSnapshotResponse`.", + "additionalProperties": { + "description": "Properties of the object. Contains field @type with type URL.", + "type": "any" + }, + "type": "object" + }, + "name": { + "description": "The server-assigned name, which is only unique within the same service that\noriginally returns it. If you use the default HTTP mapping, the\n`name` should have the format of `operations/some/unique/name`.", + "type": "string" + } + }, + "id": "Operation" + }, + "BuildTrigger": { + "description": "Configuration for an automated build in response to source repository\nchanges.", + "type": "object", + "properties": { + "id": { + "description": "Unique identifier of the trigger.\n\n@OutputOnly", + "type": "string" + }, + "description": { + "description": "Human-readable description of this trigger.", + "type": "string" + }, + "triggerTemplate": { + "description": "Template describing the types of source changes to trigger a build.\n\nBranch and tag names in trigger templates are interpreted as regular\nexpressions. Any branch or tag change that matches that regular expression\nwill trigger a build.", + "$ref": "RepoSource" + }, + "disabled": { + "description": "If true, the trigger will never result in a build.", + "type": "boolean" + }, + "createTime": { + "description": "Time when the trigger was created.\n\n@OutputOnly", + "type": "string", + "format": "google-datetime" + }, + "filename": { + "description": "Path, from the source root, to a file whose contents is used for the\ntemplate.", + "type": "string" + }, + "build": { + "description": "Contents of the build template.", + "$ref": "Build" + } + }, + "id": "BuildTrigger" + }, + "BuiltImage": { + "description": "BuiltImage describes an image built by the pipeline.", + "type": "object", + "properties": { + "digest": { + "description": "Docker Registry 2.0 digest.", + "type": "string" + }, + "name": { + "description": "Name used to push the container image to Google Container Registry, as\npresented to `docker push`.", + "type": "string" + } + }, + "id": "BuiltImage" + }, + "Hash": { + "description": "Container message for hash values.", + "type": "object", + "properties": { + "value": { + "description": "The hash value.", + "type": "string", + "format": "byte" + }, + "type": { + "description": "The type of hash that was performed.", + "enum": [ + "NONE", + "SHA256" + ], + "enumDescriptions": [ + "No hash requested.", + "Use a sha256 hash." + ], + "type": "string" + } + }, + "id": "Hash" + }, + "CancelOperationRequest": { + "description": "The request message for Operations.CancelOperation.", + "type": "object", + "properties": {}, + "id": "CancelOperationRequest" + }, + "StorageSource": { + "description": "StorageSource describes the location of the source in an archive file in\nGoogle Cloud Storage.", + "type": "object", + "properties": { + "bucket": { + "description": "Google Cloud Storage bucket containing source (see\n[Bucket Name\nRequirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)).", + "type": "string" + }, + "generation": { + "description": "Google Cloud Storage generation for the object. If the generation is\nomitted, the latest generation will be used.", + "type": "string", + "format": "int64" + }, + "object": { + "description": "Google Cloud Storage object containing source.\n\nThis object must be a gzipped archive file (.tar.gz) containing source to\nbuild.", + "type": "string" + } + }, + "id": "StorageSource" + }, + "Results": { + "description": "Results describes the artifacts created by the build pipeline.", + "type": "object", + "properties": { + "images": { + "description": "Images that were built as a part of the build.", + "type": "array", + "items": { + "$ref": "BuiltImage" + } + }, + "buildStepImages": { + "description": "List of build step digests, in order corresponding to build step indices.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "id": "Results" + }, + "Build": { + "description": "A build resource in the Container Builder API.\n\nAt a high level, a Build describes where to find source code, how to build\nit (for example, the builder image to run on the source), and what tag to\napply to the built image when it is pushed to Google Container Registry.\n\nFields can include the following variables which will be expanded when the\nbuild is created:\n\n- $PROJECT_ID: the project ID of the build.\n- $BUILD_ID: the autogenerated ID of the build.\n- $REPO_NAME: the source repository name specified by RepoSource.\n- $BRANCH_NAME: the branch name specified by RepoSource.\n- $TAG_NAME: the tag name specified by RepoSource.\n- $REVISION_ID or $COMMIT_SHA: the commit SHA specified by RepoSource or\n resolved from the specified branch or tag.", + "type": "object", + "properties": { + "id": { + "description": "Unique identifier of the build.\n@OutputOnly", + "type": "string" + }, + "sourceProvenance": { + "description": "A permanent fixed identifier for source.\n@OutputOnly", + "$ref": "SourceProvenance" + }, + "results": { + "description": "Results of the build.\n@OutputOnly", + "$ref": "Results" + }, + "status": { + "description": "Status of the build.\n@OutputOnly", + "enum": [ + "STATUS_UNKNOWN", + "QUEUED", + "WORKING", + "SUCCESS", + "FAILURE", + "INTERNAL_ERROR", + "TIMEOUT", + "CANCELLED" + ], + "enumDescriptions": [ + "Status of the build is unknown.", + "Build is queued; work has not yet begun.", + "Build is being executed.", + "Build finished successfully.", + "Build failed to complete successfully.", + "Build failed due to an internal cause.", + "Build took longer than was allowed.", + "Build was canceled by a user." + ], + "type": "string" + }, + "options": { + "description": "Special options for this build.", + "$ref": "BuildOptions" + }, + "finishTime": { + "description": "Time at which execution of the build was finished.\n\nThe difference between finish_time and start_time is the duration of the\nbuild's execution.\n@OutputOnly", + "type": "string", + "format": "google-datetime" + }, + "timeout": { + "description": "Amount of time that this build should be allowed to run, to second\ngranularity. If this amount of time elapses, work on the build will cease\nand the build status will be TIMEOUT.\n\nDefault time is ten minutes.", + "type": "string", + "format": "google-duration" + }, + "steps": { + "description": "Describes the operations to be performed on the workspace.", + "type": "array", + "items": { + "$ref": "BuildStep" + } + }, + "source": { + "description": "Describes where to find the source files to build.", + "$ref": "Source" + }, + "createTime": { + "description": "Time at which the request to create the build was received.\n@OutputOnly", + "type": "string", + "format": "google-datetime" + }, + "logUrl": { + "description": "URL to logs for this build in Google Cloud Logging.\n@OutputOnly", + "type": "string" + }, + "statusDetail": { + "description": "Customer-readable message about the current status.\n@OutputOnly", + "type": "string" + }, + "images": { + "description": "A list of images to be pushed upon the successful completion of all build\nsteps.\n\nThe images will be pushed using the builder service account's credentials.\n\nThe digests of the pushed images will be stored in the Build resource's\nresults field.\n\nIf any of the images fail to be pushed, the build is marked FAILURE.", + "type": "array", + "items": { + "type": "string" + } + }, + "startTime": { + "description": "Time at which execution of the build was started.\n@OutputOnly", + "type": "string", + "format": "google-datetime" + }, + "buildTriggerId": { + "description": "The ID of the BuildTrigger that triggered this build, if it was\ntriggered automatically.\n@OutputOnly", + "type": "string" + }, + "logsBucket": { + "description": "Google Cloud Storage bucket where logs should be written (see\n[Bucket Name\nRequirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)).\nLogs file names will be of the format `${logs_bucket}/log-${build_id}.txt`.", + "type": "string" + }, + "projectId": { + "description": "ID of the project.\n@OutputOnly.", + "type": "string" + } + }, + "id": "Build" + }, + "ListBuildTriggersResponse": { + "description": "Response containing existing BuildTriggers.", + "type": "object", + "properties": { + "triggers": { + "description": "BuildTriggers for the project, sorted by create_time descending.", + "type": "array", + "items": { + "$ref": "BuildTrigger" + } + } + }, + "id": "ListBuildTriggersResponse" + }, + "CancelBuildRequest": { + "description": "Request to cancel an ongoing build.", + "type": "object", + "properties": {}, + "id": "CancelBuildRequest" + }, + "ListOperationsResponse": { + "description": "The response message for Operations.ListOperations.", + "type": "object", + "properties": { + "nextPageToken": { + "description": "The standard List next-page token.", + "type": "string" + }, + "operations": { + "description": "A list of operations that matches the specified filter in the request.", + "type": "array", + "items": { + "$ref": "Operation" + } + } + }, + "id": "ListOperationsResponse" + }, + "FileHashes": { + "description": "Container message for hashes of byte content of files, used in\nSourceProvenance messages to verify integrity of source input to the build.", + "type": "object", + "properties": { + "fileHash": { + "description": "Collection of file hashes.", + "type": "array", + "items": { + "$ref": "Hash" + } + } + }, + "id": "FileHashes" + }, + "RepoSource": { + "description": "RepoSource describes the location of the source in a Google Cloud Source\nRepository.", + "type": "object", + "properties": { + "repoName": { + "description": "Name of the repo. If omitted, the name \"default\" is assumed.", + "type": "string" + }, + "tagName": { + "description": "Name of the tag to build.", + "type": "string" + }, + "projectId": { + "description": "ID of the project that owns the repo. If omitted, the project ID requesting\nthe build is assumed.", + "type": "string" + }, + "branchName": { + "description": "Name of the branch to build.", + "type": "string" + }, + "commitSha": { + "description": "Explicit commit SHA to build.", + "type": "string" + } + }, + "id": "RepoSource" + }, + "BuildStep": { + "description": "BuildStep describes a step to perform in the build pipeline.", + "type": "object", + "properties": { + "id": { + "description": "Optional unique identifier for this build step, used in wait_for to\nreference this build step as a dependency.", + "type": "string" + }, + "env": { + "description": "A list of environment variable definitions to be used when running a step.\n\nThe elements are of the form \"KEY=VALUE\" for the environment variable \"KEY\"\nbeing given the value \"VALUE\".", + "type": "array", + "items": { + "type": "string" + } + }, + "waitFor": { + "description": "The ID(s) of the step(s) that this build step depends on.\nThis build step will not start until all the build steps in wait_for\nhave completed successfully. If wait_for is empty, this build step will\nstart when all previous build steps in the Build.Steps list have completed\nsuccessfully.", + "type": "array", + "items": { + "type": "string" + } + }, + "args": { + "description": "A list of arguments that will be presented to the step when it is started.\n\nIf the image used to run the step's container has an entrypoint, these args\nwill be used as arguments to that entrypoint. If the image does not define\nan entrypoint, the first element in args will be used as the entrypoint,\nand the remainder will be used as arguments.", + "type": "array", + "items": { + "type": "string" + } + }, + "name": { + "description": "The name of the container image that will run this particular build step.\n\nIf the image is already available in the host's Docker daemon's cache, it\nwill be run directly. If not, the host will attempt to pull the image\nfirst, using the builder service account's credentials if necessary.\n\nThe Docker daemon's cache will already have the latest versions of all of\nthe officially supported build steps\n(https://github.com/GoogleCloudPlatform/cloud-builders). The Docker daemon\nwill also have cached many of the layers for some popular images, like\n\"ubuntu\", \"debian\", but they will be refreshed at the time you attempt to\nuse them.\n\nIf you built an image in a previous build step, it will be stored in the\nhost's Docker daemon's cache and is available to use as the name for a\nlater build step.", + "type": "string" + }, + "dir": { + "description": "Working directory (relative to project source root) to use when running\nthis operation's container.", + "type": "string" + } + }, + "id": "BuildStep" + }, + "Empty": { + "description": "A generic empty message that you can re-use to avoid defining duplicated\nempty messages in your APIs. A typical example is to use it as the request\nor the response type of an API method. For instance:\n\n service Foo {\n rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);\n }\n\nThe JSON representation for `Empty` is empty JSON object `{}`.", + "type": "object", + "properties": {}, + "id": "Empty" + }, + "BuildOptions": { + "description": "Optional arguments to enable specific features of builds.", + "type": "object", + "properties": { + "sourceProvenanceHash": { + "description": "Requested hash for SourceProvenance.", + "enumDescriptions": [ + "No hash requested.", + "Use a sha256 hash." + ], + "type": "array", + "items": { + "enum": [ + "NONE", + "SHA256" + ], + "type": "string" + } + }, + "requestedVerifyOption": { + "description": "Requested verifiability options.", + "enum": [ + "NOT_VERIFIED", + "VERIFIED" + ], + "enumDescriptions": [ + "Not a verifiable build. (default)", + "Verified build." + ], + "type": "string" + } + }, + "id": "BuildOptions" + }, + "ListBuildsResponse": { + "description": "Response including listed builds.", + "type": "object", + "properties": { + "nextPageToken": { + "description": "Token to receive the next page of results.", + "type": "string" + }, + "builds": { + "description": "Builds will be sorted by create_time, descending.", + "type": "array", + "items": { + "$ref": "Build" + } + } + }, + "id": "ListBuildsResponse" + } + }, + "revision": "20161213", + "basePath": "", + "icons": { + "x32": "http://www.google.com/images/icons/product/search-32.gif", + "x16": "http://www.google.com/images/icons/product/search-16.gif" + }, + "version_module": "True", + "canonicalName": "Cloud Build", + "discoveryVersion": "v1", + "baseUrl": "https://cloudbuild.googleapis.com/", + "name": "cloudbuild", + "parameters": { + "access_token": { + "description": "OAuth access token.", + "type": "string", + "location": "query" + }, + "prettyPrint": { + "description": "Returns response with indentations and line breaks.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "key": { + "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", + "type": "string", + "location": "query" + }, + "quotaUser": { + "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.", + "type": "string", + "location": "query" + }, + "pp": { + "description": "Pretty-print response.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "fields": { + "description": "Selector specifying which fields to include in a partial response.", + "type": "string", + "location": "query" + }, + "alt": { + "description": "Data format for response.", + "location": "query", + "enum": [ + "json", + "media", + "proto" + ], + "default": "json", + "enumDescriptions": [ + "Responses with Content-Type of application/json", + "Media download with context-dependent Content-Type", + "Responses with Content-Type of application/x-protobuf" + ], + "type": "string" + }, + "$.xgafv": { + "description": "V1 error format.", + "enum": [ + "1", + "2" + ], + "enumDescriptions": [ + "v1 error format", + "v2 error format" + ], + "type": "string", + "location": "query" + }, + "callback": { + "description": "JSONP", + "type": "string", + "location": "query" + }, + "oauth_token": { + "description": "OAuth 2.0 token for the current user.", + "type": "string", + "location": "query" + }, + "uploadType": { + "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").", + "type": "string", + "location": "query" + }, + "bearer_token": { + "description": "OAuth bearer token.", + "type": "string", + "location": "query" + }, + "upload_protocol": { + "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").", + "type": "string", + "location": "query" + } + }, + "documentationLink": "https://cloud.google.com/container-builder/docs/", + "ownerDomain": "google.com", + "batchPath": "batch", + "servicePath": "", + "ownerName": "Google", + "version": "v1", + "rootUrl": "https://cloudbuild.googleapis.com/", + "kind": "discovery#restDescription" +} diff --git a/etc/api/clouddebugger/v2/clouddebugger-api.json b/etc/api/clouddebugger/v2/clouddebugger-api.json index ea66c2f2e5..20f0a3d01e 100644 --- a/etc/api/clouddebugger/v2/clouddebugger-api.json +++ b/etc/api/clouddebugger/v2/clouddebugger-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/QjifI48X3fgI9mRgli3ziT84a8U\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/QjifI48X3fgI9mRgli3ziT84a8U\"", "discoveryVersion": "v1", "id": "clouddebugger:v2", "name": "clouddebugger", diff --git a/etc/api/clouderrorreporting/v1beta1/clouderrorreporting-api.json b/etc/api/clouderrorreporting/v1beta1/clouderrorreporting-api.json index e69de29bb2..3186f8a3ee 100644 --- a/etc/api/clouderrorreporting/v1beta1/clouderrorreporting-api.json +++ b/etc/api/clouderrorreporting/v1beta1/clouderrorreporting-api.json @@ -0,0 +1,728 @@ +{ + "id": "clouderrorreporting:v1beta1", + "auth": { + "oauth2": { + "scopes": { + "https://www.googleapis.com/auth/cloud-platform": { + "description": "View and manage your data across Google Cloud Platform services" + } + } + } + }, + "description": "Stackdriver Error Reporting groups and counts similar errors from cloud services. The Stackdriver Error Reporting API provides a way to report new errors and read access to error groups and their associated errors.\n", + "protocol": "rest", + "title": "Stackdriver Error Reporting API", + "resources": { + "projects": { + "resources": { + "events": { + "methods": { + "list": { + "id": "clouderrorreporting.projects.events.list", + "response": { + "$ref": "ListEventsResponse" + }, + "parameterOrder": [ + "projectName" + ], + "description": "Lists the specified events.", + "flatPath": "v1beta1/projects/{projectsId}/events", + "httpMethod": "GET", + "parameters": { + "timeRange.period": { + "description": "Restricts the query to the specified time range.", + "enum": [ + "PERIOD_UNSPECIFIED", + "PERIOD_1_HOUR", + "PERIOD_6_HOURS", + "PERIOD_1_DAY", + "PERIOD_1_WEEK", + "PERIOD_30_DAYS" + ], + "location": "query", + "type": "string" + }, + "serviceFilter.resourceType": { + "description": "[Optional] The exact value to match against\n[`ServiceContext.resource_type`](/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.resource_type).", + "location": "query", + "type": "string" + }, + "projectName": { + "description": "[Required] The resource name of the Google Cloud Platform project. Written\nas `projects/` plus the\n[Google Cloud Platform project ID](https://support.google.com/cloud/answer/6158840).\nExample: `projects/my-project-123`.", + "required": true, + "pattern": "^projects/[^/]+$", + "location": "path", + "type": "string" + }, + "serviceFilter.service": { + "description": "[Optional] The exact value to match against\n[`ServiceContext.service`](/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.service).", + "location": "query", + "type": "string" + }, + "groupId": { + "description": "[Required] The group for which events shall be returned.", + "location": "query", + "type": "string" + }, + "serviceFilter.version": { + "description": "[Optional] The exact value to match against\n[`ServiceContext.version`](/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.version).", + "location": "query", + "type": "string" + }, + "pageSize": { + "description": "[Optional] The maximum number of results to return per response.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "pageToken": { + "description": "[Optional] A `next_page_token` provided by a previous response.", + "location": "query", + "type": "string" + } + }, + "path": "v1beta1/{+projectName}/events", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "report": { + "id": "clouderrorreporting.projects.events.report", + "response": { + "$ref": "ReportErrorEventResponse" + }, + "parameterOrder": [ + "projectName" + ], + "description": "Report an individual error event.\n\nThis endpoint accepts \u003cstrong\u003eeither\u003c/strong\u003e an OAuth token,\n\u003cstrong\u003eor\u003c/strong\u003e an\n\u003ca href=\"https://support.google.com/cloud/answer/6158862\"\u003eAPI key\u003c/a\u003e\nfor authentication. To use an API key, append it to the URL as the value of\na `key` parameter. For example:\n\u003cpre\u003ePOST https://clouderrorreporting.googleapis.com/v1beta1/projects/example-project/events:report?key=123ABC456\u003c/pre\u003e", + "request": { + "$ref": "ReportedErrorEvent" + }, + "flatPath": "v1beta1/projects/{projectsId}/events:report", + "httpMethod": "POST", + "parameters": { + "projectName": { + "description": "[Required] The resource name of the Google Cloud Platform project. Written\nas `projects/` plus the\n[Google Cloud Platform project ID](https://support.google.com/cloud/answer/6158840).\nExample: `projects/my-project-123`.", + "required": true, + "pattern": "^projects/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/{+projectName}/events:report", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + } + } + }, + "groups": { + "methods": { + "update": { + "id": "clouderrorreporting.projects.groups.update", + "response": { + "$ref": "ErrorGroup" + }, + "parameterOrder": [ + "name" + ], + "description": "Replace the data for the specified group.\nFails if the group does not exist.", + "request": { + "$ref": "ErrorGroup" + }, + "flatPath": "v1beta1/projects/{projectsId}/groups/{groupsId}", + "httpMethod": "PUT", + "parameters": { + "name": { + "description": "The group resource name.\nExample: \u003ccode\u003eprojects/my-project-123/groups/my-groupid\u003c/code\u003e", + "required": true, + "pattern": "^projects/[^/]+/groups/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/{+name}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "get": { + "id": "clouderrorreporting.projects.groups.get", + "response": { + "$ref": "ErrorGroup" + }, + "parameterOrder": [ + "groupName" + ], + "description": "Get the specified group.", + "flatPath": "v1beta1/projects/{projectsId}/groups/{groupsId}", + "httpMethod": "GET", + "parameters": { + "groupName": { + "description": "[Required] The group resource name. Written as\n\u003ccode\u003eprojects/\u003cvar\u003eprojectID\u003c/var\u003e/groups/\u003cvar\u003egroup_name\u003c/var\u003e\u003c/code\u003e.\nCall\n\u003ca href=\"/error-reporting/reference/rest/v1beta1/projects.groupStats/list\"\u003e\n\u003ccode\u003egroupStats.list\u003c/code\u003e\u003c/a\u003e to return a list of groups belonging to\nthis project.\n\nExample: \u003ccode\u003eprojects/my-project-123/groups/my-group\u003c/code\u003e", + "required": true, + "pattern": "^projects/[^/]+/groups/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/{+groupName}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + } + } + }, + "groupStats": { + "methods": { + "list": { + "id": "clouderrorreporting.projects.groupStats.list", + "response": { + "$ref": "ListGroupStatsResponse" + }, + "parameterOrder": [ + "projectName" + ], + "description": "Lists the specified groups.", + "flatPath": "v1beta1/projects/{projectsId}/groupStats", + "httpMethod": "GET", + "parameters": { + "alignment": { + "description": "[Optional] The alignment of the timed counts to be returned.\nDefault is `ALIGNMENT_EQUAL_AT_END`.", + "enum": [ + "ERROR_COUNT_ALIGNMENT_UNSPECIFIED", + "ALIGNMENT_EQUAL_ROUNDED", + "ALIGNMENT_EQUAL_AT_END" + ], + "location": "query", + "type": "string" + }, + "timeRange.period": { + "description": "Restricts the query to the specified time range.", + "enum": [ + "PERIOD_UNSPECIFIED", + "PERIOD_1_HOUR", + "PERIOD_6_HOURS", + "PERIOD_1_DAY", + "PERIOD_1_WEEK", + "PERIOD_30_DAYS" + ], + "location": "query", + "type": "string" + }, + "serviceFilter.resourceType": { + "description": "[Optional] The exact value to match against\n[`ServiceContext.resource_type`](/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.resource_type).", + "location": "query", + "type": "string" + }, + "projectName": { + "description": "[Required] The resource name of the Google Cloud Platform project. Written\nas \u003ccode\u003eprojects/\u003c/code\u003e plus the\n\u003ca href=\"https://support.google.com/cloud/answer/6158840\"\u003eGoogle Cloud\nPlatform project ID\u003c/a\u003e.\n\nExample: \u003ccode\u003eprojects/my-project-123\u003c/code\u003e.", + "required": true, + "pattern": "^projects/[^/]+$", + "location": "path", + "type": "string" + }, + "order": { + "description": "[Optional] The sort order in which the results are returned.\nDefault is `COUNT_DESC`.", + "enum": [ + "GROUP_ORDER_UNSPECIFIED", + "COUNT_DESC", + "LAST_SEEN_DESC", + "CREATED_DESC", + "AFFECTED_USERS_DESC" + ], + "location": "query", + "type": "string" + }, + "groupId": { + "description": "[Optional] List all \u003ccode\u003eErrorGroupStats\u003c/code\u003e with these IDs.", + "repeated": true, + "location": "query", + "type": "string" + }, + "serviceFilter.service": { + "description": "[Optional] The exact value to match against\n[`ServiceContext.service`](/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.service).", + "location": "query", + "type": "string" + }, + "alignmentTime": { + "description": "[Optional] Time where the timed counts shall be aligned if rounded\nalignment is chosen. Default is 00:00 UTC.", + "location": "query", + "type": "string", + "format": "google-datetime" + }, + "serviceFilter.version": { + "description": "[Optional] The exact value to match against\n[`ServiceContext.version`](/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.version).", + "location": "query", + "type": "string" + }, + "pageSize": { + "description": "[Optional] The maximum number of results to return per response.\nDefault is 20.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "timedCountDuration": { + "description": "[Optional] The preferred duration for a single returned `TimedCount`.\nIf not set, no timed counts are returned.", + "location": "query", + "type": "string", + "format": "google-duration" + }, + "pageToken": { + "description": "[Optional] A `next_page_token` provided by a previous response. To view\nadditional results, pass this token along with the identical query\nparameters as the first request.", + "location": "query", + "type": "string" + } + }, + "path": "v1beta1/{+projectName}/groupStats", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + } + } + } + }, + "methods": { + "deleteEvents": { + "id": "clouderrorreporting.projects.deleteEvents", + "response": { + "$ref": "DeleteEventsResponse" + }, + "parameterOrder": [ + "projectName" + ], + "description": "Deletes all error events of a given project.", + "flatPath": "v1beta1/projects/{projectsId}/events", + "httpMethod": "DELETE", + "parameters": { + "projectName": { + "description": "[Required] The resource name of the Google Cloud Platform project. Written\nas `projects/` plus the\n[Google Cloud Platform project ID](https://support.google.com/cloud/answer/6158840).\nExample: `projects/my-project-123`.", + "required": true, + "pattern": "^projects/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/{+projectName}/events", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + } + } + } + }, + "schemas": { + "ReportedErrorEvent": { + "description": "An error event which is reported to the Error Reporting system.", + "type": "object", + "properties": { + "serviceContext": { + "description": "[Required] The service context in which this error has occurred.", + "$ref": "ServiceContext" + }, + "context": { + "description": "[Optional] A description of the context in which the error occurred.", + "$ref": "ErrorContext" + }, + "eventTime": { + "description": "[Optional] Time when the event occurred.\nIf not provided, the time when the event was received by the\nError Reporting system will be used.", + "type": "string", + "format": "google-datetime" + }, + "message": { + "description": "[Required] A message describing the error. The message can contain an\nexception stack in one of the supported programming languages and formats.\nIn that case, the message is parsed and detailed exception information\nis returned when retrieving the error event again.", + "type": "string" + } + }, + "id": "ReportedErrorEvent" + }, + "SourceLocation": { + "description": "Indicates a location in the source code of the service for which\nerrors are reported.\nThis data should be provided by the application when reporting an error,\nunless the error report has been generated automatically from Google App\nEngine logs. All fields are optional.", + "type": "object", + "properties": { + "filePath": { + "description": "The source code filename, which can include a truncated relative\npath, or a full path from a production machine.", + "type": "string" + }, + "functionName": { + "description": "Human-readable name of a function or method.\nThe value can include optional context like the class or package name.\nFor example, `my.package.MyClass.method` in case of Java.", + "type": "string" + }, + "lineNumber": { + "description": "1-based. 0 indicates that the line number is unknown.", + "type": "integer", + "format": "int32" + } + }, + "id": "SourceLocation" + }, + "ErrorGroupStats": { + "description": "Data extracted for a specific group based on certain filter criteria,\nsuch as a given time period and/or service filter.", + "type": "object", + "properties": { + "representative": { + "description": "An arbitrary event that is chosen as representative for the whole group.\nThe representative event is intended to be used as a quick preview for\nthe whole group. Events in the group are usually sufficiently similar\nto each other such that showing an arbitrary representative provides\ninsight into the characteristics of the group as a whole.", + "$ref": "ErrorEvent" + }, + "numAffectedServices": { + "description": "The total number of services with a non-zero error count for the given\nfilter criteria.", + "type": "integer", + "format": "int32" + }, + "affectedUsersCount": { + "description": "Approximate number of affected users in the given group that\nmatch the filter criteria.\nUsers are distinguished by data in the `ErrorContext` of the\nindividual error events, such as their login name or their remote\nIP address in case of HTTP requests.\nThe number of affected users can be zero even if the number of\nerrors is non-zero if no data was provided from which the\naffected user could be deduced.\nUsers are counted based on data in the request\ncontext that was provided in the error report. If more users are\nimplicitly affected, such as due to a crash of the whole service,\nthis is not reflected here.", + "type": "string", + "format": "int64" + }, + "count": { + "description": "Approximate total number of events in the given group that match\nthe filter criteria.", + "type": "string", + "format": "int64" + }, + "firstSeenTime": { + "description": "Approximate first occurrence that was ever seen for this group\nand which matches the given filter criteria, ignoring the\ntime_range that was specified in the request.", + "type": "string", + "format": "google-datetime" + }, + "lastSeenTime": { + "description": "Approximate last occurrence that was ever seen for this group and\nwhich matches the given filter criteria, ignoring the time_range\nthat was specified in the request.", + "type": "string", + "format": "google-datetime" + }, + "group": { + "description": "Group data that is independent of the filter criteria.", + "$ref": "ErrorGroup" + }, + "affectedServices": { + "description": "Service contexts with a non-zero error count for the given filter\ncriteria. This list can be truncated if multiple services are affected.\nRefer to `num_affected_services` for the total count.", + "type": "array", + "items": { + "$ref": "ServiceContext" + } + }, + "timedCounts": { + "description": "Approximate number of occurrences over time.\nTimed counts returned by ListGroups are guaranteed to be:\n\n- Inside the requested time interval\n- Non-overlapping, and\n- Ordered by ascending time.", + "type": "array", + "items": { + "$ref": "TimedCount" + } + } + }, + "id": "ErrorGroupStats" + }, + "ErrorContext": { + "description": "A description of the context in which an error occurred.\nThis data should be provided by the application when reporting an error,\nunless the\nerror report has been generated automatically from Google App Engine logs.", + "type": "object", + "properties": { + "httpRequest": { + "description": "The HTTP request which was processed when the error was\ntriggered.", + "$ref": "HttpRequestContext" + }, + "reportLocation": { + "description": "The location in the source code where the decision was made to\nreport the error, usually the place where it was logged.\nFor a logged exception this would be the source line where the\nexception is logged, usually close to the place where it was\ncaught. This value is in contrast to `Exception.cause_location`,\nwhich describes the source line where the exception was thrown.", + "$ref": "SourceLocation" + }, + "user": { + "description": "The user who caused or was affected by the crash.\nThis can be a user ID, an email address, or an arbitrary token that\nuniquely identifies the user.\nWhen sending an error report, leave this field empty if the user was not\nlogged in. In this case the\nError Reporting system will use other data, such as remote IP address, to\ndistinguish affected users. See `affected_users_count` in\n`ErrorGroupStats`.", + "type": "string" + } + }, + "id": "ErrorContext" + }, + "ServiceContext": { + "description": "Describes a running service that sends errors.\nIts version changes over time and multiple versions can run in parallel.", + "type": "object", + "properties": { + "resourceType": { + "description": "Type of the MonitoredResource. List of possible values:\nhttps://cloud.google.com/monitoring/api/resources\n\nValue is set automatically for incoming errors and must not be set when\nreporting errors.", + "type": "string" + }, + "service": { + "description": "An identifier of the service, such as the name of the\nexecutable, job, or Google App Engine service name. This field is expected\nto have a low number of values that are relatively stable over time, as\nopposed to `version`, which can be changed whenever new code is deployed.\n\nContains the service name for error reports extracted from Google\nApp Engine logs or `default` if the App Engine default service is used.", + "type": "string" + }, + "version": { + "description": "Represents the source code version that the developer provided,\nwhich could represent a version label or a Git SHA-1 hash, for example.", + "type": "string" + } + }, + "id": "ServiceContext" + }, + "ErrorGroup": { + "description": "Description of a group of similar error events.", + "type": "object", + "properties": { + "groupId": { + "description": "Group IDs are unique for a given project. If the same kind of error\noccurs in different service contexts, it will receive the same group ID.", + "type": "string" + }, + "name": { + "description": "The group resource name.\nExample: \u003ccode\u003eprojects/my-project-123/groups/my-groupid\u003c/code\u003e", + "type": "string" + }, + "trackingIssues": { + "description": "Associated tracking issues.", + "type": "array", + "items": { + "$ref": "TrackingIssue" + } + } + }, + "id": "ErrorGroup" + }, + "ReportErrorEventResponse": { + "description": "Response for reporting an individual error event.\nData may be added to this message in the future.", + "type": "object", + "properties": {}, + "id": "ReportErrorEventResponse" + }, + "TrackingIssue": { + "description": "Information related to tracking the progress on resolving the error.", + "type": "object", + "properties": { + "url": { + "description": "A URL pointing to a related entry in an issue tracking system.\nExample: https://github.com/user/project/issues/4", + "type": "string" + } + }, + "id": "TrackingIssue" + }, + "DeleteEventsResponse": { + "description": "Response message for deleting error events.", + "type": "object", + "properties": {}, + "id": "DeleteEventsResponse" + }, + "ErrorEvent": { + "description": "An error event which is returned by the Error Reporting system.", + "type": "object", + "properties": { + "serviceContext": { + "description": "The `ServiceContext` for which this error was reported.", + "$ref": "ServiceContext" + }, + "context": { + "description": "Data about the context in which the error occurred.", + "$ref": "ErrorContext" + }, + "eventTime": { + "description": "Time when the event occurred as provided in the error report.\nIf the report did not contain a timestamp, the time the error was received\nby the Error Reporting system is used.", + "type": "string", + "format": "google-datetime" + }, + "message": { + "description": "The stack trace that was reported or logged by the service.", + "type": "string" + } + }, + "id": "ErrorEvent" + }, + "ListEventsResponse": { + "description": "Contains a set of requested error events.", + "type": "object", + "properties": { + "nextPageToken": { + "description": "If non-empty, more results are available.\nPass this token, along with the same query parameters as the first\nrequest, to view the next page of results.", + "type": "string" + }, + "timeRangeBegin": { + "description": "The timestamp specifies the start time to which the request was restricted.", + "type": "string", + "format": "google-datetime" + }, + "errorEvents": { + "description": "The error events which match the given request.", + "type": "array", + "items": { + "$ref": "ErrorEvent" + } + } + }, + "id": "ListEventsResponse" + }, + "TimedCount": { + "description": "The number of errors in a given time period.\nAll numbers are approximate since the error events are sampled\nbefore counting them.", + "type": "object", + "properties": { + "startTime": { + "description": "Start of the time period to which `count` refers (included).", + "type": "string", + "format": "google-datetime" + }, + "endTime": { + "description": "End of the time period to which `count` refers (excluded).", + "type": "string", + "format": "google-datetime" + }, + "count": { + "description": "Approximate number of occurrences in the given time period.", + "type": "string", + "format": "int64" + } + }, + "id": "TimedCount" + }, + "HttpRequestContext": { + "description": "HTTP request data that is related to a reported error.\nThis data should be provided by the application when reporting an error,\nunless the\nerror report has been generated automatically from Google App Engine logs.", + "type": "object", + "properties": { + "method": { + "description": "The type of HTTP request, such as `GET`, `POST`, etc.", + "type": "string" + }, + "responseStatusCode": { + "description": "The HTTP response status code for the request.", + "type": "integer", + "format": "int32" + }, + "remoteIp": { + "description": "The IP address from which the request originated.\nThis can be IPv4, IPv6, or a token which is derived from the\nIP address, depending on the data that has been provided\nin the error report.", + "type": "string" + }, + "url": { + "description": "The URL of the request.", + "type": "string" + }, + "referrer": { + "description": "The referrer information that is provided with the request.", + "type": "string" + }, + "userAgent": { + "description": "The user agent information that is provided with the request.", + "type": "string" + } + }, + "id": "HttpRequestContext" + }, + "ListGroupStatsResponse": { + "description": "Contains a set of requested error group stats.", + "type": "object", + "properties": { + "nextPageToken": { + "description": "If non-empty, more results are available.\nPass this token, along with the same query parameters as the first\nrequest, to view the next page of results.", + "type": "string" + }, + "timeRangeBegin": { + "description": "The timestamp specifies the start time to which the request was restricted.\nThe start time is set based on the requested time range. It may be adjusted\nto a later time if a project has exceeded the storage quota and older data\nhas been deleted.", + "type": "string", + "format": "google-datetime" + }, + "errorGroupStats": { + "description": "The error group stats which match the given request.", + "type": "array", + "items": { + "$ref": "ErrorGroupStats" + } + } + }, + "id": "ListGroupStatsResponse" + } + }, + "revision": "20161114", + "basePath": "", + "icons": { + "x32": "http://www.google.com/images/icons/product/search-32.gif", + "x16": "http://www.google.com/images/icons/product/search-16.gif" + }, + "version_module": "True", + "canonicalName": "Clouderrorreporting", + "discoveryVersion": "v1", + "baseUrl": "https://clouderrorreporting.googleapis.com/", + "name": "clouderrorreporting", + "parameters": { + "access_token": { + "description": "OAuth access token.", + "type": "string", + "location": "query" + }, + "prettyPrint": { + "description": "Returns response with indentations and line breaks.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "key": { + "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", + "type": "string", + "location": "query" + }, + "quotaUser": { + "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.", + "type": "string", + "location": "query" + }, + "pp": { + "description": "Pretty-print response.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "fields": { + "description": "Selector specifying which fields to include in a partial response.", + "type": "string", + "location": "query" + }, + "alt": { + "description": "Data format for response.", + "location": "query", + "enum": [ + "json", + "media", + "proto" + ], + "default": "json", + "enumDescriptions": [ + "Responses with Content-Type of application/json", + "Media download with context-dependent Content-Type", + "Responses with Content-Type of application/x-protobuf" + ], + "type": "string" + }, + "$.xgafv": { + "description": "V1 error format.", + "enum": [ + "1", + "2" + ], + "enumDescriptions": [ + "v1 error format", + "v2 error format" + ], + "type": "string", + "location": "query" + }, + "callback": { + "description": "JSONP", + "type": "string", + "location": "query" + }, + "oauth_token": { + "description": "OAuth 2.0 token for the current user.", + "type": "string", + "location": "query" + }, + "uploadType": { + "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").", + "type": "string", + "location": "query" + }, + "bearer_token": { + "description": "OAuth bearer token.", + "type": "string", + "location": "query" + }, + "upload_protocol": { + "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").", + "type": "string", + "location": "query" + } + }, + "documentationLink": "https://cloud.google.com/error-reporting/", + "ownerDomain": "google.com", + "batchPath": "batch", + "servicePath": "", + "ownerName": "Google", + "version": "v1beta1", + "rootUrl": "https://clouderrorreporting.googleapis.com/", + "kind": "discovery#restDescription" +} diff --git a/etc/api/cloudmonitoring/v2beta2/cloudmonitoring-api.json b/etc/api/cloudmonitoring/v2beta2/cloudmonitoring-api.json index eda83c77b4..de89983988 100644 --- a/etc/api/cloudmonitoring/v2beta2/cloudmonitoring-api.json +++ b/etc/api/cloudmonitoring/v2beta2/cloudmonitoring-api.json @@ -1,19 +1,19 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/8gt81fb3PlHUWsNgH1AXPodtr_c\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/mLggzdz9EvP0lVEQoxoRvdSJShg\"", "discoveryVersion": "v1", "id": "cloudmonitoring:v2beta2", "name": "cloudmonitoring", "canonicalName": "Cloud Monitoring", "version": "v2beta2", - "revision": "20160718", + "revision": "20161031", "title": "Cloud Monitoring API", "description": "Accesses Google Cloud Monitoring data.", "ownerDomain": "google.com", "ownerName": "Google", "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" }, "documentationLink": "https://cloud.google.com/monitoring/v2beta2/", "protocol": "rest", diff --git a/etc/api/cloudresourcemanager/v1/cloudresourcemanager-api.json b/etc/api/cloudresourcemanager/v1/cloudresourcemanager-api.json index ce4b92afc4..241fc5ed8d 100644 --- a/etc/api/cloudresourcemanager/v1/cloudresourcemanager-api.json +++ b/etc/api/cloudresourcemanager/v1/cloudresourcemanager-api.json @@ -1,599 +1,1012 @@ { - "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/KvNq14l55QtltcB7NZiPRgJYtsY\"", - "discoveryVersion": "v1", - "id": "cloudresourcemanager:v1", - "name": "cloudresourcemanager", - "canonicalName": "Cloud Resource Manager", - "version": "v1", - "revision": "20160617", - "title": "Google Cloud Resource Manager API", - "description": "The Google Cloud Resource Manager API provides methods for creating, reading, and updating project metadata.", - "ownerDomain": "google.com", - "ownerName": "Google", - "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" - }, - "documentationLink": "https://cloud.google.com/resource-manager", - "protocol": "rest", - "baseUrl": "https://cloudresourcemanager.googleapis.com/", - "basePath": "", - "rootUrl": "https://cloudresourcemanager.googleapis.com/", - "servicePath": "", - "batchPath": "batch", - "parameters": { - "access_token": { - "type": "string", - "description": "OAuth access token.", - "location": "query" - }, - "alt": { - "type": "string", - "description": "Data format for response.", - "default": "json", - "enumDescriptions": [ - "Responses with Content-Type of application/json", - "Media download with context-dependent Content-Type", - "Responses with Content-Type of application/x-protobuf" - ], - "location": "query" - }, - "bearer_token": { - "type": "string", - "description": "OAuth bearer token.", - "location": "query" - }, - "callback": { - "type": "string", - "description": "JSONP", - "location": "query" - }, - "fields": { - "type": "string", - "description": "Selector specifying which fields to include in a partial response.", - "location": "query" - }, - "key": { - "type": "string", - "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", - "location": "query" - }, - "oauth_token": { - "type": "string", - "description": "OAuth 2.0 token for the current user.", - "location": "query" - }, - "pp": { - "type": "boolean", - "description": "Pretty-print response.", - "default": "true", - "location": "query" - }, - "prettyPrint": { - "type": "boolean", - "description": "Returns response with indentations and line breaks.", - "default": "true", - "location": "query" - }, - "quotaUser": { - "type": "string", - "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.", - "location": "query" - }, - "upload_protocol": { - "type": "string", - "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").", - "location": "query" - }, - "uploadType": { - "type": "string", - "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").", - "location": "query" - }, - "$.xgafv": { - "type": "string", - "description": "V1 error format.", - "enumDescriptions": [ - "v1 error format", - "v2 error format" - ], - "location": "query" - } - }, - "auth": { - "oauth2": { - "scopes": { - "https://www.googleapis.com/auth/cloud-platform": { - "description": "View and manage your data across Google Cloud Platform services" - }, - "https://www.googleapis.com/auth/cloud-platform.read-only": { - "description": "View your data across Google Cloud Platform services" + "id": "cloudresourcemanager:v1", + "auth": { + "oauth2": { + "scopes": { + "https://www.googleapis.com/auth/cloud-platform": { + "description": "View and manage your data across Google Cloud Platform services" + }, + "https://www.googleapis.com/auth/cloud-platform.read-only": { + "description": "View your data across Google Cloud Platform services" + } + } } - } - } - }, - "schemas": { - "Project": { - "id": "Project", - "type": "object", - "description": "A Project is a high-level Google Cloud Platform entity. It is a container for ACLs, APIs, AppEngine Apps, VMs, and other Google Cloud Platform resources.", - "properties": { - "projectNumber": { - "type": "string", - "description": "The number uniquely identifying the project. Example: 415104041262 Read-only.", - "format": "int64" - }, - "projectId": { - "type": "string", - "description": "The unique, user-assigned ID of the Project. It must be 6 to 30 lowercase letters, digits, or hyphens. It must start with a letter. Trailing hyphens are prohibited. Example: tokyo-rain-123 Read-only after creation." - }, - "lifecycleState": { - "type": "string", - "description": "The Project lifecycle state. Read-only.", - "enum": [ - "LIFECYCLE_STATE_UNSPECIFIED", - "ACTIVE", - "DELETE_REQUESTED", - "DELETE_IN_PROGRESS" - ] - }, - "name": { - "type": "string", - "description": "The user-assigned display name of the Project. It must be 4 to 30 characters. Allowed characters are: lowercase and uppercase letters, numbers, hyphen, single-quote, double-quote, space, and exclamation point. Example: My Project Read-write." - }, - "createTime": { - "type": "string", - "description": "Creation time. Read-only." - }, - "labels": { - "type": "object", - "description": "The labels associated with this Project. Label keys must be between 1 and 63 characters long and must conform to the following regular expression: \\[a-z\\](\\[-a-z0-9\\]*\\[a-z0-9\\])?. Label values must be between 0 and 63 characters long and must conform to the regular expression (\\[a-z\\](\\[-a-z0-9\\]*\\[a-z0-9\\])?)?. No more than 256 labels can be associated with a given resource. Clients should store labels in a representation such as JSON that does not depend on specific characters being disallowed. Example: \"environment\" : \"dev\" Read-write.", - "additionalProperties": { - "type": "string" - } - }, - "parent": { - "$ref": "ResourceId", - "description": "An optional reference to a parent Resource. The only supported parent type is \"organization\". Once set, the parent cannot be modified. Read-write." - } - } }, - "ResourceId": { - "id": "ResourceId", - "type": "object", - "description": "A container to reference an id for any resource type. A `resource` in Google Cloud Platform is a generic term for something you (a developer) may want to interact with through one of our API's. Some examples are an AppEngine app, a Compute Engine instance, a Cloud SQL database, and so on.", - "properties": { - "type": { - "type": "string", - "description": "Required field representing the resource type this id is for. At present, the only valid type is \"organization\"." + "description": "The Google Cloud Resource Manager API provides methods for creating, reading, and updating project metadata.", + "protocol": "rest", + "title": "Google Cloud Resource Manager API", + "resources": { + "organizations": { + "methods": { + "get": { + "id": "cloudresourcemanager.organizations.get", + "response": { + "$ref": "Organization" + }, + "parameterOrder": [ + "name" + ], + "description": "Fetches an Organization resource identified by the specified resource name.", + "flatPath": "v1/organizations/{organizationsId}", + "httpMethod": "GET", + "parameters": { + "name": { + "description": "The resource name of the Organization to fetch, e.g. \"organizations/1234\".", + "required": true, + "pattern": "^organizations/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1/{+name}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" + ] + }, + "testIamPermissions": { + "id": "cloudresourcemanager.organizations.testIamPermissions", + "response": { + "$ref": "TestIamPermissionsResponse" + }, + "parameterOrder": [ + "resource" + ], + "description": "Returns permissions that a caller has on the specified Organization.\nThe `resource` field should be the organization's resource name,\ne.g. \"organizations/123\".", + "request": { + "$ref": "TestIamPermissionsRequest" + }, + "flatPath": "v1/organizations/{organizationsId}:testIamPermissions", + "httpMethod": "POST", + "parameters": { + "resource": { + "description": "REQUIRED: The resource for which the policy detail is being requested.\n`resource` is usually specified as a path. For example, a Project\nresource is specified as `projects/{project}`.", + "required": true, + "pattern": "^organizations/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1/{+resource}:testIamPermissions", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" + ] + }, + "search": { + "id": "cloudresourcemanager.organizations.search", + "response": { + "$ref": "SearchOrganizationsResponse" + }, + "parameterOrder": [], + "description": "Searches Organization resources that are visible to the user and satisfy\nthe specified filter. This method returns Organizations in an unspecified\norder. New Organizations do not necessarily appear at the end of the\nresults.", + "request": { + "$ref": "SearchOrganizationsRequest" + }, + "flatPath": "v1/organizations:search", + "httpMethod": "POST", + "parameters": {}, + "path": "v1/organizations:search", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" + ] + }, + "setIamPolicy": { + "id": "cloudresourcemanager.organizations.setIamPolicy", + "response": { + "$ref": "Policy" + }, + "parameterOrder": [ + "resource" + ], + "description": "Sets the access control policy on an Organization resource. Replaces any\nexisting policy. The `resource` field should be the organization's resource\nname, e.g. \"organizations/123\".", + "request": { + "$ref": "SetIamPolicyRequest" + }, + "flatPath": "v1/organizations/{organizationsId}:setIamPolicy", + "httpMethod": "POST", + "parameters": { + "resource": { + "description": "REQUIRED: The resource for which the policy is being specified.\n`resource` is usually specified as a path. For example, a Project\nresource is specified as `projects/{project}`.", + "required": true, + "pattern": "^organizations/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1/{+resource}:setIamPolicy", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "getIamPolicy": { + "id": "cloudresourcemanager.organizations.getIamPolicy", + "response": { + "$ref": "Policy" + }, + "parameterOrder": [ + "resource" + ], + "description": "Gets the access control policy for an Organization resource. May be empty\nif no such policy or resource exists. The `resource` field should be the\norganization's resource name, e.g. \"organizations/123\".", + "request": { + "$ref": "GetIamPolicyRequest" + }, + "flatPath": "v1/organizations/{organizationsId}:getIamPolicy", + "httpMethod": "POST", + "parameters": { + "resource": { + "description": "REQUIRED: The resource for which the policy is being requested.\n`resource` is usually specified as a path. For example, a Project\nresource is specified as `projects/{project}`.", + "required": true, + "pattern": "^organizations/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1/{+resource}:getIamPolicy", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" + ] + } + } }, - "id": { - "type": "string", - "description": "Required field for the type-specific id. This should correspond to the id used in the type-specific API's." - } - } - }, - "ListProjectsResponse": { - "id": "ListProjectsResponse", - "type": "object", - "description": "A page of the response received from the ListProjects method. A paginated response where more pages are available has `next_page_token` set. This token can be used in a subsequent request to retrieve the next request page.", - "properties": { "projects": { - "type": "array", - "description": "The list of Projects that matched the list filter. This list can be paginated.", - "items": { - "$ref": "Project" - } + "methods": { + "getAncestry": { + "id": "cloudresourcemanager.projects.getAncestry", + "response": { + "$ref": "GetAncestryResponse" + }, + "parameterOrder": [ + "projectId" + ], + "description": "Gets a list of ancestors in the resource hierarchy for the Project\nidentified by the specified `project_id` (for example, `my-project-123`).\n\nThe caller must have read permissions for this Project.", + "request": { + "$ref": "GetAncestryRequest" + }, + "flatPath": "v1/projects/{projectId}:getAncestry", + "httpMethod": "POST", + "parameters": { + "projectId": { + "description": "The Project ID (for example, `my-project-123`).\n\nRequired.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1/projects/{projectId}:getAncestry", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" + ] + }, + "getIamPolicy": { + "id": "cloudresourcemanager.projects.getIamPolicy", + "response": { + "$ref": "Policy" + }, + "parameterOrder": [ + "resource" + ], + "description": "Returns the IAM access control policy for the specified Project.\nPermission is denied if the policy or the resource does not exist.", + "request": { + "$ref": "GetIamPolicyRequest" + }, + "flatPath": "v1/projects/{resource}:getIamPolicy", + "httpMethod": "POST", + "parameters": { + "resource": { + "description": "REQUIRED: The resource for which the policy is being requested.\n`resource` is usually specified as a path. For example, a Project\nresource is specified as `projects/{project}`.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1/projects/{resource}:getIamPolicy", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" + ] + }, + "undelete": { + "id": "cloudresourcemanager.projects.undelete", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "projectId" + ], + "description": "Restores the Project identified by the specified\n`project_id` (for example, `my-project-123`).\nYou can only use this method for a Project that has a lifecycle state of\nDELETE_REQUESTED.\nAfter deletion starts, the Project cannot be restored.\n\nThe caller must have modify permissions for this Project.", + "request": { + "$ref": "UndeleteProjectRequest" + }, + "flatPath": "v1/projects/{projectId}:undelete", + "httpMethod": "POST", + "parameters": { + "projectId": { + "description": "The project ID (for example, `foo-bar-123`).\n\nRequired.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1/projects/{projectId}:undelete", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "list": { + "id": "cloudresourcemanager.projects.list", + "response": { + "$ref": "ListProjectsResponse" + }, + "parameterOrder": [], + "description": "Lists Projects that are visible to the user and satisfy the\nspecified filter. This method returns Projects in an unspecified order.\nNew Projects do not necessarily appear at the end of the list.", + "flatPath": "v1/projects", + "httpMethod": "GET", + "parameters": { + "pageSize": { + "description": "The maximum number of Projects to return in the response.\nThe server can return fewer Projects than requested.\nIf unspecified, server picks an appropriate default.\n\nOptional.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "filter": { + "description": "An expression for filtering the results of the request. Filter rules are\ncase insensitive. The fields eligible for filtering are:\n\n+ `name`\n+ `id`\n+ \u003ccode\u003elabels.\u003cem\u003ekey\u003c/em\u003e\u003c/code\u003e where *key* is the name of a label\n\nSome examples of using labels as filters:\n\n|Filter|Description|\n|------|-----------|\n|name:*|The project has a name.|\n|name:Howl|The project's name is `Howl` or `howl`.|\n|name:HOWL|Equivalent to above.|\n|NAME:howl|Equivalent to above.|\n|labels.color:*|The project has the label `color`.|\n|labels.color:red|The project's label `color` has the value `red`.|\n|labels.color:red label.size:big|The project's label `color` has the\nvalue `red` and its label `size` has the value `big`.\n\nOptional.", + "location": "query", + "type": "string" + }, + "pageToken": { + "description": "A pagination token returned from a previous call to ListProjects\nthat indicates from where listing should continue.\n\nOptional.", + "location": "query", + "type": "string" + } + }, + "path": "v1/projects", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" + ] + }, + "get": { + "id": "cloudresourcemanager.projects.get", + "response": { + "$ref": "Project" + }, + "parameterOrder": [ + "projectId" + ], + "description": "Retrieves the Project identified by the specified\n`project_id` (for example, `my-project-123`).\n\nThe caller must have read permissions for this Project.", + "flatPath": "v1/projects/{projectId}", + "httpMethod": "GET", + "parameters": { + "projectId": { + "description": "The Project ID (for example, `my-project-123`).\n\nRequired.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1/projects/{projectId}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" + ] + }, + "update": { + "id": "cloudresourcemanager.projects.update", + "response": { + "$ref": "Project" + }, + "parameterOrder": [ + "projectId" + ], + "description": "Updates the attributes of the Project identified by the specified\n`project_id` (for example, `my-project-123`).\n\nThe caller must have modify permissions for this Project.", + "request": { + "$ref": "Project" + }, + "flatPath": "v1/projects/{projectId}", + "httpMethod": "PUT", + "parameters": { + "projectId": { + "description": "The project ID (for example, `my-project-123`).\n\nRequired.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1/projects/{projectId}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "create": { + "id": "cloudresourcemanager.projects.create", + "response": { + "$ref": "Operation" + }, + "parameterOrder": [], + "description": "Request that a new Project be created. The result is an Operation which\ncan be used to track the creation process. It is automatically deleted\nafter a few hours, so there is no need to call DeleteOperation.\n\nOur SLO permits Project creation to take up to 30 seconds at the 90th\npercentile. As of 2016-08-29, we are observing 6 seconds 50th percentile\nlatency. 95th percentile latency is around 11 seconds. We recommend\npolling at the 5th second with an exponential backoff.", + "request": { + "$ref": "Project" + }, + "flatPath": "v1/projects", + "httpMethod": "POST", + "parameters": {}, + "path": "v1/projects", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "setIamPolicy": { + "id": "cloudresourcemanager.projects.setIamPolicy", + "response": { + "$ref": "Policy" + }, + "parameterOrder": [ + "resource" + ], + "description": "Sets the IAM access control policy for the specified Project. Replaces\nany existing policy.\n\nThe following constraints apply when using `setIamPolicy()`:\n\n+ Project does not support `allUsers` and `allAuthenticatedUsers` as\n`members` in a `Binding` of a `Policy`.\n\n+ The owner role can be granted only to `user` and `serviceAccount`.\n\n+ Service accounts can be made owners of a project directly\nwithout any restrictions. However, to be added as an owner, a user must be\ninvited via Cloud Platform console and must accept the invitation.\n\n+ A user cannot be granted the owner role using `setIamPolicy()`. The user\nmust be granted the owner role using the Cloud Platform Console and must\nexplicitly accept the invitation.\n\n+ Invitations to grant the owner role cannot be sent using\n`setIamPolicy()`;\nthey must be sent only using the Cloud Platform Console.\n\n+ Membership changes that leave the project without any owners that have\naccepted the Terms of Service (ToS) will be rejected.\n\n+ There must be at least one owner who has accepted the Terms of\nService (ToS) agreement in the policy. Calling `setIamPolicy()` to\nto remove the last ToS-accepted owner from the policy will fail. This\nrestriction also applies to legacy projects that no longer have owners\nwho have accepted the ToS. Edits to IAM policies will be rejected until\nthe lack of a ToS-accepting owner is rectified.\n\n+ Calling this method requires enabling the App Engine Admin API.\n\nNote: Removing service accounts from policies or changing their roles\ncan render services completely inoperable. It is important to understand\nhow the service account is being used before removing or updating its\nroles.", + "request": { + "$ref": "SetIamPolicyRequest" + }, + "flatPath": "v1/projects/{resource}:setIamPolicy", + "httpMethod": "POST", + "parameters": { + "resource": { + "description": "REQUIRED: The resource for which the policy is being specified.\n`resource` is usually specified as a path. For example, a Project\nresource is specified as `projects/{project}`.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1/projects/{resource}:setIamPolicy", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "delete": { + "id": "cloudresourcemanager.projects.delete", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "projectId" + ], + "description": "Marks the Project identified by the specified\n`project_id` (for example, `my-project-123`) for deletion.\nThis method will only affect the Project if the following criteria are met:\n\n+ The Project does not have a billing account associated with it.\n+ The Project has a lifecycle state of\nACTIVE.\n\nThis method changes the Project's lifecycle state from\nACTIVE\nto DELETE_REQUESTED.\nThe deletion starts at an unspecified time,\nat which point the Project is no longer accessible.\n\nUntil the deletion completes, you can check the lifecycle state\nchecked by retrieving the Project with GetProject,\nand the Project remains visible to ListProjects.\nHowever, you cannot update the project.\n\nAfter the deletion completes, the Project is not retrievable by\nthe GetProject and\nListProjects methods.\n\nThe caller must have modify permissions for this Project.", + "flatPath": "v1/projects/{projectId}", + "httpMethod": "DELETE", + "parameters": { + "projectId": { + "description": "The Project ID (for example, `foo-bar-123`).\n\nRequired.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1/projects/{projectId}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "testIamPermissions": { + "id": "cloudresourcemanager.projects.testIamPermissions", + "response": { + "$ref": "TestIamPermissionsResponse" + }, + "parameterOrder": [ + "resource" + ], + "description": "Returns permissions that a caller has on the specified Project.", + "request": { + "$ref": "TestIamPermissionsRequest" + }, + "flatPath": "v1/projects/{resource}:testIamPermissions", + "httpMethod": "POST", + "parameters": { + "resource": { + "description": "REQUIRED: The resource for which the policy detail is being requested.\n`resource` is usually specified as a path. For example, a Project\nresource is specified as `projects/{project}`.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1/projects/{resource}:testIamPermissions", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" + ] + } + } }, - "nextPageToken": { - "type": "string", - "description": "Pagination token. If the result set is too large to fit in a single response, this token is returned. It encodes the position of the current result cursor. Feeding this value into a new list request with the `page_token` parameter gives the next page of the results. When `next_page_token` is not filled in, there is no next page and the list returned is the last page in the result set. Pagination tokens have a limited lifetime." + "operations": { + "methods": { + "get": { + "id": "cloudresourcemanager.operations.get", + "response": { + "$ref": "Operation" + }, + "parameterOrder": [ + "name" + ], + "description": "Gets the latest state of a long-running operation. Clients can use this\nmethod to poll the operation result at intervals as recommended by the API\nservice.", + "flatPath": "v1/operations/{operationsId}", + "httpMethod": "GET", + "parameters": { + "name": { + "description": "The name of the operation resource.", + "required": true, + "pattern": "^operations/.+$", + "location": "path", + "type": "string" + } + }, + "path": "v1/{+name}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" + ] + } + } } - } }, - "Empty": { - "id": "Empty", - "type": "object", - "description": "A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON representation for `Empty` is empty JSON object `{}`." - }, - "UndeleteProjectRequest": { - "id": "UndeleteProjectRequest", - "type": "object", - "description": "The request sent to the UndeleteProject method." - }, - "GetIamPolicyRequest": { - "id": "GetIamPolicyRequest", - "type": "object", - "description": "Request message for `GetIamPolicy` method." - }, - "Policy": { - "id": "Policy", - "type": "object", - "description": "Defines an Identity and Access Management (IAM) policy. It is used to specify access control policies for Cloud Platform resources. A `Policy` consists of a list of `bindings`. A `Binding` binds a list of `members` to a `role`, where the members can be user accounts, Google groups, Google domains, and service accounts. A `role` is a named list of permissions defined by IAM. **Example** { \"bindings\": [ { \"role\": \"roles/owner\", \"members\": [ \"user:mike@example.com\", \"group:admins@example.com\", \"domain:google.com\", \"serviceAccount:my-other-app@appspot.gserviceaccount.com\", ] }, { \"role\": \"roles/viewer\", \"members\": [\"user:sean@example.com\"] } ] } For a description of IAM and its features, see the [IAM developer's guide](https://cloud.google.com/iam).", - "properties": { - "version": { - "type": "integer", - "description": "Version of the `Policy`. The default version is 0.", - "format": "int32" - }, - "bindings": { - "type": "array", - "description": "Associates a list of `members` to a `role`. Multiple `bindings` must not be specified for the same `role`. `bindings` with no members will result in an error.", - "items": { - "$ref": "Binding" - } - }, - "etag": { - "type": "string", - "description": "`etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other. It is strongly suggested that systems make use of the `etag` in the read-modify-write cycle to perform policy updates in order to avoid race conditions: An `etag` is returned in the response to `getIamPolicy`, and systems are expected to put that etag in the request to `setIamPolicy` to ensure that their change will be applied to the same version of the policy. If no `etag` is provided in the call to `setIamPolicy`, then the existing policy is overwritten blindly.", - "format": "byte" - } - } - }, - "Binding": { - "id": "Binding", - "type": "object", - "description": "Associates `members` with a `role`.", - "properties": { - "role": { - "type": "string", - "description": "Role that is assigned to `members`. For example, `roles/viewer`, `roles/editor`, or `roles/owner`. Required" - }, - "members": { - "type": "array", - "description": "Specifies the identities requesting access for a Cloud Platform resource. `members` can have the following values: * `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account. * `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account. * `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@gmail.com` or `joe@example.com`. * `serviceAccount:{emailid}`: An email address that represents a service account. For example, `my-other-app@appspot.gserviceaccount.com`. * `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`. * `domain:{domain}`: A Google Apps domain name that represents all the users of that domain. For example, `google.com` or `example.com`.", - "items": { - "type": "string" - } - } - } - }, - "SetIamPolicyRequest": { - "id": "SetIamPolicyRequest", - "type": "object", - "description": "Request message for `SetIamPolicy` method.", - "properties": { - "policy": { - "$ref": "Policy", - "description": "REQUIRED: The complete policy to be applied to the `resource`. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them." - } - } - }, - "TestIamPermissionsRequest": { - "id": "TestIamPermissionsRequest", - "type": "object", - "description": "Request message for `TestIamPermissions` method.", - "properties": { - "permissions": { - "type": "array", - "description": "The set of permissions to check for the `resource`. Permissions with wildcards (such as '*' or 'storage.*') are not allowed. For more information see IAM Overview.", - "items": { - "type": "string" - } - } - } - }, - "TestIamPermissionsResponse": { - "id": "TestIamPermissionsResponse", - "type": "object", - "description": "Response message for `TestIamPermissions` method.", - "properties": { - "permissions": { - "type": "array", - "description": "A subset of `TestPermissionsRequest.permissions` that the caller is allowed.", - "items": { - "type": "string" - } - } - } - }, - "Operation": { - "id": "Operation", - "type": "object", - "description": "This resource represents a long-running operation that is the result of a network API call.", - "properties": { - "name": { - "type": "string", - "description": "The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should have the format of `operations/some/unique/name`." - }, - "metadata": { - "type": "object", - "description": "Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.", - "additionalProperties": { - "type": "any", - "description": "Properties of the object. Contains field @ype with type URL." - } - }, - "done": { - "type": "boolean", - "description": "If the value is `false`, it means the operation is still in progress. If true, the operation is completed, and either `error` or `response` is available." - }, - "error": { - "$ref": "Status", - "description": "The error result of the operation in case of failure." - }, - "response": { - "type": "object", - "description": "The normal response of the operation in case of success. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.", - "additionalProperties": { - "type": "any", - "description": "Properties of the object. Contains field @ype with type URL." - } - } - } - }, - "Status": { - "id": "Status", - "type": "object", - "description": "The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). The error model is designed to be: - Simple to use and understand for most users - Flexible enough to meet unexpected needs # Overview The `Status` message contains three pieces of data: error code, error message, and error details. The error code should be an enum value of google.rpc.Code, but it may accept additional error codes if needed. The error message should be a developer-facing English message that helps developers *understand* and *resolve* the error. If a localized user-facing error message is needed, put the localized message in the error details or localize it in the client. The optional error details may contain arbitrary information about the error. There is a predefined set of error detail types in the package `google.rpc` which can be used for common error conditions. # Language mapping The `Status` message is the logical representation of the error model, but it is not necessarily the actual wire format. When the `Status` message is exposed in different client libraries and different wire protocols, it can be mapped differently. For example, it will likely be mapped to some exceptions in Java, but more likely mapped to some error codes in C. # Other uses The error model and the `Status` message can be used in a variety of environments, either with or without APIs, to provide a consistent developer experience across different environments. Example uses of this error model include: - Partial errors. If a service needs to return partial errors to the client, it may embed the `Status` in the normal response to indicate the partial errors. - Workflow errors. A typical workflow has multiple steps. Each step may have a `Status` message for error reporting purpose. - Batch operations. If a client uses batch request and batch response, the `Status` message should be used directly inside batch response, one for each error sub-response. - Asynchronous operations. If an API call embeds asynchronous operation results in its response, the status of those operations should be represented directly using the `Status` message. - Logging. If some API errors are stored in logs, the message `Status` could be used directly after any stripping needed for security/privacy reasons.", - "properties": { - "code": { - "type": "integer", - "description": "The status code, which should be an enum value of google.rpc.Code.", - "format": "int32" - }, - "message": { - "type": "string", - "description": "A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client." - }, - "details": { - "type": "array", - "description": "A list of messages that carry the error details. There will be a common set of message types for APIs to use.", - "items": { + "schemas": { + "FolderOperationError": { + "description": "A classification of the Folder Operation error.", "type": "object", - "additionalProperties": { - "type": "any", - "description": "Properties of the object. Contains field @ype with type URL." - } - } - } - } - } - }, - "resources": { - "projects": { - "methods": { - "get": { - "id": "cloudresourcemanager.projects.get", - "path": "v1/projects/{projectId}", - "httpMethod": "GET", - "description": "Retrieves the Project identified by the specified `project_id` (for example, `my-project-123`). The caller must have read permissions for this Project.", - "parameters": { - "projectId": { - "type": "string", - "description": "The Project ID (for example, `my-project-123`). Required.", - "required": true, - "location": "path" - } - }, - "parameterOrder": [ - "projectId" - ], - "response": { - "$ref": "Project" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only" - ] - }, - "list": { - "id": "cloudresourcemanager.projects.list", - "path": "v1/projects", - "httpMethod": "GET", - "description": "Lists Projects that are visible to the user and satisfy the specified filter. This method returns Projects in an unspecified order. New Projects do not necessarily appear at the end of the list.", - "parameters": { - "pageToken": { - "type": "string", - "description": "A pagination token returned from a previous call to ListProjects that indicates from where listing should continue. Optional.", - "location": "query" + "properties": { + "errorMessageId": { + "description": "The type of operation error experienced.", + "enum": [ + "ERROR_TYPE_UNSPECIFIED", + "FOLDER_HEIGHT_VIOLATION", + "MAX_CHILD_FOLDERS_VIOLATION", + "FOLDER_NAME_UNIQUENESS_VIOLATION", + "RESOURCE_DELETED", + "PARENT_DELETED", + "CYCLE_INTRODUCED_ERROR", + "FOLDER_ALREADY_BEING_MOVED", + "FOLDER_TO_DELETE_NON_EMPTY" + ], + "enumDescriptions": [ + "The error type was unrecognized or unspecified.", + "The attempted action would violate the max folder depth constraint.", + "The attempted action would violate the max child folders constraint.", + "The attempted action would violate the locally-unique folder\ndisplay_name constraint.", + "The resource being moved has been deleted.", + "The resource a folder was being added to has been deleted.", + "The attempted action would introduce cycle in resource path.", + "The attempted action would move a folder that is already being moved.", + "The folder the caller is trying to delete contains active resources." + ], + "type": "string" + } }, - "pageSize": { - "type": "integer", - "description": "The maximum number of Projects to return in the response. The server can return fewer Projects than requested. If unspecified, server picks an appropriate default. Optional.", - "format": "int32", - "location": "query" + "id": "FolderOperationError" + }, + "Status": { + "description": "The `Status` type defines a logical error model that is suitable for different\nprogramming environments, including REST APIs and RPC APIs. It is used by\n[gRPC](https://github.com/grpc). The error model is designed to be:\n\n- Simple to use and understand for most users\n- Flexible enough to meet unexpected needs\n\n# Overview\n\nThe `Status` message contains three pieces of data: error code, error message,\nand error details. The error code should be an enum value of\ngoogle.rpc.Code, but it may accept additional error codes if needed. The\nerror message should be a developer-facing English message that helps\ndevelopers *understand* and *resolve* the error. If a localized user-facing\nerror message is needed, put the localized message in the error details or\nlocalize it in the client. The optional error details may contain arbitrary\ninformation about the error. There is a predefined set of error detail types\nin the package `google.rpc` which can be used for common error conditions.\n\n# Language mapping\n\nThe `Status` message is the logical representation of the error model, but it\nis not necessarily the actual wire format. When the `Status` message is\nexposed in different client libraries and different wire protocols, it can be\nmapped differently. For example, it will likely be mapped to some exceptions\nin Java, but more likely mapped to some error codes in C.\n\n# Other uses\n\nThe error model and the `Status` message can be used in a variety of\nenvironments, either with or without APIs, to provide a\nconsistent developer experience across different environments.\n\nExample uses of this error model include:\n\n- Partial errors. If a service needs to return partial errors to the client,\n it may embed the `Status` in the normal response to indicate the partial\n errors.\n\n- Workflow errors. A typical workflow has multiple steps. Each step may\n have a `Status` message for error reporting purpose.\n\n- Batch operations. If a client uses batch request and batch response, the\n `Status` message should be used directly inside batch response, one for\n each error sub-response.\n\n- Asynchronous operations. If an API call embeds asynchronous operation\n results in its response, the status of those operations should be\n represented directly using the `Status` message.\n\n- Logging. If some API errors are stored in logs, the message `Status` could\n be used directly after any stripping needed for security/privacy reasons.", + "type": "object", + "properties": { + "code": { + "description": "The status code, which should be an enum value of google.rpc.Code.", + "type": "integer", + "format": "int32" + }, + "details": { + "description": "A list of messages that carry the error details. There will be a\ncommon set of message types for APIs to use.", + "type": "array", + "items": { + "additionalProperties": { + "description": "Properties of the object. Contains field @type with type URL.", + "type": "any" + }, + "type": "object" + } + }, + "message": { + "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\ngoogle.rpc.Status.details field, or localized by the client.", + "type": "string" + } }, - "filter": { - "type": "string", - "description": "An expression for filtering the results of the request. Filter rules are case insensitive. The fields eligible for filtering are: + `name` + `id` + labels.key where *key* is the name of a label Some examples of using labels as filters: |Filter|Description| |------|-----------| |name:*|The project has a name.| |name:Howl|The project's name is `Howl` or `howl`.| |name:HOWL|Equivalent to above.| |NAME:howl|Equivalent to above.| |labels.color:*|The project has the label `color`.| |labels.color:red|The project's label `color` has the value `red`.| |labels.color:red label.size:big|The project's label `color` has the value `red` and its label `size` has the value `big`. Optional.", - "location": "query" - } - }, - "response": { - "$ref": "ListProjectsResponse" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only" - ] + "id": "Status" }, - "update": { - "id": "cloudresourcemanager.projects.update", - "path": "v1/projects/{projectId}", - "httpMethod": "PUT", - "description": "Updates the attributes of the Project identified by the specified `project_id` (for example, `my-project-123`). The caller must have modify permissions for this Project.", - "parameters": { - "projectId": { - "type": "string", - "description": "The project ID (for example, `my-project-123`). Required.", - "required": true, - "location": "path" - } - }, - "parameterOrder": [ - "projectId" - ], - "request": { - "$ref": "Project" - }, - "response": { - "$ref": "Project" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform" - ] + "ListProjectsResponse": { + "description": "A page of the response received from the\nListProjects\nmethod.\n\nA paginated response where more pages are available has\n`next_page_token` set. This token can be used in a subsequent request to\nretrieve the next request page.", + "type": "object", + "properties": { + "projects": { + "description": "The list of Projects that matched the list filter. This list can\nbe paginated.", + "type": "array", + "items": { + "$ref": "Project" + } + }, + "nextPageToken": { + "description": "Pagination token.\n\nIf the result set is too large to fit in a single response, this token\nis returned. It encodes the position of the current result cursor.\nFeeding this value into a new list request with the `page_token` parameter\ngives the next page of the results.\n\nWhen `next_page_token` is not filled in, there is no next page and\nthe list returned is the last page in the result set.\n\nPagination tokens have a limited lifetime.", + "type": "string" + } + }, + "id": "ListProjectsResponse" }, - "delete": { - "id": "cloudresourcemanager.projects.delete", - "path": "v1/projects/{projectId}", - "httpMethod": "DELETE", - "description": "Marks the Project identified by the specified `project_id` (for example, `my-project-123`) for deletion. This method will only affect the Project if the following criteria are met: + The Project does not have a billing account associated with it. + The Project has a lifecycle state of ACTIVE. This method changes the Project's lifecycle state from ACTIVE to DELETE_REQUESTED. The deletion starts at an unspecified time, at which point the Project is no longer accessible. Until the deletion completes, you can check the lifecycle state checked by retrieving the Project with GetProject, and the Project remains visible to ListProjects. However, you cannot update the project. After the deletion completes, the Project is not retrievable by the GetProject and ListProjects methods. The caller must have modify permissions for this Project.", - "parameters": { - "projectId": { - "type": "string", - "description": "The Project ID (for example, `foo-bar-123`). Required.", - "required": true, - "location": "path" - } - }, - "parameterOrder": [ - "projectId" - ], - "response": { - "$ref": "Empty" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform" - ] + "UndeleteProjectRequest": { + "description": "The request sent to the UndeleteProject\nmethod.", + "type": "object", + "properties": {}, + "id": "UndeleteProjectRequest" }, - "undelete": { - "id": "cloudresourcemanager.projects.undelete", - "path": "v1/projects/{projectId}:undelete", - "httpMethod": "POST", - "description": "Restores the Project identified by the specified `project_id` (for example, `my-project-123`). You can only use this method for a Project that has a lifecycle state of DELETE_REQUESTED. After deletion starts, the Project cannot be restored. The caller must have modify permissions for this Project.", - "parameters": { - "projectId": { - "type": "string", - "description": "The project ID (for example, `foo-bar-123`). Required.", - "required": true, - "location": "path" - } - }, - "parameterOrder": [ - "projectId" - ], - "request": { - "$ref": "UndeleteProjectRequest" - }, - "response": { - "$ref": "Empty" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform" - ] + "FolderOperation": { + "description": "Metadata describing a long running folder operation", + "type": "object", + "properties": { + "displayName": { + "description": "The display name of the folder.", + "type": "string" + }, + "sourceParent": { + "description": "The resource name of the folder's parent.\nOnly applicable when the operation_type is MOVE.", + "type": "string" + }, + "destinationParent": { + "description": "The resource name of the folder or organization we are either creating\nthe folder under or moving the folder to.", + "type": "string" + }, + "operationType": { + "description": "The type of this operation.", + "enum": [ + "OPERATION_TYPE_UNSPECIFIED", + "CREATE", + "MOVE" + ], + "enumDescriptions": [ + "Operation type not specified.", + "A create folder operation.", + "A move folder operation." + ], + "type": "string" + } + }, + "id": "FolderOperation" }, - "getIamPolicy": { - "id": "cloudresourcemanager.projects.getIamPolicy", - "path": "v1/projects/{resource}:getIamPolicy", - "httpMethod": "POST", - "description": "Returns the IAM access control policy for the specified Project. Permission is denied if the policy or the resource does not exist.", - "parameters": { - "resource": { - "type": "string", - "description": "REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation.", - "required": true, - "location": "path" - } - }, - "parameterOrder": [ - "resource" - ], - "request": { - "$ref": "GetIamPolicyRequest" - }, - "response": { - "$ref": "Policy" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only" - ] + "Operation": { + "description": "This resource represents a long-running operation that is the result of a\nnetwork API call.", + "type": "object", + "properties": { + "error": { + "description": "The error result of the operation in case of failure or cancellation.", + "$ref": "Status" + }, + "done": { + "description": "If the value is `false`, it means the operation is still in progress.\nIf true, the operation is completed, and either `error` or `response` is\navailable.", + "type": "boolean" + }, + "metadata": { + "description": "Service-specific metadata associated with the operation. It typically\ncontains progress information and common metadata such as create time.\nSome services might not provide such metadata. Any method that returns a\nlong-running operation should document the metadata type, if any.", + "additionalProperties": { + "description": "Properties of the object. Contains field @type with type URL.", + "type": "any" + }, + "type": "object" + }, + "response": { + "description": "The normal response of the operation in case of success. If the original\nmethod returns no data on success, such as `Delete`, the response is\n`google.protobuf.Empty`. If the original method is standard\n`Get`/`Create`/`Update`, the response should be the resource. For other\nmethods, the response should have the type `XxxResponse`, where `Xxx`\nis the original method name. For example, if the original method name\nis `TakeSnapshot()`, the inferred response type is\n`TakeSnapshotResponse`.", + "additionalProperties": { + "description": "Properties of the object. Contains field @type with type URL.", + "type": "any" + }, + "type": "object" + }, + "name": { + "description": "The server-assigned name, which is only unique within the same service that\noriginally returns it. If you use the default HTTP mapping, the\n`name` should have the format of `operations/some/unique/name`.", + "type": "string" + } + }, + "id": "Operation" }, - "setIamPolicy": { - "id": "cloudresourcemanager.projects.setIamPolicy", - "path": "v1/projects/{resource}:setIamPolicy", - "httpMethod": "POST", - "description": "Sets the IAM access control policy for the specified Project. Replaces any existing policy. The following constraints apply when using `setIamPolicy()`: + Project does not support `allUsers` and `allAuthenticatedUsers` as `members` in a `Binding` of a `Policy`. + The owner role can be granted only to `user` and `serviceAccount`. + Service accounts can be made owners of a project directly without any restrictions. However, to be added as an owner, a user must be invited via Cloud Platform console and must accept the invitation. + A user cannot be granted the owner role using `setIamPolicy()`. The user must be granted the owner role using the Cloud Platform Console and must explicitly accept the invitation. + Invitations to grant the owner role cannot be sent using `setIamPolicy()`; they must be sent only using the Cloud Platform Console. + Membership changes that leave the project without any owners that have accepted the Terms of Service (ToS) will be rejected. + Members cannot be added to more than one role in the same policy. + There must be at least one owner who has accepted the Terms of Service (ToS) agreement in the policy. Calling `setIamPolicy()` to to remove the last ToS-accepted owner from the policy will fail. This restriction also applies to legacy projects that no longer have owners who have accepted the ToS. Edits to IAM policies will be rejected until the lack of a ToS-accepting owner is rectified. + Calling this method requires enabling the App Engine Admin API. Note: Removing service accounts from policies or changing their roles can render services completely inoperable. It is important to understand how the service account is being used before removing or updating its roles.", - "parameters": { - "resource": { - "type": "string", - "description": "REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `setIamPolicy` documentation.", - "required": true, - "location": "path" - } - }, - "parameterOrder": [ - "resource" - ], - "request": { - "$ref": "SetIamPolicyRequest" - }, - "response": { - "$ref": "Policy" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform" - ] + "GetIamPolicyRequest": { + "description": "Request message for `GetIamPolicy` method.", + "type": "object", + "properties": {}, + "id": "GetIamPolicyRequest" }, - "testIamPermissions": { - "id": "cloudresourcemanager.projects.testIamPermissions", - "path": "v1/projects/{resource}:testIamPermissions", - "httpMethod": "POST", - "description": "Returns permissions that a caller has on the specified Project.", - "parameters": { - "resource": { - "type": "string", - "description": "REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `testIamPermissions` documentation.", - "required": true, - "location": "path" - } - }, - "parameterOrder": [ - "resource" - ], - "request": { - "$ref": "TestIamPermissionsRequest" - }, - "response": { - "$ref": "TestIamPermissionsResponse" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only" - ] + "SetIamPolicyRequest": { + "description": "Request message for `SetIamPolicy` method.", + "type": "object", + "properties": { + "policy": { + "description": "REQUIRED: The complete policy to be applied to the `resource`. The size of\nthe policy is limited to a few 10s of KB. An empty policy is a\nvalid policy but certain Cloud Platform services (such as Projects)\nmight reject them.", + "$ref": "Policy" + } + }, + "id": "SetIamPolicyRequest" + }, + "TestIamPermissionsResponse": { + "description": "Response message for `TestIamPermissions` method.", + "type": "object", + "properties": { + "permissions": { + "description": "A subset of `TestPermissionsRequest.permissions` that the caller is\nallowed.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "id": "TestIamPermissionsResponse" + }, + "Organization": { + "description": "The root node in the resource hierarchy to which a particular entity's\n(e.g., company) resources belong.", + "type": "object", + "properties": { + "displayName": { + "description": "A friendly string to be used to refer to the Organization in the UI.\nAssigned by the server, set to the firm name of the Google For Work\ncustomer that owns this organization.\n@OutputOnly", + "type": "string" + }, + "creationTime": { + "description": "Timestamp when the Organization was created. Assigned by the server.\n@OutputOnly", + "type": "string", + "format": "google-datetime" + }, + "owner": { + "description": "The owner of this Organization. The owner should be specified on\ncreation. Once set, it cannot be changed.\nThis field is required.", + "$ref": "OrganizationOwner" + }, + "lifecycleState": { + "description": "The organization's current lifecycle state. Assigned by the server.\n@OutputOnly", + "enum": [ + "LIFECYCLE_STATE_UNSPECIFIED", + "ACTIVE", + "DELETE_REQUESTED" + ], + "enumDescriptions": [ + "Unspecified state. This is only useful for distinguishing unset values.", + "The normal and active state.", + "The organization has been marked for deletion by the user." + ], + "type": "string" + }, + "name": { + "description": "Output Only. The resource name of the organization. This is the\norganization's relative path in the API. Its format is\n\"organizations/[organization_id]\". For example, \"organizations/1234\".", + "type": "string" + } + }, + "id": "Organization" + }, + "Policy": { + "description": "Defines an Identity and Access Management (IAM) policy. It is used to\nspecify access control policies for Cloud Platform resources.\n\n\nA `Policy` consists of a list of `bindings`. A `Binding` binds a list of\n`members` to a `role`, where the members can be user accounts, Google groups,\nGoogle domains, and service accounts. A `role` is a named list of permissions\ndefined by IAM.\n\n**Example**\n\n {\n \"bindings\": [\n {\n \"role\": \"roles/owner\",\n \"members\": [\n \"user:mike@example.com\",\n \"group:admins@example.com\",\n \"domain:google.com\",\n \"serviceAccount:my-other-app@appspot.gserviceaccount.com\",\n ]\n },\n {\n \"role\": \"roles/viewer\",\n \"members\": [\"user:sean@example.com\"]\n }\n ]\n }\n\nFor a description of IAM and its features, see the\n[IAM developer's guide](https://cloud.google.com/iam).", + "type": "object", + "properties": { + "bindings": { + "description": "Associates a list of `members` to a `role`.\nMultiple `bindings` must not be specified for the same `role`.\n`bindings` with no members will result in an error.", + "type": "array", + "items": { + "$ref": "Binding" + } + }, + "etag": { + "description": "`etag` is used for optimistic concurrency control as a way to help\nprevent simultaneous updates of a policy from overwriting each other.\nIt is strongly suggested that systems make use of the `etag` in the\nread-modify-write cycle to perform policy updates in order to avoid race\nconditions: An `etag` is returned in the response to `getIamPolicy`, and\nsystems are expected to put that etag in the request to `setIamPolicy` to\nensure that their change will be applied to the same version of the policy.\n\nIf no `etag` is provided in the call to `setIamPolicy`, then the existing\npolicy is overwritten blindly.", + "type": "string", + "format": "byte" + }, + "version": { + "description": "Version of the `Policy`. The default version is 0.", + "type": "integer", + "format": "int32" + } + }, + "id": "Policy" + }, + "ProjectCreationStatus": { + "description": "A status object which is used as the `metadata` field for the Operation\nreturned by CreateProject. It provides insight for when significant phases of\nProject creation have completed.", + "type": "object", + "properties": { + "ready": { + "description": "True if the project creation process is complete.", + "type": "boolean" + }, + "gettable": { + "description": "True if the project can be retrieved using GetProject. No other operations\non the project are guaranteed to work until the project creation is\ncomplete.", + "type": "boolean" + }, + "createTime": { + "description": "Creation time of the project creation workflow.", + "type": "string", + "format": "google-datetime" + } + }, + "id": "ProjectCreationStatus" + }, + "TestIamPermissionsRequest": { + "description": "Request message for `TestIamPermissions` method.", + "type": "object", + "properties": { + "permissions": { + "description": "The set of permissions to check for the `resource`. Permissions with\nwildcards (such as '*' or 'storage.*') are not allowed. For more\ninformation see\n[IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).", + "type": "array", + "items": { + "type": "string" + } + } + }, + "id": "TestIamPermissionsRequest" + }, + "GetAncestryRequest": { + "description": "The request sent to the\nGetAncestry\nmethod.", + "type": "object", + "properties": {}, + "id": "GetAncestryRequest" + }, + "GetAncestryResponse": { + "description": "Response from the GetAncestry method.", + "type": "object", + "properties": { + "ancestor": { + "description": "Ancestors are ordered from bottom to top of the resource hierarchy. The\nfirst ancestor is the project itself, followed by the project's parent,\netc.", + "type": "array", + "items": { + "$ref": "Ancestor" + } + } + }, + "id": "GetAncestryResponse" + }, + "SearchOrganizationsResponse": { + "description": "The response returned from the `SearchOrganizations` method.", + "type": "object", + "properties": { + "organizations": { + "description": "The list of Organizations that matched the search query, possibly\npaginated.", + "type": "array", + "items": { + "$ref": "Organization" + } + }, + "nextPageToken": { + "description": "A pagination token to be used to retrieve the next page of results. If the\nresult is too large to fit within the page size specified in the request,\nthis field will be set with a token that can be used to fetch the next page\nof results. If this field is empty, it indicates that this response\ncontains the last page of results.", + "type": "string" + } + }, + "id": "SearchOrganizationsResponse" + }, + "SearchOrganizationsRequest": { + "description": "The request sent to the `SearchOrganizations` method.", + "type": "object", + "properties": { + "pageSize": { + "description": "The maximum number of Organizations to return in the response.\nThis field is optional.", + "type": "integer", + "format": "int32" + }, + "filter": { + "description": "An optional query string used to filter the Organizations to return in\nthe response. Filter rules are case-insensitive.\n\n\nOrganizations may be filtered by `owner.directoryCustomerId` or by\n`domain`, where the domain is a Google for Work domain, for example:\n\n|Filter|Description|\n|------|-----------|\n|owner.directorycustomerid:123456789|Organizations with\n`owner.directory_customer_id` equal to `123456789`.|\n|domain:google.com|Organizations corresponding to the domain `google.com`.|\n\nThis field is optional.", + "type": "string" + }, + "pageToken": { + "description": "A pagination token returned from a previous call to `SearchOrganizations`\nthat indicates from where listing should continue.\nThis field is optional.", + "type": "string" + } + }, + "id": "SearchOrganizationsRequest" + }, + "Empty": { + "description": "A generic empty message that you can re-use to avoid defining duplicated\nempty messages in your APIs. A typical example is to use it as the request\nor the response type of an API method. For instance:\n\n service Foo {\n rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);\n }\n\nThe JSON representation for `Empty` is empty JSON object `{}`.", + "type": "object", + "properties": {}, + "id": "Empty" + }, + "Ancestor": { + "description": "Identifying information for a single ancestor of a project.", + "type": "object", + "properties": { + "resourceId": { + "description": "Resource id of the ancestor.", + "$ref": "ResourceId" + } + }, + "id": "Ancestor" + }, + "ResourceId": { + "description": "A container to reference an id for any resource type. A `resource` in Google\nCloud Platform is a generic term for something you (a developer) may want to\ninteract with through one of our API's. Some examples are an AppEngine app,\na Compute Engine instance, a Cloud SQL database, and so on.", + "type": "object", + "properties": { + "type": { + "description": "Required field representing the resource type this id is for.\nAt present, the only valid type is \"organization\".", + "type": "string" + }, + "id": { + "description": "Required field for the type-specific id. This should correspond to the id\nused in the type-specific API's.", + "type": "string" + } + }, + "id": "ResourceId" + }, + "Binding": { + "description": "Associates `members` with a `role`.", + "type": "object", + "properties": { + "members": { + "description": "Specifies the identities requesting access for a Cloud Platform resource.\n`members` can have the following values:\n\n* `allUsers`: A special identifier that represents anyone who is\n on the internet; with or without a Google account.\n\n* `allAuthenticatedUsers`: A special identifier that represents anyone\n who is authenticated with a Google account or a service account.\n\n* `user:{emailid}`: An email address that represents a specific Google\n account. For example, `alice@gmail.com` or `joe@example.com`.\n\n\n* `serviceAccount:{emailid}`: An email address that represents a service\n account. For example, `my-other-app@appspot.gserviceaccount.com`.\n\n* `group:{emailid}`: An email address that represents a Google group.\n For example, `admins@example.com`.\n\n* `domain:{domain}`: A Google Apps domain name that represents all the\n users of that domain. For example, `google.com` or `example.com`.\n\n", + "type": "array", + "items": { + "type": "string" + } + }, + "role": { + "description": "Role that is assigned to `members`.\nFor example, `roles/viewer`, `roles/editor`, or `roles/owner`.\nRequired", + "type": "string" + } + }, + "id": "Binding" + }, + "Project": { + "description": "A Project is a high-level Google Cloud Platform entity. It is a\ncontainer for ACLs, APIs, AppEngine Apps, VMs, and other\nGoogle Cloud Platform resources.", + "type": "object", + "properties": { + "parent": { + "description": "An optional reference to a parent Resource.\n\nThe only supported parent type is \"organization\". Once set, the parent\ncannot be modified. The `parent` can be set on creation or using the\n`UpdateProject` method; the end user must have the\n`resourcemanager.projects.create` permission on the parent.\n\nRead-write.", + "$ref": "ResourceId" + }, + "labels": { + "description": "The labels associated with this Project.\n\nLabel keys must be between 1 and 63 characters long and must conform\nto the following regular expression: \\[a-z\\](\\[-a-z0-9\\]*\\[a-z0-9\\])?.\n\nLabel values must be between 0 and 63 characters long and must conform\nto the regular expression (\\[a-z\\](\\[-a-z0-9\\]*\\[a-z0-9\\])?)?.\n\nNo more than 256 labels can be associated with a given resource.\n\nClients should store labels in a representation such as JSON that does not\ndepend on specific characters being disallowed.\n\nExample: \u003ccode\u003e\"environment\" : \"dev\"\u003c/code\u003e\n\nRead-write.", + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + "lifecycleState": { + "description": "The Project lifecycle state.\n\nRead-only.", + "enum": [ + "LIFECYCLE_STATE_UNSPECIFIED", + "ACTIVE", + "DELETE_REQUESTED", + "DELETE_IN_PROGRESS" + ], + "enumDescriptions": [ + "Unspecified state. This is only used/useful for distinguishing\nunset values.", + "The normal and active state.", + "The project has been marked for deletion by the user\n(by invoking\nDeleteProject)\nor by the system (Google Cloud Platform).\nThis can generally be reversed by invoking UndeleteProject.", + "This lifecycle state is no longer used and not returned by the API." + ], + "type": "string" + }, + "createTime": { + "description": "Creation time.\n\nRead-only.", + "type": "string", + "format": "google-datetime" + }, + "name": { + "description": "The user-assigned display name of the Project.\nIt must be 4 to 30 characters.\nAllowed characters are: lowercase and uppercase letters, numbers,\nhyphen, single-quote, double-quote, space, and exclamation point.\n\nExample: \u003ccode\u003eMy Project\u003c/code\u003e\n\nRead-write.", + "type": "string" + }, + "projectNumber": { + "description": "The number uniquely identifying the project.\n\nExample: \u003ccode\u003e415104041262\u003c/code\u003e\n\nRead-only.", + "type": "string", + "format": "int64" + }, + "projectId": { + "description": "The unique, user-assigned ID of the Project.\nIt must be 6 to 30 lowercase letters, digits, or hyphens.\nIt must start with a letter.\nTrailing hyphens are prohibited.\n\nExample: \u003ccode\u003etokyo-rain-123\u003c/code\u003e\n\nRead-only after creation.", + "type": "string" + } + }, + "id": "Project" + }, + "OrganizationOwner": { + "description": "The entity that owns an Organization. The lifetime of the Organization and\nall of its descendants are bound to the `OrganizationOwner`. If the\n`OrganizationOwner` is deleted, the Organization and all its descendants will\nbe deleted.", + "type": "object", + "properties": { + "directoryCustomerId": { + "description": "The Google for Work customer id used in the Directory API.", + "type": "string" + } + }, + "id": "OrganizationOwner" } - } }, - "operations": { - "methods": { - "get": { - "id": "cloudresourcemanager.operations.get", - "path": "v1/{+name}", - "httpMethod": "GET", - "description": "Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.", - "parameters": { - "name": { - "type": "string", - "description": "The name of the operation resource.", - "required": true, - "pattern": "^operations/.*$", - "location": "path" - } - }, - "parameterOrder": [ - "name" - ], - "response": { - "$ref": "Operation" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only" - ] + "revision": "20161212", + "basePath": "", + "icons": { + "x32": "http://www.google.com/images/icons/product/search-32.gif", + "x16": "http://www.google.com/images/icons/product/search-16.gif" + }, + "canonicalName": "Cloud Resource Manager", + "discoveryVersion": "v1", + "baseUrl": "https://cloudresourcemanager.googleapis.com/", + "name": "cloudresourcemanager", + "parameters": { + "access_token": { + "description": "OAuth access token.", + "type": "string", + "location": "query" + }, + "prettyPrint": { + "description": "Returns response with indentations and line breaks.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "key": { + "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", + "type": "string", + "location": "query" + }, + "quotaUser": { + "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.", + "type": "string", + "location": "query" + }, + "pp": { + "description": "Pretty-print response.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "fields": { + "description": "Selector specifying which fields to include in a partial response.", + "type": "string", + "location": "query" + }, + "alt": { + "description": "Data format for response.", + "location": "query", + "enum": [ + "json", + "media", + "proto" + ], + "default": "json", + "enumDescriptions": [ + "Responses with Content-Type of application/json", + "Media download with context-dependent Content-Type", + "Responses with Content-Type of application/x-protobuf" + ], + "type": "string" + }, + "$.xgafv": { + "description": "V1 error format.", + "enum": [ + "1", + "2" + ], + "enumDescriptions": [ + "v1 error format", + "v2 error format" + ], + "type": "string", + "location": "query" + }, + "callback": { + "description": "JSONP", + "type": "string", + "location": "query" + }, + "oauth_token": { + "description": "OAuth 2.0 token for the current user.", + "type": "string", + "location": "query" + }, + "uploadType": { + "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").", + "type": "string", + "location": "query" + }, + "bearer_token": { + "description": "OAuth bearer token.", + "type": "string", + "location": "query" + }, + "upload_protocol": { + "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").", + "type": "string", + "location": "query" } - } - } - } + }, + "documentationLink": "https://cloud.google.com/resource-manager", + "ownerDomain": "google.com", + "batchPath": "batch", + "servicePath": "", + "ownerName": "Google", + "version": "v1", + "rootUrl": "https://cloudresourcemanager.googleapis.com/", + "kind": "discovery#restDescription" } diff --git a/etc/api/cloudresourcemanager/v1beta1/cloudresourcemanager-api.json b/etc/api/cloudresourcemanager/v1beta1/cloudresourcemanager-api.json index 09ea7ccdcb..4cd1f6e127 100644 --- a/etc/api/cloudresourcemanager/v1beta1/cloudresourcemanager-api.json +++ b/etc/api/cloudresourcemanager/v1beta1/cloudresourcemanager-api.json @@ -1,820 +1,957 @@ { - "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/232vNH0y0gf7PFZjf9ayIsMOF0M\"", - "discoveryVersion": "v1", - "id": "cloudresourcemanager:v1beta1", - "name": "cloudresourcemanager", - "canonicalName": "Cloud Resource Manager", - "version": "v1beta1", - "revision": "20160617", - "title": "Google Cloud Resource Manager API", - "description": "The Google Cloud Resource Manager API provides methods for creating, reading, and updating project metadata.", - "ownerDomain": "google.com", - "ownerName": "Google", - "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" - }, - "documentationLink": "https://cloud.google.com/resource-manager", - "protocol": "rest", - "baseUrl": "https://cloudresourcemanager.googleapis.com/", - "basePath": "", - "rootUrl": "https://cloudresourcemanager.googleapis.com/", - "servicePath": "", - "batchPath": "batch", - "parameters": { - "access_token": { - "type": "string", - "description": "OAuth access token.", - "location": "query" - }, - "alt": { - "type": "string", - "description": "Data format for response.", - "default": "json", - "enumDescriptions": [ - "Responses with Content-Type of application/json", - "Media download with context-dependent Content-Type", - "Responses with Content-Type of application/x-protobuf" - ], - "location": "query" - }, - "bearer_token": { - "type": "string", - "description": "OAuth bearer token.", - "location": "query" - }, - "callback": { - "type": "string", - "description": "JSONP", - "location": "query" - }, - "fields": { - "type": "string", - "description": "Selector specifying which fields to include in a partial response.", - "location": "query" - }, - "key": { - "type": "string", - "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", - "location": "query" - }, - "oauth_token": { - "type": "string", - "description": "OAuth 2.0 token for the current user.", - "location": "query" - }, - "pp": { - "type": "boolean", - "description": "Pretty-print response.", - "default": "true", - "location": "query" - }, - "prettyPrint": { - "type": "boolean", - "description": "Returns response with indentations and line breaks.", - "default": "true", - "location": "query" - }, - "quotaUser": { - "type": "string", - "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.", - "location": "query" - }, - "upload_protocol": { - "type": "string", - "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").", - "location": "query" - }, - "uploadType": { - "type": "string", - "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").", - "location": "query" - }, - "$.xgafv": { - "type": "string", - "description": "V1 error format.", - "enumDescriptions": [ - "v1 error format", - "v2 error format" - ], - "location": "query" - } - }, - "auth": { - "oauth2": { - "scopes": { - "https://www.googleapis.com/auth/cloud-platform": { - "description": "View and manage your data across Google Cloud Platform services" - }, - "https://www.googleapis.com/auth/cloud-platform.read-only": { - "description": "View your data across Google Cloud Platform services" + "id": "cloudresourcemanager:v1beta1", + "auth": { + "oauth2": { + "scopes": { + "https://www.googleapis.com/auth/cloud-platform": { + "description": "View and manage your data across Google Cloud Platform services" + }, + "https://www.googleapis.com/auth/cloud-platform.read-only": { + "description": "View your data across Google Cloud Platform services" + } + } } - } - } - }, - "schemas": { - "Project": { - "id": "Project", - "type": "object", - "description": "A Project is a high-level Google Cloud Platform entity. It is a container for ACLs, APIs, AppEngine Apps, VMs, and other Google Cloud Platform resources.", - "properties": { - "projectNumber": { - "type": "string", - "description": "The number uniquely identifying the project. Example: 415104041262 Read-only.", - "format": "int64" - }, - "projectId": { - "type": "string", - "description": "The unique, user-assigned ID of the Project. It must be 6 to 30 lowercase letters, digits, or hyphens. It must start with a letter. Trailing hyphens are prohibited. Example: tokyo-rain-123 Read-only after creation." - }, - "lifecycleState": { - "type": "string", - "description": "The Project lifecycle state. Read-only.", - "enum": [ - "LIFECYCLE_STATE_UNSPECIFIED", - "ACTIVE", - "DELETE_REQUESTED", - "DELETE_IN_PROGRESS" - ] - }, - "name": { - "type": "string", - "description": "The user-assigned display name of the Project. It must be 4 to 30 characters. Allowed characters are: lowercase and uppercase letters, numbers, hyphen, single-quote, double-quote, space, and exclamation point. Example: My Project Read-write." - }, - "createTime": { - "type": "string", - "description": "Creation time. Read-only." - }, - "labels": { - "type": "object", - "description": "The labels associated with this Project. Label keys must be between 1 and 63 characters long and must conform to the following regular expression: \\[a-z\\](\\[-a-z0-9\\]*\\[a-z0-9\\])?. Label values must be between 0 and 63 characters long and must conform to the regular expression (\\[a-z\\](\\[-a-z0-9\\]*\\[a-z0-9\\])?)?. No more than 256 labels can be associated with a given resource. Clients should store labels in a representation such as JSON that does not depend on specific characters being disallowed. Example: \"environment\" : \"dev\" Read-write.", - "additionalProperties": { - "type": "string" - } - }, - "parent": { - "$ref": "ResourceId", - "description": "An optional reference to a parent Resource. The only supported parent type is \"organization\". Once set, the parent cannot be modified. Read-write." - } - } }, - "ResourceId": { - "id": "ResourceId", - "type": "object", - "description": "A container to reference an id for any resource type. A `resource` in Google Cloud Platform is a generic term for something you (a developer) may want to interact with through one of our API's. Some examples are an AppEngine app, a Compute Engine instance, a Cloud SQL database, and so on.", - "properties": { - "type": { - "type": "string", - "description": "Required field representing the resource type this id is for. At present, the valid types are \"project\" and \"organization\"." - }, - "id": { - "type": "string", - "description": "Required field for the type-specific id. This should correspond to the id used in the type-specific API's." - } - } - }, - "ListProjectsResponse": { - "id": "ListProjectsResponse", - "type": "object", - "description": "A page of the response received from the ListProjects method. A paginated response where more pages are available has `next_page_token` set. This token can be used in a subsequent request to retrieve the next request page.", - "properties": { + "description": "The Google Cloud Resource Manager API provides methods for creating, reading, and updating project metadata.", + "protocol": "rest", + "title": "Google Cloud Resource Manager API", + "resources": { "projects": { - "type": "array", - "description": "The list of Projects that matched the list filter. This list can be paginated.", - "items": { - "$ref": "Project" - } + "methods": { + "getAncestry": { + "id": "cloudresourcemanager.projects.getAncestry", + "response": { + "$ref": "GetAncestryResponse" + }, + "parameterOrder": [ + "projectId" + ], + "description": "Gets a list of ancestors in the resource hierarchy for the Project\nidentified by the specified `project_id` (for example, `my-project-123`).\n\nThe caller must have read permissions for this Project.", + "request": { + "$ref": "GetAncestryRequest" + }, + "flatPath": "v1beta1/projects/{projectId}:getAncestry", + "httpMethod": "POST", + "parameters": { + "projectId": { + "description": "The Project ID (for example, `my-project-123`).\n\nRequired.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/projects/{projectId}:getAncestry", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" + ] + }, + "getIamPolicy": { + "id": "cloudresourcemanager.projects.getIamPolicy", + "response": { + "$ref": "Policy" + }, + "parameterOrder": [ + "resource" + ], + "description": "Returns the IAM access control policy for the specified Project.\nPermission is denied if the policy or the resource does not exist.", + "request": { + "$ref": "GetIamPolicyRequest" + }, + "flatPath": "v1beta1/projects/{resource}:getIamPolicy", + "httpMethod": "POST", + "parameters": { + "resource": { + "description": "REQUIRED: The resource for which the policy is being requested.\n`resource` is usually specified as a path. For example, a Project\nresource is specified as `projects/{project}`.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/projects/{resource}:getIamPolicy", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" + ] + }, + "undelete": { + "id": "cloudresourcemanager.projects.undelete", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "projectId" + ], + "description": "Restores the Project identified by the specified\n`project_id` (for example, `my-project-123`).\nYou can only use this method for a Project that has a lifecycle state of\nDELETE_REQUESTED.\nAfter deletion starts, the Project cannot be restored.\n\nThe caller must have modify permissions for this Project.", + "request": { + "$ref": "UndeleteProjectRequest" + }, + "flatPath": "v1beta1/projects/{projectId}:undelete", + "httpMethod": "POST", + "parameters": { + "projectId": { + "description": "The project ID (for example, `foo-bar-123`).\n\nRequired.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/projects/{projectId}:undelete", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "list": { + "id": "cloudresourcemanager.projects.list", + "response": { + "$ref": "ListProjectsResponse" + }, + "parameterOrder": [], + "description": "Lists Projects that are visible to the user and satisfy the\nspecified filter. This method returns Projects in an unspecified order.\nNew Projects do not necessarily appear at the end of the list.", + "flatPath": "v1beta1/projects", + "httpMethod": "GET", + "parameters": { + "pageSize": { + "description": "The maximum number of Projects to return in the response.\nThe server can return fewer Projects than requested.\nIf unspecified, server picks an appropriate default.\n\nOptional.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "filter": { + "description": "An expression for filtering the results of the request. Filter rules are\ncase insensitive. The fields eligible for filtering are:\n\n+ `name`\n+ `id`\n+ \u003ccode\u003elabels.\u003cem\u003ekey\u003c/em\u003e\u003c/code\u003e where *key* is the name of a label\n\nSome examples of using labels as filters:\n\n|Filter|Description|\n|------|-----------|\n|name:*|The project has a name.|\n|name:Howl|The project's name is `Howl` or `howl`.|\n|name:HOWL|Equivalent to above.|\n|NAME:howl|Equivalent to above.|\n|labels.color:*|The project has the label `color`.|\n|labels.color:red|The project's label `color` has the value `red`.|\n|labels.color:red label.size:big|The project's label `color` has the value `red` and its label `size` has the value `big`.\n\nOptional.", + "location": "query", + "type": "string" + }, + "pageToken": { + "description": "A pagination token returned from a previous call to ListProjects\nthat indicates from where listing should continue.\n\nOptional.", + "location": "query", + "type": "string" + } + }, + "path": "v1beta1/projects", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" + ] + }, + "get": { + "id": "cloudresourcemanager.projects.get", + "response": { + "$ref": "Project" + }, + "parameterOrder": [ + "projectId" + ], + "description": "Retrieves the Project identified by the specified\n`project_id` (for example, `my-project-123`).\n\nThe caller must have read permissions for this Project.", + "flatPath": "v1beta1/projects/{projectId}", + "httpMethod": "GET", + "parameters": { + "projectId": { + "description": "The Project ID (for example, `my-project-123`).\n\nRequired.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/projects/{projectId}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" + ] + }, + "update": { + "id": "cloudresourcemanager.projects.update", + "response": { + "$ref": "Project" + }, + "parameterOrder": [ + "projectId" + ], + "description": "Updates the attributes of the Project identified by the specified\n`project_id` (for example, `my-project-123`).\n\nThe caller must have modify permissions for this Project.", + "request": { + "$ref": "Project" + }, + "flatPath": "v1beta1/projects/{projectId}", + "httpMethod": "PUT", + "parameters": { + "projectId": { + "description": "The project ID (for example, `my-project-123`).\n\nRequired.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/projects/{projectId}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "create": { + "id": "cloudresourcemanager.projects.create", + "response": { + "$ref": "Project" + }, + "parameterOrder": [], + "description": "Creates a Project resource.\n\nInitially, the Project resource is owned by its creator exclusively.\nThe creator can later grant permission to others to read or update the\nProject.\n\nSeveral APIs are activated automatically for the Project, including\nGoogle Cloud Storage.", + "request": { + "$ref": "Project" + }, + "flatPath": "v1beta1/projects", + "httpMethod": "POST", + "parameters": { + "useLegacyStack": { + "description": "A safety hatch to opt out of the new reliable project creation process.", + "location": "query", + "type": "boolean" + } + }, + "path": "v1beta1/projects", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "setIamPolicy": { + "id": "cloudresourcemanager.projects.setIamPolicy", + "response": { + "$ref": "Policy" + }, + "parameterOrder": [ + "resource" + ], + "description": "Sets the IAM access control policy for the specified Project. Replaces\nany existing policy.\n\nThe following constraints apply when using `setIamPolicy()`:\n\n+ Project does not support `allUsers` and `allAuthenticatedUsers` as\n`members` in a `Binding` of a `Policy`.\n\n+ The owner role can be granted only to `user` and `serviceAccount`.\n\n+ Service accounts can be made owners of a project directly\nwithout any restrictions. However, to be added as an owner, a user must be\ninvited via Cloud Platform console and must accept the invitation.\n\n+ A user cannot be granted the owner role using `setIamPolicy()`. The user\nmust be granted the owner role using the Cloud Platform Console and must\nexplicitly accept the invitation.\n\n+ Invitations to grant the owner role cannot be sent using `setIamPolicy()`;\nthey must be sent only using the Cloud Platform Console.\n\n+ Membership changes that leave the project without any owners that have\naccepted the Terms of Service (ToS) will be rejected.\n\n+ There must be at least one owner who has accepted the Terms of\nService (ToS) agreement in the policy. Calling `setIamPolicy()` to\nto remove the last ToS-accepted owner from the policy will fail. This\nrestriction also applies to legacy projects that no longer have owners\nwho have accepted the ToS. Edits to IAM policies will be rejected until\nthe lack of a ToS-accepting owner is rectified.\n\n+ Calling this method requires enabling the App Engine Admin API.\n\nNote: Removing service accounts from policies or changing their roles\ncan render services completely inoperable. It is important to understand\nhow the service account is being used before removing or updating its roles.", + "request": { + "$ref": "SetIamPolicyRequest" + }, + "flatPath": "v1beta1/projects/{resource}:setIamPolicy", + "httpMethod": "POST", + "parameters": { + "resource": { + "description": "REQUIRED: The resource for which the policy is being specified.\n`resource` is usually specified as a path. For example, a Project\nresource is specified as `projects/{project}`.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/projects/{resource}:setIamPolicy", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "delete": { + "id": "cloudresourcemanager.projects.delete", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "projectId" + ], + "description": "Marks the Project identified by the specified\n`project_id` (for example, `my-project-123`) for deletion.\nThis method will only affect the Project if the following criteria are met:\n\n+ The Project does not have a billing account associated with it.\n+ The Project has a lifecycle state of\nACTIVE.\n\nThis method changes the Project's lifecycle state from\nACTIVE\nto DELETE_REQUESTED.\nThe deletion starts at an unspecified time, at which point the project is\nno longer accessible.\n\nUntil the deletion completes, you can check the lifecycle state\nchecked by retrieving the Project with GetProject,\nand the Project remains visible to ListProjects.\nHowever, you cannot update the project.\n\nAfter the deletion completes, the Project is not retrievable by\nthe GetProject and\nListProjects methods.\n\nThe caller must have modify permissions for this Project.", + "flatPath": "v1beta1/projects/{projectId}", + "httpMethod": "DELETE", + "parameters": { + "projectId": { + "description": "The Project ID (for example, `foo-bar-123`).\n\nRequired.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/projects/{projectId}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "testIamPermissions": { + "id": "cloudresourcemanager.projects.testIamPermissions", + "response": { + "$ref": "TestIamPermissionsResponse" + }, + "parameterOrder": [ + "resource" + ], + "description": "Returns permissions that a caller has on the specified Project.", + "request": { + "$ref": "TestIamPermissionsRequest" + }, + "flatPath": "v1beta1/projects/{resource}:testIamPermissions", + "httpMethod": "POST", + "parameters": { + "resource": { + "description": "REQUIRED: The resource for which the policy detail is being requested.\n`resource` is usually specified as a path. For example, a Project\nresource is specified as `projects/{project}`.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/projects/{resource}:testIamPermissions", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" + ] + } + } }, - "nextPageToken": { - "type": "string", - "description": "Pagination token. If the result set is too large to fit in a single response, this token is returned. It encodes the position of the current result cursor. Feeding this value into a new list request with the `page_token` parameter gives the next page of the results. When `next_page_token` is not filled in, there is no next page and the list returned is the last page in the result set. Pagination tokens have a limited lifetime." - } - } - }, - "Empty": { - "id": "Empty", - "type": "object", - "description": "A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON representation for `Empty` is empty JSON object `{}`." - }, - "UndeleteProjectRequest": { - "id": "UndeleteProjectRequest", - "type": "object", - "description": "The request sent to the UndeleteProject method." - }, - "GetAncestryRequest": { - "id": "GetAncestryRequest", - "type": "object", - "description": "The request sent to the GetAncestry method." - }, - "GetAncestryResponse": { - "id": "GetAncestryResponse", - "type": "object", - "description": "Response from the GetAncestry method.", - "properties": { - "ancestor": { - "type": "array", - "description": "Ancestors are ordered from bottom to top of the resource hierarchy. The first ancestor is the project itself, followed by the project's parent, etc.", - "items": { - "$ref": "Ancestor" - } - } - } - }, - "Ancestor": { - "id": "Ancestor", - "type": "object", - "description": "Identifying information for a single ancestor of a project.", - "properties": { - "resourceId": { - "$ref": "ResourceId", - "description": "Resource id of the ancestor." - } - } - }, - "GetIamPolicyRequest": { - "id": "GetIamPolicyRequest", - "type": "object", - "description": "Request message for `GetIamPolicy` method." - }, - "Policy": { - "id": "Policy", - "type": "object", - "description": "Defines an Identity and Access Management (IAM) policy. It is used to specify access control policies for Cloud Platform resources. A `Policy` consists of a list of `bindings`. A `Binding` binds a list of `members` to a `role`, where the members can be user accounts, Google groups, Google domains, and service accounts. A `role` is a named list of permissions defined by IAM. **Example** { \"bindings\": [ { \"role\": \"roles/owner\", \"members\": [ \"user:mike@example.com\", \"group:admins@example.com\", \"domain:google.com\", \"serviceAccount:my-other-app@appspot.gserviceaccount.com\", ] }, { \"role\": \"roles/viewer\", \"members\": [\"user:sean@example.com\"] } ] } For a description of IAM and its features, see the [IAM developer's guide](https://cloud.google.com/iam).", - "properties": { - "version": { - "type": "integer", - "description": "Version of the `Policy`. The default version is 0.", - "format": "int32" - }, - "bindings": { - "type": "array", - "description": "Associates a list of `members` to a `role`. Multiple `bindings` must not be specified for the same `role`. `bindings` with no members will result in an error.", - "items": { - "$ref": "Binding" - } - }, - "etag": { - "type": "string", - "description": "`etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other. It is strongly suggested that systems make use of the `etag` in the read-modify-write cycle to perform policy updates in order to avoid race conditions: An `etag` is returned in the response to `getIamPolicy`, and systems are expected to put that etag in the request to `setIamPolicy` to ensure that their change will be applied to the same version of the policy. If no `etag` is provided in the call to `setIamPolicy`, then the existing policy is overwritten blindly.", - "format": "byte" - } - } - }, - "Binding": { - "id": "Binding", - "type": "object", - "description": "Associates `members` with a `role`.", - "properties": { - "role": { - "type": "string", - "description": "Role that is assigned to `members`. For example, `roles/viewer`, `roles/editor`, or `roles/owner`. Required" - }, - "members": { - "type": "array", - "description": "Specifies the identities requesting access for a Cloud Platform resource. `members` can have the following values: * `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account. * `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account. * `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@gmail.com` or `joe@example.com`. * `serviceAccount:{emailid}`: An email address that represents a service account. For example, `my-other-app@appspot.gserviceaccount.com`. * `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`. * `domain:{domain}`: A Google Apps domain name that represents all the users of that domain. For example, `google.com` or `example.com`.", - "items": { - "type": "string" - } - } - } - }, - "SetIamPolicyRequest": { - "id": "SetIamPolicyRequest", - "type": "object", - "description": "Request message for `SetIamPolicy` method.", - "properties": { - "policy": { - "$ref": "Policy", - "description": "REQUIRED: The complete policy to be applied to the `resource`. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them." - } - } - }, - "TestIamPermissionsRequest": { - "id": "TestIamPermissionsRequest", - "type": "object", - "description": "Request message for `TestIamPermissions` method.", - "properties": { - "permissions": { - "type": "array", - "description": "The set of permissions to check for the `resource`. Permissions with wildcards (such as '*' or 'storage.*') are not allowed. For more information see IAM Overview.", - "items": { - "type": "string" - } - } - } - }, - "TestIamPermissionsResponse": { - "id": "TestIamPermissionsResponse", - "type": "object", - "description": "Response message for `TestIamPermissions` method.", - "properties": { - "permissions": { - "type": "array", - "description": "A subset of `TestPermissionsRequest.permissions` that the caller is allowed.", - "items": { - "type": "string" - } - } - } - }, - "ListOrganizationsResponse": { - "id": "ListOrganizationsResponse", - "type": "object", - "description": "The response returned from the `ListOrganizations` method.", - "properties": { "organizations": { - "type": "array", - "description": "The list of Organizations that matched the list query, possibly paginated.", - "items": { - "$ref": "Organization" - } - }, - "nextPageToken": { - "type": "string", - "description": "A pagination token to be used to retrieve the next page of results. If the result is too large to fit within the page size specified in the request, this field will be set with a token that can be used to fetch the next page of results. If this field is empty, it indicates that this response contains the last page of results." + "methods": { + "getIamPolicy": { + "id": "cloudresourcemanager.organizations.getIamPolicy", + "response": { + "$ref": "Policy" + }, + "parameterOrder": [ + "resource" + ], + "description": "Gets the access control policy for an Organization resource. May be empty\nif no such policy or resource exists. The `resource` field should be the\norganization's resource name, e.g. \"organizations/123\".", + "request": { + "$ref": "GetIamPolicyRequest" + }, + "flatPath": "v1beta1/organizations/{organizationsId}:getIamPolicy", + "httpMethod": "POST", + "parameters": { + "resource": { + "description": "REQUIRED: The resource for which the policy is being requested.\n`resource` is usually specified as a path. For example, a Project\nresource is specified as `projects/{project}`.", + "required": true, + "pattern": "^organizations/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/{+resource}:getIamPolicy", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" + ] + }, + "list": { + "id": "cloudresourcemanager.organizations.list", + "response": { + "$ref": "ListOrganizationsResponse" + }, + "parameterOrder": [], + "description": "Lists Organization resources that are visible to the user and satisfy\nthe specified filter. This method returns Organizations in an unspecified\norder. New Organizations do not necessarily appear at the end of the list.", + "flatPath": "v1beta1/organizations", + "httpMethod": "GET", + "parameters": { + "pageSize": { + "description": "The maximum number of Organizations to return in the response.\nThis field is optional.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "filter": { + "description": "An optional query string used to filter the Organizations to return in\nthe response. Filter rules are case-insensitive.\n\n\nOrganizations may be filtered by `owner.directoryCustomerId` or by\n`domain`, where the domain is a Google for Work domain, for example:\n\n|Filter|Description|\n|------|-----------|\n|owner.directorycustomerid:123456789|Organizations with `owner.directory_customer_id` equal to `123456789`.|\n|domain:google.com|Organizations corresponding to the domain `google.com`.|\n\nThis field is optional.", + "location": "query", + "type": "string" + }, + "pageToken": { + "description": "A pagination token returned from a previous call to `ListOrganizations`\nthat indicates from where listing should continue.\nThis field is optional.", + "location": "query", + "type": "string" + } + }, + "path": "v1beta1/organizations", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" + ] + }, + "get": { + "id": "cloudresourcemanager.organizations.get", + "response": { + "$ref": "Organization" + }, + "parameterOrder": [ + "name" + ], + "description": "Fetches an Organization resource identified by the specified resource name.", + "flatPath": "v1beta1/organizations/{organizationsId}", + "httpMethod": "GET", + "parameters": { + "name": { + "description": "The resource name of the Organization to fetch, e.g. \"organizations/1234\".", + "required": true, + "pattern": "^organizations/[^/]+$", + "location": "path", + "type": "string" + }, + "organizationId": { + "description": "The id of the Organization resource to fetch.\nThis field is deprecated and will be removed in v1. Use name instead.", + "location": "query", + "type": "string" + } + }, + "path": "v1beta1/{+name}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" + ] + }, + "update": { + "id": "cloudresourcemanager.organizations.update", + "response": { + "$ref": "Organization" + }, + "parameterOrder": [ + "name" + ], + "description": "Updates an Organization resource identified by the specified resource name.", + "request": { + "$ref": "Organization" + }, + "flatPath": "v1beta1/organizations/{organizationsId}", + "httpMethod": "PUT", + "parameters": { + "name": { + "description": "Output Only. The resource name of the organization. This is the\norganization's relative path in the API. Its format is\n\"organizations/[organization_id]\". For example, \"organizations/1234\".", + "required": true, + "pattern": "^organizations/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/{+name}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "setIamPolicy": { + "id": "cloudresourcemanager.organizations.setIamPolicy", + "response": { + "$ref": "Policy" + }, + "parameterOrder": [ + "resource" + ], + "description": "Sets the access control policy on an Organization resource. Replaces any\nexisting policy. The `resource` field should be the organization's resource\nname, e.g. \"organizations/123\".", + "request": { + "$ref": "SetIamPolicyRequest" + }, + "flatPath": "v1beta1/organizations/{organizationsId}:setIamPolicy", + "httpMethod": "POST", + "parameters": { + "resource": { + "description": "REQUIRED: The resource for which the policy is being specified.\n`resource` is usually specified as a path. For example, a Project\nresource is specified as `projects/{project}`.", + "required": true, + "pattern": "^organizations/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/{+resource}:setIamPolicy", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "testIamPermissions": { + "id": "cloudresourcemanager.organizations.testIamPermissions", + "response": { + "$ref": "TestIamPermissionsResponse" + }, + "parameterOrder": [ + "resource" + ], + "description": "Returns permissions that a caller has on the specified Organization.\nThe `resource` field should be the organization's resource name,\ne.g. \"organizations/123\".", + "request": { + "$ref": "TestIamPermissionsRequest" + }, + "flatPath": "v1beta1/organizations/{organizationsId}:testIamPermissions", + "httpMethod": "POST", + "parameters": { + "resource": { + "description": "REQUIRED: The resource for which the policy detail is being requested.\n`resource` is usually specified as a path. For example, a Project\nresource is specified as `projects/{project}`.", + "required": true, + "pattern": "^organizations/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/{+resource}:testIamPermissions", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only" + ] + } + } } - } }, - "Organization": { - "id": "Organization", - "type": "object", - "description": "The root node in the resource hierarchy to which a particular entity's (e.g., company) resources belong.", - "properties": { - "name": { - "type": "string", - "description": "Output Only. The resource name of the organization. This is the organization's relative path in the API. Its format is \"organizations/[organization_id]\". For example, \"organizations/1234\"." + "schemas": { + "FolderOperationError": { + "description": "A classification of the Folder Operation error.", + "type": "object", + "properties": { + "errorMessageId": { + "description": "The type of operation error experienced.", + "enum": [ + "ERROR_TYPE_UNSPECIFIED", + "FOLDER_HEIGHT_VIOLATION", + "MAX_CHILD_FOLDERS_VIOLATION", + "FOLDER_NAME_UNIQUENESS_VIOLATION", + "RESOURCE_DELETED", + "PARENT_DELETED", + "CYCLE_INTRODUCED_ERROR", + "FOLDER_ALREADY_BEING_MOVED", + "FOLDER_TO_DELETE_NON_EMPTY" + ], + "enumDescriptions": [ + "The error type was unrecognized or unspecified.", + "The attempted action would violate the max folder depth constraint.", + "The attempted action would violate the max child folders constraint.", + "The attempted action would violate the locally-unique folder\ndisplay_name constraint.", + "The resource being moved has been deleted.", + "The resource a folder was being added to has been deleted.", + "The attempted action would introduce cycle in resource path.", + "The attempted action would move a folder that is already being moved.", + "The folder the caller is trying to delete contains active resources." + ], + "type": "string" + } + }, + "id": "FolderOperationError" }, - "organizationId": { - "type": "string", - "description": "An immutable id for the Organization that is assigned on creation. This should be omitted when creating a new Organization. This field is read-only. This field is deprecated and will be removed in v1. Use name instead." + "ListProjectsResponse": { + "description": "A page of the response received from the\nListProjects\nmethod.\n\nA paginated response where more pages are available has\n`next_page_token` set. This token can be used in a subsequent request to\nretrieve the next request page.", + "type": "object", + "properties": { + "projects": { + "description": "The list of Projects that matched the list filter. This list can\nbe paginated.", + "type": "array", + "items": { + "$ref": "Project" + } + }, + "nextPageToken": { + "description": "Pagination token.\n\nIf the result set is too large to fit in a single response, this token\nis returned. It encodes the position of the current result cursor.\nFeeding this value into a new list request with the `page_token` parameter\ngives the next page of the results.\n\nWhen `next_page_token` is not filled in, there is no next page and\nthe list returned is the last page in the result set.\n\nPagination tokens have a limited lifetime.", + "type": "string" + } + }, + "id": "ListProjectsResponse" }, - "displayName": { - "type": "string", - "description": "A friendly string to be used to refer to the Organization in the UI. This field is required." + "UndeleteProjectRequest": { + "description": "The request sent to the UndeleteProject\nmethod.", + "type": "object", + "properties": {}, + "id": "UndeleteProjectRequest" }, - "owner": { - "$ref": "OrganizationOwner", - "description": "The owner of this Organization. The owner should be specified on creation. Once set, it cannot be changed. This field is required." + "FolderOperation": { + "description": "Metadata describing a long running folder operation", + "type": "object", + "properties": { + "displayName": { + "description": "The display name of the folder.", + "type": "string" + }, + "sourceParent": { + "description": "The resource name of the folder's parent.\nOnly applicable when the operation_type is MOVE.", + "type": "string" + }, + "destinationParent": { + "description": "The resource name of the folder or organization we are either creating\nthe folder under or moving the folder to.", + "type": "string" + }, + "operationType": { + "description": "The type of this operation.", + "enum": [ + "OPERATION_TYPE_UNSPECIFIED", + "CREATE", + "MOVE" + ], + "enumDescriptions": [ + "Operation type not specified.", + "A create folder operation.", + "A move folder operation." + ], + "type": "string" + } + }, + "id": "FolderOperation" }, - "creationTime": { - "type": "string", - "description": "Timestamp when the Organization was created. Assigned by the server. @OutputOnly" + "GetIamPolicyRequest": { + "description": "Request message for `GetIamPolicy` method.", + "type": "object", + "properties": {}, + "id": "GetIamPolicyRequest" }, - "lifecycleState": { - "type": "string", - "description": "The organization's current lifecycle state. Assigned by the server. @OutputOnly", - "enum": [ - "LIFECYCLE_STATE_UNSPECIFIED", - "ACTIVE", - "DELETE_REQUESTED" - ] + "SetIamPolicyRequest": { + "description": "Request message for `SetIamPolicy` method.", + "type": "object", + "properties": { + "policy": { + "description": "REQUIRED: The complete policy to be applied to the `resource`. The size of\nthe policy is limited to a few 10s of KB. An empty policy is a\nvalid policy but certain Cloud Platform services (such as Projects)\nmight reject them.", + "$ref": "Policy" + } + }, + "id": "SetIamPolicyRequest" + }, + "TestIamPermissionsResponse": { + "description": "Response message for `TestIamPermissions` method.", + "type": "object", + "properties": { + "permissions": { + "description": "A subset of `TestPermissionsRequest.permissions` that the caller is\nallowed.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "id": "TestIamPermissionsResponse" + }, + "Organization": { + "description": "The root node in the resource hierarchy to which a particular entity's\n(e.g., company) resources belong.", + "type": "object", + "properties": { + "lifecycleState": { + "description": "The organization's current lifecycle state. Assigned by the server.\n@OutputOnly", + "enum": [ + "LIFECYCLE_STATE_UNSPECIFIED", + "ACTIVE", + "DELETE_REQUESTED" + ], + "enumDescriptions": [ + "Unspecified state. This is only useful for distinguishing unset values.", + "The normal and active state.", + "The organization has been marked for deletion by the user." + ], + "type": "string" + }, + "displayName": { + "description": "A friendly string to be used to refer to the Organization in the UI.\nAssigned by the server, set to the firm name of the Google For Work\ncustomer that owns this organization.\n@OutputOnly", + "type": "string" + }, + "organizationId": { + "description": "An immutable id for the Organization that is assigned on creation. This\nshould be omitted when creating a new Organization.\nThis field is read-only.\nThis field is deprecated and will be removed in v1. Use name instead.", + "type": "string" + }, + "name": { + "description": "Output Only. The resource name of the organization. This is the\norganization's relative path in the API. Its format is\n\"organizations/[organization_id]\". For example, \"organizations/1234\".", + "type": "string" + }, + "creationTime": { + "description": "Timestamp when the Organization was created. Assigned by the server.\n@OutputOnly", + "type": "string", + "format": "google-datetime" + }, + "owner": { + "description": "The owner of this Organization. The owner should be specified on\ncreation. Once set, it cannot be changed.\nThis field is required.", + "$ref": "OrganizationOwner" + } + }, + "id": "Organization" + }, + "Policy": { + "description": "Defines an Identity and Access Management (IAM) policy. It is used to\nspecify access control policies for Cloud Platform resources.\n\n\nA `Policy` consists of a list of `bindings`. A `Binding` binds a list of\n`members` to a `role`, where the members can be user accounts, Google groups,\nGoogle domains, and service accounts. A `role` is a named list of permissions\ndefined by IAM.\n\n**Example**\n\n {\n \"bindings\": [\n {\n \"role\": \"roles/owner\",\n \"members\": [\n \"user:mike@example.com\",\n \"group:admins@example.com\",\n \"domain:google.com\",\n \"serviceAccount:my-other-app@appspot.gserviceaccount.com\",\n ]\n },\n {\n \"role\": \"roles/viewer\",\n \"members\": [\"user:sean@example.com\"]\n }\n ]\n }\n\nFor a description of IAM and its features, see the\n[IAM developer's guide](https://cloud.google.com/iam).", + "type": "object", + "properties": { + "bindings": { + "description": "Associates a list of `members` to a `role`.\nMultiple `bindings` must not be specified for the same `role`.\n`bindings` with no members will result in an error.", + "type": "array", + "items": { + "$ref": "Binding" + } + }, + "etag": { + "description": "`etag` is used for optimistic concurrency control as a way to help\nprevent simultaneous updates of a policy from overwriting each other.\nIt is strongly suggested that systems make use of the `etag` in the\nread-modify-write cycle to perform policy updates in order to avoid race\nconditions: An `etag` is returned in the response to `getIamPolicy`, and\nsystems are expected to put that etag in the request to `setIamPolicy` to\nensure that their change will be applied to the same version of the policy.\n\nIf no `etag` is provided in the call to `setIamPolicy`, then the existing\npolicy is overwritten blindly.", + "type": "string", + "format": "byte" + }, + "version": { + "description": "Version of the `Policy`. The default version is 0.", + "type": "integer", + "format": "int32" + } + }, + "id": "Policy" + }, + "ProjectCreationStatus": { + "description": "A status object which is used as the `metadata` field for the Operation\nreturned by CreateProject. It provides insight for when significant phases of\nProject creation have completed.", + "type": "object", + "properties": { + "ready": { + "description": "True if the project creation process is complete.", + "type": "boolean" + }, + "gettable": { + "description": "True if the project can be retrieved using GetProject. No other operations\non the project are guaranteed to work until the project creation is\ncomplete.", + "type": "boolean" + }, + "createTime": { + "description": "Creation time of the project creation workflow.", + "type": "string", + "format": "google-datetime" + } + }, + "id": "ProjectCreationStatus" + }, + "TestIamPermissionsRequest": { + "description": "Request message for `TestIamPermissions` method.", + "type": "object", + "properties": { + "permissions": { + "description": "The set of permissions to check for the `resource`. Permissions with\nwildcards (such as '*' or 'storage.*') are not allowed. For more\ninformation see\n[IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).", + "type": "array", + "items": { + "type": "string" + } + } + }, + "id": "TestIamPermissionsRequest" + }, + "ListOrganizationsResponse": { + "description": "The response returned from the `ListOrganizations` method.", + "type": "object", + "properties": { + "organizations": { + "description": "The list of Organizations that matched the list query, possibly paginated.", + "type": "array", + "items": { + "$ref": "Organization" + } + }, + "nextPageToken": { + "description": "A pagination token to be used to retrieve the next page of results. If the\nresult is too large to fit within the page size specified in the request,\nthis field will be set with a token that can be used to fetch the next page\nof results. If this field is empty, it indicates that this response\ncontains the last page of results.", + "type": "string" + } + }, + "id": "ListOrganizationsResponse" + }, + "GetAncestryRequest": { + "description": "The request sent to the\nGetAncestry\nmethod.", + "type": "object", + "properties": {}, + "id": "GetAncestryRequest" + }, + "GetAncestryResponse": { + "description": "Response from the GetAncestry method.", + "type": "object", + "properties": { + "ancestor": { + "description": "Ancestors are ordered from bottom to top of the resource hierarchy. The\nfirst ancestor is the project itself, followed by the project's parent,\netc.", + "type": "array", + "items": { + "$ref": "Ancestor" + } + } + }, + "id": "GetAncestryResponse" + }, + "Empty": { + "description": "A generic empty message that you can re-use to avoid defining duplicated\nempty messages in your APIs. A typical example is to use it as the request\nor the response type of an API method. For instance:\n\n service Foo {\n rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);\n }\n\nThe JSON representation for `Empty` is empty JSON object `{}`.", + "type": "object", + "properties": {}, + "id": "Empty" + }, + "Ancestor": { + "description": "Identifying information for a single ancestor of a project.", + "type": "object", + "properties": { + "resourceId": { + "description": "Resource id of the ancestor.", + "$ref": "ResourceId" + } + }, + "id": "Ancestor" + }, + "ResourceId": { + "description": "A container to reference an id for any resource type. A `resource` in Google\nCloud Platform is a generic term for something you (a developer) may want to\ninteract with through one of our API's. Some examples are an AppEngine app,\na Compute Engine instance, a Cloud SQL database, and so on.", + "type": "object", + "properties": { + "type": { + "description": "Required field representing the resource type this id is for.\nAt present, the valid types are \"project\" and \"organization\".", + "type": "string" + }, + "id": { + "description": "Required field for the type-specific id. This should correspond to the id\nused in the type-specific API's.", + "type": "string" + } + }, + "id": "ResourceId" + }, + "Project": { + "description": "A Project is a high-level Google Cloud Platform entity. It is a\ncontainer for ACLs, APIs, AppEngine Apps, VMs, and other\nGoogle Cloud Platform resources.", + "type": "object", + "properties": { + "parent": { + "description": "An optional reference to a parent Resource.\n\nThe only supported parent type is \"organization\". Once set, the parent\ncannot be modified. The `parent` can be set on creation or using the\n`UpdateProject` method; the end user must have the\n`resourcemanager.projects.create` permission on the parent.\n\nRead-write.", + "$ref": "ResourceId" + }, + "labels": { + "description": "The labels associated with this Project.\n\nLabel keys must be between 1 and 63 characters long and must conform\nto the following regular expression: \\[a-z\\](\\[-a-z0-9\\]*\\[a-z0-9\\])?.\n\nLabel values must be between 0 and 63 characters long and must conform\nto the regular expression (\\[a-z\\](\\[-a-z0-9\\]*\\[a-z0-9\\])?)?.\n\nNo more than 256 labels can be associated with a given resource.\n\nClients should store labels in a representation such as JSON that does not\ndepend on specific characters being disallowed.\n\nExample: \u003ccode\u003e\"environment\" : \"dev\"\u003c/code\u003e\n\nRead-write.", + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + "lifecycleState": { + "description": "The Project lifecycle state.\n\nRead-only.", + "enum": [ + "LIFECYCLE_STATE_UNSPECIFIED", + "ACTIVE", + "DELETE_REQUESTED", + "DELETE_IN_PROGRESS" + ], + "enumDescriptions": [ + "Unspecified state. This is only used/useful for distinguishing\nunset values.", + "The normal and active state.", + "The project has been marked for deletion by the user\n(by invoking DeleteProject)\nor by the system (Google Cloud Platform).\nThis can generally be reversed by invoking UndeleteProject.", + "This lifecycle state is no longer used and is not returned by the API." + ], + "type": "string" + }, + "createTime": { + "description": "Creation time.\n\nRead-only.", + "type": "string", + "format": "google-datetime" + }, + "name": { + "description": "The user-assigned display name of the Project.\nIt must be 4 to 30 characters.\nAllowed characters are: lowercase and uppercase letters, numbers,\nhyphen, single-quote, double-quote, space, and exclamation point.\n\nExample: \u003ccode\u003eMy Project\u003c/code\u003e\n\nRead-write.", + "type": "string" + }, + "projectNumber": { + "description": "The number uniquely identifying the project.\n\nExample: \u003ccode\u003e415104041262\u003c/code\u003e\n\nRead-only.", + "type": "string", + "format": "int64" + }, + "projectId": { + "description": "The unique, user-assigned ID of the Project.\nIt must be 6 to 30 lowercase letters, digits, or hyphens.\nIt must start with a letter.\nTrailing hyphens are prohibited.\n\nExample: \u003ccode\u003etokyo-rain-123\u003c/code\u003e\n\nRead-only after creation.", + "type": "string" + } + }, + "id": "Project" + }, + "Binding": { + "description": "Associates `members` with a `role`.", + "type": "object", + "properties": { + "members": { + "description": "Specifies the identities requesting access for a Cloud Platform resource.\n`members` can have the following values:\n\n* `allUsers`: A special identifier that represents anyone who is\n on the internet; with or without a Google account.\n\n* `allAuthenticatedUsers`: A special identifier that represents anyone\n who is authenticated with a Google account or a service account.\n\n* `user:{emailid}`: An email address that represents a specific Google\n account. For example, `alice@gmail.com` or `joe@example.com`.\n\n\n* `serviceAccount:{emailid}`: An email address that represents a service\n account. For example, `my-other-app@appspot.gserviceaccount.com`.\n\n* `group:{emailid}`: An email address that represents a Google group.\n For example, `admins@example.com`.\n\n* `domain:{domain}`: A Google Apps domain name that represents all the\n users of that domain. For example, `google.com` or `example.com`.\n\n", + "type": "array", + "items": { + "type": "string" + } + }, + "role": { + "description": "Role that is assigned to `members`.\nFor example, `roles/viewer`, `roles/editor`, or `roles/owner`.\nRequired", + "type": "string" + } + }, + "id": "Binding" + }, + "OrganizationOwner": { + "description": "The entity that owns an Organization. The lifetime of the Organization and\nall of its descendants are bound to the `OrganizationOwner`. If the\n`OrganizationOwner` is deleted, the Organization and all its descendants will\nbe deleted.", + "type": "object", + "properties": { + "directoryCustomerId": { + "description": "The Google for Work customer id used in the Directory API.", + "type": "string" + } + }, + "id": "OrganizationOwner" } - } }, - "OrganizationOwner": { - "id": "OrganizationOwner", - "type": "object", - "description": "The entity that owns an Organization. The lifetime of the Organization and all of its descendants are bound to the `OrganizationOwner`. If the `OrganizationOwner` is deleted, the Organization and all its descendants will be deleted.", - "properties": { - "directoryCustomerId": { - "type": "string", - "description": "The Google for Work customer id used in the Directory API." - } - } - } - }, - "resources": { - "projects": { - "methods": { - "create": { - "id": "cloudresourcemanager.projects.create", - "path": "v1beta1/projects", - "httpMethod": "POST", - "description": "Creates a Project resource. Initially, the Project resource is owned by its creator exclusively. The creator can later grant permission to others to read or update the Project. Several APIs are activated automatically for the Project, including Google Cloud Storage.", - "request": { - "$ref": "Project" - }, - "response": { - "$ref": "Project" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform" - ] - }, - "list": { - "id": "cloudresourcemanager.projects.list", - "path": "v1beta1/projects", - "httpMethod": "GET", - "description": "Lists Projects that are visible to the user and satisfy the specified filter. This method returns Projects in an unspecified order. New Projects do not necessarily appear at the end of the list.", - "parameters": { - "pageToken": { - "type": "string", - "description": "A pagination token returned from a previous call to ListProjects that indicates from where listing should continue. Optional.", - "location": "query" - }, - "pageSize": { - "type": "integer", - "description": "The maximum number of Projects to return in the response. The server can return fewer Projects than requested. If unspecified, server picks an appropriate default. Optional.", - "format": "int32", - "location": "query" - }, - "filter": { - "type": "string", - "description": "An expression for filtering the results of the request. Filter rules are case insensitive. The fields eligible for filtering are: + `name` + `id` + labels.key where *key* is the name of a label Some examples of using labels as filters: |Filter|Description| |------|-----------| |name:*|The project has a name.| |name:Howl|The project's name is `Howl` or `howl`.| |name:HOWL|Equivalent to above.| |NAME:howl|Equivalent to above.| |labels.color:*|The project has the label `color`.| |labels.color:red|The project's label `color` has the value `red`.| |labels.color:red label.size:big|The project's label `color` has the value `red` and its label `size` has the value `big`. Optional.", - "location": "query" - } - }, - "response": { - "$ref": "ListProjectsResponse" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only" - ] - }, - "get": { - "id": "cloudresourcemanager.projects.get", - "path": "v1beta1/projects/{projectId}", - "httpMethod": "GET", - "description": "Retrieves the Project identified by the specified `project_id` (for example, `my-project-123`). The caller must have read permissions for this Project.", - "parameters": { - "projectId": { - "type": "string", - "description": "The Project ID (for example, `my-project-123`). Required.", - "required": true, - "location": "path" - } - }, - "parameterOrder": [ - "projectId" - ], - "response": { - "$ref": "Project" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only" - ] - }, - "update": { - "id": "cloudresourcemanager.projects.update", - "path": "v1beta1/projects/{projectId}", - "httpMethod": "PUT", - "description": "Updates the attributes of the Project identified by the specified `project_id` (for example, `my-project-123`). The caller must have modify permissions for this Project.", - "parameters": { - "projectId": { - "type": "string", - "description": "The project ID (for example, `my-project-123`). Required.", - "required": true, - "location": "path" - } - }, - "parameterOrder": [ - "projectId" - ], - "request": { - "$ref": "Project" - }, - "response": { - "$ref": "Project" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform" - ] - }, - "delete": { - "id": "cloudresourcemanager.projects.delete", - "path": "v1beta1/projects/{projectId}", - "httpMethod": "DELETE", - "description": "Marks the Project identified by the specified `project_id` (for example, `my-project-123`) for deletion. This method will only affect the Project if the following criteria are met: + The Project does not have a billing account associated with it. + The Project has a lifecycle state of ACTIVE. This method changes the Project's lifecycle state from ACTIVE to DELETE_REQUESTED. The deletion starts at an unspecified time, at which point the project is no longer accessible. Until the deletion completes, you can check the lifecycle state checked by retrieving the Project with GetProject, and the Project remains visible to ListProjects. However, you cannot update the project. After the deletion completes, the Project is not retrievable by the GetProject and ListProjects methods. The caller must have modify permissions for this Project.", - "parameters": { - "projectId": { - "type": "string", - "description": "The Project ID (for example, `foo-bar-123`). Required.", - "required": true, - "location": "path" - } - }, - "parameterOrder": [ - "projectId" - ], - "response": { - "$ref": "Empty" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform" - ] - }, - "undelete": { - "id": "cloudresourcemanager.projects.undelete", - "path": "v1beta1/projects/{projectId}:undelete", - "httpMethod": "POST", - "description": "Restores the Project identified by the specified `project_id` (for example, `my-project-123`). You can only use this method for a Project that has a lifecycle state of DELETE_REQUESTED. After deletion starts, the Project cannot be restored. The caller must have modify permissions for this Project.", - "parameters": { - "projectId": { - "type": "string", - "description": "The project ID (for example, `foo-bar-123`). Required.", - "required": true, - "location": "path" - } - }, - "parameterOrder": [ - "projectId" - ], - "request": { - "$ref": "UndeleteProjectRequest" - }, - "response": { - "$ref": "Empty" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform" - ] - }, - "getAncestry": { - "id": "cloudresourcemanager.projects.getAncestry", - "path": "v1beta1/projects/{projectId}:getAncestry", - "httpMethod": "POST", - "description": "Gets a list of ancestors in the resource hierarchy for the Project identified by the specified `project_id` (for example, `my-project-123`). The caller must have read permissions for this Project.", - "parameters": { - "projectId": { - "type": "string", - "description": "The Project ID (for example, `my-project-123`). Required.", - "required": true, - "location": "path" - } - }, - "parameterOrder": [ - "projectId" - ], - "request": { - "$ref": "GetAncestryRequest" - }, - "response": { - "$ref": "GetAncestryResponse" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only" - ] - }, - "getIamPolicy": { - "id": "cloudresourcemanager.projects.getIamPolicy", - "path": "v1beta1/projects/{resource}:getIamPolicy", - "httpMethod": "POST", - "description": "Returns the IAM access control policy for the specified Project. Permission is denied if the policy or the resource does not exist.", - "parameters": { - "resource": { - "type": "string", - "description": "REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation.", - "required": true, - "location": "path" - } - }, - "parameterOrder": [ - "resource" - ], - "request": { - "$ref": "GetIamPolicyRequest" - }, - "response": { - "$ref": "Policy" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only" - ] - }, - "setIamPolicy": { - "id": "cloudresourcemanager.projects.setIamPolicy", - "path": "v1beta1/projects/{resource}:setIamPolicy", - "httpMethod": "POST", - "description": "Sets the IAM access control policy for the specified Project. Replaces any existing policy. The following constraints apply when using `setIamPolicy()`: + Project does not support `allUsers` and `allAuthenticatedUsers` as `members` in a `Binding` of a `Policy`. + The owner role can be granted only to `user` and `serviceAccount`. + Service accounts can be made owners of a project directly without any restrictions. However, to be added as an owner, a user must be invited via Cloud Platform console and must accept the invitation. + A user cannot be granted the owner role using `setIamPolicy()`. The user must be granted the owner role using the Cloud Platform Console and must explicitly accept the invitation. + Invitations to grant the owner role cannot be sent using `setIamPolicy()`; they must be sent only using the Cloud Platform Console. + Membership changes that leave the project without any owners that have accepted the Terms of Service (ToS) will be rejected. + Members cannot be added to more than one role in the same policy. + There must be at least one owner who has accepted the Terms of Service (ToS) agreement in the policy. Calling `setIamPolicy()` to to remove the last ToS-accepted owner from the policy will fail. This restriction also applies to legacy projects that no longer have owners who have accepted the ToS. Edits to IAM policies will be rejected until the lack of a ToS-accepting owner is rectified. + Calling this method requires enabling the App Engine Admin API. Note: Removing service accounts from policies or changing their roles can render services completely inoperable. It is important to understand how the service account is being used before removing or updating its roles.", - "parameters": { - "resource": { - "type": "string", - "description": "REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `setIamPolicy` documentation.", - "required": true, - "location": "path" - } - }, - "parameterOrder": [ - "resource" - ], - "request": { - "$ref": "SetIamPolicyRequest" - }, - "response": { - "$ref": "Policy" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform" - ] - }, - "testIamPermissions": { - "id": "cloudresourcemanager.projects.testIamPermissions", - "path": "v1beta1/projects/{resource}:testIamPermissions", - "httpMethod": "POST", - "description": "Returns permissions that a caller has on the specified Project.", - "parameters": { - "resource": { - "type": "string", - "description": "REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `testIamPermissions` documentation.", - "required": true, - "location": "path" - } - }, - "parameterOrder": [ - "resource" - ], - "request": { - "$ref": "TestIamPermissionsRequest" - }, - "response": { - "$ref": "TestIamPermissionsResponse" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only" - ] - } - } + "revision": "20161212", + "basePath": "", + "icons": { + "x32": "http://www.google.com/images/icons/product/search-32.gif", + "x16": "http://www.google.com/images/icons/product/search-16.gif" }, - "organizations": { - "methods": { - "list": { - "id": "cloudresourcemanager.organizations.list", - "path": "v1beta1/organizations", - "httpMethod": "GET", - "description": "Lists Organization resources that are visible to the user and satisfy the specified filter. This method returns Organizations in an unspecified order. New Organizations do not necessarily appear at the end of the list.", - "parameters": { - "pageSize": { - "type": "integer", - "description": "The maximum number of Organizations to return in the response. This field is optional.", - "format": "int32", - "location": "query" - }, - "pageToken": { - "type": "string", - "description": "A pagination token returned from a previous call to `ListOrganizations` that indicates from where listing should continue. This field is optional.", - "location": "query" - }, - "filter": { - "type": "string", - "description": "An optional query string used to filter the Organizations to return in the response. Filter rules are case-insensitive. Organizations may be filtered by `owner.directoryCustomerId` or by `domain`, where the domain is a Google for Work domain, for example: |Filter|Description| |------|-----------| |owner.directorycustomerid:123456789|Organizations with `owner.directory_customer_id` equal to `123456789`.| |domain:google.com|Organizations corresponding to the domain `google.com`.| This field is optional.", - "location": "query" - } - }, - "response": { - "$ref": "ListOrganizationsResponse" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only" - ] + "canonicalName": "Cloud Resource Manager", + "discoveryVersion": "v1", + "baseUrl": "https://cloudresourcemanager.googleapis.com/", + "name": "cloudresourcemanager", + "parameters": { + "access_token": { + "description": "OAuth access token.", + "type": "string", + "location": "query" }, - "get": { - "id": "cloudresourcemanager.organizations.get", - "path": "v1beta1/{+name}", - "httpMethod": "GET", - "description": "Fetches an Organization resource identified by the specified resource name.", - "parameters": { - "name": { - "type": "string", - "description": "The resource name of the Organization to fetch. Its format is \"organizations/[organization_id]\". For example, \"organizations/1234\".", - "required": true, - "pattern": "^organizations/[^/]*$", - "location": "path" - }, - "organizationId": { - "type": "string", - "description": "The id of the Organization resource to fetch. This field is deprecated and will be removed in v1. Use name instead.", - "location": "query" - } - }, - "parameterOrder": [ - "name" - ], - "response": { - "$ref": "Organization" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only" - ] + "prettyPrint": { + "description": "Returns response with indentations and line breaks.", + "default": "true", + "type": "boolean", + "location": "query" }, - "update": { - "id": "cloudresourcemanager.organizations.update", - "path": "v1beta1/{+name}", - "httpMethod": "PUT", - "description": "Updates an Organization resource identified by the specified resource name.", - "parameters": { - "name": { - "type": "string", - "description": "Output Only. The resource name of the organization. This is the organization's relative path in the API. Its format is \"organizations/[organization_id]\". For example, \"organizations/1234\".", - "required": true, - "pattern": "^organizations/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "name" - ], - "request": { - "$ref": "Organization" - }, - "response": { - "$ref": "Organization" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform" - ] + "key": { + "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", + "type": "string", + "location": "query" }, - "setIamPolicy": { - "id": "cloudresourcemanager.organizations.setIamPolicy", - "path": "v1beta1/{+resource}:setIamPolicy", - "httpMethod": "POST", - "description": "Sets the access control policy on an Organization resource. Replaces any existing policy. The `resource` field should be the organization's resource name, e.g. \"organizations/123\". For backward compatibility, the resource provided may also be the organization_id. This will not be supported in v1.", - "parameters": { - "resource": { - "type": "string", - "description": "REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `setIamPolicy` documentation.", - "required": true, - "pattern": "^organizations/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "resource" - ], - "request": { - "$ref": "SetIamPolicyRequest" - }, - "response": { - "$ref": "Policy" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform" - ] + "quotaUser": { + "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.", + "type": "string", + "location": "query" }, - "getIamPolicy": { - "id": "cloudresourcemanager.organizations.getIamPolicy", - "path": "v1beta1/{+resource}:getIamPolicy", - "httpMethod": "POST", - "description": "Gets the access control policy for an Organization resource. May be empty if no such policy or resource exists. The `resource` field should be the organization's resource name, e.g. \"organizations/123\". For backward compatibility, the resource provided may also be the organization_id. This will not be supported in v1.", - "parameters": { - "resource": { - "type": "string", - "description": "REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation.", - "required": true, - "pattern": "^organizations/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "resource" - ], - "request": { - "$ref": "GetIamPolicyRequest" - }, - "response": { - "$ref": "Policy" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only" - ] + "pp": { + "description": "Pretty-print response.", + "default": "true", + "type": "boolean", + "location": "query" }, - "testIamPermissions": { - "id": "cloudresourcemanager.organizations.testIamPermissions", - "path": "v1beta1/{+resource}:testIamPermissions", - "httpMethod": "POST", - "description": "Returns permissions that a caller has on the specified Organization. The `resource` field should be the organization's resource name, e.g. \"organizations/123\". For backward compatibility, the resource provided may also be the organization_id. This will not be supported in v1.", - "parameters": { - "resource": { - "type": "string", - "description": "REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `testIamPermissions` documentation.", - "required": true, - "pattern": "^organizations/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "resource" - ], - "request": { - "$ref": "TestIamPermissionsRequest" - }, - "response": { - "$ref": "TestIamPermissionsResponse" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only" - ] + "fields": { + "description": "Selector specifying which fields to include in a partial response.", + "type": "string", + "location": "query" + }, + "alt": { + "description": "Data format for response.", + "location": "query", + "enum": [ + "json", + "media", + "proto" + ], + "default": "json", + "enumDescriptions": [ + "Responses with Content-Type of application/json", + "Media download with context-dependent Content-Type", + "Responses with Content-Type of application/x-protobuf" + ], + "type": "string" + }, + "$.xgafv": { + "description": "V1 error format.", + "enum": [ + "1", + "2" + ], + "enumDescriptions": [ + "v1 error format", + "v2 error format" + ], + "type": "string", + "location": "query" + }, + "callback": { + "description": "JSONP", + "type": "string", + "location": "query" + }, + "oauth_token": { + "description": "OAuth 2.0 token for the current user.", + "type": "string", + "location": "query" + }, + "uploadType": { + "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").", + "type": "string", + "location": "query" + }, + "bearer_token": { + "description": "OAuth bearer token.", + "type": "string", + "location": "query" + }, + "upload_protocol": { + "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").", + "type": "string", + "location": "query" } - } - } - } + }, + "documentationLink": "https://cloud.google.com/resource-manager", + "ownerDomain": "google.com", + "batchPath": "batch", + "servicePath": "", + "ownerName": "Google", + "version": "v1beta1", + "rootUrl": "https://cloudresourcemanager.googleapis.com/", + "kind": "discovery#restDescription" } diff --git a/etc/api/cloudtrace/v1/cloudtrace-api.json b/etc/api/cloudtrace/v1/cloudtrace-api.json index fd8cc0f1a8..3d84328020 100644 --- a/etc/api/cloudtrace/v1/cloudtrace-api.json +++ b/etc/api/cloudtrace/v1/cloudtrace-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/avS4leRd3oaImhwLi14P2pt74p0\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/avS4leRd3oaImhwLi14P2pt74p0\"", "discoveryVersion": "v1", "id": "cloudtrace:v1", "name": "cloudtrace", diff --git a/etc/api/clouduseraccounts/alpha/clouduseraccounts-api.json b/etc/api/clouduseraccounts/alpha/clouduseraccounts-api.json index 50bb82e510..8dc8f7c9b5 100644 --- a/etc/api/clouduseraccounts/alpha/clouduseraccounts-api.json +++ b/etc/api/clouduseraccounts/alpha/clouduseraccounts-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/lOQeocShB0dxGwrtxzB56jZ95Xk\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/lOQeocShB0dxGwrtxzB56jZ95Xk\"", "discoveryVersion": "v1", "id": "clouduseraccounts:alpha", "name": "clouduseraccounts", diff --git a/etc/api/clouduseraccounts/beta/clouduseraccounts-api.json b/etc/api/clouduseraccounts/beta/clouduseraccounts-api.json index d1b8b74f9e..d12b9ca88a 100644 --- a/etc/api/clouduseraccounts/beta/clouduseraccounts-api.json +++ b/etc/api/clouduseraccounts/beta/clouduseraccounts-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/-BiORd5nMN3AbHTR5Pi2H1JslEk\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/-BiORd5nMN3AbHTR5Pi2H1JslEk\"", "discoveryVersion": "v1", "id": "clouduseraccounts:beta", "name": "clouduseraccounts", diff --git a/etc/api/clouduseraccounts/vm_alpha/clouduseraccounts-api.json b/etc/api/clouduseraccounts/vm_alpha/clouduseraccounts-api.json index 6226aa586a..c6acddcea0 100644 --- a/etc/api/clouduseraccounts/vm_alpha/clouduseraccounts-api.json +++ b/etc/api/clouduseraccounts/vm_alpha/clouduseraccounts-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/DmNFUFGhSh7oLg7RNX5k36KX4oA\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/DmNFUFGhSh7oLg7RNX5k36KX4oA\"", "discoveryVersion": "v1", "id": "clouduseraccounts:vm_alpha", "name": "clouduseraccounts", diff --git a/etc/api/clouduseraccounts/vm_beta/clouduseraccounts-api.json b/etc/api/clouduseraccounts/vm_beta/clouduseraccounts-api.json index 3dc412191d..ec17945bb3 100644 --- a/etc/api/clouduseraccounts/vm_beta/clouduseraccounts-api.json +++ b/etc/api/clouduseraccounts/vm_beta/clouduseraccounts-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/NOgAExjYfIWiV_BL3FlcslmjncY\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/NOgAExjYfIWiV_BL3FlcslmjncY\"", "discoveryVersion": "v1", "id": "clouduseraccounts:vm_beta", "name": "clouduseraccounts", diff --git a/etc/api/compute/alpha/compute-api.json b/etc/api/compute/alpha/compute-api.json index d10adb0ecb..88bc55a65b 100644 --- a/etc/api/compute/alpha/compute-api.json +++ b/etc/api/compute/alpha/compute-api.json @@ -1,11 +1,11 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/cBm-zqTwhARaUrplDwCjl-Uk8_E\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/PUmw8QSO_Lc3hgCFrHiAOjjNG38\"", "discoveryVersion": "v1", "id": "compute:alpha", "name": "compute", "version": "alpha", - "revision": "20160908", + "revision": "20161123", "title": "Compute Engine API", "description": "Creates and runs virtual machines on Google Cloud Platform.", "ownerDomain": "google.com", @@ -96,6 +96,10 @@ "type": "object", "description": "An access configuration attached to an instance's network interface. Only one access config per instance is supported.", "properties": { + "dnsName": { + "type": "string", + "description": "[Output Only] The public DNS domain name for the instance." + }, "kind": { "type": "string", "description": "[Output Only] Type of the resource. Always compute#accessConfig for access configs.", @@ -109,6 +113,30 @@ "type": "string", "description": "An external IP address associated with this instance. Specify an unused static external IP address available to the project or leave this field undefined to use an IP from a shared ephemeral IP address pool. If you specify a static external IP address, it must live in the same region as the zone of the instance." }, + "networkTier": { + "type": "string", + "description": "This signifies the networking tier used for configuring this access configuration and can only take the following values: CLOUD_NETWORK_PREMIUM , CLOUD_NETWORK_STANDARD. If this field is not specified, it is assumed to be CLOUD_NETWORK_PREMIUM.", + "enum": [ + "CLOUD_NETWORK_PREMIUM", + "CLOUD_NETWORK_STANDARD" + ], + "enumDescriptions": [ + "", + "" + ] + }, + "ptrDomainName": { + "type": "string", + "description": "The DNS domain name for the public PTR record. This field can only be set when the set_ptr field is enabled." + }, + "setPtr": { + "type": "boolean", + "description": "Specifies whether a public DNS ?PTR? record should be created to map the external IP address of the instance to a DNS domain name." + }, + "setPublicDns": { + "type": "boolean", + "description": "Specifies whether a public DNS ?A? record should be created for the external IP address of this access configuration." + }, "type": { "type": "string", "description": "The type of configuration. The default and only option is ONE_TO_ONE_NAT.", @@ -149,6 +177,18 @@ "description": "[Output Only] Type of the resource. Always compute#address for addresses.", "default": "compute#address" }, + "labelFingerprint": { + "type": "string", + "description": "A fingerprint for the labels being applied to this Address, which is essentially a hash of the labels set used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash in order to update or change labels.\n\nTo see the latest fingerprint, make a get() request to retrieve an Address.", + "format": "byte" + }, + "labels": { + "type": "object", + "description": "Labels to apply to this Address resource. These can be later modified by the setLabels method. Each label key/value must comply with RFC1035. Label values may be empty.", + "additionalProperties": { + "type": "string" + } + }, "name": { "type": "string", "description": "Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.", @@ -159,6 +199,18 @@ ] } }, + "networkTier": { + "type": "string", + "description": "This signifies the networking tier used for configuring this Address and can only take the following values: CLOUD_NETWORK_PREMIUM , CLOUD_NETWORK_STANDARD. If this field is not specified, it is assumed to be CLOUD_NETWORK_PREMIUM.", + "enum": [ + "CLOUD_NETWORK_PREMIUM", + "CLOUD_NETWORK_STANDARD" + ], + "enumDescriptions": [ + "", + "" + ] + }, "region": { "type": "string", "description": "[Output Only] URL of the region where the regional address resides. This field is not applicable to global addresses." @@ -330,6 +382,21 @@ } } }, + "AliasIpRange": { + "id": "AliasIpRange", + "type": "object", + "description": "An alias IP range attached to an instance's network interface.", + "properties": { + "ipCidrRange": { + "type": "string", + "description": "The IP CIDR range represented by this alias IP range. This IP CIDR range must belong to the specified subnetwork and cannot contain IP addresses reserved by system or used by other network interfaces. This range may be a single IP address (e.g. 10.2.3.4), a netmask (e.g. /24) or a CIDR format string (e.g. 10.1.2.0/24)." + }, + "subnetworkRangeName": { + "type": "string", + "description": "Optional subnetwork secondary range name specifying the secondary range from which to allocate the IP CIDR range for this alias IP range. If left unspecified, the primary range of the subnetwork will be used." + } + } + }, "AttachedDisk": { "id": "AttachedDisk", "type": "object", @@ -351,6 +418,11 @@ "$ref": "CustomerEncryptionKey", "description": "Encrypts or decrypts a disk using a customer-supplied encryption key.\n\nIf you are creating a new disk, this field encrypts the new disk using an encryption key that you provide. If you are attaching an existing disk that is already encrypted, this field decrypts the disk using the customer-supplied encryption key.\n\nIf you encrypt a disk using a customer-supplied key, you must provide the same key again when you attempt to use this resource at a later time. For example, you must provide the key when you create a snapshot or an image from the disk or when you attach the disk to a virtual machine instance.\n\nIf you do not provide an encryption key, then the disk will be encrypted using an automatically generated key and you do not need to provide a key to use the disk later.\n\nInstance templates do not store customer-supplied encryption keys, so you cannot use your own keys to encrypt disks in a managed instance group." }, + "diskSizeGb": { + "type": "string", + "description": "The size of the disk in base-2 GB. This supersedes disk_size_gb in InitializeParams.", + "format": "int64" + }, "index": { "type": "integer", "description": "Assigns a zero-based index to this disk, where 0 is reserved for the boot disk. For example, if you have many disks attached to an instance, each disk would have a unique index number. If not specified, the server will choose an appropriate value.", @@ -398,7 +470,7 @@ }, "source": { "type": "string", - "description": "Specifies a valid partial or full URL to an existing Persistent Disk resource. This field is only applicable for persistent disks. Note that for InstanceTemplate, it is just disk name, not URL for the disk." + "description": "Specifies a valid partial or full URL to an existing Persistent Disk resource. When creating a new instance, one of initializeParams.sourceImage or disks.source is required.\n\nIf desired, you can also attach existing non-root persistent disks using this property. This field is only applicable for persistent disks.\n\nNote that for InstanceTemplate, specify the disk name, not the URL for the disk." }, "type": { "type": "string", @@ -451,7 +523,7 @@ }, "sourceImage": { "type": "string", - "description": "The source image used to create this disk. If the source image is deleted, this field will not be set.\n\nTo create a disk with one of the public operating system images, specify the image by its family name. For example, specify family/debian-8 to use the latest Debian 8 image:\n\nprojects/debian-cloud/global/images/family/debian-8 \n\nAlternatively, use a specific version of a public operating system image:\n\nprojects/debian-cloud/global/images/debian-8-jessie-vYYYYMMDD \n\nTo create a disk with a private image that you created, specify the image name in the following format:\n\nglobal/images/my-private-image \n\nYou can also specify a private image by its image family, which returns the latest version of the image in that family. Replace the image name with family/family-name:\n\nglobal/images/family/my-private-family" + "description": "The source image to create this disk. When creating a new instance, one of initializeParams.sourceImage or disks.source is required.\n\nTo create a disk with one of the public operating system images, specify the image by its family name. For example, specify family/debian-8 to use the latest Debian 8 image:\n\nprojects/debian-cloud/global/images/family/debian-8 \n\nAlternatively, use a specific version of a public operating system image:\n\nprojects/debian-cloud/global/images/debian-8-jessie-vYYYYMMDD \n\nTo create a disk with a private image that you created, specify the image name in the following format:\n\nglobal/images/my-private-image \n\nYou can also specify a private image by its image family, which returns the latest version of the image in that family. Replace the image name with family/family-name:\n\nglobal/images/family/my-private-family \n\nIf the source image is deleted later, this field will not be set." }, "sourceImageEncryptionKey": { "$ref": "CustomerEncryptionKey", @@ -462,8 +534,15 @@ "AuditConfig": { "id": "AuditConfig", "type": "object", - "description": "Enables \"data access\" audit logging for a service and specifies a list of members that are log-exempted.", + "description": "Provides the configuration for non-admin_activity logging for a service. Controls exemptions and specific log sub-types.", "properties": { + "auditLogConfigs": { + "type": "array", + "description": "The configuration for each type of logging", + "items": { + "$ref": "AuditLogConfig" + } + }, "exemptedMembers": { "type": "array", "description": "Specifies the identities that are exempted from \"data access\" audit logging for the `service` specified above. Follows the same format of Binding.members.", @@ -473,7 +552,37 @@ }, "service": { "type": "string", - "description": "Specifies a service that will be enabled for \"data access\" audit logging. For example, `resourcemanager`, `storage`, `compute`. `allServices` is a special value that covers all services." + "description": "Specifies a service that will be enabled for audit logging. For example, `resourcemanager`, `storage`, `compute`. `allServices` is a special value that covers all services." + } + } + }, + "AuditLogConfig": { + "id": "AuditLogConfig", + "type": "object", + "description": "Provides the configuration for a sub-type of logging.", + "properties": { + "exemptedMembers": { + "type": "array", + "description": "Specifies the identities that are exempted from this type of logging Follows the same format of Binding.members.", + "items": { + "type": "string" + } + }, + "logType": { + "type": "string", + "description": "The log type that this config enables.", + "enum": [ + "ADMIN_READ", + "DATA_READ", + "DATA_WRITE", + "LOG_TYPE_UNSPECIFIED" + ], + "enumDescriptions": [ + "", + "", + "", + "" + ] } } }, @@ -540,7 +649,7 @@ }, "statusDetails": { "type": "array", - "description": "[Output Only] Human-readable details about the current state of the autoscaler. Examples: ?Error when fetching replicas: Replica Pool xxx doesn?t exist.? ?Autoscaling capped at min_num_replicas: 2.?", + "description": "[Output Only] Human-readable details about the current state of the autoscaler. Read the documentation for Commonly returned status messages for examples of status messages you might encounter.", "items": { "$ref": "AutoscalerStatusDetails" } @@ -622,10 +731,12 @@ "type": "object", "properties": { "message": { - "type": "string" + "type": "string", + "description": "The status message." }, "type": { "type": "string", + "description": "The type of error returned.", "enum": [ "ALL_INSTANCES_UNHEALTHY", "BACKEND_SERVICE_DOES_NOT_EXIST", @@ -799,7 +910,7 @@ "properties": { "metric": { "type": "string", - "description": "The identifier of the Cloud Monitoring metric. The metric cannot have negative values and should be a utilization metric, which means that the number of virtual machines handling requests should increase or decrease proportionally to the metric. The metric must also have a label of compute.googleapis.com/resource_id with the value of the instance's unique ID, although this alone does not guarantee that the metric is valid.\n\nFor example, the following is a valid metric:\ncompute.googleapis.com/instance/network/received_bytes_count\n\n\nThe following is not a valid metric because it does not increase or decrease based on usage:\ncompute.googleapis.com/instance/cpu/reserved_cores" + "description": "The identifier of the Stackdriver Monitoring metric. The metric cannot have negative values and should be a utilization metric, which means that the number of virtual machines handling requests should increase or decrease proportionally to the metric. The metric must also have a label of compute.googleapis.com/resource_id with the value of the instance's unique ID, although this alone does not guarantee that the metric is valid.\n\nFor example, the following is a valid metric:\ncompute.googleapis.com/instance/network/received_bytes_count\nThe following is not a valid metric because it does not increase or decrease based on usage:\ncompute.googleapis.com/instance/cpu/reserved_cores" }, "utilizationTarget": { "type": "number", @@ -808,7 +919,7 @@ }, "utilizationTargetType": { "type": "string", - "description": "Defines how target utilization value is expressed for a Cloud Monitoring metric. Either GAUGE, DELTA_PER_SECOND, or DELTA_PER_MINUTE. If not specified, the default is GAUGE.", + "description": "Defines how target utilization value is expressed for a Stackdriver Monitoring metric. Either GAUGE, DELTA_PER_SECOND, or DELTA_PER_MINUTE. If not specified, the default is GAUGE.", "enum": [ "DELTA_PER_MINUTE", "DELTA_PER_SECOND", @@ -898,6 +1009,10 @@ "type": "string", "description": "An optional description of this resource. Provide this property when you create the resource." }, + "failover": { + "type": "boolean", + "description": "This field designates whether this is a failover backend. More than one failover backend can be configured for a given BackendService." + }, "group": { "type": "string", "description": "The fully-qualified URL of a zonal Instance Group resource. This instance group defines the list of instances that serve traffic. Member virtual machine instances from each instance group must live in the same zone as the instance group itself. No two backends in a backend service are allowed to use same Instance Group resource.\n\nNote that you must specify an Instance Group resource using the fully-qualified URL, rather than a partial URL.\n\nWhen the BackendService has load balancing scheme INTERNAL, the instance group must be in a zone within the same region as the BackendService." @@ -1037,6 +1152,10 @@ "$ref": "Backend" } }, + "cdnPolicy": { + "$ref": "BackendServiceCdnPolicy", + "description": "Cloud CDN configuration for this BackendService." + }, "connectionDraining": { "$ref": "ConnectionDraining" }, @@ -1044,6 +1163,13 @@ "type": "string", "description": "[Output Only] Creation timestamp in RFC3339 text format." }, + "customRequestHeaders": { + "type": "array", + "description": "Headers that the HTTP/S load balancer should add to proxied requests.", + "items": { + "type": "string" + } + }, "description": { "type": "string", "description": "An optional description of this resource. Provide this property when you create the resource." @@ -1064,8 +1190,8 @@ "type": "string" } }, - "iaap": { - "$ref": "BackendServiceIAAP" + "iap": { + "$ref": "BackendServiceIAP" }, "id": { "type": "string", @@ -1109,6 +1235,7 @@ "description": "The protocol this BackendService uses to communicate with backends.\n\nPossible values are HTTP, HTTPS, HTTP2, TCP and SSL. The default is HTTP.\n\nFor internal load balancing, the possible values are TCP and UDP, and the default is TCP.", "enum": [ "HTTP", + "HTTP2", "HTTPS", "SSL", "TCP", @@ -1119,6 +1246,7 @@ "", "", "", + "", "" ] }, @@ -1187,6 +1315,17 @@ } } }, + "BackendServiceCdnPolicy": { + "id": "BackendServiceCdnPolicy", + "type": "object", + "description": "Message containing Cloud CDN configuration for a backend service.", + "properties": { + "cacheKeyPolicy": { + "$ref": "CacheKeyPolicy", + "description": "The CacheKeyPolicy for this CdnPolicy." + } + } + }, "BackendServiceGroupHealth": { "id": "BackendServiceGroupHealth", "type": "object", @@ -1204,10 +1343,10 @@ } } }, - "BackendServiceIAAP": { - "id": "BackendServiceIAAP", + "BackendServiceIAP": { + "id": "BackendServiceIAP", "type": "object", - "description": "Identity Aware Application Proxy (Cloud Gatekeeper)", + "description": "Identity-Aware Proxy (Cloud Gatekeeper)", "properties": { "enabled": { "type": "boolean" @@ -1341,7 +1480,7 @@ "properties": { "members": { "type": "array", - "description": "Specifies the identities requesting access for a Cloud Platform resource. `members` can have the following values:\n\n* `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account.\n\n* `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account.\n\n* `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@gmail.com` or `joe@example.com`.\n\n* `serviceAccount:{emailid}`: An email address that represents a service account. For example, `my-other-app@appspot.gserviceaccount.com`.\n\n* `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`.\n\n* `domain:{domain}`: A Google Apps domain name that represents all the users of that domain. For example, `google.com` or `example.com`.", + "description": "Specifies the identities requesting access for a Cloud Platform resource. `members` can have the following values:\n\n* `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account.\n\n* `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account.\n\n* `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@gmail.com` or `joe@example.com`.\n\n\n\n* `serviceAccount:{emailid}`: An email address that represents a service account. For example, `my-other-app@appspot.gserviceaccount.com`.\n\n* `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`.\n\n* `domain:{domain}`: A Google Apps domain name that represents all the users of that domain. For example, `google.com` or `example.com`.", "items": { "type": "string" } @@ -1358,13 +1497,280 @@ "properties": { "host": { "type": "string", - "description": "If host is non-empty, this invalidation rule will only apply to requests with a Host header matching host." + "description": "If set, this invalidation rule will only apply to requests with a Host header matching host." }, "path": { "type": "string" } } }, + "CacheKeyPolicy": { + "id": "CacheKeyPolicy", + "type": "object", + "description": "Message containing what to include in the cache key for a request for Cloud CDN.", + "properties": { + "includeHost": { + "type": "boolean", + "description": "If true, requests to different hosts will be cached separately." + }, + "includeProtocol": { + "type": "boolean", + "description": "If true, http and https requests will be cached separately." + }, + "includeQueryString": { + "type": "boolean", + "description": "If true, include query string parameters in the cache key according to query_string_whitelist and query_string_blacklist. If neither is set, the entire query string will be included. If false, the query string will be excluded from the cache key entirely." + }, + "queryStringBlacklist": { + "type": "array", + "description": "Names of query string parameters to exclude in cache keys. All other parameters will be included. Either specify query_string_whitelist or query_string_blacklist, not both. '&' and '=' will be percent encoded and not treated as delimiters.", + "items": { + "type": "string" + } + }, + "queryStringWhitelist": { + "type": "array", + "description": "Names of query string parameters to include in cache keys. All other parameters will be excluded. Either specify query_string_whitelist or query_string_blacklist, not both. '&' and '=' will be percent encoded and not treated as delimiters.", + "items": { + "type": "string" + } + } + } + }, + "Commitment": { + "id": "Commitment", + "type": "object", + "description": "A usage-commitment with a start / end time. Users create commitments for particular resources (e.g. memory). Actual usage is first deducted from available commitments made prior, perhaps at a reduced price (as laid out in the commitment).", + "properties": { + "creationTimestamp": { + "type": "string", + "description": "[Output Only] Creation timestamp in RFC3339 text format." + }, + "description": { + "type": "string", + "description": "An optional description of this resource. Provide this property when you create the resource." + }, + "endTimestamp": { + "type": "string", + "description": "[Output Only] Commitment end time in RFC3339 text format." + }, + "id": { + "type": "string", + "description": "[Output Only] The unique identifier for the resource. This identifier is defined by the server.", + "format": "uint64" + }, + "kind": { + "type": "string", + "description": "[Output Only] Type of the resource. Always compute#commitment for commitments.", + "default": "compute#commitment" + }, + "name": { + "type": "string", + "description": "Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.", + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "annotations": { + "required": [ + "compute.commitments.insert" + ] + } + }, + "plan": { + "type": "string", + "description": "The plan for this commitment, which determines duration and discount rate. The currently supported plans are TWELVE_MONTH (1 year), and THIRTY_SIX_MONTH (3 years).", + "enum": [ + "INVALID", + "THIRTY_SIX_MONTH", + "TWELVE_MONTH" + ], + "enumDescriptions": [ + "", + "", + "" + ] + }, + "resources": { + "type": "array", + "description": "List of commitment amounts for particular resources. Note that VCPU and MEMORY resource commitments must occur together.", + "items": { + "$ref": "ResourceCommitment" + } + }, + "selfLink": { + "type": "string", + "description": "[Output Only] Server-defined URL for the resource." + }, + "startTimestamp": { + "type": "string", + "description": "[Output Only] Commitment start time in RFC3339 text format." + }, + "status": { + "type": "string", + "description": "[Output Only] Status of the commitment with regards to eventual expiration (each commitment has an end-date defined). One of the following values: NOT_YET_ACTIVE, ACTIVE, EXPIRED.", + "enum": [ + "ACTIVE", + "CREATING", + "EXPIRED", + "NOT_YET_ACTIVE" + ], + "enumDescriptions": [ + "", + "", + "", + "" + ] + }, + "statusMessage": { + "type": "string", + "description": "[Output Only] An optional, human-readable explanation of the status." + }, + "zone": { + "type": "string", + "description": "[Output Only] URL of the zone where this commitment may be used." + } + } + }, + "CommitmentAggregatedList": { + "id": "CommitmentAggregatedList", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "[Output Only] The unique identifier for the resource. This identifier is defined by the server." + }, + "items": { + "type": "object", + "description": "Commitments by scope.", + "additionalProperties": { + "$ref": "CommitmentsScopedList", + "description": "[Output Only] Name of the scope containing this set of commitments." + } + }, + "kind": { + "type": "string", + "description": "[Output Only] Type of resource. Always compute#commitmentAggregatedList for aggregated lists of commitments.", + "default": "compute#commitmentAggregatedList" + }, + "nextPageToken": { + "type": "string", + "description": "[Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results." + }, + "selfLink": { + "type": "string", + "description": "[Output Only] Server-defined URL for this resource." + } + } + }, + "CommitmentList": { + "id": "CommitmentList", + "type": "object", + "description": "Contains a list of Commitment resources.", + "properties": { + "id": { + "type": "string", + "description": "[Output Only] The unique identifier for the resource. This identifier is defined by the server." + }, + "items": { + "type": "array", + "description": "A list of Commitment resources.", + "items": { + "$ref": "Commitment" + } + }, + "kind": { + "type": "string", + "description": "[Output Only] Type of resource. Always compute#commitmentList for lists of commitments.", + "default": "compute#commitmentList" + }, + "nextPageToken": { + "type": "string", + "description": "[Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results." + }, + "selfLink": { + "type": "string", + "description": "[Output Only] Server-defined URL for this resource." + } + } + }, + "CommitmentsScopedList": { + "id": "CommitmentsScopedList", + "type": "object", + "properties": { + "commitments": { + "type": "array", + "description": "[Output Only] List of commitments contained in this scope.", + "items": { + "$ref": "Commitment" + } + }, + "warning": { + "type": "object", + "description": "[Output Only] Informational warning which replaces the list of commitments when the list is empty.", + "properties": { + "code": { + "type": "string", + "description": "[Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response.", + "enum": [ + "CLEANUP_FAILED", + "DEPRECATED_RESOURCE_USED", + "DISK_SIZE_LARGER_THAN_IMAGE_SIZE", + "FIELD_VALUE_OVERRIDEN", + "INJECTED_KERNELS_DEPRECATED", + "NEXT_HOP_ADDRESS_NOT_ASSIGNED", + "NEXT_HOP_CANNOT_IP_FORWARD", + "NEXT_HOP_INSTANCE_NOT_FOUND", + "NEXT_HOP_INSTANCE_NOT_ON_NETWORK", + "NEXT_HOP_NOT_RUNNING", + "NOT_CRITICAL_ERROR", + "NO_RESULTS_ON_PAGE", + "REQUIRED_TOS_AGREEMENT", + "RESOURCE_NOT_DELETED", + "SINGLE_INSTANCE_PROPERTY_TEMPLATE", + "UNREACHABLE" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ] + }, + "data": { + "type": "array", + "description": "[Output Only] Metadata about this warning in key: value format. For example:\n\"data\": [ { \"key\": \"scope\", \"value\": \"zones/us-east1-d\" }", + "items": { + "type": "object", + "properties": { + "key": { + "type": "string", + "description": "[Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding)." + }, + "value": { + "type": "string", + "description": "[Output Only] A warning data value corresponding to the key." + } + } + } + }, + "message": { + "type": "string", + "description": "[Output Only] A human-readable description of the warning code." + } + } + } + } + }, "Condition": { "id": "Condition", "type": "object", @@ -1376,9 +1782,11 @@ "enum": [ "ATTRIBUTION", "AUTHORITY", - "NO_ATTR" + "NO_ATTR", + "SECURITY_REALM" ], "enumDescriptions": [ + "", "", "", "" @@ -1491,15 +1899,15 @@ "properties": { "deleted": { "type": "string", - "description": "An optional RFC3339 timestamp on or after which the deprecation state of this resource will be changed to DELETED." + "description": "An optional RFC3339 timestamp on or after which the state of this resource is intended to change to DELETED. This is only informational and the status will not change unless the client explicitly changes it." }, "deprecated": { "type": "string", - "description": "An optional RFC3339 timestamp on or after which the deprecation state of this resource will be changed to DEPRECATED." + "description": "An optional RFC3339 timestamp on or after which the state of this resource is intended to change to DEPRECATED. This is only informational and the status will not change unless the client explicitly changes it." }, "obsolete": { "type": "string", - "description": "An optional RFC3339 timestamp on or after which the deprecation state of this resource will be changed to OBSOLETE." + "description": "An optional RFC3339 timestamp on or after which the state of this resource is intended to change to OBSOLETE. This is only informational and the status will not change unless the client explicitly changes it." }, "replacement": { "type": "string", @@ -1635,7 +2043,7 @@ }, "status": { "type": "string", - "description": "[Output Only] The status of disk creation. Applicable statuses includes: CREATING, FAILED, READY, RESTORING.", + "description": "[Output Only] The status of disk creation.", "enum": [ "CREATING", "FAILED", @@ -2067,10 +2475,49 @@ "type": "string", "description": "[Output Only] Creation timestamp in RFC3339 text format." }, + "denied": { + "type": "array", + "description": "The list of DENY rules specified by this firewall. Each rule specifies a protocol and port-range tuple that describes a permitted connection.", + "items": { + "type": "object", + "properties": { + "IPProtocol": { + "type": "string", + "description": "The IP protocol to which this rule applies. The protocol type is required when creating a firewall rule. This value can either be one of the following well known protocol strings (tcp, udp, icmp, esp, ah, sctp), or the IP protocol number." + }, + "ports": { + "type": "array", + "description": "An optional list of ports to which this rule applies. This field is only applicable for UDP or TCP protocol. Each entry must be either an integer or a range. If not specified, this rule applies to connections through any port.\n\nExample inputs include: [\"22\"], [\"80\",\"443\"], and [\"12345-12349\"].", + "items": { + "type": "string" + } + } + } + } + }, "description": { "type": "string", "description": "An optional description of this resource. Provide this property when you create the resource." }, + "destinationRanges": { + "type": "array", + "description": "If destination ranges are specified, the firewall will apply only to traffic that has destination IP address in these ranges. These ranges must be expressed in CIDR format.", + "items": { + "type": "string" + } + }, + "direction": { + "type": "string", + "description": "Direction of traffic to which this firewall applies; default is INGRESS. Note: For INGRESS traffic, it is NOT supported to specify destinationRanges; For EGRESS traffic, it is NOT supported to specify sourceRanges OR sourceTags.", + "enum": [ + "EGRESS", + "INGRESS" + ], + "enumDescriptions": [ + "", + "" + ] + }, "id": { "type": "string", "description": "[Output Only] The unique identifier for the resource. This identifier is defined by the server.", @@ -2096,6 +2543,11 @@ "type": "string", "description": "URL of the network resource for this firewall rule. If not specified when creating a firewall rule, the default network is used:\nglobal/networks/default\nIf you choose to specify this property, you can specify the network as a full or partial URL. For example, the following are all valid URLs: \n- https://www.googleapis.com/compute/v1/projects/myproject/global/networks/my-network \n- projects/myproject/global/networks/my-network \n- global/networks/default" }, + "priority": { + "type": "integer", + "description": "Priority for this rule. This is an integer between 0 and 65535, both inclusive. When not specified, the value assumed is 1000. Relative priorities determine precedence of conflicting rules. Lower value of priority implies higher precedence (eg, a rule with priority 0 has higher precedence than a rule with priority 1). DENY rules take precedence over ALLOW rules having equal priority.", + "format": "int32" + }, "selfLink": { "type": "string", "description": "[Output Only] Server-defined URL for the resource." @@ -2217,15 +2669,6 @@ "type": "string", "description": "An optional description of this resource. Provide this property when you create the resource." }, - "dnsLabel": { - "type": "string", - "description": "An optional prefix to the DNS name for this Forwarding Rule. If specified, will be the first label of the fully qualified domain name.\n\nThe label must be 1-63 characters long, and comply with RFC1035. Specifically, the label must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.\n\nThis field is only used for internal load balancing.", - "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?" - }, - "dnsName": { - "type": "string", - "description": "[Output Only] The internal fully qualified domain name for this Forwarding Rule.\n\nThis field is only used for internal load balancing." - }, "id": { "type": "string", "description": "[Output Only] The unique identifier for the resource. This identifier is defined by the server.", @@ -2236,6 +2679,18 @@ "description": "[Output Only] Type of the resource. Always compute#forwardingRule for Forwarding Rule resources.", "default": "compute#forwardingRule" }, + "labelFingerprint": { + "type": "string", + "description": "A fingerprint for the labels being applied to this resource, which is essentially a hash of the labels set used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash in order to update or change labels.\n\nTo see the latest fingerprint, make a get() request to retrieve a ForwardingRule.", + "format": "byte" + }, + "labels": { + "type": "object", + "description": "Labels to apply to this resource. These can be later modified by the setLabels method. Each label key/value pair must comply with RFC1035. Label values may be empty.", + "additionalProperties": { + "type": "string" + } + }, "loadBalancingScheme": { "type": "string", "description": "This signifies what the ForwardingRule will be used for and can only take the following values: INTERNAL EXTERNAL The value of INTERNAL means that this will be used for Internal Network Load Balancing (TCP, UDP). The value of EXTERNAL means that this will be used for External Load Balancing (HTTP(S) LB, External TCP/UDP LB, SSL Proxy)", @@ -2259,6 +2714,18 @@ "type": "string", "description": "This field is not used for external load balancing.\n\nFor internal load balancing, this field identifies the network that the load balanced IP should belong to for this Forwarding Rule. If this field is not specified, the default network will be used." }, + "networkTier": { + "type": "string", + "description": "This signifies the networking tier used for configuring this load balancer and can only take the following values: CLOUD_NETWORK_PREMIUM , CLOUD_NETWORK_STANDARD. If this field is not specified, it is assumed to be CLOUD_NETWORK_PREMIUM.", + "enum": [ + "CLOUD_NETWORK_PREMIUM", + "CLOUD_NETWORK_STANDARD" + ], + "enumDescriptions": [ + "", + "" + ] + }, "portRange": { "type": "string", "description": "Applicable only when IPProtocol is TCP, UDP, or SCTP, only packets addressed to ports in the specified range will be forwarded to target. Forwarding rules with the same [IPAddress, IPProtocol] pair must have disjoint port ranges.\n\nThis field is not used for internal load balancing." @@ -2278,6 +2745,15 @@ "type": "string", "description": "[Output Only] Server-defined URL for the resource." }, + "serviceLabel": { + "type": "string", + "description": "An optional prefix to the service name for this Forwarding Rule. If specified, will be the first label of the fully qualified service name.\n\nThe label must be 1-63 characters long, and comply with RFC1035. Specifically, the label must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.\n\nThis field is only used for internal load balancing.", + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?" + }, + "serviceName": { + "type": "string", + "description": "[Output Only] The internal fully qualified service name for this Forwarding Rule.\n\nThis field is only used for internal load balancing." + }, "subnetwork": { "type": "string", "description": "This field is not used for external load balancing.\n\nFor internal load balancing, this field identifies the subnetwork that the load balanced IP should belong to for this Forwarding Rule.\n\nIf the network specified is in auto subnet mode, this field is optional. However, if the network is in custom subnet mode, a subnetwork must be specified." @@ -2451,16 +2927,20 @@ "GuestOsFeature": { "id": "GuestOsFeature", "type": "object", - "description": "Features supported by the guest os.", + "description": "Guest OS features.", "properties": { "type": { "type": "string", - "description": "The type of supported feature..", + "description": "The type of supported feature. Currenty only VIRTIO_SCSI_MULTIQUEUE is supported. For newer Windows images, the server might also populate this property with the value WINDOWS to indicate that this is a Windows image. This value is purely informational and does not enable or disable any features.", "enum": [ "FEATURE_TYPE_UNSPECIFIED", - "VIRTIO_SCSI_MULTIQUEUE" + "MULTI_IP_SUBNET", + "VIRTIO_SCSI_MULTIQUEUE", + "WINDOWS" ], "enumDescriptions": [ + "", + "", "", "" ] @@ -2499,6 +2979,10 @@ "requestPath": { "type": "string", "description": "The request path of the HTTP/2 health check request. The default value is /." + }, + "response": { + "type": "string", + "description": "The string to match anywhere in the first 1024 bytes of the response body. If left empty (the default value), the status code determines health. The response data can only be ASCII." } } }, @@ -2534,6 +3018,10 @@ "requestPath": { "type": "string", "description": "The request path of the HTTP health check request. The default value is /." + }, + "response": { + "type": "string", + "description": "The string to match anywhere in the first 1024 bytes of the response body. If left empty (the default value), the status code determines health. The response data can only be ASCII." } } }, @@ -2569,6 +3057,10 @@ "requestPath": { "type": "string", "description": "The request path of the HTTPS health check request. The default value is /." + }, + "response": { + "type": "string", + "description": "The string to match anywhere in the first 1024 bytes of the response body. If left empty (the default value), the status code determines health. The response data can only be ASCII." } } }, @@ -2636,14 +3128,15 @@ }, "type": { "type": "string", - "description": "Specifies the type of the healthCheck, either TCP, UDP, SSL, HTTP, HTTPS or HTTP2. If not specified, the default is TCP. Exactly one of the protocol-specific health check field must be specified, which must match type field.", + "description": "Specifies the type of the healthCheck, either TCP, SSL, HTTP or HTTPS. If not specified, the default is TCP. Exactly one of the protocol-specific health check field must be specified, which must match type field.", "enum": [ "HTTP", "HTTP2", "HTTPS", "INVALID", "SSL", - "TCP" + "TCP", + "UDP" ], "enumDescriptions": [ "", @@ -2651,9 +3144,13 @@ "", "", "", + "", "" ] }, + "udpHealthCheck": { + "$ref": "UDPHealthCheck" + }, "unhealthyThreshold": { "type": "integer", "description": "A so-far healthy instance will be marked unhealthy after this many consecutive failures. The default value is 2.", @@ -2733,6 +3230,137 @@ } } }, + "Host": { + "id": "Host", + "type": "object", + "properties": { + "creationTimestamp": { + "type": "string", + "description": "[Output Only] Creation timestamp in RFC3339 text format." + }, + "description": { + "type": "string", + "description": "[Output Only] An optional textual description of the resource." + }, + "hostType": { + "type": "string", + "description": "Full or partial URL of the host type resource to use for this host, in the format: zones/zone/hostTypes/host-type. This is provided by the client when the host is created. For example, the following is a valid partial url to a predefined host type:\n\nzones/us-central1-f/hostTypes/n1-host-64-416" + }, + "id": { + "type": "string", + "description": "[Output Only] The unique identifier for the resource. This identifier is defined by the server.", + "format": "uint64" + }, + "instances": { + "type": "array", + "description": "A list of resource URLs to the virtual machine instances in this host. They must live in zones contained in the same region as this host.", + "items": { + "type": "string" + } + }, + "kind": { + "type": "string", + "description": "[Output Only] The type of the resource. Always compute#host for host.", + "default": "compute#host" + }, + "name": { + "type": "string", + "description": "The name of the resource, provided by the client when initially creating the resource. The resource name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash." + }, + "selfLink": { + "type": "string", + "description": "[Output Only] Server-defined URL for the resource." + }, + "status": { + "type": "string", + "description": "[Output Only] The status of the host. One of the following values: CREATING, READY, REPAIR, and DELETING.", + "enum": [ + "CREATING", + "DELETING", + "INVALID", + "READY", + "REPAIR" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "" + ] + }, + "statusMessage": { + "type": "string", + "description": "[Output Only] An optional, human-readable explanation of the status." + }, + "zone": { + "type": "string", + "description": "[Output Only] The name of the zone where the host resides, such as us-central1-a." + } + } + }, + "HostAggregatedList": { + "id": "HostAggregatedList", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "[Output Only] The unique identifier for the resource. This identifier is defined by the server." + }, + "items": { + "type": "object", + "description": "[Output Only] A map of scoped host lists.", + "additionalProperties": { + "$ref": "HostsScopedList", + "description": "[Output Only] Name of the scope containing this set of hosts." + } + }, + "kind": { + "type": "string", + "description": "[Output Only] Type of resource. Always compute#hostAggregatedList for aggregated lists of hosts.", + "default": "compute#hostAggregatedList" + }, + "nextPageToken": { + "type": "string", + "description": "[Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results." + }, + "selfLink": { + "type": "string", + "description": "[Output Only] Server-defined URL for the resource." + } + } + }, + "HostList": { + "id": "HostList", + "type": "object", + "description": "Contains a list of hosts.", + "properties": { + "id": { + "type": "string", + "description": "[Output Only] The unique identifier for the resource. This identifier is defined by the server." + }, + "items": { + "type": "array", + "description": "[Output Only] A list of Host resources.", + "items": { + "$ref": "Host" + } + }, + "kind": { + "type": "string", + "description": "[Output Only] Type of resource. Always compute#hostList for lists of hosts.", + "default": "compute#hostList" + }, + "nextPageToken": { + "type": "string", + "description": "[Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results." + }, + "selfLink": { + "type": "string", + "description": "[Output Only] Server-defined URL for the resource." + } + } + }, "HostRule": { "id": "HostRule", "type": "object", @@ -2755,6 +3383,86 @@ } } }, + "HostsScopedList": { + "id": "HostsScopedList", + "type": "object", + "properties": { + "hosts": { + "type": "array", + "description": "[Output Only] List of hosts contained in this scope.", + "items": { + "$ref": "Host" + } + }, + "warning": { + "type": "object", + "description": "[Output Only] An informational warning that appears when the host list is empty.", + "properties": { + "code": { + "type": "string", + "description": "[Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response.", + "enum": [ + "CLEANUP_FAILED", + "DEPRECATED_RESOURCE_USED", + "DISK_SIZE_LARGER_THAN_IMAGE_SIZE", + "FIELD_VALUE_OVERRIDEN", + "INJECTED_KERNELS_DEPRECATED", + "NEXT_HOP_ADDRESS_NOT_ASSIGNED", + "NEXT_HOP_CANNOT_IP_FORWARD", + "NEXT_HOP_INSTANCE_NOT_FOUND", + "NEXT_HOP_INSTANCE_NOT_ON_NETWORK", + "NEXT_HOP_NOT_RUNNING", + "NOT_CRITICAL_ERROR", + "NO_RESULTS_ON_PAGE", + "REQUIRED_TOS_AGREEMENT", + "RESOURCE_NOT_DELETED", + "SINGLE_INSTANCE_PROPERTY_TEMPLATE", + "UNREACHABLE" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ] + }, + "data": { + "type": "array", + "description": "[Output Only] Metadata about this warning in key: value format. For example:\n\"data\": [ { \"key\": \"scope\", \"value\": \"zones/us-east1-d\" }", + "items": { + "type": "object", + "properties": { + "key": { + "type": "string", + "description": "[Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding)." + }, + "value": { + "type": "string", + "description": "[Output Only] A warning data value corresponding to the key." + } + } + } + }, + "message": { + "type": "string", + "description": "[Output Only] A human-readable description of the warning code." + } + } + } + } + }, "HttpHealthCheck": { "id": "HttpHealthCheck", "type": "object", @@ -2963,7 +3671,7 @@ }, "creationTimestamp": { "type": "string", - "description": "Creation timestamp in RFC3339 text format." + "description": "[Output Only] Creation timestamp in RFC3339 text format." }, "deprecated": { "$ref": "DeprecationStatus", @@ -2984,7 +3692,7 @@ }, "guestOsFeatures": { "type": "array", - "description": "Features of the guest os, valid for bootable images only.", + "description": "A list of features to enable on the guest OS. Applicable for bootable images only. Currently, only one feature can be enabled, VIRTIO_SCSCI_MULTIQUEUE, which allows each virtual CPU to have its own queue. For Windows images, you can only enable VIRTIO_SCSCI_MULTIQUEUE on images with driver version 1.2.0.1621 or higher. Linux images with kernel versions 3.17 and higher will support VIRTIO_SCSCI_MULTIQUEUE.\n\nFor new Windows images, the server might also populate this field with the value WINDOWS, to indicate that this is a Windows image. This value is purely informational and does not enable or disable any features.", "items": { "$ref": "GuestOsFeature" } @@ -3068,7 +3776,7 @@ }, "sourceDisk": { "type": "string", - "description": "URL of the The source disk used to create this image. This can be a full or valid partial URL. You must provide either this property or the rawDisk.source property but not both to create an image. For example, the following are valid values: \n- https://www.googleapis.com/compute/v1/projects/project/zones/zone/disk/disk \n- projects/project/zones/zone/disk/disk \n- zones/zone/disks/disk" + "description": "URL of the source disk used to create this image. This can be a full or valid partial URL. You must provide either this property or the rawDisk.source property but not both to create an image. For example, the following are valid values: \n- https://www.googleapis.com/compute/v1/projects/project/zones/zone/disks/disk \n- projects/project/zones/zone/disks/disk \n- zones/zone/disks/disk" }, "sourceDiskEncryptionKey": { "$ref": "CustomerEncryptionKey", @@ -3164,6 +3872,10 @@ "$ref": "AttachedDisk" } }, + "host": { + "type": "string", + "description": "Full or partial URL of the host resource that the instance should be placed on, in the format: zones/zone/hosts/host.\n\nOptional, Private Host (physical machine) that the instance will be placed on when it's created. The instance is guaranteed to be placed on the same machine as other instances with the same private host.\n\nThe request will be rejected if the private host has run out of resources." + }, "id": { "type": "string", "description": "[Output Only] The unique identifier for the resource. This identifier is defined by the server.", @@ -3317,7 +4029,7 @@ }, "id": { "type": "string", - "description": "[Output Only] A unique identifier for this instance group. The server generates this identifier.", + "description": "[Output Only] A unique identifier for this instance group, generated by the server.", "format": "uint64" }, "kind": { @@ -3467,7 +4179,7 @@ }, "failoverAction": { "type": "string", - "description": "The action to perform in case of zone failure (set only for Regional instance group managers).", + "description": "The action to perform in case of zone failure. Only one value is supported, NO_FAILOVER. The default is NO_FAILOVER.", "enum": [ "NO_FAILOVER", "UNKNOWN" @@ -3529,6 +4241,10 @@ "type": "string", "description": "[Output Only] The URL for this managed instance group. The server defines this URL." }, + "serviceAccount": { + "type": "string", + "description": "Service account will be used as credentials for all operations performed by managed instance group on instances. The service accounts needs all permissions required to create and delete instances. When not specified, the service account {projectNumber}@cloudservices.gserviceaccount.com will be used." + }, "targetPools": { "type": "array", "description": "The URLs for all TargetPool resources to which instances in the instanceGroup field are added. The target pools automatically apply to all of the instances in the managed instance group.", @@ -3579,7 +4295,7 @@ }, "creatingWithoutRetries": { "type": "integer", - "description": "[Output Only] The number of instances that the managed instance group will attempt to create. The group attempts to create each instance only once. If the group fails to create any of these instances, it decreases the group's target_size value accordingly.", + "description": "[Output Only] The number of instances that the managed instance group will attempt to create. The group attempts to create each instance only once. If the group fails to create any of these instances, it decreases the group's targetSize value accordingly.", "format": "int32" }, "deleting": { @@ -3606,6 +4322,11 @@ "type": "integer", "description": "[Output Only] The number of instances in the managed instance group that are scheduled to be restarted or are currently being restarted.", "format": "int32" + }, + "verifying": { + "type": "integer", + "description": "[Output Only] The number of instances in the managed instance group that are being verified.", + "format": "int32" } } }, @@ -3646,12 +4367,16 @@ "properties": { "healthCheck": { "type": "string", - "description": "The URL for the HealthCheck that signals autohealing." + "description": "The URL for the health check that signals autohealing." }, "initialDelaySec": { "type": "integer", "description": "The number of seconds that the managed instance group waits before it applies autohealing policies to new instances or recently recreated instances. This initial delay allows instances to initialize and run their startup scripts before the instance group determines that they are UNHEALTHY. This prevents the managed instance group from recreating its instances prematurely. This value must be from range [0, 3600].", "format": "int32" + }, + "maxUnavailable": { + "$ref": "FixedOrPercent", + "description": "Maximum number of instances that can be unavailable when auto-healing. The instance is considered available if all of the following conditions are satisfied: 1. instance's status is RUNNING 2. instance's liveness health check result was observed to be HEALTHY at least once By default, a percent value of 100% is used." } } }, @@ -3682,7 +4407,7 @@ }, "selfLink": { "type": "string", - "description": "[Output Only] The URL for this resource type. The server generates this URL." + "description": "[Output Only] Server-defined URL for this resource." } } }, @@ -4524,6 +5249,11 @@ "description": "[Output Only] Type of resource. Always compute#license for licenses.", "default": "compute#license" }, + "licenseCode": { + "type": "string", + "description": "[Output Only] The unique code used to attach this license to images, snapshots, and disks.", + "format": "uint64" + }, "name": { "type": "string", "description": "[Output Only] Name of the resource. The name is 1-63 characters long and complies with RFC1035.", @@ -4537,6 +5267,10 @@ "selfLink": { "type": "string", "description": "[Output Only] Server-defined URL for the resource." + }, + "transferable": { + "type": "boolean", + "description": "If false, licenses will not be copied from the source resource when creating an image from a disk, disk from snapshot, or snapshot from disk." } } }, @@ -4789,7 +5523,8 @@ "NONE", "RECREATING", "REFRESHING", - "RESTARTING" + "RESTARTING", + "VERIFYING" ], "enumDescriptions": [ "", @@ -4799,6 +5534,7 @@ "", "", "", + "", "" ] }, @@ -4973,6 +5709,18 @@ "type": "string", "description": "[Output Only] Creation timestamp in RFC3339 text format." }, + "crossVmEncryption": { + "type": "string", + "description": "[Output Only] Type of VM-to-VM traffic encryption for this network.", + "enum": [ + "ENCRYPTED", + "UNENCRYPTED" + ], + "enumDescriptions": [ + "", + "" + ] + }, "description": { "type": "string", "description": "An optional description of this resource. Provide this property when you create the resource." @@ -4992,6 +5740,18 @@ "description": "[Output Only] Type of the resource. Always compute#network for networks.", "default": "compute#network" }, + "loadBalancerVmEncryption": { + "type": "string", + "description": "[Output Only] Type of LB-to-VM traffic encryption for this network.", + "enum": [ + "ENCRYPTED", + "UNENCRYPTED" + ], + "enumDescriptions": [ + "", + "" + ] + }, "name": { "type": "string", "description": "Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.", @@ -5002,6 +5762,13 @@ ] } }, + "peerings": { + "type": "array", + "description": "[Output Only] List of network peerings for the resource.", + "items": { + "$ref": "NetworkPeering" + } + }, "selfLink": { "type": "string", "description": "[Output Only] Server-defined URL for the resource." @@ -5027,6 +5794,13 @@ "$ref": "AccessConfig" } }, + "aliasIpRanges": { + "type": "array", + "description": "An array of alias IP ranges for this network interface. Can only be specified for network interfaces on subnet-mode networks.", + "items": { + "$ref": "AliasIpRange" + } + }, "name": { "type": "string", "description": "[Output Only] The name of the network interface, generated by the server. For network devices, these are eth0, eth1, etc." @@ -5077,7 +5851,70 @@ }, "selfLink": { "type": "string", - "description": "[Output Only] Server-defined URL for this resource ." + "description": "[Output Only] Server-defined URL for this resource." + } + } + }, + "NetworkPeering": { + "id": "NetworkPeering", + "type": "object", + "description": "A network peering attached to a network resource. The message includes the peering name, peer network, peering state, and a flag indicating whether Google Compute Engine should automatically create routes for the peering.", + "properties": { + "autoCreateRoutes": { + "type": "boolean", + "description": "Whether full mesh connectivity is created and managed automatically. When it is set to true, Google Compute Engine will automatically create and manage the routes between two networks when the state is ACTIVE. Otherwise, user needs to create routes manually to route packets to peer network." + }, + "name": { + "type": "string", + "description": "Name of this peering. Provided by the client when the peering is created. The name must comply with RFC1035. Specifically, the name must be 1-63 characters long and match regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all the following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash." + }, + "network": { + "type": "string", + "description": "The URL of the peer network. It can be either full URL or partial URL. The peer network may belong to a different project. If the partial URL does not contain project, it is assumed that the peer network is in the same project as the current network." + }, + "state": { + "type": "string", + "description": "[Output Only] State for the peering.", + "enum": [ + "ACTIVE", + "INACTIVE" + ], + "enumDescriptions": [ + "", + "" + ] + }, + "stateDetails": { + "type": "string", + "description": "[Output Only] Details about the current state of the peering." + } + } + }, + "NetworksAddPeeringRequest": { + "id": "NetworksAddPeeringRequest", + "type": "object", + "properties": { + "autoCreateRoutes": { + "type": "boolean", + "description": "Whether Google Compute Engine manages the routes automatically." + }, + "name": { + "type": "string", + "description": "Name of the peering, which should conform to RFC1035." + }, + "peerNetwork": { + "type": "string", + "description": "URL of the peer network. It can be either full URL or partial URL. The peer network may belong to a different project. If the partial URL does not contain project, it is assumed that the peer network is in the same project as the current network." + } + } + }, + "NetworksRemovePeeringRequest": { + "id": "NetworksRemovePeeringRequest", + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Name of the peering, which should conform to RFC1035." } } }, @@ -5202,7 +6039,7 @@ }, "targetLink": { "type": "string", - "description": "[Output Only] The URL of the resource that the operation modifies." + "description": "[Output Only] The URL of the resource that the operation modifies. For operations related to creating a snapshot, this points to the persistent disk that the snapshot was created from." }, "user": { "type": "string", @@ -5631,6 +6468,16 @@ } } }, + "ProjectsSetDefaultServiceAccountRequest": { + "id": "ProjectsSetDefaultServiceAccountRequest", + "type": "object", + "properties": { + "email": { + "type": "string", + "description": "Email address of the service account." + } + } + }, "Quota": { "id": "Quota", "type": "object", @@ -5677,7 +6524,9 @@ "TARGET_INSTANCES", "TARGET_POOLS", "TARGET_SSL_PROXIES", + "TARGET_TCP_PROXIES", "TARGET_VPN_GATEWAYS", + "TOTAL_CPUS", "URL_MAPS", "VPN_TUNNELS" ], @@ -5716,6 +6565,8 @@ "", "", "", + "", + "", "" ] }, @@ -5820,36 +6671,6 @@ } } }, - "RegionDiskList": { - "id": "RegionDiskList", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "[Output Only] The unique identifier for the resource. This identifier is defined by the server." - }, - "items": { - "type": "array", - "description": "[Output Only] A list of persistent disks.", - "items": { - "$ref": "Disk" - } - }, - "kind": { - "type": "string", - "description": "[Output Only] Type of resource. Always compute#regionDiskList for lists of region disks.", - "default": "compute#regionDiskList" - }, - "nextPageToken": { - "type": "string", - "description": "[Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results." - }, - "selfLink": { - "type": "string", - "description": "[Output Only] Server-defined URL for this resource." - } - } - }, "RegionDiskTypeList": { "id": "RegionDiskTypeList", "type": "object", @@ -6165,13 +6986,41 @@ } } }, + "ResourceCommitment": { + "id": "ResourceCommitment", + "type": "object", + "description": "Commitment for a particular resource (a Commitment is composed of one or more of these).", + "properties": { + "amount": { + "type": "string", + "description": "The amount of the resource purchased (in a type-dependent unit, such as bytes).", + "format": "int64" + }, + "type": { + "type": "string", + "description": "Type of resource for which this commitment applies.", + "enum": [ + "LOCAL_SSD", + "MEMORY", + "UNSPECIFIED", + "VCPU" + ], + "enumDescriptions": [ + "", + "", + "", + "" + ] + } + } + }, "ResourceGroupReference": { "id": "ResourceGroupReference", "type": "object", "properties": { "group": { "type": "string", - "description": "A URI referencing one of the resource views listed in the backend service." + "description": "A URI referencing one of the instance groups listed in the backend service." } } }, @@ -6242,6 +7091,10 @@ "type": "string", "description": "The URL of the local network if it should handle matching packets." }, + "nextHopPeering": { + "type": "string", + "description": "[Output Only] The network peering name that should handle matching packets, which should conform to RFC1035." + }, "nextHopVpnTunnel": { "type": "string", "description": "The URL to a VpnTunnel that should handle matching packets." @@ -6406,7 +7259,7 @@ }, "interfaces": { "type": "array", - "description": "Router interfaces. Each interface requires either one linked resource (e.g. linkedVpnTunnel) or IP address and IP address range (e.g. ipRange).", + "description": "Router interfaces. Each interface requires either one linked resource (e.g. linkedVpnTunnel), or IP address and IP address range (e.g. ipRange), or both.", "items": { "$ref": "RouterInterface" } @@ -6567,7 +7420,7 @@ }, "selfLink": { "type": "string", - "description": "[Output Only] Server-defined URL for the resource." + "description": "[Output Only] Server-defined URL for this resource." } } }, @@ -6907,7 +7760,7 @@ }, "selfLink": { "type": "string", - "description": "[Output Only] Server-defined URL for the resource." + "description": "[Output Only] Server-defined URL for this resource." }, "start": { "type": "string", @@ -7108,7 +7961,7 @@ }, "privateKey": { "type": "string", - "description": "A write-only private key in PEM format. Only insert RPCs will include this field." + "description": "A write-only private key in PEM format. Only insert requests will include this field." }, "selfLink": { "type": "string", @@ -7195,6 +8048,13 @@ "type": "string", "description": "URL of the region where the Subnetwork resides." }, + "secondaryIpRanges": { + "type": "array", + "description": "An array of configurations for secondary IP ranges for VM instances contained in this subnetwork. The primary IP of such VM must belong to the primary ipCidrRange of the subnetwork. The alias IPs may belong to either primary or secondary ranges.", + "items": { + "$ref": "SubnetworkSecondaryRange" + } + }, "selfLink": { "type": "string", "description": "[Output Only] Server-defined URL for the resource." @@ -7263,6 +8123,21 @@ } } }, + "SubnetworkSecondaryRange": { + "id": "SubnetworkSecondaryRange", + "type": "object", + "description": "Represents a secondary IP range of a subnetwork.", + "properties": { + "ipCidrRange": { + "type": "string", + "description": "The range of IP addresses belonging to this subnetwork secondary range. Provide this property when you create the subnetwork. Ranges must be unique and non-overlapping with all primary and secondary IP ranges within a network." + }, + "rangeName": { + "type": "string", + "description": "The name associated with this subnetwork secondary range, used when adding an alias IP range to a VM instance. The name must be 1-63 characters long, and comply with RFC1035. The name must be unique within the subnetwork." + } + } + }, "SubnetworksExpandIpCidrRangeRequest": { "id": "SubnetworksExpandIpCidrRangeRequest", "type": "object", @@ -7353,6 +8228,15 @@ } } }, + "SubnetworksSetPrivateIpGoogleAccessRequest": { + "id": "SubnetworksSetPrivateIpGoogleAccessRequest", + "type": "object", + "properties": { + "privateIpGoogleAccess": { + "type": "boolean" + } + } + }, "TCPHealthCheck": { "id": "TCPHealthCheck", "type": "object", @@ -8195,6 +9079,115 @@ } } }, + "TargetTcpProxiesSetBackendServiceRequest": { + "id": "TargetTcpProxiesSetBackendServiceRequest", + "type": "object", + "properties": { + "service": { + "type": "string", + "description": "The URL of the new BackendService resource for the targetTcpProxy." + } + } + }, + "TargetTcpProxiesSetProxyHeaderRequest": { + "id": "TargetTcpProxiesSetProxyHeaderRequest", + "type": "object", + "properties": { + "proxyHeader": { + "type": "string", + "description": "The new type of proxy header to append before sending data to the backend. NONE or PROXY_V1 are allowed.", + "enum": [ + "NONE", + "PROXY_V1" + ], + "enumDescriptions": [ + "", + "" + ] + } + } + }, + "TargetTcpProxy": { + "id": "TargetTcpProxy", + "type": "object", + "description": "A TargetTcpProxy resource. This resource defines a TCP proxy.", + "properties": { + "creationTimestamp": { + "type": "string", + "description": "[Output Only] Creation timestamp in RFC3339 text format." + }, + "description": { + "type": "string", + "description": "An optional description of this resource. Provide this property when you create the resource." + }, + "id": { + "type": "string", + "description": "[Output Only] The unique identifier for the resource. This identifier is defined by the server.", + "format": "uint64" + }, + "kind": { + "type": "string", + "description": "[Output Only] Type of the resource. Always compute#targetTcpProxy for target TCP proxies.", + "default": "compute#targetTcpProxy" + }, + "name": { + "type": "string", + "description": "Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.", + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?" + }, + "proxyHeader": { + "type": "string", + "description": "Specifies the type of proxy header to append before sending data to the backend, either NONE or PROXY_V1. The default is NONE.", + "enum": [ + "NONE", + "PROXY_V1" + ], + "enumDescriptions": [ + "", + "" + ] + }, + "selfLink": { + "type": "string", + "description": "[Output Only] Server-defined URL for the resource." + }, + "service": { + "type": "string", + "description": "URL to the BackendService resource." + } + } + }, + "TargetTcpProxyList": { + "id": "TargetTcpProxyList", + "type": "object", + "description": "Contains a list of TargetTcpProxy resources.", + "properties": { + "id": { + "type": "string", + "description": "[Output Only] The unique identifier for the resource. This identifier is defined by the server." + }, + "items": { + "type": "array", + "description": "A list of TargetTcpProxy resources.", + "items": { + "$ref": "TargetTcpProxy" + } + }, + "kind": { + "type": "string", + "description": "Type of resource.", + "default": "compute#targetTcpProxyList" + }, + "nextPageToken": { + "type": "string", + "description": "[Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results." + }, + "selfLink": { + "type": "string", + "description": "[Output Only] Server-defined URL for this resource." + } + } + }, "TargetVpnGateway": { "id": "TargetVpnGateway", "type": "object", @@ -8304,7 +9297,7 @@ }, "selfLink": { "type": "string", - "description": "[Output Only] Server-defined URL for the resource." + "description": "[Output Only] Server-defined URL for this resource." } } }, @@ -8335,7 +9328,7 @@ }, "selfLink": { "type": "string", - "description": "[Output Only] Server-defined URL for the resource." + "description": "[Output Only] Server-defined URL for this resource." } } }, @@ -8463,6 +9456,29 @@ } } }, + "UDPHealthCheck": { + "id": "UDPHealthCheck", + "type": "object", + "properties": { + "port": { + "type": "integer", + "description": "The UDP port number for the health check request.", + "format": "int32" + }, + "portName": { + "type": "string", + "description": "Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name are defined, port takes precedence." + }, + "request": { + "type": "string", + "description": "Raw data of request to send in payload of UDP packet. It is an error if this is empty. The request data can only be ASCII." + }, + "response": { + "type": "string", + "description": "The bytes to match against the beginning of the response data. It is an error if this is empty. The response data can only be ASCII." + } + } + }, "UrlMap": { "id": "UrlMap", "type": "object", @@ -8682,6 +9698,18 @@ "description": "[Output Only] Type of resource. Always compute#vpnTunnel for VPN tunnels.", "default": "compute#vpnTunnel" }, + "labelFingerprint": { + "type": "string", + "description": "A fingerprint for the labels being applied to this VpnTunnel, which is essentially a hash of the labels set used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash in order to update or change labels.\n\nTo see the latest fingerprint, make a get() request to retrieve a VpnTunnel.", + "format": "byte" + }, + "labels": { + "type": "object", + "description": "Labels to apply to this VpnTunnel. These can be later modified by the setLabels method. Each label key/value pair must comply with RFC1035. Label values may be empty.", + "additionalProperties": { + "type": "string" + } + }, "localTrafficSelector": { "type": "array", "description": "Local traffic selector to use when establishing the VPN tunnel with peer VPN gateway. The value should be a CIDR formatted string, for example: 192.168.0.0/16. The ranges should be disjoint.", @@ -8831,7 +9859,7 @@ }, "selfLink": { "type": "string", - "description": "[Output Only] Server-defined URL for the resource." + "description": "[Output Only] Server-defined URL for this resource." } } }, @@ -8941,7 +9969,7 @@ }, "selfLink": { "type": "string", - "description": "[Output Only] Server-defined URL for this resource ." + "description": "[Output Only] Server-defined URL for this resource." } } }, @@ -9895,7 +10923,7 @@ "id": "compute.backendBuckets.patch", "path": "{project}/global/backendBuckets/{backendBucket}", "httpMethod": "PATCH", - "description": "Update the entire content of the BackendBucket resource. This method supports patch semantics.", + "description": "Updates the specified BackendBucket resource with the data included in the request. This method supports patch semantics.", "parameters": { "backendBucket": { "type": "string", @@ -10005,7 +11033,7 @@ "id": "compute.backendBuckets.update", "path": "{project}/global/backendBuckets/{backendBucket}", "httpMethod": "PUT", - "description": "Update the entire content of the BackendBucket resource.", + "description": "Updates the specified BackendBucket resource with the data included in the request.", "parameters": { "backendBucket": { "type": "string", @@ -10276,7 +11304,7 @@ "id": "compute.backendServices.patch", "path": "{project}/global/backendServices/{backendService}", "httpMethod": "PATCH", - "description": "Updates the entire content of the BackendService resource. There are several restrictions and guidelines to keep in mind when updating a backend service. Read Restrictions and Guidelines for more information. This method supports patch semantics.", + "description": "Updates the specified BackendService resource with the data included in the request. There are several restrictions and guidelines to keep in mind when updating a backend service. Read Restrictions and Guidelines for more information. This method supports patch semantics.", "parameters": { "backendService": { "type": "string", @@ -10349,7 +11377,7 @@ "id": "compute.backendServices.update", "path": "{project}/global/backendServices/{backendService}", "httpMethod": "PUT", - "description": "Updates the entire content of the BackendService resource. There are several restrictions and guidelines to keep in mind when updating a backend service. Read Restrictions and Guidelines for more information.", + "description": "Updates the specified BackendService resource with the data included in the request. There are several restrictions and guidelines to keep in mind when updating a backend service. Read Restrictions and Guidelines for more information.", "parameters": { "backendService": { "type": "string", @@ -10424,6 +11452,328 @@ } } }, + "commitments": { + "methods": { + "aggregatedList": { + "id": "compute.commitments.aggregatedList", + "path": "{project}/aggregated/commitments", + "httpMethod": "GET", + "description": "Retrieves an aggregated list of commitments.", + "parameters": { + "filter": { + "type": "string", + "description": "Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string.\n\nThe field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field.\n\nFor example, to filter for instances that do not have a name of example-instance, you would use filter=name ne example-instance.\n\nYou can filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. Use filtering on nested fields to take advantage of labels to organize and search for results based on label values.\n\nTo filter on multiple expressions, provide each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions, meaning that resources must match all expressions to pass the filters.", + "location": "query" + }, + "maxResults": { + "type": "integer", + "description": "The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests.", + "default": "500", + "format": "uint32", + "minimum": "0", + "maximum": "500", + "location": "query" + }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", + "location": "query" + }, + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + } + }, + "parameterOrder": [ + "project" + ], + "response": { + "$ref": "CommitmentAggregatedList" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/compute.readonly" + ] + }, + "get": { + "id": "compute.commitments.get", + "path": "{project}/zones/{zone}/commitments/{commitment}", + "httpMethod": "GET", + "description": "Returns the specified commitment resource. Get a list of available commitments by making a list() request.", + "parameters": { + "commitment": { + "type": "string", + "description": "Name of the commitment to return.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + }, + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "zone": { + "type": "string", + "description": "Name of the zone for this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "zone", + "commitment" + ], + "response": { + "$ref": "Commitment" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/compute.readonly" + ] + }, + "getIamPolicy": { + "id": "compute.commitments.getIamPolicy", + "path": "{project}/zones/{zone}/commitments/{resource}/getIamPolicy", + "httpMethod": "GET", + "description": "Gets the access control policy for a resource. May be empty if no such policy or resource exists.", + "parameters": { + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "resource": { + "type": "string", + "description": "Name of the resource for this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + }, + "zone": { + "type": "string", + "description": "The name of the zone for this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "zone", + "resource" + ], + "response": { + "$ref": "Policy" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/compute.readonly" + ] + }, + "insert": { + "id": "compute.commitments.insert", + "path": "{project}/zones/{zone}/commitments", + "httpMethod": "POST", + "description": "Creates an commitment in the specified project using the data included in the request.", + "parameters": { + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "zone": { + "type": "string", + "description": "Name of the zone for this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "zone" + ], + "request": { + "$ref": "Commitment" + }, + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute" + ] + }, + "list": { + "id": "compute.commitments.list", + "path": "{project}/zones/{zone}/commitments", + "httpMethod": "GET", + "description": "Retrieves a list of commitments contained within the specified zone.", + "parameters": { + "filter": { + "type": "string", + "description": "Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string.\n\nThe field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field.\n\nFor example, to filter for instances that do not have a name of example-instance, you would use filter=name ne example-instance.\n\nYou can filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. Use filtering on nested fields to take advantage of labels to organize and search for results based on label values.\n\nTo filter on multiple expressions, provide each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions, meaning that resources must match all expressions to pass the filters.", + "location": "query" + }, + "maxResults": { + "type": "integer", + "description": "The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests.", + "default": "500", + "format": "uint32", + "minimum": "0", + "maximum": "500", + "location": "query" + }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", + "location": "query" + }, + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "zone": { + "type": "string", + "description": "Name of the zone for this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "zone" + ], + "response": { + "$ref": "CommitmentList" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/compute.readonly" + ] + }, + "setIamPolicy": { + "id": "compute.commitments.setIamPolicy", + "path": "{project}/zones/{zone}/commitments/{resource}/setIamPolicy", + "httpMethod": "POST", + "description": "Sets the access control policy on the specified resource. Replaces any existing policy.", + "parameters": { + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "resource": { + "type": "string", + "description": "Name of the resource for this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + }, + "zone": { + "type": "string", + "description": "The name of the zone for this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "zone", + "resource" + ], + "request": { + "$ref": "Policy" + }, + "response": { + "$ref": "Policy" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/compute.readonly" + ] + }, + "testIamPermissions": { + "id": "compute.commitments.testIamPermissions", + "path": "{project}/zones/{zone}/commitments/{resource}/testIamPermissions", + "httpMethod": "POST", + "description": "Returns permissions that a caller has on the specified resource.", + "parameters": { + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "resource": { + "type": "string", + "description": "Name of the resource for this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + }, + "zone": { + "type": "string", + "description": "The name of the zone for this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "zone", + "resource" + ], + "request": { + "$ref": "TestPermissionsRequest" + }, + "response": { + "$ref": "TestPermissionsResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/compute.readonly" + ] + } + } + }, "diskTypes": { "methods": { "aggregatedList": { @@ -12406,6 +13756,369 @@ } } }, + "hosts": { + "methods": { + "aggregatedList": { + "id": "compute.hosts.aggregatedList", + "path": "{project}/aggregated/hosts", + "httpMethod": "GET", + "description": "Retrieves an aggregated list of hosts.", + "parameters": { + "filter": { + "type": "string", + "description": "Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string.\n\nThe field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field.\n\nFor example, to filter for instances that do not have a name of example-instance, you would use filter=name ne example-instance.\n\nYou can filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. Use filtering on nested fields to take advantage of labels to organize and search for results based on label values.\n\nTo filter on multiple expressions, provide each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions, meaning that resources must match all expressions to pass the filters.", + "location": "query" + }, + "maxResults": { + "type": "integer", + "description": "The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests.", + "default": "500", + "format": "uint32", + "minimum": "0", + "maximum": "500", + "location": "query" + }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", + "location": "query" + }, + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + } + }, + "parameterOrder": [ + "project" + ], + "response": { + "$ref": "HostAggregatedList" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/compute.readonly" + ] + }, + "delete": { + "id": "compute.hosts.delete", + "path": "{project}/zones/{zone}/hosts/{host}", + "httpMethod": "DELETE", + "description": "Deletes the specified Host resource.", + "parameters": { + "host": { + "type": "string", + "description": "Name of the Host resource to delete.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + }, + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "zone": { + "type": "string", + "description": "The name of the zone for this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "zone", + "host" + ], + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute" + ] + }, + "get": { + "id": "compute.hosts.get", + "path": "{project}/zones/{zone}/hosts/{host}", + "httpMethod": "GET", + "description": "Returns the specified host. Get a list of available hosts by making a list() request.", + "parameters": { + "host": { + "type": "string", + "description": "Name of the host to return.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + }, + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "zone": { + "type": "string", + "description": "The name of the zone for this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "zone", + "host" + ], + "response": { + "$ref": "Host" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/compute.readonly" + ] + }, + "getIamPolicy": { + "id": "compute.hosts.getIamPolicy", + "path": "{project}/zones/{zone}/hosts/{resource}/getIamPolicy", + "httpMethod": "GET", + "description": "Gets the access control policy for a resource. May be empty if no such policy or resource exists.", + "parameters": { + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "resource": { + "type": "string", + "description": "Name of the resource for this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + }, + "zone": { + "type": "string", + "description": "The name of the zone for this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "zone", + "resource" + ], + "response": { + "$ref": "Policy" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/compute.readonly" + ] + }, + "insert": { + "id": "compute.hosts.insert", + "path": "{project}/zones/{zone}/hosts", + "httpMethod": "POST", + "description": "Creates a host resource in the specified project using the data included in the request.", + "parameters": { + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "zone": { + "type": "string", + "description": "The name of the zone for this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "zone" + ], + "request": { + "$ref": "Host" + }, + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute" + ] + }, + "list": { + "id": "compute.hosts.list", + "path": "{project}/zones/{zone}/hosts", + "httpMethod": "GET", + "description": "Retrieves a list of hosts available to the specified project.", + "parameters": { + "filter": { + "type": "string", + "description": "Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string.\n\nThe field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field.\n\nFor example, to filter for instances that do not have a name of example-instance, you would use filter=name ne example-instance.\n\nYou can filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. Use filtering on nested fields to take advantage of labels to organize and search for results based on label values.\n\nTo filter on multiple expressions, provide each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions, meaning that resources must match all expressions to pass the filters.", + "location": "query" + }, + "maxResults": { + "type": "integer", + "description": "The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests.", + "default": "500", + "format": "uint32", + "minimum": "0", + "maximum": "500", + "location": "query" + }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", + "location": "query" + }, + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "zone": { + "type": "string", + "description": "The name of the zone for this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "zone" + ], + "response": { + "$ref": "HostList" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/compute.readonly" + ] + }, + "setIamPolicy": { + "id": "compute.hosts.setIamPolicy", + "path": "{project}/zones/{zone}/hosts/{resource}/setIamPolicy", + "httpMethod": "POST", + "description": "Sets the access control policy on the specified resource. Replaces any existing policy.", + "parameters": { + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "resource": { + "type": "string", + "description": "Name of the resource for this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + }, + "zone": { + "type": "string", + "description": "The name of the zone for this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "zone", + "resource" + ], + "request": { + "$ref": "Policy" + }, + "response": { + "$ref": "Policy" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/compute.readonly" + ] + }, + "testIamPermissions": { + "id": "compute.hosts.testIamPermissions", + "path": "{project}/zones/{zone}/hosts/{resource}/testIamPermissions", + "httpMethod": "POST", + "description": "Returns permissions that a caller has on the specified resource.", + "parameters": { + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "resource": { + "type": "string", + "description": "Name of the resource for this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + }, + "zone": { + "type": "string", + "description": "The name of the zone for this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "zone", + "resource" + ], + "request": { + "$ref": "TestPermissionsRequest" + }, + "response": { + "$ref": "TestPermissionsResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/compute.readonly" + ] + } + } + }, "httpHealthChecks": { "methods": { "delete": { @@ -13530,12 +15243,32 @@ "httpMethod": "POST", "description": "Lists all of the instances in the managed instance group. Each instance in the list has a currentAction, which indicates the action that the managed instance group is performing on the instance. For example, if the group is still creating an instance, the currentAction is CREATING. If a previous action failed, the list displays the errors for that failed action.", "parameters": { + "filter": { + "type": "string", + "location": "query" + }, "instanceGroupManager": { "type": "string", "description": "The name of the managed instance group.", "required": true, "location": "path" }, + "maxResults": { + "type": "integer", + "default": "500", + "format": "uint32", + "minimum": "0", + "maximum": "500", + "location": "query" + }, + "order_by": { + "type": "string", + "location": "query" + }, + "pageToken": { + "type": "string", + "location": "query" + }, "project": { "type": "string", "description": "Project ID for this request.", @@ -14710,6 +16443,11 @@ "httpMethod": "POST", "description": "Attaches a Disk resource to an instance.", "parameters": { + "forceAttach": { + "type": "boolean", + "description": "Whether to force attach the disk even if it's currently attached to another instance. This is only available for regional disks.", + "location": "query" + }, "instance": { "type": "string", "description": "The instance name for this request.", @@ -15754,6 +17492,57 @@ "https://www.googleapis.com/auth/compute", "https://www.googleapis.com/auth/compute.readonly" ] + }, + "updateAccessConfig": { + "id": "compute.instances.updateAccessConfig", + "path": "{project}/zones/{zone}/instances/{instance}/updateAccessConfig", + "httpMethod": "POST", + "description": "Updates the specified access config from an instance's network interface with the data included in the request.", + "parameters": { + "instance": { + "type": "string", + "description": "The instance name for this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + }, + "networkInterface": { + "type": "string", + "description": "The name of the network interface where the access config is attached.", + "required": true, + "location": "query" + }, + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "zone": { + "type": "string", + "description": "The name of the zone for this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "zone", + "instance", + "networkInterface" + ], + "request": { + "$ref": "AccessConfig" + }, + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute" + ] } } }, @@ -15951,6 +17740,42 @@ }, "networks": { "methods": { + "addPeering": { + "id": "compute.networks.addPeering", + "path": "{project}/global/networks/{network}/addPeering", + "httpMethod": "POST", + "description": "Adds a peering to the specified network.", + "parameters": { + "network": { + "type": "string", + "description": "Name of the network resource to add peering to.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + }, + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "network" + ], + "request": { + "$ref": "NetworksAddPeeringRequest" + }, + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute" + ] + }, "delete": { "id": "compute.networks.delete", "path": "{project}/global/networks/{network}", @@ -16096,6 +17921,42 @@ "https://www.googleapis.com/auth/compute.readonly" ] }, + "removePeering": { + "id": "compute.networks.removePeering", + "path": "{project}/global/networks/{network}/removePeering", + "httpMethod": "POST", + "description": "Removes a peering from the specified network.", + "parameters": { + "network": { + "type": "string", + "description": "Name of the network resource to remove peering from.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + }, + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "network" + ], + "request": { + "$ref": "NetworksRemovePeeringRequest" + }, + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute" + ] + }, "switchToCustomMode": { "id": "compute.networks.switchToCustomMode", "path": "{project}/global/networks/{network}/switchToCustomMode", @@ -16324,7 +18185,8 @@ }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/compute" + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/compute.readonly" ] }, "getXpnResources": { @@ -16349,7 +18211,8 @@ }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/compute" + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/compute.readonly" ] }, "listXpnHosts": { @@ -16377,7 +18240,8 @@ }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/compute" + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/compute.readonly" ] }, "moveDisk": { @@ -16464,6 +18328,34 @@ "https://www.googleapis.com/auth/compute" ] }, + "setDefaultServiceAccount": { + "id": "compute.projects.setDefaultServiceAccount", + "path": "{project}/setDefaultServiceAccount", + "httpMethod": "POST", + "description": "Sets the default service account of the project. The default service account is used when a VM instance is created with the service account email address set to \"default\".", + "parameters": { + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + } + }, + "parameterOrder": [ + "project" + ], + "request": { + "$ref": "ProjectsSetDefaultServiceAccountRequest" + }, + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute" + ] + }, "setUsageExportBucket": { "id": "compute.projects.setUsageExportBucket", "path": "{project}/setUsageExportBucket", @@ -16680,7 +18572,7 @@ "id": "compute.regionAutoscalers.patch", "path": "{project}/regions/{region}/autoscalers", "httpMethod": "PATCH", - "description": "Updates a autoscaler in the specified project using the data included in the request. This method supports patch semantics.", + "description": "Updates an autoscaler in the specified project using the data included in the request. This method supports patch semantics.", "parameters": { "autoscaler": { "type": "string", @@ -16769,7 +18661,7 @@ "id": "compute.regionAutoscalers.update", "path": "{project}/regions/{region}/autoscalers", "httpMethod": "PUT", - "description": "Updates a autoscaler in the specified project using the data included in the request.", + "description": "Updates an autoscaler in the specified project using the data included in the request.", "parameters": { "autoscaler": { "type": "string", @@ -17036,7 +18928,7 @@ "id": "compute.regionBackendServices.patch", "path": "{project}/regions/{region}/backendServices/{backendService}", "httpMethod": "PATCH", - "description": "Update the entire content of the regional BackendService resource. There are several restrictions and guidelines to keep in mind when updating a backend service. Read Restrictions and Guidelines for more information. This method supports patch semantics.", + "description": "Updates the specified regional BackendService resource with the data included in the request. There are several restrictions and guidelines to keep in mind when updating a backend service. Read Restrictions and Guidelines for more information. This method supports patch semantics.", "parameters": { "backendService": { "type": "string", @@ -17125,7 +19017,7 @@ "id": "compute.regionBackendServices.update", "path": "{project}/regions/{region}/backendServices/{backendService}", "httpMethod": "PUT", - "description": "Update the entire content of the regional BackendService resource. There are several restrictions and guidelines to keep in mind when updating a backend service. Read Restrictions and Guidelines for more information.", + "description": "Updates the specified regional BackendService resource with the data included in the request. There are several restrictions and guidelines to keep in mind when updating a backend service. Read Restrictions and Guidelines for more information.", "parameters": { "backendService": { "type": "string", @@ -17494,7 +19386,7 @@ "region" ], "response": { - "$ref": "RegionDiskList" + "$ref": "DiskList" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", @@ -17766,7 +19658,7 @@ "id": "compute.regionInstanceGroupManagers.get", "path": "{project}/regions/{region}/instanceGroupManagers/{instanceGroupManager}", "httpMethod": "GET", - "description": "Returns all of the details for the specified managed instance group.", + "description": "Returns all of the details about the specified managed instance group.", "parameters": { "instanceGroupManager": { "type": "string", @@ -17900,12 +19792,32 @@ "httpMethod": "POST", "description": "Lists the instances in the managed instance group and instances that are scheduled to be created. The list includes any current actions that the group has scheduled for its instances.", "parameters": { + "filter": { + "type": "string", + "location": "query" + }, "instanceGroupManager": { "type": "string", "description": "The name of the managed instance group.", "required": true, "location": "path" }, + "maxResults": { + "type": "integer", + "default": "500", + "format": "uint32", + "minimum": "0", + "maximum": "500", + "location": "query" + }, + "order_by": { + "type": "string", + "location": "query" + }, + "pageToken": { + "type": "string", + "location": "query" + }, "project": { "type": "string", "description": "Project ID for this request.", @@ -18112,7 +20024,7 @@ "id": "compute.regionInstanceGroupManagers.setInstanceTemplate", "path": "{project}/regions/{region}/instanceGroupManagers/{instanceGroupManager}/setInstanceTemplate", "httpMethod": "POST", - "description": "Sets the instance template to use when creating new instances in this group. Existing instances are not affected.", + "description": "Sets the instance template to use when creating new instances or recreating instances in this group. Existing instances are not affected.", "parameters": { "instanceGroupManager": { "type": "string", @@ -19041,7 +20953,7 @@ "id": "compute.routers.patch", "path": "{project}/regions/{region}/routers/{router}", "httpMethod": "PATCH", - "description": "Updates the entire content of the Router resource. This method supports patch semantics.", + "description": "Updates the specified Router resource with the data included in the request. This method supports patch semantics.", "parameters": { "project": { "type": "string", @@ -19175,7 +21087,7 @@ "id": "compute.routers.update", "path": "{project}/regions/{region}/routers/{router}", "httpMethod": "PUT", - "description": "Updates the entire content of the Router resource.", + "description": "Updates the specified Router resource with the data included in the request.", "parameters": { "project": { "type": "string", @@ -20143,6 +22055,50 @@ "https://www.googleapis.com/auth/compute.readonly" ] }, + "setPrivateIpGoogleAccess": { + "id": "compute.subnetworks.setPrivateIpGoogleAccess", + "path": "{project}/regions/{region}/subnetworks/{subnetwork}/setPrivateIpGoogleAccess", + "httpMethod": "POST", + "description": "Set whether VMs in this subnet can access Google services without assigning external IP addresses through Cloudpath.", + "parameters": { + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "region": { + "type": "string", + "description": "Name of the region scoping this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + }, + "subnetwork": { + "type": "string", + "description": "Name of the Subnetwork resource.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "region", + "subnetwork" + ], + "request": { + "$ref": "SubnetworksSetPrivateIpGoogleAccessRequest" + }, + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute" + ] + }, "testIamPermissions": { "id": "compute.subnetworks.testIamPermissions", "path": "{project}/regions/{region}/subnetworks/{resource}/testIamPermissions", @@ -21787,6 +23743,264 @@ } } }, + "targetTcpProxies": { + "methods": { + "delete": { + "id": "compute.targetTcpProxies.delete", + "path": "{project}/global/targetTcpProxies/{targetTcpProxy}", + "httpMethod": "DELETE", + "description": "Deletes the specified TargetTcpProxy resource.", + "parameters": { + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "targetTcpProxy": { + "type": "string", + "description": "Name of the TargetTcpProxy resource to delete.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "targetTcpProxy" + ], + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute" + ] + }, + "get": { + "id": "compute.targetTcpProxies.get", + "path": "{project}/global/targetTcpProxies/{targetTcpProxy}", + "httpMethod": "GET", + "description": "Returns the specified TargetTcpProxy resource. Get a list of available target TCP proxies by making a list() request.", + "parameters": { + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "targetTcpProxy": { + "type": "string", + "description": "Name of the TargetTcpProxy resource to return.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "targetTcpProxy" + ], + "response": { + "$ref": "TargetTcpProxy" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/compute.readonly" + ] + }, + "insert": { + "id": "compute.targetTcpProxies.insert", + "path": "{project}/global/targetTcpProxies", + "httpMethod": "POST", + "description": "Creates a TargetTcpProxy resource in the specified project using the data included in the request.", + "parameters": { + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + } + }, + "parameterOrder": [ + "project" + ], + "request": { + "$ref": "TargetTcpProxy" + }, + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute" + ] + }, + "list": { + "id": "compute.targetTcpProxies.list", + "path": "{project}/global/targetTcpProxies", + "httpMethod": "GET", + "description": "Retrieves the list of TargetTcpProxy resources available to the specified project.", + "parameters": { + "filter": { + "type": "string", + "description": "Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string.\n\nThe field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field.\n\nFor example, to filter for instances that do not have a name of example-instance, you would use filter=name ne example-instance.\n\nYou can filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. Use filtering on nested fields to take advantage of labels to organize and search for results based on label values.\n\nTo filter on multiple expressions, provide each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions, meaning that resources must match all expressions to pass the filters.", + "location": "query" + }, + "maxResults": { + "type": "integer", + "description": "The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests.", + "default": "500", + "format": "uint32", + "minimum": "0", + "maximum": "500", + "location": "query" + }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", + "location": "query" + }, + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + } + }, + "parameterOrder": [ + "project" + ], + "response": { + "$ref": "TargetTcpProxyList" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/compute.readonly" + ] + }, + "setBackendService": { + "id": "compute.targetTcpProxies.setBackendService", + "path": "{project}/global/targetTcpProxies/{targetTcpProxy}/setBackendService", + "httpMethod": "POST", + "description": "Changes the BackendService for TargetTcpProxy.", + "parameters": { + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "targetTcpProxy": { + "type": "string", + "description": "Name of the TargetTcpProxy resource whose BackendService resource is to be set.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "targetTcpProxy" + ], + "request": { + "$ref": "TargetTcpProxiesSetBackendServiceRequest" + }, + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute" + ] + }, + "setProxyHeader": { + "id": "compute.targetTcpProxies.setProxyHeader", + "path": "{project}/global/targetTcpProxies/{targetTcpProxy}/setProxyHeader", + "httpMethod": "POST", + "description": "Changes the ProxyHeaderType for TargetTcpProxy.", + "parameters": { + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "targetTcpProxy": { + "type": "string", + "description": "Name of the TargetTcpProxy resource whose ProxyHeader is to be set.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "targetTcpProxy" + ], + "request": { + "$ref": "TargetTcpProxiesSetProxyHeaderRequest" + }, + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute" + ] + }, + "testIamPermissions": { + "id": "compute.targetTcpProxies.testIamPermissions", + "path": "{project}/global/targetTcpProxies/{resource}/testIamPermissions", + "httpMethod": "POST", + "description": "Returns permissions that a caller has on the specified resource.", + "parameters": { + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "resource": { + "type": "string", + "description": "Name of the resource for this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9_]{0,61}[a-z0-9])?", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "resource" + ], + "request": { + "$ref": "TestPermissionsRequest" + }, + "response": { + "$ref": "TestPermissionsResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/compute.readonly" + ] + } + } + }, "targetVpnGateways": { "methods": { "aggregatedList": { @@ -22250,7 +24464,7 @@ "id": "compute.urlMaps.patch", "path": "{project}/global/urlMaps/{urlMap}", "httpMethod": "PATCH", - "description": "Updates the entire content of the UrlMap resource. This method supports patch semantics.", + "description": "Updates the specified UrlMap resource with the data included in the request. This method supports patch semantics.", "parameters": { "project": { "type": "string", @@ -22323,7 +24537,7 @@ "id": "compute.urlMaps.update", "path": "{project}/global/urlMaps/{urlMap}", "httpMethod": "PUT", - "description": "Updates the entire content of the UrlMap resource.", + "description": "Updates the specified UrlMap resource with the data included in the request.", "parameters": { "project": { "type": "string", diff --git a/etc/api/compute/beta/compute-api.json b/etc/api/compute/beta/compute-api.json index fb1aa0b0ac..cb83728e12 100644 --- a/etc/api/compute/beta/compute-api.json +++ b/etc/api/compute/beta/compute-api.json @@ -1,11 +1,11 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/8RdBsrY5Sd00svzgdJBUxxYBOv0\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/W53MDz4wFFhI7YEGcKxK5fiKMY8\"", "discoveryVersion": "v1", "id": "compute:beta", "name": "compute", "version": "beta", - "revision": "20160908", + "revision": "20161123", "title": "Compute Engine API", "description": "Creates and runs virtual machines on Google Cloud Platform.", "ownerDomain": "google.com", @@ -398,7 +398,7 @@ }, "source": { "type": "string", - "description": "Specifies a valid partial or full URL to an existing Persistent Disk resource. This field is only applicable for persistent disks. Note that for InstanceTemplate, it is just disk name, not URL for the disk." + "description": "Specifies a valid partial or full URL to an existing Persistent Disk resource. When creating a new instance, one of initializeParams.sourceImage or disks.source is required.\n\nIf desired, you can also attach existing non-root persistent disks using this property. This field is only applicable for persistent disks.\n\nNote that for InstanceTemplate, specify the disk name, not the URL for the disk." }, "type": { "type": "string", @@ -451,7 +451,7 @@ }, "sourceImage": { "type": "string", - "description": "The source image used to create this disk. If the source image is deleted, this field will not be set.\n\nTo create a disk with one of the public operating system images, specify the image by its family name. For example, specify family/debian-8 to use the latest Debian 8 image:\n\nprojects/debian-cloud/global/images/family/debian-8 \n\nAlternatively, use a specific version of a public operating system image:\n\nprojects/debian-cloud/global/images/debian-8-jessie-vYYYYMMDD \n\nTo create a disk with a private image that you created, specify the image name in the following format:\n\nglobal/images/my-private-image \n\nYou can also specify a private image by its image family, which returns the latest version of the image in that family. Replace the image name with family/family-name:\n\nglobal/images/family/my-private-family" + "description": "The source image to create this disk. When creating a new instance, one of initializeParams.sourceImage or disks.source is required.\n\nTo create a disk with one of the public operating system images, specify the image by its family name. For example, specify family/debian-8 to use the latest Debian 8 image:\n\nprojects/debian-cloud/global/images/family/debian-8 \n\nAlternatively, use a specific version of a public operating system image:\n\nprojects/debian-cloud/global/images/debian-8-jessie-vYYYYMMDD \n\nTo create a disk with a private image that you created, specify the image name in the following format:\n\nglobal/images/my-private-image \n\nYou can also specify a private image by its image family, which returns the latest version of the image in that family. Replace the image name with family/family-name:\n\nglobal/images/family/my-private-family \n\nIf the source image is deleted later, this field will not be set." }, "sourceImageEncryptionKey": { "$ref": "CustomerEncryptionKey", @@ -459,6 +459,61 @@ } } }, + "AuditConfig": { + "id": "AuditConfig", + "type": "object", + "description": "Provides the configuration for non-admin_activity logging for a service. Controls exemptions and specific log sub-types.", + "properties": { + "auditLogConfigs": { + "type": "array", + "description": "The configuration for each type of logging", + "items": { + "$ref": "AuditLogConfig" + } + }, + "exemptedMembers": { + "type": "array", + "description": "Specifies the identities that are exempted from \"data access\" audit logging for the `service` specified above. Follows the same format of Binding.members.", + "items": { + "type": "string" + } + }, + "service": { + "type": "string", + "description": "Specifies a service that will be enabled for audit logging. For example, `resourcemanager`, `storage`, `compute`. `allServices` is a special value that covers all services." + } + } + }, + "AuditLogConfig": { + "id": "AuditLogConfig", + "type": "object", + "description": "Provides the configuration for a sub-type of logging.", + "properties": { + "exemptedMembers": { + "type": "array", + "description": "Specifies the identities that are exempted from this type of logging Follows the same format of Binding.members.", + "items": { + "type": "string" + } + }, + "logType": { + "type": "string", + "description": "The log type that this config enables.", + "enum": [ + "ADMIN_READ", + "DATA_READ", + "DATA_WRITE", + "LOG_TYPE_UNSPECIFIED" + ], + "enumDescriptions": [ + "", + "", + "", + "" + ] + } + } + }, "Autoscaler": { "id": "Autoscaler", "type": "object", @@ -522,7 +577,7 @@ }, "statusDetails": { "type": "array", - "description": "[Output Only] Human-readable details about the current state of the autoscaler. Examples: ?Error when fetching replicas: Replica Pool xxx doesn?t exist.? ?Autoscaling capped at min_num_replicas: 2.?", + "description": "[Output Only] Human-readable details about the current state of the autoscaler. Read the documentation for Commonly returned status messages for examples of status messages you might encounter.", "items": { "$ref": "AutoscalerStatusDetails" } @@ -604,10 +659,12 @@ "type": "object", "properties": { "message": { - "type": "string" + "type": "string", + "description": "The status message." }, "type": { "type": "string", + "description": "The type of error returned.", "enum": [ "ALL_INSTANCES_UNHEALTHY", "BACKEND_SERVICE_DOES_NOT_EXIST", @@ -777,7 +834,7 @@ "properties": { "metric": { "type": "string", - "description": "The identifier of the Cloud Monitoring metric. The metric cannot have negative values and should be a utilization metric, which means that the number of virtual machines handling requests should increase or decrease proportionally to the metric. The metric must also have a label of compute.googleapis.com/resource_id with the value of the instance's unique ID, although this alone does not guarantee that the metric is valid.\n\nFor example, the following is a valid metric:\ncompute.googleapis.com/instance/network/received_bytes_count\n\n\nThe following is not a valid metric because it does not increase or decrease based on usage:\ncompute.googleapis.com/instance/cpu/reserved_cores" + "description": "The identifier of the Stackdriver Monitoring metric. The metric cannot have negative values and should be a utilization metric, which means that the number of virtual machines handling requests should increase or decrease proportionally to the metric. The metric must also have a label of compute.googleapis.com/resource_id with the value of the instance's unique ID, although this alone does not guarantee that the metric is valid.\n\nFor example, the following is a valid metric:\ncompute.googleapis.com/instance/network/received_bytes_count\nThe following is not a valid metric because it does not increase or decrease based on usage:\ncompute.googleapis.com/instance/cpu/reserved_cores" }, "utilizationTarget": { "type": "number", @@ -786,7 +843,7 @@ }, "utilizationTargetType": { "type": "string", - "description": "Defines how target utilization value is expressed for a Cloud Monitoring metric. Either GAUGE, DELTA_PER_SECOND, or DELTA_PER_MINUTE. If not specified, the default is GAUGE.", + "description": "Defines how target utilization value is expressed for a Stackdriver Monitoring metric. Either GAUGE, DELTA_PER_SECOND, or DELTA_PER_MINUTE. If not specified, the default is GAUGE.", "enum": [ "DELTA_PER_MINUTE", "DELTA_PER_SECOND", @@ -871,6 +928,79 @@ } } }, + "BackendBucket": { + "id": "BackendBucket", + "type": "object", + "description": "A BackendBucket resource. This resource defines a Cloud Storage bucket.", + "properties": { + "bucketName": { + "type": "string", + "description": "Cloud Storage bucket name." + }, + "creationTimestamp": { + "type": "string", + "description": "[Output Only] Creation timestamp in RFC3339 text format." + }, + "description": { + "type": "string", + "description": "An optional textual description of the resource; provided by the client when the resource is created." + }, + "enableCdn": { + "type": "boolean", + "description": "If true, enable Cloud CDN for this BackendBucket." + }, + "id": { + "type": "string", + "description": "[Output Only] Unique identifier for the resource; defined by the server.", + "format": "uint64" + }, + "kind": { + "type": "string", + "description": "Type of the resource.", + "default": "compute#backendBucket" + }, + "name": { + "type": "string", + "description": "Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.", + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?" + }, + "selfLink": { + "type": "string", + "description": "[Output Only] Server-defined URL for the resource." + } + } + }, + "BackendBucketList": { + "id": "BackendBucketList", + "type": "object", + "description": "Contains a list of BackendBucket resources.", + "properties": { + "id": { + "type": "string", + "description": "[Output Only] Unique identifier for the resource; defined by the server." + }, + "items": { + "type": "array", + "description": "A list of BackendBucket resources.", + "items": { + "$ref": "BackendBucket" + } + }, + "kind": { + "type": "string", + "description": "Type of resource.", + "default": "compute#backendBucketList" + }, + "nextPageToken": { + "type": "string", + "description": "[Output Only] A token used to continue a truncated list request." + }, + "selfLink": { + "type": "string", + "description": "[Output Only] Server-defined URL for this resource." + } + } + }, "BackendService": { "id": "BackendService", "type": "object", @@ -915,6 +1045,9 @@ "type": "string" } }, + "iap": { + "$ref": "BackendServiceIAP" + }, "id": { "type": "string", "description": "[Output Only] The unique identifier for the resource. This identifier is defined by the server.", @@ -1052,6 +1185,25 @@ } } }, + "BackendServiceIAP": { + "id": "BackendServiceIAP", + "type": "object", + "description": "Identity-Aware Proxy (Cloud Gatekeeper)", + "properties": { + "enabled": { + "type": "boolean" + }, + "oauth2ClientId": { + "type": "string" + }, + "oauth2ClientSecret": { + "type": "string" + }, + "oauth2ClientSecretSha256": { + "type": "string" + } + } + }, "BackendServiceList": { "id": "BackendServiceList", "type": "object", @@ -1163,15 +1315,113 @@ } } }, + "Binding": { + "id": "Binding", + "type": "object", + "description": "Associates `members` with a `role`.", + "properties": { + "members": { + "type": "array", + "description": "Specifies the identities requesting access for a Cloud Platform resource. `members` can have the following values:\n\n* `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account.\n\n* `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account.\n\n* `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@gmail.com` or `joe@example.com`.\n\n\n\n* `serviceAccount:{emailid}`: An email address that represents a service account. For example, `my-other-app@appspot.gserviceaccount.com`.\n\n* `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`.\n\n* `domain:{domain}`: A Google Apps domain name that represents all the users of that domain. For example, `google.com` or `example.com`.", + "items": { + "type": "string" + } + }, + "role": { + "type": "string", + "description": "Role that is assigned to `members`. For example, `roles/viewer`, `roles/editor`, or `roles/owner`." + } + } + }, "CacheInvalidationRule": { "id": "CacheInvalidationRule", "type": "object", "properties": { + "host": { + "type": "string", + "description": "If set, this invalidation rule will only apply to requests with a Host header matching host." + }, "path": { "type": "string" } } }, + "Condition": { + "id": "Condition", + "type": "object", + "description": "A condition to be met.", + "properties": { + "iam": { + "type": "string", + "description": "Trusted attributes supplied by the IAM system.", + "enum": [ + "ATTRIBUTION", + "AUTHORITY", + "NO_ATTR", + "SECURITY_REALM" + ], + "enumDescriptions": [ + "", + "", + "", + "" + ] + }, + "op": { + "type": "string", + "description": "An operator to apply the subject with.", + "enum": [ + "DISCHARGED", + "EQUALS", + "IN", + "NOT_EQUALS", + "NOT_IN", + "NO_OP" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "", + "" + ] + }, + "svc": { + "type": "string", + "description": "Trusted attributes discharged by the service." + }, + "sys": { + "type": "string", + "description": "Trusted attributes supplied by any service that owns resources and uses the IAM system for access control.", + "enum": [ + "IP", + "NAME", + "NO_ATTR", + "REGION", + "SERVICE" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "" + ] + }, + "value": { + "type": "string", + "description": "DEPRECATED. Use 'values' instead." + }, + "values": { + "type": "array", + "description": "The objects of the condition. This is mutually exclusive with 'value'.", + "items": { + "type": "string" + } + } + } + }, "ConnectionDraining": { "id": "ConnectionDraining", "type": "object", @@ -1224,15 +1474,15 @@ "properties": { "deleted": { "type": "string", - "description": "An optional RFC3339 timestamp on or after which the deprecation state of this resource will be changed to DELETED." + "description": "An optional RFC3339 timestamp on or after which the state of this resource is intended to change to DELETED. This is only informational and the status will not change unless the client explicitly changes it." }, "deprecated": { "type": "string", - "description": "An optional RFC3339 timestamp on or after which the deprecation state of this resource will be changed to DEPRECATED." + "description": "An optional RFC3339 timestamp on or after which the state of this resource is intended to change to DEPRECATED. This is only informational and the status will not change unless the client explicitly changes it." }, "obsolete": { "type": "string", - "description": "An optional RFC3339 timestamp on or after which the deprecation state of this resource will be changed to OBSOLETE." + "description": "An optional RFC3339 timestamp on or after which the state of this resource is intended to change to OBSOLETE. This is only informational and the status will not change unless the client explicitly changes it." }, "replacement": { "type": "string", @@ -1357,7 +1607,7 @@ }, "status": { "type": "string", - "description": "[Output Only] The status of disk creation. Applicable statuses includes: CREATING, FAILED, READY, RESTORING.", + "description": "[Output Only] The status of disk creation.", "enum": [ "CREATING", "FAILED", @@ -1891,6 +2141,7 @@ "enum": [ "AH", "ESP", + "ICMP", "SCTP", "TCP", "UDP" @@ -1900,6 +2151,7 @@ "", "", "", + "", "" ] }, @@ -2140,54 +2392,21 @@ "GuestOsFeature": { "id": "GuestOsFeature", "type": "object", - "description": "Features supported by the guest os.", + "description": "Guest OS features.", "properties": { "type": { "type": "string", - "description": "The type of supported feature..", + "description": "The type of supported feature. Currenty only VIRTIO_SCSI_MULTIQUEUE is supported. For newer Windows images, the server might also populate this property with the value WINDOWS to indicate that this is a Windows image. This value is purely informational and does not enable or disable any features.", "enum": [ "FEATURE_TYPE_UNSPECIFIED", - "VIRTIO_SCSI_MULTIQUEUE" + "VIRTIO_SCSI_MULTIQUEUE", + "WINDOWS" ], "enumDescriptions": [ "", - "" - ] - } - } - }, - "HTTP2HealthCheck": { - "id": "HTTP2HealthCheck", - "type": "object", - "properties": { - "host": { - "type": "string", - "description": "The value of the host header in the HTTP/2 health check request. If left empty (default value), the IP on behalf of which this health check is performed will be used." - }, - "port": { - "type": "integer", - "description": "The TCP port number for the health check request. The default value is 443.", - "format": "int32" - }, - "portName": { - "type": "string", - "description": "Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name are defined, port takes precedence." - }, - "proxyHeader": { - "type": "string", - "description": "Specifies the type of proxy header to append before sending data to the backend, either NONE or PROXY_V1. The default is NONE.", - "enum": [ - "NONE", - "PROXY_V1" - ], - "enumDescriptions": [ "", "" ] - }, - "requestPath": { - "type": "string", - "description": "The request path of the HTTP/2 health check request. The default value is /." } } }, @@ -2284,9 +2503,6 @@ "description": "A so-far unhealthy instance will be marked healthy after this many consecutive successes. The default value is 2.", "format": "int32" }, - "http2HealthCheck": { - "$ref": "HTTP2HealthCheck" - }, "httpHealthCheck": { "$ref": "HTTPHealthCheck" }, @@ -2325,14 +2541,14 @@ }, "type": { "type": "string", - "description": "Specifies the type of the healthCheck, either TCP, UDP, SSL, HTTP, HTTPS or HTTP2. If not specified, the default is TCP. Exactly one of the protocol-specific health check field must be specified, which must match type field.", + "description": "Specifies the type of the healthCheck, either TCP, SSL, HTTP or HTTPS. If not specified, the default is TCP. Exactly one of the protocol-specific health check field must be specified, which must match type field.", "enum": [ "HTTP", - "HTTP2", "HTTPS", "INVALID", "SSL", - "TCP" + "TCP", + "UDP" ], "enumDescriptions": [ "", @@ -2343,6 +2559,9 @@ "" ] }, + "udpHealthCheck": { + "$ref": "UDPHealthCheck" + }, "unhealthyThreshold": { "type": "integer", "description": "A so-far healthy instance will be marked unhealthy after this many consecutive failures. The default value is 2.", @@ -2652,7 +2871,7 @@ }, "creationTimestamp": { "type": "string", - "description": "Creation timestamp in RFC3339 text format." + "description": "[Output Only] Creation timestamp in RFC3339 text format." }, "deprecated": { "$ref": "DeprecationStatus", @@ -2673,7 +2892,7 @@ }, "guestOsFeatures": { "type": "array", - "description": "Features of the guest os, valid for bootable images only.", + "description": "A list of features to enable on the guest OS. Applicable for bootable images only. Currently, only one feature can be enabled, VIRTIO_SCSCI_MULTIQUEUE, which allows each virtual CPU to have its own queue. For Windows images, you can only enable VIRTIO_SCSCI_MULTIQUEUE on images with driver version 1.2.0.1621 or higher. Linux images with kernel versions 3.17 and higher will support VIRTIO_SCSCI_MULTIQUEUE.\n\nFor new Windows images, the server might also populate this field with the value WINDOWS, to indicate that this is a Windows image. This value is purely informational and does not enable or disable any features.", "items": { "$ref": "GuestOsFeature" } @@ -2757,7 +2976,7 @@ }, "sourceDisk": { "type": "string", - "description": "URL of the The source disk used to create this image. This can be a full or valid partial URL. You must provide either this property or the rawDisk.source property but not both to create an image. For example, the following are valid values: \n- https://www.googleapis.com/compute/v1/projects/project/zones/zone/disk/disk \n- projects/project/zones/zone/disk/disk \n- zones/zone/disks/disk" + "description": "URL of the source disk used to create this image. This can be a full or valid partial URL. You must provide either this property or the rawDisk.source property but not both to create an image. For example, the following are valid values: \n- https://www.googleapis.com/compute/v1/projects/project/zones/zone/disks/disk \n- projects/project/zones/zone/disks/disk \n- zones/zone/disks/disk" }, "sourceDiskEncryptionKey": { "$ref": "CustomerEncryptionKey", @@ -3002,7 +3221,7 @@ }, "id": { "type": "string", - "description": "[Output Only] A unique identifier for this instance group. The server generates this identifier.", + "description": "[Output Only] A unique identifier for this instance group, generated by the server.", "format": "uint64" }, "kind": { @@ -3152,7 +3371,7 @@ }, "failoverAction": { "type": "string", - "description": "The action to perform in case of zone failure (set only for Regional instance group managers).", + "description": "The action to perform in case of zone failure. Only one value is supported, NO_FAILOVER. The default is NO_FAILOVER.", "enum": [ "NO_FAILOVER", "UNKNOWN" @@ -3210,6 +3429,10 @@ "type": "string", "description": "[Output Only] The URL for this managed instance group. The server defines this URL." }, + "serviceAccount": { + "type": "string", + "description": "Service account will be used as credentials for all operations performed by managed instance group on instances. The service accounts needs all permissions required to create and delete instances. When not specified, the service account {projectNumber}@cloudservices.gserviceaccount.com will be used." + }, "targetPools": { "type": "array", "description": "The URLs for all TargetPool resources to which instances in the instanceGroup field are added. The target pools automatically apply to all of the instances in the managed instance group.", @@ -3249,7 +3472,7 @@ }, "creatingWithoutRetries": { "type": "integer", - "description": "[Output Only] The number of instances that the managed instance group will attempt to create. The group attempts to create each instance only once. If the group fails to create any of these instances, it decreases the group's target_size value accordingly.", + "description": "[Output Only] The number of instances that the managed instance group will attempt to create. The group attempts to create each instance only once. If the group fails to create any of these instances, it decreases the group's targetSize value accordingly.", "format": "int32" }, "deleting": { @@ -3316,7 +3539,7 @@ "properties": { "healthCheck": { "type": "string", - "description": "The URL for the HealthCheck that signals autohealing." + "description": "The URL for the health check that signals autohealing." }, "initialDelaySec": { "type": "integer", @@ -3352,7 +3575,7 @@ }, "selfLink": { "type": "string", - "description": "[Output Only] The URL for this resource type. The server generates this URL." + "description": "[Output Only] Server-defined URL for this resource." } } }, @@ -4057,6 +4280,23 @@ } } }, + "InstancesSetServiceAccountRequest": { + "id": "InstancesSetServiceAccountRequest", + "type": "object", + "properties": { + "email": { + "type": "string", + "description": "Email address of the service account." + }, + "scopes": { + "type": "array", + "description": "The list of scopes to be made available for this service account.", + "items": { + "type": "string" + } + } + } + }, "InstancesStartWithEncryptionKeyRequest": { "id": "InstancesStartWithEncryptionKeyRequest", "type": "object", @@ -4100,6 +4340,32 @@ } } }, + "LogConfig": { + "id": "LogConfig", + "type": "object", + "description": "Specifies what kind of log the caller must write", + "properties": { + "counter": { + "$ref": "LogConfigCounterOptions", + "description": "Counter options." + } + } + }, + "LogConfigCounterOptions": { + "id": "LogConfigCounterOptions", + "type": "object", + "description": "Options for counters", + "properties": { + "field": { + "type": "string", + "description": "The field value to attribute." + }, + "metric": { + "type": "string", + "description": "The metric to update." + } + } + }, "MachineType": { "id": "MachineType", "type": "object", @@ -4593,7 +4859,7 @@ }, "selfLink": { "type": "string", - "description": "[Output Only] Server-defined URL for this resource ." + "description": "[Output Only] Server-defined URL for this resource." } } }, @@ -4718,7 +4984,7 @@ }, "targetLink": { "type": "string", - "description": "[Output Only] The URL of the resource that the operation modifies." + "description": "[Output Only] The URL of the resource that the operation modifies. For operations related to creating a snapshot, this points to the persistent disk that the snapshot was created from." }, "user": { "type": "string", @@ -4986,6 +5252,48 @@ } } }, + "Policy": { + "id": "Policy", + "type": "object", + "description": "Defines an Identity and Access Management (IAM) policy. It is used to specify access control policies for Cloud Platform resources.\n\n\n\nA `Policy` consists of a list of `bindings`. A `Binding` binds a list of `members` to a `role`, where the members can be user accounts, Google groups, Google domains, and service accounts. A `role` is a named list of permissions defined by IAM.\n\n**Example**\n\n{ \"bindings\": [ { \"role\": \"roles/owner\", \"members\": [ \"user:mike@example.com\", \"group:admins@example.com\", \"domain:google.com\", \"serviceAccount:my-other-app@appspot.gserviceaccount.com\", ] }, { \"role\": \"roles/viewer\", \"members\": [\"user:sean@example.com\"] } ] }\n\nFor a description of IAM and its features, see the [IAM developer's guide](https://cloud.google.com/iam).", + "properties": { + "auditConfigs": { + "type": "array", + "description": "Specifies audit logging configs for \"data access\". \"data access\": generally refers to data reads/writes and admin reads. \"admin activity\": generally refers to admin writes.\n\nNote: `AuditConfig` doesn't apply to \"admin activity\", which always enables audit logging.", + "items": { + "$ref": "AuditConfig" + } + }, + "bindings": { + "type": "array", + "description": "Associates a list of `members` to a `role`. Multiple `bindings` must not be specified for the same `role`. `bindings` with no members will result in an error.", + "items": { + "$ref": "Binding" + } + }, + "etag": { + "type": "string", + "description": "`etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other. It is strongly suggested that systems make use of the `etag` in the read-modify-write cycle to perform policy updates in order to avoid race conditions: An `etag` is returned in the response to `getIamPolicy`, and systems are expected to put that etag in the request to `setIamPolicy` to ensure that their change will be applied to the same version of the policy.\n\nIf no `etag` is provided in the call to `setIamPolicy`, then the existing policy is overwritten blindly.", + "format": "byte" + }, + "iamOwned": { + "type": "boolean", + "description": "" + }, + "rules": { + "type": "array", + "description": "If more than one rule is specified, the rules are applied in the following manner: - All matching LOG rules are always applied. - If any DENY/DENY_WITH_LOG rule matches, permission is denied. Logging will be applied if one or more matching rule requires logging. - Otherwise, if any ALLOW/ALLOW_WITH_LOG rule matches, permission is granted. Logging will be applied if one or more matching rule requires logging. - Otherwise, if no rule applies, permission is denied.", + "items": { + "$ref": "Rule" + } + }, + "version": { + "type": "integer", + "description": "Version of the `Policy`. The default version is 0.", + "format": "int32" + } + } + }, "Project": { "id": "Project", "type": "object", @@ -5042,6 +5350,28 @@ "usageExportLocation": { "$ref": "UsageExportLocation", "description": "The naming prefix for daily usage reports and the Google Cloud Storage bucket where they are stored." + }, + "xpnProjectStatus": { + "type": "string", + "description": "[Output Only] The role this project has in a Cross Project Network (XPN) configuration. Currently only HOST projects are differentiated.", + "enum": [ + "HOST", + "UNSPECIFIED_XPN_PROJECT_STATUS" + ], + "enumDescriptions": [ + "", + "" + ] + } + } + }, + "ProjectsListXpnHostsRequest": { + "id": "ProjectsListXpnHostsRequest", + "type": "object", + "properties": { + "organization": { + "type": "string", + "description": "Optional organization ID managed by Cloud Resource Manager, for which to list XPN host projects. If not specified, the organization will be inferred from the project." } } }, @@ -5060,6 +5390,7 @@ "description": "[Output Only] Name of the quota metric.", "enum": [ "AUTOSCALERS", + "BACKEND_BUCKETS", "BACKEND_SERVICES", "CPUS", "DISKS_TOTAL_GB", @@ -5090,6 +5421,7 @@ "TARGET_POOLS", "TARGET_SSL_PROXIES", "TARGET_VPN_GATEWAYS", + "TOTAL_CPUS", "URL_MAPS", "VPN_TUNNELS" ], @@ -5126,6 +5458,8 @@ "", "", "", + "", + "", "" ] }, @@ -5492,7 +5826,7 @@ "properties": { "group": { "type": "string", - "description": "A URI referencing one of the resource views listed in the backend service." + "description": "A URI referencing one of the instance groups listed in the backend service." } } }, @@ -5727,7 +6061,7 @@ }, "interfaces": { "type": "array", - "description": "Router interfaces. Each interface requires either one linked resource (e.g. linkedVpnTunnel) or IP address and IP address range (e.g. ipRange).", + "description": "Router interfaces. Each interface requires either one linked resource (e.g. linkedVpnTunnel), or IP address and IP address range (e.g. ipRange), or both.", "items": { "$ref": "RouterInterface" } @@ -5888,7 +6222,7 @@ }, "selfLink": { "type": "string", - "description": "[Output Only] Server-defined URL for the resource." + "description": "[Output Only] Server-defined URL for this resource." } } }, @@ -6079,6 +6413,72 @@ } } }, + "Rule": { + "id": "Rule", + "type": "object", + "description": "A rule to be applied in a Policy.", + "properties": { + "action": { + "type": "string", + "description": "Required", + "enum": [ + "ALLOW", + "ALLOW_WITH_LOG", + "DENY", + "DENY_WITH_LOG", + "LOG", + "NO_ACTION" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "", + "" + ] + }, + "conditions": { + "type": "array", + "description": "Additional restrictions that must be met", + "items": { + "$ref": "Condition" + } + }, + "description": { + "type": "string", + "description": "Human-readable description of the rule." + }, + "ins": { + "type": "array", + "description": "If one or more 'in' clauses are specified, the rule matches if the PRINCIPAL/AUTHORITY_SELECTOR is in at least one of these entries.", + "items": { + "type": "string" + } + }, + "logConfigs": { + "type": "array", + "description": "The config returned to callers of tech.iam.IAM.CheckPolicy for any entries that match the LOG action.", + "items": { + "$ref": "LogConfig" + } + }, + "notIns": { + "type": "array", + "description": "If one or more 'not_in' clauses are specified, the rule matches if the PRINCIPAL/AUTHORITY_SELECTOR is in none of the entries.", + "items": { + "type": "string" + } + }, + "permissions": { + "type": "array", + "description": "A permission is a string of form '..' (e.g., 'storage.buckets.list'). A value of '*' matches all permissions, and a verb part of '*' (e.g., 'storage.buckets.*') matches all verbs.", + "items": { + "type": "string" + } + } + } + }, "SSLHealthCheck": { "id": "SSLHealthCheck", "type": "object", @@ -6162,7 +6562,7 @@ }, "selfLink": { "type": "string", - "description": "[Output Only] Server-defined URL for the resource." + "description": "[Output Only] Server-defined URL for this resource." }, "start": { "type": "string", @@ -6363,7 +6763,7 @@ }, "privateKey": { "type": "string", - "description": "A write-only private key in PEM format. Only insert RPCs will include this field." + "description": "A write-only private key in PEM format. Only insert requests will include this field." }, "selfLink": { "type": "string", @@ -7547,7 +7947,7 @@ }, "selfLink": { "type": "string", - "description": "[Output Only] Server-defined URL for the resource." + "description": "[Output Only] Server-defined URL for this resource." } } }, @@ -7578,7 +7978,7 @@ }, "selfLink": { "type": "string", - "description": "[Output Only] Server-defined URL for the resource." + "description": "[Output Only] Server-defined URL for this resource." } } }, @@ -7706,6 +8106,29 @@ } } }, + "UDPHealthCheck": { + "id": "UDPHealthCheck", + "type": "object", + "properties": { + "port": { + "type": "integer", + "description": "The UDP port number for the health check request.", + "format": "int32" + }, + "portName": { + "type": "string", + "description": "Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name are defined, port takes precedence." + }, + "request": { + "type": "string", + "description": "Raw data of request to send in payload of UDP packet. It is an error if this is empty. The request data can only be ASCII." + }, + "response": { + "type": "string", + "description": "The bytes to match against the beginning of the response data. It is an error if this is empty. The response data can only be ASCII." + } + } + }, "UrlMap": { "id": "UrlMap", "type": "object", @@ -8074,7 +8497,7 @@ }, "selfLink": { "type": "string", - "description": "[Output Only] Server-defined URL for the resource." + "description": "[Output Only] Server-defined URL for this resource." } } }, @@ -8158,6 +8581,36 @@ } } }, + "XpnHostList": { + "id": "XpnHostList", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "[Output Only] The unique identifier for the resource. This identifier is defined by the server." + }, + "items": { + "type": "array", + "description": "[Output Only] A list of XPN host project URLs.", + "items": { + "$ref": "Project" + } + }, + "kind": { + "type": "string", + "description": "[Output Only] Type of resource. Always compute#xpnHostList for lists of XPN hosts.", + "default": "compute#xpnHostList" + }, + "nextPageToken": { + "type": "string", + "description": "[Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results." + }, + "selfLink": { + "type": "string", + "description": "[Output Only] Server-defined URL for this resource." + } + } + }, "Zone": { "id": "Zone", "type": "object", @@ -8900,6 +9353,227 @@ } } }, + "backendBuckets": { + "methods": { + "delete": { + "id": "compute.backendBuckets.delete", + "path": "{project}/global/backendBuckets/{backendBucket}", + "httpMethod": "DELETE", + "description": "Deletes the specified BackendBucket resource.", + "parameters": { + "backendBucket": { + "type": "string", + "description": "Name of the BackendBucket resource to delete.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + }, + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "backendBucket" + ], + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute" + ] + }, + "get": { + "id": "compute.backendBuckets.get", + "path": "{project}/global/backendBuckets/{backendBucket}", + "httpMethod": "GET", + "description": "Returns the specified BackendBucket resource. Get a list of available backend buckets by making a list() request.", + "parameters": { + "backendBucket": { + "type": "string", + "description": "Name of the BackendBucket resource to return.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + }, + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "backendBucket" + ], + "response": { + "$ref": "BackendBucket" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/compute.readonly" + ] + }, + "insert": { + "id": "compute.backendBuckets.insert", + "path": "{project}/global/backendBuckets", + "httpMethod": "POST", + "description": "Creates a BackendBucket resource in the specified project using the data included in the request.", + "parameters": { + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + } + }, + "parameterOrder": [ + "project" + ], + "request": { + "$ref": "BackendBucket" + }, + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute" + ] + }, + "list": { + "id": "compute.backendBuckets.list", + "path": "{project}/global/backendBuckets", + "httpMethod": "GET", + "description": "Retrieves the list of BackendBucket resources available to the specified project.", + "parameters": { + "filter": { + "type": "string", + "description": "Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string.\n\nThe field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field.\n\nFor example, to filter for instances that do not have a name of example-instance, you would use filter=name ne example-instance.\n\nYou can filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. Use filtering on nested fields to take advantage of labels to organize and search for results based on label values.\n\nTo filter on multiple expressions, provide each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions, meaning that resources must match all expressions to pass the filters.", + "location": "query" + }, + "maxResults": { + "type": "integer", + "description": "The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests.", + "default": "500", + "format": "uint32", + "minimum": "0", + "maximum": "500", + "location": "query" + }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", + "location": "query" + }, + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + } + }, + "parameterOrder": [ + "project" + ], + "response": { + "$ref": "BackendBucketList" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/compute.readonly" + ] + }, + "patch": { + "id": "compute.backendBuckets.patch", + "path": "{project}/global/backendBuckets/{backendBucket}", + "httpMethod": "PATCH", + "description": "Updates the specified BackendBucket resource with the data included in the request. This method supports patch semantics.", + "parameters": { + "backendBucket": { + "type": "string", + "description": "Name of the BackendBucket resource to update.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + }, + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "backendBucket" + ], + "request": { + "$ref": "BackendBucket" + }, + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute" + ] + }, + "update": { + "id": "compute.backendBuckets.update", + "path": "{project}/global/backendBuckets/{backendBucket}", + "httpMethod": "PUT", + "description": "Updates the specified BackendBucket resource with the data included in the request.", + "parameters": { + "backendBucket": { + "type": "string", + "description": "Name of the BackendBucket resource to update.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + }, + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "backendBucket" + ], + "request": { + "$ref": "BackendBucket" + }, + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute" + ] + } + } + }, "backendServices": { "methods": { "aggregatedList": { @@ -9137,7 +9811,7 @@ "id": "compute.backendServices.patch", "path": "{project}/global/backendServices/{backendService}", "httpMethod": "PATCH", - "description": "Updates the entire content of the BackendService resource. There are several restrictions and guidelines to keep in mind when updating a backend service. Read Restrictions and Guidelines for more information. This method supports patch semantics.", + "description": "Updates the specified BackendService resource with the data included in the request. There are several restrictions and guidelines to keep in mind when updating a backend service. Read Restrictions and Guidelines for more information. This method supports patch semantics.", "parameters": { "backendService": { "type": "string", @@ -9210,7 +9884,7 @@ "id": "compute.backendServices.update", "path": "{project}/global/backendServices/{backendService}", "httpMethod": "PUT", - "description": "Updates the entire content of the BackendService resource. There are several restrictions and guidelines to keep in mind when updating a backend service. Read Restrictions and Guidelines for more information.", + "description": "Updates the specified BackendService resource with the data included in the request. There are several restrictions and guidelines to keep in mind when updating a backend service. Read Restrictions and Guidelines for more information.", "parameters": { "backendService": { "type": "string", @@ -9463,6 +10137,10 @@ "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", "location": "path" }, + "guestFlush": { + "type": "boolean", + "location": "query" + }, "project": { "type": "string", "description": "Project ID for this request.", @@ -12346,12 +13024,32 @@ "httpMethod": "POST", "description": "Lists all of the instances in the managed instance group. Each instance in the list has a currentAction, which indicates the action that the managed instance group is performing on the instance. For example, if the group is still creating an instance, the currentAction is CREATING. If a previous action failed, the list displays the errors for that failed action.", "parameters": { + "filter": { + "type": "string", + "location": "query" + }, "instanceGroupManager": { "type": "string", "description": "The name of the managed instance group.", "required": true, "location": "path" }, + "maxResults": { + "type": "integer", + "default": "500", + "format": "uint32", + "minimum": "0", + "maximum": "500", + "location": "query" + }, + "order_by": { + "type": "string", + "location": "query" + }, + "pageToken": { + "type": "string", + "location": "query" + }, "project": { "type": "string", "description": "Project ID for this request.", @@ -14090,6 +14788,50 @@ "https://www.googleapis.com/auth/compute" ] }, + "setServiceAccount": { + "id": "compute.instances.setServiceAccount", + "path": "{project}/zones/{zone}/instances/{instance}/setServiceAccount", + "httpMethod": "POST", + "description": "Sets the service account on the instance.", + "parameters": { + "instance": { + "type": "string", + "description": "Name of the instance resource to start.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + }, + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "zone": { + "type": "string", + "description": "The name of the zone for this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "zone", + "instance" + ], + "request": { + "$ref": "InstancesSetServiceAccountRequest" + }, + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute" + ] + }, "setTags": { "id": "compute.instances.setTags", "path": "{project}/zones/{zone}/instances/{instance}/setTags", @@ -14746,6 +15488,61 @@ "https://www.googleapis.com/auth/compute.readonly" ] }, + "getXpnHost": { + "id": "compute.projects.getXpnHost", + "path": "{project}/getXpnHost", + "httpMethod": "GET", + "description": "Get the XPN host project that this project links to. May be empty if no link exists.", + "parameters": { + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + } + }, + "parameterOrder": [ + "project" + ], + "response": { + "$ref": "Project" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/compute.readonly" + ] + }, + "listXpnHosts": { + "id": "compute.projects.listXpnHosts", + "path": "{project}/listXpnHosts", + "httpMethod": "POST", + "description": "List all XPN host projects visible to the user in an organization.", + "parameters": { + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + } + }, + "parameterOrder": [ + "project" + ], + "request": { + "$ref": "ProjectsListXpnHostsRequest" + }, + "response": { + "$ref": "XpnHostList" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/compute.readonly" + ] + }, "moveDisk": { "id": "compute.projects.moveDisk", "path": "{project}/moveDisk", @@ -15046,7 +15843,7 @@ "id": "compute.regionAutoscalers.patch", "path": "{project}/regions/{region}/autoscalers", "httpMethod": "PATCH", - "description": "Updates a autoscaler in the specified project using the data included in the request. This method supports patch semantics.", + "description": "Updates an autoscaler in the specified project using the data included in the request. This method supports patch semantics.", "parameters": { "autoscaler": { "type": "string", @@ -15135,7 +15932,7 @@ "id": "compute.regionAutoscalers.update", "path": "{project}/regions/{region}/autoscalers", "httpMethod": "PUT", - "description": "Updates a autoscaler in the specified project using the data included in the request.", + "description": "Updates an autoscaler in the specified project using the data included in the request.", "parameters": { "autoscaler": { "type": "string", @@ -15402,7 +16199,7 @@ "id": "compute.regionBackendServices.patch", "path": "{project}/regions/{region}/backendServices/{backendService}", "httpMethod": "PATCH", - "description": "Update the entire content of the regional BackendService resource. There are several restrictions and guidelines to keep in mind when updating a backend service. Read Restrictions and Guidelines for more information. This method supports patch semantics.", + "description": "Updates the specified regional BackendService resource with the data included in the request. There are several restrictions and guidelines to keep in mind when updating a backend service. Read Restrictions and Guidelines for more information. This method supports patch semantics.", "parameters": { "backendService": { "type": "string", @@ -15491,7 +16288,7 @@ "id": "compute.regionBackendServices.update", "path": "{project}/regions/{region}/backendServices/{backendService}", "httpMethod": "PUT", - "description": "Update the entire content of the regional BackendService resource. There are several restrictions and guidelines to keep in mind when updating a backend service. Read Restrictions and Guidelines for more information.", + "description": "Updates the specified regional BackendService resource with the data included in the request. There are several restrictions and guidelines to keep in mind when updating a backend service. Read Restrictions and Guidelines for more information.", "parameters": { "backendService": { "type": "string", @@ -15662,7 +16459,7 @@ "id": "compute.regionInstanceGroupManagers.get", "path": "{project}/regions/{region}/instanceGroupManagers/{instanceGroupManager}", "httpMethod": "GET", - "description": "Returns all of the details for the specified managed instance group.", + "description": "Returns all of the details about the specified managed instance group.", "parameters": { "instanceGroupManager": { "type": "string", @@ -15796,12 +16593,32 @@ "httpMethod": "POST", "description": "Lists the instances in the managed instance group and instances that are scheduled to be created. The list includes any current actions that the group has scheduled for its instances.", "parameters": { + "filter": { + "type": "string", + "location": "query" + }, "instanceGroupManager": { "type": "string", "description": "The name of the managed instance group.", "required": true, "location": "path" }, + "maxResults": { + "type": "integer", + "default": "500", + "format": "uint32", + "minimum": "0", + "maximum": "500", + "location": "query" + }, + "order_by": { + "type": "string", + "location": "query" + }, + "pageToken": { + "type": "string", + "location": "query" + }, "project": { "type": "string", "description": "Project ID for this request.", @@ -15830,6 +16647,48 @@ "https://www.googleapis.com/auth/compute.readonly" ] }, + "patch": { + "id": "compute.regionInstanceGroupManagers.patch", + "path": "{project}/regions/{region}/instanceGroupManagers/{instanceGroupManager}", + "httpMethod": "PATCH", + "description": "Updates a managed instance group using the information that you specify in the request. This operation is marked as DONE when the group is updated even if the instances in the group have not yet been updated. You must separately verify the status of the individual instances with the listmanagedinstances method. This method supports patch semantics.", + "parameters": { + "instanceGroupManager": { + "type": "string", + "description": "The name of the instance group manager.", + "required": true, + "location": "path" + }, + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "region": { + "type": "string", + "description": "Name of the region scoping this request.", + "required": true, + "location": "path" + } + }, + "parameterOrder": [ + "project", + "region", + "instanceGroupManager" + ], + "request": { + "$ref": "InstanceGroupManager" + }, + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute" + ] + }, "recreateInstances": { "id": "compute.regionInstanceGroupManagers.recreateInstances", "path": "{project}/regions/{region}/instanceGroupManagers/{instanceGroupManager}/recreateInstances", @@ -15966,7 +16825,7 @@ "id": "compute.regionInstanceGroupManagers.setInstanceTemplate", "path": "{project}/regions/{region}/instanceGroupManagers/{instanceGroupManager}/setInstanceTemplate", "httpMethod": "POST", - "description": "Sets the instance template to use when creating new instances in this group. Existing instances are not affected.", + "description": "Sets the instance template to use when creating new instances or recreating instances in this group. Existing instances are not affected.", "parameters": { "instanceGroupManager": { "type": "string", @@ -16090,6 +16949,48 @@ "https://www.googleapis.com/auth/compute", "https://www.googleapis.com/auth/compute.readonly" ] + }, + "update": { + "id": "compute.regionInstanceGroupManagers.update", + "path": "{project}/regions/{region}/instanceGroupManagers/{instanceGroupManager}", + "httpMethod": "PUT", + "description": "Updates a managed instance group using the information that you specify in the request. This operation is marked as DONE when the group is updated even if the instances in the group have not yet been updated. You must separately verify the status of the individual instances with the listmanagedinstances method.", + "parameters": { + "instanceGroupManager": { + "type": "string", + "description": "The name of the instance group manager.", + "required": true, + "location": "path" + }, + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "region": { + "type": "string", + "description": "Name of the region scoping this request.", + "required": true, + "location": "path" + } + }, + "parameterOrder": [ + "project", + "region", + "instanceGroupManager" + ], + "request": { + "$ref": "InstanceGroupManager" + }, + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute" + ] } } }, @@ -16853,7 +17754,7 @@ "id": "compute.routers.patch", "path": "{project}/regions/{region}/routers/{router}", "httpMethod": "PATCH", - "description": "Updates the entire content of the Router resource. This method supports patch semantics.", + "description": "Updates the specified Router resource with the data included in the request. This method supports patch semantics.", "parameters": { "project": { "type": "string", @@ -16987,7 +17888,7 @@ "id": "compute.routers.update", "path": "{project}/regions/{region}/routers/{router}", "httpMethod": "PUT", - "description": "Updates the entire content of the Router resource.", + "description": "Updates the specified Router resource with the data included in the request.", "parameters": { "project": { "type": "string", @@ -17774,6 +18675,48 @@ "https://www.googleapis.com/auth/compute.readonly" ] }, + "getIamPolicy": { + "id": "compute.subnetworks.getIamPolicy", + "path": "{project}/regions/{region}/subnetworks/{resource}/getIamPolicy", + "httpMethod": "GET", + "description": "Gets the access control policy for a resource. May be empty if no such policy or resource exists.", + "parameters": { + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "region": { + "type": "string", + "description": "The name of the region for this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + }, + "resource": { + "type": "string", + "description": "Name of the resource for this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "region", + "resource" + ], + "response": { + "$ref": "Policy" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/compute.readonly" + ] + }, "insert": { "id": "compute.subnetworks.insert", "path": "{project}/regions/{region}/subnetworks", @@ -17868,6 +18811,51 @@ "https://www.googleapis.com/auth/compute.readonly" ] }, + "setIamPolicy": { + "id": "compute.subnetworks.setIamPolicy", + "path": "{project}/regions/{region}/subnetworks/{resource}/setIamPolicy", + "httpMethod": "POST", + "description": "Sets the access control policy on the specified resource. Replaces any existing policy.", + "parameters": { + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "region": { + "type": "string", + "description": "The name of the region for this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + }, + "resource": { + "type": "string", + "description": "Name of the resource for this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "region", + "resource" + ], + "request": { + "$ref": "Policy" + }, + "response": { + "$ref": "Policy" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/compute.readonly" + ] + }, "testIamPermissions": { "id": "compute.subnetworks.testIamPermissions", "path": "{project}/regions/{region}/subnetworks/{resource}/testIamPermissions", @@ -19975,7 +20963,7 @@ "id": "compute.urlMaps.patch", "path": "{project}/global/urlMaps/{urlMap}", "httpMethod": "PATCH", - "description": "Updates the entire content of the UrlMap resource. This method supports patch semantics.", + "description": "Updates the specified UrlMap resource with the data included in the request. This method supports patch semantics.", "parameters": { "project": { "type": "string", @@ -20048,7 +21036,7 @@ "id": "compute.urlMaps.update", "path": "{project}/global/urlMaps/{urlMap}", "httpMethod": "PUT", - "description": "Updates the entire content of the UrlMap resource.", + "description": "Updates the specified UrlMap resource with the data included in the request.", "parameters": { "project": { "type": "string", diff --git a/etc/api/compute/v1/compute-api.json b/etc/api/compute/v1/compute-api.json index b1a8517147..391300e3cf 100644 --- a/etc/api/compute/v1/compute-api.json +++ b/etc/api/compute/v1/compute-api.json @@ -1,11 +1,11 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/VKavLaSgkeUcGZP86XzgOvq4HAw\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/BIPueDp4_YHmOXWnzCh7vT7JOHQ\"", "discoveryVersion": "v1", "id": "compute:v1", "name": "compute", "version": "v1", - "revision": "20160908", + "revision": "20161123", "title": "Compute Engine API", "description": "Creates and runs virtual machines on Google Cloud Platform.", "ownerDomain": "google.com", @@ -398,7 +398,7 @@ }, "source": { "type": "string", - "description": "Specifies a valid partial or full URL to an existing Persistent Disk resource. This field is only applicable for persistent disks. Note that for InstanceTemplate, it is just disk name, not URL for the disk." + "description": "Specifies a valid partial or full URL to an existing Persistent Disk resource. When creating a new instance, one of initializeParams.sourceImage or disks.source is required.\n\nIf desired, you can also attach existing non-root persistent disks using this property. This field is only applicable for persistent disks.\n\nNote that for InstanceTemplate, specify the disk name, not the URL for the disk." }, "type": { "type": "string", @@ -439,7 +439,7 @@ }, "sourceImage": { "type": "string", - "description": "The source image used to create this disk. If the source image is deleted, this field will not be set.\n\nTo create a disk with one of the public operating system images, specify the image by its family name. For example, specify family/debian-8 to use the latest Debian 8 image:\n\nprojects/debian-cloud/global/images/family/debian-8 \n\nAlternatively, use a specific version of a public operating system image:\n\nprojects/debian-cloud/global/images/debian-8-jessie-vYYYYMMDD \n\nTo create a disk with a private image that you created, specify the image name in the following format:\n\nglobal/images/my-private-image \n\nYou can also specify a private image by its image family, which returns the latest version of the image in that family. Replace the image name with family/family-name:\n\nglobal/images/family/my-private-family" + "description": "The source image to create this disk. When creating a new instance, one of initializeParams.sourceImage or disks.source is required.\n\nTo create a disk with one of the public operating system images, specify the image by its family name. For example, specify family/debian-8 to use the latest Debian 8 image:\n\nprojects/debian-cloud/global/images/family/debian-8 \n\nAlternatively, use a specific version of a public operating system image:\n\nprojects/debian-cloud/global/images/debian-8-jessie-vYYYYMMDD \n\nTo create a disk with a private image that you created, specify the image name in the following format:\n\nglobal/images/my-private-image \n\nYou can also specify a private image by its image family, which returns the latest version of the image in that family. Replace the image name with family/family-name:\n\nglobal/images/family/my-private-family \n\nIf the source image is deleted later, this field will not be set." }, "sourceImageEncryptionKey": { "$ref": "CustomerEncryptionKey", @@ -484,6 +484,10 @@ ] } }, + "region": { + "type": "string", + "description": "[Output Only] URL of the region where the instance group resides (for autoscalers living in regional scope)." + }, "selfLink": { "type": "string", "description": "[Output Only] Server-defined URL for the resource." @@ -696,7 +700,7 @@ "properties": { "metric": { "type": "string", - "description": "The identifier of the Cloud Monitoring metric. The metric cannot have negative values and should be a utilization metric, which means that the number of virtual machines handling requests should increase or decrease proportionally to the metric. The metric must also have a label of compute.googleapis.com/resource_id with the value of the instance's unique ID, although this alone does not guarantee that the metric is valid.\n\nFor example, the following is a valid metric:\ncompute.googleapis.com/instance/network/received_bytes_count\n\n\nThe following is not a valid metric because it does not increase or decrease based on usage:\ncompute.googleapis.com/instance/cpu/reserved_cores" + "description": "The identifier of the Stackdriver Monitoring metric. The metric cannot have negative values and should be a utilization metric, which means that the number of virtual machines handling requests should increase or decrease proportionally to the metric. The metric must also have a label of compute.googleapis.com/resource_id with the value of the instance's unique ID, although this alone does not guarantee that the metric is valid.\n\nFor example, the following is a valid metric:\ncompute.googleapis.com/instance/network/received_bytes_count\nThe following is not a valid metric because it does not increase or decrease based on usage:\ncompute.googleapis.com/instance/cpu/reserved_cores" }, "utilizationTarget": { "type": "number", @@ -705,7 +709,7 @@ }, "utilizationTargetType": { "type": "string", - "description": "Defines how target utilization value is expressed for a Cloud Monitoring metric. Either GAUGE, DELTA_PER_SECOND, or DELTA_PER_MINUTE. If not specified, the default is GAUGE.", + "description": "Defines how target utilization value is expressed for a Stackdriver Monitoring metric. Either GAUGE, DELTA_PER_SECOND, or DELTA_PER_MINUTE. If not specified, the default is GAUGE.", "enum": [ "DELTA_PER_MINUTE", "DELTA_PER_SECOND", @@ -844,6 +848,19 @@ "description": "[Output Only] Type of resource. Always compute#backendService for backend services.", "default": "compute#backendService" }, + "loadBalancingScheme": { + "type": "string", + "enum": [ + "EXTERNAL", + "INTERNAL", + "INVALID_LOAD_BALANCING_SCHEME" + ], + "enumDescriptions": [ + "", + "", + "" + ] + }, "name": { "type": "string", "description": "Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.", @@ -865,12 +882,14 @@ "HTTP", "HTTPS", "SSL", - "TCP" + "TCP", + "UDP" ], "enumDescriptions": [ "", "", "", + "", "" ] }, @@ -887,6 +906,7 @@ "description": "Type of session affinity to use. The default is NONE.\n\nWhen the load balancing scheme is EXTERNAL, can be NONE, CLIENT_IP, or GENERATED_COOKIE.\n\nWhen the load balancing scheme is INTERNAL, can be NONE, CLIENT_IP, CLIENT_IP_PROTO, or CLIENT_IP_PORT_PROTO.\n\nWhen the protocol is UDP, this field is not used.", "enum": [ "CLIENT_IP", + "CLIENT_IP_PORT_PROTO", "CLIENT_IP_PROTO", "GENERATED_COOKIE", "NONE" @@ -895,6 +915,7 @@ "", "", "", + "", "" ] }, @@ -905,6 +926,38 @@ } } }, + "BackendServiceAggregatedList": { + "id": "BackendServiceAggregatedList", + "type": "object", + "description": "Contains a list of BackendServicesScopedList.", + "properties": { + "id": { + "type": "string", + "description": "[Output Only] Unique identifier for the resource; defined by the server." + }, + "items": { + "type": "object", + "description": "A map of scoped BackendService lists.", + "additionalProperties": { + "$ref": "BackendServicesScopedList", + "description": "Name of the scope containing this set of BackendServices." + } + }, + "kind": { + "type": "string", + "description": "Type of resource.", + "default": "compute#backendServiceAggregatedList" + }, + "nextPageToken": { + "type": "string", + "description": "[Output Only] A token used to continue a truncated list request." + }, + "selfLink": { + "type": "string", + "description": "[Output Only] Server-defined URL for this resource." + } + } + }, "BackendServiceGroupHealth": { "id": "BackendServiceGroupHealth", "type": "object", @@ -953,10 +1006,94 @@ } } }, + "BackendServicesScopedList": { + "id": "BackendServicesScopedList", + "type": "object", + "properties": { + "backendServices": { + "type": "array", + "description": "List of BackendServices contained in this scope.", + "items": { + "$ref": "BackendService" + } + }, + "warning": { + "type": "object", + "description": "Informational warning which replaces the list of backend services when the list is empty.", + "properties": { + "code": { + "type": "string", + "description": "[Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response.", + "enum": [ + "CLEANUP_FAILED", + "DEPRECATED_RESOURCE_USED", + "DISK_SIZE_LARGER_THAN_IMAGE_SIZE", + "FIELD_VALUE_OVERRIDEN", + "INJECTED_KERNELS_DEPRECATED", + "NEXT_HOP_ADDRESS_NOT_ASSIGNED", + "NEXT_HOP_CANNOT_IP_FORWARD", + "NEXT_HOP_INSTANCE_NOT_FOUND", + "NEXT_HOP_INSTANCE_NOT_ON_NETWORK", + "NEXT_HOP_NOT_RUNNING", + "NOT_CRITICAL_ERROR", + "NO_RESULTS_ON_PAGE", + "REQUIRED_TOS_AGREEMENT", + "RESOURCE_NOT_DELETED", + "SINGLE_INSTANCE_PROPERTY_TEMPLATE", + "UNREACHABLE" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ] + }, + "data": { + "type": "array", + "description": "[Output Only] Metadata about this warning in key: value format. For example:\n\"data\": [ { \"key\": \"scope\", \"value\": \"zones/us-east1-d\" }", + "items": { + "type": "object", + "properties": { + "key": { + "type": "string", + "description": "[Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding)." + }, + "value": { + "type": "string", + "description": "[Output Only] A warning data value corresponding to the key." + } + } + } + }, + "message": { + "type": "string", + "description": "[Output Only] A human-readable description of the warning code." + } + } + } + } + }, "CacheInvalidationRule": { "id": "CacheInvalidationRule", "type": "object", "properties": { + "host": { + "type": "string", + "description": "If set, this invalidation rule will only apply to requests with a Host header matching host." + }, "path": { "type": "string" } @@ -1010,15 +1147,15 @@ "properties": { "deleted": { "type": "string", - "description": "An optional RFC3339 timestamp on or after which the deprecation state of this resource will be changed to DELETED." + "description": "An optional RFC3339 timestamp on or after which the state of this resource is intended to change to DELETED. This is only informational and the status will not change unless the client explicitly changes it." }, "deprecated": { "type": "string", - "description": "An optional RFC3339 timestamp on or after which the deprecation state of this resource will be changed to DEPRECATED." + "description": "An optional RFC3339 timestamp on or after which the state of this resource is intended to change to DEPRECATED. This is only informational and the status will not change unless the client explicitly changes it." }, "obsolete": { "type": "string", - "description": "An optional RFC3339 timestamp on or after which the deprecation state of this resource will be changed to OBSOLETE." + "description": "An optional RFC3339 timestamp on or after which the state of this resource is intended to change to OBSOLETE. This is only informational and the status will not change unless the client explicitly changes it." }, "replacement": { "type": "string", @@ -1131,7 +1268,7 @@ }, "status": { "type": "string", - "description": "[Output Only] The status of disk creation. Applicable statuses includes: CREATING, FAILED, READY, RESTORING.", + "description": "[Output Only] The status of disk creation.", "enum": [ "CREATING", "FAILED", @@ -1665,6 +1802,10 @@ "" ] }, + "backendService": { + "type": "string", + "description": "This field is not used for external load balancing.\n\nFor internal load balancing, this field identifies the BackendService resource to receive the matched traffic." + }, "creationTimestamp": { "type": "string", "description": "[Output Only] Creation timestamp in RFC3339 text format." @@ -1683,15 +1824,40 @@ "description": "[Output Only] Type of the resource. Always compute#forwardingRule for Forwarding Rule resources.", "default": "compute#forwardingRule" }, + "loadBalancingScheme": { + "type": "string", + "description": "This signifies what the ForwardingRule will be used for and can only take the following values: INTERNAL EXTERNAL The value of INTERNAL means that this will be used for Internal Network Load Balancing (TCP, UDP). The value of EXTERNAL means that this will be used for External Load Balancing (HTTP(S) LB, External TCP/UDP LB, SSL Proxy)", + "enum": [ + "EXTERNAL", + "INTERNAL", + "INVALID" + ], + "enumDescriptions": [ + "", + "", + "" + ] + }, "name": { "type": "string", "description": "Name of the resource; provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.", "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?" }, + "network": { + "type": "string", + "description": "This field is not used for external load balancing.\n\nFor internal load balancing, this field identifies the network that the load balanced IP should belong to for this Forwarding Rule. If this field is not specified, the default network will be used." + }, "portRange": { "type": "string", "description": "Applicable only when IPProtocol is TCP, UDP, or SCTP, only packets addressed to ports in the specified range will be forwarded to target. Forwarding rules with the same [IPAddress, IPProtocol] pair must have disjoint port ranges.\n\nThis field is not used for internal load balancing." }, + "ports": { + "type": "array", + "description": "This field is not used for external load balancing.\n\nWhen the load balancing scheme is INTERNAL, a single port or a comma separated list of ports can be configured. Only packets addressed to these ports will be forwarded to the backends configured with this forwarding rule. If the port list is not provided then all ports are allowed to pass through.\n\nYou may specify a maximum of up to 5 ports.", + "items": { + "type": "string" + } + }, "region": { "type": "string", "description": "[Output Only] URL of the region where the regional forwarding rule resides. This field is not applicable to global forwarding rules." @@ -1700,6 +1866,10 @@ "type": "string", "description": "[Output Only] Server-defined URL for the resource." }, + "subnetwork": { + "type": "string", + "description": "This field is not used for external load balancing.\n\nFor internal load balancing, this field identifies the subnetwork that the load balanced IP should belong to for this Forwarding Rule.\n\nIf the network specified is in auto subnet mode, this field is optional. However, if the network is in custom subnet mode, a subnetwork must be specified." + }, "target": { "type": "string", "description": "The URL of the target resource to receive the matched traffic. For regional forwarding rules, this target must live in the same region as the forwarding rule. For global forwarding rules, this target must be a global TargetHttpProxy or TargetHttpsProxy resource. The forwarded traffic must be of a type appropriate to the target object. For example, TargetHttpProxy requires HTTP traffic, and TargetHttpsProxy requires HTTPS traffic.\n\nThis field is not used for internal load balancing." @@ -1848,38 +2018,24 @@ } } }, - "HTTP2HealthCheck": { - "id": "HTTP2HealthCheck", + "GuestOsFeature": { + "id": "GuestOsFeature", "type": "object", + "description": "Guest OS features.", "properties": { - "host": { + "type": { "type": "string", - "description": "The value of the host header in the HTTP/2 health check request. If left empty (default value), the IP on behalf of which this health check is performed will be used." - }, - "port": { - "type": "integer", - "description": "The TCP port number for the health check request. The default value is 443.", - "format": "int32" - }, - "portName": { - "type": "string", - "description": "Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name are defined, port takes precedence." - }, - "proxyHeader": { - "type": "string", - "description": "Specifies the type of proxy header to append before sending data to the backend, either NONE or PROXY_V1. The default is NONE.", + "description": "The type of supported feature. Currenty only VIRTIO_SCSI_MULTIQUEUE is supported. For newer Windows images, the server might also populate this property with the value WINDOWS to indicate that this is a Windows image. This value is purely informational and does not enable or disable any features.", "enum": [ - "NONE", - "PROXY_V1" + "FEATURE_TYPE_UNSPECIFIED", + "VIRTIO_SCSI_MULTIQUEUE", + "WINDOWS" ], "enumDescriptions": [ + "", "", "" ] - }, - "requestPath": { - "type": "string", - "description": "The request path of the HTTP/2 health check request. The default value is /." } } }, @@ -1976,9 +2132,6 @@ "description": "A so-far unhealthy instance will be marked healthy after this many consecutive successes. The default value is 2.", "format": "int32" }, - "http2HealthCheck": { - "$ref": "HTTP2HealthCheck" - }, "httpHealthCheck": { "$ref": "HTTPHealthCheck" }, @@ -2017,10 +2170,9 @@ }, "type": { "type": "string", - "description": "Specifies the type of the healthCheck, either TCP, UDP, SSL, HTTP, HTTPS or HTTP2. If not specified, the default is TCP. Exactly one of the protocol-specific health check field must be specified, which must match type field.", + "description": "Specifies the type of the healthCheck, either TCP, SSL, HTTP or HTTPS. If not specified, the default is TCP. Exactly one of the protocol-specific health check field must be specified, which must match type field.", "enum": [ "HTTP", - "HTTP2", "HTTPS", "INVALID", "SSL", @@ -2031,7 +2183,6 @@ "", "", "", - "", "" ] }, @@ -2344,7 +2495,7 @@ }, "creationTimestamp": { "type": "string", - "description": "Creation timestamp in RFC3339 text format." + "description": "[Output Only] Creation timestamp in RFC3339 text format." }, "deprecated": { "$ref": "DeprecationStatus", @@ -2363,6 +2514,13 @@ "type": "string", "description": "The name of the image family to which this image belongs. You can create disks by specifying an image family instead of a specific image name. The image family always returns its latest image that is not deprecated. The name of the image family must comply with RFC1035." }, + "guestOsFeatures": { + "type": "array", + "description": "A list of features to enable on the guest OS. Applicable for bootable images only. Currently, only one feature can be enabled, VIRTIO_SCSCI_MULTIQUEUE, which allows each virtual CPU to have its own queue. For Windows images, you can only enable VIRTIO_SCSCI_MULTIQUEUE on images with driver version 1.2.0.1621 or higher. Linux images with kernel versions 3.17 and higher will support VIRTIO_SCSCI_MULTIQUEUE.\n\nFor new Windows images, the server might also populate this field with the value WINDOWS, to indicate that this is a Windows image. This value is purely informational and does not enable or disable any features.", + "items": { + "$ref": "GuestOsFeature" + } + }, "id": { "type": "string", "description": "[Output Only] The unique identifier for the resource. This identifier is defined by the server.", @@ -2430,7 +2588,7 @@ }, "sourceDisk": { "type": "string", - "description": "URL of the The source disk used to create this image. This can be a full or valid partial URL. You must provide either this property or the rawDisk.source property but not both to create an image. For example, the following are valid values: \n- https://www.googleapis.com/compute/v1/projects/project/zones/zone/disk/disk \n- projects/project/zones/zone/disk/disk \n- zones/zone/disks/disk" + "description": "URL of the source disk used to create this image. This can be a full or valid partial URL. You must provide either this property or the rawDisk.source property but not both to create an image. For example, the following are valid values: \n- https://www.googleapis.com/compute/v1/projects/project/zones/zone/disks/disk \n- projects/project/zones/zone/disks/disk \n- zones/zone/disks/disk" }, "sourceDiskEncryptionKey": { "$ref": "CustomerEncryptionKey", @@ -2663,7 +2821,7 @@ }, "id": { "type": "string", - "description": "[Output Only] A unique identifier for this instance group. The server generates this identifier.", + "description": "[Output Only] A unique identifier for this instance group, generated by the server.", "format": "uint64" }, "kind": { @@ -2692,6 +2850,10 @@ "type": "string", "description": "The URL of the network to which all instances in the instance group belong." }, + "region": { + "type": "string", + "description": "The URL of the region where the instance group is located (for regional resources)." + }, "selfLink": { "type": "string", "description": "[Output Only] The URL for this instance group. The server generates this URL." @@ -2840,6 +3002,10 @@ "$ref": "NamedPort" } }, + "region": { + "type": "string", + "description": "[Output Only] The URL of the region where the managed instance group resides (for regional resources)." + }, "selfLink": { "type": "string", "description": "[Output Only] The URL for this managed instance group. The server defines this URL." @@ -2883,7 +3049,7 @@ }, "creatingWithoutRetries": { "type": "integer", - "description": "[Output Only] The number of instances that the managed instance group will attempt to create. The group attempts to create each instance only once. If the group fails to create any of these instances, it decreases the group's target_size value accordingly.", + "description": "[Output Only] The number of instances that the managed instance group will attempt to create. The group attempts to create each instance only once. If the group fails to create any of these instances, it decreases the group's targetSize value accordingly.", "format": "int32" }, "deleting": { @@ -2971,7 +3137,7 @@ }, "selfLink": { "type": "string", - "description": "[Output Only] The URL for this resource type. The server generates this URL." + "description": "[Output Only] Server-defined URL for this resource." } } }, @@ -4179,7 +4345,7 @@ }, "selfLink": { "type": "string", - "description": "[Output Only] Server-defined URL for this resource ." + "description": "[Output Only] Server-defined URL for this resource." } } }, @@ -4304,7 +4470,7 @@ }, "targetLink": { "type": "string", - "description": "[Output Only] The URL of the resource that the operation modifies." + "description": "[Output Only] The URL of the resource that the operation modifies. For operations related to creating a snapshot, this points to the persistent disk that the snapshot was created from." }, "user": { "type": "string", @@ -4676,6 +4842,7 @@ "TARGET_POOLS", "TARGET_SSL_PROXIES", "TARGET_VPN_GATEWAYS", + "TOTAL_CPUS", "URL_MAPS", "VPN_TUNNELS" ], @@ -4712,6 +4879,7 @@ "", "", "", + "", "" ] }, @@ -4785,6 +4953,250 @@ } } }, + "RegionAutoscalerList": { + "id": "RegionAutoscalerList", + "type": "object", + "description": "Contains a list of autoscalers.", + "properties": { + "id": { + "type": "string", + "description": "[Output Only] The unique identifier for the resource. This identifier is defined by the server." + }, + "items": { + "type": "array", + "description": "A list of autoscalers.", + "items": { + "$ref": "Autoscaler" + } + }, + "kind": { + "type": "string", + "description": "Type of resource.", + "default": "compute#regionAutoscalerList" + }, + "nextPageToken": { + "type": "string", + "description": "[Output Only] A token used to continue a truncated list request." + }, + "selfLink": { + "type": "string", + "description": "[Output Only] Server-defined URL for this resource." + } + } + }, + "RegionInstanceGroupList": { + "id": "RegionInstanceGroupList", + "type": "object", + "description": "Contains a list of InstanceGroup resources.", + "properties": { + "id": { + "type": "string", + "description": "[Output Only] The unique identifier for the resource. This identifier is defined by the server." + }, + "items": { + "type": "array", + "description": "A list of InstanceGroup resources.", + "items": { + "$ref": "InstanceGroup" + } + }, + "kind": { + "type": "string", + "description": "The resource type.", + "default": "compute#regionInstanceGroupList" + }, + "nextPageToken": { + "type": "string", + "description": "[Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results." + }, + "selfLink": { + "type": "string", + "description": "[Output Only] The URL for this resource type. The server generates this URL." + } + } + }, + "RegionInstanceGroupManagerList": { + "id": "RegionInstanceGroupManagerList", + "type": "object", + "description": "Contains a list of managed instance groups.", + "properties": { + "id": { + "type": "string", + "description": "[Output Only] The unique identifier for the resource. This identifier is defined by the server." + }, + "items": { + "type": "array", + "description": "A list of managed instance groups.", + "items": { + "$ref": "InstanceGroupManager" + } + }, + "kind": { + "type": "string", + "description": "[Output Only] The resource type, which is always compute#instanceGroupManagerList for a list of managed instance groups that exist in th regional scope.", + "default": "compute#regionInstanceGroupManagerList" + }, + "nextPageToken": { + "type": "string", + "description": "[Output only] A token used to continue a truncated list request." + }, + "selfLink": { + "type": "string", + "description": "[Output only] The URL for this resource type. The server generates this URL." + } + } + }, + "RegionInstanceGroupManagersAbandonInstancesRequest": { + "id": "RegionInstanceGroupManagersAbandonInstancesRequest", + "type": "object", + "properties": { + "instances": { + "type": "array", + "description": "The names of one or more instances to abandon.", + "items": { + "type": "string" + } + } + } + }, + "RegionInstanceGroupManagersDeleteInstancesRequest": { + "id": "RegionInstanceGroupManagersDeleteInstancesRequest", + "type": "object", + "properties": { + "instances": { + "type": "array", + "description": "The names of one or more instances to delete.", + "items": { + "type": "string" + } + } + } + }, + "RegionInstanceGroupManagersListInstancesResponse": { + "id": "RegionInstanceGroupManagersListInstancesResponse", + "type": "object", + "properties": { + "managedInstances": { + "type": "array", + "description": "List of managed instances.", + "items": { + "$ref": "ManagedInstance" + } + } + } + }, + "RegionInstanceGroupManagersRecreateRequest": { + "id": "RegionInstanceGroupManagersRecreateRequest", + "type": "object", + "properties": { + "instances": { + "type": "array", + "description": "The URL for one or more instances to recreate.", + "items": { + "type": "string" + } + } + } + }, + "RegionInstanceGroupManagersSetTargetPoolsRequest": { + "id": "RegionInstanceGroupManagersSetTargetPoolsRequest", + "type": "object", + "properties": { + "fingerprint": { + "type": "string", + "description": "Fingerprint of the target pools information, which is a hash of the contents. This field is used for optimistic locking when you update the target pool entries. This field is optional.", + "format": "byte" + }, + "targetPools": { + "type": "array", + "description": "The URL of all TargetPool resources to which instances in the instanceGroup field are added. The target pools automatically apply to all of the instances in the managed instance group.", + "items": { + "type": "string" + } + } + } + }, + "RegionInstanceGroupManagersSetTemplateRequest": { + "id": "RegionInstanceGroupManagersSetTemplateRequest", + "type": "object", + "properties": { + "instanceTemplate": { + "type": "string", + "description": "URL of the InstanceTemplate resource from which all new instances will be created." + } + } + }, + "RegionInstanceGroupsListInstances": { + "id": "RegionInstanceGroupsListInstances", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "[Output Only] Unique identifier for the resource. Defined by the server." + }, + "items": { + "type": "array", + "description": "A list of instances and any named ports that are assigned to those instances.", + "items": { + "$ref": "InstanceWithNamedPorts" + } + }, + "kind": { + "type": "string", + "description": "The resource type.", + "default": "compute#regionInstanceGroupsListInstances" + }, + "nextPageToken": { + "type": "string", + "description": "[Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results." + }, + "selfLink": { + "type": "string", + "description": "[Output Only] Server-defined URL for the resource." + } + } + }, + "RegionInstanceGroupsListInstancesRequest": { + "id": "RegionInstanceGroupsListInstancesRequest", + "type": "object", + "properties": { + "instanceState": { + "type": "string", + "description": "Instances in which state should be returned. Valid options are: 'ALL', 'RUNNING'. By default, it lists all instances.", + "enum": [ + "ALL", + "RUNNING" + ], + "enumDescriptions": [ + "", + "" + ] + }, + "portName": { + "type": "string", + "description": "Name of port user is interested in. It is optional. If it is set, only information about this ports will be returned. If it is not set, all the named ports will be returned. Always lists all instances.", + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?" + } + } + }, + "RegionInstanceGroupsSetNamedPortsRequest": { + "id": "RegionInstanceGroupsSetNamedPortsRequest", + "type": "object", + "properties": { + "fingerprint": { + "type": "string", + "description": "The fingerprint of the named ports information for this instance group. Use this optional property to prevent conflicts when multiple users change the named ports settings concurrently. Obtain the fingerprint with the instanceGroups.get method. Then, include the fingerprint in your request to ensure that you do not overwrite changes that were applied from another concurrent request.", + "format": "byte" + }, + "namedPorts": { + "type": "array", + "description": "The list of named ports to set for this instance group.", + "items": { + "$ref": "NamedPort" + } + } + } + }, "RegionList": { "id": "RegionList", "type": "object", @@ -4822,7 +5234,7 @@ "properties": { "group": { "type": "string", - "description": "A URI referencing one of the resource views listed in the backend service." + "description": "A URI referencing one of the instance groups listed in the backend service." } } }, @@ -5057,7 +5469,7 @@ }, "interfaces": { "type": "array", - "description": "Router interfaces. Each interface requires either one linked resource (e.g. linkedVpnTunnel) or IP address and IP address range (e.g. ipRange).", + "description": "Router interfaces. Each interface requires either one linked resource (e.g. linkedVpnTunnel), or IP address and IP address range (e.g. ipRange), or both.", "items": { "$ref": "RouterInterface" } @@ -5218,7 +5630,7 @@ }, "selfLink": { "type": "string", - "description": "[Output Only] Server-defined URL for the resource." + "description": "[Output Only] Server-defined URL for this resource." } } }, @@ -5485,9 +5897,19 @@ "description": "[Output Only] Type of the resource. Always compute#serialPortOutput for serial port output.", "default": "compute#serialPortOutput" }, + "next": { + "type": "string", + "description": "[Output Only] The position of the next byte of content from the serial console output. Use this value in the next request as the start parameter.", + "format": "int64" + }, "selfLink": { "type": "string", - "description": "[Output Only] Server-defined URL for the resource." + "description": "[Output Only] Server-defined URL for this resource." + }, + "start": { + "type": "string", + "description": "[Output Only] The starting byte position of the output that was returned. This should match the start parameter sent with the request. If the serial console output exceeds the size of the buffer, older output will be overwritten by newer content and the start values will be mismatched.", + "format": "int64" } } }, @@ -5671,7 +6093,7 @@ }, "privateKey": { "type": "string", - "description": "A write-only private key in PEM format. Only insert RPCs will include this field." + "description": "A write-only private key in PEM format. Only insert requests will include this field." }, "selfLink": { "type": "string", @@ -5822,6 +6244,16 @@ } } }, + "SubnetworksExpandIpCidrRangeRequest": { + "id": "SubnetworksExpandIpCidrRangeRequest", + "type": "object", + "properties": { + "ipCidrRange": { + "type": "string", + "description": "The IP (in CIDR format or netmask) of internal addresses that are legal on this Subnetwork. This range should be disjoint from other subnetworks within this network. This range can only be larger than (i.e. a superset of) the range previously defined before the update." + } + } + }, "SubnetworksScopedList": { "id": "SubnetworksScopedList", "type": "object", @@ -6372,6 +6804,7 @@ "description": "Sesssion affinity option, must be one of the following values:\nNONE: Connections from the same client IP may go to any instance in the pool.\nCLIENT_IP: Connections from the same client IP will go to the same instance in the pool while that instance remains healthy.\nCLIENT_IP_PROTO: Connections from the same client IP with the same IP protocol will go to the same instance in the pool while that instance remains healthy.", "enum": [ "CLIENT_IP", + "CLIENT_IP_PORT_PROTO", "CLIENT_IP_PROTO", "GENERATED_COOKIE", "NONE" @@ -6380,6 +6813,7 @@ "", "", "", + "", "" ] } @@ -6843,7 +7277,7 @@ }, "selfLink": { "type": "string", - "description": "[Output Only] Server-defined URL for the resource." + "description": "[Output Only] Server-defined URL for this resource." } } }, @@ -6874,7 +7308,7 @@ }, "selfLink": { "type": "string", - "description": "[Output Only] Server-defined URL for the resource." + "description": "[Output Only] Server-defined URL for this resource." } } }, @@ -7344,7 +7778,7 @@ }, "selfLink": { "type": "string", - "description": "[Output Only] Server-defined URL for the resource." + "description": "[Output Only] Server-defined URL for this resource." } } }, @@ -7536,6 +7970,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -7700,6 +8139,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -7757,6 +8201,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -7921,6 +8370,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -8044,6 +8498,56 @@ }, "backendServices": { "methods": { + "aggregatedList": { + "id": "compute.backendServices.aggregatedList", + "path": "{project}/aggregated/backendServices", + "httpMethod": "GET", + "description": "Retrieves the list of all BackendService resources, regional and global, available to the specified project.", + "parameters": { + "filter": { + "type": "string", + "description": "Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string.\n\nThe field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field.\n\nFor example, to filter for instances that do not have a name of example-instance, you would use filter=name ne example-instance.\n\nYou can filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. Use filtering on nested fields to take advantage of labels to organize and search for results based on label values.\n\nTo filter on multiple expressions, provide each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions, meaning that resources must match all expressions to pass the filters.", + "location": "query" + }, + "maxResults": { + "type": "integer", + "description": "The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests.", + "default": "500", + "format": "uint32", + "minimum": "0", + "maximum": "500", + "location": "query" + }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", + "location": "query" + }, + "project": { + "type": "string", + "description": "Name of the project scoping this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + } + }, + "parameterOrder": [ + "project" + ], + "response": { + "$ref": "BackendServiceAggregatedList" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/compute.readonly" + ] + }, "delete": { "id": "compute.backendServices.delete", "path": "{project}/global/backendServices/{backendService}", @@ -8195,6 +8699,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -8224,7 +8733,7 @@ "id": "compute.backendServices.patch", "path": "{project}/global/backendServices/{backendService}", "httpMethod": "PATCH", - "description": "Updates the entire content of the BackendService resource. There are several restrictions and guidelines to keep in mind when updating a backend service. Read Restrictions and Guidelines for more information. This method supports patch semantics.", + "description": "Updates the specified BackendService resource with the data included in the request. There are several restrictions and guidelines to keep in mind when updating a backend service. Read Restrictions and Guidelines for more information. This method supports patch semantics.", "parameters": { "backendService": { "type": "string", @@ -8260,7 +8769,7 @@ "id": "compute.backendServices.update", "path": "{project}/global/backendServices/{backendService}", "httpMethod": "PUT", - "description": "Updates the entire content of the BackendService resource. There are several restrictions and guidelines to keep in mind when updating a backend service. Read Restrictions and Guidelines for more information.", + "description": "Updates the specified BackendService resource with the data included in the request. There are several restrictions and guidelines to keep in mind when updating a backend service. Read Restrictions and Guidelines for more information.", "parameters": { "backendService": { "type": "string", @@ -8316,6 +8825,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -8403,6 +8917,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -8460,6 +8979,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -8672,6 +9196,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -8868,6 +9397,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -8989,6 +9523,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -9153,6 +9692,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -9349,6 +9893,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -9493,6 +10042,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -9578,6 +10132,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -9687,6 +10246,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -9831,6 +10395,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -10047,6 +10616,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -10263,6 +10837,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -10552,6 +11131,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -10643,6 +11227,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -10844,6 +11433,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -10882,12 +11476,32 @@ "httpMethod": "POST", "description": "Lists all of the instances in the managed instance group. Each instance in the list has a currentAction, which indicates the action that the managed instance group is performing on the instance. For example, if the group is still creating an instance, the currentAction is CREATING. If a previous action failed, the list displays the errors for that failed action.", "parameters": { + "filter": { + "type": "string", + "location": "query" + }, "instanceGroupManager": { "type": "string", "description": "The name of the managed instance group.", "required": true, "location": "path" }, + "maxResults": { + "type": "integer", + "default": "500", + "format": "uint32", + "minimum": "0", + "maximum": "500", + "location": "query" + }, + "order_by": { + "type": "string", + "location": "query" + }, + "pageToken": { + "type": "string", + "location": "query" + }, "project": { "type": "string", "description": "Project ID for this request.", @@ -11155,6 +11769,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -11314,6 +11933,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -11372,6 +11996,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -11611,6 +12240,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -11711,6 +12345,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -11995,6 +12634,12 @@ "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", "location": "path" }, + "start": { + "type": "string", + "description": "For the initial request, leave this field unspecified. For subsequent calls, this field should be set to the next value that was returned in the previous call.", + "format": "int64", + "location": "query" + }, "zone": { "type": "string", "description": "The name of the zone for this request.", @@ -12073,6 +12718,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -12567,6 +13217,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -12654,6 +13309,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -12806,6 +13466,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -12830,6 +13495,39 @@ "https://www.googleapis.com/auth/compute", "https://www.googleapis.com/auth/compute.readonly" ] + }, + "switchToCustomMode": { + "id": "compute.networks.switchToCustomMode", + "path": "{project}/global/networks/{network}/switchToCustomMode", + "httpMethod": "POST", + "description": "Switches the network mode from auto subnet mode to custom subnet mode.", + "parameters": { + "network": { + "type": "string", + "description": "Name of the network to be updated.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + }, + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "network" + ], + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute" + ] } } }, @@ -12978,6 +13676,1289 @@ } } }, + "regionAutoscalers": { + "methods": { + "delete": { + "id": "compute.regionAutoscalers.delete", + "path": "{project}/regions/{region}/autoscalers/{autoscaler}", + "httpMethod": "DELETE", + "description": "Deletes the specified autoscaler.", + "parameters": { + "autoscaler": { + "type": "string", + "description": "Name of the autoscaler to delete.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + }, + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "region": { + "type": "string", + "description": "Name of the region scoping this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "region", + "autoscaler" + ], + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute" + ] + }, + "get": { + "id": "compute.regionAutoscalers.get", + "path": "{project}/regions/{region}/autoscalers/{autoscaler}", + "httpMethod": "GET", + "description": "Returns the specified autoscaler.", + "parameters": { + "autoscaler": { + "type": "string", + "description": "Name of the autoscaler to return.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + }, + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "region": { + "type": "string", + "description": "Name of the region scoping this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "region", + "autoscaler" + ], + "response": { + "$ref": "Autoscaler" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/compute.readonly" + ] + }, + "insert": { + "id": "compute.regionAutoscalers.insert", + "path": "{project}/regions/{region}/autoscalers", + "httpMethod": "POST", + "description": "Creates an autoscaler in the specified project using the data included in the request.", + "parameters": { + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "region": { + "type": "string", + "description": "Name of the region scoping this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "region" + ], + "request": { + "$ref": "Autoscaler" + }, + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute" + ] + }, + "list": { + "id": "compute.regionAutoscalers.list", + "path": "{project}/regions/{region}/autoscalers", + "httpMethod": "GET", + "description": "Retrieves a list of autoscalers contained within the specified region.", + "parameters": { + "filter": { + "type": "string", + "description": "Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string.\n\nThe field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field.\n\nFor example, to filter for instances that do not have a name of example-instance, you would use filter=name ne example-instance.\n\nYou can filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. Use filtering on nested fields to take advantage of labels to organize and search for results based on label values.\n\nTo filter on multiple expressions, provide each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions, meaning that resources must match all expressions to pass the filters.", + "location": "query" + }, + "maxResults": { + "type": "integer", + "description": "The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests.", + "default": "500", + "format": "uint32", + "minimum": "0", + "maximum": "500", + "location": "query" + }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", + "location": "query" + }, + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "region": { + "type": "string", + "description": "Name of the region scoping this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "region" + ], + "response": { + "$ref": "RegionAutoscalerList" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/compute.readonly" + ] + }, + "patch": { + "id": "compute.regionAutoscalers.patch", + "path": "{project}/regions/{region}/autoscalers", + "httpMethod": "PATCH", + "description": "Updates an autoscaler in the specified project using the data included in the request. This method supports patch semantics.", + "parameters": { + "autoscaler": { + "type": "string", + "description": "Name of the autoscaler to update.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "query" + }, + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "region": { + "type": "string", + "description": "Name of the region scoping this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "region", + "autoscaler" + ], + "request": { + "$ref": "Autoscaler" + }, + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute" + ] + }, + "update": { + "id": "compute.regionAutoscalers.update", + "path": "{project}/regions/{region}/autoscalers", + "httpMethod": "PUT", + "description": "Updates an autoscaler in the specified project using the data included in the request.", + "parameters": { + "autoscaler": { + "type": "string", + "description": "Name of the autoscaler to update.", + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "query" + }, + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "region": { + "type": "string", + "description": "Name of the region scoping this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "region" + ], + "request": { + "$ref": "Autoscaler" + }, + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute" + ] + } + } + }, + "regionBackendServices": { + "methods": { + "delete": { + "id": "compute.regionBackendServices.delete", + "path": "{project}/regions/{region}/backendServices/{backendService}", + "httpMethod": "DELETE", + "description": "Deletes the specified regional BackendService resource.", + "parameters": { + "backendService": { + "type": "string", + "description": "Name of the BackendService resource to delete.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + }, + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "region": { + "type": "string", + "description": "Name of the region scoping this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "region", + "backendService" + ], + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute" + ] + }, + "get": { + "id": "compute.regionBackendServices.get", + "path": "{project}/regions/{region}/backendServices/{backendService}", + "httpMethod": "GET", + "description": "Returns the specified regional BackendService resource.", + "parameters": { + "backendService": { + "type": "string", + "description": "Name of the BackendService resource to return.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + }, + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "region": { + "type": "string", + "description": "Name of the region scoping this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "region", + "backendService" + ], + "response": { + "$ref": "BackendService" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/compute.readonly" + ] + }, + "getHealth": { + "id": "compute.regionBackendServices.getHealth", + "path": "{project}/regions/{region}/backendServices/{backendService}/getHealth", + "httpMethod": "POST", + "description": "Gets the most recent health check results for this regional BackendService.", + "parameters": { + "backendService": { + "type": "string", + "description": "Name of the BackendService resource to which the queried instance belongs.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + }, + "project": { + "type": "string", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "region": { + "type": "string", + "description": "Name of the region scoping this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "region", + "backendService" + ], + "request": { + "$ref": "ResourceGroupReference" + }, + "response": { + "$ref": "BackendServiceGroupHealth" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/compute.readonly" + ] + }, + "insert": { + "id": "compute.regionBackendServices.insert", + "path": "{project}/regions/{region}/backendServices", + "httpMethod": "POST", + "description": "Creates a regional BackendService resource in the specified project using the data included in the request. There are several restrictions and guidelines to keep in mind when creating a regional backend service. Read Restrictions and Guidelines for more information.", + "parameters": { + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "region": { + "type": "string", + "description": "Name of the region scoping this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "region" + ], + "request": { + "$ref": "BackendService" + }, + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute" + ] + }, + "list": { + "id": "compute.regionBackendServices.list", + "path": "{project}/regions/{region}/backendServices", + "httpMethod": "GET", + "description": "Retrieves the list of regional BackendService resources available to the specified project in the given region.", + "parameters": { + "filter": { + "type": "string", + "description": "Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string.\n\nThe field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field.\n\nFor example, to filter for instances that do not have a name of example-instance, you would use filter=name ne example-instance.\n\nYou can filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. Use filtering on nested fields to take advantage of labels to organize and search for results based on label values.\n\nTo filter on multiple expressions, provide each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions, meaning that resources must match all expressions to pass the filters.", + "location": "query" + }, + "maxResults": { + "type": "integer", + "description": "The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests.", + "default": "500", + "format": "uint32", + "minimum": "0", + "maximum": "500", + "location": "query" + }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", + "location": "query" + }, + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "region": { + "type": "string", + "description": "Name of the region scoping this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "region" + ], + "response": { + "$ref": "BackendServiceList" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/compute.readonly" + ] + }, + "patch": { + "id": "compute.regionBackendServices.patch", + "path": "{project}/regions/{region}/backendServices/{backendService}", + "httpMethod": "PATCH", + "description": "Updates the specified regional BackendService resource with the data included in the request. There are several restrictions and guidelines to keep in mind when updating a backend service. Read Restrictions and Guidelines for more information. This method supports patch semantics.", + "parameters": { + "backendService": { + "type": "string", + "description": "Name of the BackendService resource to update.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + }, + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "region": { + "type": "string", + "description": "Name of the region scoping this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "region", + "backendService" + ], + "request": { + "$ref": "BackendService" + }, + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute" + ] + }, + "update": { + "id": "compute.regionBackendServices.update", + "path": "{project}/regions/{region}/backendServices/{backendService}", + "httpMethod": "PUT", + "description": "Updates the specified regional BackendService resource with the data included in the request. There are several restrictions and guidelines to keep in mind when updating a backend service. Read Restrictions and Guidelines for more information.", + "parameters": { + "backendService": { + "type": "string", + "description": "Name of the BackendService resource to update.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + }, + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "region": { + "type": "string", + "description": "Name of the region scoping this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "region", + "backendService" + ], + "request": { + "$ref": "BackendService" + }, + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute" + ] + } + } + }, + "regionInstanceGroupManagers": { + "methods": { + "abandonInstances": { + "id": "compute.regionInstanceGroupManagers.abandonInstances", + "path": "{project}/regions/{region}/instanceGroupManagers/{instanceGroupManager}/abandonInstances", + "httpMethod": "POST", + "description": "Schedules a group action to remove the specified instances from the managed instance group. Abandoning an instance does not delete the instance, but it does remove the instance from any target pools that are applied by the managed instance group. This method reduces the targetSize of the managed instance group by the number of instances that you abandon. This operation is marked as DONE when the action is scheduled even if the instances have not yet been removed from the group. You must separately verify the status of the abandoning action with the listmanagedinstances method.", + "parameters": { + "instanceGroupManager": { + "type": "string", + "description": "Name of the managed instance group.", + "required": true, + "location": "path" + }, + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "region": { + "type": "string", + "description": "Name of the region scoping this request.", + "required": true, + "location": "path" + } + }, + "parameterOrder": [ + "project", + "region", + "instanceGroupManager" + ], + "request": { + "$ref": "RegionInstanceGroupManagersAbandonInstancesRequest" + }, + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute" + ] + }, + "delete": { + "id": "compute.regionInstanceGroupManagers.delete", + "path": "{project}/regions/{region}/instanceGroupManagers/{instanceGroupManager}", + "httpMethod": "DELETE", + "description": "Deletes the specified managed instance group and all of the instances in that group.", + "parameters": { + "instanceGroupManager": { + "type": "string", + "description": "Name of the managed instance group to delete.", + "required": true, + "location": "path" + }, + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "region": { + "type": "string", + "description": "Name of the region scoping this request.", + "required": true, + "location": "path" + } + }, + "parameterOrder": [ + "project", + "region", + "instanceGroupManager" + ], + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute" + ] + }, + "deleteInstances": { + "id": "compute.regionInstanceGroupManagers.deleteInstances", + "path": "{project}/regions/{region}/instanceGroupManagers/{instanceGroupManager}/deleteInstances", + "httpMethod": "POST", + "description": "Schedules a group action to delete the specified instances in the managed instance group. The instances are also removed from any target pools of which they were a member. This method reduces the targetSize of the managed instance group by the number of instances that you delete. This operation is marked as DONE when the action is scheduled even if the instances are still being deleted. You must separately verify the status of the deleting action with the listmanagedinstances method.", + "parameters": { + "instanceGroupManager": { + "type": "string", + "description": "Name of the managed instance group.", + "required": true, + "location": "path" + }, + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "region": { + "type": "string", + "description": "Name of the region scoping this request.", + "required": true, + "location": "path" + } + }, + "parameterOrder": [ + "project", + "region", + "instanceGroupManager" + ], + "request": { + "$ref": "RegionInstanceGroupManagersDeleteInstancesRequest" + }, + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute" + ] + }, + "get": { + "id": "compute.regionInstanceGroupManagers.get", + "path": "{project}/regions/{region}/instanceGroupManagers/{instanceGroupManager}", + "httpMethod": "GET", + "description": "Returns all of the details about the specified managed instance group.", + "parameters": { + "instanceGroupManager": { + "type": "string", + "description": "Name of the managed instance group to return.", + "required": true, + "location": "path" + }, + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "region": { + "type": "string", + "description": "Name of the region scoping this request.", + "required": true, + "location": "path" + } + }, + "parameterOrder": [ + "project", + "region", + "instanceGroupManager" + ], + "response": { + "$ref": "InstanceGroupManager" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/compute.readonly" + ] + }, + "insert": { + "id": "compute.regionInstanceGroupManagers.insert", + "path": "{project}/regions/{region}/instanceGroupManagers", + "httpMethod": "POST", + "description": "Creates a managed instance group using the information that you specify in the request. After the group is created, it schedules an action to create instances in the group using the specified instance template. This operation is marked as DONE when the group is created even if the instances in the group have not yet been created. You must separately verify the status of the individual instances with the listmanagedinstances method.", + "parameters": { + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "region": { + "type": "string", + "description": "Name of the region scoping this request.", + "required": true, + "location": "path" + } + }, + "parameterOrder": [ + "project", + "region" + ], + "request": { + "$ref": "InstanceGroupManager" + }, + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute" + ] + }, + "list": { + "id": "compute.regionInstanceGroupManagers.list", + "path": "{project}/regions/{region}/instanceGroupManagers", + "httpMethod": "GET", + "description": "Retrieves the list of managed instance groups that are contained within the specified region.", + "parameters": { + "filter": { + "type": "string", + "description": "Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string.\n\nThe field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field.\n\nFor example, to filter for instances that do not have a name of example-instance, you would use filter=name ne example-instance.\n\nYou can filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. Use filtering on nested fields to take advantage of labels to organize and search for results based on label values.\n\nTo filter on multiple expressions, provide each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions, meaning that resources must match all expressions to pass the filters.", + "location": "query" + }, + "maxResults": { + "type": "integer", + "description": "The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests.", + "default": "500", + "format": "uint32", + "minimum": "0", + "maximum": "500", + "location": "query" + }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", + "location": "query" + }, + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "region": { + "type": "string", + "description": "Name of the region scoping this request.", + "required": true, + "location": "path" + } + }, + "parameterOrder": [ + "project", + "region" + ], + "response": { + "$ref": "RegionInstanceGroupManagerList" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/compute.readonly" + ] + }, + "listManagedInstances": { + "id": "compute.regionInstanceGroupManagers.listManagedInstances", + "path": "{project}/regions/{region}/instanceGroupManagers/{instanceGroupManager}/listManagedInstances", + "httpMethod": "POST", + "description": "Lists the instances in the managed instance group and instances that are scheduled to be created. The list includes any current actions that the group has scheduled for its instances.", + "parameters": { + "filter": { + "type": "string", + "location": "query" + }, + "instanceGroupManager": { + "type": "string", + "description": "The name of the managed instance group.", + "required": true, + "location": "path" + }, + "maxResults": { + "type": "integer", + "default": "500", + "format": "uint32", + "minimum": "0", + "maximum": "500", + "location": "query" + }, + "order_by": { + "type": "string", + "location": "query" + }, + "pageToken": { + "type": "string", + "location": "query" + }, + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "region": { + "type": "string", + "description": "Name of the region scoping this request.", + "required": true, + "location": "path" + } + }, + "parameterOrder": [ + "project", + "region", + "instanceGroupManager" + ], + "response": { + "$ref": "RegionInstanceGroupManagersListInstancesResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/compute.readonly" + ] + }, + "recreateInstances": { + "id": "compute.regionInstanceGroupManagers.recreateInstances", + "path": "{project}/regions/{region}/instanceGroupManagers/{instanceGroupManager}/recreateInstances", + "httpMethod": "POST", + "description": "Schedules a group action to recreate the specified instances in the managed instance group. The instances are deleted and recreated using the current instance template for the managed instance group. This operation is marked as DONE when the action is scheduled even if the instances have not yet been recreated. You must separately verify the status of the recreating action with the listmanagedinstances method.", + "parameters": { + "instanceGroupManager": { + "type": "string", + "description": "Name of the managed instance group.", + "required": true, + "location": "path" + }, + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "region": { + "type": "string", + "description": "Name of the region scoping this request.", + "required": true, + "location": "path" + } + }, + "parameterOrder": [ + "project", + "region", + "instanceGroupManager" + ], + "request": { + "$ref": "RegionInstanceGroupManagersRecreateRequest" + }, + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute" + ] + }, + "resize": { + "id": "compute.regionInstanceGroupManagers.resize", + "path": "{project}/regions/{region}/instanceGroupManagers/{instanceGroupManager}/resize", + "httpMethod": "POST", + "description": "Changes the intended size for the managed instance group. If you increase the size, the group schedules actions to create new instances using the current instance template. If you decrease the size, the group schedules delete actions on one or more instances. The resize operation is marked DONE when the resize actions are scheduled even if the group has not yet added or deleted any instances. You must separately verify the status of the creating or deleting actions with the listmanagedinstances method.", + "parameters": { + "instanceGroupManager": { + "type": "string", + "description": "Name of the managed instance group.", + "required": true, + "location": "path" + }, + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "region": { + "type": "string", + "description": "Name of the region scoping this request.", + "required": true, + "location": "path" + }, + "size": { + "type": "integer", + "description": "Number of instances that should exist in this instance group manager.", + "required": true, + "format": "int32", + "minimum": "0", + "location": "query" + } + }, + "parameterOrder": [ + "project", + "region", + "instanceGroupManager", + "size" + ], + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute" + ] + }, + "setInstanceTemplate": { + "id": "compute.regionInstanceGroupManagers.setInstanceTemplate", + "path": "{project}/regions/{region}/instanceGroupManagers/{instanceGroupManager}/setInstanceTemplate", + "httpMethod": "POST", + "description": "Sets the instance template to use when creating new instances or recreating instances in this group. Existing instances are not affected.", + "parameters": { + "instanceGroupManager": { + "type": "string", + "description": "The name of the managed instance group.", + "required": true, + "location": "path" + }, + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "region": { + "type": "string", + "description": "Name of the region scoping this request.", + "required": true, + "location": "path" + } + }, + "parameterOrder": [ + "project", + "region", + "instanceGroupManager" + ], + "request": { + "$ref": "RegionInstanceGroupManagersSetTemplateRequest" + }, + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute" + ] + }, + "setTargetPools": { + "id": "compute.regionInstanceGroupManagers.setTargetPools", + "path": "{project}/regions/{region}/instanceGroupManagers/{instanceGroupManager}/setTargetPools", + "httpMethod": "POST", + "description": "Modifies the target pools to which all new instances in this group are assigned. Existing instances in the group are not affected.", + "parameters": { + "instanceGroupManager": { + "type": "string", + "description": "Name of the managed instance group.", + "required": true, + "location": "path" + }, + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "region": { + "type": "string", + "description": "Name of the region scoping this request.", + "required": true, + "location": "path" + } + }, + "parameterOrder": [ + "project", + "region", + "instanceGroupManager" + ], + "request": { + "$ref": "RegionInstanceGroupManagersSetTargetPoolsRequest" + }, + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute" + ] + } + } + }, + "regionInstanceGroups": { + "methods": { + "get": { + "id": "compute.regionInstanceGroups.get", + "path": "{project}/regions/{region}/instanceGroups/{instanceGroup}", + "httpMethod": "GET", + "description": "Returns the specified instance group resource.", + "parameters": { + "instanceGroup": { + "type": "string", + "description": "Name of the instance group resource to return.", + "required": true, + "location": "path" + }, + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "region": { + "type": "string", + "description": "Name of the region scoping this request.", + "required": true, + "location": "path" + } + }, + "parameterOrder": [ + "project", + "region", + "instanceGroup" + ], + "response": { + "$ref": "InstanceGroup" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/compute.readonly" + ] + }, + "list": { + "id": "compute.regionInstanceGroups.list", + "path": "{project}/regions/{region}/instanceGroups", + "httpMethod": "GET", + "description": "Retrieves the list of instance group resources contained within the specified region.", + "parameters": { + "filter": { + "type": "string", + "description": "Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string.\n\nThe field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field.\n\nFor example, to filter for instances that do not have a name of example-instance, you would use filter=name ne example-instance.\n\nYou can filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. Use filtering on nested fields to take advantage of labels to organize and search for results based on label values.\n\nTo filter on multiple expressions, provide each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions, meaning that resources must match all expressions to pass the filters.", + "location": "query" + }, + "maxResults": { + "type": "integer", + "description": "The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests.", + "default": "500", + "format": "uint32", + "minimum": "0", + "maximum": "500", + "location": "query" + }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", + "location": "query" + }, + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "region": { + "type": "string", + "description": "Name of the region scoping this request.", + "required": true, + "location": "path" + } + }, + "parameterOrder": [ + "project", + "region" + ], + "response": { + "$ref": "RegionInstanceGroupList" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/compute.readonly" + ] + }, + "listInstances": { + "id": "compute.regionInstanceGroups.listInstances", + "path": "{project}/regions/{region}/instanceGroups/{instanceGroup}/listInstances", + "httpMethod": "POST", + "description": "Lists the instances in the specified instance group and displays information about the named ports. Depending on the specified options, this method can list all instances or only the instances that are running.", + "parameters": { + "filter": { + "type": "string", + "description": "Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string.\n\nThe field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field.\n\nFor example, to filter for instances that do not have a name of example-instance, you would use filter=name ne example-instance.\n\nYou can filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. Use filtering on nested fields to take advantage of labels to organize and search for results based on label values.\n\nTo filter on multiple expressions, provide each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions, meaning that resources must match all expressions to pass the filters.", + "location": "query" + }, + "instanceGroup": { + "type": "string", + "description": "Name of the regional instance group for which we want to list the instances.", + "required": true, + "location": "path" + }, + "maxResults": { + "type": "integer", + "description": "The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests.", + "default": "500", + "format": "uint32", + "minimum": "0", + "maximum": "500", + "location": "query" + }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", + "location": "query" + }, + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "region": { + "type": "string", + "description": "Name of the region scoping this request.", + "required": true, + "location": "path" + } + }, + "parameterOrder": [ + "project", + "region", + "instanceGroup" + ], + "request": { + "$ref": "RegionInstanceGroupsListInstancesRequest" + }, + "response": { + "$ref": "RegionInstanceGroupsListInstances" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/compute.readonly" + ] + }, + "setNamedPorts": { + "id": "compute.regionInstanceGroups.setNamedPorts", + "path": "{project}/regions/{region}/instanceGroups/{instanceGroup}/setNamedPorts", + "httpMethod": "POST", + "description": "Sets the named ports for the specified regional instance group.", + "parameters": { + "instanceGroup": { + "type": "string", + "description": "The name of the regional instance group where the named ports are updated.", + "required": true, + "location": "path" + }, + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "region": { + "type": "string", + "description": "Name of the region scoping this request.", + "required": true, + "location": "path" + } + }, + "parameterOrder": [ + "project", + "region", + "instanceGroup" + ], + "request": { + "$ref": "RegionInstanceGroupsSetNamedPortsRequest" + }, + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute" + ] + } + } + }, "regionOperations": { "methods": { "delete": { @@ -13080,6 +15061,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -13171,6 +15157,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -13220,6 +15211,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -13426,6 +15422,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -13463,7 +15464,7 @@ "id": "compute.routers.patch", "path": "{project}/regions/{region}/routers/{router}", "httpMethod": "PATCH", - "description": "Updates the entire content of the Router resource. This method supports patch semantics.", + "description": "Updates the specified Router resource with the data included in the request. This method supports patch semantics.", "parameters": { "project": { "type": "string", @@ -13552,7 +15553,7 @@ "id": "compute.routers.update", "path": "{project}/regions/{region}/routers/{router}", "httpMethod": "PUT", - "description": "Updates the entire content of the Router resource.", + "description": "Updates the specified Router resource with the data included in the request.", "parameters": { "project": { "type": "string", @@ -13711,6 +15712,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -13827,6 +15833,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -13971,6 +15982,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -14020,6 +16036,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -14086,6 +16107,50 @@ "https://www.googleapis.com/auth/compute" ] }, + "expandIpCidrRange": { + "id": "compute.subnetworks.expandIpCidrRange", + "path": "{project}/regions/{region}/subnetworks/{subnetwork}/expandIpCidrRange", + "httpMethod": "POST", + "description": "Expands the IP CIDR range of the subnetwork to a specified value.", + "parameters": { + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "region": { + "type": "string", + "description": "Name of the region scoping this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + }, + "subnetwork": { + "type": "string", + "description": "Name of the Subnetwork resource to update.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "region", + "subnetwork" + ], + "request": { + "$ref": "SubnetworksExpandIpCidrRangeRequest" + }, + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute" + ] + }, "get": { "id": "compute.subnetworks.get", "path": "{project}/regions/{region}/subnetworks/{subnetwork}", @@ -14184,6 +16249,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -14336,6 +16406,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -14516,6 +16591,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -14637,6 +16717,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -14801,6 +16886,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -14946,6 +17036,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -15155,6 +17250,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -15445,6 +17545,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -15602,6 +17707,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -15766,6 +17876,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -15954,6 +18069,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -15983,7 +18103,7 @@ "id": "compute.urlMaps.patch", "path": "{project}/global/urlMaps/{urlMap}", "httpMethod": "PATCH", - "description": "Updates the entire content of the UrlMap resource. This method supports patch semantics.", + "description": "Updates the specified UrlMap resource with the data included in the request. This method supports patch semantics.", "parameters": { "project": { "type": "string", @@ -16019,7 +18139,7 @@ "id": "compute.urlMaps.update", "path": "{project}/global/urlMaps/{urlMap}", "httpMethod": "PUT", - "description": "Updates the entire content of the UrlMap resource.", + "description": "Updates the specified UrlMap resource with the data included in the request.", "parameters": { "project": { "type": "string", @@ -16111,6 +18231,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -16275,6 +18400,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -16412,6 +18542,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -16503,6 +18638,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", diff --git a/etc/api/consumersurveys/v2/consumersurveys-api.json b/etc/api/consumersurveys/v2/consumersurveys-api.json index aab6288660..fd41160f58 100644 --- a/etc/api/consumersurveys/v2/consumersurveys-api.json +++ b/etc/api/consumersurveys/v2/consumersurveys-api.json @@ -1,19 +1,19 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/r9HedtrzUW2pbu5XQ5oErnzKmxQ\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/rHWbtxT3gC8DAqrI4kJjmo2JS7Q\"", "discoveryVersion": "v1", "id": "consumersurveys:v2", "name": "consumersurveys", "canonicalName": "Consumer Surveys", "version": "v2", - "revision": "20160718", + "revision": "20161101", "title": "Consumer Surveys API", "description": "Creates and conducts surveys, lists the surveys that an authenticated user owns, and retrieves survey results and information about specified surveys.", "ownerDomain": "google.com", "ownerName": "Google", "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" }, "protocol": "rest", "baseUrl": "https://www.googleapis.com/consumersurveys/v2/", @@ -101,31 +101,24 @@ "MobileAppPanel": { "id": "MobileAppPanel", "type": "object", - "description": "Representation of an individual pre-defined panel object defining a targeted audience of opinion rewards mobile app users.", "properties": { "country": { - "type": "string", - "description": "Country code for the country of the users that the panel contains. Uses standard ISO 3166-1 2-character language codes. For instance, 'US' for the United States, and 'GB' for the United Kingdom. Any survey created targeting this panel must also target the corresponding country." + "type": "string" }, "isPublicPanel": { - "type": "boolean", - "description": "Whether or not the panel is accessible to all API users." + "type": "boolean" }, "language": { - "type": "string", - "description": "Language code that the panel can target. For instance, 'en-US'. Uses standard BCP47 language codes. See specification. Any survey created targeting this panel must also target the corresponding language." + "type": "string" }, "mobileAppPanelId": { - "type": "string", - "description": "Unique panel ID string. This corresponds to the mobile_app_panel_id used in Survey Insert requests." + "type": "string" }, "name": { - "type": "string", - "description": "Human readable name of the audience panel." + "type": "string" }, "owners": { "type": "array", - "description": "List of email addresses for users who can target members of this panel. Must contain at least the address of the user making the API call for panels that are not public. This field will be empty for public panels.", "items": { "type": "string" } @@ -200,64 +193,46 @@ "Survey": { "id": "Survey", "type": "object", - "description": "Representation of an individual survey object.", "properties": { "audience": { - "$ref": "SurveyAudience", - "description": "Targeting-criteria message containing demographic information" + "$ref": "SurveyAudience" }, "cost": { - "$ref": "SurveyCost", - "description": "Cost to run the survey and collect the necessary number of responses." + "$ref": "SurveyCost" }, "customerData": { "type": "string", - "description": "Additional information to store on behalf of the API consumer and associate with this question. This binary blob is treated as opaque. This field is limited to 64K bytes.", "format": "byte" }, "description": { - "type": "string", - "description": "Text description of the survey." + "type": "string" }, "owners": { "type": "array", - "description": "List of email addresses for survey owners. Must contain at least the address of the user making the API call.", "items": { "type": "string" - }, - "annotations": { - "required": [ - "consumersurveys.surveys.insert" - ] } }, "questions": { "type": "array", - "description": "List of questions defining the survey.", "items": { "$ref": "SurveyQuestion" - }, - "annotations": { - "required": [ - "consumersurveys.surveys.insert" - ] } }, + "rejectionReason": { + "$ref": "SurveyRejection" + }, "state": { - "type": "string", - "description": "State that the survey is in." + "type": "string" }, "surveyUrlId": { - "type": "string", - "description": "Unique survey ID, that is viewable in the URL of the Survey Creator UI" + "type": "string" }, "title": { - "type": "string", - "description": "Optional name that will be given to the survey." + "type": "string" }, "wantedResponseCount": { "type": "integer", - "description": "Number of responses desired for the survey.", "format": "int32" } } @@ -265,76 +240,53 @@ "SurveyAudience": { "id": "SurveyAudience", "type": "object", - "description": "Specifications for the target audience of a survey run through the API.", "properties": { "ages": { "type": "array", - "description": "Optional list of age buckets to target. Supported age buckets are: ['18-24', '25-34', '35-44', '45-54', '55-64', '65+']", "items": { "type": "string" } }, "country": { - "type": "string", - "description": "Required country code that surveys should be targeted to. Accepts standard ISO 3166-1 2 character language codes. For instance, 'US' for the United States, and 'GB' for the United Kingdom.", - "annotations": { - "required": [ - "consumersurveys.surveys.insert" - ] - } + "type": "string" }, "countrySubdivision": { - "type": "string", - "description": "Country subdivision (states/provinces/etc) that surveys should be targeted to. For all countries except GB, ISO-3166-2 subdivision code is required (eg. 'US-OH' for Ohio, United States). For GB, NUTS 1 statistical region codes for the United Kingdom is required (eg. 'UK-UKC' for North East England)." + "type": "string" }, "gender": { - "type": "string", - "description": "Optional gender to target." + "type": "string" }, "languages": { "type": "array", - "description": "Language code that surveys should be targeted to. For instance, 'en-US'. Surveys may target bilingual users by specifying a list of language codes (for example, 'de' and 'en-US'). In that case, all languages will be used for targeting users but the survey content (which is displayed) must match the first language listed. Accepts standard BCP47 language codes. See specification.", "items": { "type": "string" - }, - "annotations": { - "required": [ - "consumersurveys.surveys.insert" - ] } }, "mobileAppPanelId": { - "type": "string", - "description": "Key for predefined panel that causes survey to be sent to a predefined set of Opinion Rewards App users. You must set PopulationSource to ANDROID_APP_PANEL to use this field." + "type": "string" }, "populationSource": { - "type": "string", - "description": "Online population source where the respondents are sampled from." + "type": "string" } } }, "SurveyCost": { "id": "SurveyCost", "type": "object", - "description": "Message defining the cost to run a given survey through API.", "properties": { "costPerResponseNanos": { "type": "string", - "description": "Cost per survey response in nano units of the given currency. To get the total cost for a survey, multiply this value by wanted_response_count.", "format": "int64" }, "currencyCode": { - "type": "string", - "description": "Currency code that the cost is given in." + "type": "string" }, "maxCostPerResponseNanos": { "type": "string", - "description": "Threshold to start a survey automatically if the quoted price is at most this value. When a survey has a Screener (threshold) question, it must go through an incidence pricing test to determine the final cost per response. Typically you will have to make a followup call to start the survey giving the final computed cost per response. If the survey has no threshold_answers, setting this property will return an error. By specifying this property, you indicate the max price per response you are willing to pay in advance of the incidence test. If the price turns out to be lower than the specified value, the survey will begin immediately and you will be charged at the rate determined by the incidence pricing test. If the price turns out to be greater than the specified value the survey will not be started and you will instead be notified what price was determined by the incidence test. At that point, you must raise the value of this property to be greater than or equal to that cost before attempting to start the survey again. This will immediately start the survey as long the incidence test was run within the last 21 days.", "format": "int64" }, "nanos": { "type": "string", - "description": "Cost of survey in nano units of the given currency. DEPRECATED in favor of cost_per_response_nanos", "format": "int64" } } @@ -342,26 +294,21 @@ "SurveyQuestion": { "id": "SurveyQuestion", "type": "object", - "description": "Message defining the question specifications.", "properties": { "answerOrder": { - "type": "string", - "description": "The randomization option for multiple choice and multi-select questions. If not specified, this option defaults to randomize." + "type": "string" }, "answers": { "type": "array", - "description": "Required list of answer options for a question.", "items": { "type": "string" } }, "hasOther": { - "type": "boolean", - "description": "Option to allow open-ended text box for Single Answer and Multiple Answer question types. This can be used with SINGLE_ANSWER, SINGLE_ANSWER_WITH_IMAGE, MULTIPLE_ANSWERS, and MULTIPLE_ANSWERS_WITH_IMAGE question types." + "type": "boolean" }, "highValueLabel": { - "type": "string", - "description": "For rating questions, the text for the higher end of the scale, such as 'Best'. For numeric questions, a string representing a floating-point that is the maximum allowed number for a response." + "type": "string" }, "images": { "type": "array", @@ -370,102 +317,89 @@ } }, "lastAnswerPositionPinned": { - "type": "boolean", - "description": "Currently only support pinning an answer option to the last position." + "type": "boolean" }, "lowValueLabel": { - "type": "string", - "description": "For rating questions, the text for the lower end of the scale, such as 'Worst'. For numeric questions, a string representing a floating-point that is the minimum allowed number for a response." + "type": "string" }, "mustPickSuggestion": { - "type": "boolean", - "description": "Option to force the user to pick one of the open text suggestions. This requires that suggestions are provided for this question." + "type": "boolean" }, "numStars": { - "type": "string", - "description": "Number of stars to use for ratings questions." + "type": "string" }, "openTextPlaceholder": { - "type": "string", - "description": "Placeholder text for an open text question." + "type": "string" }, "openTextSuggestions": { "type": "array", - "description": "A list of suggested answers for open text question auto-complete. This is only valid if single_line_response is true.", "items": { "type": "string" } }, "question": { - "type": "string", - "description": "Required question text shown to the respondent." + "type": "string" }, "sentimentText": { - "type": "string", - "description": "Used by the Rating Scale with Text question type. This text goes along with the question field that is presented to the respondent, and is the actual text that the respondent is asked to rate." + "type": "string" }, "singleLineResponse": { - "type": "boolean", - "description": "Option to allow multiple line open text responses instead of a single line response. Note that we don't show auto-complete suggestions with multiple line responses." + "type": "boolean" }, "thresholdAnswers": { "type": "array", - "description": "The threshold/screener answer options, which will screen a user into the rest of the survey. These will be a subset of the answer option strings.", "items": { "type": "string" } }, "type": { - "type": "string", - "description": "Required field defining the question type. For details about configuring different type of questions, consult the question configuration guide.", - "annotations": { - "required": [ - "consumersurveys.surveys.insert" - ] - } + "type": "string" }, "unitOfMeasurementLabel": { - "type": "string", - "description": "Optional unit of measurement for display (for example: hours, people, miles)." + "type": "string" }, "videoId": { - "type": "string", - "description": "The YouTube video ID to be show in video questions." + "type": "string" } } }, "SurveyQuestionImage": { "id": "SurveyQuestionImage", "type": "object", - "description": "Container object for image data and alt_text.", "properties": { "altText": { - "type": "string", - "description": "The alt text property used in image tags is required for all images." + "type": "string" }, "data": { "type": "string", - "description": "Inline jpeg, gif, tiff, bmp, or png image raw bytes for an image question types.", "format": "byte" }, "url": { - "type": "string", - "description": "The read-only URL for the hosted images." + "type": "string" + } + } + }, + "SurveyRejection": { + "id": "SurveyRejection", + "type": "object", + "properties": { + "explanation": { + "type": "string" + }, + "type": { + "type": "string" } } }, "SurveyResults": { "id": "SurveyResults", "type": "object", - "description": "Reference to the current results for a given survey.", "properties": { "status": { - "type": "string", - "description": "Human readable string describing the status of the request." + "type": "string" }, "surveyUrlId": { - "type": "string", - "description": "External survey ID as viewable by survey owners in the editor view." + "type": "string" } } }, @@ -647,7 +581,7 @@ "id": "consumersurveys.results.get", "path": "surveys/{surveyUrlId}/results", "httpMethod": "GET", - "description": "Retrieves any survey results that have been produced so far. Results are formatted as an Excel file.", + "description": "Retrieves any survey results that have been produced so far. Results are formatted as an Excel file. You must add \"?alt=media\" to the URL as an argument to get results.", "parameters": { "surveyUrlId": { "type": "string", diff --git a/etc/api/container/v1/container-api.json b/etc/api/container/v1/container-api.json index 26700fd22b..9594dca92b 100644 --- a/etc/api/container/v1/container-api.json +++ b/etc/api/container/v1/container-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/cpP4K9eaLrLwMGtsdl5oXjxb8rw\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/cpP4K9eaLrLwMGtsdl5oXjxb8rw\"", "discoveryVersion": "v1", "id": "container:v1", "name": "container", diff --git a/etc/api/content/v2/content-api.json b/etc/api/content/v2/content-api.json index 6835d42a0c..755df2be30 100644 --- a/etc/api/content/v2/content-api.json +++ b/etc/api/content/v2/content-api.json @@ -1,19 +1,19 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/KYk0P4hLurettj7gPX6wNnI67WQ\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/VEEyLOh5uQoE1GRmT6bPbJj1uoA\"", "discoveryVersion": "v1", "id": "content:v2", "name": "content", "canonicalName": "Shopping Content", "version": "v2", - "revision": "20160905", + "revision": "20161205", "title": "Content API for Shopping", "description": "Manages product items, inventory, and Merchant Center accounts for Google Shopping.", "ownerDomain": "google.com", "ownerName": "Google", "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" }, "documentationLink": "https://developers.google.com/shopping-content", "protocol": "rest", @@ -1766,6 +1766,10 @@ "$ref": "LoyaltyPoints", "description": "Loyalty points that users receive after purchasing the item. Japan only." }, + "pickup": { + "$ref": "InventoryPickup", + "description": "Store pickup information. Only supported for local inventory. Not setting pickup means \"don't update\" while setting it to the empty value ({} in JSON) means \"delete\". Otherwise, pickupMethod and pickupSla must be set together, unless pickupMethod is \"not supported\"." + }, "price": { "$ref": "Price", "description": "The price of the product." @@ -1871,6 +1875,20 @@ } } }, + "InventoryPickup": { + "id": "InventoryPickup", + "type": "object", + "properties": { + "pickupMethod": { + "type": "string", + "description": "Whether store pickup is available for this offer and whether the pickup option should be shown as buy, reserve, or not supported. Only supported for local inventory. Unless the value is \"not supported\", must be submitted together with pickupSla." + }, + "pickupSla": { + "type": "string", + "description": "The expected date that an order will be ready for pickup, relative to when the order is placed. Only supported for local inventory. Must be submitted together with pickupMethod." + } + } + }, "InventorySetRequest": { "id": "InventorySetRequest", "type": "object", @@ -1887,6 +1905,10 @@ "$ref": "LoyaltyPoints", "description": "Loyalty points that users receive after purchasing the item. Japan only." }, + "pickup": { + "$ref": "InventoryPickup", + "description": "Store pickup information. Only supported for local inventory. Not setting pickup means \"don't update\" while setting it to the empty value ({} in JSON) means \"delete\". Otherwise, pickupMethod and pickupSla must be set together, unless pickupMethod is \"not supported\"." + }, "price": { "$ref": "Price", "description": "The price of the product." @@ -2135,7 +2157,7 @@ }, "explicitMarketingPreference": { "type": "boolean", - "description": "If set, this indicates the user explicitly chose to opt in or out of providing marketing rights to the merchant. If unset, this indicates the user has already made this choice in a previous purchase, and was thus not shown the marketing right opt in/out checkbox during the Purchases on Google checkout flow." + "description": "If set, this indicates the user explicitly chose to opt in or out of providing marketing rights to the merchant. If unset, this indicates the user has already made this choice in a previous purchase, and was thus not shown the marketing right opt in/out checkbox during the checkout flow." }, "fullName": { "type": "string", @@ -4524,7 +4546,7 @@ }, "explicitMarketingPreference": { "type": "boolean", - "description": "If set, this indicates the user explicitly chose to opt in or out of providing marketing rights to the merchant. If unset, this indicates the user has already made this choice in a previous purchase, and was thus not shown the marketing right opt in/out checkbox during the Purchases on Google checkout flow. Optional." + "description": "If set, this indicates the user explicitly chose to opt in or out of providing marketing rights to the merchant. If unset, this indicates the user has already made this choice in a previous purchase, and was thus not shown the marketing right opt in/out checkbox during the checkout flow. Optional." }, "fullName": { "type": "string", @@ -4806,7 +4828,7 @@ "id": "content.accounts.delete", "path": "{merchantId}/accounts/{accountId}", "httpMethod": "DELETE", - "description": "Deletes a Merchant Center sub-account.", + "description": "Deletes a Merchant Center sub-account. This method can only be called for multi-client accounts.", "parameters": { "accountId": { "type": "string", @@ -4840,7 +4862,7 @@ "id": "content.accounts.get", "path": "{merchantId}/accounts/{accountId}", "httpMethod": "GET", - "description": "Retrieves a Merchant Center account.", + "description": "Retrieves a Merchant Center account. This method can only be called for accounts to which the managing account has access: either the managing account itself or sub-accounts if the managing account is a multi-client account.", "parameters": { "accountId": { "type": "string", @@ -4872,7 +4894,7 @@ "id": "content.accounts.insert", "path": "{merchantId}/accounts", "httpMethod": "POST", - "description": "Creates a Merchant Center sub-account.", + "description": "Creates a Merchant Center sub-account. This method can only be called for multi-client accounts.", "parameters": { "dryRun": { "type": "boolean", @@ -4904,7 +4926,7 @@ "id": "content.accounts.list", "path": "{merchantId}/accounts", "httpMethod": "GET", - "description": "Lists the sub-accounts in your Merchant Center account.", + "description": "Lists the sub-accounts in your Merchant Center account. This method can only be called for multi-client accounts.", "parameters": { "maxResults": { "type": "integer", @@ -4939,7 +4961,7 @@ "id": "content.accounts.patch", "path": "{merchantId}/accounts/{accountId}", "httpMethod": "PATCH", - "description": "Updates a Merchant Center account. This method supports patch semantics.", + "description": "Updates a Merchant Center account. This method can only be called for multi-client accounts. This method supports patch semantics.", "parameters": { "accountId": { "type": "string", @@ -4979,7 +5001,7 @@ "id": "content.accounts.update", "path": "{merchantId}/accounts/{accountId}", "httpMethod": "PUT", - "description": "Updates a Merchant Center account.", + "description": "Updates a Merchant Center account. This method can only be called for multi-client accounts.", "parameters": { "accountId": { "type": "string", @@ -5045,7 +5067,7 @@ "id": "content.accountshipping.get", "path": "{merchantId}/accountshipping/{accountId}", "httpMethod": "GET", - "description": "Retrieves the shipping settings of the account.", + "description": "Retrieves the shipping settings of the account. This method can only be called for accounts to which the managing account has access: either the managing account itself or sub-accounts if the managing account is a multi-client account.", "parameters": { "accountId": { "type": "string", @@ -5077,7 +5099,7 @@ "id": "content.accountshipping.list", "path": "{merchantId}/accountshipping", "httpMethod": "GET", - "description": "Lists the shipping settings of the sub-accounts in your Merchant Center account.", + "description": "Lists the shipping settings of the sub-accounts in your Merchant Center account. This method can only be called for multi-client accounts.", "parameters": { "maxResults": { "type": "integer", @@ -5112,7 +5134,7 @@ "id": "content.accountshipping.patch", "path": "{merchantId}/accountshipping/{accountId}", "httpMethod": "PATCH", - "description": "Updates the shipping settings of the account. This method supports patch semantics.", + "description": "Updates the shipping settings of the account. This method can only be called for accounts to which the managing account has access: either the managing account itself or sub-accounts if the managing account is a multi-client account. This method supports patch semantics.", "parameters": { "accountId": { "type": "string", @@ -5152,7 +5174,7 @@ "id": "content.accountshipping.update", "path": "{merchantId}/accountshipping/{accountId}", "httpMethod": "PUT", - "description": "Updates the shipping settings of the account.", + "description": "Updates the shipping settings of the account. This method can only be called for accounts to which the managing account has access: either the managing account itself or sub-accounts if the managing account is a multi-client account.", "parameters": { "accountId": { "type": "string", @@ -5210,7 +5232,7 @@ "id": "content.accountstatuses.get", "path": "{merchantId}/accountstatuses/{accountId}", "httpMethod": "GET", - "description": "Retrieves the status of a Merchant Center account.", + "description": "Retrieves the status of a Merchant Center account. This method can only be called for accounts to which the managing account has access: either the managing account itself or sub-accounts if the managing account is a multi-client account.", "parameters": { "accountId": { "type": "string", @@ -5242,7 +5264,7 @@ "id": "content.accountstatuses.list", "path": "{merchantId}/accountstatuses", "httpMethod": "GET", - "description": "Lists the statuses of the sub-accounts in your Merchant Center account.", + "description": "Lists the statuses of the sub-accounts in your Merchant Center account. This method can only be called for multi-client accounts.", "parameters": { "maxResults": { "type": "integer", @@ -5303,7 +5325,7 @@ "id": "content.accounttax.get", "path": "{merchantId}/accounttax/{accountId}", "httpMethod": "GET", - "description": "Retrieves the tax settings of the account.", + "description": "Retrieves the tax settings of the account. This method can only be called for accounts to which the managing account has access: either the managing account itself or sub-accounts if the managing account is a multi-client account.", "parameters": { "accountId": { "type": "string", @@ -5335,7 +5357,7 @@ "id": "content.accounttax.list", "path": "{merchantId}/accounttax", "httpMethod": "GET", - "description": "Lists the tax settings of the sub-accounts in your Merchant Center account.", + "description": "Lists the tax settings of the sub-accounts in your Merchant Center account. This method can only be called for multi-client accounts.", "parameters": { "maxResults": { "type": "integer", @@ -5370,7 +5392,7 @@ "id": "content.accounttax.patch", "path": "{merchantId}/accounttax/{accountId}", "httpMethod": "PATCH", - "description": "Updates the tax settings of the account. This method supports patch semantics.", + "description": "Updates the tax settings of the account. This method can only be called for accounts to which the managing account has access: either the managing account itself or sub-accounts if the managing account is a multi-client account. This method supports patch semantics.", "parameters": { "accountId": { "type": "string", @@ -5410,7 +5432,7 @@ "id": "content.accounttax.update", "path": "{merchantId}/accounttax/{accountId}", "httpMethod": "PUT", - "description": "Updates the tax settings of the account.", + "description": "Updates the tax settings of the account. This method can only be called for accounts to which the managing account has access: either the managing account itself or sub-accounts if the managing account is a multi-client account.", "parameters": { "accountId": { "type": "string", @@ -5475,7 +5497,7 @@ "id": "content.datafeeds.delete", "path": "{merchantId}/datafeeds/{datafeedId}", "httpMethod": "DELETE", - "description": "Deletes a datafeed from your Merchant Center account.", + "description": "Deletes a datafeed from your Merchant Center account. This method can only be called for non-multi-client accounts.", "parameters": { "datafeedId": { "type": "string", @@ -5507,7 +5529,7 @@ "id": "content.datafeeds.get", "path": "{merchantId}/datafeeds/{datafeedId}", "httpMethod": "GET", - "description": "Retrieves a datafeed from your Merchant Center account.", + "description": "Retrieves a datafeed from your Merchant Center account. This method can only be called for non-multi-client accounts.", "parameters": { "datafeedId": { "type": "string", @@ -5537,7 +5559,7 @@ "id": "content.datafeeds.insert", "path": "{merchantId}/datafeeds", "httpMethod": "POST", - "description": "Registers a datafeed with your Merchant Center account.", + "description": "Registers a datafeed with your Merchant Center account. This method can only be called for non-multi-client accounts.", "parameters": { "dryRun": { "type": "boolean", @@ -5568,7 +5590,7 @@ "id": "content.datafeeds.list", "path": "{merchantId}/datafeeds", "httpMethod": "GET", - "description": "Lists the datafeeds in your Merchant Center account.", + "description": "Lists the datafeeds in your Merchant Center account. This method can only be called for non-multi-client accounts.", "parameters": { "maxResults": { "type": "integer", @@ -5603,7 +5625,7 @@ "id": "content.datafeeds.patch", "path": "{merchantId}/datafeeds/{datafeedId}", "httpMethod": "PATCH", - "description": "Updates a datafeed of your Merchant Center account. This method supports patch semantics.", + "description": "Updates a datafeed of your Merchant Center account. This method can only be called for non-multi-client accounts. This method supports patch semantics.", "parameters": { "datafeedId": { "type": "string", @@ -5641,7 +5663,7 @@ "id": "content.datafeeds.update", "path": "{merchantId}/datafeeds/{datafeedId}", "httpMethod": "PUT", - "description": "Updates a datafeed of your Merchant Center account.", + "description": "Updates a datafeed of your Merchant Center account. This method can only be called for non-multi-client accounts.", "parameters": { "datafeedId": { "type": "string", @@ -5697,7 +5719,7 @@ "id": "content.datafeedstatuses.get", "path": "{merchantId}/datafeedstatuses/{datafeedId}", "httpMethod": "GET", - "description": "Retrieves the status of a datafeed from your Merchant Center account.", + "description": "Retrieves the status of a datafeed from your Merchant Center account. This method can only be called for non-multi-client accounts.", "parameters": { "datafeedId": { "type": "string", @@ -5727,7 +5749,7 @@ "id": "content.datafeedstatuses.list", "path": "{merchantId}/datafeedstatuses", "httpMethod": "GET", - "description": "Lists the statuses of the datafeeds in your Merchant Center account.", + "description": "Lists the statuses of the datafeeds in your Merchant Center account. This method can only be called for non-multi-client accounts.", "parameters": { "maxResults": { "type": "integer", @@ -5766,7 +5788,7 @@ "id": "content.inventory.custombatch", "path": "inventory/batch", "httpMethod": "POST", - "description": "Updates price and availability for multiple products or stores in a single request. This operation does not update the expiration date of the products.", + "description": "Updates price and availability for multiple products or stores in a single request. This operation does not update the expiration date of the products. This method can only be called for non-multi-client accounts.", "parameters": { "dryRun": { "type": "boolean", @@ -5788,7 +5810,7 @@ "id": "content.inventory.set", "path": "{merchantId}/inventory/{storeCode}/products/{productId}", "httpMethod": "POST", - "description": "Updates price and availability of a product in your Merchant Center account. This operation does not update the expiration date of the product.", + "description": "Updates price and availability of a product in your Merchant Center account. This operation does not update the expiration date of the product. This method can only be called for non-multi-client accounts.", "parameters": { "dryRun": { "type": "boolean", @@ -5838,7 +5860,7 @@ "id": "content.orders.acknowledge", "path": "{merchantId}/orders/{orderId}/acknowledge", "httpMethod": "POST", - "description": "Marks an order as acknowledged.", + "description": "Marks an order as acknowledged. This method can only be called for non-multi-client accounts.", "parameters": { "merchantId": { "type": "string", @@ -5872,7 +5894,7 @@ "id": "content.orders.advancetestorder", "path": "{merchantId}/testorders/{orderId}/advance", "httpMethod": "POST", - "description": "Sandbox only. Moves a test order from state \"inProgress\" to state \"pendingShipment\".", + "description": "Sandbox only. Moves a test order from state \"inProgress\" to state \"pendingShipment\". This method can only be called for non-multi-client accounts.", "parameters": { "merchantId": { "type": "string", @@ -5903,7 +5925,7 @@ "id": "content.orders.cancel", "path": "{merchantId}/orders/{orderId}/cancel", "httpMethod": "POST", - "description": "Cancels all line items in an order.", + "description": "Cancels all line items in an order. This method can only be called for non-multi-client accounts.", "parameters": { "merchantId": { "type": "string", @@ -5937,7 +5959,7 @@ "id": "content.orders.cancellineitem", "path": "{merchantId}/orders/{orderId}/cancelLineItem", "httpMethod": "POST", - "description": "Cancels a line item.", + "description": "Cancels a line item. This method can only be called for non-multi-client accounts.", "parameters": { "merchantId": { "type": "string", @@ -5971,7 +5993,7 @@ "id": "content.orders.createtestorder", "path": "{merchantId}/testorders", "httpMethod": "POST", - "description": "Sandbox only. Creates a test order.", + "description": "Sandbox only. Creates a test order. This method can only be called for non-multi-client accounts.", "parameters": { "merchantId": { "type": "string", @@ -5998,7 +6020,7 @@ "id": "content.orders.custombatch", "path": "orders/batch", "httpMethod": "POST", - "description": "Retrieves or modifies multiple orders in a single request.", + "description": "Retrieves or modifies multiple orders in a single request. This method can only be called for non-multi-client accounts.", "request": { "$ref": "OrdersCustomBatchRequest" }, @@ -6013,7 +6035,7 @@ "id": "content.orders.get", "path": "{merchantId}/orders/{orderId}", "httpMethod": "GET", - "description": "Retrieves an order from your Merchant Center account.", + "description": "Retrieves an order from your Merchant Center account. This method can only be called for non-multi-client accounts.", "parameters": { "merchantId": { "type": "string", @@ -6044,7 +6066,7 @@ "id": "content.orders.getbymerchantorderid", "path": "{merchantId}/ordersbymerchantid/{merchantOrderId}", "httpMethod": "GET", - "description": "Retrieves an order using merchant order id.", + "description": "Retrieves an order using merchant order id. This method can only be called for non-multi-client accounts.", "parameters": { "merchantId": { "type": "string", @@ -6075,7 +6097,7 @@ "id": "content.orders.gettestordertemplate", "path": "{merchantId}/testordertemplates/{templateName}", "httpMethod": "GET", - "description": "Sandbox only. Retrieves an order template that can be used to quickly create a new order in sandbox.", + "description": "Sandbox only. Retrieves an order template that can be used to quickly create a new order in sandbox. This method can only be called for non-multi-client accounts.", "parameters": { "merchantId": { "type": "string", @@ -6118,7 +6140,7 @@ "id": "content.orders.list", "path": "{merchantId}/orders", "httpMethod": "GET", - "description": "Lists the orders in your Merchant Center account.", + "description": "Lists the orders in your Merchant Center account. This method can only be called for non-multi-client accounts.", "parameters": { "acknowledged": { "type": "boolean", @@ -6213,7 +6235,7 @@ "id": "content.orders.refund", "path": "{merchantId}/orders/{orderId}/refund", "httpMethod": "POST", - "description": "Refund a portion of the order, up to the full amount paid.", + "description": "Refund a portion of the order, up to the full amount paid. This method can only be called for non-multi-client accounts.", "parameters": { "merchantId": { "type": "string", @@ -6247,7 +6269,7 @@ "id": "content.orders.returnlineitem", "path": "{merchantId}/orders/{orderId}/returnLineItem", "httpMethod": "POST", - "description": "Returns a line item.", + "description": "Returns a line item. This method can only be called for non-multi-client accounts.", "parameters": { "merchantId": { "type": "string", @@ -6281,7 +6303,7 @@ "id": "content.orders.shiplineitems", "path": "{merchantId}/orders/{orderId}/shipLineItems", "httpMethod": "POST", - "description": "Marks line item(s) as shipped.", + "description": "Marks line item(s) as shipped. This method can only be called for non-multi-client accounts.", "parameters": { "merchantId": { "type": "string", @@ -6315,7 +6337,7 @@ "id": "content.orders.updatemerchantorderid", "path": "{merchantId}/orders/{orderId}/updateMerchantOrderId", "httpMethod": "POST", - "description": "Updates the merchant order ID for a given order.", + "description": "Updates the merchant order ID for a given order. This method can only be called for non-multi-client accounts.", "parameters": { "merchantId": { "type": "string", @@ -6349,7 +6371,7 @@ "id": "content.orders.updateshipment", "path": "{merchantId}/orders/{orderId}/updateShipment", "httpMethod": "POST", - "description": "Updates a shipment's status, carrier, and/or tracking ID.", + "description": "Updates a shipment's status, carrier, and/or tracking ID. This method can only be called for non-multi-client accounts.", "parameters": { "merchantId": { "type": "string", @@ -6387,7 +6409,7 @@ "id": "content.products.custombatch", "path": "products/batch", "httpMethod": "POST", - "description": "Retrieves, inserts, and deletes multiple products in a single request.", + "description": "Retrieves, inserts, and deletes multiple products in a single request. This method can only be called for non-multi-client accounts.", "parameters": { "dryRun": { "type": "boolean", @@ -6409,7 +6431,7 @@ "id": "content.products.delete", "path": "{merchantId}/products/{productId}", "httpMethod": "DELETE", - "description": "Deletes a product from your Merchant Center account.", + "description": "Deletes a product from your Merchant Center account. This method can only be called for non-multi-client accounts.", "parameters": { "dryRun": { "type": "boolean", @@ -6442,7 +6464,7 @@ "id": "content.products.get", "path": "{merchantId}/products/{productId}", "httpMethod": "GET", - "description": "Retrieves a product from your Merchant Center account.", + "description": "Retrieves a product from your Merchant Center account. This method can only be called for non-multi-client accounts.", "parameters": { "merchantId": { "type": "string", @@ -6473,7 +6495,7 @@ "id": "content.products.insert", "path": "{merchantId}/products", "httpMethod": "POST", - "description": "Uploads a product to your Merchant Center account.", + "description": "Uploads a product to your Merchant Center account. If an item with the same channel, contentLanguage, offerId, and targetCountry already exists, this method updates that entry. This method can only be called for non-multi-client accounts.", "parameters": { "dryRun": { "type": "boolean", @@ -6505,7 +6527,7 @@ "id": "content.products.list", "path": "{merchantId}/products", "httpMethod": "GET", - "description": "Lists the products in your Merchant Center account.", + "description": "Lists the products in your Merchant Center account. This method can only be called for non-multi-client accounts.", "parameters": { "includeInvalidInsertedItems": { "type": "boolean", @@ -6549,7 +6571,7 @@ "id": "content.productstatuses.custombatch", "path": "productstatuses/batch", "httpMethod": "POST", - "description": "Gets the statuses of multiple products in a single request.", + "description": "Gets the statuses of multiple products in a single request. This method can only be called for non-multi-client accounts.", "request": { "$ref": "ProductstatusesCustomBatchRequest" }, @@ -6564,7 +6586,7 @@ "id": "content.productstatuses.get", "path": "{merchantId}/productstatuses/{productId}", "httpMethod": "GET", - "description": "Gets the status of a product from your Merchant Center account.", + "description": "Gets the status of a product from your Merchant Center account. This method can only be called for non-multi-client accounts.", "parameters": { "merchantId": { "type": "string", @@ -6595,7 +6617,7 @@ "id": "content.productstatuses.list", "path": "{merchantId}/productstatuses", "httpMethod": "GET", - "description": "Lists the statuses of the products in your Merchant Center account.", + "description": "Lists the statuses of the products in your Merchant Center account. This method can only be called for non-multi-client accounts.", "parameters": { "includeInvalidInsertedItems": { "type": "boolean", @@ -6661,7 +6683,7 @@ "id": "content.shippingsettings.get", "path": "{merchantId}/shippingsettings/{accountId}", "httpMethod": "GET", - "description": "Retrieves the shipping settings of the account.", + "description": "Retrieves the shipping settings of the account. This method can only be called for accounts to which the managing account has access: either the managing account itself or sub-accounts if the managing account is a multi-client account.", "parameters": { "accountId": { "type": "string", @@ -6717,7 +6739,7 @@ "id": "content.shippingsettings.list", "path": "{merchantId}/shippingsettings", "httpMethod": "GET", - "description": "Lists the shipping settings of the sub-accounts in your Merchant Center account.", + "description": "Lists the shipping settings of the sub-accounts in your Merchant Center account. This method can only be called for multi-client accounts.", "parameters": { "maxResults": { "type": "integer", @@ -6752,7 +6774,7 @@ "id": "content.shippingsettings.patch", "path": "{merchantId}/shippingsettings/{accountId}", "httpMethod": "PATCH", - "description": "Updates the shipping settings of the account. This method supports patch semantics.", + "description": "Updates the shipping settings of the account. This method can only be called for accounts to which the managing account has access: either the managing account itself or sub-accounts if the managing account is a multi-client account. This method supports patch semantics.", "parameters": { "accountId": { "type": "string", @@ -6792,7 +6814,7 @@ "id": "content.shippingsettings.update", "path": "{merchantId}/shippingsettings/{accountId}", "httpMethod": "PUT", - "description": "Updates the shipping settings of the account.", + "description": "Updates the shipping settings of the account. This method can only be called for accounts to which the managing account has access: either the managing account itself or sub-accounts if the managing account is a multi-client account.", "parameters": { "accountId": { "type": "string", diff --git a/etc/api/content/v2sandbox/content-api.json b/etc/api/content/v2sandbox/content-api.json index d1d642d011..8c73a4b245 100644 --- a/etc/api/content/v2sandbox/content-api.json +++ b/etc/api/content/v2sandbox/content-api.json @@ -1,19 +1,19 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/5YRb4l5DodMV9xyOy-Xnx-Jl5b0\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/W1AQ-5FwbPweFAs-GFJ9Ju07xes\"", "discoveryVersion": "v1", "id": "content:v2sandbox", "name": "content", "canonicalName": "Shopping Content", "version": "v2sandbox", - "revision": "20160905", + "revision": "20161205", "title": "Content API for Shopping", "description": "Manages product items, inventory, and Merchant Center accounts for Google Shopping.", "ownerDomain": "google.com", "ownerName": "Google", "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" }, "documentationLink": "https://developers.google.com/shopping-content", "protocol": "rest", @@ -299,7 +299,7 @@ }, "explicitMarketingPreference": { "type": "boolean", - "description": "If set, this indicates the user explicitly chose to opt in or out of providing marketing rights to the merchant. If unset, this indicates the user has already made this choice in a previous purchase, and was thus not shown the marketing right opt in/out checkbox during the Purchases on Google checkout flow." + "description": "If set, this indicates the user explicitly chose to opt in or out of providing marketing rights to the merchant. If unset, this indicates the user has already made this choice in a previous purchase, and was thus not shown the marketing right opt in/out checkbox during the checkout flow." }, "fullName": { "type": "string", @@ -1526,7 +1526,7 @@ }, "explicitMarketingPreference": { "type": "boolean", - "description": "If set, this indicates the user explicitly chose to opt in or out of providing marketing rights to the merchant. If unset, this indicates the user has already made this choice in a previous purchase, and was thus not shown the marketing right opt in/out checkbox during the Purchases on Google checkout flow. Optional." + "description": "If set, this indicates the user explicitly chose to opt in or out of providing marketing rights to the merchant. If unset, this indicates the user has already made this choice in a previous purchase, and was thus not shown the marketing right opt in/out checkbox during the checkout flow. Optional." }, "fullName": { "type": "string", @@ -1723,7 +1723,7 @@ "id": "content.orders.acknowledge", "path": "{merchantId}/orders/{orderId}/acknowledge", "httpMethod": "POST", - "description": "Marks an order as acknowledged.", + "description": "Marks an order as acknowledged. This method can only be called for non-multi-client accounts.", "parameters": { "merchantId": { "type": "string", @@ -1757,7 +1757,7 @@ "id": "content.orders.advancetestorder", "path": "{merchantId}/testorders/{orderId}/advance", "httpMethod": "POST", - "description": "Sandbox only. Moves a test order from state \"inProgress\" to state \"pendingShipment\".", + "description": "Sandbox only. Moves a test order from state \"inProgress\" to state \"pendingShipment\". This method can only be called for non-multi-client accounts.", "parameters": { "merchantId": { "type": "string", @@ -1788,7 +1788,7 @@ "id": "content.orders.cancel", "path": "{merchantId}/orders/{orderId}/cancel", "httpMethod": "POST", - "description": "Cancels all line items in an order.", + "description": "Cancels all line items in an order. This method can only be called for non-multi-client accounts.", "parameters": { "merchantId": { "type": "string", @@ -1822,7 +1822,7 @@ "id": "content.orders.cancellineitem", "path": "{merchantId}/orders/{orderId}/cancelLineItem", "httpMethod": "POST", - "description": "Cancels a line item.", + "description": "Cancels a line item. This method can only be called for non-multi-client accounts.", "parameters": { "merchantId": { "type": "string", @@ -1856,7 +1856,7 @@ "id": "content.orders.createtestorder", "path": "{merchantId}/testorders", "httpMethod": "POST", - "description": "Sandbox only. Creates a test order.", + "description": "Sandbox only. Creates a test order. This method can only be called for non-multi-client accounts.", "parameters": { "merchantId": { "type": "string", @@ -1883,7 +1883,7 @@ "id": "content.orders.custombatch", "path": "orders/batch", "httpMethod": "POST", - "description": "Retrieves or modifies multiple orders in a single request.", + "description": "Retrieves or modifies multiple orders in a single request. This method can only be called for non-multi-client accounts.", "request": { "$ref": "OrdersCustomBatchRequest" }, @@ -1898,7 +1898,7 @@ "id": "content.orders.get", "path": "{merchantId}/orders/{orderId}", "httpMethod": "GET", - "description": "Retrieves an order from your Merchant Center account.", + "description": "Retrieves an order from your Merchant Center account. This method can only be called for non-multi-client accounts.", "parameters": { "merchantId": { "type": "string", @@ -1929,7 +1929,7 @@ "id": "content.orders.getbymerchantorderid", "path": "{merchantId}/ordersbymerchantid/{merchantOrderId}", "httpMethod": "GET", - "description": "Retrieves an order using merchant order id.", + "description": "Retrieves an order using merchant order id. This method can only be called for non-multi-client accounts.", "parameters": { "merchantId": { "type": "string", @@ -1960,7 +1960,7 @@ "id": "content.orders.gettestordertemplate", "path": "{merchantId}/testordertemplates/{templateName}", "httpMethod": "GET", - "description": "Sandbox only. Retrieves an order template that can be used to quickly create a new order in sandbox.", + "description": "Sandbox only. Retrieves an order template that can be used to quickly create a new order in sandbox. This method can only be called for non-multi-client accounts.", "parameters": { "merchantId": { "type": "string", @@ -2003,7 +2003,7 @@ "id": "content.orders.list", "path": "{merchantId}/orders", "httpMethod": "GET", - "description": "Lists the orders in your Merchant Center account.", + "description": "Lists the orders in your Merchant Center account. This method can only be called for non-multi-client accounts.", "parameters": { "acknowledged": { "type": "boolean", @@ -2098,7 +2098,7 @@ "id": "content.orders.refund", "path": "{merchantId}/orders/{orderId}/refund", "httpMethod": "POST", - "description": "Refund a portion of the order, up to the full amount paid.", + "description": "Refund a portion of the order, up to the full amount paid. This method can only be called for non-multi-client accounts.", "parameters": { "merchantId": { "type": "string", @@ -2132,7 +2132,7 @@ "id": "content.orders.returnlineitem", "path": "{merchantId}/orders/{orderId}/returnLineItem", "httpMethod": "POST", - "description": "Returns a line item.", + "description": "Returns a line item. This method can only be called for non-multi-client accounts.", "parameters": { "merchantId": { "type": "string", @@ -2166,7 +2166,7 @@ "id": "content.orders.shiplineitems", "path": "{merchantId}/orders/{orderId}/shipLineItems", "httpMethod": "POST", - "description": "Marks line item(s) as shipped.", + "description": "Marks line item(s) as shipped. This method can only be called for non-multi-client accounts.", "parameters": { "merchantId": { "type": "string", @@ -2200,7 +2200,7 @@ "id": "content.orders.updatemerchantorderid", "path": "{merchantId}/orders/{orderId}/updateMerchantOrderId", "httpMethod": "POST", - "description": "Updates the merchant order ID for a given order.", + "description": "Updates the merchant order ID for a given order. This method can only be called for non-multi-client accounts.", "parameters": { "merchantId": { "type": "string", @@ -2234,7 +2234,7 @@ "id": "content.orders.updateshipment", "path": "{merchantId}/orders/{orderId}/updateShipment", "httpMethod": "POST", - "description": "Updates a shipment's status, carrier, and/or tracking ID.", + "description": "Updates a shipment's status, carrier, and/or tracking ID. This method can only be called for non-multi-client accounts.", "parameters": { "merchantId": { "type": "string", diff --git a/etc/api/customsearch/v1/customsearch-api.json b/etc/api/customsearch/v1/customsearch-api.json index 421371335e..6463cace45 100644 --- a/etc/api/customsearch/v1/customsearch-api.json +++ b/etc/api/customsearch/v1/customsearch-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/6uDmKuIsmBzjIYdBp6ZSuZP4_cw\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/2gL3A40IBu11GP9xmmdXxrLKXPg\"", "discoveryVersion": "v1", "id": "customsearch:v1", "name": "customsearch", @@ -11,8 +11,8 @@ "ownerDomain": "google.com", "ownerName": "Google", "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" }, "documentationLink": "https://developers.google.com/custom-search/v1/using_rest", "protocol": "rest", diff --git a/etc/api/dataflow/v1b3/dataflow-api.json b/etc/api/dataflow/v1b3/dataflow-api.json index e36e8cd800..b41dce8d2d 100644 --- a/etc/api/dataflow/v1b3/dataflow-api.json +++ b/etc/api/dataflow/v1b3/dataflow-api.json @@ -1,11 +1,11 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/947N7-PR3f8n42WFCweiQxxRQdA\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/2ldmPeHEvQ6NGgRE1Cb3tnvrYr8\"", "discoveryVersion": "v1", "id": "dataflow:v1b3", "name": "dataflow", "version": "v1b3", - "revision": "20160908", + "revision": "20161004", "title": "Google Dataflow API", "description": "Develops and executes data processing patterns like ETL, batch computation, and continuous computation.", "ownerDomain": "google.com", @@ -274,6 +274,10 @@ "additionalProperties": { "type": "string" } + }, + "location": { + "type": "string", + "description": "The location which contains this job." } } }, @@ -339,6 +343,10 @@ "type": "any", "description": "Properties of the object. Contains field @type with type URL." } + }, + "serviceAccountEmail": { + "type": "string", + "description": "Identity to run virtual machines as. Defaults to the default account." } } }, @@ -705,6 +713,24 @@ "nextPageToken": { "type": "string", "description": "Set if there may be more results than fit in this response." + }, + "failedLocation": { + "type": "array", + "description": "Zero or more messages describing locations that failed to respond.", + "items": { + "$ref": "FailedLocation" + } + } + } + }, + "FailedLocation": { + "id": "FailedLocation", + "type": "object", + "description": "FailedLocation indicates which location failed to respond to a request for data.", + "properties": { + "name": { + "type": "string", + "description": "The name of the failed location." } } }, @@ -845,6 +871,10 @@ "type": "object", "description": "Request to create a Dataflow job.", "properties": { + "jobName": { + "type": "string", + "description": "The job name to use for the created job.." + }, "gcsPath": { "type": "string", "description": "A path to the serialized JSON representation of the job." @@ -855,6 +885,30 @@ "additionalProperties": { "type": "string" } + }, + "environment": { + "$ref": "RuntimeEnvironment", + "description": "Runtime environment for the job." + } + } + }, + "RuntimeEnvironment": { + "id": "RuntimeEnvironment", + "type": "object", + "description": "Environment values to set at runtime.", + "properties": { + "maxWorkers": { + "type": "integer", + "description": "The maximum number of workers to start for the job.", + "format": "int32" + }, + "zone": { + "type": "string", + "description": "The zone to start the workers in." + }, + "serviceAccountEmail": { + "type": "string", + "description": "The service account to run the job as." } } }, @@ -877,6 +931,10 @@ "currentWorkerTime": { "type": "string", "description": "The current timestamp at the worker." + }, + "location": { + "type": "string", + "description": "The location which contains the WorkItem's job." } } }, @@ -1690,6 +1748,10 @@ "workerId": { "type": "string", "description": "Identifies the worker leasing work -- typically the ID of the virtual machine running the worker." + }, + "location": { + "type": "string", + "description": "The location which contains the WorkItem's job." } } }, @@ -2350,6 +2412,10 @@ "trackingSubscription": { "type": "string", "description": "If set, specifies the pubsub subscription that will be used for tracking custom time timestamps for watermark estimation." + }, + "withAttributes": { + "type": "boolean", + "description": "If true, then the client has requested to get pubsub attributes." } } }, @@ -2781,6 +2847,11 @@ "type": "string", "description": "DEPRECATED. This field is now on the Job message.", "location": "query" + }, + "location": { + "type": "string", + "description": "The location which contains this job.", + "location": "query" } }, "parameterOrder": [ @@ -2824,6 +2895,11 @@ "JOB_VIEW_ALL" ], "location": "query" + }, + "location": { + "type": "string", + "description": "The location which contains this job.", + "location": "query" } }, "parameterOrder": [ @@ -2855,6 +2931,11 @@ "description": "Identifies a single job.", "required": true, "location": "path" + }, + "location": { + "type": "string", + "description": "The location which contains this job.", + "location": "query" } }, "parameterOrder": [ @@ -2915,6 +2996,11 @@ "type": "string", "description": "Set this to the 'next_page_token' field of a previous response to request additional results in a long list.", "location": "query" + }, + "location": { + "type": "string", + "description": "The location which contains this job.", + "location": "query" } }, "parameterOrder": [ @@ -2950,6 +3036,11 @@ "type": "string", "description": "Return only metric data that has changed since this time. Default is to return all information about all metrics for the job.", "location": "query" + }, + "location": { + "type": "string", + "description": "The location which contains the job specified by job_id.", + "location": "query" } }, "parameterOrder": [ @@ -3091,6 +3182,11 @@ "type": "string", "description": "Return only messages with timestamps \u003c end_time. The default is now (i.e. return up to the latest messages available).", "location": "query" + }, + "location": { + "type": "string", + "description": "The location which contains the job specified by job_id.", + "location": "query" } }, "parameterOrder": [ @@ -3181,6 +3277,422 @@ } } }, + "locations": { + "resources": { + "jobs": { + "methods": { + "create": { + "id": "dataflow.projects.locations.jobs.create", + "path": "v1b3/projects/{projectId}/locations/{location}/jobs", + "httpMethod": "POST", + "description": "Creates a dataflow job.", + "parameters": { + "projectId": { + "type": "string", + "description": "The project which owns the job.", + "required": true, + "location": "path" + }, + "location": { + "type": "string", + "description": "The location which contains this job.", + "required": true, + "location": "path" + }, + "view": { + "type": "string", + "description": "Level of information requested in response.", + "enum": [ + "JOB_VIEW_UNKNOWN", + "JOB_VIEW_SUMMARY", + "JOB_VIEW_ALL" + ], + "location": "query" + }, + "replaceJobId": { + "type": "string", + "description": "DEPRECATED. This field is now on the Job message.", + "location": "query" + } + }, + "parameterOrder": [ + "projectId", + "location" + ], + "request": { + "$ref": "Job" + }, + "response": { + "$ref": "Job" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/userinfo.email" + ] + }, + "get": { + "id": "dataflow.projects.locations.jobs.get", + "path": "v1b3/projects/{projectId}/locations/{location}/jobs/{jobId}", + "httpMethod": "GET", + "description": "Gets the state of the specified dataflow job.", + "parameters": { + "projectId": { + "type": "string", + "description": "The project which owns the job.", + "required": true, + "location": "path" + }, + "location": { + "type": "string", + "description": "The location which contains this job.", + "required": true, + "location": "path" + }, + "jobId": { + "type": "string", + "description": "Identifies a single job.", + "required": true, + "location": "path" + }, + "view": { + "type": "string", + "description": "Level of information requested in response.", + "enum": [ + "JOB_VIEW_UNKNOWN", + "JOB_VIEW_SUMMARY", + "JOB_VIEW_ALL" + ], + "location": "query" + } + }, + "parameterOrder": [ + "projectId", + "location", + "jobId" + ], + "response": { + "$ref": "Job" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/userinfo.email" + ] + }, + "update": { + "id": "dataflow.projects.locations.jobs.update", + "path": "v1b3/projects/{projectId}/locations/{location}/jobs/{jobId}", + "httpMethod": "PUT", + "description": "Updates the state of an existing dataflow job.", + "parameters": { + "projectId": { + "type": "string", + "description": "The project which owns the job.", + "required": true, + "location": "path" + }, + "location": { + "type": "string", + "description": "The location which contains this job.", + "required": true, + "location": "path" + }, + "jobId": { + "type": "string", + "description": "Identifies a single job.", + "required": true, + "location": "path" + } + }, + "parameterOrder": [ + "projectId", + "location", + "jobId" + ], + "request": { + "$ref": "Job" + }, + "response": { + "$ref": "Job" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/userinfo.email" + ] + }, + "list": { + "id": "dataflow.projects.locations.jobs.list", + "path": "v1b3/projects/{projectId}/locations/{location}/jobs", + "httpMethod": "GET", + "description": "List the jobs of a project", + "parameters": { + "projectId": { + "type": "string", + "description": "The project which owns the jobs.", + "required": true, + "location": "path" + }, + "location": { + "type": "string", + "description": "The location which contains this job.", + "required": true, + "location": "path" + }, + "filter": { + "type": "string", + "description": "The kind of filter to use.", + "enum": [ + "UNKNOWN", + "ALL", + "TERMINATED", + "ACTIVE" + ], + "location": "query" + }, + "view": { + "type": "string", + "description": "Level of information requested in response. Default is SUMMARY.", + "enum": [ + "JOB_VIEW_UNKNOWN", + "JOB_VIEW_SUMMARY", + "JOB_VIEW_ALL" + ], + "location": "query" + }, + "pageSize": { + "type": "integer", + "description": "If there are many jobs, limit response to at most this many. The actual number of jobs returned will be the lesser of max_responses and an unspecified server-defined limit.", + "format": "int32", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "Set this to the 'next_page_token' field of a previous response to request additional results in a long list.", + "location": "query" + } + }, + "parameterOrder": [ + "projectId", + "location" + ], + "response": { + "$ref": "ListJobsResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/userinfo.email" + ] + }, + "getMetrics": { + "id": "dataflow.projects.locations.jobs.getMetrics", + "path": "v1b3/projects/{projectId}/locations/{location}/jobs/{jobId}/metrics", + "httpMethod": "GET", + "description": "Request the job status.", + "parameters": { + "projectId": { + "type": "string", + "description": "A project id.", + "required": true, + "location": "path" + }, + "location": { + "type": "string", + "description": "The location which contains the job specified by job_id.", + "required": true, + "location": "path" + }, + "jobId": { + "type": "string", + "description": "The job to get messages for.", + "required": true, + "location": "path" + }, + "startTime": { + "type": "string", + "description": "Return only metric data that has changed since this time. Default is to return all information about all metrics for the job.", + "location": "query" + } + }, + "parameterOrder": [ + "projectId", + "location", + "jobId" + ], + "response": { + "$ref": "JobMetrics" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/userinfo.email" + ] + } + }, + "resources": { + "messages": { + "methods": { + "list": { + "id": "dataflow.projects.locations.jobs.messages.list", + "path": "v1b3/projects/{projectId}/locations/{location}/jobs/{jobId}/messages", + "httpMethod": "GET", + "description": "Request the job status.", + "parameters": { + "projectId": { + "type": "string", + "description": "A project id.", + "required": true, + "location": "path" + }, + "location": { + "type": "string", + "description": "The location which contains the job specified by job_id.", + "required": true, + "location": "path" + }, + "jobId": { + "type": "string", + "description": "The job to get messages about.", + "required": true, + "location": "path" + }, + "minimumImportance": { + "type": "string", + "description": "Filter to only get messages with importance \u003e= level", + "enum": [ + "JOB_MESSAGE_IMPORTANCE_UNKNOWN", + "JOB_MESSAGE_DEBUG", + "JOB_MESSAGE_DETAILED", + "JOB_MESSAGE_BASIC", + "JOB_MESSAGE_WARNING", + "JOB_MESSAGE_ERROR" + ], + "location": "query" + }, + "pageSize": { + "type": "integer", + "description": "If specified, determines the maximum number of messages to return. If unspecified, the service may choose an appropriate default, or may return an arbitrarily large number of results.", + "format": "int32", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "If supplied, this should be the value of next_page_token returned by an earlier call. This will cause the next page of results to be returned.", + "location": "query" + }, + "startTime": { + "type": "string", + "description": "If specified, return only messages with timestamps \u003e= start_time. The default is the job creation time (i.e. beginning of messages).", + "location": "query" + }, + "endTime": { + "type": "string", + "description": "Return only messages with timestamps \u003c end_time. The default is now (i.e. return up to the latest messages available).", + "location": "query" + } + }, + "parameterOrder": [ + "projectId", + "location", + "jobId" + ], + "response": { + "$ref": "ListJobMessagesResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/userinfo.email" + ] + } + } + }, + "workItems": { + "methods": { + "reportStatus": { + "id": "dataflow.projects.locations.jobs.workItems.reportStatus", + "path": "v1b3/projects/{projectId}/locations/{location}/jobs/{jobId}/workItems:reportStatus", + "httpMethod": "POST", + "description": "Reports the status of dataflow WorkItems leased by a worker.", + "parameters": { + "projectId": { + "type": "string", + "description": "The project which owns the WorkItem's job.", + "required": true, + "location": "path" + }, + "location": { + "type": "string", + "description": "The location which contains the WorkItem's job.", + "required": true, + "location": "path" + }, + "jobId": { + "type": "string", + "description": "The job which the WorkItem is part of.", + "required": true, + "location": "path" + } + }, + "parameterOrder": [ + "projectId", + "location", + "jobId" + ], + "request": { + "$ref": "ReportWorkItemStatusRequest" + }, + "response": { + "$ref": "ReportWorkItemStatusResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/userinfo.email" + ] + }, + "lease": { + "id": "dataflow.projects.locations.jobs.workItems.lease", + "path": "v1b3/projects/{projectId}/locations/{location}/jobs/{jobId}/workItems:lease", + "httpMethod": "POST", + "description": "Leases a dataflow WorkItem to run.", + "parameters": { + "projectId": { + "type": "string", + "description": "Identifies the project this worker belongs to.", + "required": true, + "location": "path" + }, + "location": { + "type": "string", + "description": "The location which contains the WorkItem's job.", + "required": true, + "location": "path" + }, + "jobId": { + "type": "string", + "description": "Identifies the workflow job this worker belongs to.", + "required": true, + "location": "path" + } + }, + "parameterOrder": [ + "projectId", + "location", + "jobId" + ], + "request": { + "$ref": "LeaseWorkItemRequest" + }, + "response": { + "$ref": "LeaseWorkItemResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/userinfo.email" + ] + } + } + } + } + } + } + }, "templates": { "methods": { "create": { diff --git a/etc/api/dataproc/v1/dataproc-api.json b/etc/api/dataproc/v1/dataproc-api.json index bec4b2787a..0c6e38c52f 100644 --- a/etc/api/dataproc/v1/dataproc-api.json +++ b/etc/api/dataproc/v1/dataproc-api.json @@ -1,13 +1,13 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/tFUpSbikiYUx1YQKdRQ2bGGumuA\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/UWIx0i13luZLKjW6gmDu2evUqDA\"", "discoveryVersion": "v1", "id": "dataproc:v1", "name": "dataproc", "version": "v1", - "revision": "20160503", + "revision": "20161102", "title": "Google Cloud Dataproc API", - "description": "Manages Hadoop-based clusters and jobs on Google Cloud Platform.", + "description": "An API for managing Hadoop-based clusters and jobs on Google Cloud Platform.", "ownerDomain": "google.com", "ownerName": "Google", "icons": { @@ -127,6 +127,13 @@ "$ref": "ClusterConfig", "description": "[Required] The cluster config. Note that Cloud Dataproc may set default values, and values may change when clusters are updated." }, + "labels": { + "type": "object", + "description": "[Optional] The labels to associate with this cluster. Label **keys** must contain 1 to 63 characters, and must conform to [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt). Label **values** may be empty, but, if present, must contain 1 to 63 characters, and must conform to [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be associated with a cluster.", + "additionalProperties": { + "type": "string" + } + }, "status": { "$ref": "ClusterStatus", "description": "[Output-only] Cluster status." @@ -141,6 +148,10 @@ "clusterUuid": { "type": "string", "description": "[Output-only] A cluster UUID (Unique Universal Identifier). Cloud Dataproc generates this value when it creates the cluster." + }, + "metrics": { + "$ref": "ClusterMetrics", + "description": "Contains cluster daemon metrics such as HDFS and YARN stats. **Beta Feature**: This report is available for testing purposes only. It may be changed before final release." } } }, @@ -175,7 +186,7 @@ }, "initializationActions": { "type": "array", - "description": "[Optional] Commands to execute on each node after config is completed. By default, executables are run on master and all worker nodes. You can test a node's role metadata to run an executable on a master or worker node, as shown below: ROLE=$(/usr/share/google/get_metadata_value attributes/role) if [[ \"${ROLE}\" == 'Master' ]]; then ... master specific actions ... else ... worker specific actions ... fi", + "description": "[Optional] Commands to execute on each node after config is completed. By default, executables are run on master and all worker nodes. You can test a node's role metadata to run an executable on a master or worker node, as shown below using `curl` (you can also use `wget`): ROLE=$(curl -H Metadata-Flavor:Google http://metadata/computeMetadata/v1/instance/attributes/dataproc-role) if [[ \"${ROLE}\" == 'Master' ]]; then ... master specific actions ... else ... worker specific actions ... fi", "items": { "$ref": "NodeInitializationAction" } @@ -193,29 +204,33 @@ }, "networkUri": { "type": "string", - "description": "The Google Compute Engine network to be used for machine communications. Cannot be specified with subnetwork_uri. If neither network_uri nor subnetwork_uri is specified, the \"default\" network of the project is used, if it exists. Cannot be a \"Custom Subnet Network\" (see https://cloud.google.com/compute/docs/subnetworks for more information). Example: `https://www.googleapis.com/compute/v1/projects/[project_id]/regions/global/default`." + "description": "[Optional] The Google Compute Engine network to be used for machine communications. Cannot be specified with subnetwork_uri. If neither `network_uri` nor `subnetwork_uri` is specified, the \"default\" network of the project is used, if it exists. Cannot be a \"Custom Subnet Network\" (see [Using Subnetworks](/compute/docs/subnetworks) for more information). Example: `https://www.googleapis.com/compute/v1/projects/[project_id]/regions/global/default`." }, "subnetworkUri": { "type": "string", - "description": "The Google Compute Engine subnetwork to be used for machine communications. Cannot be specified with network_uri. Example: `https://www.googleapis.com/compute/v1/projects/[project_id]/regions/us-east1/sub0`." + "description": "[Optional] The Google Compute Engine subnetwork to be used for machine communications. Cannot be specified with network_uri. Example: `https://www.googleapis.com/compute/v1/projects/[project_id]/regions/us-east1/sub0`." + }, + "internalIpOnly": { + "type": "boolean", + "description": "[Optional] If true, all instances in the cluster will only have internal IP addresses. By default, clusters are not restricted to internal IP addresses, and will have ephemeral external IP addresses assigned to each instance. This `internal_ip_only` restriction can only be enabled for subnetwork enabled networks, and all off-cluster dependencies must be configured to be accessible without external IP addresses." }, "serviceAccountScopes": { "type": "array", - "description": "The URIs of service account scopes to be included in Google Compute Engine instances. The following base set of scopes is always included: * https://www.googleapis.com/auth/cloud.useraccounts.readonly * https://www.googleapis.com/auth/devstorage.read_write * https://www.googleapis.com/auth/logging.write If no scopes are specfied, the following defaults are also provided: * https://www.googleapis.com/auth/bigquery * https://www.googleapis.com/auth/bigtable.admin.table * https://www.googleapis.com/auth/bigtable.data * https://www.googleapis.com/auth/devstorage.full_control", + "description": "[Optional] The URIs of service account scopes to be included in Google Compute Engine instances. The following base set of scopes is always included: * https://www.googleapis.com/auth/cloud.useraccounts.readonly * https://www.googleapis.com/auth/devstorage.read_write * https://www.googleapis.com/auth/logging.write If no scopes are specified, the following defaults are also provided: * https://www.googleapis.com/auth/bigquery * https://www.googleapis.com/auth/bigtable.admin.table * https://www.googleapis.com/auth/bigtable.data * https://www.googleapis.com/auth/devstorage.full_control", "items": { "type": "string" } }, "tags": { "type": "array", - "description": "The Google Compute Engine tags to add to all instances.", + "description": "The Google Compute Engine tags to add to all instances (see [Tagging instances](/compute/docs/label-or-tag-resources#tags)).", "items": { "type": "string" } }, "metadata": { "type": "object", - "description": "The Google Compute Engine metadata entries to add to all instances.", + "description": "The Google Compute Engine metadata entries to add to all instances (see [Project and instance metadata](https://cloud.google.com/compute/docs/storing-retrieving-metadata#project_and_instance_metadata)).", "additionalProperties": { "type": "string" } @@ -225,16 +240,16 @@ "InstanceGroupConfig": { "id": "InstanceGroupConfig", "type": "object", - "description": "The config settings for Google Compute Engine resources in an instance group, such as a master or worker group.", + "description": "[Optional] The config settings for Google Compute Engine resources in an instance group, such as a master or worker group.", "properties": { "numInstances": { "type": "integer", - "description": "The number of VM instances in the instance group. For master instance groups, must be set to 1.", + "description": "[Required] The number of VM instances in the instance group. For master instance groups, must be set to 1.", "format": "int32" }, "instanceNames": { "type": "array", - "description": "The list of instance names. Cloud Dataproc derives the names from `cluster_name`, `num_instances`, and the instance group if not set by user (recommended practice is to let Cloud Dataproc derive the name).", + "description": "[Optional] The list of instance names. Cloud Dataproc derives the names from `cluster_name`, `num_instances`, and the instance group if not set by user (recommended practice is to let Cloud Dataproc derive the name).", "items": { "type": "string" } @@ -245,15 +260,15 @@ }, "machineTypeUri": { "type": "string", - "description": "The Google Compute Engine machine type used for cluster instances. Example: `https://www.googleapis.com/compute/v1/projects/[project_id]/zones/us-east1-a/machineTypes/n1-standard-2`." + "description": "[Required] The Google Compute Engine machine type used for cluster instances. Example: `https://www.googleapis.com/compute/v1/projects/[project_id]/zones/us-east1-a/machineTypes/n1-standard-2`." }, "diskConfig": { "$ref": "DiskConfig", - "description": "Disk option config settings." + "description": "[Optional] Disk option config settings." }, "isPreemptible": { "type": "boolean", - "description": "Specifies that this instance group contains Preemptible Instances." + "description": "[Optional] Specifies that this instance group contains preemptible instances." }, "managedGroupConfig": { "$ref": "ManagedGroupConfig", @@ -273,7 +288,7 @@ }, "numLocalSsds": { "type": "integer", - "description": "[Optional] Number of attached SSDs, from 0 to 4 (default is 0). If SSDs are not attached, the boot disk is used to store runtime logs and HDFS data. If one or more SSDs are attached, this runtime bulk data is spread across them, and the boot disk contains only basic config and installed binaries.", + "description": "[Optional] Number of attached SSDs, from 0 to 4 (default is 0). If SSDs are not attached, the boot disk is used to store runtime logs and [HDFS](https://hadoop.apache.org/docs/r1.2.1/hdfs_user_guide.html) data. If one or more SSDs are attached, this runtime bulk data is spread across them, and the boot disk contains only basic config and installed binaries.", "format": "int32" } } @@ -333,7 +348,7 @@ "properties": { "state": { "type": "string", - "description": "The cluster's state.", + "description": "[Output-only] The cluster's state.", "enum": [ "UNKNOWN", "CREATING", @@ -345,11 +360,34 @@ }, "detail": { "type": "string", - "description": "Optional details of cluster's state." + "description": "[Output-only] Optional details of cluster's state." }, "stateStartTime": { "type": "string", - "description": "Time when this state was entered." + "description": "[Output-only] Time when this state was entered." + } + } + }, + "ClusterMetrics": { + "id": "ClusterMetrics", + "type": "object", + "description": "Contains cluster daemon metrics, such as HDFS and YARN stats. **Beta Feature**: This report is available for testing purposes only. It may be changed before final release.", + "properties": { + "hdfsMetrics": { + "type": "object", + "description": "The HDFS metrics.", + "additionalProperties": { + "type": "string", + "format": "int64" + } + }, + "yarnMetrics": { + "type": "object", + "description": "The YARN metrics.", + "additionalProperties": { + "type": "string", + "format": "int64" + } } } }, @@ -367,7 +405,7 @@ "description": "Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.", "additionalProperties": { "type": "any", - "description": "Properties of the object. Contains field @ype with type URL." + "description": "Properties of the object. Contains field @type with type URL." } }, "done": { @@ -376,14 +414,14 @@ }, "error": { "$ref": "Status", - "description": "The error result of the operation in case of failure." + "description": "The error result of the operation in case of failure or cancellation." }, "response": { "type": "object", "description": "The normal response of the operation in case of success. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.", "additionalProperties": { "type": "any", - "description": "Properties of the object. Contains field @ype with type URL." + "description": "Properties of the object. Contains field @type with type URL." } } } @@ -409,7 +447,7 @@ "type": "object", "additionalProperties": { "type": "any", - "description": "Properties of the object. Contains field @ype with type URL." + "description": "Properties of the object. Contains field @type with type URL." } } } @@ -429,7 +467,7 @@ }, "nextPageToken": { "type": "string", - "description": "[Optional] This token is included in the response if there are more results to fetch. To fetch additional results, provide this value as the `page_token` in a subsequent ListClustersRequest." + "description": "[Output-only] This token is included in the response if there are more results to fetch. To fetch additional results, provide this value as the `page_token` in a subsequent ListClustersRequest." } } }, @@ -497,6 +535,13 @@ "$ref": "JobStatus" } }, + "yarnApplications": { + "type": "array", + "description": "[Output-only] The collection of YARN applications spun up by this job. **Beta** Feature: This report is available for testing purposes only. It may be changed before final release.", + "items": { + "$ref": "YarnApplication" + } + }, "driverOutputResourceUri": { "type": "string", "description": "[Output-only] A URI pointing to the location of the stdout of the job's driver program." @@ -504,6 +549,13 @@ "driverControlFilesUri": { "type": "string", "description": "[Output-only] If present, the location of miscellaneous control files which may be used as part of job setup and handling. If not present, control files may be placed in the same location as `driver_output_uri`." + }, + "labels": { + "type": "object", + "description": "[Optional] The labels to associate with this job. Label **keys** must contain 1 to 63 characters, and must conform to [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt). Label **values** may be empty, but, if present, must contain 1 to 63 characters, and must conform to [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be associated with a job.", + "additionalProperties": { + "type": "string" + } } } }, @@ -518,7 +570,7 @@ }, "jobId": { "type": "string", - "description": "[Required] The job ID, which must be unique within the project. The job ID is generated by the server upon job submission or provided by the user as a means to perform retries without creating duplicate jobs. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), or hyphens (-). The maximum length is 512 characters." + "description": "[Optional] The job ID, which must be unique within the project. The job ID is generated by the server upon job submission or provided by the user as a means to perform retries without creating duplicate jobs. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), or hyphens (-). The maximum length is 512 characters." } } }, @@ -540,7 +592,7 @@ "HadoopJob": { "id": "HadoopJob", "type": "object", - "description": "A Cloud Dataproc job for running Hadoop MapReduce jobs on YARN.", + "description": "A Cloud Dataproc job for running [Apache Hadoop MapReduce](https://hadoop.apache.org/docs/current/hadoop-mapreduce-client/hadoop-mapreduce-client-core/MapReduceTutorial.html) jobs on [Apache Hadoop YARN](https://hadoop.apache.org/docs/r2.7.1/hadoop-yarn/hadoop-yarn-site/YARN.html).", "properties": { "mainJarFileUri": { "type": "string", @@ -619,7 +671,7 @@ "SparkJob": { "id": "SparkJob", "type": "object", - "description": "A Cloud Dataproc job for running Spark applications on YARN.", + "description": "A Cloud Dataproc job for running [Apache Spark](http://spark.apache.org/) applications on YARN.", "properties": { "mainJarFileUri": { "type": "string", @@ -673,7 +725,7 @@ "PySparkJob": { "id": "PySparkJob", "type": "object", - "description": "A Cloud Dataproc job for running PySpark applications on YARN.", + "description": "A Cloud Dataproc job for running [Apache PySpark](https://spark.apache.org/docs/0.9.0/python-programming-guide.html) applications on YARN.", "properties": { "mainPythonFileUri": { "type": "string", @@ -730,7 +782,7 @@ "HiveJob": { "id": "HiveJob", "type": "object", - "description": "A Cloud Dataproc job for running Hive queries on YARN.", + "description": "A Cloud Dataproc job for running [Apache Hive](https://hive.apache.org/) queries on YARN.", "properties": { "queryFileUri": { "type": "string", @@ -784,7 +836,7 @@ "PigJob": { "id": "PigJob", "type": "object", - "description": "A Cloud Dataproc job for running Pig queries on YARN.", + "description": "A Cloud Dataproc job for running [Apache Pig](https://pig.apache.org/) queries on YARN.", "properties": { "queryFileUri": { "type": "string", @@ -828,7 +880,7 @@ "SparkSqlJob": { "id": "SparkSqlJob", "type": "object", - "description": "A Cloud Dataproc job for running Spark SQL queries.", + "description": "A Cloud Dataproc job for running [Apache Spark SQL](http://spark.apache.org/sql/) queries.", "properties": { "queryFileUri": { "type": "string", @@ -872,7 +924,7 @@ "properties": { "state": { "type": "string", - "description": "[Required] A state message specifying the overall job state.", + "description": "[Output-only] A state message specifying the overall job state.", "enum": [ "STATE_UNSPECIFIED", "PENDING", @@ -887,7 +939,7 @@ }, "details": { "type": "string", - "description": "[Optional] Job state details, such as an error description if the state is ERROR." + "description": "[Output-only] Optional job state details, such as an error description if the state is ERROR." }, "stateStartTime": { "type": "string", @@ -895,6 +947,41 @@ } } }, + "YarnApplication": { + "id": "YarnApplication", + "type": "object", + "description": "A YARN application created by a job. Application information is a subset of org.apache.hadoop.yarn.proto.YarnProtos.ApplicationReportProto. **Beta Feature**: This report is available for testing purposes only. It may be changed before final release.", + "properties": { + "name": { + "type": "string", + "description": "[Required] The application name." + }, + "state": { + "type": "string", + "description": "[Required] The application state.", + "enum": [ + "STATE_UNSPECIFIED", + "NEW", + "NEW_SAVING", + "SUBMITTED", + "ACCEPTED", + "RUNNING", + "FINISHED", + "FAILED", + "KILLED" + ] + }, + "progress": { + "type": "number", + "description": "[Required] The numerical progress of the application, from 1 to 100.", + "format": "float" + }, + "trackingUrl": { + "type": "string", + "description": "[Optional] The HTTP URL of the ApplicationMaster, HistoryServer, or TimelineServer that provides application-specific information. The URL uses the internal hostname, and requires a proxy server for resolution and, possibly, access." + } + } + }, "ListJobsResponse": { "id": "ListJobsResponse", "type": "object", @@ -948,7 +1035,7 @@ "properties": { "outputUri": { "type": "string", - "description": "[Output-only] The Google Cloud Storage URI of the diagnostic output. This is a plain text file with a summary of collected diagnostics." + "description": "[Output-only] The Google Cloud Storage URI of the diagnostic output. The output report is a plain text file with a summary of collected diagnostics." } } }, @@ -959,11 +1046,11 @@ "properties": { "clusterName": { "type": "string", - "description": "Name of the cluster for the operation." + "description": "[Output-only] Name of the cluster for the operation." }, "clusterUuid": { "type": "string", - "description": "Cluster UUId for the operation." + "description": "[Output-only] Cluster UUID for the operation." }, "status": { "$ref": "ClusterOperationStatus", @@ -983,6 +1070,13 @@ "description": { "type": "string", "description": "[Output-only] Short description of operation." + }, + "labels": { + "type": "object", + "description": "[Output-only] labels associated with the operation", + "additionalProperties": { + "type": "string" + } } } }, @@ -993,7 +1087,7 @@ "properties": { "state": { "type": "string", - "description": "A message containing the operation state.", + "description": "[Output-only] A message containing the operation state.", "enum": [ "UNKNOWN", "PENDING", @@ -1003,15 +1097,15 @@ }, "innerState": { "type": "string", - "description": "A message containing the detailed operation state." + "description": "[Output-only] A message containing the detailed operation state." }, "details": { "type": "string", - "description": "A message containing any operation metadata details." + "description": "[Output-only]A message containing any operation metadata details." }, "stateStartTime": { "type": "string", - "description": "The time this state was entered." + "description": "[Output-only] The time this state was entered." } } }, @@ -1297,15 +1391,20 @@ "required": true, "location": "path" }, + "filter": { + "type": "string", + "description": "[Optional] A filter constraining the clusters to list. Filters are case-sensitive and have the following syntax: field:value [field:value] ... or field = value [AND [field = value]] ... where **field** is one of `status.state`, `clusterName`, or `labels.[KEY]`, and `[KEY]` is a label key. **value** can be `*` to match all values. `status.state` can be one of the following: `ACTIVE`, `INACTIVE`, `CREATING`, `RUNNING`, `ERROR`, `DELETING`, or `UPDATING`. `ACTIVE` contains the `CREATING`, `UPDATING`, and `RUNNING` states. `INACTIVE` contains the `DELETING` and `ERROR` states. `clusterName` is the name of the cluster provided at creation time. Only the logical `AND` operator is supported; space-separated items are treated as having an implicit `AND` operator. Example valid filters are: status.state:ACTIVE clusterName:mycluster labels.env:staging \\ labels.starred:* and status.state = ACTIVE AND clusterName = mycluster \\ AND labels.env = staging AND labels.starred = *", + "location": "query" + }, "pageSize": { "type": "integer", - "description": "The standard List page size.", + "description": "[Optional] The standard List page size.", "format": "int32", "location": "query" }, "pageToken": { "type": "string", - "description": "The standard List page token.", + "description": "[Optional] The standard List page token.", "location": "query" } }, @@ -1470,13 +1569,18 @@ }, "jobStateMatcher": { "type": "string", - "description": "[Optional] Specifies enumerated categories of jobs to list.", + "description": "[Optional] Specifies enumerated categories of jobs to list (default = match ALL jobs).", "enum": [ "ALL", "ACTIVE", "NON_ACTIVE" ], "location": "query" + }, + "filter": { + "type": "string", + "description": "[Optional] A filter constraining the jobs to list. Filters are case-sensitive and have the following syntax: field:value] ... or [field = value] AND [field [= value]] ... where **field** is `status.state` or `labels.[KEY]`, and `[KEY]` is a label key. **value** can be `*` to match all values. `status.state` can be either `ACTIVE` or `INACTIVE`. Only the logical `AND` operator is supported; space-separated items are treated as having an implicit `AND` operator. Example valid filters are: status.state:ACTIVE labels.env:staging labels.starred:* and status.state = ACTIVE AND labels.env = staging AND labels.starred = *", + "location": "query" } }, "parameterOrder": [ @@ -1571,30 +1675,6 @@ }, "operations": { "methods": { - "get": { - "id": "dataproc.projects.regions.operations.get", - "path": "v1/{+name}", - "httpMethod": "GET", - "description": "Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.", - "parameters": { - "name": { - "type": "string", - "description": "The name of the operation resource.", - "required": true, - "pattern": "^projects/[^/]*/regions/[^/]*/operations/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "name" - ], - "response": { - "$ref": "Operation" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform" - ] - }, "list": { "id": "dataproc.projects.regions.operations.list", "path": "v1/{+name}", @@ -1605,7 +1685,7 @@ "type": "string", "description": "The name of the operation collection.", "required": true, - "pattern": "^projects/[^/]*/regions/[^/]*/operations$", + "pattern": "^projects/[^/]+/regions/[^/]+/operations$", "location": "path" }, "filter": { @@ -1635,17 +1715,17 @@ "https://www.googleapis.com/auth/cloud-platform" ] }, - "cancel": { - "id": "dataproc.projects.regions.operations.cancel", - "path": "v1/{+name}:cancel", - "httpMethod": "POST", - "description": "Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation.", + "get": { + "id": "dataproc.projects.regions.operations.get", + "path": "v1/{+name}", + "httpMethod": "GET", + "description": "Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.", "parameters": { "name": { "type": "string", - "description": "The name of the operation resource to be cancelled.", + "description": "The name of the operation resource.", "required": true, - "pattern": "^projects/[^/]*/regions/[^/]*/operations/[^/]*$", + "pattern": "^projects/[^/]+/regions/[^/]+/operations/[^/]+$", "location": "path" } }, @@ -1653,7 +1733,7 @@ "name" ], "response": { - "$ref": "Empty" + "$ref": "Operation" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform" @@ -1669,7 +1749,31 @@ "type": "string", "description": "The name of the operation resource to be deleted.", "required": true, - "pattern": "^projects/[^/]*/regions/[^/]*/operations/[^/]*$", + "pattern": "^projects/[^/]+/regions/[^/]+/operations/[^/]+$", + "location": "path" + } + }, + "parameterOrder": [ + "name" + ], + "response": { + "$ref": "Empty" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "cancel": { + "id": "dataproc.projects.regions.operations.cancel", + "path": "v1/{+name}:cancel", + "httpMethod": "POST", + "description": "Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to `Code.CANCELLED`.", + "parameters": { + "name": { + "type": "string", + "description": "The name of the operation resource to be cancelled.", + "required": true, + "pattern": "^projects/[^/]+/regions/[^/]+/operations/[^/]+$", "location": "path" } }, diff --git a/etc/api/dataproc/v1alpha1/dataproc-api.json b/etc/api/dataproc/v1alpha1/dataproc-api.json index db174e8f75..43865b59fc 100644 --- a/etc/api/dataproc/v1alpha1/dataproc-api.json +++ b/etc/api/dataproc/v1alpha1/dataproc-api.json @@ -1,13 +1,13 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/SuGBALYSLzjdcbguynWOEdgixyw\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/r7FI1XKe3nwqujSEPgINO6f6aJQ\"", "discoveryVersion": "v1", "id": "dataproc:v1alpha1", "name": "dataproc", "version": "v1alpha1", - "revision": "20160503", + "revision": "20161102", "title": "Google Cloud Dataproc API", - "description": "Manages Hadoop-based clusters and jobs on Google Cloud Platform.", + "description": "An API for managing Hadoop-based clusters and jobs on Google Cloud Platform.", "ownerDomain": "google.com", "ownerName": "Google", "icons": { @@ -127,6 +127,13 @@ "$ref": "ClusterConfiguration", "description": "[Required] The cluster configuration. It may differ from a user's initial configuration due to Cloud Dataproc setting of default values and updating clusters." }, + "labels": { + "type": "object", + "description": "[Optional] The labels to associate with this cluster. Label keys must be between 1 and 63 characters long, and must conform to the following PCRE regular expression: \\p{Ll}\\p{Lo}{0,62} Label values must be between 1 and 63 characters long, and must conform to the following PCRE regular expression: [\\p{Ll}\\p{Lo}\\p{N}_-]{0,63} No more than 64 labels can be associated with a given cluster.", + "additionalProperties": { + "type": "string" + } + }, "status": { "$ref": "ClusterStatus", "description": "[Output-only] Cluster status." @@ -145,6 +152,10 @@ "clusterUuid": { "type": "string", "description": "[Output-only] A cluster UUID (Unique Universal Identifier). Cloud Dataproc generates this value when it creates the cluster." + }, + "metrics": { + "$ref": "ClusterMetrics", + "description": "Contains cluster daemon metrics such as HDFS and YARN stats." } } }, @@ -278,6 +289,10 @@ "type": "string", "description": "The Google Compute Engine subnetwork to be used for machine communications. Cannot be specified with network_uri. Example: `compute.googleapis.com/projects/[project_id]/regions/us-east1/sub0`." }, + "internalIpOnly": { + "type": "boolean", + "description": "If true, all instances in the cluser will only have internal IP addresses. By default, clusters are not restricted to internal IP addresses, and will have ephemeral external IP addresses assigned to each instance. This restriction can only be enabled for subnetwork enabled networks, and all off-cluster dependencies must be configured to be accessible without external IP addresses." + }, "serviceAccountScopes": { "type": "array", "description": "The service account scopes included in Google Compute Engine instances. Must include devstorage.full_control to enable the Google Cloud Storage connector. Example \"auth.googleapis.com/compute\" and \"auth.googleapis.com/devstorage.full_control\".", @@ -415,6 +430,29 @@ } } }, + "ClusterMetrics": { + "id": "ClusterMetrics", + "type": "object", + "description": "Contains cluster daemon metrics, such as HDFS and YARN stats.", + "properties": { + "hdfsMetrics": { + "type": "object", + "description": "The HDFS metrics.", + "additionalProperties": { + "type": "string", + "format": "int64" + } + }, + "yarnMetrics": { + "type": "object", + "description": "The YARN metrics.", + "additionalProperties": { + "type": "string", + "format": "int64" + } + } + } + }, "Operation": { "id": "Operation", "type": "object", @@ -429,7 +467,7 @@ "description": "Service-specific metadata associated with the operation.", "additionalProperties": { "type": "any", - "description": "Properties of the object. Contains field @ype with type URL." + "description": "Properties of the object. Contains field @type with type URL." } }, "done": { @@ -445,7 +483,7 @@ "description": "The operation response. If the called method returns no data on success, the response is `google.protobuf.Empty`. If the called method is `Get`,`Create` or `Update`, the response is the resource. For all other methods, the response type is a concatenation of the method name and \"Response\". For example, if the called method is `TakeSnapshot()`, the response type is `TakeSnapshotResponse`.", "additionalProperties": { "type": "any", - "description": "Properties of the object. Contains field @ype with type URL." + "description": "Properties of the object. Contains field @type with type URL." } } } @@ -471,7 +509,7 @@ "type": "object", "additionalProperties": { "type": "any", - "description": "Properties of the object. Contains field @ype with type URL." + "description": "Properties of the object. Contains field @type with type URL." } } } @@ -584,6 +622,13 @@ "interactive": { "type": "boolean", "description": "[Optional] If set to true, then the driver's stdin will be kept open and driver_input_uri will be set to provide a path at which additional input can be sent to the driver." + }, + "labels": { + "type": "object", + "description": "[Optional] The labels to associate with this job. Label keys must be between 1 and 63 characters long, and must conform to the following regular expression: \\p{Ll}\\p{Lo}{0,62} Label values must be between 1 and 63 characters long, and must conform to the following regular expression: [\\p{Ll}\\p{Lo}\\p{N}_-]{0,63} No more than 64 labels can be associated with a given job.", + "additionalProperties": { + "type": "string" + } } } }, @@ -1066,6 +1111,10 @@ "ACTIVE", "NON_ACTIVE" ] + }, + "filter": { + "type": "string", + "description": "[Optional] A filter constraining which jobs to list. Valid filters contain job state and label terms such as: labels.key1 = val1 AND (labels.k2 = val2 OR labels.k3 = val3)" } } }, @@ -1109,7 +1158,7 @@ "properties": { "outputUri": { "type": "string", - "description": "[Output-only] The Google Cloud Storage URI of the diagnostic output. This is a plain text file with a summary of collected diagnostics." + "description": "[Output-only] The Google Cloud Storage URI of the diagnostic output. The output report is a plain text file with a summary of collected diagnostics." } } }, @@ -1120,11 +1169,11 @@ "properties": { "clusterName": { "type": "string", - "description": "Name of the cluster for the operation." + "description": "[Output-only] Name of the cluster for the operation." }, "clusterUuid": { "type": "string", - "description": "Cluster UUId for the operation." + "description": "[Output-only] Cluster UUID for the operation." }, "status": { "$ref": "ClusterOperationStatus", @@ -1144,6 +1193,13 @@ "description": { "type": "string", "description": "[Output-only] Short description of operation." + }, + "labels": { + "type": "object", + "description": "[Output-only] labels associated with the operation", + "additionalProperties": { + "type": "string" + } } } }, @@ -1154,7 +1210,7 @@ "properties": { "state": { "type": "string", - "description": "A message containing the operation state.", + "description": "[Output-only] A message containing the operation state.", "enum": [ "UNKNOWN", "PENDING", @@ -1164,15 +1220,15 @@ }, "innerState": { "type": "string", - "description": "A message containing the detailed operation state." + "description": "[Output-only] A message containing the detailed operation state." }, "details": { "type": "string", - "description": "A message containing any operation metadata details." + "description": "[Output-only]A message containing any operation metadata details." }, "stateStartTime": { "type": "string", - "description": "The time this state was entered." + "description": "[Output-only] The time this state was entered." } } }, @@ -1458,6 +1514,11 @@ "required": true, "location": "path" }, + "filter": { + "type": "string", + "description": "[Optional] A filter constraining which clusters to list. Valid filters contain label terms such as: labels.key1 = val1 AND (-labels.k2 = val2 OR labels.k3 = val3)", + "location": "query" + }, "pageSize": { "type": "integer", "description": "The standard List page size.", @@ -1650,7 +1711,7 @@ "type": "string", "description": "The operation resource name.", "required": true, - "pattern": "^operations/.*$", + "pattern": "^operations/.+$", "location": "path" } }, @@ -1714,7 +1775,7 @@ "type": "string", "description": "The name of the operation resource to be cancelled.", "required": true, - "pattern": "^operations/.*$", + "pattern": "^operations/.+$", "location": "path" } }, @@ -1741,7 +1802,7 @@ "type": "string", "description": "The name of the operation resource to be deleted.", "required": true, - "pattern": "^operations/.*$", + "pattern": "^operations/.+$", "location": "path" } }, diff --git a/etc/api/dataproc/v1beta1/dataproc-api.json b/etc/api/dataproc/v1beta1/dataproc-api.json index baca3db1f3..907b0ee9d6 100644 --- a/etc/api/dataproc/v1beta1/dataproc-api.json +++ b/etc/api/dataproc/v1beta1/dataproc-api.json @@ -1,13 +1,13 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/xUykUeDoZBMkhqViXbAjUkEVLQw\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/cZQ-6vqHhMM0YELMHYWsiSzNXAM\"", "discoveryVersion": "v1", "id": "dataproc:v1beta1", "name": "dataproc", "version": "v1beta1", - "revision": "20160503", + "revision": "20161102", "title": "Google Cloud Dataproc API", - "description": "Manages Hadoop-based clusters and jobs on Google Cloud Platform.", + "description": "An API for managing Hadoop-based clusters and jobs on Google Cloud Platform.", "ownerDomain": "google.com", "ownerName": "Google", "icons": { @@ -127,6 +127,13 @@ "$ref": "ClusterConfiguration", "description": "[Required] The cluster configuration. Note that Cloud Dataproc may set default values, and values may change when clusters are updated." }, + "labels": { + "type": "object", + "description": "[Optional] The labels to associate with this cluster. Label keys must be between 1 and 63 characters long, and must conform to the following PCRE regular expression: \\p{Ll}\\p{Lo}{0,62} Label values must be between 1 and 63 characters long, and must conform to the following PCRE regular expression: [\\p{Ll}\\p{Lo}\\p{N}_-]{0,63} No more than 64 labels can be associated with a given cluster.", + "additionalProperties": { + "type": "string" + } + }, "status": { "$ref": "ClusterStatus", "description": "[Output-only] Cluster status." @@ -141,6 +148,10 @@ "clusterUuid": { "type": "string", "description": "[Output-only] A cluster UUID (Unique Universal Identifier). Cloud Dataproc generates this value when it creates the cluster." + }, + "metrics": { + "$ref": "ClusterMetrics", + "description": "Contains cluster daemon metrics such as HDFS and YARN stats." } } }, @@ -199,6 +210,10 @@ "type": "string", "description": "The Google Compute Engine subnetwork to be used for machine communications. Cannot be specified with network_uri. Example: `https://www.googleapis.com/compute/v1/projects/[project_id]/regions/us-east1/sub0`." }, + "internalIpOnly": { + "type": "boolean", + "description": "If true, all instances in the cluser will only have internal IP addresses. By default, clusters are not restricted to internal IP addresses, and will have ephemeral external IP addresses assigned to each instance. This restriction can only be enabled for subnetwork enabled networks, and all off-cluster dependencies must be configured to be accessible without external IP addresses." + }, "serviceAccountScopes": { "type": "array", "description": "The URIs of service account scopes to be included in Google Compute Engine instances. The following base set of scopes is always included: - https://www.googleapis.com/auth/cloud.useraccounts.readonly - https://www.googleapis.com/auth/devstorage.read_write - https://www.googleapis.com/auth/logging.write If no scopes are specfied, the following defaults are also provided: - https://www.googleapis.com/auth/bigquery - https://www.googleapis.com/auth/bigtable.admin.table - https://www.googleapis.com/auth/bigtable.data - https://www.googleapis.com/auth/devstorage.full_control", @@ -353,6 +368,29 @@ } } }, + "ClusterMetrics": { + "id": "ClusterMetrics", + "type": "object", + "description": "Contains cluster daemon metrics, such as HDFS and YARN stats.", + "properties": { + "hdfsMetrics": { + "type": "object", + "description": "The HDFS metrics.", + "additionalProperties": { + "type": "string", + "format": "int64" + } + }, + "yarnMetrics": { + "type": "object", + "description": "The YARN metrics.", + "additionalProperties": { + "type": "string", + "format": "int64" + } + } + } + }, "Operation": { "id": "Operation", "type": "object", @@ -367,7 +405,7 @@ "description": "Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.", "additionalProperties": { "type": "any", - "description": "Properties of the object. Contains field @ype with type URL." + "description": "Properties of the object. Contains field @type with type URL." } }, "done": { @@ -376,14 +414,14 @@ }, "error": { "$ref": "Status", - "description": "The error result of the operation in case of failure." + "description": "The error result of the operation in case of failure or cancellation." }, "response": { "type": "object", "description": "The normal response of the operation in case of success. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.", "additionalProperties": { "type": "any", - "description": "Properties of the object. Contains field @ype with type URL." + "description": "Properties of the object. Contains field @type with type URL." } } } @@ -409,7 +447,7 @@ "type": "object", "additionalProperties": { "type": "any", - "description": "Properties of the object. Contains field @ype with type URL." + "description": "Properties of the object. Contains field @type with type URL." } } } @@ -523,6 +561,13 @@ "interactive": { "type": "boolean", "description": "[Optional] If set to `true`, the driver's stdin will be kept open and `driver_input_uri` will be set to provide a path at which additional input can be sent to the driver." + }, + "labels": { + "type": "object", + "description": "[Optional] The labels to associate with this job. Label keys must be between 1 and 63 characters long, and must conform to the following regular expression: \\p{Ll}\\p{Lo}{0,62} Label values must be between 1 and 63 characters long, and must conform to the following regular expression: [\\p{Ll}\\p{Lo}\\p{N}_-]{0,63} No more than 64 labels can be associated with a given job.", + "additionalProperties": { + "type": "string" + } } } }, @@ -1007,7 +1052,7 @@ "properties": { "outputUri": { "type": "string", - "description": "[Output-only] The Google Cloud Storage URI of the diagnostic output. This is a plain text file with a summary of collected diagnostics." + "description": "[Output-only] The Google Cloud Storage URI of the diagnostic output. The output report is a plain text file with a summary of collected diagnostics." } } }, @@ -1018,11 +1063,11 @@ "properties": { "clusterName": { "type": "string", - "description": "Name of the cluster for the operation." + "description": "[Output-only] Name of the cluster for the operation." }, "clusterUuid": { "type": "string", - "description": "Cluster UUId for the operation." + "description": "[Output-only] Cluster UUID for the operation." }, "status": { "$ref": "ClusterOperationStatus", @@ -1042,6 +1087,13 @@ "description": { "type": "string", "description": "[Output-only] Short description of operation." + }, + "labels": { + "type": "object", + "description": "[Output-only] labels associated with the operation", + "additionalProperties": { + "type": "string" + } } } }, @@ -1052,7 +1104,7 @@ "properties": { "state": { "type": "string", - "description": "A message containing the operation state.", + "description": "[Output-only] A message containing the operation state.", "enum": [ "UNKNOWN", "PENDING", @@ -1062,15 +1114,15 @@ }, "innerState": { "type": "string", - "description": "A message containing the detailed operation state." + "description": "[Output-only] A message containing the detailed operation state." }, "details": { "type": "string", - "description": "A message containing any operation metadata details." + "description": "[Output-only]A message containing any operation metadata details." }, "stateStartTime": { "type": "string", - "description": "The time this state was entered." + "description": "[Output-only] The time this state was entered." } } }, @@ -1320,6 +1372,11 @@ "required": true, "location": "path" }, + "filter": { + "type": "string", + "description": "[Optional] A filter constraining which clusters to list. Valid filters contain label terms such as: labels.key1 = val1 AND (-labels.k2 = val2 OR labels.k3 = val3)", + "location": "query" + }, "pageSize": { "type": "integer", "description": "The standard List page size.", @@ -1472,6 +1529,11 @@ "NON_ACTIVE" ], "location": "query" + }, + "filter": { + "type": "string", + "description": "[Optional] A filter constraining which jobs to list. Valid filters contain job state and label terms such as: labels.key1 = val1 AND (labels.k2 = val2 OR labels.k3 = val3)", + "location": "query" } }, "parameterOrder": [ @@ -1563,7 +1625,7 @@ "type": "string", "description": "The name of the operation resource.", "required": true, - "pattern": "^operations/.*$", + "pattern": "^operations/.+$", "location": "path" } }, @@ -1627,7 +1689,7 @@ "type": "string", "description": "The name of the operation resource to be cancelled.", "required": true, - "pattern": "^operations/.*$", + "pattern": "^operations/.+$", "location": "path" } }, @@ -1654,7 +1716,7 @@ "type": "string", "description": "The name of the operation resource to be deleted.", "required": true, - "pattern": "^operations/.*$", + "pattern": "^operations/.+$", "location": "path" } }, diff --git a/etc/api/datastore/v1/datastore-api.json b/etc/api/datastore/v1/datastore-api.json index e69de29bb2..8226cc43cc 100644 --- a/etc/api/datastore/v1/datastore-api.json +++ b/etc/api/datastore/v1/datastore-api.json @@ -0,0 +1,1075 @@ +{ + "id": "datastore:v1", + "auth": { + "oauth2": { + "scopes": { + "https://www.googleapis.com/auth/cloud-platform": { + "description": "View and manage your data across Google Cloud Platform services" + }, + "https://www.googleapis.com/auth/datastore": { + "description": "View and manage your Google Cloud Datastore data" + } + } + } + }, + "description": "Accesses the schemaless NoSQL database to provide fully managed, robust, scalable storage for your application.\n", + "protocol": "rest", + "title": "Google Cloud Datastore API", + "resources": { + "projects": { + "methods": { + "runQuery": { + "id": "datastore.projects.runQuery", + "response": { + "$ref": "RunQueryResponse" + }, + "parameterOrder": [ + "projectId" + ], + "description": "Queries for entities.", + "request": { + "$ref": "RunQueryRequest" + }, + "flatPath": "v1/projects/{projectId}:runQuery", + "httpMethod": "POST", + "parameters": { + "projectId": { + "description": "The ID of the project against which to make the request.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1/projects/{projectId}:runQuery", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/datastore" + ] + }, + "beginTransaction": { + "id": "datastore.projects.beginTransaction", + "response": { + "$ref": "BeginTransactionResponse" + }, + "parameterOrder": [ + "projectId" + ], + "description": "Begins a new transaction.", + "request": { + "$ref": "BeginTransactionRequest" + }, + "flatPath": "v1/projects/{projectId}:beginTransaction", + "httpMethod": "POST", + "parameters": { + "projectId": { + "description": "The ID of the project against which to make the request.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1/projects/{projectId}:beginTransaction", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/datastore" + ] + }, + "allocateIds": { + "id": "datastore.projects.allocateIds", + "response": { + "$ref": "AllocateIdsResponse" + }, + "parameterOrder": [ + "projectId" + ], + "description": "Allocates IDs for the given keys, which is useful for referencing an entity\nbefore it is inserted.", + "request": { + "$ref": "AllocateIdsRequest" + }, + "flatPath": "v1/projects/{projectId}:allocateIds", + "httpMethod": "POST", + "parameters": { + "projectId": { + "description": "The ID of the project against which to make the request.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1/projects/{projectId}:allocateIds", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/datastore" + ] + }, + "lookup": { + "id": "datastore.projects.lookup", + "response": { + "$ref": "LookupResponse" + }, + "parameterOrder": [ + "projectId" + ], + "description": "Looks up entities by key.", + "request": { + "$ref": "LookupRequest" + }, + "flatPath": "v1/projects/{projectId}:lookup", + "httpMethod": "POST", + "parameters": { + "projectId": { + "description": "The ID of the project against which to make the request.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1/projects/{projectId}:lookup", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/datastore" + ] + }, + "commit": { + "id": "datastore.projects.commit", + "response": { + "$ref": "CommitResponse" + }, + "parameterOrder": [ + "projectId" + ], + "description": "Commits a transaction, optionally creating, deleting or modifying some\nentities.", + "request": { + "$ref": "CommitRequest" + }, + "flatPath": "v1/projects/{projectId}:commit", + "httpMethod": "POST", + "parameters": { + "projectId": { + "description": "The ID of the project against which to make the request.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1/projects/{projectId}:commit", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/datastore" + ] + }, + "rollback": { + "id": "datastore.projects.rollback", + "response": { + "$ref": "RollbackResponse" + }, + "parameterOrder": [ + "projectId" + ], + "description": "Rolls back a transaction.", + "request": { + "$ref": "RollbackRequest" + }, + "flatPath": "v1/projects/{projectId}:rollback", + "httpMethod": "POST", + "parameters": { + "projectId": { + "description": "The ID of the project against which to make the request.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1/projects/{projectId}:rollback", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/datastore" + ] + } + } + } + }, + "schemas": { + "Value": { + "description": "A message that can hold any of the supported value types and associated\nmetadata.", + "type": "object", + "properties": { + "stringValue": { + "description": "A UTF-8 encoded string value.\nWhen `exclude_from_indexes` is false (it is indexed) , may have at most 1500 bytes.\nOtherwise, may be set to at least 1,000,000 bytes.", + "type": "string" + }, + "arrayValue": { + "description": "An array value.\nCannot contain another array value.\nA `Value` instance that sets field `array_value` must not set fields\n`meaning` or `exclude_from_indexes`.", + "$ref": "ArrayValue" + }, + "entityValue": { + "description": "An entity value.\n\n- May have no key.\n- May have a key with an incomplete key path.\n- May have a reserved/read-only key.", + "$ref": "Entity" + }, + "meaning": { + "description": "The `meaning` field should only be populated for backwards compatibility.", + "type": "integer", + "format": "int32" + }, + "integerValue": { + "description": "An integer value.", + "type": "string", + "format": "int64" + }, + "doubleValue": { + "description": "A double value.", + "type": "number", + "format": "double" + }, + "blobValue": { + "description": "A blob value.\nMay have at most 1,000,000 bytes.\nWhen `exclude_from_indexes` is false, may have at most 1500 bytes.\nIn JSON requests, must be base64-encoded.", + "type": "string", + "format": "byte" + }, + "geoPointValue": { + "description": "A geo point value representing a point on the surface of Earth.", + "$ref": "LatLng" + }, + "nullValue": { + "description": "A null value.", + "enum": [ + "NULL_VALUE" + ], + "enumDescriptions": [ + "Null value." + ], + "type": "string" + }, + "booleanValue": { + "description": "A boolean value.", + "type": "boolean" + }, + "keyValue": { + "description": "A key value.", + "$ref": "Key" + }, + "excludeFromIndexes": { + "description": "If the value should be excluded from all indexes including those defined\nexplicitly.", + "type": "boolean" + }, + "timestampValue": { + "description": "A timestamp value.\nWhen stored in the Datastore, precise only to microseconds;\nany additional precision is rounded down.", + "type": "string", + "format": "google-datetime" + } + }, + "id": "Value" + }, + "ReadOptions": { + "description": "The options shared by read requests.", + "type": "object", + "properties": { + "transaction": { + "description": "The identifier of the transaction in which to read. A\ntransaction identifier is returned by a call to\nDatastore.BeginTransaction.", + "type": "string", + "format": "byte" + }, + "readConsistency": { + "description": "The non-transactional read consistency to use.\nCannot be set to `STRONG` for global queries.", + "enum": [ + "READ_CONSISTENCY_UNSPECIFIED", + "STRONG", + "EVENTUAL" + ], + "enumDescriptions": [ + "Unspecified. This value must not be used.", + "Strong consistency.", + "Eventual consistency." + ], + "type": "string" + } + }, + "id": "ReadOptions" + }, + "PropertyOrder": { + "description": "The desired order for a specific property.", + "type": "object", + "properties": { + "direction": { + "description": "The direction to order by. Defaults to `ASCENDING`.", + "enum": [ + "DIRECTION_UNSPECIFIED", + "ASCENDING", + "DESCENDING" + ], + "enumDescriptions": [ + "Unspecified. This value must not be used.", + "Ascending.", + "Descending." + ], + "type": "string" + }, + "property": { + "description": "The property to order by.", + "$ref": "PropertyReference" + } + }, + "id": "PropertyOrder" + }, + "CommitRequest": { + "description": "The request for Datastore.Commit.", + "type": "object", + "properties": { + "transaction": { + "description": "The identifier of the transaction associated with the commit. A\ntransaction identifier is returned by a call to\nDatastore.BeginTransaction.", + "type": "string", + "format": "byte" + }, + "mode": { + "description": "The type of commit to perform. Defaults to `TRANSACTIONAL`.", + "enum": [ + "MODE_UNSPECIFIED", + "TRANSACTIONAL", + "NON_TRANSACTIONAL" + ], + "enumDescriptions": [ + "Unspecified. This value must not be used.", + "Transactional: The mutations are either all applied, or none are applied.\nLearn about transactions [here](https://cloud.google.com/datastore/docs/concepts/transactions).", + "Non-transactional: The mutations may not apply as all or none." + ], + "type": "string" + }, + "mutations": { + "description": "The mutations to perform.\n\nWhen mode is `TRANSACTIONAL`, mutations affecting a single entity are\napplied in order. The following sequences of mutations affecting a single\nentity are not permitted in a single `Commit` request:\n\n- `insert` followed by `insert`\n- `update` followed by `insert`\n- `upsert` followed by `insert`\n- `delete` followed by `update`\n\nWhen mode is `NON_TRANSACTIONAL`, no two mutations may affect a single\nentity.", + "type": "array", + "items": { + "$ref": "Mutation" + } + } + }, + "id": "CommitRequest" + }, + "Query": { + "description": "A query for entities.", + "type": "object", + "properties": { + "limit": { + "description": "The maximum number of results to return. Applies after all other\nconstraints. Optional.\nUnspecified is interpreted as no limit.\nMust be \u003e= 0 if specified.", + "type": "integer", + "format": "int32" + }, + "filter": { + "description": "The filter to apply.", + "$ref": "Filter" + }, + "endCursor": { + "description": "An ending point for the query results. Query cursors are\nreturned in query result batches and\n[can only be used to limit the same query](https://cloud.google.com/datastore/docs/concepts/queries#cursors_limits_and_offsets).", + "type": "string", + "format": "byte" + }, + "distinctOn": { + "description": "The properties to make distinct. The query results will contain the first\nresult for each distinct combination of values for the given properties\n(if empty, all results are returned).", + "type": "array", + "items": { + "$ref": "PropertyReference" + } + }, + "offset": { + "description": "The number of results to skip. Applies before limit, but after all other\nconstraints. Optional. Must be \u003e= 0 if specified.", + "type": "integer", + "format": "int32" + }, + "projection": { + "description": "The projection to return. Defaults to returning all properties.", + "type": "array", + "items": { + "$ref": "Projection" + } + }, + "order": { + "description": "The order to apply to the query results (if empty, order is unspecified).", + "type": "array", + "items": { + "$ref": "PropertyOrder" + } + }, + "startCursor": { + "description": "A starting point for the query results. Query cursors are\nreturned in query result batches and\n[can only be used to continue the same query](https://cloud.google.com/datastore/docs/concepts/queries#cursors_limits_and_offsets).", + "type": "string", + "format": "byte" + }, + "kind": { + "description": "The kinds to query (if empty, returns entities of all kinds).\nCurrently at most 1 kind may be specified.", + "type": "array", + "items": { + "$ref": "KindExpression" + } + } + }, + "id": "Query" + }, + "RollbackRequest": { + "description": "The request for Datastore.Rollback.", + "type": "object", + "properties": { + "transaction": { + "description": "The transaction identifier, returned by a call to\nDatastore.BeginTransaction.", + "type": "string", + "format": "byte" + } + }, + "id": "RollbackRequest" + }, + "EntityResult": { + "description": "The result of fetching an entity from Datastore.", + "type": "object", + "properties": { + "cursor": { + "description": "A cursor that points to the position after the result entity.\nSet only when the `EntityResult` is part of a `QueryResultBatch` message.", + "type": "string", + "format": "byte" + }, + "entity": { + "description": "The resulting entity.", + "$ref": "Entity" + }, + "version": { + "description": "The version of the entity, a strictly positive number that monotonically\nincreases with changes to the entity.\n\nThis field is set for `FULL` entity\nresults.\n\nFor missing entities in `LookupResponse`, this\nis the version of the snapshot that was used to look up the entity, and it\nis always set except for eventually consistent reads.", + "type": "string", + "format": "int64" + } + }, + "id": "EntityResult" + }, + "GqlQueryParameter": { + "description": "A binding parameter for a GQL query.", + "type": "object", + "properties": { + "value": { + "description": "A value parameter.", + "$ref": "Value" + }, + "cursor": { + "description": "A query cursor. Query cursors are returned in query\nresult batches.", + "type": "string", + "format": "byte" + } + }, + "id": "GqlQueryParameter" + }, + "ArrayValue": { + "description": "An array value.", + "type": "object", + "properties": { + "values": { + "description": "Values in the array.\nThe order of this array may not be preserved if it contains a mix of\nindexed and unindexed values.", + "type": "array", + "items": { + "$ref": "Value" + } + } + }, + "id": "ArrayValue" + }, + "Filter": { + "description": "A holder for any type of filter.", + "type": "object", + "properties": { + "propertyFilter": { + "description": "A filter on a property.", + "$ref": "PropertyFilter" + }, + "compositeFilter": { + "description": "A composite filter.", + "$ref": "CompositeFilter" + } + }, + "id": "Filter" + }, + "BeginTransactionResponse": { + "description": "The response for Datastore.BeginTransaction.", + "type": "object", + "properties": { + "transaction": { + "description": "The transaction identifier (always present).", + "type": "string", + "format": "byte" + } + }, + "id": "BeginTransactionResponse" + }, + "PartitionId": { + "description": "A partition ID identifies a grouping of entities. The grouping is always\nby project and namespace, however the namespace ID may be empty.\n\nA partition ID contains several dimensions:\nproject ID and namespace ID.\n\nPartition dimensions:\n\n- May be `\"\"`.\n- Must be valid UTF-8 bytes.\n- Must have values that match regex `[A-Za-z\\d\\.\\-_]{1,100}`\nIf the value of any dimension matches regex `__.*__`, the partition is\nreserved/read-only.\nA reserved/read-only partition ID is forbidden in certain documented\ncontexts.\n\nForeign partition IDs (in which the project ID does\nnot match the context project ID ) are discouraged.\nReads and writes of foreign partition IDs may fail if the project is not in an active state.", + "type": "object", + "properties": { + "namespaceId": { + "description": "If not empty, the ID of the namespace to which the entities belong.", + "type": "string" + }, + "projectId": { + "description": "The ID of the project to which the entities belong.", + "type": "string" + } + }, + "id": "PartitionId" + }, + "QueryResultBatch": { + "description": "A batch of results produced by a query.", + "type": "object", + "properties": { + "snapshotVersion": { + "description": "The version number of the snapshot this batch was returned from.\nThis applies to the range of results from the query's `start_cursor` (or\nthe beginning of the query if no cursor was given) to this batch's\n`end_cursor` (not the query's `end_cursor`).\n\nIn a single transaction, subsequent query result batches for the same query\ncan have a greater snapshot version number. Each batch's snapshot version\nis valid for all preceding batches.\nThe value will be zero for eventually consistent queries.", + "type": "string", + "format": "int64" + }, + "endCursor": { + "description": "A cursor that points to the position after the last result in the batch.", + "type": "string", + "format": "byte" + }, + "skippedCursor": { + "description": "A cursor that points to the position after the last skipped result.\nWill be set when `skipped_results` != 0.", + "type": "string", + "format": "byte" + }, + "entityResultType": { + "description": "The result type for every entity in `entity_results`.", + "enum": [ + "RESULT_TYPE_UNSPECIFIED", + "FULL", + "PROJECTION", + "KEY_ONLY" + ], + "enumDescriptions": [ + "Unspecified. This value is never used.", + "The key and properties.", + "A projected subset of properties. The entity may have no key.", + "Only the key." + ], + "type": "string" + }, + "moreResults": { + "description": "The state of the query after the current batch.", + "enum": [ + "MORE_RESULTS_TYPE_UNSPECIFIED", + "NOT_FINISHED", + "MORE_RESULTS_AFTER_LIMIT", + "MORE_RESULTS_AFTER_CURSOR", + "NO_MORE_RESULTS" + ], + "enumDescriptions": [ + "Unspecified. This value is never used.", + "There may be additional batches to fetch from this query.", + "The query is finished, but there may be more results after the limit.", + "The query is finished, but there may be more results after the end\ncursor.", + "The query has been exhausted." + ], + "type": "string" + }, + "entityResults": { + "description": "The results for this batch.", + "type": "array", + "items": { + "$ref": "EntityResult" + } + }, + "skippedResults": { + "description": "The number of results skipped, typically because of an offset.", + "type": "integer", + "format": "int32" + } + }, + "id": "QueryResultBatch" + }, + "AllocateIdsRequest": { + "description": "The request for Datastore.AllocateIds.", + "type": "object", + "properties": { + "keys": { + "description": "A list of keys with incomplete key paths for which to allocate IDs.\nNo key may be reserved/read-only.", + "type": "array", + "items": { + "$ref": "Key" + } + } + }, + "id": "AllocateIdsRequest" + }, + "KindExpression": { + "description": "A representation of a kind.", + "type": "object", + "properties": { + "name": { + "description": "The name of the kind.", + "type": "string" + } + }, + "id": "KindExpression" + }, + "PropertyFilter": { + "description": "A filter on a specific property.", + "type": "object", + "properties": { + "value": { + "description": "The value to compare the property to.", + "$ref": "Value" + }, + "op": { + "description": "The operator to filter by.", + "enum": [ + "OPERATOR_UNSPECIFIED", + "LESS_THAN", + "LESS_THAN_OR_EQUAL", + "GREATER_THAN", + "GREATER_THAN_OR_EQUAL", + "EQUAL", + "HAS_ANCESTOR" + ], + "enumDescriptions": [ + "Unspecified. This value must not be used.", + "Less than.", + "Less than or equal.", + "Greater than.", + "Greater than or equal.", + "Equal.", + "Has ancestor." + ], + "type": "string" + }, + "property": { + "description": "The property to filter by.", + "$ref": "PropertyReference" + } + }, + "id": "PropertyFilter" + }, + "PathElement": { + "description": "A (kind, ID/name) pair used to construct a key path.\n\nIf either name or ID is set, the element is complete.\nIf neither is set, the element is incomplete.", + "type": "object", + "properties": { + "kind": { + "description": "The kind of the entity.\nA kind matching regex `__.*__` is reserved/read-only.\nA kind must not contain more than 1500 bytes when UTF-8 encoded.\nCannot be `\"\"`.", + "type": "string" + }, + "id": { + "description": "The auto-allocated ID of the entity.\nNever equal to zero. Values less than zero are discouraged and may not\nbe supported in the future.", + "type": "string", + "format": "int64" + }, + "name": { + "description": "The name of the entity.\nA name matching regex `__.*__` is reserved/read-only.\nA name must not be more than 1500 bytes when UTF-8 encoded.\nCannot be `\"\"`.", + "type": "string" + } + }, + "id": "PathElement" + }, + "RollbackResponse": { + "description": "The response for Datastore.Rollback.\n(an empty message).", + "type": "object", + "properties": {}, + "id": "RollbackResponse" + }, + "PropertyReference": { + "description": "A reference to a property relative to the kind expressions.", + "type": "object", + "properties": { + "name": { + "description": "The name of the property.\nIf name includes \".\"s, it may be interpreted as a property name path.", + "type": "string" + } + }, + "id": "PropertyReference" + }, + "Projection": { + "description": "A representation of a property in a projection.", + "type": "object", + "properties": { + "property": { + "description": "The property to project.", + "$ref": "PropertyReference" + } + }, + "id": "Projection" + }, + "MutationResult": { + "description": "The result of applying a mutation.", + "type": "object", + "properties": { + "conflictDetected": { + "description": "Whether a conflict was detected for this mutation. Always false when a\nconflict detection strategy field is not set in the mutation.", + "type": "boolean" + }, + "key": { + "description": "The automatically allocated key.\nSet only when the mutation allocated a key.", + "$ref": "Key" + }, + "version": { + "description": "The version of the entity on the server after processing the mutation. If\nthe mutation doesn't change anything on the server, then the version will\nbe the version of the current entity or, if no entity is present, a version\nthat is strictly greater than the version of any previous entity and less\nthan the version of any possible future entity.", + "type": "string", + "format": "int64" + } + }, + "id": "MutationResult" + }, + "AllocateIdsResponse": { + "description": "The response for Datastore.AllocateIds.", + "type": "object", + "properties": { + "keys": { + "description": "The keys specified in the request (in the same order), each with\nits key path completed with a newly allocated ID.", + "type": "array", + "items": { + "$ref": "Key" + } + } + }, + "id": "AllocateIdsResponse" + }, + "LookupResponse": { + "description": "The response for Datastore.Lookup.", + "type": "object", + "properties": { + "found": { + "description": "Entities found as `ResultType.FULL` entities. The order of results in this\nfield is undefined and has no relation to the order of the keys in the\ninput.", + "type": "array", + "items": { + "$ref": "EntityResult" + } + }, + "missing": { + "description": "Entities not found as `ResultType.KEY_ONLY` entities. The order of results\nin this field is undefined and has no relation to the order of the keys\nin the input.", + "type": "array", + "items": { + "$ref": "EntityResult" + } + }, + "deferred": { + "description": "A list of keys that were not looked up due to resource constraints. The\norder of results in this field is undefined and has no relation to the\norder of the keys in the input.", + "type": "array", + "items": { + "$ref": "Key" + } + } + }, + "id": "LookupResponse" + }, + "BeginTransactionRequest": { + "description": "The request for Datastore.BeginTransaction.", + "type": "object", + "properties": {}, + "id": "BeginTransactionRequest" + }, + "Key": { + "description": "A unique identifier for an entity.\nIf a key's partition ID or any of its path kinds or names are\nreserved/read-only, the key is reserved/read-only.\nA reserved/read-only key is forbidden in certain documented contexts.", + "type": "object", + "properties": { + "partitionId": { + "description": "Entities are partitioned into subsets, currently identified by a project\nID and namespace ID.\nQueries are scoped to a single partition.", + "$ref": "PartitionId" + }, + "path": { + "description": "The entity path.\nAn entity path consists of one or more elements composed of a kind and a\nstring or numerical identifier, which identify entities. The first\nelement identifies a _root entity_, the second element identifies\na _child_ of the root entity, the third element identifies a child of the\nsecond entity, and so forth. The entities identified by all prefixes of\nthe path are called the element's _ancestors_.\n\nAn entity path is always fully complete: *all* of the entity's ancestors\nare required to be in the path along with the entity identifier itself.\nThe only exception is that in some documented cases, the identifier in the\nlast path element (for the entity) itself may be omitted. For example,\nthe last path element of the key of `Mutation.insert` may have no\nidentifier.\n\nA path can never be empty, and a path can have at most 100 elements.", + "type": "array", + "items": { + "$ref": "PathElement" + } + } + }, + "id": "Key" + }, + "RunQueryResponse": { + "description": "The response for Datastore.RunQuery.", + "type": "object", + "properties": { + "batch": { + "description": "A batch of query results (always present).", + "$ref": "QueryResultBatch" + }, + "query": { + "description": "The parsed form of the `GqlQuery` from the request, if it was set.", + "$ref": "Query" + } + }, + "id": "RunQueryResponse" + }, + "Entity": { + "description": "A Datastore data object.\n\nAn entity is limited to 1 megabyte when stored. That _roughly_\ncorresponds to a limit of 1 megabyte for the serialized form of this\nmessage.", + "type": "object", + "properties": { + "properties": { + "description": "The entity's properties.\nThe map's keys are property names.\nA property name matching regex `__.*__` is reserved.\nA reserved property name is forbidden in certain documented contexts.\nThe name must not contain more than 500 characters.\nThe name cannot be `\"\"`.", + "additionalProperties": { + "$ref": "Value" + }, + "type": "object" + }, + "key": { + "description": "The entity's key.\n\nAn entity must have a key, unless otherwise documented (for example,\nan entity in `Value.entity_value` may have no key).\nAn entity's kind is its key path's last element's kind,\nor null if it has no key.", + "$ref": "Key" + } + }, + "id": "Entity" + }, + "GqlQuery": { + "description": "A [GQL query](https://cloud.google.com/datastore/docs/apis/gql/gql_reference).", + "type": "object", + "properties": { + "queryString": { + "description": "A string of the format described\n[here](https://cloud.google.com/datastore/docs/apis/gql/gql_reference).", + "type": "string" + }, + "namedBindings": { + "description": "For each non-reserved named binding site in the query string, there must be\na named parameter with that name, but not necessarily the inverse.\n\nKey must match regex `A-Za-z_$*`, must not match regex\n`__.*__`, and must not be `\"\"`.", + "additionalProperties": { + "$ref": "GqlQueryParameter" + }, + "type": "object" + }, + "allowLiterals": { + "description": "When false, the query string must not contain any literals and instead must\nbind all values. For example,\n`SELECT * FROM Kind WHERE a = 'string literal'` is not allowed, while\n`SELECT * FROM Kind WHERE a = @value` is.", + "type": "boolean" + }, + "positionalBindings": { + "description": "Numbered binding site @1 references the first numbered parameter,\neffectively using 1-based indexing, rather than the usual 0.\n\nFor each binding site numbered i in `query_string`, there must be an i-th\nnumbered parameter. The inverse must also be true.", + "type": "array", + "items": { + "$ref": "GqlQueryParameter" + } + } + }, + "id": "GqlQuery" + }, + "Mutation": { + "description": "A mutation to apply to an entity.", + "type": "object", + "properties": { + "insert": { + "description": "The entity to insert. The entity must not already exist.\nThe entity key's final path element may be incomplete.", + "$ref": "Entity" + }, + "update": { + "description": "The entity to update. The entity must already exist.\nMust have a complete key path.", + "$ref": "Entity" + }, + "baseVersion": { + "description": "The version of the entity that this mutation is being applied to. If this\ndoes not match the current version on the server, the mutation conflicts.", + "type": "string", + "format": "int64" + }, + "upsert": { + "description": "The entity to upsert. The entity may or may not already exist.\nThe entity key's final path element may be incomplete.", + "$ref": "Entity" + }, + "delete": { + "description": "The key of the entity to delete. The entity may or may not already exist.\nMust have a complete key path and must not be reserved/read-only.", + "$ref": "Key" + } + }, + "id": "Mutation" + }, + "CommitResponse": { + "description": "The response for Datastore.Commit.", + "type": "object", + "properties": { + "mutationResults": { + "description": "The result of performing the mutations.\nThe i-th mutation result corresponds to the i-th mutation in the request.", + "type": "array", + "items": { + "$ref": "MutationResult" + } + }, + "indexUpdates": { + "description": "The number of index entries updated during the commit, or zero if none were\nupdated.", + "type": "integer", + "format": "int32" + } + }, + "id": "CommitResponse" + }, + "RunQueryRequest": { + "description": "The request for Datastore.RunQuery.", + "type": "object", + "properties": { + "partitionId": { + "description": "Entities are partitioned into subsets, identified by a partition ID.\nQueries are scoped to a single partition.\nThis partition ID is normalized with the standard default context\npartition ID.", + "$ref": "PartitionId" + }, + "gqlQuery": { + "description": "The GQL query to run.", + "$ref": "GqlQuery" + }, + "readOptions": { + "description": "The options for this query.", + "$ref": "ReadOptions" + }, + "query": { + "description": "The query to run.", + "$ref": "Query" + } + }, + "id": "RunQueryRequest" + }, + "LookupRequest": { + "description": "The request for Datastore.Lookup.", + "type": "object", + "properties": { + "readOptions": { + "description": "The options for this lookup request.", + "$ref": "ReadOptions" + }, + "keys": { + "description": "Keys of entities to look up.", + "type": "array", + "items": { + "$ref": "Key" + } + } + }, + "id": "LookupRequest" + }, + "LatLng": { + "description": "An object representing a latitude/longitude pair. This is expressed as a pair\nof doubles representing degrees latitude and degrees longitude. Unless\nspecified otherwise, this must conform to the\n\u003ca href=\"http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf\"\u003eWGS84\nstandard\u003c/a\u003e. Values must be within normalized ranges.\n\nExample of normalization code in Python:\n\n def NormalizeLongitude(longitude):\n \"\"\"Wraps decimal degrees longitude to [-180.0, 180.0].\"\"\"\n q, r = divmod(longitude, 360.0)\n if r \u003e 180.0 or (r == 180.0 and q \u003c= -1.0):\n return r - 360.0\n return r\n\n def NormalizeLatLng(latitude, longitude):\n \"\"\"Wraps decimal degrees latitude and longitude to\n [-90.0, 90.0] and [-180.0, 180.0], respectively.\"\"\"\n r = latitude % 360.0\n if r \u003c= 90.0:\n return r, NormalizeLongitude(longitude)\n elif r \u003e= 270.0:\n return r - 360, NormalizeLongitude(longitude)\n else:\n return 180 - r, NormalizeLongitude(longitude + 180.0)\n\n assert 180.0 == NormalizeLongitude(180.0)\n assert -180.0 == NormalizeLongitude(-180.0)\n assert -179.0 == NormalizeLongitude(181.0)\n assert (0.0, 0.0) == NormalizeLatLng(360.0, 0.0)\n assert (0.0, 0.0) == NormalizeLatLng(-360.0, 0.0)\n assert (85.0, 180.0) == NormalizeLatLng(95.0, 0.0)\n assert (-85.0, -170.0) == NormalizeLatLng(-95.0, 10.0)\n assert (90.0, 10.0) == NormalizeLatLng(90.0, 10.0)\n assert (-90.0, -10.0) == NormalizeLatLng(-90.0, -10.0)\n assert (0.0, -170.0) == NormalizeLatLng(-180.0, 10.0)\n assert (0.0, -170.0) == NormalizeLatLng(180.0, 10.0)\n assert (-90.0, 10.0) == NormalizeLatLng(270.0, 10.0)\n assert (90.0, 10.0) == NormalizeLatLng(-270.0, 10.0)", + "type": "object", + "properties": { + "latitude": { + "description": "The latitude in degrees. It must be in the range [-90.0, +90.0].", + "type": "number", + "format": "double" + }, + "longitude": { + "description": "The longitude in degrees. It must be in the range [-180.0, +180.0].", + "type": "number", + "format": "double" + } + }, + "id": "LatLng" + }, + "CompositeFilter": { + "description": "A filter that merges multiple other filters using the given operator.", + "type": "object", + "properties": { + "op": { + "description": "The operator for combining multiple filters.", + "enum": [ + "OPERATOR_UNSPECIFIED", + "AND" + ], + "enumDescriptions": [ + "Unspecified. This value must not be used.", + "The results are required to satisfy each of the combined filters." + ], + "type": "string" + }, + "filters": { + "description": "The list of filters to combine.\nMust contain at least one filter.", + "type": "array", + "items": { + "$ref": "Filter" + } + } + }, + "id": "CompositeFilter" + } + }, + "revision": "20161108", + "basePath": "", + "icons": { + "x32": "http://www.google.com/images/icons/product/search-32.gif", + "x16": "http://www.google.com/images/icons/product/search-16.gif" + }, + "version_module": "True", + "discoveryVersion": "v1", + "baseUrl": "https://datastore.googleapis.com/", + "name": "datastore", + "parameters": { + "access_token": { + "description": "OAuth access token.", + "type": "string", + "location": "query" + }, + "prettyPrint": { + "description": "Returns response with indentations and line breaks.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "key": { + "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", + "type": "string", + "location": "query" + }, + "quotaUser": { + "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.", + "type": "string", + "location": "query" + }, + "pp": { + "description": "Pretty-print response.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "fields": { + "description": "Selector specifying which fields to include in a partial response.", + "type": "string", + "location": "query" + }, + "alt": { + "description": "Data format for response.", + "location": "query", + "enum": [ + "json", + "media", + "proto" + ], + "default": "json", + "enumDescriptions": [ + "Responses with Content-Type of application/json", + "Media download with context-dependent Content-Type", + "Responses with Content-Type of application/x-protobuf" + ], + "type": "string" + }, + "$.xgafv": { + "description": "V1 error format.", + "enum": [ + "1", + "2" + ], + "enumDescriptions": [ + "v1 error format", + "v2 error format" + ], + "type": "string", + "location": "query" + }, + "callback": { + "description": "JSONP", + "type": "string", + "location": "query" + }, + "oauth_token": { + "description": "OAuth 2.0 token for the current user.", + "type": "string", + "location": "query" + }, + "uploadType": { + "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").", + "type": "string", + "location": "query" + }, + "bearer_token": { + "description": "OAuth bearer token.", + "type": "string", + "location": "query" + }, + "upload_protocol": { + "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").", + "type": "string", + "location": "query" + } + }, + "documentationLink": "https://cloud.google.com/datastore/", + "ownerDomain": "google.com", + "batchPath": "batch", + "servicePath": "", + "ownerName": "Google", + "version": "v1", + "rootUrl": "https://datastore.googleapis.com/", + "kind": "discovery#restDescription" +} diff --git a/etc/api/datastore/v1beta1/datastore-api.json b/etc/api/datastore/v1beta1/datastore-api.json index fcf1bc6559..92b2eb4952 100644 --- a/etc/api/datastore/v1beta1/datastore-api.json +++ b/etc/api/datastore/v1beta1/datastore-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/dy6n0rfohZWlTzhdDX3ZUa-EJxE\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/exiNwA5EYULji4urf-Hcdv-K2mE\"", "discoveryVersion": "v1", "id": "datastore:v1beta1", "name": "datastore", @@ -11,8 +11,8 @@ "ownerDomain": "google.com", "ownerName": "Google", "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" }, "documentationLink": "https://developers.google.com/datastore/", "protocol": "rest", diff --git a/etc/api/datastore/v1beta2/datastore-api.json b/etc/api/datastore/v1beta2/datastore-api.json index 2f5a14e5c2..9cda68f9f6 100644 --- a/etc/api/datastore/v1beta2/datastore-api.json +++ b/etc/api/datastore/v1beta2/datastore-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/xlRfXybj491s9T9Q90yjlG-attA\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/KnvSOTZ1D3HuWYBmolpDipcu9hU\"", "discoveryVersion": "v1", "id": "datastore:v1beta2", "name": "datastore", @@ -11,8 +11,8 @@ "ownerDomain": "google.com", "ownerName": "Google", "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" }, "documentationLink": "https://developers.google.com/datastore/", "protocol": "rest", diff --git a/etc/api/datastore/v1beta3/datastore-api.json b/etc/api/datastore/v1beta3/datastore-api.json index e69de29bb2..36433026c7 100644 --- a/etc/api/datastore/v1beta3/datastore-api.json +++ b/etc/api/datastore/v1beta3/datastore-api.json @@ -0,0 +1,1075 @@ +{ + "id": "datastore:v1beta3", + "auth": { + "oauth2": { + "scopes": { + "https://www.googleapis.com/auth/cloud-platform": { + "description": "View and manage your data across Google Cloud Platform services" + }, + "https://www.googleapis.com/auth/datastore": { + "description": "View and manage your Google Cloud Datastore data" + } + } + } + }, + "description": "Accesses the schemaless NoSQL database to provide fully managed, robust, scalable storage for your application.\n", + "protocol": "rest", + "title": "Google Cloud Datastore API", + "resources": { + "projects": { + "methods": { + "runQuery": { + "id": "datastore.projects.runQuery", + "response": { + "$ref": "RunQueryResponse" + }, + "parameterOrder": [ + "projectId" + ], + "description": "Queries for entities.", + "request": { + "$ref": "RunQueryRequest" + }, + "flatPath": "v1beta3/projects/{projectId}:runQuery", + "httpMethod": "POST", + "parameters": { + "projectId": { + "description": "The ID of the project against which to make the request.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1beta3/projects/{projectId}:runQuery", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/datastore" + ] + }, + "beginTransaction": { + "id": "datastore.projects.beginTransaction", + "response": { + "$ref": "BeginTransactionResponse" + }, + "parameterOrder": [ + "projectId" + ], + "description": "Begins a new transaction.", + "request": { + "$ref": "BeginTransactionRequest" + }, + "flatPath": "v1beta3/projects/{projectId}:beginTransaction", + "httpMethod": "POST", + "parameters": { + "projectId": { + "description": "The ID of the project against which to make the request.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1beta3/projects/{projectId}:beginTransaction", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/datastore" + ] + }, + "allocateIds": { + "id": "datastore.projects.allocateIds", + "response": { + "$ref": "AllocateIdsResponse" + }, + "parameterOrder": [ + "projectId" + ], + "description": "Allocates IDs for the given keys, which is useful for referencing an entity\nbefore it is inserted.", + "request": { + "$ref": "AllocateIdsRequest" + }, + "flatPath": "v1beta3/projects/{projectId}:allocateIds", + "httpMethod": "POST", + "parameters": { + "projectId": { + "description": "The ID of the project against which to make the request.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1beta3/projects/{projectId}:allocateIds", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/datastore" + ] + }, + "lookup": { + "id": "datastore.projects.lookup", + "response": { + "$ref": "LookupResponse" + }, + "parameterOrder": [ + "projectId" + ], + "description": "Looks up entities by key.", + "request": { + "$ref": "LookupRequest" + }, + "flatPath": "v1beta3/projects/{projectId}:lookup", + "httpMethod": "POST", + "parameters": { + "projectId": { + "description": "The ID of the project against which to make the request.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1beta3/projects/{projectId}:lookup", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/datastore" + ] + }, + "commit": { + "id": "datastore.projects.commit", + "response": { + "$ref": "CommitResponse" + }, + "parameterOrder": [ + "projectId" + ], + "description": "Commits a transaction, optionally creating, deleting or modifying some\nentities.", + "request": { + "$ref": "CommitRequest" + }, + "flatPath": "v1beta3/projects/{projectId}:commit", + "httpMethod": "POST", + "parameters": { + "projectId": { + "description": "The ID of the project against which to make the request.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1beta3/projects/{projectId}:commit", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/datastore" + ] + }, + "rollback": { + "id": "datastore.projects.rollback", + "response": { + "$ref": "RollbackResponse" + }, + "parameterOrder": [ + "projectId" + ], + "description": "Rolls back a transaction.", + "request": { + "$ref": "RollbackRequest" + }, + "flatPath": "v1beta3/projects/{projectId}:rollback", + "httpMethod": "POST", + "parameters": { + "projectId": { + "description": "The ID of the project against which to make the request.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1beta3/projects/{projectId}:rollback", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/datastore" + ] + } + } + } + }, + "schemas": { + "Value": { + "description": "A message that can hold any of the supported value types and associated\nmetadata.", + "type": "object", + "properties": { + "stringValue": { + "description": "A UTF-8 encoded string value.\nWhen `exclude_from_indexes` is false (it is indexed) , may have at most 1500 bytes.\nOtherwise, may be set to at least 1,000,000 bytes.", + "type": "string" + }, + "arrayValue": { + "description": "An array value.\nCannot contain another array value.\nA `Value` instance that sets field `array_value` must not set fields\n`meaning` or `exclude_from_indexes`.", + "$ref": "ArrayValue" + }, + "entityValue": { + "description": "An entity value.\n\n- May have no key.\n- May have a key with an incomplete key path.\n- May have a reserved/read-only key.", + "$ref": "Entity" + }, + "meaning": { + "description": "The `meaning` field should only be populated for backwards compatibility.", + "type": "integer", + "format": "int32" + }, + "integerValue": { + "description": "An integer value.", + "type": "string", + "format": "int64" + }, + "doubleValue": { + "description": "A double value.", + "type": "number", + "format": "double" + }, + "blobValue": { + "description": "A blob value.\nMay have at most 1,000,000 bytes.\nWhen `exclude_from_indexes` is false, may have at most 1500 bytes.\nIn JSON requests, must be base64-encoded.", + "type": "string", + "format": "byte" + }, + "geoPointValue": { + "description": "A geo point value representing a point on the surface of Earth.", + "$ref": "LatLng" + }, + "nullValue": { + "description": "A null value.", + "enum": [ + "NULL_VALUE" + ], + "enumDescriptions": [ + "Null value." + ], + "type": "string" + }, + "booleanValue": { + "description": "A boolean value.", + "type": "boolean" + }, + "keyValue": { + "description": "A key value.", + "$ref": "Key" + }, + "excludeFromIndexes": { + "description": "If the value should be excluded from all indexes including those defined\nexplicitly.", + "type": "boolean" + }, + "timestampValue": { + "description": "A timestamp value.\nWhen stored in the Datastore, precise only to microseconds;\nany additional precision is rounded down.", + "type": "string", + "format": "google-datetime" + } + }, + "id": "Value" + }, + "ReadOptions": { + "description": "The options shared by read requests.", + "type": "object", + "properties": { + "transaction": { + "description": "The identifier of the transaction in which to read. A\ntransaction identifier is returned by a call to\nDatastore.BeginTransaction.", + "type": "string", + "format": "byte" + }, + "readConsistency": { + "description": "The non-transactional read consistency to use.\nCannot be set to `STRONG` for global queries.", + "enum": [ + "READ_CONSISTENCY_UNSPECIFIED", + "STRONG", + "EVENTUAL" + ], + "enumDescriptions": [ + "Unspecified. This value must not be used.", + "Strong consistency.", + "Eventual consistency." + ], + "type": "string" + } + }, + "id": "ReadOptions" + }, + "PropertyOrder": { + "description": "The desired order for a specific property.", + "type": "object", + "properties": { + "direction": { + "description": "The direction to order by. Defaults to `ASCENDING`.", + "enum": [ + "DIRECTION_UNSPECIFIED", + "ASCENDING", + "DESCENDING" + ], + "enumDescriptions": [ + "Unspecified. This value must not be used.", + "Ascending.", + "Descending." + ], + "type": "string" + }, + "property": { + "description": "The property to order by.", + "$ref": "PropertyReference" + } + }, + "id": "PropertyOrder" + }, + "CommitRequest": { + "description": "The request for Datastore.Commit.", + "type": "object", + "properties": { + "transaction": { + "description": "The identifier of the transaction associated with the commit. A\ntransaction identifier is returned by a call to\nDatastore.BeginTransaction.", + "type": "string", + "format": "byte" + }, + "mode": { + "description": "The type of commit to perform. Defaults to `TRANSACTIONAL`.", + "enum": [ + "MODE_UNSPECIFIED", + "TRANSACTIONAL", + "NON_TRANSACTIONAL" + ], + "enumDescriptions": [ + "Unspecified. This value must not be used.", + "Transactional: The mutations are either all applied, or none are applied.\nLearn about transactions [here](https://cloud.google.com/datastore/docs/concepts/transactions).", + "Non-transactional: The mutations may not apply as all or none." + ], + "type": "string" + }, + "mutations": { + "description": "The mutations to perform.\n\nWhen mode is `TRANSACTIONAL`, mutations affecting a single entity are\napplied in order. The following sequences of mutations affecting a single\nentity are not permitted in a single `Commit` request:\n\n- `insert` followed by `insert`\n- `update` followed by `insert`\n- `upsert` followed by `insert`\n- `delete` followed by `update`\n\nWhen mode is `NON_TRANSACTIONAL`, no two mutations may affect a single\nentity.", + "type": "array", + "items": { + "$ref": "Mutation" + } + } + }, + "id": "CommitRequest" + }, + "Query": { + "description": "A query for entities.", + "type": "object", + "properties": { + "limit": { + "description": "The maximum number of results to return. Applies after all other\nconstraints. Optional.\nUnspecified is interpreted as no limit.\nMust be \u003e= 0 if specified.", + "type": "integer", + "format": "int32" + }, + "filter": { + "description": "The filter to apply.", + "$ref": "Filter" + }, + "endCursor": { + "description": "An ending point for the query results. Query cursors are\nreturned in query result batches and\n[can only be used to limit the same query](https://cloud.google.com/datastore/docs/concepts/queries#cursors_limits_and_offsets).", + "type": "string", + "format": "byte" + }, + "distinctOn": { + "description": "The properties to make distinct. The query results will contain the first\nresult for each distinct combination of values for the given properties\n(if empty, all results are returned).", + "type": "array", + "items": { + "$ref": "PropertyReference" + } + }, + "offset": { + "description": "The number of results to skip. Applies before limit, but after all other\nconstraints. Optional. Must be \u003e= 0 if specified.", + "type": "integer", + "format": "int32" + }, + "projection": { + "description": "The projection to return. Defaults to returning all properties.", + "type": "array", + "items": { + "$ref": "Projection" + } + }, + "order": { + "description": "The order to apply to the query results (if empty, order is unspecified).", + "type": "array", + "items": { + "$ref": "PropertyOrder" + } + }, + "startCursor": { + "description": "A starting point for the query results. Query cursors are\nreturned in query result batches and\n[can only be used to continue the same query](https://cloud.google.com/datastore/docs/concepts/queries#cursors_limits_and_offsets).", + "type": "string", + "format": "byte" + }, + "kind": { + "description": "The kinds to query (if empty, returns entities of all kinds).\nCurrently at most 1 kind may be specified.", + "type": "array", + "items": { + "$ref": "KindExpression" + } + } + }, + "id": "Query" + }, + "RollbackRequest": { + "description": "The request for Datastore.Rollback.", + "type": "object", + "properties": { + "transaction": { + "description": "The transaction identifier, returned by a call to\nDatastore.BeginTransaction.", + "type": "string", + "format": "byte" + } + }, + "id": "RollbackRequest" + }, + "EntityResult": { + "description": "The result of fetching an entity from Datastore.", + "type": "object", + "properties": { + "cursor": { + "description": "A cursor that points to the position after the result entity.\nSet only when the `EntityResult` is part of a `QueryResultBatch` message.", + "type": "string", + "format": "byte" + }, + "entity": { + "description": "The resulting entity.", + "$ref": "Entity" + }, + "version": { + "description": "The version of the entity, a strictly positive number that monotonically\nincreases with changes to the entity.\n\nThis field is set for `FULL` entity\nresults.\n\nFor missing entities in `LookupResponse`, this\nis the version of the snapshot that was used to look up the entity, and it\nis always set except for eventually consistent reads.", + "type": "string", + "format": "int64" + } + }, + "id": "EntityResult" + }, + "GqlQueryParameter": { + "description": "A binding parameter for a GQL query.", + "type": "object", + "properties": { + "value": { + "description": "A value parameter.", + "$ref": "Value" + }, + "cursor": { + "description": "A query cursor. Query cursors are returned in query\nresult batches.", + "type": "string", + "format": "byte" + } + }, + "id": "GqlQueryParameter" + }, + "ArrayValue": { + "description": "An array value.", + "type": "object", + "properties": { + "values": { + "description": "Values in the array.\nThe order of this array may not be preserved if it contains a mix of\nindexed and unindexed values.", + "type": "array", + "items": { + "$ref": "Value" + } + } + }, + "id": "ArrayValue" + }, + "Filter": { + "description": "A holder for any type of filter.", + "type": "object", + "properties": { + "propertyFilter": { + "description": "A filter on a property.", + "$ref": "PropertyFilter" + }, + "compositeFilter": { + "description": "A composite filter.", + "$ref": "CompositeFilter" + } + }, + "id": "Filter" + }, + "BeginTransactionResponse": { + "description": "The response for Datastore.BeginTransaction.", + "type": "object", + "properties": { + "transaction": { + "description": "The transaction identifier (always present).", + "type": "string", + "format": "byte" + } + }, + "id": "BeginTransactionResponse" + }, + "PartitionId": { + "description": "A partition ID identifies a grouping of entities. The grouping is always\nby project and namespace, however the namespace ID may be empty.\n\nA partition ID contains several dimensions:\nproject ID and namespace ID.\n\nPartition dimensions:\n\n- May be `\"\"`.\n- Must be valid UTF-8 bytes.\n- Must have values that match regex `[A-Za-z\\d\\.\\-_]{1,100}`\nIf the value of any dimension matches regex `__.*__`, the partition is\nreserved/read-only.\nA reserved/read-only partition ID is forbidden in certain documented\ncontexts.\n\nForeign partition IDs (in which the project ID does\nnot match the context project ID ) are discouraged.\nReads and writes of foreign partition IDs may fail if the project is not in an active state.", + "type": "object", + "properties": { + "namespaceId": { + "description": "If not empty, the ID of the namespace to which the entities belong.", + "type": "string" + }, + "projectId": { + "description": "The ID of the project to which the entities belong.", + "type": "string" + } + }, + "id": "PartitionId" + }, + "QueryResultBatch": { + "description": "A batch of results produced by a query.", + "type": "object", + "properties": { + "snapshotVersion": { + "description": "The version number of the snapshot this batch was returned from.\nThis applies to the range of results from the query's `start_cursor` (or\nthe beginning of the query if no cursor was given) to this batch's\n`end_cursor` (not the query's `end_cursor`).\n\nIn a single transaction, subsequent query result batches for the same query\ncan have a greater snapshot version number. Each batch's snapshot version\nis valid for all preceding batches.\nThe value will be zero for eventually consistent queries.", + "type": "string", + "format": "int64" + }, + "endCursor": { + "description": "A cursor that points to the position after the last result in the batch.", + "type": "string", + "format": "byte" + }, + "skippedCursor": { + "description": "A cursor that points to the position after the last skipped result.\nWill be set when `skipped_results` != 0.", + "type": "string", + "format": "byte" + }, + "entityResultType": { + "description": "The result type for every entity in `entity_results`.", + "enum": [ + "RESULT_TYPE_UNSPECIFIED", + "FULL", + "PROJECTION", + "KEY_ONLY" + ], + "enumDescriptions": [ + "Unspecified. This value is never used.", + "The key and properties.", + "A projected subset of properties. The entity may have no key.", + "Only the key." + ], + "type": "string" + }, + "moreResults": { + "description": "The state of the query after the current batch.", + "enum": [ + "MORE_RESULTS_TYPE_UNSPECIFIED", + "NOT_FINISHED", + "MORE_RESULTS_AFTER_LIMIT", + "MORE_RESULTS_AFTER_CURSOR", + "NO_MORE_RESULTS" + ], + "enumDescriptions": [ + "Unspecified. This value is never used.", + "There may be additional batches to fetch from this query.", + "The query is finished, but there may be more results after the limit.", + "The query is finished, but there may be more results after the end\ncursor.", + "The query has been exhausted." + ], + "type": "string" + }, + "entityResults": { + "description": "The results for this batch.", + "type": "array", + "items": { + "$ref": "EntityResult" + } + }, + "skippedResults": { + "description": "The number of results skipped, typically because of an offset.", + "type": "integer", + "format": "int32" + } + }, + "id": "QueryResultBatch" + }, + "AllocateIdsRequest": { + "description": "The request for Datastore.AllocateIds.", + "type": "object", + "properties": { + "keys": { + "description": "A list of keys with incomplete key paths for which to allocate IDs.\nNo key may be reserved/read-only.", + "type": "array", + "items": { + "$ref": "Key" + } + } + }, + "id": "AllocateIdsRequest" + }, + "KindExpression": { + "description": "A representation of a kind.", + "type": "object", + "properties": { + "name": { + "description": "The name of the kind.", + "type": "string" + } + }, + "id": "KindExpression" + }, + "PropertyFilter": { + "description": "A filter on a specific property.", + "type": "object", + "properties": { + "value": { + "description": "The value to compare the property to.", + "$ref": "Value" + }, + "op": { + "description": "The operator to filter by.", + "enum": [ + "OPERATOR_UNSPECIFIED", + "LESS_THAN", + "LESS_THAN_OR_EQUAL", + "GREATER_THAN", + "GREATER_THAN_OR_EQUAL", + "EQUAL", + "HAS_ANCESTOR" + ], + "enumDescriptions": [ + "Unspecified. This value must not be used.", + "Less than.", + "Less than or equal.", + "Greater than.", + "Greater than or equal.", + "Equal.", + "Has ancestor." + ], + "type": "string" + }, + "property": { + "description": "The property to filter by.", + "$ref": "PropertyReference" + } + }, + "id": "PropertyFilter" + }, + "PathElement": { + "description": "A (kind, ID/name) pair used to construct a key path.\n\nIf either name or ID is set, the element is complete.\nIf neither is set, the element is incomplete.", + "type": "object", + "properties": { + "kind": { + "description": "The kind of the entity.\nA kind matching regex `__.*__` is reserved/read-only.\nA kind must not contain more than 1500 bytes when UTF-8 encoded.\nCannot be `\"\"`.", + "type": "string" + }, + "id": { + "description": "The auto-allocated ID of the entity.\nNever equal to zero. Values less than zero are discouraged and may not\nbe supported in the future.", + "type": "string", + "format": "int64" + }, + "name": { + "description": "The name of the entity.\nA name matching regex `__.*__` is reserved/read-only.\nA name must not be more than 1500 bytes when UTF-8 encoded.\nCannot be `\"\"`.", + "type": "string" + } + }, + "id": "PathElement" + }, + "RollbackResponse": { + "description": "The response for Datastore.Rollback.\n(an empty message).", + "type": "object", + "properties": {}, + "id": "RollbackResponse" + }, + "PropertyReference": { + "description": "A reference to a property relative to the kind expressions.", + "type": "object", + "properties": { + "name": { + "description": "The name of the property.\nIf name includes \".\"s, it may be interpreted as a property name path.", + "type": "string" + } + }, + "id": "PropertyReference" + }, + "Projection": { + "description": "A representation of a property in a projection.", + "type": "object", + "properties": { + "property": { + "description": "The property to project.", + "$ref": "PropertyReference" + } + }, + "id": "Projection" + }, + "MutationResult": { + "description": "The result of applying a mutation.", + "type": "object", + "properties": { + "conflictDetected": { + "description": "Whether a conflict was detected for this mutation. Always false when a\nconflict detection strategy field is not set in the mutation.", + "type": "boolean" + }, + "key": { + "description": "The automatically allocated key.\nSet only when the mutation allocated a key.", + "$ref": "Key" + }, + "version": { + "description": "The version of the entity on the server after processing the mutation. If\nthe mutation doesn't change anything on the server, then the version will\nbe the version of the current entity or, if no entity is present, a version\nthat is strictly greater than the version of any previous entity and less\nthan the version of any possible future entity.", + "type": "string", + "format": "int64" + } + }, + "id": "MutationResult" + }, + "AllocateIdsResponse": { + "description": "The response for Datastore.AllocateIds.", + "type": "object", + "properties": { + "keys": { + "description": "The keys specified in the request (in the same order), each with\nits key path completed with a newly allocated ID.", + "type": "array", + "items": { + "$ref": "Key" + } + } + }, + "id": "AllocateIdsResponse" + }, + "LookupResponse": { + "description": "The response for Datastore.Lookup.", + "type": "object", + "properties": { + "found": { + "description": "Entities found as `ResultType.FULL` entities. The order of results in this\nfield is undefined and has no relation to the order of the keys in the\ninput.", + "type": "array", + "items": { + "$ref": "EntityResult" + } + }, + "missing": { + "description": "Entities not found as `ResultType.KEY_ONLY` entities. The order of results\nin this field is undefined and has no relation to the order of the keys\nin the input.", + "type": "array", + "items": { + "$ref": "EntityResult" + } + }, + "deferred": { + "description": "A list of keys that were not looked up due to resource constraints. The\norder of results in this field is undefined and has no relation to the\norder of the keys in the input.", + "type": "array", + "items": { + "$ref": "Key" + } + } + }, + "id": "LookupResponse" + }, + "BeginTransactionRequest": { + "description": "The request for Datastore.BeginTransaction.", + "type": "object", + "properties": {}, + "id": "BeginTransactionRequest" + }, + "Key": { + "description": "A unique identifier for an entity.\nIf a key's partition ID or any of its path kinds or names are\nreserved/read-only, the key is reserved/read-only.\nA reserved/read-only key is forbidden in certain documented contexts.", + "type": "object", + "properties": { + "partitionId": { + "description": "Entities are partitioned into subsets, currently identified by a project\nID and namespace ID.\nQueries are scoped to a single partition.", + "$ref": "PartitionId" + }, + "path": { + "description": "The entity path.\nAn entity path consists of one or more elements composed of a kind and a\nstring or numerical identifier, which identify entities. The first\nelement identifies a _root entity_, the second element identifies\na _child_ of the root entity, the third element identifies a child of the\nsecond entity, and so forth. The entities identified by all prefixes of\nthe path are called the element's _ancestors_.\n\nAn entity path is always fully complete: *all* of the entity's ancestors\nare required to be in the path along with the entity identifier itself.\nThe only exception is that in some documented cases, the identifier in the\nlast path element (for the entity) itself may be omitted. For example,\nthe last path element of the key of `Mutation.insert` may have no\nidentifier.\n\nA path can never be empty, and a path can have at most 100 elements.", + "type": "array", + "items": { + "$ref": "PathElement" + } + } + }, + "id": "Key" + }, + "RunQueryResponse": { + "description": "The response for Datastore.RunQuery.", + "type": "object", + "properties": { + "batch": { + "description": "A batch of query results (always present).", + "$ref": "QueryResultBatch" + }, + "query": { + "description": "The parsed form of the `GqlQuery` from the request, if it was set.", + "$ref": "Query" + } + }, + "id": "RunQueryResponse" + }, + "Entity": { + "description": "A Datastore data object.\n\nAn entity is limited to 1 megabyte when stored. That _roughly_\ncorresponds to a limit of 1 megabyte for the serialized form of this\nmessage.", + "type": "object", + "properties": { + "properties": { + "description": "The entity's properties.\nThe map's keys are property names.\nA property name matching regex `__.*__` is reserved.\nA reserved property name is forbidden in certain documented contexts.\nThe name must not contain more than 500 characters.\nThe name cannot be `\"\"`.", + "additionalProperties": { + "$ref": "Value" + }, + "type": "object" + }, + "key": { + "description": "The entity's key.\n\nAn entity must have a key, unless otherwise documented (for example,\nan entity in `Value.entity_value` may have no key).\nAn entity's kind is its key path's last element's kind,\nor null if it has no key.", + "$ref": "Key" + } + }, + "id": "Entity" + }, + "GqlQuery": { + "description": "A [GQL query](https://cloud.google.com/datastore/docs/apis/gql/gql_reference).", + "type": "object", + "properties": { + "queryString": { + "description": "A string of the format described\n[here](https://cloud.google.com/datastore/docs/apis/gql/gql_reference).", + "type": "string" + }, + "namedBindings": { + "description": "For each non-reserved named binding site in the query string, there must be\na named parameter with that name, but not necessarily the inverse.\n\nKey must match regex `A-Za-z_$*`, must not match regex\n`__.*__`, and must not be `\"\"`.", + "additionalProperties": { + "$ref": "GqlQueryParameter" + }, + "type": "object" + }, + "allowLiterals": { + "description": "When false, the query string must not contain any literals and instead must\nbind all values. For example,\n`SELECT * FROM Kind WHERE a = 'string literal'` is not allowed, while\n`SELECT * FROM Kind WHERE a = @value` is.", + "type": "boolean" + }, + "positionalBindings": { + "description": "Numbered binding site @1 references the first numbered parameter,\neffectively using 1-based indexing, rather than the usual 0.\n\nFor each binding site numbered i in `query_string`, there must be an i-th\nnumbered parameter. The inverse must also be true.", + "type": "array", + "items": { + "$ref": "GqlQueryParameter" + } + } + }, + "id": "GqlQuery" + }, + "Mutation": { + "description": "A mutation to apply to an entity.", + "type": "object", + "properties": { + "insert": { + "description": "The entity to insert. The entity must not already exist.\nThe entity key's final path element may be incomplete.", + "$ref": "Entity" + }, + "update": { + "description": "The entity to update. The entity must already exist.\nMust have a complete key path.", + "$ref": "Entity" + }, + "baseVersion": { + "description": "The version of the entity that this mutation is being applied to. If this\ndoes not match the current version on the server, the mutation conflicts.", + "type": "string", + "format": "int64" + }, + "upsert": { + "description": "The entity to upsert. The entity may or may not already exist.\nThe entity key's final path element may be incomplete.", + "$ref": "Entity" + }, + "delete": { + "description": "The key of the entity to delete. The entity may or may not already exist.\nMust have a complete key path and must not be reserved/read-only.", + "$ref": "Key" + } + }, + "id": "Mutation" + }, + "CommitResponse": { + "description": "The response for Datastore.Commit.", + "type": "object", + "properties": { + "mutationResults": { + "description": "The result of performing the mutations.\nThe i-th mutation result corresponds to the i-th mutation in the request.", + "type": "array", + "items": { + "$ref": "MutationResult" + } + }, + "indexUpdates": { + "description": "The number of index entries updated during the commit, or zero if none were\nupdated.", + "type": "integer", + "format": "int32" + } + }, + "id": "CommitResponse" + }, + "RunQueryRequest": { + "description": "The request for Datastore.RunQuery.", + "type": "object", + "properties": { + "partitionId": { + "description": "Entities are partitioned into subsets, identified by a partition ID.\nQueries are scoped to a single partition.\nThis partition ID is normalized with the standard default context\npartition ID.", + "$ref": "PartitionId" + }, + "gqlQuery": { + "description": "The GQL query to run.", + "$ref": "GqlQuery" + }, + "readOptions": { + "description": "The options for this query.", + "$ref": "ReadOptions" + }, + "query": { + "description": "The query to run.", + "$ref": "Query" + } + }, + "id": "RunQueryRequest" + }, + "LookupRequest": { + "description": "The request for Datastore.Lookup.", + "type": "object", + "properties": { + "readOptions": { + "description": "The options for this lookup request.", + "$ref": "ReadOptions" + }, + "keys": { + "description": "Keys of entities to look up.", + "type": "array", + "items": { + "$ref": "Key" + } + } + }, + "id": "LookupRequest" + }, + "LatLng": { + "description": "An object representing a latitude/longitude pair. This is expressed as a pair\nof doubles representing degrees latitude and degrees longitude. Unless\nspecified otherwise, this must conform to the\n\u003ca href=\"http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf\"\u003eWGS84\nstandard\u003c/a\u003e. Values must be within normalized ranges.\n\nExample of normalization code in Python:\n\n def NormalizeLongitude(longitude):\n \"\"\"Wraps decimal degrees longitude to [-180.0, 180.0].\"\"\"\n q, r = divmod(longitude, 360.0)\n if r \u003e 180.0 or (r == 180.0 and q \u003c= -1.0):\n return r - 360.0\n return r\n\n def NormalizeLatLng(latitude, longitude):\n \"\"\"Wraps decimal degrees latitude and longitude to\n [-90.0, 90.0] and [-180.0, 180.0], respectively.\"\"\"\n r = latitude % 360.0\n if r \u003c= 90.0:\n return r, NormalizeLongitude(longitude)\n elif r \u003e= 270.0:\n return r - 360, NormalizeLongitude(longitude)\n else:\n return 180 - r, NormalizeLongitude(longitude + 180.0)\n\n assert 180.0 == NormalizeLongitude(180.0)\n assert -180.0 == NormalizeLongitude(-180.0)\n assert -179.0 == NormalizeLongitude(181.0)\n assert (0.0, 0.0) == NormalizeLatLng(360.0, 0.0)\n assert (0.0, 0.0) == NormalizeLatLng(-360.0, 0.0)\n assert (85.0, 180.0) == NormalizeLatLng(95.0, 0.0)\n assert (-85.0, -170.0) == NormalizeLatLng(-95.0, 10.0)\n assert (90.0, 10.0) == NormalizeLatLng(90.0, 10.0)\n assert (-90.0, -10.0) == NormalizeLatLng(-90.0, -10.0)\n assert (0.0, -170.0) == NormalizeLatLng(-180.0, 10.0)\n assert (0.0, -170.0) == NormalizeLatLng(180.0, 10.0)\n assert (-90.0, 10.0) == NormalizeLatLng(270.0, 10.0)\n assert (90.0, 10.0) == NormalizeLatLng(-270.0, 10.0)", + "type": "object", + "properties": { + "latitude": { + "description": "The latitude in degrees. It must be in the range [-90.0, +90.0].", + "type": "number", + "format": "double" + }, + "longitude": { + "description": "The longitude in degrees. It must be in the range [-180.0, +180.0].", + "type": "number", + "format": "double" + } + }, + "id": "LatLng" + }, + "CompositeFilter": { + "description": "A filter that merges multiple other filters using the given operator.", + "type": "object", + "properties": { + "op": { + "description": "The operator for combining multiple filters.", + "enum": [ + "OPERATOR_UNSPECIFIED", + "AND" + ], + "enumDescriptions": [ + "Unspecified. This value must not be used.", + "The results are required to satisfy each of the combined filters." + ], + "type": "string" + }, + "filters": { + "description": "The list of filters to combine.\nMust contain at least one filter.", + "type": "array", + "items": { + "$ref": "Filter" + } + } + }, + "id": "CompositeFilter" + } + }, + "revision": "20161108", + "basePath": "", + "icons": { + "x32": "http://www.google.com/images/icons/product/search-32.gif", + "x16": "http://www.google.com/images/icons/product/search-16.gif" + }, + "version_module": "True", + "discoveryVersion": "v1", + "baseUrl": "https://datastore.googleapis.com/", + "name": "datastore", + "parameters": { + "access_token": { + "description": "OAuth access token.", + "type": "string", + "location": "query" + }, + "prettyPrint": { + "description": "Returns response with indentations and line breaks.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "key": { + "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", + "type": "string", + "location": "query" + }, + "quotaUser": { + "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.", + "type": "string", + "location": "query" + }, + "pp": { + "description": "Pretty-print response.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "fields": { + "description": "Selector specifying which fields to include in a partial response.", + "type": "string", + "location": "query" + }, + "alt": { + "description": "Data format for response.", + "location": "query", + "enum": [ + "json", + "media", + "proto" + ], + "default": "json", + "enumDescriptions": [ + "Responses with Content-Type of application/json", + "Media download with context-dependent Content-Type", + "Responses with Content-Type of application/x-protobuf" + ], + "type": "string" + }, + "$.xgafv": { + "description": "V1 error format.", + "enum": [ + "1", + "2" + ], + "enumDescriptions": [ + "v1 error format", + "v2 error format" + ], + "type": "string", + "location": "query" + }, + "callback": { + "description": "JSONP", + "type": "string", + "location": "query" + }, + "oauth_token": { + "description": "OAuth 2.0 token for the current user.", + "type": "string", + "location": "query" + }, + "uploadType": { + "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").", + "type": "string", + "location": "query" + }, + "bearer_token": { + "description": "OAuth bearer token.", + "type": "string", + "location": "query" + }, + "upload_protocol": { + "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").", + "type": "string", + "location": "query" + } + }, + "documentationLink": "https://cloud.google.com/datastore/", + "ownerDomain": "google.com", + "batchPath": "batch", + "servicePath": "", + "ownerName": "Google", + "version": "v1beta3", + "rootUrl": "https://datastore.googleapis.com/", + "kind": "discovery#restDescription" +} diff --git a/etc/api/deploymentmanager/v2/deploymentmanager-api.json b/etc/api/deploymentmanager/v2/deploymentmanager-api.json index ac78d80d3f..67f49c6ee3 100644 --- a/etc/api/deploymentmanager/v2/deploymentmanager-api.json +++ b/etc/api/deploymentmanager/v2/deploymentmanager-api.json @@ -1,19 +1,19 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/K_qiwyhd6rj_g1mYQfSWowdML68\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/OCYmftvQxj4AeJHkXNi3Nl_Kgng\"", "discoveryVersion": "v1", "id": "deploymentmanager:v2", "name": "deploymentmanager", "canonicalName": "Deployment Manager", "version": "v2", - "revision": "20160901", + "revision": "20161209", "title": "Google Cloud Deployment Manager API", "description": "Declares, configures, and deploys complex solutions on Google Cloud Platform.", "ownerDomain": "google.com", "ownerName": "Google", "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" }, "documentationLink": "https://cloud.google.com/deployment-manager/", "protocol": "rest", @@ -86,6 +86,101 @@ } }, "schemas": { + "AuditConfig": { + "id": "AuditConfig", + "type": "object", + "description": "Provides the configuration for non-admin_activity logging for a service. Controls exemptions and specific log sub-types.", + "properties": { + "auditLogConfigs": { + "type": "array", + "description": "The configuration for each type of logging", + "items": { + "$ref": "AuditLogConfig" + } + }, + "exemptedMembers": { + "type": "array", + "description": "Specifies the identities that are exempted from \"data access\" audit logging for the `service` specified above. Follows the same format of Binding.members.", + "items": { + "type": "string" + } + }, + "service": { + "type": "string", + "description": "Specifies a service that will be enabled for audit logging. For example, `resourcemanager`, `storage`, `compute`. `allServices` is a special value that covers all services." + } + } + }, + "AuditLogConfig": { + "id": "AuditLogConfig", + "type": "object", + "description": "Provides the configuration for a sub-type of logging.", + "properties": { + "exemptedMembers": { + "type": "array", + "description": "Specifies the identities that are exempted from this type of logging Follows the same format of Binding.members.", + "items": { + "type": "string" + } + }, + "logType": { + "type": "string", + "description": "The log type that this config enables." + } + } + }, + "Binding": { + "id": "Binding", + "type": "object", + "description": "Associates `members` with a `role`.", + "properties": { + "members": { + "type": "array", + "description": "Specifies the identities requesting access for a Cloud Platform resource. `members` can have the following values:\n\n* `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account.\n\n* `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account.\n\n* `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@gmail.com` or `joe@example.com`.\n\n\n\n* `serviceAccount:{emailid}`: An email address that represents a service account. For example, `my-other-app@appspot.gserviceaccount.com`.\n\n* `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`.\n\n* `domain:{domain}`: A Google Apps domain name that represents all the users of that domain. For example, `google.com` or `example.com`.", + "items": { + "type": "string" + } + }, + "role": { + "type": "string", + "description": "Role that is assigned to `members`. For example, `roles/viewer`, `roles/editor`, or `roles/owner`." + } + } + }, + "Condition": { + "id": "Condition", + "type": "object", + "description": "A condition to be met.", + "properties": { + "iam": { + "type": "string", + "description": "Trusted attributes supplied by the IAM system." + }, + "op": { + "type": "string", + "description": "An operator to apply the subject with." + }, + "svc": { + "type": "string", + "description": "Trusted attributes discharged by the service." + }, + "sys": { + "type": "string", + "description": "Trusted attributes supplied by any service that owns resources and uses the IAM system for access control." + }, + "value": { + "type": "string", + "description": "DEPRECATED. Use 'values' instead." + }, + "values": { + "type": "array", + "description": "The objects of the condition. This is mutually exclusive with 'value'.", + "items": { + "type": "string" + } + } + } + }, "ConfigFile": { "id": "ConfigFile", "type": "object", @@ -252,6 +347,32 @@ } } }, + "LogConfig": { + "id": "LogConfig", + "type": "object", + "description": "Specifies what kind of log the caller must write", + "properties": { + "counter": { + "$ref": "LogConfigCounterOptions", + "description": "Counter options." + } + } + }, + "LogConfigCounterOptions": { + "id": "LogConfigCounterOptions", + "type": "object", + "description": "Options for counters", + "properties": { + "field": { + "type": "string", + "description": "The field value to attribute." + }, + "metric": { + "type": "string", + "description": "The metric to update." + } + } + }, "Manifest": { "id": "Manifest", "type": "object", @@ -424,7 +545,7 @@ }, "targetLink": { "type": "string", - "description": "[Output Only] The URL of the resource that the operation modifies. If creating a persistent disk snapshot, this points to the persistent disk that the snapshot was created from." + "description": "[Output Only] The URL of the resource that the operation modifies. For operations related to creating a snapshot, this points to the persistent disk that the snapshot was created from." }, "user": { "type": "string", @@ -488,11 +609,57 @@ } } }, + "Policy": { + "id": "Policy", + "type": "object", + "description": "Defines an Identity and Access Management (IAM) policy. It is used to specify access control policies for Cloud Platform resources.\n\n\n\nA `Policy` consists of a list of `bindings`. A `Binding` binds a list of `members` to a `role`, where the members can be user accounts, Google groups, Google domains, and service accounts. A `role` is a named list of permissions defined by IAM.\n\n**Example**\n\n{ \"bindings\": [ { \"role\": \"roles/owner\", \"members\": [ \"user:mike@example.com\", \"group:admins@example.com\", \"domain:google.com\", \"serviceAccount:my-other-app@appspot.gserviceaccount.com\", ] }, { \"role\": \"roles/viewer\", \"members\": [\"user:sean@example.com\"] } ] }\n\nFor a description of IAM and its features, see the [IAM developer's guide](https://cloud.google.com/iam).", + "properties": { + "auditConfigs": { + "type": "array", + "description": "Specifies audit logging configs for \"data access\". \"data access\": generally refers to data reads/writes and admin reads. \"admin activity\": generally refers to admin writes.\n\nNote: `AuditConfig` doesn't apply to \"admin activity\", which always enables audit logging.", + "items": { + "$ref": "AuditConfig" + } + }, + "bindings": { + "type": "array", + "description": "Associates a list of `members` to a `role`. Multiple `bindings` must not be specified for the same `role`. `bindings` with no members will result in an error.", + "items": { + "$ref": "Binding" + } + }, + "etag": { + "type": "string", + "description": "`etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other. It is strongly suggested that systems make use of the `etag` in the read-modify-write cycle to perform policy updates in order to avoid race conditions: An `etag` is returned in the response to `getIamPolicy`, and systems are expected to put that etag in the request to `setIamPolicy` to ensure that their change will be applied to the same version of the policy.\n\nIf no `etag` is provided in the call to `setIamPolicy`, then the existing policy is overwritten blindly.", + "format": "byte" + }, + "iamOwned": { + "type": "boolean", + "description": "" + }, + "rules": { + "type": "array", + "description": "If more than one rule is specified, the rules are applied in the following manner: - All matching LOG rules are always applied. - If any DENY/DENY_WITH_LOG rule matches, permission is denied. Logging will be applied if one or more matching rule requires logging. - Otherwise, if any ALLOW/ALLOW_WITH_LOG rule matches, permission is granted. Logging will be applied if one or more matching rule requires logging. - Otherwise, if no rule applies, permission is denied.", + "items": { + "$ref": "Rule" + } + }, + "version": { + "type": "integer", + "description": "Version of the `Policy`. The default version is 0.", + "format": "int32" + } + } + }, "Resource": { "id": "Resource", "type": "object", "description": "", "properties": { + "accessControl": { + "$ref": "ResourceAccessControl", + "description": "The Access Control Policy set on this resource." + }, "finalProperties": { "type": "string", "description": "[Output Only] The evaluated properties of the resource with references expanded. Returned as serialized YAML." @@ -570,11 +737,26 @@ } } }, + "ResourceAccessControl": { + "id": "ResourceAccessControl", + "type": "object", + "description": "The access controls set on the resource.", + "properties": { + "gcpIamPolicy": { + "type": "string", + "description": "The GCP IAM Policy to set on the resource." + } + } + }, "ResourceUpdate": { "id": "ResourceUpdate", "type": "object", "description": "", "properties": { + "accessControl": { + "$ref": "ResourceAccessControl", + "description": "The Access Control Policy to set on this resource after updating the resource itself." + }, "error": { "type": "object", "description": "[Output Only] If errors are generated during update of the resource, this field will be populated.", @@ -676,6 +858,56 @@ } } }, + "Rule": { + "id": "Rule", + "type": "object", + "description": "A rule to be applied in a Policy.", + "properties": { + "action": { + "type": "string", + "description": "Required" + }, + "conditions": { + "type": "array", + "description": "Additional restrictions that must be met", + "items": { + "$ref": "Condition" + } + }, + "description": { + "type": "string", + "description": "Human-readable description of the rule." + }, + "ins": { + "type": "array", + "description": "If one or more 'in' clauses are specified, the rule matches if the PRINCIPAL/AUTHORITY_SELECTOR is in at least one of these entries.", + "items": { + "type": "string" + } + }, + "logConfigs": { + "type": "array", + "description": "The config returned to callers of tech.iam.IAM.CheckPolicy for any entries that match the LOG action.", + "items": { + "$ref": "LogConfig" + } + }, + "notIns": { + "type": "array", + "description": "If one or more 'not_in' clauses are specified, the rule matches if the PRINCIPAL/AUTHORITY_SELECTOR is in none of the entries.", + "items": { + "type": "string" + } + }, + "permissions": { + "type": "array", + "description": "A permission is a string of form '..' (e.g., 'storage.buckets.list'). A value of '*' matches all permissions, and a verb part of '*' (e.g., 'storage.buckets.*') matches all verbs.", + "items": { + "type": "string" + } + } + } + }, "TargetConfiguration": { "id": "TargetConfiguration", "type": "object", @@ -694,6 +926,32 @@ } } }, + "TestPermissionsRequest": { + "id": "TestPermissionsRequest", + "type": "object", + "properties": { + "permissions": { + "type": "array", + "description": "The set of permissions to check for the 'resource'. Permissions with wildcards (such as '*' or 'storage.*') are not allowed.", + "items": { + "type": "string" + } + } + } + }, + "TestPermissionsResponse": { + "id": "TestPermissionsResponse", + "type": "object", + "properties": { + "permissions": { + "type": "array", + "description": "A subset of `TestPermissionsRequest.permissions` that the caller is allowed.", + "items": { + "type": "string" + } + } + } + }, "Type": { "id": "Type", "type": "object", @@ -786,6 +1044,20 @@ "httpMethod": "DELETE", "description": "Deletes a deployment and all of the resources in the deployment.", "parameters": { + "deletePolicy": { + "type": "string", + "description": "Sets the policy to use for deleting resources.", + "default": "DELETE", + "enum": [ + "ABANDON", + "DELETE" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + }, "deployment": { "type": "string", "description": "The name of the deployment for this request.", @@ -848,6 +1120,39 @@ "https://www.googleapis.com/auth/ndev.cloudman.readonly" ] }, + "getIamPolicy": { + "id": "deploymentmanager.deployments.getIamPolicy", + "path": "{project}/global/deployments/{resource}/getIamPolicy", + "httpMethod": "GET", + "description": "Gets the access control policy for a resource. May be empty if no such policy or resource exists.", + "parameters": { + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "resource": { + "type": "string", + "description": "Name of the resource for this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9_]{0,61}[a-z0-9])?", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "resource" + ], + "response": { + "$ref": "Policy" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/ndev.cloudman" + ] + }, "insert": { "id": "deploymentmanager.deployments.insert", "path": "{project}/global/deployments", @@ -901,6 +1206,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -997,6 +1307,42 @@ "https://www.googleapis.com/auth/ndev.cloudman" ] }, + "setIamPolicy": { + "id": "deploymentmanager.deployments.setIamPolicy", + "path": "{project}/global/deployments/{resource}/setIamPolicy", + "httpMethod": "POST", + "description": "Sets the access control policy on the specified resource. Replaces any existing policy.", + "parameters": { + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "resource": { + "type": "string", + "description": "Name of the resource for this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9_]{0,61}[a-z0-9])?", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "resource" + ], + "request": { + "$ref": "Policy" + }, + "response": { + "$ref": "Policy" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/ndev.cloudman" + ] + }, "stop": { "id": "deploymentmanager.deployments.stop", "path": "{project}/global/deployments/{deployment}/stop", @@ -1033,6 +1379,42 @@ "https://www.googleapis.com/auth/ndev.cloudman" ] }, + "testIamPermissions": { + "id": "deploymentmanager.deployments.testIamPermissions", + "path": "{project}/global/deployments/{resource}/testIamPermissions", + "httpMethod": "POST", + "description": "Returns permissions that a caller has on the specified resource.", + "parameters": { + "project": { + "type": "string", + "description": "Project ID for this request.", + "required": true, + "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))", + "location": "path" + }, + "resource": { + "type": "string", + "description": "Name of the resource for this request.", + "required": true, + "pattern": "[a-z](?:[-a-z0-9_]{0,61}[a-z0-9])?", + "location": "path" + } + }, + "parameterOrder": [ + "project", + "resource" + ], + "request": { + "$ref": "TestPermissionsRequest" + }, + "response": { + "$ref": "TestPermissionsResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/ndev.cloudman" + ] + }, "update": { "id": "deploymentmanager.deployments.update", "path": "{project}/global/deployments/{deployment}", @@ -1177,6 +1559,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -1262,6 +1649,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -1361,6 +1753,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", @@ -1412,6 +1809,11 @@ "maximum": "500", "location": "query" }, + "orderBy": { + "type": "string", + "description": "Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.\n\nYou can also sort results in descending order based on the creation timestamp using orderBy=\"creationTimestamp desc\". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.\n\nCurrently, only sorting by name or creationTimestamp desc is supported.", + "location": "query" + }, "pageToken": { "type": "string", "description": "Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.", diff --git a/etc/api/dfareporting/v2.5/dfareporting-api.json b/etc/api/dfareporting/v2.5/dfareporting-api.json index 50b16cfa9a..c51e040b55 100644 --- a/etc/api/dfareporting/v2.5/dfareporting-api.json +++ b/etc/api/dfareporting/v2.5/dfareporting-api.json @@ -1,11 +1,11 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/y2LzemS0ncSGPB8Wy8sQ08tzru8\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/NjTto7z56uIMZ6dXu1KlAZzPglQ\"", "discoveryVersion": "v1", "id": "dfareporting:v2.5", "name": "dfareporting", "version": "v2.5", - "revision": "20160803", + "revision": "20161027", "title": "DCM/DFA Reporting And Trafficking API", "description": "Manages your DoubleClick Campaign Manager ad campaigns and reports.", "ownerDomain": "google.com", @@ -120,6 +120,7 @@ "ACTIVE_ADS_TIER_300K", "ACTIVE_ADS_TIER_40K", "ACTIVE_ADS_TIER_500K", + "ACTIVE_ADS_TIER_750K", "ACTIVE_ADS_TIER_75K" ], "enumDescriptions": [ @@ -128,6 +129,7 @@ "", "", "", + "", "" ] }, @@ -228,6 +230,7 @@ "ACTIVE_ADS_TIER_300K", "ACTIVE_ADS_TIER_40K", "ACTIVE_ADS_TIER_500K", + "ACTIVE_ADS_TIER_750K", "ACTIVE_ADS_TIER_75K" ], "enumDescriptions": [ @@ -236,6 +239,7 @@ "", "", "", + "", "" ] }, @@ -545,7 +549,7 @@ }, "active": { "type": "boolean", - "description": "Whether this ad is active." + "description": "Whether this ad is active. When true, archived must be false." }, "advertiserId": { "type": "string", @@ -558,7 +562,7 @@ }, "archived": { "type": "boolean", - "description": "Whether this ad is archived." + "description": "Whether this ad is archived. When true, active must be false." }, "audienceSegmentId": { "type": "string", @@ -1670,7 +1674,7 @@ }, "limitAdTracking": { "type": "boolean", - "description": "Whether the user has Limit Ad Tracking set." + "description": "Whether Limit Ad Tracking is enabled. When set to true, the conversion will be used for reporting but not targeting. This will prevent remarketing." }, "mobileDeviceId": { "type": "string", @@ -10029,7 +10033,7 @@ "id": "dfareporting.accountUserProfiles.list", "path": "userprofiles/{profileId}/accountUserProfiles", "httpMethod": "GET", - "description": "Retrieves a list of account user profiles, possibly filtered.", + "description": "Retrieves a list of account user profiles, possibly filtered. This method supports paging.", "parameters": { "active": { "type": "boolean", @@ -10217,7 +10221,7 @@ "id": "dfareporting.accounts.list", "path": "userprofiles/{profileId}/accounts", "httpMethod": "GET", - "description": "Retrieves the list of accounts, possibly filtered.", + "description": "Retrieves the list of accounts, possibly filtered. This method supports paging.", "parameters": { "active": { "type": "boolean", @@ -10420,7 +10424,7 @@ "id": "dfareporting.ads.list", "path": "userprofiles/{profileId}/ads", "httpMethod": "GET", - "description": "Retrieves a list of ads, possibly filtered.", + "description": "Retrieves a list of ads, possibly filtered. This method supports paging.", "parameters": { "active": { "type": "boolean", @@ -10834,7 +10838,7 @@ "id": "dfareporting.advertiserGroups.list", "path": "userprofiles/{profileId}/advertiserGroups", "httpMethod": "GET", - "description": "Retrieves a list of advertiser groups, possibly filtered.", + "description": "Retrieves a list of advertiser groups, possibly filtered. This method supports paging.", "parameters": { "ids": { "type": "string", @@ -11032,7 +11036,7 @@ "id": "dfareporting.advertisers.list", "path": "userprofiles/{profileId}/advertisers", "httpMethod": "GET", - "description": "Retrieves a list of advertisers, possibly filtered.", + "description": "Retrieves a list of advertisers, possibly filtered. This method supports paging.", "parameters": { "advertiserGroupIds": { "type": "string", @@ -11277,7 +11281,7 @@ "id": "dfareporting.campaignCreativeAssociations.list", "path": "userprofiles/{profileId}/campaigns/{campaignId}/campaignCreativeAssociations", "httpMethod": "GET", - "description": "Retrieves the list of creative IDs associated with the specified campaign.", + "description": "Retrieves the list of creative IDs associated with the specified campaign. This method supports paging.", "parameters": { "campaignId": { "type": "string", @@ -11410,7 +11414,7 @@ "id": "dfareporting.campaigns.list", "path": "userprofiles/{profileId}/campaigns", "httpMethod": "GET", - "description": "Retrieves a list of campaigns, possibly filtered.", + "description": "Retrieves a list of campaigns, possibly filtered. This method supports paging.", "parameters": { "advertiserGroupIds": { "type": "string", @@ -11624,7 +11628,7 @@ "id": "dfareporting.changeLogs.list", "path": "userprofiles/{profileId}/changeLogs", "httpMethod": "GET", - "description": "Retrieves a list of change logs.", + "description": "Retrieves a list of change logs. This method supports paging.", "parameters": { "action": { "type": "string", @@ -11735,6 +11739,7 @@ "OBJECT_REMARKETING_LIST", "OBJECT_RICHMEDIA_CREATIVE", "OBJECT_SD_SITE", + "OBJECT_SEARCH_LIFT_STUDY", "OBJECT_SIZE", "OBJECT_SUBACCOUNT", "OBJECT_TARGETING_TEMPLATE", @@ -11780,6 +11785,7 @@ "", "", "", + "", "" ], "location": "query" @@ -12029,7 +12035,7 @@ "id": "dfareporting.contentCategories.list", "path": "userprofiles/{profileId}/contentCategories", "httpMethod": "GET", - "description": "Retrieves a list of content categories, possibly filtered.", + "description": "Retrieves a list of content categories, possibly filtered. This method supports paging.", "parameters": { "ids": { "type": "string", @@ -12427,7 +12433,7 @@ "id": "dfareporting.creativeFieldValues.list", "path": "userprofiles/{profileId}/creativeFields/{creativeFieldId}/creativeFieldValues", "httpMethod": "GET", - "description": "Retrieves a list of creative field values, possibly filtered.", + "description": "Retrieves a list of creative field values, possibly filtered. This method supports paging.", "parameters": { "creativeFieldId": { "type": "string", @@ -12678,7 +12684,7 @@ "id": "dfareporting.creativeFields.list", "path": "userprofiles/{profileId}/creativeFields", "httpMethod": "GET", - "description": "Retrieves a list of creative fields, possibly filtered.", + "description": "Retrieves a list of creative fields, possibly filtered. This method supports paging.", "parameters": { "advertiserIds": { "type": "string", @@ -12883,7 +12889,7 @@ "id": "dfareporting.creativeGroups.list", "path": "userprofiles/{profileId}/creativeGroups", "httpMethod": "GET", - "description": "Retrieves a list of creative groups, possibly filtered.", + "description": "Retrieves a list of creative groups, possibly filtered. This method supports paging.", "parameters": { "advertiserIds": { "type": "string", @@ -13094,7 +13100,7 @@ "id": "dfareporting.creatives.list", "path": "userprofiles/{profileId}/creatives", "httpMethod": "GET", - "description": "Retrieves a list of creatives, possibly filtered.", + "description": "Retrieves a list of creatives, possibly filtered. This method supports paging.", "parameters": { "active": { "type": "boolean", @@ -13423,7 +13429,7 @@ "id": "dfareporting.directorySiteContacts.list", "path": "userprofiles/{profileId}/directorySiteContacts", "httpMethod": "GET", - "description": "Retrieves a list of directory site contacts, possibly filtered.", + "description": "Retrieves a list of directory site contacts, possibly filtered. This method supports paging.", "parameters": { "directorySiteIds": { "type": "string", @@ -13566,7 +13572,7 @@ "id": "dfareporting.directorySites.list", "path": "userprofiles/{profileId}/directorySites", "httpMethod": "GET", - "description": "Retrieves a list of directory sites, possibly filtered.", + "description": "Retrieves a list of directory sites, possibly filtered. This method supports paging.", "parameters": { "acceptsInStreamVideoPlacements": { "type": "boolean", @@ -14321,7 +14327,7 @@ "id": "dfareporting.floodlightActivities.list", "path": "userprofiles/{profileId}/floodlightActivities", "httpMethod": "GET", - "description": "Retrieves a list of floodlight activities, possibly filtered.", + "description": "Retrieves a list of floodlight activities, possibly filtered. This method supports paging.", "parameters": { "advertiserId": { "type": "string", @@ -14566,7 +14572,7 @@ "id": "dfareporting.floodlightActivityGroups.list", "path": "userprofiles/{profileId}/floodlightActivityGroups", "httpMethod": "GET", - "description": "Retrieves a list of floodlight activity groups, possibly filtered.", + "description": "Retrieves a list of floodlight activity groups, possibly filtered. This method supports paging.", "parameters": { "advertiserId": { "type": "string", @@ -14899,7 +14905,7 @@ "id": "dfareporting.inventoryItems.list", "path": "userprofiles/{profileId}/projects/{projectId}/inventoryItems", "httpMethod": "GET", - "description": "Retrieves a list of inventory items, possibly filtered.", + "description": "Retrieves a list of inventory items, possibly filtered. This method supports paging.", "parameters": { "ids": { "type": "string", @@ -15485,7 +15491,7 @@ "id": "dfareporting.orderDocuments.list", "path": "userprofiles/{profileId}/projects/{projectId}/orderDocuments", "httpMethod": "GET", - "description": "Retrieves a list of order documents, possibly filtered.", + "description": "Retrieves a list of order documents, possibly filtered. This method supports paging.", "parameters": { "approved": { "type": "boolean", @@ -15629,7 +15635,7 @@ "id": "dfareporting.orders.list", "path": "userprofiles/{profileId}/projects/{projectId}/orders", "httpMethod": "GET", - "description": "Retrieves a list of orders, possibly filtered.", + "description": "Retrieves a list of orders, possibly filtered. This method supports paging.", "parameters": { "ids": { "type": "string", @@ -15780,7 +15786,7 @@ "id": "dfareporting.placementGroups.list", "path": "userprofiles/{profileId}/placementGroups", "httpMethod": "GET", - "description": "Retrieves a list of placement groups, possibly filtered.", + "description": "Retrieves a list of placement groups, possibly filtered. This method supports paging.", "parameters": { "advertiserIds": { "type": "string", @@ -16109,7 +16115,7 @@ "id": "dfareporting.placementStrategies.list", "path": "userprofiles/{profileId}/placementStrategies", "httpMethod": "GET", - "description": "Retrieves a list of placement strategies, possibly filtered.", + "description": "Retrieves a list of placement strategies, possibly filtered. This method supports paging.", "parameters": { "ids": { "type": "string", @@ -16390,7 +16396,7 @@ "id": "dfareporting.placements.list", "path": "userprofiles/{profileId}/placements", "httpMethod": "GET", - "description": "Retrieves a list of placements, possibly filtered.", + "description": "Retrieves a list of placements, possibly filtered. This method supports paging.", "parameters": { "advertiserIds": { "type": "string", @@ -16816,7 +16822,7 @@ "id": "dfareporting.projects.list", "path": "userprofiles/{profileId}/projects", "httpMethod": "GET", - "description": "Retrieves a list of projects, possibly filtered.", + "description": "Retrieves a list of projects, possibly filtered. This method supports paging.", "parameters": { "advertiserIds": { "type": "string", @@ -17085,7 +17091,7 @@ "id": "dfareporting.remarketingLists.list", "path": "userprofiles/{profileId}/remarketingLists", "httpMethod": "GET", - "description": "Retrieves a list of remarketing lists, possibly filtered.", + "description": "Retrieves a list of remarketing lists, possibly filtered. This method supports paging.", "parameters": { "active": { "type": "boolean", @@ -17726,7 +17732,7 @@ "id": "dfareporting.sites.list", "path": "userprofiles/{profileId}/sites", "httpMethod": "GET", - "description": "Retrieves a list of sites, possibly filtered.", + "description": "Retrieves a list of sites, possibly filtered. This method supports paging.", "parameters": { "acceptsInStreamVideoPlacements": { "type": "boolean", @@ -18085,7 +18091,7 @@ "id": "dfareporting.subaccounts.list", "path": "userprofiles/{profileId}/subaccounts", "httpMethod": "GET", - "description": "Gets a list of subaccounts, possibly filtered.", + "description": "Gets a list of subaccounts, possibly filtered. This method supports paging.", "parameters": { "ids": { "type": "string", @@ -18256,7 +18262,7 @@ "id": "dfareporting.targetableRemarketingLists.list", "path": "userprofiles/{profileId}/targetableRemarketingLists", "httpMethod": "GET", - "description": "Retrieves a list of targetable remarketing lists, possibly filtered.", + "description": "Retrieves a list of targetable remarketing lists, possibly filtered. This method supports paging.", "parameters": { "active": { "type": "boolean", @@ -18596,7 +18602,7 @@ "id": "dfareporting.userRoles.list", "path": "userprofiles/{profileId}/userRoles", "httpMethod": "GET", - "description": "Retrieves a list of user roles, possibly filtered.", + "description": "Retrieves a list of user roles, possibly filtered. This method supports paging.", "parameters": { "accountUserRoleOnly": { "type": "boolean", diff --git a/etc/api/dfareporting/v2.5beta1/dfareporting-api.json b/etc/api/dfareporting/v2.5beta1/dfareporting-api.json index 87040486d2..f6035dbcd8 100644 --- a/etc/api/dfareporting/v2.5beta1/dfareporting-api.json +++ b/etc/api/dfareporting/v2.5beta1/dfareporting-api.json @@ -1,11 +1,11 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/z0eZUaqOcxxITNN1hSlIwZVa79Y\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/IuF-UJwb7L5VgOXQMERaZkF35jI\"", "discoveryVersion": "v1", "id": "dfareporting:v2.5beta1", "name": "dfareporting", "version": "v2.5beta1", - "revision": "20160803", + "revision": "20161027", "title": "DCM/DFA Reporting And Trafficking API", "description": "Manages your DoubleClick Campaign Manager ad campaigns and reports.", "ownerDomain": "google.com", @@ -120,6 +120,7 @@ "ACTIVE_ADS_TIER_300K", "ACTIVE_ADS_TIER_40K", "ACTIVE_ADS_TIER_500K", + "ACTIVE_ADS_TIER_750K", "ACTIVE_ADS_TIER_75K" ], "enumDescriptions": [ @@ -128,6 +129,7 @@ "", "", "", + "", "" ] }, @@ -228,6 +230,7 @@ "ACTIVE_ADS_TIER_300K", "ACTIVE_ADS_TIER_40K", "ACTIVE_ADS_TIER_500K", + "ACTIVE_ADS_TIER_750K", "ACTIVE_ADS_TIER_75K" ], "enumDescriptions": [ @@ -236,6 +239,7 @@ "", "", "", + "", "" ] }, @@ -545,7 +549,7 @@ }, "active": { "type": "boolean", - "description": "Whether this ad is active." + "description": "Whether this ad is active. When true, archived must be false." }, "advertiserId": { "type": "string", @@ -558,7 +562,7 @@ }, "archived": { "type": "boolean", - "description": "Whether this ad is archived." + "description": "Whether this ad is archived. When true, active must be false." }, "audienceSegmentId": { "type": "string", @@ -1670,7 +1674,7 @@ }, "limitAdTracking": { "type": "boolean", - "description": "Whether the user has Limit Ad Tracking set." + "description": "Whether Limit Ad Tracking is enabled. When set to true, the conversion will be used for reporting but not targeting. This will prevent remarketing." }, "mobileDeviceId": { "type": "string", @@ -10029,7 +10033,7 @@ "id": "dfareporting.accountUserProfiles.list", "path": "userprofiles/{profileId}/accountUserProfiles", "httpMethod": "GET", - "description": "Retrieves a list of account user profiles, possibly filtered.", + "description": "Retrieves a list of account user profiles, possibly filtered. This method supports paging.", "parameters": { "active": { "type": "boolean", @@ -10217,7 +10221,7 @@ "id": "dfareporting.accounts.list", "path": "userprofiles/{profileId}/accounts", "httpMethod": "GET", - "description": "Retrieves the list of accounts, possibly filtered.", + "description": "Retrieves the list of accounts, possibly filtered. This method supports paging.", "parameters": { "active": { "type": "boolean", @@ -10420,7 +10424,7 @@ "id": "dfareporting.ads.list", "path": "userprofiles/{profileId}/ads", "httpMethod": "GET", - "description": "Retrieves a list of ads, possibly filtered.", + "description": "Retrieves a list of ads, possibly filtered. This method supports paging.", "parameters": { "active": { "type": "boolean", @@ -10834,7 +10838,7 @@ "id": "dfareporting.advertiserGroups.list", "path": "userprofiles/{profileId}/advertiserGroups", "httpMethod": "GET", - "description": "Retrieves a list of advertiser groups, possibly filtered.", + "description": "Retrieves a list of advertiser groups, possibly filtered. This method supports paging.", "parameters": { "ids": { "type": "string", @@ -11032,7 +11036,7 @@ "id": "dfareporting.advertisers.list", "path": "userprofiles/{profileId}/advertisers", "httpMethod": "GET", - "description": "Retrieves a list of advertisers, possibly filtered.", + "description": "Retrieves a list of advertisers, possibly filtered. This method supports paging.", "parameters": { "advertiserGroupIds": { "type": "string", @@ -11277,7 +11281,7 @@ "id": "dfareporting.campaignCreativeAssociations.list", "path": "userprofiles/{profileId}/campaigns/{campaignId}/campaignCreativeAssociations", "httpMethod": "GET", - "description": "Retrieves the list of creative IDs associated with the specified campaign.", + "description": "Retrieves the list of creative IDs associated with the specified campaign. This method supports paging.", "parameters": { "campaignId": { "type": "string", @@ -11410,7 +11414,7 @@ "id": "dfareporting.campaigns.list", "path": "userprofiles/{profileId}/campaigns", "httpMethod": "GET", - "description": "Retrieves a list of campaigns, possibly filtered.", + "description": "Retrieves a list of campaigns, possibly filtered. This method supports paging.", "parameters": { "advertiserGroupIds": { "type": "string", @@ -11624,7 +11628,7 @@ "id": "dfareporting.changeLogs.list", "path": "userprofiles/{profileId}/changeLogs", "httpMethod": "GET", - "description": "Retrieves a list of change logs.", + "description": "Retrieves a list of change logs. This method supports paging.", "parameters": { "action": { "type": "string", @@ -11735,6 +11739,7 @@ "OBJECT_REMARKETING_LIST", "OBJECT_RICHMEDIA_CREATIVE", "OBJECT_SD_SITE", + "OBJECT_SEARCH_LIFT_STUDY", "OBJECT_SIZE", "OBJECT_SUBACCOUNT", "OBJECT_TARGETING_TEMPLATE", @@ -11780,6 +11785,7 @@ "", "", "", + "", "" ], "location": "query" @@ -12029,7 +12035,7 @@ "id": "dfareporting.contentCategories.list", "path": "userprofiles/{profileId}/contentCategories", "httpMethod": "GET", - "description": "Retrieves a list of content categories, possibly filtered.", + "description": "Retrieves a list of content categories, possibly filtered. This method supports paging.", "parameters": { "ids": { "type": "string", @@ -12427,7 +12433,7 @@ "id": "dfareporting.creativeFieldValues.list", "path": "userprofiles/{profileId}/creativeFields/{creativeFieldId}/creativeFieldValues", "httpMethod": "GET", - "description": "Retrieves a list of creative field values, possibly filtered.", + "description": "Retrieves a list of creative field values, possibly filtered. This method supports paging.", "parameters": { "creativeFieldId": { "type": "string", @@ -12678,7 +12684,7 @@ "id": "dfareporting.creativeFields.list", "path": "userprofiles/{profileId}/creativeFields", "httpMethod": "GET", - "description": "Retrieves a list of creative fields, possibly filtered.", + "description": "Retrieves a list of creative fields, possibly filtered. This method supports paging.", "parameters": { "advertiserIds": { "type": "string", @@ -12883,7 +12889,7 @@ "id": "dfareporting.creativeGroups.list", "path": "userprofiles/{profileId}/creativeGroups", "httpMethod": "GET", - "description": "Retrieves a list of creative groups, possibly filtered.", + "description": "Retrieves a list of creative groups, possibly filtered. This method supports paging.", "parameters": { "advertiserIds": { "type": "string", @@ -13094,7 +13100,7 @@ "id": "dfareporting.creatives.list", "path": "userprofiles/{profileId}/creatives", "httpMethod": "GET", - "description": "Retrieves a list of creatives, possibly filtered.", + "description": "Retrieves a list of creatives, possibly filtered. This method supports paging.", "parameters": { "active": { "type": "boolean", @@ -13423,7 +13429,7 @@ "id": "dfareporting.directorySiteContacts.list", "path": "userprofiles/{profileId}/directorySiteContacts", "httpMethod": "GET", - "description": "Retrieves a list of directory site contacts, possibly filtered.", + "description": "Retrieves a list of directory site contacts, possibly filtered. This method supports paging.", "parameters": { "directorySiteIds": { "type": "string", @@ -13566,7 +13572,7 @@ "id": "dfareporting.directorySites.list", "path": "userprofiles/{profileId}/directorySites", "httpMethod": "GET", - "description": "Retrieves a list of directory sites, possibly filtered.", + "description": "Retrieves a list of directory sites, possibly filtered. This method supports paging.", "parameters": { "acceptsInStreamVideoPlacements": { "type": "boolean", @@ -14321,7 +14327,7 @@ "id": "dfareporting.floodlightActivities.list", "path": "userprofiles/{profileId}/floodlightActivities", "httpMethod": "GET", - "description": "Retrieves a list of floodlight activities, possibly filtered.", + "description": "Retrieves a list of floodlight activities, possibly filtered. This method supports paging.", "parameters": { "advertiserId": { "type": "string", @@ -14566,7 +14572,7 @@ "id": "dfareporting.floodlightActivityGroups.list", "path": "userprofiles/{profileId}/floodlightActivityGroups", "httpMethod": "GET", - "description": "Retrieves a list of floodlight activity groups, possibly filtered.", + "description": "Retrieves a list of floodlight activity groups, possibly filtered. This method supports paging.", "parameters": { "advertiserId": { "type": "string", @@ -14899,7 +14905,7 @@ "id": "dfareporting.inventoryItems.list", "path": "userprofiles/{profileId}/projects/{projectId}/inventoryItems", "httpMethod": "GET", - "description": "Retrieves a list of inventory items, possibly filtered.", + "description": "Retrieves a list of inventory items, possibly filtered. This method supports paging.", "parameters": { "ids": { "type": "string", @@ -15485,7 +15491,7 @@ "id": "dfareporting.orderDocuments.list", "path": "userprofiles/{profileId}/projects/{projectId}/orderDocuments", "httpMethod": "GET", - "description": "Retrieves a list of order documents, possibly filtered.", + "description": "Retrieves a list of order documents, possibly filtered. This method supports paging.", "parameters": { "approved": { "type": "boolean", @@ -15629,7 +15635,7 @@ "id": "dfareporting.orders.list", "path": "userprofiles/{profileId}/projects/{projectId}/orders", "httpMethod": "GET", - "description": "Retrieves a list of orders, possibly filtered.", + "description": "Retrieves a list of orders, possibly filtered. This method supports paging.", "parameters": { "ids": { "type": "string", @@ -15780,7 +15786,7 @@ "id": "dfareporting.placementGroups.list", "path": "userprofiles/{profileId}/placementGroups", "httpMethod": "GET", - "description": "Retrieves a list of placement groups, possibly filtered.", + "description": "Retrieves a list of placement groups, possibly filtered. This method supports paging.", "parameters": { "advertiserIds": { "type": "string", @@ -16109,7 +16115,7 @@ "id": "dfareporting.placementStrategies.list", "path": "userprofiles/{profileId}/placementStrategies", "httpMethod": "GET", - "description": "Retrieves a list of placement strategies, possibly filtered.", + "description": "Retrieves a list of placement strategies, possibly filtered. This method supports paging.", "parameters": { "ids": { "type": "string", @@ -16390,7 +16396,7 @@ "id": "dfareporting.placements.list", "path": "userprofiles/{profileId}/placements", "httpMethod": "GET", - "description": "Retrieves a list of placements, possibly filtered.", + "description": "Retrieves a list of placements, possibly filtered. This method supports paging.", "parameters": { "advertiserIds": { "type": "string", @@ -16816,7 +16822,7 @@ "id": "dfareporting.projects.list", "path": "userprofiles/{profileId}/projects", "httpMethod": "GET", - "description": "Retrieves a list of projects, possibly filtered.", + "description": "Retrieves a list of projects, possibly filtered. This method supports paging.", "parameters": { "advertiserIds": { "type": "string", @@ -17085,7 +17091,7 @@ "id": "dfareporting.remarketingLists.list", "path": "userprofiles/{profileId}/remarketingLists", "httpMethod": "GET", - "description": "Retrieves a list of remarketing lists, possibly filtered.", + "description": "Retrieves a list of remarketing lists, possibly filtered. This method supports paging.", "parameters": { "active": { "type": "boolean", @@ -17726,7 +17732,7 @@ "id": "dfareporting.sites.list", "path": "userprofiles/{profileId}/sites", "httpMethod": "GET", - "description": "Retrieves a list of sites, possibly filtered.", + "description": "Retrieves a list of sites, possibly filtered. This method supports paging.", "parameters": { "acceptsInStreamVideoPlacements": { "type": "boolean", @@ -18085,7 +18091,7 @@ "id": "dfareporting.subaccounts.list", "path": "userprofiles/{profileId}/subaccounts", "httpMethod": "GET", - "description": "Gets a list of subaccounts, possibly filtered.", + "description": "Gets a list of subaccounts, possibly filtered. This method supports paging.", "parameters": { "ids": { "type": "string", @@ -18256,7 +18262,7 @@ "id": "dfareporting.targetableRemarketingLists.list", "path": "userprofiles/{profileId}/targetableRemarketingLists", "httpMethod": "GET", - "description": "Retrieves a list of targetable remarketing lists, possibly filtered.", + "description": "Retrieves a list of targetable remarketing lists, possibly filtered. This method supports paging.", "parameters": { "active": { "type": "boolean", @@ -18596,7 +18602,7 @@ "id": "dfareporting.userRoles.list", "path": "userprofiles/{profileId}/userRoles", "httpMethod": "GET", - "description": "Retrieves a list of user roles, possibly filtered.", + "description": "Retrieves a list of user roles, possibly filtered. This method supports paging.", "parameters": { "accountUserRoleOnly": { "type": "boolean", diff --git a/etc/api/dfareporting/v2.6/dfareporting-api.json b/etc/api/dfareporting/v2.6/dfareporting-api.json index 873000d453..3696119c9b 100644 --- a/etc/api/dfareporting/v2.6/dfareporting-api.json +++ b/etc/api/dfareporting/v2.6/dfareporting-api.json @@ -1,11 +1,11 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/kUzYRmhKcAnpiKF3q0AnOrMQGIA\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/IUIpYIH18PV9NykwTxBMEWqSYmE\"", "discoveryVersion": "v1", "id": "dfareporting:v2.6", "name": "dfareporting", "version": "v2.6", - "revision": "20160803", + "revision": "20161027", "title": "DCM/DFA Reporting And Trafficking API", "description": "Manages your DoubleClick Campaign Manager ad campaigns and reports.", "ownerDomain": "google.com", @@ -120,6 +120,7 @@ "ACTIVE_ADS_TIER_300K", "ACTIVE_ADS_TIER_40K", "ACTIVE_ADS_TIER_500K", + "ACTIVE_ADS_TIER_750K", "ACTIVE_ADS_TIER_75K" ], "enumDescriptions": [ @@ -128,6 +129,7 @@ "", "", "", + "", "" ] }, @@ -228,6 +230,7 @@ "ACTIVE_ADS_TIER_300K", "ACTIVE_ADS_TIER_40K", "ACTIVE_ADS_TIER_500K", + "ACTIVE_ADS_TIER_750K", "ACTIVE_ADS_TIER_75K" ], "enumDescriptions": [ @@ -236,6 +239,7 @@ "", "", "", + "", "" ] }, @@ -545,7 +549,7 @@ }, "active": { "type": "boolean", - "description": "Whether this ad is active." + "description": "Whether this ad is active. When true, archived must be false." }, "advertiserId": { "type": "string", @@ -558,7 +562,7 @@ }, "archived": { "type": "boolean", - "description": "Whether this ad is archived." + "description": "Whether this ad is archived. When true, active must be false." }, "audienceSegmentId": { "type": "string", @@ -1682,7 +1686,7 @@ }, "limitAdTracking": { "type": "boolean", - "description": "Whether the user has Limit Ad Tracking set." + "description": "Whether Limit Ad Tracking is enabled. When set to true, the conversion will be used for reporting but not targeting. This will prevent remarketing." }, "mobileDeviceId": { "type": "string", @@ -10260,7 +10264,7 @@ "id": "dfareporting.accountUserProfiles.list", "path": "userprofiles/{profileId}/accountUserProfiles", "httpMethod": "GET", - "description": "Retrieves a list of account user profiles, possibly filtered.", + "description": "Retrieves a list of account user profiles, possibly filtered. This method supports paging.", "parameters": { "active": { "type": "boolean", @@ -10448,7 +10452,7 @@ "id": "dfareporting.accounts.list", "path": "userprofiles/{profileId}/accounts", "httpMethod": "GET", - "description": "Retrieves the list of accounts, possibly filtered.", + "description": "Retrieves the list of accounts, possibly filtered. This method supports paging.", "parameters": { "active": { "type": "boolean", @@ -10651,7 +10655,7 @@ "id": "dfareporting.ads.list", "path": "userprofiles/{profileId}/ads", "httpMethod": "GET", - "description": "Retrieves a list of ads, possibly filtered.", + "description": "Retrieves a list of ads, possibly filtered. This method supports paging.", "parameters": { "active": { "type": "boolean", @@ -11065,7 +11069,7 @@ "id": "dfareporting.advertiserGroups.list", "path": "userprofiles/{profileId}/advertiserGroups", "httpMethod": "GET", - "description": "Retrieves a list of advertiser groups, possibly filtered.", + "description": "Retrieves a list of advertiser groups, possibly filtered. This method supports paging.", "parameters": { "ids": { "type": "string", @@ -11263,7 +11267,7 @@ "id": "dfareporting.advertisers.list", "path": "userprofiles/{profileId}/advertisers", "httpMethod": "GET", - "description": "Retrieves a list of advertisers, possibly filtered.", + "description": "Retrieves a list of advertisers, possibly filtered. This method supports paging.", "parameters": { "advertiserGroupIds": { "type": "string", @@ -11508,7 +11512,7 @@ "id": "dfareporting.campaignCreativeAssociations.list", "path": "userprofiles/{profileId}/campaigns/{campaignId}/campaignCreativeAssociations", "httpMethod": "GET", - "description": "Retrieves the list of creative IDs associated with the specified campaign.", + "description": "Retrieves the list of creative IDs associated with the specified campaign. This method supports paging.", "parameters": { "campaignId": { "type": "string", @@ -11641,7 +11645,7 @@ "id": "dfareporting.campaigns.list", "path": "userprofiles/{profileId}/campaigns", "httpMethod": "GET", - "description": "Retrieves a list of campaigns, possibly filtered.", + "description": "Retrieves a list of campaigns, possibly filtered. This method supports paging.", "parameters": { "advertiserGroupIds": { "type": "string", @@ -11855,7 +11859,7 @@ "id": "dfareporting.changeLogs.list", "path": "userprofiles/{profileId}/changeLogs", "httpMethod": "GET", - "description": "Retrieves a list of change logs.", + "description": "Retrieves a list of change logs. This method supports paging.", "parameters": { "action": { "type": "string", @@ -11966,6 +11970,7 @@ "OBJECT_REMARKETING_LIST", "OBJECT_RICHMEDIA_CREATIVE", "OBJECT_SD_SITE", + "OBJECT_SEARCH_LIFT_STUDY", "OBJECT_SIZE", "OBJECT_SUBACCOUNT", "OBJECT_TARGETING_TEMPLATE", @@ -12011,6 +12016,7 @@ "", "", "", + "", "" ], "location": "query" @@ -12260,7 +12266,7 @@ "id": "dfareporting.contentCategories.list", "path": "userprofiles/{profileId}/contentCategories", "httpMethod": "GET", - "description": "Retrieves a list of content categories, possibly filtered.", + "description": "Retrieves a list of content categories, possibly filtered. This method supports paging.", "parameters": { "ids": { "type": "string", @@ -12658,7 +12664,7 @@ "id": "dfareporting.creativeFieldValues.list", "path": "userprofiles/{profileId}/creativeFields/{creativeFieldId}/creativeFieldValues", "httpMethod": "GET", - "description": "Retrieves a list of creative field values, possibly filtered.", + "description": "Retrieves a list of creative field values, possibly filtered. This method supports paging.", "parameters": { "creativeFieldId": { "type": "string", @@ -12909,7 +12915,7 @@ "id": "dfareporting.creativeFields.list", "path": "userprofiles/{profileId}/creativeFields", "httpMethod": "GET", - "description": "Retrieves a list of creative fields, possibly filtered.", + "description": "Retrieves a list of creative fields, possibly filtered. This method supports paging.", "parameters": { "advertiserIds": { "type": "string", @@ -13114,7 +13120,7 @@ "id": "dfareporting.creativeGroups.list", "path": "userprofiles/{profileId}/creativeGroups", "httpMethod": "GET", - "description": "Retrieves a list of creative groups, possibly filtered.", + "description": "Retrieves a list of creative groups, possibly filtered. This method supports paging.", "parameters": { "advertiserIds": { "type": "string", @@ -13325,7 +13331,7 @@ "id": "dfareporting.creatives.list", "path": "userprofiles/{profileId}/creatives", "httpMethod": "GET", - "description": "Retrieves a list of creatives, possibly filtered.", + "description": "Retrieves a list of creatives, possibly filtered. This method supports paging.", "parameters": { "active": { "type": "boolean", @@ -13654,7 +13660,7 @@ "id": "dfareporting.directorySiteContacts.list", "path": "userprofiles/{profileId}/directorySiteContacts", "httpMethod": "GET", - "description": "Retrieves a list of directory site contacts, possibly filtered.", + "description": "Retrieves a list of directory site contacts, possibly filtered. This method supports paging.", "parameters": { "directorySiteIds": { "type": "string", @@ -13797,7 +13803,7 @@ "id": "dfareporting.directorySites.list", "path": "userprofiles/{profileId}/directorySites", "httpMethod": "GET", - "description": "Retrieves a list of directory sites, possibly filtered.", + "description": "Retrieves a list of directory sites, possibly filtered. This method supports paging.", "parameters": { "acceptsInStreamVideoPlacements": { "type": "boolean", @@ -14552,7 +14558,7 @@ "id": "dfareporting.floodlightActivities.list", "path": "userprofiles/{profileId}/floodlightActivities", "httpMethod": "GET", - "description": "Retrieves a list of floodlight activities, possibly filtered.", + "description": "Retrieves a list of floodlight activities, possibly filtered. This method supports paging.", "parameters": { "advertiserId": { "type": "string", @@ -14797,7 +14803,7 @@ "id": "dfareporting.floodlightActivityGroups.list", "path": "userprofiles/{profileId}/floodlightActivityGroups", "httpMethod": "GET", - "description": "Retrieves a list of floodlight activity groups, possibly filtered.", + "description": "Retrieves a list of floodlight activity groups, possibly filtered. This method supports paging.", "parameters": { "advertiserId": { "type": "string", @@ -15130,7 +15136,7 @@ "id": "dfareporting.inventoryItems.list", "path": "userprofiles/{profileId}/projects/{projectId}/inventoryItems", "httpMethod": "GET", - "description": "Retrieves a list of inventory items, possibly filtered.", + "description": "Retrieves a list of inventory items, possibly filtered. This method supports paging.", "parameters": { "ids": { "type": "string", @@ -15744,7 +15750,7 @@ "id": "dfareporting.orderDocuments.list", "path": "userprofiles/{profileId}/projects/{projectId}/orderDocuments", "httpMethod": "GET", - "description": "Retrieves a list of order documents, possibly filtered.", + "description": "Retrieves a list of order documents, possibly filtered. This method supports paging.", "parameters": { "approved": { "type": "boolean", @@ -15888,7 +15894,7 @@ "id": "dfareporting.orders.list", "path": "userprofiles/{profileId}/projects/{projectId}/orders", "httpMethod": "GET", - "description": "Retrieves a list of orders, possibly filtered.", + "description": "Retrieves a list of orders, possibly filtered. This method supports paging.", "parameters": { "ids": { "type": "string", @@ -16039,7 +16045,7 @@ "id": "dfareporting.placementGroups.list", "path": "userprofiles/{profileId}/placementGroups", "httpMethod": "GET", - "description": "Retrieves a list of placement groups, possibly filtered.", + "description": "Retrieves a list of placement groups, possibly filtered. This method supports paging.", "parameters": { "advertiserIds": { "type": "string", @@ -16368,7 +16374,7 @@ "id": "dfareporting.placementStrategies.list", "path": "userprofiles/{profileId}/placementStrategies", "httpMethod": "GET", - "description": "Retrieves a list of placement strategies, possibly filtered.", + "description": "Retrieves a list of placement strategies, possibly filtered. This method supports paging.", "parameters": { "ids": { "type": "string", @@ -16649,7 +16655,7 @@ "id": "dfareporting.placements.list", "path": "userprofiles/{profileId}/placements", "httpMethod": "GET", - "description": "Retrieves a list of placements, possibly filtered.", + "description": "Retrieves a list of placements, possibly filtered. This method supports paging.", "parameters": { "advertiserIds": { "type": "string", @@ -17075,7 +17081,7 @@ "id": "dfareporting.projects.list", "path": "userprofiles/{profileId}/projects", "httpMethod": "GET", - "description": "Retrieves a list of projects, possibly filtered.", + "description": "Retrieves a list of projects, possibly filtered. This method supports paging.", "parameters": { "advertiserIds": { "type": "string", @@ -17344,7 +17350,7 @@ "id": "dfareporting.remarketingLists.list", "path": "userprofiles/{profileId}/remarketingLists", "httpMethod": "GET", - "description": "Retrieves a list of remarketing lists, possibly filtered.", + "description": "Retrieves a list of remarketing lists, possibly filtered. This method supports paging.", "parameters": { "active": { "type": "boolean", @@ -17985,7 +17991,7 @@ "id": "dfareporting.sites.list", "path": "userprofiles/{profileId}/sites", "httpMethod": "GET", - "description": "Retrieves a list of sites, possibly filtered.", + "description": "Retrieves a list of sites, possibly filtered. This method supports paging.", "parameters": { "acceptsInStreamVideoPlacements": { "type": "boolean", @@ -18344,7 +18350,7 @@ "id": "dfareporting.subaccounts.list", "path": "userprofiles/{profileId}/subaccounts", "httpMethod": "GET", - "description": "Gets a list of subaccounts, possibly filtered.", + "description": "Gets a list of subaccounts, possibly filtered. This method supports paging.", "parameters": { "ids": { "type": "string", @@ -18515,7 +18521,7 @@ "id": "dfareporting.targetableRemarketingLists.list", "path": "userprofiles/{profileId}/targetableRemarketingLists", "httpMethod": "GET", - "description": "Retrieves a list of targetable remarketing lists, possibly filtered.", + "description": "Retrieves a list of targetable remarketing lists, possibly filtered. This method supports paging.", "parameters": { "active": { "type": "boolean", @@ -18657,7 +18663,7 @@ "id": "dfareporting.targetingTemplates.list", "path": "userprofiles/{profileId}/targetingTemplates", "httpMethod": "GET", - "description": "Retrieves a list of targeting templates, optionally filtered.", + "description": "Retrieves a list of targeting templates, optionally filtered. This method supports paging.", "parameters": { "advertiserId": { "type": "string", @@ -19059,7 +19065,7 @@ "id": "dfareporting.userRoles.list", "path": "userprofiles/{profileId}/userRoles", "httpMethod": "GET", - "description": "Retrieves a list of user roles, possibly filtered.", + "description": "Retrieves a list of user roles, possibly filtered. This method supports paging.", "parameters": { "accountUserRoleOnly": { "type": "boolean", diff --git a/etc/api/dfareporting/v2.7/dfareporting-api.json b/etc/api/dfareporting/v2.7/dfareporting-api.json new file mode 100644 index 0000000000..08b139c01d --- /dev/null +++ b/etc/api/dfareporting/v2.7/dfareporting-api.json @@ -0,0 +1,19439 @@ +{ + "kind": "discovery#restDescription", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/OBUnP-P7ni-fogNkVJMH8BP7EG8\"", + "discoveryVersion": "v1", + "id": "dfareporting:v2.7", + "name": "dfareporting", + "version": "v2.7", + "revision": "20161027", + "title": "DCM/DFA Reporting And Trafficking API", + "description": "Manages your DoubleClick Campaign Manager ad campaigns and reports.", + "ownerDomain": "google.com", + "ownerName": "Google", + "icons": { + "x16": "https://www.google.com/images/icons/product/doubleclick-16.gif", + "x32": "https://www.google.com/images/icons/product/doubleclick-32.gif" + }, + "documentationLink": "https://developers.google.com/doubleclick-advertisers/", + "protocol": "rest", + "baseUrl": "https://www.googleapis.com/dfareporting/v2.7/", + "basePath": "/dfareporting/v2.7/", + "rootUrl": "https://www.googleapis.com/", + "servicePath": "dfareporting/v2.7/", + "batchPath": "batch", + "parameters": { + "alt": { + "type": "string", + "description": "Data format for the response.", + "default": "json", + "enum": [ + "json" + ], + "enumDescriptions": [ + "Responses with Content-Type of application/json" + ], + "location": "query" + }, + "fields": { + "type": "string", + "description": "Selector specifying which fields to include in a partial response.", + "location": "query" + }, + "key": { + "type": "string", + "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", + "location": "query" + }, + "oauth_token": { + "type": "string", + "description": "OAuth 2.0 token for the current user.", + "location": "query" + }, + "prettyPrint": { + "type": "boolean", + "description": "Returns response with indentations and line breaks.", + "default": "true", + "location": "query" + }, + "quotaUser": { + "type": "string", + "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.", + "location": "query" + }, + "userIp": { + "type": "string", + "description": "IP address of the site where the request originates. Use this if you want to enforce per-user limits.", + "location": "query" + } + }, + "auth": { + "oauth2": { + "scopes": { + "https://www.googleapis.com/auth/ddmconversions": { + "description": "Manage DoubleClick Digital Marketing conversions" + }, + "https://www.googleapis.com/auth/dfareporting": { + "description": "View and manage DoubleClick for Advertisers reports" + }, + "https://www.googleapis.com/auth/dfatrafficking": { + "description": "View and manage your DoubleClick Campaign Manager's (DCM) display ad campaigns" + } + } + } + }, + "schemas": { + "Account": { + "id": "Account", + "type": "object", + "description": "Contains properties of a DCM account.", + "properties": { + "accountPermissionIds": { + "type": "array", + "description": "Account permissions assigned to this account.", + "items": { + "type": "string", + "format": "int64" + } + }, + "accountProfile": { + "type": "string", + "description": "Profile for this account. This is a read-only field that can be left blank.", + "enum": [ + "ACCOUNT_PROFILE_BASIC", + "ACCOUNT_PROFILE_STANDARD" + ], + "enumDescriptions": [ + "", + "" + ] + }, + "active": { + "type": "boolean", + "description": "Whether this account is active." + }, + "activeAdsLimitTier": { + "type": "string", + "description": "Maximum number of active ads allowed for this account.", + "enum": [ + "ACTIVE_ADS_TIER_100K", + "ACTIVE_ADS_TIER_200K", + "ACTIVE_ADS_TIER_300K", + "ACTIVE_ADS_TIER_40K", + "ACTIVE_ADS_TIER_500K", + "ACTIVE_ADS_TIER_750K", + "ACTIVE_ADS_TIER_75K" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "", + "", + "" + ] + }, + "activeViewOptOut": { + "type": "boolean", + "description": "Whether to serve creatives with Active View tags. If disabled, viewability data will not be available for any impressions." + }, + "availablePermissionIds": { + "type": "array", + "description": "User role permissions available to the user roles of this account.", + "items": { + "type": "string", + "format": "int64" + } + }, + "countryId": { + "type": "string", + "description": "ID of the country associated with this account.", + "format": "int64" + }, + "currencyId": { + "type": "string", + "description": "ID of currency associated with this account. This is a required field.\nAcceptable values are: \n- \"1\" for USD \n- \"2\" for GBP \n- \"3\" for ESP \n- \"4\" for SEK \n- \"5\" for CAD \n- \"6\" for JPY \n- \"7\" for DEM \n- \"8\" for AUD \n- \"9\" for FRF \n- \"10\" for ITL \n- \"11\" for DKK \n- \"12\" for NOK \n- \"13\" for FIM \n- \"14\" for ZAR \n- \"15\" for IEP \n- \"16\" for NLG \n- \"17\" for EUR \n- \"18\" for KRW \n- \"19\" for TWD \n- \"20\" for SGD \n- \"21\" for CNY \n- \"22\" for HKD \n- \"23\" for NZD \n- \"24\" for MYR \n- \"25\" for BRL \n- \"26\" for PTE \n- \"27\" for MXP \n- \"28\" for CLP \n- \"29\" for TRY \n- \"30\" for ARS \n- \"31\" for PEN \n- \"32\" for ILS \n- \"33\" for CHF \n- \"34\" for VEF \n- \"35\" for COP \n- \"36\" for GTQ \n- \"37\" for PLN \n- \"39\" for INR \n- \"40\" for THB \n- \"41\" for IDR \n- \"42\" for CZK \n- \"43\" for RON \n- \"44\" for HUF \n- \"45\" for RUB \n- \"46\" for AED \n- \"47\" for BGN \n- \"48\" for HRK", + "format": "int64" + }, + "defaultCreativeSizeId": { + "type": "string", + "description": "Default placement dimensions for this account.", + "format": "int64" + }, + "description": { + "type": "string", + "description": "Description of this account." + }, + "id": { + "type": "string", + "description": "ID of this account. This is a read-only, auto-generated field.", + "format": "int64" + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#account\".", + "default": "dfareporting#account" + }, + "locale": { + "type": "string", + "description": "Locale of this account.\nAcceptable values are: \n- \"cs\" (Czech) \n- \"de\" (German) \n- \"en\" (English) \n- \"en-GB\" (English United Kingdom) \n- \"es\" (Spanish) \n- \"fr\" (French) \n- \"it\" (Italian) \n- \"ja\" (Japanese) \n- \"ko\" (Korean) \n- \"pl\" (Polish) \n- \"pt-BR\" (Portuguese Brazil) \n- \"ru\" (Russian) \n- \"sv\" (Swedish) \n- \"tr\" (Turkish) \n- \"zh-CN\" (Chinese Simplified) \n- \"zh-TW\" (Chinese Traditional)" + }, + "maximumImageSize": { + "type": "string", + "description": "Maximum image size allowed for this account.", + "format": "int64" + }, + "name": { + "type": "string", + "description": "Name of this account. This is a required field, and must be less than 128 characters long and be globally unique." + }, + "nielsenOcrEnabled": { + "type": "boolean", + "description": "Whether campaigns created in this account will be enabled for Nielsen OCR reach ratings by default." + }, + "reportsConfiguration": { + "$ref": "ReportsConfiguration", + "description": "Reporting configuration of this account." + }, + "shareReportsWithTwitter": { + "type": "boolean", + "description": "Share Path to Conversion reports with Twitter." + }, + "teaserSizeLimit": { + "type": "string", + "description": "File size limit in kilobytes of Rich Media teaser creatives. Must be between 1 and 10240.", + "format": "int64" + } + } + }, + "AccountActiveAdSummary": { + "id": "AccountActiveAdSummary", + "type": "object", + "description": "Gets a summary of active ads in an account.", + "properties": { + "accountId": { + "type": "string", + "description": "ID of the account.", + "format": "int64" + }, + "activeAds": { + "type": "string", + "description": "Ads that have been activated for the account", + "format": "int64" + }, + "activeAdsLimitTier": { + "type": "string", + "description": "Maximum number of active ads allowed for the account.", + "enum": [ + "ACTIVE_ADS_TIER_100K", + "ACTIVE_ADS_TIER_200K", + "ACTIVE_ADS_TIER_300K", + "ACTIVE_ADS_TIER_40K", + "ACTIVE_ADS_TIER_500K", + "ACTIVE_ADS_TIER_750K", + "ACTIVE_ADS_TIER_75K" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "", + "", + "" + ] + }, + "availableAds": { + "type": "string", + "description": "Ads that can be activated for the account.", + "format": "int64" + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#accountActiveAdSummary\".", + "default": "dfareporting#accountActiveAdSummary" + } + } + }, + "AccountPermission": { + "id": "AccountPermission", + "type": "object", + "description": "AccountPermissions contains information about a particular account permission. Some features of DCM require an account permission to be present in the account.", + "properties": { + "accountProfiles": { + "type": "array", + "description": "Account profiles associated with this account permission.\n\nPossible values are:\n- \"ACCOUNT_PROFILE_BASIC\"\n- \"ACCOUNT_PROFILE_STANDARD\"", + "items": { + "type": "string", + "enum": [ + "ACCOUNT_PROFILE_BASIC", + "ACCOUNT_PROFILE_STANDARD" + ], + "enumDescriptions": [ + "", + "" + ] + } + }, + "id": { + "type": "string", + "description": "ID of this account permission.", + "format": "int64" + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#accountPermission\".", + "default": "dfareporting#accountPermission" + }, + "level": { + "type": "string", + "description": "Administrative level required to enable this account permission.", + "enum": [ + "ADMINISTRATOR", + "USER" + ], + "enumDescriptions": [ + "", + "" + ] + }, + "name": { + "type": "string", + "description": "Name of this account permission." + }, + "permissionGroupId": { + "type": "string", + "description": "Permission group of this account permission.", + "format": "int64" + } + } + }, + "AccountPermissionGroup": { + "id": "AccountPermissionGroup", + "type": "object", + "description": "AccountPermissionGroups contains a mapping of permission group IDs to names. A permission group is a grouping of account permissions.", + "properties": { + "id": { + "type": "string", + "description": "ID of this account permission group.", + "format": "int64" + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#accountPermissionGroup\".", + "default": "dfareporting#accountPermissionGroup" + }, + "name": { + "type": "string", + "description": "Name of this account permission group." + } + } + }, + "AccountPermissionGroupsListResponse": { + "id": "AccountPermissionGroupsListResponse", + "type": "object", + "description": "Account Permission Group List Response", + "properties": { + "accountPermissionGroups": { + "type": "array", + "description": "Account permission group collection.", + "items": { + "$ref": "AccountPermissionGroup" + } + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#accountPermissionGroupsListResponse\".", + "default": "dfareporting#accountPermissionGroupsListResponse" + } + } + }, + "AccountPermissionsListResponse": { + "id": "AccountPermissionsListResponse", + "type": "object", + "description": "Account Permission List Response", + "properties": { + "accountPermissions": { + "type": "array", + "description": "Account permission collection.", + "items": { + "$ref": "AccountPermission" + } + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#accountPermissionsListResponse\".", + "default": "dfareporting#accountPermissionsListResponse" + } + } + }, + "AccountUserProfile": { + "id": "AccountUserProfile", + "type": "object", + "description": "AccountUserProfiles contains properties of a DCM user profile. This resource is specifically for managing user profiles, whereas UserProfiles is for accessing the API.", + "properties": { + "accountId": { + "type": "string", + "description": "Account ID of the user profile. This is a read-only field that can be left blank.", + "format": "int64" + }, + "active": { + "type": "boolean", + "description": "Whether this user profile is active. This defaults to false, and must be set true on insert for the user profile to be usable." + }, + "advertiserFilter": { + "$ref": "ObjectFilter", + "description": "Filter that describes which advertisers are visible to the user profile." + }, + "campaignFilter": { + "$ref": "ObjectFilter", + "description": "Filter that describes which campaigns are visible to the user profile." + }, + "comments": { + "type": "string", + "description": "Comments for this user profile." + }, + "email": { + "type": "string", + "description": "Email of the user profile. The email addresss must be linked to a Google Account. This field is required on insertion and is read-only after insertion." + }, + "id": { + "type": "string", + "description": "ID of the user profile. This is a read-only, auto-generated field.", + "format": "int64" + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#accountUserProfile\".", + "default": "dfareporting#accountUserProfile" + }, + "locale": { + "type": "string", + "description": "Locale of the user profile. This is a required field.\nAcceptable values are: \n- \"cs\" (Czech) \n- \"de\" (German) \n- \"en\" (English) \n- \"en-GB\" (English United Kingdom) \n- \"es\" (Spanish) \n- \"fr\" (French) \n- \"it\" (Italian) \n- \"ja\" (Japanese) \n- \"ko\" (Korean) \n- \"pl\" (Polish) \n- \"pt-BR\" (Portuguese Brazil)\n- \"ru\" (Russian) \n- \"sv\" (Swedish) \n- \"tr\" (Turkish) \n- \"zh-CN\" (Chinese Simplified) \n- \"zh-TW\" (Chinese Traditional)" + }, + "name": { + "type": "string", + "description": "Name of the user profile. This is a required field. Must be less than 64 characters long, must be globally unique, and cannot contain whitespace or any of the following characters: \"&;\"#%,\"." + }, + "siteFilter": { + "$ref": "ObjectFilter", + "description": "Filter that describes which sites are visible to the user profile." + }, + "subaccountId": { + "type": "string", + "description": "Subaccount ID of the user profile. This is a read-only field that can be left blank.", + "format": "int64" + }, + "traffickerType": { + "type": "string", + "description": "Trafficker type of this user profile.", + "enum": [ + "EXTERNAL_TRAFFICKER", + "INTERNAL_NON_TRAFFICKER", + "INTERNAL_TRAFFICKER" + ], + "enumDescriptions": [ + "", + "", + "" + ] + }, + "userAccessType": { + "type": "string", + "description": "User type of the user profile. This is a read-only field that can be left blank.", + "enum": [ + "INTERNAL_ADMINISTRATOR", + "NORMAL_USER", + "READ_ONLY_SUPER_USER", + "SUPER_USER" + ], + "enumDescriptions": [ + "", + "", + "", + "" + ] + }, + "userRoleFilter": { + "$ref": "ObjectFilter", + "description": "Filter that describes which user roles are visible to the user profile." + }, + "userRoleId": { + "type": "string", + "description": "User role ID of the user profile. This is a required field.", + "format": "int64" + } + } + }, + "AccountUserProfilesListResponse": { + "id": "AccountUserProfilesListResponse", + "type": "object", + "description": "Account User Profile List Response", + "properties": { + "accountUserProfiles": { + "type": "array", + "description": "Account user profile collection.", + "items": { + "$ref": "AccountUserProfile" + } + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#accountUserProfilesListResponse\".", + "default": "dfareporting#accountUserProfilesListResponse" + }, + "nextPageToken": { + "type": "string", + "description": "Pagination token to be used for the next list operation." + } + } + }, + "AccountsListResponse": { + "id": "AccountsListResponse", + "type": "object", + "description": "Account List Response", + "properties": { + "accounts": { + "type": "array", + "description": "Account collection.", + "items": { + "$ref": "Account" + } + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#accountsListResponse\".", + "default": "dfareporting#accountsListResponse" + }, + "nextPageToken": { + "type": "string", + "description": "Pagination token to be used for the next list operation." + } + } + }, + "Activities": { + "id": "Activities", + "type": "object", + "description": "Represents an activity group.", + "properties": { + "filters": { + "type": "array", + "description": "List of activity filters. The dimension values need to be all either of type \"dfa:activity\" or \"dfa:activityGroup\".", + "items": { + "$ref": "DimensionValue" + } + }, + "kind": { + "type": "string", + "description": "The kind of resource this is, in this case dfareporting#activities.", + "default": "dfareporting#activities" + }, + "metricNames": { + "type": "array", + "description": "List of names of floodlight activity metrics.", + "items": { + "type": "string" + } + } + } + }, + "Ad": { + "id": "Ad", + "type": "object", + "description": "Contains properties of a DCM ad.", + "properties": { + "accountId": { + "type": "string", + "description": "Account ID of this ad. This is a read-only field that can be left blank.", + "format": "int64" + }, + "active": { + "type": "boolean", + "description": "Whether this ad is active. When true, archived must be false." + }, + "advertiserId": { + "type": "string", + "description": "Advertiser ID of this ad. This is a required field on insertion.", + "format": "int64" + }, + "advertiserIdDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the ID of the advertiser. This is a read-only, auto-generated field." + }, + "archived": { + "type": "boolean", + "description": "Whether this ad is archived. When true, active must be false." + }, + "audienceSegmentId": { + "type": "string", + "description": "Audience segment ID that is being targeted for this ad. Applicable when type is AD_SERVING_STANDARD_AD.", + "format": "int64" + }, + "campaignId": { + "type": "string", + "description": "Campaign ID of this ad. This is a required field on insertion.", + "format": "int64" + }, + "campaignIdDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the ID of the campaign. This is a read-only, auto-generated field." + }, + "clickThroughUrl": { + "$ref": "ClickThroughUrl", + "description": "Click-through URL for this ad. This is a required field on insertion. Applicable when type is AD_SERVING_CLICK_TRACKER." + }, + "clickThroughUrlSuffixProperties": { + "$ref": "ClickThroughUrlSuffixProperties", + "description": "Click-through URL suffix properties for this ad. Applies to the URL in the ad or (if overriding ad properties) the URL in the creative." + }, + "comments": { + "type": "string", + "description": "Comments for this ad." + }, + "compatibility": { + "type": "string", + "description": "Compatibility of this ad. Applicable when type is AD_SERVING_DEFAULT_AD. DISPLAY and DISPLAY_INTERSTITIAL refer to either rendering on desktop or on mobile devices or in mobile apps for regular or interstitial ads, respectively. APP and APP_INTERSTITIAL are only used for existing default ads. New mobile placements must be assigned DISPLAY or DISPLAY_INTERSTITIAL and default ads created for those placements will be limited to those compatibility types. IN_STREAM_VIDEO refers to rendering in-stream video ads developed with the VAST standard.", + "enum": [ + "APP", + "APP_INTERSTITIAL", + "DISPLAY", + "DISPLAY_INTERSTITIAL", + "IN_STREAM_VIDEO" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "" + ] + }, + "createInfo": { + "$ref": "LastModifiedInfo", + "description": "Information about the creation of this ad. This is a read-only field." + }, + "creativeGroupAssignments": { + "type": "array", + "description": "Creative group assignments for this ad. Applicable when type is AD_SERVING_CLICK_TRACKER. Only one assignment per creative group number is allowed for a maximum of two assignments.", + "items": { + "$ref": "CreativeGroupAssignment" + } + }, + "creativeRotation": { + "$ref": "CreativeRotation", + "description": "Creative rotation for this ad. Applicable when type is AD_SERVING_DEFAULT_AD, AD_SERVING_STANDARD_AD, or AD_SERVING_TRACKING. When type is AD_SERVING_DEFAULT_AD, this field should have exactly one creativeAssignment." + }, + "dayPartTargeting": { + "$ref": "DayPartTargeting", + "description": "Time and day targeting information for this ad. This field must be left blank if the ad is using a targeting template. Applicable when type is AD_SERVING_STANDARD_AD." + }, + "defaultClickThroughEventTagProperties": { + "$ref": "DefaultClickThroughEventTagProperties", + "description": "Default click-through event tag properties for this ad." + }, + "deliverySchedule": { + "$ref": "DeliverySchedule", + "description": "Delivery schedule information for this ad. Applicable when type is AD_SERVING_STANDARD_AD or AD_SERVING_TRACKING. This field along with subfields priority and impressionRatio are required on insertion when type is AD_SERVING_STANDARD_AD." + }, + "dynamicClickTracker": { + "type": "boolean", + "description": "Whether this ad is a dynamic click tracker. Applicable when type is AD_SERVING_CLICK_TRACKER. This is a required field on insert, and is read-only after insert." + }, + "endTime": { + "type": "string", + "description": "Date and time that this ad should stop serving. Must be later than the start time. This is a required field on insertion.", + "format": "date-time" + }, + "eventTagOverrides": { + "type": "array", + "description": "Event tag overrides for this ad.", + "items": { + "$ref": "EventTagOverride" + } + }, + "geoTargeting": { + "$ref": "GeoTargeting", + "description": "Geographical targeting information for this ad. This field must be left blank if the ad is using a targeting template. Applicable when type is AD_SERVING_STANDARD_AD." + }, + "id": { + "type": "string", + "description": "ID of this ad. This is a read-only, auto-generated field.", + "format": "int64" + }, + "idDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the ID of this ad. This is a read-only, auto-generated field." + }, + "keyValueTargetingExpression": { + "$ref": "KeyValueTargetingExpression", + "description": "Key-value targeting information for this ad. This field must be left blank if the ad is using a targeting template. Applicable when type is AD_SERVING_STANDARD_AD." + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#ad\".", + "default": "dfareporting#ad" + }, + "languageTargeting": { + "$ref": "LanguageTargeting", + "description": "Language targeting information for this ad. This field must be left blank if the ad is using a targeting template. Applicable when type is AD_SERVING_STANDARD_AD." + }, + "lastModifiedInfo": { + "$ref": "LastModifiedInfo", + "description": "Information about the most recent modification of this ad. This is a read-only field." + }, + "name": { + "type": "string", + "description": "Name of this ad. This is a required field and must be less than 256 characters long." + }, + "placementAssignments": { + "type": "array", + "description": "Placement assignments for this ad.", + "items": { + "$ref": "PlacementAssignment" + } + }, + "remarketingListExpression": { + "$ref": "ListTargetingExpression", + "description": "Remarketing list targeting expression for this ad. This field must be left blank if the ad is using a targeting template. Applicable when type is AD_SERVING_STANDARD_AD." + }, + "size": { + "$ref": "Size", + "description": "Size of this ad. Applicable when type is AD_SERVING_DEFAULT_AD." + }, + "sslCompliant": { + "type": "boolean", + "description": "Whether this ad is ssl compliant. This is a read-only field that is auto-generated when the ad is inserted or updated." + }, + "sslRequired": { + "type": "boolean", + "description": "Whether this ad requires ssl. This is a read-only field that is auto-generated when the ad is inserted or updated." + }, + "startTime": { + "type": "string", + "description": "Date and time that this ad should start serving. If creating an ad, this field must be a time in the future. This is a required field on insertion.", + "format": "date-time" + }, + "subaccountId": { + "type": "string", + "description": "Subaccount ID of this ad. This is a read-only field that can be left blank.", + "format": "int64" + }, + "targetingTemplateId": { + "type": "string", + "description": "Targeting template ID, used to apply preconfigured targeting information to this ad. This cannot be set while any of dayPartTargeting, geoTargeting, keyValueTargetingExpression, languageTargeting, remarketingListExpression, or technologyTargeting are set. Applicable when type is AD_SERVING_STANDARD_AD.", + "format": "int64" + }, + "technologyTargeting": { + "$ref": "TechnologyTargeting", + "description": "Technology platform targeting information for this ad. This field must be left blank if the ad is using a targeting template. Applicable when type is AD_SERVING_STANDARD_AD." + }, + "type": { + "type": "string", + "description": "Type of ad. This is a required field on insertion. Note that default ads (AD_SERVING_DEFAULT_AD) cannot be created directly (see Creative resource).", + "enum": [ + "AD_SERVING_CLICK_TRACKER", + "AD_SERVING_DEFAULT_AD", + "AD_SERVING_STANDARD_AD", + "AD_SERVING_TRACKING" + ], + "enumDescriptions": [ + "", + "", + "", + "" + ] + } + } + }, + "AdSlot": { + "id": "AdSlot", + "type": "object", + "description": "Ad Slot", + "properties": { + "comment": { + "type": "string", + "description": "Comment for this ad slot." + }, + "compatibility": { + "type": "string", + "description": "Ad slot compatibility. DISPLAY and DISPLAY_INTERSTITIAL refer to rendering either on desktop, mobile devices or in mobile apps for regular or interstitial ads respectively. APP and APP_INTERSTITIAL are for rendering in mobile apps. IN_STREAM_VIDEO refers to rendering in in-stream video ads developed with the VAST standard.", + "enum": [ + "APP", + "APP_INTERSTITIAL", + "DISPLAY", + "DISPLAY_INTERSTITIAL", + "IN_STREAM_VIDEO" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "" + ] + }, + "height": { + "type": "string", + "description": "Height of this ad slot.", + "format": "int64" + }, + "linkedPlacementId": { + "type": "string", + "description": "ID of the placement from an external platform that is linked to this ad slot.", + "format": "int64" + }, + "name": { + "type": "string", + "description": "Name of this ad slot." + }, + "paymentSourceType": { + "type": "string", + "description": "Payment source type of this ad slot.", + "enum": [ + "PLANNING_PAYMENT_SOURCE_TYPE_AGENCY_PAID", + "PLANNING_PAYMENT_SOURCE_TYPE_PUBLISHER_PAID" + ], + "enumDescriptions": [ + "", + "" + ] + }, + "primary": { + "type": "boolean", + "description": "Primary ad slot of a roadblock inventory item." + }, + "width": { + "type": "string", + "description": "Width of this ad slot.", + "format": "int64" + } + } + }, + "AdsListResponse": { + "id": "AdsListResponse", + "type": "object", + "description": "Ad List Response", + "properties": { + "ads": { + "type": "array", + "description": "Ad collection.", + "items": { + "$ref": "Ad" + } + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#adsListResponse\".", + "default": "dfareporting#adsListResponse" + }, + "nextPageToken": { + "type": "string", + "description": "Pagination token to be used for the next list operation." + } + } + }, + "Advertiser": { + "id": "Advertiser", + "type": "object", + "description": "Contains properties of a DCM advertiser.", + "properties": { + "accountId": { + "type": "string", + "description": "Account ID of this advertiser.This is a read-only field that can be left blank.", + "format": "int64" + }, + "advertiserGroupId": { + "type": "string", + "description": "ID of the advertiser group this advertiser belongs to. You can group advertisers for reporting purposes, allowing you to see aggregated information for all advertisers in each group.", + "format": "int64" + }, + "clickThroughUrlSuffix": { + "type": "string", + "description": "Suffix added to click-through URL of ad creative associations under this advertiser. Must be less than 129 characters long." + }, + "defaultClickThroughEventTagId": { + "type": "string", + "description": "ID of the click-through event tag to apply by default to the landing pages of this advertiser's campaigns.", + "format": "int64" + }, + "defaultEmail": { + "type": "string", + "description": "Default email address used in sender field for tag emails." + }, + "floodlightConfigurationId": { + "type": "string", + "description": "Floodlight configuration ID of this advertiser. The floodlight configuration ID will be created automatically, so on insert this field should be left blank. This field can be set to another advertiser's floodlight configuration ID in order to share that advertiser's floodlight configuration with this advertiser, so long as: \n- This advertiser's original floodlight configuration is not already associated with floodlight activities or floodlight activity groups. \n- This advertiser's original floodlight configuration is not already shared with another advertiser.", + "format": "int64" + }, + "floodlightConfigurationIdDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the ID of the floodlight configuration. This is a read-only, auto-generated field." + }, + "id": { + "type": "string", + "description": "ID of this advertiser. This is a read-only, auto-generated field.", + "format": "int64" + }, + "idDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the ID of this advertiser. This is a read-only, auto-generated field." + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#advertiser\".", + "default": "dfareporting#advertiser" + }, + "name": { + "type": "string", + "description": "Name of this advertiser. This is a required field and must be less than 256 characters long and unique among advertisers of the same account." + }, + "originalFloodlightConfigurationId": { + "type": "string", + "description": "Original floodlight configuration before any sharing occurred. Set the floodlightConfigurationId of this advertiser to originalFloodlightConfigurationId to unshare the advertiser's current floodlight configuration. You cannot unshare an advertiser's floodlight configuration if the shared configuration has activities associated with any campaign or placement.", + "format": "int64" + }, + "status": { + "type": "string", + "description": "Status of this advertiser.", + "enum": [ + "APPROVED", + "ON_HOLD" + ], + "enumDescriptions": [ + "", + "" + ] + }, + "subaccountId": { + "type": "string", + "description": "Subaccount ID of this advertiser.This is a read-only field that can be left blank.", + "format": "int64" + }, + "suspended": { + "type": "boolean", + "description": "Suspension status of this advertiser." + } + } + }, + "AdvertiserGroup": { + "id": "AdvertiserGroup", + "type": "object", + "description": "Groups advertisers together so that reports can be generated for the entire group at once.", + "properties": { + "accountId": { + "type": "string", + "description": "Account ID of this advertiser group. This is a read-only field that can be left blank.", + "format": "int64" + }, + "id": { + "type": "string", + "description": "ID of this advertiser group. This is a read-only, auto-generated field.", + "format": "int64" + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#advertiserGroup\".", + "default": "dfareporting#advertiserGroup" + }, + "name": { + "type": "string", + "description": "Name of this advertiser group. This is a required field and must be less than 256 characters long and unique among advertiser groups of the same account." + } + } + }, + "AdvertiserGroupsListResponse": { + "id": "AdvertiserGroupsListResponse", + "type": "object", + "description": "Advertiser Group List Response", + "properties": { + "advertiserGroups": { + "type": "array", + "description": "Advertiser group collection.", + "items": { + "$ref": "AdvertiserGroup" + } + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#advertiserGroupsListResponse\".", + "default": "dfareporting#advertiserGroupsListResponse" + }, + "nextPageToken": { + "type": "string", + "description": "Pagination token to be used for the next list operation." + } + } + }, + "AdvertisersListResponse": { + "id": "AdvertisersListResponse", + "type": "object", + "description": "Advertiser List Response", + "properties": { + "advertisers": { + "type": "array", + "description": "Advertiser collection.", + "items": { + "$ref": "Advertiser" + } + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#advertisersListResponse\".", + "default": "dfareporting#advertisersListResponse" + }, + "nextPageToken": { + "type": "string", + "description": "Pagination token to be used for the next list operation." + } + } + }, + "AudienceSegment": { + "id": "AudienceSegment", + "type": "object", + "description": "Audience Segment.", + "properties": { + "allocation": { + "type": "integer", + "description": "Weight allocated to this segment. Must be between 1 and 1000. The weight assigned will be understood in proportion to the weights assigned to other segments in the same segment group.", + "format": "int32" + }, + "id": { + "type": "string", + "description": "ID of this audience segment. This is a read-only, auto-generated field.", + "format": "int64" + }, + "name": { + "type": "string", + "description": "Name of this audience segment. This is a required field and must be less than 65 characters long." + } + } + }, + "AudienceSegmentGroup": { + "id": "AudienceSegmentGroup", + "type": "object", + "description": "Audience Segment Group.", + "properties": { + "audienceSegments": { + "type": "array", + "description": "Audience segments assigned to this group. The number of segments must be between 2 and 100.", + "items": { + "$ref": "AudienceSegment" + } + }, + "id": { + "type": "string", + "description": "ID of this audience segment group. This is a read-only, auto-generated field.", + "format": "int64" + }, + "name": { + "type": "string", + "description": "Name of this audience segment group. This is a required field and must be less than 65 characters long." + } + } + }, + "Browser": { + "id": "Browser", + "type": "object", + "description": "Contains information about a browser that can be targeted by ads.", + "properties": { + "browserVersionId": { + "type": "string", + "description": "ID referring to this grouping of browser and version numbers. This is the ID used for targeting.", + "format": "int64" + }, + "dartId": { + "type": "string", + "description": "DART ID of this browser. This is the ID used when generating reports.", + "format": "int64" + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#browser\".", + "default": "dfareporting#browser" + }, + "majorVersion": { + "type": "string", + "description": "Major version number (leftmost number) of this browser. For example, for Chrome 5.0.376.86 beta, this field should be set to 5. An asterisk (*) may be used to target any version number, and a question mark (?) may be used to target cases where the version number cannot be identified. For example, Chrome *.* targets any version of Chrome: 1.2, 2.5, 3.5, and so on. Chrome 3.* targets Chrome 3.1, 3.5, but not 4.0. Firefox ?.? targets cases where the ad server knows the browser is Firefox but can't tell which version it is." + }, + "minorVersion": { + "type": "string", + "description": "Minor version number (number after first dot on left) of this browser. For example, for Chrome 5.0.375.86 beta, this field should be set to 0. An asterisk (*) may be used to target any version number, and a question mark (?) may be used to target cases where the version number cannot be identified. For example, Chrome *.* targets any version of Chrome: 1.2, 2.5, 3.5, and so on. Chrome 3.* targets Chrome 3.1, 3.5, but not 4.0. Firefox ?.? targets cases where the ad server knows the browser is Firefox but can't tell which version it is." + }, + "name": { + "type": "string", + "description": "Name of this browser." + } + } + }, + "BrowsersListResponse": { + "id": "BrowsersListResponse", + "type": "object", + "description": "Browser List Response", + "properties": { + "browsers": { + "type": "array", + "description": "Browser collection.", + "items": { + "$ref": "Browser" + } + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#browsersListResponse\".", + "default": "dfareporting#browsersListResponse" + } + } + }, + "Campaign": { + "id": "Campaign", + "type": "object", + "description": "Contains properties of a DCM campaign.", + "properties": { + "accountId": { + "type": "string", + "description": "Account ID of this campaign. This is a read-only field that can be left blank.", + "format": "int64" + }, + "additionalCreativeOptimizationConfigurations": { + "type": "array", + "description": "Additional creative optimization configurations for the campaign.", + "items": { + "$ref": "CreativeOptimizationConfiguration" + } + }, + "advertiserGroupId": { + "type": "string", + "description": "Advertiser group ID of the associated advertiser.", + "format": "int64" + }, + "advertiserId": { + "type": "string", + "description": "Advertiser ID of this campaign. This is a required field.", + "format": "int64" + }, + "advertiserIdDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the advertiser ID of this campaign. This is a read-only, auto-generated field." + }, + "archived": { + "type": "boolean", + "description": "Whether this campaign has been archived." + }, + "audienceSegmentGroups": { + "type": "array", + "description": "Audience segment groups assigned to this campaign. Cannot have more than 300 segment groups.", + "items": { + "$ref": "AudienceSegmentGroup" + } + }, + "billingInvoiceCode": { + "type": "string", + "description": "Billing invoice code included in the DCM client billing invoices associated with the campaign." + }, + "clickThroughUrlSuffixProperties": { + "$ref": "ClickThroughUrlSuffixProperties", + "description": "Click-through URL suffix override properties for this campaign." + }, + "comment": { + "type": "string", + "description": "Arbitrary comments about this campaign. Must be less than 256 characters long." + }, + "createInfo": { + "$ref": "LastModifiedInfo", + "description": "Information about the creation of this campaign. This is a read-only field." + }, + "creativeGroupIds": { + "type": "array", + "description": "List of creative group IDs that are assigned to the campaign.", + "items": { + "type": "string", + "format": "int64" + } + }, + "creativeOptimizationConfiguration": { + "$ref": "CreativeOptimizationConfiguration", + "description": "Creative optimization configuration for the campaign." + }, + "defaultClickThroughEventTagProperties": { + "$ref": "DefaultClickThroughEventTagProperties", + "description": "Click-through event tag ID override properties for this campaign." + }, + "endDate": { + "type": "string", + "description": "Date on which the campaign will stop running. On insert, the end date must be today or a future date. The end date must be later than or be the same as the start date. If, for example, you set 6/25/2015 as both the start and end dates, the effective campaign run date is just that day only, 6/25/2015. The hours, minutes, and seconds of the end date should not be set, as doing so will result in an error. This is a required field.", + "format": "date" + }, + "eventTagOverrides": { + "type": "array", + "description": "Overrides that can be used to activate or deactivate advertiser event tags.", + "items": { + "$ref": "EventTagOverride" + } + }, + "externalId": { + "type": "string", + "description": "External ID for this campaign." + }, + "id": { + "type": "string", + "description": "ID of this campaign. This is a read-only auto-generated field.", + "format": "int64" + }, + "idDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the ID of this campaign. This is a read-only, auto-generated field." + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#campaign\".", + "default": "dfareporting#campaign" + }, + "lastModifiedInfo": { + "$ref": "LastModifiedInfo", + "description": "Information about the most recent modification of this campaign. This is a read-only field." + }, + "lookbackConfiguration": { + "$ref": "LookbackConfiguration", + "description": "Lookback window settings for the campaign." + }, + "name": { + "type": "string", + "description": "Name of this campaign. This is a required field and must be less than 256 characters long and unique among campaigns of the same advertiser." + }, + "nielsenOcrEnabled": { + "type": "boolean", + "description": "Whether Nielsen reports are enabled for this campaign." + }, + "startDate": { + "type": "string", + "description": "Date on which the campaign starts running. The start date can be any date. The hours, minutes, and seconds of the start date should not be set, as doing so will result in an error. This is a required field.", + "format": "date" + }, + "subaccountId": { + "type": "string", + "description": "Subaccount ID of this campaign. This is a read-only field that can be left blank.", + "format": "int64" + }, + "traffickerEmails": { + "type": "array", + "description": "Campaign trafficker contact emails.", + "items": { + "type": "string" + } + } + } + }, + "CampaignCreativeAssociation": { + "id": "CampaignCreativeAssociation", + "type": "object", + "description": "Identifies a creative which has been associated with a given campaign.", + "properties": { + "creativeId": { + "type": "string", + "description": "ID of the creative associated with the campaign. This is a required field.", + "format": "int64" + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#campaignCreativeAssociation\".", + "default": "dfareporting#campaignCreativeAssociation" + } + } + }, + "CampaignCreativeAssociationsListResponse": { + "id": "CampaignCreativeAssociationsListResponse", + "type": "object", + "description": "Campaign Creative Association List Response", + "properties": { + "campaignCreativeAssociations": { + "type": "array", + "description": "Campaign creative association collection", + "items": { + "$ref": "CampaignCreativeAssociation" + } + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#campaignCreativeAssociationsListResponse\".", + "default": "dfareporting#campaignCreativeAssociationsListResponse" + }, + "nextPageToken": { + "type": "string", + "description": "Pagination token to be used for the next list operation." + } + } + }, + "CampaignsListResponse": { + "id": "CampaignsListResponse", + "type": "object", + "description": "Campaign List Response", + "properties": { + "campaigns": { + "type": "array", + "description": "Campaign collection.", + "items": { + "$ref": "Campaign" + } + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#campaignsListResponse\".", + "default": "dfareporting#campaignsListResponse" + }, + "nextPageToken": { + "type": "string", + "description": "Pagination token to be used for the next list operation." + } + } + }, + "ChangeLog": { + "id": "ChangeLog", + "type": "object", + "description": "Describes a change that a user has made to a resource.", + "properties": { + "accountId": { + "type": "string", + "description": "Account ID of the modified object.", + "format": "int64" + }, + "action": { + "type": "string", + "description": "Action which caused the change." + }, + "changeTime": { + "type": "string", + "description": "Time when the object was modified.", + "format": "date-time" + }, + "fieldName": { + "type": "string", + "description": "Field name of the object which changed." + }, + "id": { + "type": "string", + "description": "ID of this change log.", + "format": "int64" + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#changeLog\".", + "default": "dfareporting#changeLog" + }, + "newValue": { + "type": "string", + "description": "New value of the object field." + }, + "objectId": { + "type": "string", + "description": "ID of the object of this change log. The object could be a campaign, placement, ad, or other type.", + "format": "int64" + }, + "objectType": { + "type": "string", + "description": "Object type of the change log." + }, + "oldValue": { + "type": "string", + "description": "Old value of the object field." + }, + "subaccountId": { + "type": "string", + "description": "Subaccount ID of the modified object.", + "format": "int64" + }, + "transactionId": { + "type": "string", + "description": "Transaction ID of this change log. When a single API call results in many changes, each change will have a separate ID in the change log but will share the same transactionId.", + "format": "int64" + }, + "userProfileId": { + "type": "string", + "description": "ID of the user who modified the object.", + "format": "int64" + }, + "userProfileName": { + "type": "string", + "description": "User profile name of the user who modified the object." + } + } + }, + "ChangeLogsListResponse": { + "id": "ChangeLogsListResponse", + "type": "object", + "description": "Change Log List Response", + "properties": { + "changeLogs": { + "type": "array", + "description": "Change log collection.", + "items": { + "$ref": "ChangeLog" + } + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#changeLogsListResponse\".", + "default": "dfareporting#changeLogsListResponse" + }, + "nextPageToken": { + "type": "string", + "description": "Pagination token to be used for the next list operation." + } + } + }, + "CitiesListResponse": { + "id": "CitiesListResponse", + "type": "object", + "description": "City List Response", + "properties": { + "cities": { + "type": "array", + "description": "City collection.", + "items": { + "$ref": "City" + } + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#citiesListResponse\".", + "default": "dfareporting#citiesListResponse" + } + } + }, + "City": { + "id": "City", + "type": "object", + "description": "Contains information about a city that can be targeted by ads.", + "properties": { + "countryCode": { + "type": "string", + "description": "Country code of the country to which this city belongs." + }, + "countryDartId": { + "type": "string", + "description": "DART ID of the country to which this city belongs.", + "format": "int64" + }, + "dartId": { + "type": "string", + "description": "DART ID of this city. This is the ID used for targeting and generating reports.", + "format": "int64" + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#city\".", + "default": "dfareporting#city" + }, + "metroCode": { + "type": "string", + "description": "Metro region code of the metro region (DMA) to which this city belongs." + }, + "metroDmaId": { + "type": "string", + "description": "ID of the metro region (DMA) to which this city belongs.", + "format": "int64" + }, + "name": { + "type": "string", + "description": "Name of this city." + }, + "regionCode": { + "type": "string", + "description": "Region code of the region to which this city belongs." + }, + "regionDartId": { + "type": "string", + "description": "DART ID of the region to which this city belongs.", + "format": "int64" + } + } + }, + "ClickTag": { + "id": "ClickTag", + "type": "object", + "description": "Creative Click Tag.", + "properties": { + "eventName": { + "type": "string", + "description": "Advertiser event name associated with the click tag. This field is used by DISPLAY_IMAGE_GALLERY and HTML5_BANNER creatives. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE." + }, + "name": { + "type": "string", + "description": "Parameter name for the specified click tag. For DISPLAY_IMAGE_GALLERY creative assets, this field must match the value of the creative asset's creativeAssetId.name field." + }, + "value": { + "type": "string", + "description": "Parameter value for the specified click tag. This field contains a click-through url." + } + } + }, + "ClickThroughUrl": { + "id": "ClickThroughUrl", + "type": "object", + "description": "Click-through URL", + "properties": { + "computedClickThroughUrl": { + "type": "string", + "description": "Read-only convenience field representing the actual URL that will be used for this click-through. The URL is computed as follows: \n- If defaultLandingPage is enabled then the campaign's default landing page URL is assigned to this field.\n- If defaultLandingPage is not enabled and a landingPageId is specified then that landing page's URL is assigned to this field.\n- If neither of the above cases apply, then the customClickThroughUrl is assigned to this field." + }, + "customClickThroughUrl": { + "type": "string", + "description": "Custom click-through URL. Applicable if the defaultLandingPage field is set to false and the landingPageId field is left unset." + }, + "defaultLandingPage": { + "type": "boolean", + "description": "Whether the campaign default landing page is used." + }, + "landingPageId": { + "type": "string", + "description": "ID of the landing page for the click-through URL. Applicable if the defaultLandingPage field is set to false.", + "format": "int64" + } + } + }, + "ClickThroughUrlSuffixProperties": { + "id": "ClickThroughUrlSuffixProperties", + "type": "object", + "description": "Click Through URL Suffix settings.", + "properties": { + "clickThroughUrlSuffix": { + "type": "string", + "description": "Click-through URL suffix to apply to all ads in this entity's scope. Must be less than 128 characters long." + }, + "overrideInheritedSuffix": { + "type": "boolean", + "description": "Whether this entity should override the inherited click-through URL suffix with its own defined value." + } + } + }, + "CompanionClickThroughOverride": { + "id": "CompanionClickThroughOverride", + "type": "object", + "description": "Companion Click-through override.", + "properties": { + "clickThroughUrl": { + "$ref": "ClickThroughUrl", + "description": "Click-through URL of this companion click-through override." + }, + "creativeId": { + "type": "string", + "description": "ID of the creative for this companion click-through override.", + "format": "int64" + } + } + }, + "CompanionSetting": { + "id": "CompanionSetting", + "type": "object", + "description": "Companion Settings", + "properties": { + "companionsDisabled": { + "type": "boolean", + "description": "Whether companions are disabled for this placement." + }, + "enabledSizes": { + "type": "array", + "description": "Whitelist of companion sizes to be served to this placement. Set this list to null or empty to serve all companion sizes.", + "items": { + "$ref": "Size" + } + }, + "imageOnly": { + "type": "boolean", + "description": "Whether to serve only static images as companions." + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#companionSetting\".", + "default": "dfareporting#companionSetting" + } + } + }, + "CompatibleFields": { + "id": "CompatibleFields", + "type": "object", + "description": "Represents a response to the queryCompatibleFields method.", + "properties": { + "crossDimensionReachReportCompatibleFields": { + "$ref": "CrossDimensionReachReportCompatibleFields", + "description": "Contains items that are compatible to be selected for a report of type \"CROSS_DIMENSION_REACH\"." + }, + "floodlightReportCompatibleFields": { + "$ref": "FloodlightReportCompatibleFields", + "description": "Contains items that are compatible to be selected for a report of type \"FLOODLIGHT\"." + }, + "kind": { + "type": "string", + "description": "The kind of resource this is, in this case dfareporting#compatibleFields.", + "default": "dfareporting#compatibleFields" + }, + "pathToConversionReportCompatibleFields": { + "$ref": "PathToConversionReportCompatibleFields", + "description": "Contains items that are compatible to be selected for a report of type \"PATH_TO_CONVERSION\"." + }, + "reachReportCompatibleFields": { + "$ref": "ReachReportCompatibleFields", + "description": "Contains items that are compatible to be selected for a report of type \"REACH\"." + }, + "reportCompatibleFields": { + "$ref": "ReportCompatibleFields", + "description": "Contains items that are compatible to be selected for a report of type \"STANDARD\"." + } + } + }, + "ConnectionType": { + "id": "ConnectionType", + "type": "object", + "description": "Contains information about an internet connection type that can be targeted by ads. Clients can use the connection type to target mobile vs. broadband users.", + "properties": { + "id": { + "type": "string", + "description": "ID of this connection type.", + "format": "int64" + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#connectionType\".", + "default": "dfareporting#connectionType" + }, + "name": { + "type": "string", + "description": "Name of this connection type." + } + } + }, + "ConnectionTypesListResponse": { + "id": "ConnectionTypesListResponse", + "type": "object", + "description": "Connection Type List Response", + "properties": { + "connectionTypes": { + "type": "array", + "description": "Collection of connection types such as broadband and mobile.", + "items": { + "$ref": "ConnectionType" + } + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#connectionTypesListResponse\".", + "default": "dfareporting#connectionTypesListResponse" + } + } + }, + "ContentCategoriesListResponse": { + "id": "ContentCategoriesListResponse", + "type": "object", + "description": "Content Category List Response", + "properties": { + "contentCategories": { + "type": "array", + "description": "Content category collection.", + "items": { + "$ref": "ContentCategory" + } + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#contentCategoriesListResponse\".", + "default": "dfareporting#contentCategoriesListResponse" + }, + "nextPageToken": { + "type": "string", + "description": "Pagination token to be used for the next list operation." + } + } + }, + "ContentCategory": { + "id": "ContentCategory", + "type": "object", + "description": "Organizes placements according to the contents of their associated webpages.", + "properties": { + "accountId": { + "type": "string", + "description": "Account ID of this content category. This is a read-only field that can be left blank.", + "format": "int64" + }, + "id": { + "type": "string", + "description": "ID of this content category. This is a read-only, auto-generated field.", + "format": "int64" + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#contentCategory\".", + "default": "dfareporting#contentCategory" + }, + "name": { + "type": "string", + "description": "Name of this content category. This is a required field and must be less than 256 characters long and unique among content categories of the same account." + } + } + }, + "Conversion": { + "id": "Conversion", + "type": "object", + "description": "A Conversion represents when a user successfully performs a desired action after seeing an ad.", + "properties": { + "childDirectedTreatment": { + "type": "boolean", + "description": "Whether the conversion was directed toward children." + }, + "customVariables": { + "type": "array", + "description": "Custom floodlight variables.", + "items": { + "$ref": "CustomFloodlightVariable" + } + }, + "encryptedUserId": { + "type": "string", + "description": "The alphanumeric encrypted user ID. When set, encryptionInfo should also be specified. This field is mutually exclusive with encryptedUserIdCandidates[] and mobileDeviceId. This or encryptedUserIdCandidates[] or mobileDeviceId is a required field." + }, + "encryptedUserIdCandidates": { + "type": "array", + "description": "A list of the alphanumeric encrypted user IDs. Any user ID with exposure prior to the conversion timestamp will be used in the inserted conversion. If no such user ID is found then the conversion will be rejected with NO_COOKIE_MATCH_FOUND error. When set, encryptionInfo should also be specified. This field should only be used when calling conversions.batchinsert. This field is mutually exclusive with encryptedUserId and mobileDeviceId. This or encryptedUserId or mobileDeviceId is a required field.", + "items": { + "type": "string" + } + }, + "floodlightActivityId": { + "type": "string", + "description": "Floodlight Activity ID of this conversion. This is a required field.", + "format": "int64" + }, + "floodlightConfigurationId": { + "type": "string", + "description": "Floodlight Configuration ID of this conversion. This is a required field.", + "format": "int64" + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#conversion\".", + "default": "dfareporting#conversion" + }, + "limitAdTracking": { + "type": "boolean", + "description": "Whether Limit Ad Tracking is enabled. When set to true, the conversion will be used for reporting but not targeting. This will prevent remarketing." + }, + "mobileDeviceId": { + "type": "string", + "description": "The mobile device ID. This field is mutually exclusive with encryptedUserId and encryptedUserIdCandidates[]. This or encryptedUserId or encryptedUserIdCandidates[] is a required field." + }, + "ordinal": { + "type": "string", + "description": "The ordinal of the conversion. Use this field to control how conversions of the same user and day are de-duplicated. This is a required field." + }, + "quantity": { + "type": "string", + "description": "The quantity of the conversion.", + "format": "int64" + }, + "timestampMicros": { + "type": "string", + "description": "The timestamp of conversion, in Unix epoch micros. This is a required field.", + "format": "int64" + }, + "value": { + "type": "number", + "description": "The value of the conversion.", + "format": "double" + } + } + }, + "ConversionError": { + "id": "ConversionError", + "type": "object", + "description": "The error code and description for a conversion that failed to insert or update.", + "properties": { + "code": { + "type": "string", + "description": "The error code.", + "enum": [ + "INTERNAL", + "INVALID_ARGUMENT", + "NOT_FOUND", + "PERMISSION_DENIED" + ], + "enumDescriptions": [ + "", + "", + "", + "" + ] + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#conversionError\".", + "default": "dfareporting#conversionError" + }, + "message": { + "type": "string", + "description": "A description of the error." + } + } + }, + "ConversionStatus": { + "id": "ConversionStatus", + "type": "object", + "description": "The original conversion that was inserted or updated and whether there were any errors.", + "properties": { + "conversion": { + "$ref": "Conversion", + "description": "The original conversion that was inserted or updated." + }, + "errors": { + "type": "array", + "description": "A list of errors related to this conversion.", + "items": { + "$ref": "ConversionError" + } + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#conversionStatus\".", + "default": "dfareporting#conversionStatus" + } + } + }, + "ConversionsBatchInsertRequest": { + "id": "ConversionsBatchInsertRequest", + "type": "object", + "description": "Insert Conversions Request.", + "properties": { + "conversions": { + "type": "array", + "description": "The set of conversions to insert.", + "items": { + "$ref": "Conversion" + } + }, + "encryptionInfo": { + "$ref": "EncryptionInfo", + "description": "Describes how encryptedUserId or encryptedUserIdCandidates[] is encrypted. This is a required field if encryptedUserId or encryptedUserIdCandidates[] is used." + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#conversionsBatchInsertRequest\".", + "default": "dfareporting#conversionsBatchInsertRequest" + } + } + }, + "ConversionsBatchInsertResponse": { + "id": "ConversionsBatchInsertResponse", + "type": "object", + "description": "Insert Conversions Response.", + "properties": { + "hasFailures": { + "type": "boolean", + "description": "Indicates that some or all conversions failed to insert." + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#conversionsBatchInsertResponse\".", + "default": "dfareporting#conversionsBatchInsertResponse" + }, + "status": { + "type": "array", + "description": "The status of each conversion's insertion status. The status is returned in the same order that conversions are inserted.", + "items": { + "$ref": "ConversionStatus" + } + } + } + }, + "CountriesListResponse": { + "id": "CountriesListResponse", + "type": "object", + "description": "Country List Response", + "properties": { + "countries": { + "type": "array", + "description": "Country collection.", + "items": { + "$ref": "Country" + } + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#countriesListResponse\".", + "default": "dfareporting#countriesListResponse" + } + } + }, + "Country": { + "id": "Country", + "type": "object", + "description": "Contains information about a country that can be targeted by ads.", + "properties": { + "countryCode": { + "type": "string", + "description": "Country code." + }, + "dartId": { + "type": "string", + "description": "DART ID of this country. This is the ID used for targeting and generating reports.", + "format": "int64" + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#country\".", + "default": "dfareporting#country" + }, + "name": { + "type": "string", + "description": "Name of this country." + }, + "sslEnabled": { + "type": "boolean", + "description": "Whether ad serving supports secure servers in this country." + } + } + }, + "Creative": { + "id": "Creative", + "type": "object", + "description": "Contains properties of a Creative.", + "properties": { + "accountId": { + "type": "string", + "description": "Account ID of this creative. This field, if left unset, will be auto-generated for both insert and update operations. Applicable to all creative types.", + "format": "int64" + }, + "active": { + "type": "boolean", + "description": "Whether the creative is active. Applicable to all creative types." + }, + "adParameters": { + "type": "string", + "description": "Ad parameters user for VPAID creative. This is a read-only field. Applicable to the following creative types: all VPAID." + }, + "adTagKeys": { + "type": "array", + "description": "Keywords for a Rich Media creative. Keywords let you customize the creative settings of a Rich Media ad running on your site without having to contact the advertiser. You can use keywords to dynamically change the look or functionality of a creative. Applicable to the following creative types: all RICH_MEDIA, and all VPAID.", + "items": { + "type": "string" + } + }, + "advertiserId": { + "type": "string", + "description": "Advertiser ID of this creative. This is a required field. Applicable to all creative types.", + "format": "int64" + }, + "allowScriptAccess": { + "type": "boolean", + "description": "Whether script access is allowed for this creative. This is a read-only and deprecated field which will automatically be set to true on update. Applicable to the following creative types: FLASH_INPAGE." + }, + "archived": { + "type": "boolean", + "description": "Whether the creative is archived. Applicable to all creative types." + }, + "artworkType": { + "type": "string", + "description": "Type of artwork used for the creative. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA, and all VPAID.", + "enum": [ + "ARTWORK_TYPE_FLASH", + "ARTWORK_TYPE_HTML5", + "ARTWORK_TYPE_IMAGE", + "ARTWORK_TYPE_MIXED" + ], + "enumDescriptions": [ + "", + "", + "", + "" + ] + }, + "authoringSource": { + "type": "string", + "description": "Source application where creative was authored. Presently, only DBM authored creatives will have this field set. Applicable to all creative types.", + "enum": [ + "CREATIVE_AUTHORING_SOURCE_DBM", + "CREATIVE_AUTHORING_SOURCE_DCM", + "CREATIVE_AUTHORING_SOURCE_STUDIO" + ], + "enumDescriptions": [ + "", + "", + "" + ] + }, + "authoringTool": { + "type": "string", + "description": "Authoring tool for HTML5 banner creatives. This is a read-only field. Applicable to the following creative types: HTML5_BANNER.", + "enum": [ + "NINJA", + "SWIFFY" + ], + "enumDescriptions": [ + "", + "" + ] + }, + "auto_advance_images": { + "type": "boolean", + "description": "Whether images are automatically advanced for image gallery creatives. Applicable to the following creative types: DISPLAY_IMAGE_GALLERY." + }, + "backgroundColor": { + "type": "string", + "description": "The 6-character HTML color code, beginning with #, for the background of the window area where the Flash file is displayed. Default is white. Applicable to the following creative types: FLASH_INPAGE." + }, + "backupImageClickThroughUrl": { + "type": "string", + "description": "Click-through URL for backup image. Applicable to the following creative types: FLASH_INPAGE and HTML5_BANNER. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE." + }, + "backupImageFeatures": { + "type": "array", + "description": "List of feature dependencies that will cause a backup image to be served if the browser that serves the ad does not support them. Feature dependencies are features that a browser must be able to support in order to render your HTML5 creative asset correctly. This field is initially auto-generated to contain all features detected by DCM for all the assets of this creative and can then be modified by the client. To reset this field, copy over all the creativeAssets' detected features. Applicable to the following creative types: HTML5_BANNER. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE.", + "items": { + "type": "string", + "enum": [ + "APPLICATION_CACHE", + "AUDIO", + "CANVAS", + "CANVAS_TEXT", + "CSS_ANIMATIONS", + "CSS_BACKGROUND_SIZE", + "CSS_BORDER_IMAGE", + "CSS_BORDER_RADIUS", + "CSS_BOX_SHADOW", + "CSS_COLUMNS", + "CSS_FLEX_BOX", + "CSS_FONT_FACE", + "CSS_GENERATED_CONTENT", + "CSS_GRADIENTS", + "CSS_HSLA", + "CSS_MULTIPLE_BGS", + "CSS_OPACITY", + "CSS_REFLECTIONS", + "CSS_RGBA", + "CSS_TEXT_SHADOW", + "CSS_TRANSFORMS", + "CSS_TRANSFORMS3D", + "CSS_TRANSITIONS", + "DRAG_AND_DROP", + "GEO_LOCATION", + "HASH_CHANGE", + "HISTORY", + "INDEXED_DB", + "INLINE_SVG", + "INPUT_ATTR_AUTOCOMPLETE", + "INPUT_ATTR_AUTOFOCUS", + "INPUT_ATTR_LIST", + "INPUT_ATTR_MAX", + "INPUT_ATTR_MIN", + "INPUT_ATTR_MULTIPLE", + "INPUT_ATTR_PATTERN", + "INPUT_ATTR_PLACEHOLDER", + "INPUT_ATTR_REQUIRED", + "INPUT_ATTR_STEP", + "INPUT_TYPE_COLOR", + "INPUT_TYPE_DATE", + "INPUT_TYPE_DATETIME", + "INPUT_TYPE_DATETIME_LOCAL", + "INPUT_TYPE_EMAIL", + "INPUT_TYPE_MONTH", + "INPUT_TYPE_NUMBER", + "INPUT_TYPE_RANGE", + "INPUT_TYPE_SEARCH", + "INPUT_TYPE_TEL", + "INPUT_TYPE_TIME", + "INPUT_TYPE_URL", + "INPUT_TYPE_WEEK", + "LOCAL_STORAGE", + "POST_MESSAGE", + "SESSION_STORAGE", + "SMIL", + "SVG_CLIP_PATHS", + "SVG_FE_IMAGE", + "SVG_FILTERS", + "SVG_HREF", + "TOUCH", + "VIDEO", + "WEBGL", + "WEB_SOCKETS", + "WEB_SQL_DATABASE", + "WEB_WORKERS" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ] + } + }, + "backupImageReportingLabel": { + "type": "string", + "description": "Reporting label used for HTML5 banner backup image. Applicable to the following creative types: DISPLAY when the primary asset type is not HTML_IMAGE." + }, + "backupImageTargetWindow": { + "$ref": "TargetWindow", + "description": "Target window for backup image. Applicable to the following creative types: FLASH_INPAGE and HTML5_BANNER. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE." + }, + "clickTags": { + "type": "array", + "description": "Click tags of the creative. For DISPLAY, FLASH_INPAGE, and HTML5_BANNER creatives, this is a subset of detected click tags for the assets associated with this creative. After creating a flash asset, detected click tags will be returned in the creativeAssetMetadata. When inserting the creative, populate the creative clickTags field using the creativeAssetMetadata.clickTags field. For DISPLAY_IMAGE_GALLERY creatives, there should be exactly one entry in this list for each image creative asset. A click tag is matched with a corresponding creative asset by matching the clickTag.name field with the creativeAsset.assetIdentifier.name field. Applicable to the following creative types: DISPLAY_IMAGE_GALLERY, FLASH_INPAGE, HTML5_BANNER. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE.", + "items": { + "$ref": "ClickTag" + } + }, + "commercialId": { + "type": "string", + "description": "Industry standard ID assigned to creative for reach and frequency. Applicable to the following creative types: all INSTREAM_VIDEO and all VPAID." + }, + "companionCreatives": { + "type": "array", + "description": "List of companion creatives assigned to an in-Stream videocreative. Acceptable values include IDs of existing flash and image creatives. Applicable to the following creative types: all VPAID and all INSTREAM_VIDEO with dynamicAssetSelection set to false.", + "items": { + "type": "string", + "format": "int64" + } + }, + "compatibility": { + "type": "array", + "description": "Compatibilities associated with this creative. This is a read-only field. DISPLAY and DISPLAY_INTERSTITIAL refer to rendering either on desktop or on mobile devices or in mobile apps for regular or interstitial ads, respectively. APP and APP_INTERSTITIAL are for rendering in mobile apps. Only pre-existing creatives may have these compatibilities since new creatives will either be assigned DISPLAY or DISPLAY_INTERSTITIAL instead. IN_STREAM_VIDEO refers to rendering in in-stream video ads developed with the VAST standard. Applicable to all creative types.\n\nAcceptable values are:\n- \"APP\"\n- \"APP_INTERSTITIAL\"\n- \"IN_STREAM_VIDEO\"\n- \"DISPLAY\"\n- \"DISPLAY_INTERSTITIAL\"", + "items": { + "type": "string", + "enum": [ + "APP", + "APP_INTERSTITIAL", + "DISPLAY", + "DISPLAY_INTERSTITIAL", + "IN_STREAM_VIDEO" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "" + ] + } + }, + "convertFlashToHtml5": { + "type": "boolean", + "description": "Whether Flash assets associated with the creative need to be automatically converted to HTML5. This flag is enabled by default and users can choose to disable it if they don't want the system to generate and use HTML5 asset for this creative. Applicable to the following creative type: FLASH_INPAGE. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE." + }, + "counterCustomEvents": { + "type": "array", + "description": "List of counter events configured for the creative. For DISPLAY_IMAGE_GALLERY creatives, these are read-only and auto-generated from clickTags. Applicable to the following creative types: DISPLAY_IMAGE_GALLERY, all RICH_MEDIA, and all VPAID.", + "items": { + "$ref": "CreativeCustomEvent" + } + }, + "creativeAssetSelection": { + "$ref": "CreativeAssetSelection", + "description": "Required if dynamicAssetSelection is true." + }, + "creativeAssets": { + "type": "array", + "description": "Assets associated with a creative. Applicable to all but the following creative types: INTERNAL_REDIRECT, INTERSTITIAL_INTERNAL_REDIRECT, and REDIRECT", + "items": { + "$ref": "CreativeAsset" + } + }, + "creativeFieldAssignments": { + "type": "array", + "description": "Creative field assignments for this creative. Applicable to all creative types.", + "items": { + "$ref": "CreativeFieldAssignment" + } + }, + "customKeyValues": { + "type": "array", + "description": "Custom key-values for a Rich Media creative. Key-values let you customize the creative settings of a Rich Media ad running on your site without having to contact the advertiser. You can use key-values to dynamically change the look or functionality of a creative. Applicable to the following creative types: all RICH_MEDIA, and all VPAID.", + "items": { + "type": "string" + } + }, + "dynamicAssetSelection": { + "type": "boolean", + "description": "Set this to true to enable the use of rules to target individual assets in this creative. When set to true creativeAssetSelection must be set. This also controls asset-level companions. When this is true, companion creatives should be assigned to creative assets. Learn more. Applicable to INSTREAM_VIDEO creatives." + }, + "exitCustomEvents": { + "type": "array", + "description": "List of exit events configured for the creative. For DISPLAY and DISPLAY_IMAGE_GALLERY creatives, these are read-only and auto-generated from clickTags, For DISPLAY, an event is also created from the backupImageReportingLabel. Applicable to the following creative types: DISPLAY_IMAGE_GALLERY, all RICH_MEDIA, and all VPAID. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE.", + "items": { + "$ref": "CreativeCustomEvent" + } + }, + "fsCommand": { + "$ref": "FsCommand", + "description": "OpenWindow FSCommand of this creative. This lets the SWF file communicate with either Flash Player or the program hosting Flash Player, such as a web browser. This is only triggered if allowScriptAccess field is true. Applicable to the following creative types: FLASH_INPAGE." + }, + "htmlCode": { + "type": "string", + "description": "HTML code for the creative. This is a required field when applicable. This field is ignored if htmlCodeLocked is false. Applicable to the following creative types: all CUSTOM, FLASH_INPAGE, and HTML5_BANNER, and all RICH_MEDIA." + }, + "htmlCodeLocked": { + "type": "boolean", + "description": "Whether HTML code is DCM-generated or manually entered. Set to true to ignore changes to htmlCode. Applicable to the following creative types: FLASH_INPAGE and HTML5_BANNER." + }, + "id": { + "type": "string", + "description": "ID of this creative. This is a read-only, auto-generated field. Applicable to all creative types.", + "format": "int64" + }, + "idDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the ID of this creative. This is a read-only field. Applicable to all creative types." + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#creative\".", + "default": "dfareporting#creative" + }, + "lastModifiedInfo": { + "$ref": "LastModifiedInfo", + "description": "Creative last modification information. This is a read-only field. Applicable to all creative types." + }, + "latestTraffickedCreativeId": { + "type": "string", + "description": "Latest Studio trafficked creative ID associated with rich media and VPAID creatives. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA, and all VPAID.", + "format": "int64" + }, + "name": { + "type": "string", + "description": "Name of the creative. This is a required field and must be less than 256 characters long. Applicable to all creative types." + }, + "overrideCss": { + "type": "string", + "description": "Override CSS value for rich media creatives. Applicable to the following creative types: all RICH_MEDIA." + }, + "progressOffset": { + "$ref": "VideoOffset", + "description": "Amount of time to play the video before counting a view. Applicable to the following creative types: all INSTREAM_VIDEO." + }, + "redirectUrl": { + "type": "string", + "description": "URL of hosted image or hosted video or another ad tag. For INSTREAM_VIDEO_REDIRECT creatives this is the in-stream video redirect URL. The standard for a VAST (Video Ad Serving Template) ad response allows for a redirect link to another VAST 2.0 or 3.0 call. This is a required field when applicable. Applicable to the following creative types: DISPLAY_REDIRECT, INTERNAL_REDIRECT, INTERSTITIAL_INTERNAL_REDIRECT, and INSTREAM_VIDEO_REDIRECT" + }, + "renderingId": { + "type": "string", + "description": "ID of current rendering version. This is a read-only field. Applicable to all creative types.", + "format": "int64" + }, + "renderingIdDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the rendering ID of this creative. This is a read-only field. Applicable to all creative types." + }, + "requiredFlashPluginVersion": { + "type": "string", + "description": "The minimum required Flash plugin version for this creative. For example, 11.2.202.235. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA, and all VPAID." + }, + "requiredFlashVersion": { + "type": "integer", + "description": "The internal Flash version for this creative as calculated by DoubleClick Studio. This is a read-only field. Applicable to the following creative types: FLASH_INPAGE all RICH_MEDIA, and all VPAID. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE.", + "format": "int32" + }, + "size": { + "$ref": "Size", + "description": "Size associated with this creative. When inserting or updating a creative either the size ID field or size width and height fields can be used. This is a required field when applicable; however for IMAGE, FLASH_INPAGE creatives, and for DISPLAY creatives with a primary asset of type HTML_IMAGE, if left blank, this field will be automatically set using the actual size of the associated image assets. Applicable to the following creative types: DISPLAY, DISPLAY_IMAGE_GALLERY, FLASH_INPAGE, HTML5_BANNER, IMAGE, and all RICH_MEDIA." + }, + "skipOffset": { + "$ref": "VideoOffset", + "description": "Amount of time to play the video before the skip button appears. Applicable to the following creative types: all INSTREAM_VIDEO." + }, + "skippable": { + "type": "boolean", + "description": "Whether the user can choose to skip the creative. Applicable to the following creative types: all INSTREAM_VIDEO and all VPAID." + }, + "sslCompliant": { + "type": "boolean", + "description": "Whether the creative is SSL-compliant. This is a read-only field. Applicable to all creative types." + }, + "sslOverride": { + "type": "boolean", + "description": "Whether creative should be treated as SSL compliant even if the system scan shows it's not. Applicable to all creative types." + }, + "studioAdvertiserId": { + "type": "string", + "description": "Studio advertiser ID associated with rich media and VPAID creatives. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA, and all VPAID.", + "format": "int64" + }, + "studioCreativeId": { + "type": "string", + "description": "Studio creative ID associated with rich media and VPAID creatives. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA, and all VPAID.", + "format": "int64" + }, + "studioTraffickedCreativeId": { + "type": "string", + "description": "Studio trafficked creative ID associated with rich media and VPAID creatives. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA, and all VPAID.", + "format": "int64" + }, + "subaccountId": { + "type": "string", + "description": "Subaccount ID of this creative. This field, if left unset, will be auto-generated for both insert and update operations. Applicable to all creative types.", + "format": "int64" + }, + "thirdPartyBackupImageImpressionsUrl": { + "type": "string", + "description": "Third-party URL used to record backup image impressions. Applicable to the following creative types: all RICH_MEDIA." + }, + "thirdPartyRichMediaImpressionsUrl": { + "type": "string", + "description": "Third-party URL used to record rich media impressions. Applicable to the following creative types: all RICH_MEDIA." + }, + "thirdPartyUrls": { + "type": "array", + "description": "Third-party URLs for tracking in-stream video creative events. Applicable to the following creative types: all INSTREAM_VIDEO and all VPAID.", + "items": { + "$ref": "ThirdPartyTrackingUrl" + } + }, + "timerCustomEvents": { + "type": "array", + "description": "List of timer events configured for the creative. For DISPLAY_IMAGE_GALLERY creatives, these are read-only and auto-generated from clickTags. Applicable to the following creative types: DISPLAY_IMAGE_GALLERY, all RICH_MEDIA, and all VPAID. Applicable to DISPLAY when the primary asset is not HTML_IMAGE.", + "items": { + "$ref": "CreativeCustomEvent" + } + }, + "totalFileSize": { + "type": "string", + "description": "Combined size of all creative assets. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA, and all VPAID.", + "format": "int64" + }, + "type": { + "type": "string", + "description": "Type of this creative. This is a required field. Applicable to all creative types.\n\nNote: FLASH_INPAGE, HTML5_BANNER, and IMAGE are only used for existing creatives. New creatives should use DISPLAY as a replacement for these types.", + "enum": [ + "BRAND_SAFE_DEFAULT_INSTREAM_VIDEO", + "CUSTOM_DISPLAY", + "CUSTOM_DISPLAY_INTERSTITIAL", + "DISPLAY", + "DISPLAY_IMAGE_GALLERY", + "DISPLAY_REDIRECT", + "FLASH_INPAGE", + "HTML5_BANNER", + "IMAGE", + "INSTREAM_VIDEO", + "INSTREAM_VIDEO_REDIRECT", + "INTERNAL_REDIRECT", + "INTERSTITIAL_INTERNAL_REDIRECT", + "RICH_MEDIA_DISPLAY_BANNER", + "RICH_MEDIA_DISPLAY_EXPANDING", + "RICH_MEDIA_DISPLAY_INTERSTITIAL", + "RICH_MEDIA_DISPLAY_MULTI_FLOATING_INTERSTITIAL", + "RICH_MEDIA_IM_EXPAND", + "RICH_MEDIA_INPAGE_FLOATING", + "RICH_MEDIA_MOBILE_IN_APP", + "RICH_MEDIA_PEEL_DOWN", + "TRACKING_TEXT", + "VPAID_LINEAR_VIDEO", + "VPAID_NON_LINEAR_VIDEO" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ] + }, + "version": { + "type": "integer", + "description": "The version number helps you keep track of multiple versions of your creative in your reports. The version number will always be auto-generated during insert operations to start at 1. For tracking creatives the version cannot be incremented and will always remain at 1. For all other creative types the version can be incremented only by 1 during update operations. In addition, the version will be automatically incremented by 1 when undergoing Rich Media creative merging. Applicable to all creative types.", + "format": "int32" + }, + "videoDescription": { + "type": "string", + "description": "Description of the video ad. Applicable to the following creative types: all INSTREAM_VIDEO and all VPAID." + }, + "videoDuration": { + "type": "number", + "description": "Creative video duration in seconds. This is a read-only field. Applicable to the following creative types: INSTREAM_VIDEO, all RICH_MEDIA, and all VPAID.", + "format": "float" + } + } + }, + "CreativeAsset": { + "id": "CreativeAsset", + "type": "object", + "description": "Creative Asset.", + "properties": { + "actionScript3": { + "type": "boolean", + "description": "Whether ActionScript3 is enabled for the flash asset. This is a read-only field. Applicable to the following creative type: FLASH_INPAGE. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE." + }, + "active": { + "type": "boolean", + "description": "Whether the video asset is active. This is a read-only field for VPAID_NON_LINEAR_VIDEO assets. Applicable to the following creative types: INSTREAM_VIDEO and all VPAID." + }, + "alignment": { + "type": "string", + "description": "Possible alignments for an asset. This is a read-only field. Applicable to the following creative types: RICH_MEDIA_DISPLAY_MULTI_FLOATING_INTERSTITIAL.", + "enum": [ + "ALIGNMENT_BOTTOM", + "ALIGNMENT_LEFT", + "ALIGNMENT_RIGHT", + "ALIGNMENT_TOP" + ], + "enumDescriptions": [ + "", + "", + "", + "" + ] + }, + "artworkType": { + "type": "string", + "description": "Artwork type of rich media creative. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA.", + "enum": [ + "ARTWORK_TYPE_FLASH", + "ARTWORK_TYPE_HTML5", + "ARTWORK_TYPE_IMAGE", + "ARTWORK_TYPE_MIXED" + ], + "enumDescriptions": [ + "", + "", + "", + "" + ] + }, + "assetIdentifier": { + "$ref": "CreativeAssetId", + "description": "Identifier of this asset. This is the same identifier returned during creative asset insert operation. This is a required field. Applicable to all but the following creative types: all REDIRECT and TRACKING_TEXT." + }, + "backupImageExit": { + "$ref": "CreativeCustomEvent", + "description": "Exit event configured for the backup image. Applicable to the following creative types: all RICH_MEDIA." + }, + "bitRate": { + "type": "integer", + "description": "Detected bit-rate for video asset. This is a read-only field. Applicable to the following creative types: INSTREAM_VIDEO and all VPAID.", + "format": "int32" + }, + "childAssetType": { + "type": "string", + "description": "Rich media child asset type. This is a read-only field. Applicable to the following creative types: all VPAID.", + "enum": [ + "CHILD_ASSET_TYPE_DATA", + "CHILD_ASSET_TYPE_FLASH", + "CHILD_ASSET_TYPE_IMAGE", + "CHILD_ASSET_TYPE_VIDEO" + ], + "enumDescriptions": [ + "", + "", + "", + "" + ] + }, + "collapsedSize": { + "$ref": "Size", + "description": "Size of an asset when collapsed. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA and all VPAID. Additionally, applicable to assets whose displayType is ASSET_DISPLAY_TYPE_EXPANDING or ASSET_DISPLAY_TYPE_PEEL_DOWN." + }, + "companionCreativeIds": { + "type": "array", + "description": "List of companion creatives assigned to an in-stream video creative asset. Acceptable values include IDs of existing flash and image creatives. Applicable to INSTREAM_VIDEO creative type with dynamicAssetSelection set to true.", + "items": { + "type": "string", + "format": "int64" + } + }, + "customStartTimeValue": { + "type": "integer", + "description": "Custom start time in seconds for making the asset visible. Applicable to the following creative types: all RICH_MEDIA.", + "format": "int32" + }, + "detectedFeatures": { + "type": "array", + "description": "List of feature dependencies for the creative asset that are detected by DCM. Feature dependencies are features that a browser must be able to support in order to render your HTML5 creative correctly. This is a read-only, auto-generated field. Applicable to the following creative types: HTML5_BANNER. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE.", + "items": { + "type": "string", + "enum": [ + "APPLICATION_CACHE", + "AUDIO", + "CANVAS", + "CANVAS_TEXT", + "CSS_ANIMATIONS", + "CSS_BACKGROUND_SIZE", + "CSS_BORDER_IMAGE", + "CSS_BORDER_RADIUS", + "CSS_BOX_SHADOW", + "CSS_COLUMNS", + "CSS_FLEX_BOX", + "CSS_FONT_FACE", + "CSS_GENERATED_CONTENT", + "CSS_GRADIENTS", + "CSS_HSLA", + "CSS_MULTIPLE_BGS", + "CSS_OPACITY", + "CSS_REFLECTIONS", + "CSS_RGBA", + "CSS_TEXT_SHADOW", + "CSS_TRANSFORMS", + "CSS_TRANSFORMS3D", + "CSS_TRANSITIONS", + "DRAG_AND_DROP", + "GEO_LOCATION", + "HASH_CHANGE", + "HISTORY", + "INDEXED_DB", + "INLINE_SVG", + "INPUT_ATTR_AUTOCOMPLETE", + "INPUT_ATTR_AUTOFOCUS", + "INPUT_ATTR_LIST", + "INPUT_ATTR_MAX", + "INPUT_ATTR_MIN", + "INPUT_ATTR_MULTIPLE", + "INPUT_ATTR_PATTERN", + "INPUT_ATTR_PLACEHOLDER", + "INPUT_ATTR_REQUIRED", + "INPUT_ATTR_STEP", + "INPUT_TYPE_COLOR", + "INPUT_TYPE_DATE", + "INPUT_TYPE_DATETIME", + "INPUT_TYPE_DATETIME_LOCAL", + "INPUT_TYPE_EMAIL", + "INPUT_TYPE_MONTH", + "INPUT_TYPE_NUMBER", + "INPUT_TYPE_RANGE", + "INPUT_TYPE_SEARCH", + "INPUT_TYPE_TEL", + "INPUT_TYPE_TIME", + "INPUT_TYPE_URL", + "INPUT_TYPE_WEEK", + "LOCAL_STORAGE", + "POST_MESSAGE", + "SESSION_STORAGE", + "SMIL", + "SVG_CLIP_PATHS", + "SVG_FE_IMAGE", + "SVG_FILTERS", + "SVG_HREF", + "TOUCH", + "VIDEO", + "WEBGL", + "WEB_SOCKETS", + "WEB_SQL_DATABASE", + "WEB_WORKERS" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ] + } + }, + "displayType": { + "type": "string", + "description": "Type of rich media asset. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA.", + "enum": [ + "ASSET_DISPLAY_TYPE_BACKDROP", + "ASSET_DISPLAY_TYPE_EXPANDING", + "ASSET_DISPLAY_TYPE_FLASH_IN_FLASH", + "ASSET_DISPLAY_TYPE_FLASH_IN_FLASH_EXPANDING", + "ASSET_DISPLAY_TYPE_FLOATING", + "ASSET_DISPLAY_TYPE_INPAGE", + "ASSET_DISPLAY_TYPE_OVERLAY", + "ASSET_DISPLAY_TYPE_PEEL_DOWN", + "ASSET_DISPLAY_TYPE_VPAID_LINEAR", + "ASSET_DISPLAY_TYPE_VPAID_NON_LINEAR" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ] + }, + "duration": { + "type": "integer", + "description": "Duration in seconds for which an asset will be displayed. Applicable to the following creative types: INSTREAM_VIDEO and VPAID_LINEAR_VIDEO.", + "format": "int32" + }, + "durationType": { + "type": "string", + "description": "Duration type for which an asset will be displayed. Applicable to the following creative types: all RICH_MEDIA.", + "enum": [ + "ASSET_DURATION_TYPE_AUTO", + "ASSET_DURATION_TYPE_CUSTOM", + "ASSET_DURATION_TYPE_NONE" + ], + "enumDescriptions": [ + "", + "", + "" + ] + }, + "expandedDimension": { + "$ref": "Size", + "description": "Detected expanded dimension for video asset. This is a read-only field. Applicable to the following creative types: INSTREAM_VIDEO and all VPAID." + }, + "fileSize": { + "type": "string", + "description": "File size associated with this creative asset. This is a read-only field. Applicable to all but the following creative types: all REDIRECT and TRACKING_TEXT.", + "format": "int64" + }, + "flashVersion": { + "type": "integer", + "description": "Flash version of the asset. This is a read-only field. Applicable to the following creative types: FLASH_INPAGE, all RICH_MEDIA, and all VPAID. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE.", + "format": "int32" + }, + "hideFlashObjects": { + "type": "boolean", + "description": "Whether to hide Flash objects flag for an asset. Applicable to the following creative types: all RICH_MEDIA." + }, + "hideSelectionBoxes": { + "type": "boolean", + "description": "Whether to hide selection boxes flag for an asset. Applicable to the following creative types: all RICH_MEDIA." + }, + "horizontallyLocked": { + "type": "boolean", + "description": "Whether the asset is horizontally locked. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA." + }, + "id": { + "type": "string", + "description": "Numeric ID of this creative asset. This is a required field and should not be modified. Applicable to all but the following creative types: all REDIRECT and TRACKING_TEXT.", + "format": "int64" + }, + "idDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the ID of the asset. This is a read-only, auto-generated field." + }, + "mimeType": { + "type": "string", + "description": "Detected MIME type for video asset. This is a read-only field. Applicable to the following creative types: INSTREAM_VIDEO and all VPAID." + }, + "offset": { + "$ref": "OffsetPosition", + "description": "Offset position for an asset in collapsed mode. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA and all VPAID. Additionally, only applicable to assets whose displayType is ASSET_DISPLAY_TYPE_EXPANDING or ASSET_DISPLAY_TYPE_PEEL_DOWN." + }, + "originalBackup": { + "type": "boolean", + "description": "Whether the backup asset is original or changed by the user in DCM. Applicable to the following creative types: all RICH_MEDIA." + }, + "position": { + "$ref": "OffsetPosition", + "description": "Offset position for an asset. Applicable to the following creative types: all RICH_MEDIA." + }, + "positionLeftUnit": { + "type": "string", + "description": "Offset left unit for an asset. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA.", + "enum": [ + "OFFSET_UNIT_PERCENT", + "OFFSET_UNIT_PIXEL", + "OFFSET_UNIT_PIXEL_FROM_CENTER" + ], + "enumDescriptions": [ + "", + "", + "" + ] + }, + "positionTopUnit": { + "type": "string", + "description": "Offset top unit for an asset. This is a read-only field if the asset displayType is ASSET_DISPLAY_TYPE_OVERLAY. Applicable to the following creative types: all RICH_MEDIA.", + "enum": [ + "OFFSET_UNIT_PERCENT", + "OFFSET_UNIT_PIXEL", + "OFFSET_UNIT_PIXEL_FROM_CENTER" + ], + "enumDescriptions": [ + "", + "", + "" + ] + }, + "progressiveServingUrl": { + "type": "string", + "description": "Progressive URL for video asset. This is a read-only field. Applicable to the following creative types: INSTREAM_VIDEO and all VPAID." + }, + "pushdown": { + "type": "boolean", + "description": "Whether the asset pushes down other content. Applicable to the following creative types: all RICH_MEDIA. Additionally, only applicable when the asset offsets are 0, the collapsedSize.width matches size.width, and the collapsedSize.height is less than size.height." + }, + "pushdownDuration": { + "type": "number", + "description": "Pushdown duration in seconds for an asset. Must be between 0 and 9.99. Applicable to the following creative types: all RICH_MEDIA.Additionally, only applicable when the asset pushdown field is true, the offsets are 0, the collapsedSize.width matches size.width, and the collapsedSize.height is less than size.height.", + "format": "float" + }, + "role": { + "type": "string", + "description": "Role of the asset in relation to creative. Applicable to all but the following creative types: all REDIRECT and TRACKING_TEXT. This is a required field.\nPRIMARY applies to DISPLAY, FLASH_INPAGE, HTML5_BANNER, IMAGE, DISPLAY_IMAGE_GALLERY, all RICH_MEDIA (which may contain multiple primary assets), and all VPAID creatives.\nBACKUP_IMAGE applies to FLASH_INPAGE, HTML5_BANNER, all RICH_MEDIA, and all VPAID creatives. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE.\nADDITIONAL_IMAGE and ADDITIONAL_FLASH apply to FLASH_INPAGE creatives.\nOTHER refers to assets from sources other than DCM, such as Studio uploaded assets, applicable to all RICH_MEDIA and all VPAID creatives.\nPARENT_VIDEO refers to videos uploaded by the user in DCM and is applicable to INSTREAM_VIDEO and VPAID_LINEAR_VIDEO creatives.\nTRANSCODED_VIDEO refers to videos transcoded by DCM from PARENT_VIDEO assets and is applicable to INSTREAM_VIDEO and VPAID_LINEAR_VIDEO creatives.\nALTERNATE_VIDEO refers to the DCM representation of child asset videos from Studio, and is applicable to VPAID_LINEAR_VIDEO creatives. These cannot be added or removed within DCM.\nFor VPAID_LINEAR_VIDEO creatives, PARENT_VIDEO, TRANSCODED_VIDEO and ALTERNATE_VIDEO assets that are marked active serve as backup in case the VPAID creative cannot be served. Only PARENT_VIDEO assets can be added or removed for an INSTREAM_VIDEO or VPAID_LINEAR_VIDEO creative.", + "enum": [ + "ADDITIONAL_FLASH", + "ADDITIONAL_IMAGE", + "ALTERNATE_VIDEO", + "BACKUP_IMAGE", + "OTHER", + "PARENT_VIDEO", + "PRIMARY", + "TRANSCODED_VIDEO" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "", + "", + "", + "" + ] + }, + "size": { + "$ref": "Size", + "description": "Size associated with this creative asset. This is a required field when applicable; however for IMAGE and FLASH_INPAGE, creatives if left blank, this field will be automatically set using the actual size of the associated image asset. Applicable to the following creative types: DISPLAY_IMAGE_GALLERY, FLASH_INPAGE, HTML5_BANNER, IMAGE, and all RICH_MEDIA. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE." + }, + "sslCompliant": { + "type": "boolean", + "description": "Whether the asset is SSL-compliant. This is a read-only field. Applicable to all but the following creative types: all REDIRECT and TRACKING_TEXT." + }, + "startTimeType": { + "type": "string", + "description": "Initial wait time type before making the asset visible. Applicable to the following creative types: all RICH_MEDIA.", + "enum": [ + "ASSET_START_TIME_TYPE_CUSTOM", + "ASSET_START_TIME_TYPE_NONE" + ], + "enumDescriptions": [ + "", + "" + ] + }, + "streamingServingUrl": { + "type": "string", + "description": "Streaming URL for video asset. This is a read-only field. Applicable to the following creative types: INSTREAM_VIDEO and all VPAID." + }, + "transparency": { + "type": "boolean", + "description": "Whether the asset is transparent. Applicable to the following creative types: all RICH_MEDIA. Additionally, only applicable to HTML5 assets." + }, + "verticallyLocked": { + "type": "boolean", + "description": "Whether the asset is vertically locked. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA." + }, + "videoDuration": { + "type": "number", + "description": "Detected video duration for video asset. This is a read-only field. Applicable to the following creative types: INSTREAM_VIDEO and all VPAID.", + "format": "float" + }, + "windowMode": { + "type": "string", + "description": "Window mode options for flash assets. Applicable to the following creative types: FLASH_INPAGE, RICH_MEDIA_DISPLAY_EXPANDING, RICH_MEDIA_IM_EXPAND, RICH_MEDIA_DISPLAY_BANNER, and RICH_MEDIA_INPAGE_FLOATING.", + "enum": [ + "OPAQUE", + "TRANSPARENT", + "WINDOW" + ], + "enumDescriptions": [ + "", + "", + "" + ] + }, + "zIndex": { + "type": "integer", + "description": "zIndex value of an asset. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA.Additionally, only applicable to assets whose displayType is NOT one of the following types: ASSET_DISPLAY_TYPE_INPAGE or ASSET_DISPLAY_TYPE_OVERLAY.", + "format": "int32" + }, + "zipFilename": { + "type": "string", + "description": "File name of zip file. This is a read-only field. Applicable to the following creative types: HTML5_BANNER." + }, + "zipFilesize": { + "type": "string", + "description": "Size of zip file. This is a read-only field. Applicable to the following creative types: HTML5_BANNER." + } + } + }, + "CreativeAssetId": { + "id": "CreativeAssetId", + "type": "object", + "description": "Creative Asset ID.", + "properties": { + "name": { + "type": "string", + "description": "Name of the creative asset. This is a required field while inserting an asset. After insertion, this assetIdentifier is used to identify the uploaded asset. Characters in the name must be alphanumeric or one of the following: \".-_ \". Spaces are allowed." + }, + "type": { + "type": "string", + "description": "Type of asset to upload. This is a required field. FLASH and IMAGE are no longer supported for new uploads. All image assets should use HTML_IMAGE.", + "enum": [ + "FLASH", + "HTML", + "HTML_IMAGE", + "IMAGE", + "VIDEO" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "" + ] + } + } + }, + "CreativeAssetMetadata": { + "id": "CreativeAssetMetadata", + "type": "object", + "description": "CreativeAssets contains properties of a creative asset file which will be uploaded or has already been uploaded. Refer to the creative sample code for how to upload assets and insert a creative.", + "properties": { + "assetIdentifier": { + "$ref": "CreativeAssetId", + "description": "ID of the creative asset. This is a required field." + }, + "clickTags": { + "type": "array", + "description": "List of detected click tags for assets. This is a read-only auto-generated field.", + "items": { + "$ref": "ClickTag" + } + }, + "detectedFeatures": { + "type": "array", + "description": "List of feature dependencies for the creative asset that are detected by DCM. Feature dependencies are features that a browser must be able to support in order to render your HTML5 creative correctly. This is a read-only, auto-generated field.", + "items": { + "type": "string", + "enum": [ + "APPLICATION_CACHE", + "AUDIO", + "CANVAS", + "CANVAS_TEXT", + "CSS_ANIMATIONS", + "CSS_BACKGROUND_SIZE", + "CSS_BORDER_IMAGE", + "CSS_BORDER_RADIUS", + "CSS_BOX_SHADOW", + "CSS_COLUMNS", + "CSS_FLEX_BOX", + "CSS_FONT_FACE", + "CSS_GENERATED_CONTENT", + "CSS_GRADIENTS", + "CSS_HSLA", + "CSS_MULTIPLE_BGS", + "CSS_OPACITY", + "CSS_REFLECTIONS", + "CSS_RGBA", + "CSS_TEXT_SHADOW", + "CSS_TRANSFORMS", + "CSS_TRANSFORMS3D", + "CSS_TRANSITIONS", + "DRAG_AND_DROP", + "GEO_LOCATION", + "HASH_CHANGE", + "HISTORY", + "INDEXED_DB", + "INLINE_SVG", + "INPUT_ATTR_AUTOCOMPLETE", + "INPUT_ATTR_AUTOFOCUS", + "INPUT_ATTR_LIST", + "INPUT_ATTR_MAX", + "INPUT_ATTR_MIN", + "INPUT_ATTR_MULTIPLE", + "INPUT_ATTR_PATTERN", + "INPUT_ATTR_PLACEHOLDER", + "INPUT_ATTR_REQUIRED", + "INPUT_ATTR_STEP", + "INPUT_TYPE_COLOR", + "INPUT_TYPE_DATE", + "INPUT_TYPE_DATETIME", + "INPUT_TYPE_DATETIME_LOCAL", + "INPUT_TYPE_EMAIL", + "INPUT_TYPE_MONTH", + "INPUT_TYPE_NUMBER", + "INPUT_TYPE_RANGE", + "INPUT_TYPE_SEARCH", + "INPUT_TYPE_TEL", + "INPUT_TYPE_TIME", + "INPUT_TYPE_URL", + "INPUT_TYPE_WEEK", + "LOCAL_STORAGE", + "POST_MESSAGE", + "SESSION_STORAGE", + "SMIL", + "SVG_CLIP_PATHS", + "SVG_FE_IMAGE", + "SVG_FILTERS", + "SVG_HREF", + "TOUCH", + "VIDEO", + "WEBGL", + "WEB_SOCKETS", + "WEB_SQL_DATABASE", + "WEB_WORKERS" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ] + } + }, + "id": { + "type": "string", + "description": "Numeric ID of the asset. This is a read-only, auto-generated field.", + "format": "int64" + }, + "idDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the numeric ID of the asset. This is a read-only, auto-generated field." + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#creativeAssetMetadata\".", + "default": "dfareporting#creativeAssetMetadata" + }, + "warnedValidationRules": { + "type": "array", + "description": "Rules validated during code generation that generated a warning. This is a read-only, auto-generated field.\n\nPossible values are:\n- \"ADMOB_REFERENCED\"\n- \"ASSET_FORMAT_UNSUPPORTED_DCM\"\n- \"ASSET_INVALID\"\n- \"CLICK_TAG_HARD_CODED\"\n- \"CLICK_TAG_INVALID\"\n- \"CLICK_TAG_IN_GWD\"\n- \"CLICK_TAG_MISSING\"\n- \"CLICK_TAG_MORE_THAN_ONE\"\n- \"CLICK_TAG_NON_TOP_LEVEL\"\n- \"COMPONENT_UNSUPPORTED_DCM\"\n- \"ENABLER_UNSUPPORTED_METHOD_DCM\"\n- \"EXTERNAL_FILE_REFERENCED\"\n- \"FILE_DETAIL_EMPTY\"\n- \"FILE_TYPE_INVALID\"\n- \"GWD_PROPERTIES_INVALID\"\n- \"HTML5_FEATURE_UNSUPPORTED\"\n- \"LINKED_FILE_NOT_FOUND\"\n- \"MAX_FLASH_VERSION_11\"\n- \"MRAID_REFERENCED\"\n- \"NOT_SSL_COMPLIANT\"\n- \"ORPHANED_ASSET\"\n- \"PRIMARY_HTML_MISSING\"\n- \"SVG_INVALID\"\n- \"ZIP_INVALID\"", + "items": { + "type": "string", + "enum": [ + "ADMOB_REFERENCED", + "ASSET_FORMAT_UNSUPPORTED_DCM", + "ASSET_INVALID", + "CLICK_TAG_HARD_CODED", + "CLICK_TAG_INVALID", + "CLICK_TAG_IN_GWD", + "CLICK_TAG_MISSING", + "CLICK_TAG_MORE_THAN_ONE", + "CLICK_TAG_NON_TOP_LEVEL", + "COMPONENT_UNSUPPORTED_DCM", + "ENABLER_UNSUPPORTED_METHOD_DCM", + "EXTERNAL_FILE_REFERENCED", + "FILE_DETAIL_EMPTY", + "FILE_TYPE_INVALID", + "GWD_PROPERTIES_INVALID", + "HTML5_FEATURE_UNSUPPORTED", + "LINKED_FILE_NOT_FOUND", + "MAX_FLASH_VERSION_11", + "MRAID_REFERENCED", + "NOT_SSL_COMPLIANT", + "ORPHANED_ASSET", + "PRIMARY_HTML_MISSING", + "SVG_INVALID", + "ZIP_INVALID" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ] + } + } + } + }, + "CreativeAssetSelection": { + "id": "CreativeAssetSelection", + "type": "object", + "description": "Encapsulates the list of rules for asset selection and a default asset in case none of the rules match. Applicable to INSTREAM_VIDEO creatives.", + "properties": { + "defaultAssetId": { + "type": "string", + "description": "A creativeAssets[].id. This should refer to one of the parent assets in this creative, and will be served if none of the rules match. This is a required field.", + "format": "int64" + }, + "rules": { + "type": "array", + "description": "Rules determine which asset will be served to a viewer. Rules will be evaluated in the order in which they are stored in this list. This list must contain at least one rule. Applicable to INSTREAM_VIDEO creatives.", + "items": { + "$ref": "Rule" + } + } + } + }, + "CreativeAssignment": { + "id": "CreativeAssignment", + "type": "object", + "description": "Creative Assignment.", + "properties": { + "active": { + "type": "boolean", + "description": "Whether this creative assignment is active. When true, the creative will be included in the ad's rotation." + }, + "applyEventTags": { + "type": "boolean", + "description": "Whether applicable event tags should fire when this creative assignment is rendered. If this value is unset when the ad is inserted or updated, it will default to true for all creative types EXCEPT for INTERNAL_REDIRECT, INTERSTITIAL_INTERNAL_REDIRECT, and INSTREAM_VIDEO." + }, + "clickThroughUrl": { + "$ref": "ClickThroughUrl", + "description": "Click-through URL of the creative assignment." + }, + "companionCreativeOverrides": { + "type": "array", + "description": "Companion creative overrides for this creative assignment. Applicable to video ads.", + "items": { + "$ref": "CompanionClickThroughOverride" + } + }, + "creativeGroupAssignments": { + "type": "array", + "description": "Creative group assignments for this creative assignment. Only one assignment per creative group number is allowed for a maximum of two assignments.", + "items": { + "$ref": "CreativeGroupAssignment" + } + }, + "creativeId": { + "type": "string", + "description": "ID of the creative to be assigned. This is a required field.", + "format": "int64" + }, + "creativeIdDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the ID of the creative. This is a read-only, auto-generated field." + }, + "endTime": { + "type": "string", + "description": "Date and time that the assigned creative should stop serving. Must be later than the start time.", + "format": "date-time" + }, + "richMediaExitOverrides": { + "type": "array", + "description": "Rich media exit overrides for this creative assignment.\nApplicable when the creative type is any of the following: \n- RICH_MEDIA_INPAGE\n- RICH_MEDIA_INPAGE_FLOATING\n- RICH_MEDIA_IM_EXPAND\n- RICH_MEDIA_EXPANDING\n- RICH_MEDIA_INTERSTITIAL_FLOAT\n- RICH_MEDIA_MOBILE_IN_APP\n- RICH_MEDIA_MULTI_FLOATING\n- RICH_MEDIA_PEEL_DOWN\n- ADVANCED_BANNER\n- VPAID_LINEAR\n- VPAID_NON_LINEAR", + "items": { + "$ref": "RichMediaExitOverride" + } + }, + "sequence": { + "type": "integer", + "description": "Sequence number of the creative assignment, applicable when the rotation type is CREATIVE_ROTATION_TYPE_SEQUENTIAL.", + "format": "int32" + }, + "sslCompliant": { + "type": "boolean", + "description": "Whether the creative to be assigned is SSL-compliant. This is a read-only field that is auto-generated when the ad is inserted or updated." + }, + "startTime": { + "type": "string", + "description": "Date and time that the assigned creative should start serving.", + "format": "date-time" + }, + "weight": { + "type": "integer", + "description": "Weight of the creative assignment, applicable when the rotation type is CREATIVE_ROTATION_TYPE_RANDOM.", + "format": "int32" + } + } + }, + "CreativeCustomEvent": { + "id": "CreativeCustomEvent", + "type": "object", + "description": "Creative Custom Event.", + "properties": { + "advertiserCustomEventId": { + "type": "string", + "description": "Unique ID of this event used by DDM Reporting and Data Transfer. This is a read-only field.", + "format": "int64" + }, + "advertiserCustomEventName": { + "type": "string", + "description": "User-entered name for the event." + }, + "advertiserCustomEventType": { + "type": "string", + "description": "Type of the event. This is a read-only field.", + "enum": [ + "ADVERTISER_EVENT_COUNTER", + "ADVERTISER_EVENT_EXIT", + "ADVERTISER_EVENT_TIMER" + ], + "enumDescriptions": [ + "", + "", + "" + ] + }, + "artworkLabel": { + "type": "string", + "description": "Artwork label column, used to link events in DCM back to events in Studio. This is a required field and should not be modified after insertion." + }, + "artworkType": { + "type": "string", + "description": "Artwork type used by the creative.This is a read-only field.", + "enum": [ + "ARTWORK_TYPE_FLASH", + "ARTWORK_TYPE_HTML5", + "ARTWORK_TYPE_IMAGE", + "ARTWORK_TYPE_MIXED" + ], + "enumDescriptions": [ + "", + "", + "", + "" + ] + }, + "exitUrl": { + "type": "string", + "description": "Exit URL of the event. This field is used only for exit events." + }, + "id": { + "type": "string", + "description": "ID of this event. This is a required field and should not be modified after insertion.", + "format": "int64" + }, + "popupWindowProperties": { + "$ref": "PopupWindowProperties", + "description": "Properties for rich media popup windows. This field is used only for exit events." + }, + "targetType": { + "type": "string", + "description": "Target type used by the event.", + "enum": [ + "TARGET_BLANK", + "TARGET_PARENT", + "TARGET_POPUP", + "TARGET_SELF", + "TARGET_TOP" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "" + ] + }, + "videoReportingId": { + "type": "string", + "description": "Video reporting ID, used to differentiate multiple videos in a single creative. This is a read-only field." + } + } + }, + "CreativeField": { + "id": "CreativeField", + "type": "object", + "description": "Contains properties of a creative field.", + "properties": { + "accountId": { + "type": "string", + "description": "Account ID of this creative field. This is a read-only field that can be left blank.", + "format": "int64" + }, + "advertiserId": { + "type": "string", + "description": "Advertiser ID of this creative field. This is a required field on insertion.", + "format": "int64" + }, + "advertiserIdDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the ID of the advertiser. This is a read-only, auto-generated field." + }, + "id": { + "type": "string", + "description": "ID of this creative field. This is a read-only, auto-generated field.", + "format": "int64" + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#creativeField\".", + "default": "dfareporting#creativeField" + }, + "name": { + "type": "string", + "description": "Name of this creative field. This is a required field and must be less than 256 characters long and unique among creative fields of the same advertiser." + }, + "subaccountId": { + "type": "string", + "description": "Subaccount ID of this creative field. This is a read-only field that can be left blank.", + "format": "int64" + } + } + }, + "CreativeFieldAssignment": { + "id": "CreativeFieldAssignment", + "type": "object", + "description": "Creative Field Assignment.", + "properties": { + "creativeFieldId": { + "type": "string", + "description": "ID of the creative field.", + "format": "int64" + }, + "creativeFieldValueId": { + "type": "string", + "description": "ID of the creative field value.", + "format": "int64" + } + } + }, + "CreativeFieldValue": { + "id": "CreativeFieldValue", + "type": "object", + "description": "Contains properties of a creative field value.", + "properties": { + "id": { + "type": "string", + "description": "ID of this creative field value. This is a read-only, auto-generated field.", + "format": "int64" + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#creativeFieldValue\".", + "default": "dfareporting#creativeFieldValue" + }, + "value": { + "type": "string", + "description": "Value of this creative field value. It needs to be less than 256 characters in length and unique per creative field." + } + } + }, + "CreativeFieldValuesListResponse": { + "id": "CreativeFieldValuesListResponse", + "type": "object", + "description": "Creative Field Value List Response", + "properties": { + "creativeFieldValues": { + "type": "array", + "description": "Creative field value collection.", + "items": { + "$ref": "CreativeFieldValue" + } + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#creativeFieldValuesListResponse\".", + "default": "dfareporting#creativeFieldValuesListResponse" + }, + "nextPageToken": { + "type": "string", + "description": "Pagination token to be used for the next list operation." + } + } + }, + "CreativeFieldsListResponse": { + "id": "CreativeFieldsListResponse", + "type": "object", + "description": "Creative Field List Response", + "properties": { + "creativeFields": { + "type": "array", + "description": "Creative field collection.", + "items": { + "$ref": "CreativeField" + } + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#creativeFieldsListResponse\".", + "default": "dfareporting#creativeFieldsListResponse" + }, + "nextPageToken": { + "type": "string", + "description": "Pagination token to be used for the next list operation." + } + } + }, + "CreativeGroup": { + "id": "CreativeGroup", + "type": "object", + "description": "Contains properties of a creative group.", + "properties": { + "accountId": { + "type": "string", + "description": "Account ID of this creative group. This is a read-only field that can be left blank.", + "format": "int64" + }, + "advertiserId": { + "type": "string", + "description": "Advertiser ID of this creative group. This is a required field on insertion.", + "format": "int64" + }, + "advertiserIdDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the ID of the advertiser. This is a read-only, auto-generated field." + }, + "groupNumber": { + "type": "integer", + "description": "Subgroup of the creative group. Assign your creative groups to one of the following subgroups in order to filter or manage them more easily. This field is required on insertion and is read-only after insertion.\nAcceptable values are: \n- 1\n- 2", + "format": "int32" + }, + "id": { + "type": "string", + "description": "ID of this creative group. This is a read-only, auto-generated field.", + "format": "int64" + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#creativeGroup\".", + "default": "dfareporting#creativeGroup" + }, + "name": { + "type": "string", + "description": "Name of this creative group. This is a required field and must be less than 256 characters long and unique among creative groups of the same advertiser." + }, + "subaccountId": { + "type": "string", + "description": "Subaccount ID of this creative group. This is a read-only field that can be left blank.", + "format": "int64" + } + } + }, + "CreativeGroupAssignment": { + "id": "CreativeGroupAssignment", + "type": "object", + "description": "Creative Group Assignment.", + "properties": { + "creativeGroupId": { + "type": "string", + "description": "ID of the creative group to be assigned.", + "format": "int64" + }, + "creativeGroupNumber": { + "type": "string", + "description": "Creative group number of the creative group assignment.", + "enum": [ + "CREATIVE_GROUP_ONE", + "CREATIVE_GROUP_TWO" + ], + "enumDescriptions": [ + "", + "" + ] + } + } + }, + "CreativeGroupsListResponse": { + "id": "CreativeGroupsListResponse", + "type": "object", + "description": "Creative Group List Response", + "properties": { + "creativeGroups": { + "type": "array", + "description": "Creative group collection.", + "items": { + "$ref": "CreativeGroup" + } + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#creativeGroupsListResponse\".", + "default": "dfareporting#creativeGroupsListResponse" + }, + "nextPageToken": { + "type": "string", + "description": "Pagination token to be used for the next list operation." + } + } + }, + "CreativeOptimizationConfiguration": { + "id": "CreativeOptimizationConfiguration", + "type": "object", + "description": "Creative optimization settings.", + "properties": { + "id": { + "type": "string", + "description": "ID of this creative optimization config. This field is auto-generated when the campaign is inserted or updated. It can be null for existing campaigns.", + "format": "int64" + }, + "name": { + "type": "string", + "description": "Name of this creative optimization config. This is a required field and must be less than 129 characters long." + }, + "optimizationActivitys": { + "type": "array", + "description": "List of optimization activities associated with this configuration.", + "items": { + "$ref": "OptimizationActivity" + } + }, + "optimizationModel": { + "type": "string", + "description": "Optimization model for this configuration.", + "enum": [ + "CLICK", + "POST_CLICK", + "POST_CLICK_AND_IMPRESSION", + "POST_IMPRESSION", + "VIDEO_COMPLETION" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "" + ] + } + } + }, + "CreativeRotation": { + "id": "CreativeRotation", + "type": "object", + "description": "Creative Rotation.", + "properties": { + "creativeAssignments": { + "type": "array", + "description": "Creative assignments in this creative rotation.", + "items": { + "$ref": "CreativeAssignment" + } + }, + "creativeOptimizationConfigurationId": { + "type": "string", + "description": "Creative optimization configuration that is used by this ad. It should refer to one of the existing optimization configurations in the ad's campaign. If it is unset or set to 0, then the campaign's default optimization configuration will be used for this ad.", + "format": "int64" + }, + "type": { + "type": "string", + "description": "Type of creative rotation. Can be used to specify whether to use sequential or random rotation.", + "enum": [ + "CREATIVE_ROTATION_TYPE_RANDOM", + "CREATIVE_ROTATION_TYPE_SEQUENTIAL" + ], + "enumDescriptions": [ + "", + "" + ] + }, + "weightCalculationStrategy": { + "type": "string", + "description": "Strategy for calculating weights. Used with CREATIVE_ROTATION_TYPE_RANDOM.", + "enum": [ + "WEIGHT_STRATEGY_CUSTOM", + "WEIGHT_STRATEGY_EQUAL", + "WEIGHT_STRATEGY_HIGHEST_CTR", + "WEIGHT_STRATEGY_OPTIMIZED" + ], + "enumDescriptions": [ + "", + "", + "", + "" + ] + } + } + }, + "CreativeSettings": { + "id": "CreativeSettings", + "type": "object", + "description": "Creative Settings", + "properties": { + "iFrameFooter": { + "type": "string", + "description": "Header text for iFrames for this site. Must be less than or equal to 2000 characters long." + }, + "iFrameHeader": { + "type": "string", + "description": "Header text for iFrames for this site. Must be less than or equal to 2000 characters long." + } + } + }, + "CreativesListResponse": { + "id": "CreativesListResponse", + "type": "object", + "description": "Creative List Response", + "properties": { + "creatives": { + "type": "array", + "description": "Creative collection.", + "items": { + "$ref": "Creative" + } + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#creativesListResponse\".", + "default": "dfareporting#creativesListResponse" + }, + "nextPageToken": { + "type": "string", + "description": "Pagination token to be used for the next list operation." + } + } + }, + "CrossDimensionReachReportCompatibleFields": { + "id": "CrossDimensionReachReportCompatibleFields", + "type": "object", + "description": "Represents fields that are compatible to be selected for a report of type \"CROSS_DIMENSION_REACH\".", + "properties": { + "breakdown": { + "type": "array", + "description": "Dimensions which are compatible to be selected in the \"breakdown\" section of the report.", + "items": { + "$ref": "Dimension" + } + }, + "dimensionFilters": { + "type": "array", + "description": "Dimensions which are compatible to be selected in the \"dimensionFilters\" section of the report.", + "items": { + "$ref": "Dimension" + } + }, + "kind": { + "type": "string", + "description": "The kind of resource this is, in this case dfareporting#crossDimensionReachReportCompatibleFields.", + "default": "dfareporting#crossDimensionReachReportCompatibleFields" + }, + "metrics": { + "type": "array", + "description": "Metrics which are compatible to be selected in the \"metricNames\" section of the report.", + "items": { + "$ref": "Metric" + } + }, + "overlapMetrics": { + "type": "array", + "description": "Metrics which are compatible to be selected in the \"overlapMetricNames\" section of the report.", + "items": { + "$ref": "Metric" + } + } + } + }, + "CustomFloodlightVariable": { + "id": "CustomFloodlightVariable", + "type": "object", + "description": "A custom floodlight variable.", + "properties": { + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#customFloodlightVariable\".", + "default": "dfareporting#customFloodlightVariable" + }, + "type": { + "type": "string", + "description": "The type of custom floodlight variable to supply a value for. These map to the \"u[1-20]=\" in the tags.", + "enum": [ + "U1", + "U10", + "U100", + "U11", + "U12", + "U13", + "U14", + "U15", + "U16", + "U17", + "U18", + "U19", + "U2", + "U20", + "U21", + "U22", + "U23", + "U24", + "U25", + "U26", + "U27", + "U28", + "U29", + "U3", + "U30", + "U31", + "U32", + "U33", + "U34", + "U35", + "U36", + "U37", + "U38", + "U39", + "U4", + "U40", + "U41", + "U42", + "U43", + "U44", + "U45", + "U46", + "U47", + "U48", + "U49", + "U5", + "U50", + "U51", + "U52", + "U53", + "U54", + "U55", + "U56", + "U57", + "U58", + "U59", + "U6", + "U60", + "U61", + "U62", + "U63", + "U64", + "U65", + "U66", + "U67", + "U68", + "U69", + "U7", + "U70", + "U71", + "U72", + "U73", + "U74", + "U75", + "U76", + "U77", + "U78", + "U79", + "U8", + "U80", + "U81", + "U82", + "U83", + "U84", + "U85", + "U86", + "U87", + "U88", + "U89", + "U9", + "U90", + "U91", + "U92", + "U93", + "U94", + "U95", + "U96", + "U97", + "U98", + "U99" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ] + }, + "value": { + "type": "string", + "description": "The value of the custom floodlight variable. The length of string must not exceed 50 characters." + } + } + }, + "CustomRichMediaEvents": { + "id": "CustomRichMediaEvents", + "type": "object", + "description": "Represents a Custom Rich Media Events group.", + "properties": { + "filteredEventIds": { + "type": "array", + "description": "List of custom rich media event IDs. Dimension values must be all of type dfa:richMediaEventTypeIdAndName.", + "items": { + "$ref": "DimensionValue" + } + }, + "kind": { + "type": "string", + "description": "The kind of resource this is, in this case dfareporting#customRichMediaEvents.", + "default": "dfareporting#customRichMediaEvents" + } + } + }, + "DateRange": { + "id": "DateRange", + "type": "object", + "description": "Represents a date range.", + "properties": { + "endDate": { + "type": "string", + "description": "The end date of the date range, inclusive. A string of the format: \"yyyy-MM-dd\".", + "format": "date" + }, + "kind": { + "type": "string", + "description": "The kind of resource this is, in this case dfareporting#dateRange.", + "default": "dfareporting#dateRange" + }, + "relativeDateRange": { + "type": "string", + "description": "The date range relative to the date of when the report is run.", + "enum": [ + "LAST_24_MONTHS", + "LAST_30_DAYS", + "LAST_365_DAYS", + "LAST_7_DAYS", + "LAST_90_DAYS", + "MONTH_TO_DATE", + "PREVIOUS_MONTH", + "PREVIOUS_QUARTER", + "PREVIOUS_WEEK", + "PREVIOUS_YEAR", + "QUARTER_TO_DATE", + "TODAY", + "WEEK_TO_DATE", + "YEAR_TO_DATE", + "YESTERDAY" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ] + }, + "startDate": { + "type": "string", + "description": "The start date of the date range, inclusive. A string of the format: \"yyyy-MM-dd\".", + "format": "date" + } + } + }, + "DayPartTargeting": { + "id": "DayPartTargeting", + "type": "object", + "description": "Day Part Targeting.", + "properties": { + "daysOfWeek": { + "type": "array", + "description": "Days of the week when the ad will serve.\n\nAcceptable values are:\n- \"SUNDAY\"\n- \"MONDAY\"\n- \"TUESDAY\"\n- \"WEDNESDAY\"\n- \"THURSDAY\"\n- \"FRIDAY\"\n- \"SATURDAY\"", + "items": { + "type": "string", + "enum": [ + "FRIDAY", + "MONDAY", + "SATURDAY", + "SUNDAY", + "THURSDAY", + "TUESDAY", + "WEDNESDAY" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "", + "", + "" + ] + } + }, + "hoursOfDay": { + "type": "array", + "description": "Hours of the day when the ad will serve. Must be an integer between 0 and 23 (inclusive), where 0 is midnight to 1 AM, and 23 is 11 PM to midnight. Can be specified with days of week, in which case the ad would serve during these hours on the specified days. For example, if Monday, Wednesday, Friday are the days of week specified and 9-10am, 3-5pm (hours 9, 15, and 16) is specified, the ad would serve Monday, Wednesdays, and Fridays at 9-10am and 3-5pm.", + "items": { + "type": "integer", + "format": "int32" + } + }, + "userLocalTime": { + "type": "boolean", + "description": "Whether or not to use the user's local time. If false, the America/New York time zone applies." + } + } + }, + "DefaultClickThroughEventTagProperties": { + "id": "DefaultClickThroughEventTagProperties", + "type": "object", + "description": "Properties of inheriting and overriding the default click-through event tag. A campaign may override the event tag defined at the advertiser level, and an ad may also override the campaign's setting further.", + "properties": { + "defaultClickThroughEventTagId": { + "type": "string", + "description": "ID of the click-through event tag to apply to all ads in this entity's scope.", + "format": "int64" + }, + "overrideInheritedEventTag": { + "type": "boolean", + "description": "Whether this entity should override the inherited default click-through event tag with its own defined value." + } + } + }, + "DeliverySchedule": { + "id": "DeliverySchedule", + "type": "object", + "description": "Delivery Schedule.", + "properties": { + "frequencyCap": { + "$ref": "FrequencyCap", + "description": "Limit on the number of times an individual user can be served the ad within a specified period of time." + }, + "hardCutoff": { + "type": "boolean", + "description": "Whether or not hard cutoff is enabled. If true, the ad will not serve after the end date and time. Otherwise the ad will continue to be served until it has reached its delivery goals." + }, + "impressionRatio": { + "type": "string", + "description": "Impression ratio for this ad. This ratio determines how often each ad is served relative to the others. For example, if ad A has an impression ratio of 1 and ad B has an impression ratio of 3, then DCM will serve ad B three times as often as ad A. Must be between 1 and 10.", + "format": "int64" + }, + "priority": { + "type": "string", + "description": "Serving priority of an ad, with respect to other ads. The lower the priority number, the greater the priority with which it is served.", + "enum": [ + "AD_PRIORITY_01", + "AD_PRIORITY_02", + "AD_PRIORITY_03", + "AD_PRIORITY_04", + "AD_PRIORITY_05", + "AD_PRIORITY_06", + "AD_PRIORITY_07", + "AD_PRIORITY_08", + "AD_PRIORITY_09", + "AD_PRIORITY_10", + "AD_PRIORITY_11", + "AD_PRIORITY_12", + "AD_PRIORITY_13", + "AD_PRIORITY_14", + "AD_PRIORITY_15", + "AD_PRIORITY_16" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ] + } + } + }, + "DfpSettings": { + "id": "DfpSettings", + "type": "object", + "description": "DFP Settings", + "properties": { + "dfp_network_code": { + "type": "string", + "description": "DFP network code for this directory site." + }, + "dfp_network_name": { + "type": "string", + "description": "DFP network name for this directory site." + }, + "programmaticPlacementAccepted": { + "type": "boolean", + "description": "Whether this directory site accepts programmatic placements." + }, + "pubPaidPlacementAccepted": { + "type": "boolean", + "description": "Whether this directory site accepts publisher-paid tags." + }, + "publisherPortalOnly": { + "type": "boolean", + "description": "Whether this directory site is available only via DoubleClick Publisher Portal." + } + } + }, + "Dimension": { + "id": "Dimension", + "type": "object", + "description": "Represents a dimension.", + "properties": { + "kind": { + "type": "string", + "description": "The kind of resource this is, in this case dfareporting#dimension.", + "default": "dfareporting#dimension" + }, + "name": { + "type": "string", + "description": "The dimension name, e.g. dfa:advertiser" + } + } + }, + "DimensionFilter": { + "id": "DimensionFilter", + "type": "object", + "description": "Represents a dimension filter.", + "properties": { + "dimensionName": { + "type": "string", + "description": "The name of the dimension to filter." + }, + "kind": { + "type": "string", + "description": "The kind of resource this is, in this case dfareporting#dimensionFilter.", + "default": "dfareporting#dimensionFilter" + }, + "value": { + "type": "string", + "description": "The value of the dimension to filter." + } + } + }, + "DimensionValue": { + "id": "DimensionValue", + "type": "object", + "description": "Represents a DimensionValue resource.", + "properties": { + "dimensionName": { + "type": "string", + "description": "The name of the dimension." + }, + "etag": { + "type": "string", + "description": "The eTag of this response for caching purposes." + }, + "id": { + "type": "string", + "description": "The ID associated with the value if available." + }, + "kind": { + "type": "string", + "description": "The kind of resource this is, in this case dfareporting#dimensionValue.", + "default": "dfareporting#dimensionValue" + }, + "matchType": { + "type": "string", + "description": "Determines how the 'value' field is matched when filtering. If not specified, defaults to EXACT. If set to WILDCARD_EXPRESSION, '*' is allowed as a placeholder for variable length character sequences, and it can be escaped with a backslash. Note, only paid search dimensions ('dfa:paidSearch*') allow a matchType other than EXACT.", + "enum": [ + "BEGINS_WITH", + "CONTAINS", + "EXACT", + "WILDCARD_EXPRESSION" + ], + "enumDescriptions": [ + "", + "", + "", + "" + ] + }, + "value": { + "type": "string", + "description": "The value of the dimension." + } + } + }, + "DimensionValueList": { + "id": "DimensionValueList", + "type": "object", + "description": "Represents the list of DimensionValue resources.", + "properties": { + "etag": { + "type": "string", + "description": "The eTag of this response for caching purposes." + }, + "items": { + "type": "array", + "description": "The dimension values returned in this response.", + "items": { + "$ref": "DimensionValue" + } + }, + "kind": { + "type": "string", + "description": "The kind of list this is, in this case dfareporting#dimensionValueList.", + "default": "dfareporting#dimensionValueList" + }, + "nextPageToken": { + "type": "string", + "description": "Continuation token used to page through dimension values. To retrieve the next page of results, set the next request's \"pageToken\" to the value of this field. The page token is only valid for a limited amount of time and should not be persisted." + } + } + }, + "DimensionValueRequest": { + "id": "DimensionValueRequest", + "type": "object", + "description": "Represents a DimensionValuesRequest.", + "properties": { + "dimensionName": { + "type": "string", + "description": "The name of the dimension for which values should be requested.", + "annotations": { + "required": [ + "dfareporting.dimensionValues.query" + ] + } + }, + "endDate": { + "type": "string", + "description": "The end date of the date range for which to retrieve dimension values. A string of the format \"yyyy-MM-dd\".", + "format": "date", + "annotations": { + "required": [ + "dfareporting.dimensionValues.query" + ] + } + }, + "filters": { + "type": "array", + "description": "The list of filters by which to filter values. The filters are ANDed.", + "items": { + "$ref": "DimensionFilter" + } + }, + "kind": { + "type": "string", + "description": "The kind of request this is, in this case dfareporting#dimensionValueRequest.", + "default": "dfareporting#dimensionValueRequest" + }, + "startDate": { + "type": "string", + "description": "The start date of the date range for which to retrieve dimension values. A string of the format \"yyyy-MM-dd\".", + "format": "date", + "annotations": { + "required": [ + "dfareporting.dimensionValues.query" + ] + } + } + } + }, + "DirectorySite": { + "id": "DirectorySite", + "type": "object", + "description": "DirectorySites contains properties of a website from the Site Directory. Sites need to be added to an account via the Sites resource before they can be assigned to a placement.", + "properties": { + "active": { + "type": "boolean", + "description": "Whether this directory site is active." + }, + "contactAssignments": { + "type": "array", + "description": "Directory site contacts.", + "items": { + "$ref": "DirectorySiteContactAssignment" + } + }, + "countryId": { + "type": "string", + "description": "Country ID of this directory site.", + "format": "int64" + }, + "currencyId": { + "type": "string", + "description": "Currency ID of this directory site.\nPossible values are: \n- \"1\" for USD \n- \"2\" for GBP \n- \"3\" for ESP \n- \"4\" for SEK \n- \"5\" for CAD \n- \"6\" for JPY \n- \"7\" for DEM \n- \"8\" for AUD \n- \"9\" for FRF \n- \"10\" for ITL \n- \"11\" for DKK \n- \"12\" for NOK \n- \"13\" for FIM \n- \"14\" for ZAR \n- \"15\" for IEP \n- \"16\" for NLG \n- \"17\" for EUR \n- \"18\" for KRW \n- \"19\" for TWD \n- \"20\" for SGD \n- \"21\" for CNY \n- \"22\" for HKD \n- \"23\" for NZD \n- \"24\" for MYR \n- \"25\" for BRL \n- \"26\" for PTE \n- \"27\" for MXP \n- \"28\" for CLP \n- \"29\" for TRY \n- \"30\" for ARS \n- \"31\" for PEN \n- \"32\" for ILS \n- \"33\" for CHF \n- \"34\" for VEF \n- \"35\" for COP \n- \"36\" for GTQ \n- \"37\" for PLN \n- \"39\" for INR \n- \"40\" for THB \n- \"41\" for IDR \n- \"42\" for CZK \n- \"43\" for RON \n- \"44\" for HUF \n- \"45\" for RUB \n- \"46\" for AED \n- \"47\" for BGN \n- \"48\" for HRK", + "format": "int64" + }, + "description": { + "type": "string", + "description": "Description of this directory site." + }, + "id": { + "type": "string", + "description": "ID of this directory site. This is a read-only, auto-generated field.", + "format": "int64" + }, + "idDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the ID of this directory site. This is a read-only, auto-generated field." + }, + "inpageTagFormats": { + "type": "array", + "description": "Tag types for regular placements.\n\nAcceptable values are:\n- \"STANDARD\"\n- \"IFRAME_JAVASCRIPT_INPAGE\"\n- \"INTERNAL_REDIRECT_INPAGE\"\n- \"JAVASCRIPT_INPAGE\"", + "items": { + "type": "string", + "enum": [ + "IFRAME_JAVASCRIPT_INPAGE", + "INTERNAL_REDIRECT_INPAGE", + "JAVASCRIPT_INPAGE", + "STANDARD" + ], + "enumDescriptions": [ + "", + "", + "", + "" + ] + } + }, + "interstitialTagFormats": { + "type": "array", + "description": "Tag types for interstitial placements.\n\nAcceptable values are:\n- \"IFRAME_JAVASCRIPT_INTERSTITIAL\"\n- \"INTERNAL_REDIRECT_INTERSTITIAL\"\n- \"JAVASCRIPT_INTERSTITIAL\"", + "items": { + "type": "string", + "enum": [ + "IFRAME_JAVASCRIPT_INTERSTITIAL", + "INTERNAL_REDIRECT_INTERSTITIAL", + "JAVASCRIPT_INTERSTITIAL" + ], + "enumDescriptions": [ + "", + "", + "" + ] + } + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#directorySite\".", + "default": "dfareporting#directorySite" + }, + "name": { + "type": "string", + "description": "Name of this directory site." + }, + "parentId": { + "type": "string", + "description": "Parent directory site ID.", + "format": "int64" + }, + "settings": { + "$ref": "DirectorySiteSettings", + "description": "Directory site settings." + }, + "url": { + "type": "string", + "description": "URL of this directory site." + } + } + }, + "DirectorySiteContact": { + "id": "DirectorySiteContact", + "type": "object", + "description": "Contains properties of a Site Directory contact.", + "properties": { + "address": { + "type": "string", + "description": "Address of this directory site contact." + }, + "email": { + "type": "string", + "description": "Email address of this directory site contact." + }, + "firstName": { + "type": "string", + "description": "First name of this directory site contact." + }, + "id": { + "type": "string", + "description": "ID of this directory site contact. This is a read-only, auto-generated field.", + "format": "int64" + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#directorySiteContact\".", + "default": "dfareporting#directorySiteContact" + }, + "lastName": { + "type": "string", + "description": "Last name of this directory site contact." + }, + "phone": { + "type": "string", + "description": "Phone number of this directory site contact." + }, + "role": { + "type": "string", + "description": "Directory site contact role.", + "enum": [ + "ADMIN", + "EDIT", + "VIEW" + ], + "enumDescriptions": [ + "", + "", + "" + ] + }, + "title": { + "type": "string", + "description": "Title or designation of this directory site contact." + }, + "type": { + "type": "string", + "description": "Directory site contact type.", + "enum": [ + "BILLING", + "OTHER", + "SALES", + "TECHNICAL" + ], + "enumDescriptions": [ + "", + "", + "", + "" + ] + } + } + }, + "DirectorySiteContactAssignment": { + "id": "DirectorySiteContactAssignment", + "type": "object", + "description": "Directory Site Contact Assignment", + "properties": { + "contactId": { + "type": "string", + "description": "ID of this directory site contact. This is a read-only, auto-generated field.", + "format": "int64" + }, + "visibility": { + "type": "string", + "description": "Visibility of this directory site contact assignment. When set to PUBLIC this contact assignment is visible to all account and agency users; when set to PRIVATE it is visible only to the site.", + "enum": [ + "PRIVATE", + "PUBLIC" + ], + "enumDescriptions": [ + "", + "" + ] + } + } + }, + "DirectorySiteContactsListResponse": { + "id": "DirectorySiteContactsListResponse", + "type": "object", + "description": "Directory Site Contact List Response", + "properties": { + "directorySiteContacts": { + "type": "array", + "description": "Directory site contact collection", + "items": { + "$ref": "DirectorySiteContact" + } + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#directorySiteContactsListResponse\".", + "default": "dfareporting#directorySiteContactsListResponse" + }, + "nextPageToken": { + "type": "string", + "description": "Pagination token to be used for the next list operation." + } + } + }, + "DirectorySiteSettings": { + "id": "DirectorySiteSettings", + "type": "object", + "description": "Directory Site Settings", + "properties": { + "activeViewOptOut": { + "type": "boolean", + "description": "Whether this directory site has disabled active view creatives." + }, + "dfp_settings": { + "$ref": "DfpSettings", + "description": "Directory site DFP settings." + }, + "instream_video_placement_accepted": { + "type": "boolean", + "description": "Whether this site accepts in-stream video ads." + }, + "interstitialPlacementAccepted": { + "type": "boolean", + "description": "Whether this site accepts interstitial ads." + }, + "nielsenOcrOptOut": { + "type": "boolean", + "description": "Whether this directory site has disabled Nielsen OCR reach ratings." + }, + "verificationTagOptOut": { + "type": "boolean", + "description": "Whether this directory site has disabled generation of Verification ins tags." + }, + "videoActiveViewOptOut": { + "type": "boolean", + "description": "Whether this directory site has disabled active view for in-stream video creatives." + } + } + }, + "DirectorySitesListResponse": { + "id": "DirectorySitesListResponse", + "type": "object", + "description": "Directory Site List Response", + "properties": { + "directorySites": { + "type": "array", + "description": "Directory site collection.", + "items": { + "$ref": "DirectorySite" + } + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#directorySitesListResponse\".", + "default": "dfareporting#directorySitesListResponse" + }, + "nextPageToken": { + "type": "string", + "description": "Pagination token to be used for the next list operation." + } + } + }, + "DynamicTargetingKey": { + "id": "DynamicTargetingKey", + "type": "object", + "description": "Contains properties of a dynamic targeting key. Dynamic targeting keys are unique, user-friendly labels, created at the advertiser level in DCM, that can be assigned to ads, creatives, and placements and used for targeting with DoubleClick Studio dynamic creatives. Use these labels instead of numeric DCM IDs (such as placement IDs) to save time and avoid errors in your dynamic feeds.", + "properties": { + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#dynamicTargetingKey\".", + "default": "dfareporting#dynamicTargetingKey" + }, + "name": { + "type": "string", + "description": "Name of this dynamic targeting key. This is a required field. Must be less than 256 characters long and cannot contain commas. All characters are converted to lowercase." + }, + "objectId": { + "type": "string", + "description": "ID of the object of this dynamic targeting key. This is a required field.", + "format": "int64" + }, + "objectType": { + "type": "string", + "description": "Type of the object of this dynamic targeting key. This is a required field.", + "enum": [ + "OBJECT_AD", + "OBJECT_ADVERTISER", + "OBJECT_CREATIVE", + "OBJECT_PLACEMENT" + ], + "enumDescriptions": [ + "", + "", + "", + "" + ] + } + } + }, + "DynamicTargetingKeysListResponse": { + "id": "DynamicTargetingKeysListResponse", + "type": "object", + "description": "Dynamic Targeting Key List Response", + "properties": { + "dynamicTargetingKeys": { + "type": "array", + "description": "Dynamic targeting key collection.", + "items": { + "$ref": "DynamicTargetingKey" + } + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#dynamicTargetingKeysListResponse\".", + "default": "dfareporting#dynamicTargetingKeysListResponse" + } + } + }, + "EncryptionInfo": { + "id": "EncryptionInfo", + "type": "object", + "description": "A description of how user IDs are encrypted.", + "properties": { + "encryptionEntityId": { + "type": "string", + "description": "The encryption entity ID. This should match the encryption configuration for ad serving or Data Transfer.", + "format": "int64" + }, + "encryptionEntityType": { + "type": "string", + "description": "The encryption entity type. This should match the encryption configuration for ad serving or Data Transfer.", + "enum": [ + "ADWORDS_CUSTOMER", + "DBM_ADVERTISER", + "DBM_PARTNER", + "DCM_ACCOUNT", + "DCM_ADVERTISER", + "ENCRYPTION_ENTITY_TYPE_UNKNOWN" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "", + "" + ] + }, + "encryptionSource": { + "type": "string", + "description": "Describes whether the encrypted cookie was received from ad serving (the %m macro) or from Data Transfer.", + "enum": [ + "AD_SERVING", + "DATA_TRANSFER", + "ENCRYPTION_SCOPE_UNKNOWN" + ], + "enumDescriptions": [ + "", + "", + "" + ] + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#encryptionInfo\".", + "default": "dfareporting#encryptionInfo" + } + } + }, + "EventTag": { + "id": "EventTag", + "type": "object", + "description": "Contains properties of an event tag.", + "properties": { + "accountId": { + "type": "string", + "description": "Account ID of this event tag. This is a read-only field that can be left blank.", + "format": "int64" + }, + "advertiserId": { + "type": "string", + "description": "Advertiser ID of this event tag. This field or the campaignId field is required on insertion.", + "format": "int64" + }, + "advertiserIdDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the ID of the advertiser. This is a read-only, auto-generated field." + }, + "campaignId": { + "type": "string", + "description": "Campaign ID of this event tag. This field or the advertiserId field is required on insertion.", + "format": "int64" + }, + "campaignIdDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the ID of the campaign. This is a read-only, auto-generated field." + }, + "enabledByDefault": { + "type": "boolean", + "description": "Whether this event tag should be automatically enabled for all of the advertiser's campaigns and ads." + }, + "excludeFromAdxRequests": { + "type": "boolean", + "description": "Whether to remove this event tag from ads that are trafficked through DoubleClick Bid Manager to Ad Exchange. This may be useful if the event tag uses a pixel that is unapproved for Ad Exchange bids on one or more networks, such as the Google Display Network." + }, + "id": { + "type": "string", + "description": "ID of this event tag. This is a read-only, auto-generated field.", + "format": "int64" + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#eventTag\".", + "default": "dfareporting#eventTag" + }, + "name": { + "type": "string", + "description": "Name of this event tag. This is a required field and must be less than 256 characters long." + }, + "siteFilterType": { + "type": "string", + "description": "Site filter type for this event tag. If no type is specified then the event tag will be applied to all sites.", + "enum": [ + "BLACKLIST", + "WHITELIST" + ], + "enumDescriptions": [ + "", + "" + ] + }, + "siteIds": { + "type": "array", + "description": "Filter list of site IDs associated with this event tag. The siteFilterType determines whether this is a whitelist or blacklist filter.", + "items": { + "type": "string", + "format": "int64" + } + }, + "sslCompliant": { + "type": "boolean", + "description": "Whether this tag is SSL-compliant or not. This is a read-only field." + }, + "status": { + "type": "string", + "description": "Status of this event tag. Must be ENABLED for this event tag to fire. This is a required field.", + "enum": [ + "DISABLED", + "ENABLED" + ], + "enumDescriptions": [ + "", + "" + ] + }, + "subaccountId": { + "type": "string", + "description": "Subaccount ID of this event tag. This is a read-only field that can be left blank.", + "format": "int64" + }, + "type": { + "type": "string", + "description": "Event tag type. Can be used to specify whether to use a third-party pixel, a third-party JavaScript URL, or a third-party click-through URL for either impression or click tracking. This is a required field.", + "enum": [ + "CLICK_THROUGH_EVENT_TAG", + "IMPRESSION_IMAGE_EVENT_TAG", + "IMPRESSION_JAVASCRIPT_EVENT_TAG" + ], + "enumDescriptions": [ + "", + "", + "" + ] + }, + "url": { + "type": "string", + "description": "Payload URL for this event tag. The URL on a click-through event tag should have a landing page URL appended to the end of it. This field is required on insertion." + }, + "urlEscapeLevels": { + "type": "integer", + "description": "Number of times the landing page URL should be URL-escaped before being appended to the click-through event tag URL. Only applies to click-through event tags as specified by the event tag type.", + "format": "int32" + } + } + }, + "EventTagOverride": { + "id": "EventTagOverride", + "type": "object", + "description": "Event tag override information.", + "properties": { + "enabled": { + "type": "boolean", + "description": "Whether this override is enabled." + }, + "id": { + "type": "string", + "description": "ID of this event tag override. This is a read-only, auto-generated field.", + "format": "int64" + } + } + }, + "EventTagsListResponse": { + "id": "EventTagsListResponse", + "type": "object", + "description": "Event Tag List Response", + "properties": { + "eventTags": { + "type": "array", + "description": "Event tag collection.", + "items": { + "$ref": "EventTag" + } + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#eventTagsListResponse\".", + "default": "dfareporting#eventTagsListResponse" + } + } + }, + "File": { + "id": "File", + "type": "object", + "description": "Represents a File resource. A file contains the metadata for a report run. It shows the status of the run and holds the URLs to the generated report data if the run is finished and the status is \"REPORT_AVAILABLE\".", + "properties": { + "dateRange": { + "$ref": "DateRange", + "description": "The date range for which the file has report data. The date range will always be the absolute date range for which the report is run." + }, + "etag": { + "type": "string", + "description": "The eTag of this response for caching purposes." + }, + "fileName": { + "type": "string", + "description": "The filename of the file." + }, + "format": { + "type": "string", + "description": "The output format of the report. Only available once the file is available.", + "enum": [ + "CSV", + "EXCEL" + ], + "enumDescriptions": [ + "", + "" + ] + }, + "id": { + "type": "string", + "description": "The unique ID of this report file.", + "format": "int64" + }, + "kind": { + "type": "string", + "description": "The kind of resource this is, in this case dfareporting#file.", + "default": "dfareporting#file" + }, + "lastModifiedTime": { + "type": "string", + "description": "The timestamp in milliseconds since epoch when this file was last modified.", + "format": "int64" + }, + "reportId": { + "type": "string", + "description": "The ID of the report this file was generated from.", + "format": "int64" + }, + "status": { + "type": "string", + "description": "The status of the report file.", + "enum": [ + "CANCELLED", + "FAILED", + "PROCESSING", + "REPORT_AVAILABLE" + ], + "enumDescriptions": [ + "", + "", + "", + "" + ] + }, + "urls": { + "type": "object", + "description": "The URLs where the completed report file can be downloaded.", + "properties": { + "apiUrl": { + "type": "string", + "description": "The URL for downloading the report data through the API." + }, + "browserUrl": { + "type": "string", + "description": "The URL for downloading the report data through a browser." + } + } + } + } + }, + "FileList": { + "id": "FileList", + "type": "object", + "description": "Represents the list of File resources.", + "properties": { + "etag": { + "type": "string", + "description": "The eTag of this response for caching purposes." + }, + "items": { + "type": "array", + "description": "The files returned in this response.", + "items": { + "$ref": "File" + } + }, + "kind": { + "type": "string", + "description": "The kind of list this is, in this case dfareporting#fileList.", + "default": "dfareporting#fileList" + }, + "nextPageToken": { + "type": "string", + "description": "Continuation token used to page through files. To retrieve the next page of results, set the next request's \"pageToken\" to the value of this field. The page token is only valid for a limited amount of time and should not be persisted." + } + } + }, + "Flight": { + "id": "Flight", + "type": "object", + "description": "Flight", + "properties": { + "endDate": { + "type": "string", + "description": "Inventory item flight end date.", + "format": "date" + }, + "rateOrCost": { + "type": "string", + "description": "Rate or cost of this flight.", + "format": "int64" + }, + "startDate": { + "type": "string", + "description": "Inventory item flight start date.", + "format": "date" + }, + "units": { + "type": "string", + "description": "Units of this flight.", + "format": "int64" + } + } + }, + "FloodlightActivitiesGenerateTagResponse": { + "id": "FloodlightActivitiesGenerateTagResponse", + "type": "object", + "description": "Floodlight Activity GenerateTag Response", + "properties": { + "floodlightActivityTag": { + "type": "string", + "description": "Generated tag for this floodlight activity." + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#floodlightActivitiesGenerateTagResponse\".", + "default": "dfareporting#floodlightActivitiesGenerateTagResponse" + } + } + }, + "FloodlightActivitiesListResponse": { + "id": "FloodlightActivitiesListResponse", + "type": "object", + "description": "Floodlight Activity List Response", + "properties": { + "floodlightActivities": { + "type": "array", + "description": "Floodlight activity collection.", + "items": { + "$ref": "FloodlightActivity" + } + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#floodlightActivitiesListResponse\".", + "default": "dfareporting#floodlightActivitiesListResponse" + }, + "nextPageToken": { + "type": "string", + "description": "Pagination token to be used for the next list operation." + } + } + }, + "FloodlightActivity": { + "id": "FloodlightActivity", + "type": "object", + "description": "Contains properties of a Floodlight activity.", + "properties": { + "accountId": { + "type": "string", + "description": "Account ID of this floodlight activity. This is a read-only field that can be left blank.", + "format": "int64" + }, + "advertiserId": { + "type": "string", + "description": "Advertiser ID of this floodlight activity. If this field is left blank, the value will be copied over either from the activity group's advertiser or the existing activity's advertiser.", + "format": "int64" + }, + "advertiserIdDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the ID of the advertiser. This is a read-only, auto-generated field." + }, + "cacheBustingType": { + "type": "string", + "description": "Code type used for cache busting in the generated tag.", + "enum": [ + "ACTIVE_SERVER_PAGE", + "COLD_FUSION", + "JAVASCRIPT", + "JSP", + "PHP" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "" + ] + }, + "countingMethod": { + "type": "string", + "description": "Counting method for conversions for this floodlight activity. This is a required field.", + "enum": [ + "ITEMS_SOLD_COUNTING", + "SESSION_COUNTING", + "STANDARD_COUNTING", + "TRANSACTIONS_COUNTING", + "UNIQUE_COUNTING" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "" + ] + }, + "defaultTags": { + "type": "array", + "description": "Dynamic floodlight tags.", + "items": { + "$ref": "FloodlightActivityDynamicTag" + } + }, + "expectedUrl": { + "type": "string", + "description": "URL where this tag will be deployed. If specified, must be less than 256 characters long." + }, + "floodlightActivityGroupId": { + "type": "string", + "description": "Floodlight activity group ID of this floodlight activity. This is a required field.", + "format": "int64" + }, + "floodlightActivityGroupName": { + "type": "string", + "description": "Name of the associated floodlight activity group. This is a read-only field." + }, + "floodlightActivityGroupTagString": { + "type": "string", + "description": "Tag string of the associated floodlight activity group. This is a read-only field." + }, + "floodlightActivityGroupType": { + "type": "string", + "description": "Type of the associated floodlight activity group. This is a read-only field.", + "enum": [ + "COUNTER", + "SALE" + ], + "enumDescriptions": [ + "", + "" + ] + }, + "floodlightConfigurationId": { + "type": "string", + "description": "Floodlight configuration ID of this floodlight activity. If this field is left blank, the value will be copied over either from the activity group's floodlight configuration or from the existing activity's floodlight configuration.", + "format": "int64" + }, + "floodlightConfigurationIdDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the ID of the floodlight configuration. This is a read-only, auto-generated field." + }, + "hidden": { + "type": "boolean", + "description": "Whether this activity is archived." + }, + "id": { + "type": "string", + "description": "ID of this floodlight activity. This is a read-only, auto-generated field.", + "format": "int64" + }, + "idDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the ID of this floodlight activity. This is a read-only, auto-generated field." + }, + "imageTagEnabled": { + "type": "boolean", + "description": "Whether the image tag is enabled for this activity." + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#floodlightActivity\".", + "default": "dfareporting#floodlightActivity" + }, + "name": { + "type": "string", + "description": "Name of this floodlight activity. This is a required field. Must be less than 129 characters long and cannot contain quotes." + }, + "notes": { + "type": "string", + "description": "General notes or implementation instructions for the tag." + }, + "publisherTags": { + "type": "array", + "description": "Publisher dynamic floodlight tags.", + "items": { + "$ref": "FloodlightActivityPublisherDynamicTag" + } + }, + "secure": { + "type": "boolean", + "description": "Whether this tag should use SSL." + }, + "sslCompliant": { + "type": "boolean", + "description": "Whether the floodlight activity is SSL-compliant. This is a read-only field, its value detected by the system from the floodlight tags." + }, + "sslRequired": { + "type": "boolean", + "description": "Whether this floodlight activity must be SSL-compliant." + }, + "subaccountId": { + "type": "string", + "description": "Subaccount ID of this floodlight activity. This is a read-only field that can be left blank.", + "format": "int64" + }, + "tagFormat": { + "type": "string", + "description": "Tag format type for the floodlight activity. If left blank, the tag format will default to HTML.", + "enum": [ + "HTML", + "XHTML" + ], + "enumDescriptions": [ + "", + "" + ] + }, + "tagString": { + "type": "string", + "description": "Value of the cat= paramter in the floodlight tag, which the ad servers use to identify the activity. This is optional: if empty, a new tag string will be generated for you. This string must be 1 to 8 characters long, with valid characters being [a-z][A-Z][0-9][-][ _ ]. This tag string must also be unique among activities of the same activity group. This field is read-only after insertion." + }, + "userDefinedVariableTypes": { + "type": "array", + "description": "List of the user-defined variables used by this conversion tag. These map to the \"u[1-20]=\" in the tags. Each of these can have a user defined type.\nAcceptable values are:\n- \"U1\"\n- \"U2\"\n- \"U3\"\n- \"U4\"\n- \"U5\"\n- \"U6\"\n- \"U7\"\n- \"U8\"\n- \"U9\"\n- \"U10\"\n- \"U11\"\n- \"U12\"\n- \"U13\"\n- \"U14\"\n- \"U15\"\n- \"U16\"\n- \"U17\"\n- \"U18\"\n- \"U19\"\n- \"U20\"", + "items": { + "type": "string", + "enum": [ + "U1", + "U10", + "U100", + "U11", + "U12", + "U13", + "U14", + "U15", + "U16", + "U17", + "U18", + "U19", + "U2", + "U20", + "U21", + "U22", + "U23", + "U24", + "U25", + "U26", + "U27", + "U28", + "U29", + "U3", + "U30", + "U31", + "U32", + "U33", + "U34", + "U35", + "U36", + "U37", + "U38", + "U39", + "U4", + "U40", + "U41", + "U42", + "U43", + "U44", + "U45", + "U46", + "U47", + "U48", + "U49", + "U5", + "U50", + "U51", + "U52", + "U53", + "U54", + "U55", + "U56", + "U57", + "U58", + "U59", + "U6", + "U60", + "U61", + "U62", + "U63", + "U64", + "U65", + "U66", + "U67", + "U68", + "U69", + "U7", + "U70", + "U71", + "U72", + "U73", + "U74", + "U75", + "U76", + "U77", + "U78", + "U79", + "U8", + "U80", + "U81", + "U82", + "U83", + "U84", + "U85", + "U86", + "U87", + "U88", + "U89", + "U9", + "U90", + "U91", + "U92", + "U93", + "U94", + "U95", + "U96", + "U97", + "U98", + "U99" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ] + } + } + } + }, + "FloodlightActivityDynamicTag": { + "id": "FloodlightActivityDynamicTag", + "type": "object", + "description": "Dynamic Tag", + "properties": { + "id": { + "type": "string", + "description": "ID of this dynamic tag. This is a read-only, auto-generated field.", + "format": "int64" + }, + "name": { + "type": "string", + "description": "Name of this tag." + }, + "tag": { + "type": "string", + "description": "Tag code." + } + } + }, + "FloodlightActivityGroup": { + "id": "FloodlightActivityGroup", + "type": "object", + "description": "Contains properties of a Floodlight activity group.", + "properties": { + "accountId": { + "type": "string", + "description": "Account ID of this floodlight activity group. This is a read-only field that can be left blank.", + "format": "int64" + }, + "advertiserId": { + "type": "string", + "description": "Advertiser ID of this floodlight activity group. If this field is left blank, the value will be copied over either from the floodlight configuration's advertiser or from the existing activity group's advertiser.", + "format": "int64" + }, + "advertiserIdDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the ID of the advertiser. This is a read-only, auto-generated field." + }, + "floodlightConfigurationId": { + "type": "string", + "description": "Floodlight configuration ID of this floodlight activity group. This is a required field.", + "format": "int64" + }, + "floodlightConfigurationIdDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the ID of the floodlight configuration. This is a read-only, auto-generated field." + }, + "id": { + "type": "string", + "description": "ID of this floodlight activity group. This is a read-only, auto-generated field.", + "format": "int64" + }, + "idDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the ID of this floodlight activity group. This is a read-only, auto-generated field." + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#floodlightActivityGroup\".", + "default": "dfareporting#floodlightActivityGroup" + }, + "name": { + "type": "string", + "description": "Name of this floodlight activity group. This is a required field. Must be less than 65 characters long and cannot contain quotes." + }, + "subaccountId": { + "type": "string", + "description": "Subaccount ID of this floodlight activity group. This is a read-only field that can be left blank.", + "format": "int64" + }, + "tagString": { + "type": "string", + "description": "Value of the type= parameter in the floodlight tag, which the ad servers use to identify the activity group that the activity belongs to. This is optional: if empty, a new tag string will be generated for you. This string must be 1 to 8 characters long, with valid characters being [a-z][A-Z][0-9][-][ _ ]. This tag string must also be unique among activity groups of the same floodlight configuration. This field is read-only after insertion." + }, + "type": { + "type": "string", + "description": "Type of the floodlight activity group. This is a required field that is read-only after insertion.", + "enum": [ + "COUNTER", + "SALE" + ], + "enumDescriptions": [ + "", + "" + ] + } + } + }, + "FloodlightActivityGroupsListResponse": { + "id": "FloodlightActivityGroupsListResponse", + "type": "object", + "description": "Floodlight Activity Group List Response", + "properties": { + "floodlightActivityGroups": { + "type": "array", + "description": "Floodlight activity group collection.", + "items": { + "$ref": "FloodlightActivityGroup" + } + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#floodlightActivityGroupsListResponse\".", + "default": "dfareporting#floodlightActivityGroupsListResponse" + }, + "nextPageToken": { + "type": "string", + "description": "Pagination token to be used for the next list operation." + } + } + }, + "FloodlightActivityPublisherDynamicTag": { + "id": "FloodlightActivityPublisherDynamicTag", + "type": "object", + "description": "Publisher Dynamic Tag", + "properties": { + "clickThrough": { + "type": "boolean", + "description": "Whether this tag is applicable only for click-throughs." + }, + "directorySiteId": { + "type": "string", + "description": "Directory site ID of this dynamic tag. This is a write-only field that can be used as an alternative to the siteId field. When this resource is retrieved, only the siteId field will be populated.", + "format": "int64" + }, + "dynamicTag": { + "$ref": "FloodlightActivityDynamicTag", + "description": "Dynamic floodlight tag." + }, + "siteId": { + "type": "string", + "description": "Site ID of this dynamic tag.", + "format": "int64" + }, + "siteIdDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the ID of the site. This is a read-only, auto-generated field." + }, + "viewThrough": { + "type": "boolean", + "description": "Whether this tag is applicable only for view-throughs." + } + } + }, + "FloodlightConfiguration": { + "id": "FloodlightConfiguration", + "type": "object", + "description": "Contains properties of a Floodlight configuration.", + "properties": { + "accountId": { + "type": "string", + "description": "Account ID of this floodlight configuration. This is a read-only field that can be left blank.", + "format": "int64" + }, + "advertiserId": { + "type": "string", + "description": "Advertiser ID of the parent advertiser of this floodlight configuration.", + "format": "int64" + }, + "advertiserIdDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the ID of the advertiser. This is a read-only, auto-generated field." + }, + "analyticsDataSharingEnabled": { + "type": "boolean", + "description": "Whether advertiser data is shared with Google Analytics." + }, + "exposureToConversionEnabled": { + "type": "boolean", + "description": "Whether the exposure-to-conversion report is enabled. This report shows detailed pathway information on up to 10 of the most recent ad exposures seen by a user before converting." + }, + "firstDayOfWeek": { + "type": "string", + "description": "Day that will be counted as the first day of the week in reports. This is a required field.", + "enum": [ + "MONDAY", + "SUNDAY" + ], + "enumDescriptions": [ + "", + "" + ] + }, + "id": { + "type": "string", + "description": "ID of this floodlight configuration. This is a read-only, auto-generated field.", + "format": "int64" + }, + "idDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the ID of this floodlight configuration. This is a read-only, auto-generated field." + }, + "inAppAttributionTrackingEnabled": { + "type": "boolean", + "description": "Whether in-app attribution tracking is enabled." + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#floodlightConfiguration\".", + "default": "dfareporting#floodlightConfiguration" + }, + "lookbackConfiguration": { + "$ref": "LookbackConfiguration", + "description": "Lookback window settings for this floodlight configuration." + }, + "naturalSearchConversionAttributionOption": { + "type": "string", + "description": "Types of attribution options for natural search conversions.", + "enum": [ + "EXCLUDE_NATURAL_SEARCH_CONVERSION_ATTRIBUTION", + "INCLUDE_NATURAL_SEARCH_CONVERSION_ATTRIBUTION", + "INCLUDE_NATURAL_SEARCH_TIERED_CONVERSION_ATTRIBUTION" + ], + "enumDescriptions": [ + "", + "", + "" + ] + }, + "omnitureSettings": { + "$ref": "OmnitureSettings", + "description": "Settings for DCM Omniture integration." + }, + "standardVariableTypes": { + "type": "array", + "description": "List of standard variables enabled for this configuration.\n\nAcceptable values are:\n- \"ORD\"\n- \"NUM\"", + "items": { + "type": "string", + "enum": [ + "NUM", + "ORD", + "TRAN", + "U" + ], + "enumDescriptions": [ + "", + "", + "", + "" + ] + } + }, + "subaccountId": { + "type": "string", + "description": "Subaccount ID of this floodlight configuration. This is a read-only field that can be left blank.", + "format": "int64" + }, + "tagSettings": { + "$ref": "TagSettings", + "description": "Configuration settings for dynamic and image floodlight tags." + }, + "thirdPartyAuthenticationTokens": { + "type": "array", + "description": "List of third-party authentication tokens enabled for this configuration.", + "items": { + "$ref": "ThirdPartyAuthenticationToken" + } + }, + "userDefinedVariableConfigurations": { + "type": "array", + "description": "List of user defined variables enabled for this configuration.", + "items": { + "$ref": "UserDefinedVariableConfiguration" + } + } + } + }, + "FloodlightConfigurationsListResponse": { + "id": "FloodlightConfigurationsListResponse", + "type": "object", + "description": "Floodlight Configuration List Response", + "properties": { + "floodlightConfigurations": { + "type": "array", + "description": "Floodlight configuration collection.", + "items": { + "$ref": "FloodlightConfiguration" + } + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#floodlightConfigurationsListResponse\".", + "default": "dfareporting#floodlightConfigurationsListResponse" + } + } + }, + "FloodlightReportCompatibleFields": { + "id": "FloodlightReportCompatibleFields", + "type": "object", + "description": "Represents fields that are compatible to be selected for a report of type \"FlOODLIGHT\".", + "properties": { + "dimensionFilters": { + "type": "array", + "description": "Dimensions which are compatible to be selected in the \"dimensionFilters\" section of the report.", + "items": { + "$ref": "Dimension" + } + }, + "dimensions": { + "type": "array", + "description": "Dimensions which are compatible to be selected in the \"dimensions\" section of the report.", + "items": { + "$ref": "Dimension" + } + }, + "kind": { + "type": "string", + "description": "The kind of resource this is, in this case dfareporting#floodlightReportCompatibleFields.", + "default": "dfareporting#floodlightReportCompatibleFields" + }, + "metrics": { + "type": "array", + "description": "Metrics which are compatible to be selected in the \"metricNames\" section of the report.", + "items": { + "$ref": "Metric" + } + } + } + }, + "FrequencyCap": { + "id": "FrequencyCap", + "type": "object", + "description": "Frequency Cap.", + "properties": { + "duration": { + "type": "string", + "description": "Duration of time, in seconds, for this frequency cap. The maximum duration is 90 days in seconds, or 7,776,000.", + "format": "int64" + }, + "impressions": { + "type": "string", + "description": "Number of times an individual user can be served the ad within the specified duration. The maximum allowed is 15.", + "format": "int64" + } + } + }, + "FsCommand": { + "id": "FsCommand", + "type": "object", + "description": "FsCommand.", + "properties": { + "left": { + "type": "integer", + "description": "Distance from the left of the browser.Applicable when positionOption is DISTANCE_FROM_TOP_LEFT_CORNER.", + "format": "int32" + }, + "positionOption": { + "type": "string", + "description": "Position in the browser where the window will open.", + "enum": [ + "CENTERED", + "DISTANCE_FROM_TOP_LEFT_CORNER" + ], + "enumDescriptions": [ + "", + "" + ] + }, + "top": { + "type": "integer", + "description": "Distance from the top of the browser. Applicable when positionOption is DISTANCE_FROM_TOP_LEFT_CORNER.", + "format": "int32" + }, + "windowHeight": { + "type": "integer", + "description": "Height of the window.", + "format": "int32" + }, + "windowWidth": { + "type": "integer", + "description": "Width of the window.", + "format": "int32" + } + } + }, + "GeoTargeting": { + "id": "GeoTargeting", + "type": "object", + "description": "Geographical Targeting.", + "properties": { + "cities": { + "type": "array", + "description": "Cities to be targeted. For each city only dartId is required. The other fields are populated automatically when the ad is inserted or updated. If targeting a city, do not target or exclude the country of the city, and do not target the metro or region of the city.", + "items": { + "$ref": "City" + } + }, + "countries": { + "type": "array", + "description": "Countries to be targeted or excluded from targeting, depending on the setting of the excludeCountries field. For each country only dartId is required. The other fields are populated automatically when the ad is inserted or updated. If targeting or excluding a country, do not target regions, cities, metros, or postal codes in the same country.", + "items": { + "$ref": "Country" + } + }, + "excludeCountries": { + "type": "boolean", + "description": "Whether or not to exclude the countries in the countries field from targeting. If false, the countries field refers to countries which will be targeted by the ad." + }, + "metros": { + "type": "array", + "description": "Metros to be targeted. For each metro only dmaId is required. The other fields are populated automatically when the ad is inserted or updated. If targeting a metro, do not target or exclude the country of the metro.", + "items": { + "$ref": "Metro" + } + }, + "postalCodes": { + "type": "array", + "description": "Postal codes to be targeted. For each postal code only id is required. The other fields are populated automatically when the ad is inserted or updated. If targeting a postal code, do not target or exclude the country of the postal code.", + "items": { + "$ref": "PostalCode" + } + }, + "regions": { + "type": "array", + "description": "Regions to be targeted. For each region only dartId is required. The other fields are populated automatically when the ad is inserted or updated. If targeting a region, do not target or exclude the country of the region.", + "items": { + "$ref": "Region" + } + } + } + }, + "InventoryItem": { + "id": "InventoryItem", + "type": "object", + "description": "Represents a buy from the DoubleClick Planning inventory store.", + "properties": { + "accountId": { + "type": "string", + "description": "Account ID of this inventory item.", + "format": "int64" + }, + "adSlots": { + "type": "array", + "description": "Ad slots of this inventory item. If this inventory item represents a standalone placement, there will be exactly one ad slot. If this inventory item represents a placement group, there will be more than one ad slot, each representing one child placement in that placement group.", + "items": { + "$ref": "AdSlot" + } + }, + "advertiserId": { + "type": "string", + "description": "Advertiser ID of this inventory item.", + "format": "int64" + }, + "contentCategoryId": { + "type": "string", + "description": "Content category ID of this inventory item.", + "format": "int64" + }, + "estimatedClickThroughRate": { + "type": "string", + "description": "Estimated click-through rate of this inventory item.", + "format": "int64" + }, + "estimatedConversionRate": { + "type": "string", + "description": "Estimated conversion rate of this inventory item.", + "format": "int64" + }, + "id": { + "type": "string", + "description": "ID of this inventory item.", + "format": "int64" + }, + "inPlan": { + "type": "boolean", + "description": "Whether this inventory item is in plan." + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#inventoryItem\".", + "default": "dfareporting#inventoryItem" + }, + "lastModifiedInfo": { + "$ref": "LastModifiedInfo", + "description": "Information about the most recent modification of this inventory item." + }, + "name": { + "type": "string", + "description": "Name of this inventory item. For standalone inventory items, this is the same name as that of its only ad slot. For group inventory items, this can differ from the name of any of its ad slots." + }, + "negotiationChannelId": { + "type": "string", + "description": "Negotiation channel ID of this inventory item.", + "format": "int64" + }, + "orderId": { + "type": "string", + "description": "Order ID of this inventory item.", + "format": "int64" + }, + "placementStrategyId": { + "type": "string", + "description": "Placement strategy ID of this inventory item.", + "format": "int64" + }, + "pricing": { + "$ref": "Pricing", + "description": "Pricing of this inventory item." + }, + "projectId": { + "type": "string", + "description": "Project ID of this inventory item.", + "format": "int64" + }, + "rfpId": { + "type": "string", + "description": "RFP ID of this inventory item.", + "format": "int64" + }, + "siteId": { + "type": "string", + "description": "ID of the site this inventory item is associated with.", + "format": "int64" + }, + "subaccountId": { + "type": "string", + "description": "Subaccount ID of this inventory item.", + "format": "int64" + }, + "type": { + "type": "string", + "description": "Type of inventory item.", + "enum": [ + "PLANNING_PLACEMENT_TYPE_CREDIT", + "PLANNING_PLACEMENT_TYPE_REGULAR" + ], + "enumDescriptions": [ + "", + "" + ] + } + } + }, + "InventoryItemsListResponse": { + "id": "InventoryItemsListResponse", + "type": "object", + "description": "Inventory item List Response", + "properties": { + "inventoryItems": { + "type": "array", + "description": "Inventory item collection", + "items": { + "$ref": "InventoryItem" + } + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#inventoryItemsListResponse\".", + "default": "dfareporting#inventoryItemsListResponse" + }, + "nextPageToken": { + "type": "string", + "description": "Pagination token to be used for the next list operation." + } + } + }, + "KeyValueTargetingExpression": { + "id": "KeyValueTargetingExpression", + "type": "object", + "description": "Key Value Targeting Expression.", + "properties": { + "expression": { + "type": "string", + "description": "Keyword expression being targeted by the ad." + } + } + }, + "LandingPage": { + "id": "LandingPage", + "type": "object", + "description": "Contains information about where a user's browser is taken after the user clicks an ad.", + "properties": { + "default": { + "type": "boolean", + "description": "Whether or not this landing page will be assigned to any ads or creatives that do not have a landing page assigned explicitly. Only one default landing page is allowed per campaign." + }, + "id": { + "type": "string", + "description": "ID of this landing page. This is a read-only, auto-generated field.", + "format": "int64" + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#landingPage\".", + "default": "dfareporting#landingPage" + }, + "name": { + "type": "string", + "description": "Name of this landing page. This is a required field. It must be less than 256 characters long, and must be unique among landing pages of the same campaign." + }, + "url": { + "type": "string", + "description": "URL of this landing page. This is a required field." + } + } + }, + "LandingPagesListResponse": { + "id": "LandingPagesListResponse", + "type": "object", + "description": "Landing Page List Response", + "properties": { + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#landingPagesListResponse\".", + "default": "dfareporting#landingPagesListResponse" + }, + "landingPages": { + "type": "array", + "description": "Landing page collection", + "items": { + "$ref": "LandingPage" + } + } + } + }, + "Language": { + "id": "Language", + "type": "object", + "description": "Contains information about a language that can be targeted by ads.", + "properties": { + "id": { + "type": "string", + "description": "Language ID of this language. This is the ID used for targeting and generating reports.", + "format": "int64" + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#language\".", + "default": "dfareporting#language" + }, + "languageCode": { + "type": "string", + "description": "Format of language code is an ISO 639 two-letter language code optionally followed by an underscore followed by an ISO 3166 code. Examples are \"en\" for English or \"zh_CN\" for Simplified Chinese." + }, + "name": { + "type": "string", + "description": "Name of this language." + } + } + }, + "LanguageTargeting": { + "id": "LanguageTargeting", + "type": "object", + "description": "Language Targeting.", + "properties": { + "languages": { + "type": "array", + "description": "Languages that this ad targets. For each language only languageId is required. The other fields are populated automatically when the ad is inserted or updated.", + "items": { + "$ref": "Language" + } + } + } + }, + "LanguagesListResponse": { + "id": "LanguagesListResponse", + "type": "object", + "description": "Language List Response", + "properties": { + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#languagesListResponse\".", + "default": "dfareporting#languagesListResponse" + }, + "languages": { + "type": "array", + "description": "Language collection.", + "items": { + "$ref": "Language" + } + } + } + }, + "LastModifiedInfo": { + "id": "LastModifiedInfo", + "type": "object", + "description": "Modification timestamp.", + "properties": { + "time": { + "type": "string", + "description": "Timestamp of the last change in milliseconds since epoch.", + "format": "int64" + } + } + }, + "ListPopulationClause": { + "id": "ListPopulationClause", + "type": "object", + "description": "A group clause made up of list population terms representing constraints joined by ORs.", + "properties": { + "terms": { + "type": "array", + "description": "Terms of this list population clause. Each clause is made up of list population terms representing constraints and are joined by ORs.", + "items": { + "$ref": "ListPopulationTerm" + } + } + } + }, + "ListPopulationRule": { + "id": "ListPopulationRule", + "type": "object", + "description": "Remarketing List Population Rule.", + "properties": { + "floodlightActivityId": { + "type": "string", + "description": "Floodlight activity ID associated with this rule. This field can be left blank.", + "format": "int64" + }, + "floodlightActivityName": { + "type": "string", + "description": "Name of floodlight activity associated with this rule. This is a read-only, auto-generated field." + }, + "listPopulationClauses": { + "type": "array", + "description": "Clauses that make up this list population rule. Clauses are joined by ANDs, and the clauses themselves are made up of list population terms which are joined by ORs.", + "items": { + "$ref": "ListPopulationClause" + } + } + } + }, + "ListPopulationTerm": { + "id": "ListPopulationTerm", + "type": "object", + "description": "Remarketing List Population Rule Term.", + "properties": { + "contains": { + "type": "boolean", + "description": "Will be true if the term should check if the user is in the list and false if the term should check if the user is not in the list. This field is only relevant when type is set to LIST_MEMBERSHIP_TERM. False by default." + }, + "negation": { + "type": "boolean", + "description": "Whether to negate the comparison result of this term during rule evaluation. This field is only relevant when type is left unset or set to CUSTOM_VARIABLE_TERM or REFERRER_TERM." + }, + "operator": { + "type": "string", + "description": "Comparison operator of this term. This field is only relevant when type is left unset or set to CUSTOM_VARIABLE_TERM or REFERRER_TERM.", + "enum": [ + "NUM_EQUALS", + "NUM_GREATER_THAN", + "NUM_GREATER_THAN_EQUAL", + "NUM_LESS_THAN", + "NUM_LESS_THAN_EQUAL", + "STRING_CONTAINS", + "STRING_EQUALS" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "", + "", + "" + ] + }, + "remarketingListId": { + "type": "string", + "description": "ID of the list in question. This field is only relevant when type is set to LIST_MEMBERSHIP_TERM.", + "format": "int64" + }, + "type": { + "type": "string", + "description": "List population term type determines the applicable fields in this object. If left unset or set to CUSTOM_VARIABLE_TERM, then variableName, variableFriendlyName, operator, value, and negation are applicable. If set to LIST_MEMBERSHIP_TERM then remarketingListId and contains are applicable. If set to REFERRER_TERM then operator, value, and negation are applicable.", + "enum": [ + "CUSTOM_VARIABLE_TERM", + "LIST_MEMBERSHIP_TERM", + "REFERRER_TERM" + ], + "enumDescriptions": [ + "", + "", + "" + ] + }, + "value": { + "type": "string", + "description": "Literal to compare the variable to. This field is only relevant when type is left unset or set to CUSTOM_VARIABLE_TERM or REFERRER_TERM." + }, + "variableFriendlyName": { + "type": "string", + "description": "Friendly name of this term's variable. This is a read-only, auto-generated field. This field is only relevant when type is left unset or set to CUSTOM_VARIABLE_TERM." + }, + "variableName": { + "type": "string", + "description": "Name of the variable (U1, U2, etc.) being compared in this term. This field is only relevant when type is set to null, CUSTOM_VARIABLE_TERM or REFERRER_TERM." + } + } + }, + "ListTargetingExpression": { + "id": "ListTargetingExpression", + "type": "object", + "description": "Remarketing List Targeting Expression.", + "properties": { + "expression": { + "type": "string", + "description": "Expression describing which lists are being targeted by the ad." + } + } + }, + "LookbackConfiguration": { + "id": "LookbackConfiguration", + "type": "object", + "description": "Lookback configuration settings.", + "properties": { + "clickDuration": { + "type": "integer", + "description": "Lookback window, in days, from the last time a given user clicked on one of your ads. If you enter 0, clicks will not be considered as triggering events for floodlight tracking. If you leave this field blank, the default value for your account will be used.", + "format": "int32" + }, + "postImpressionActivitiesDuration": { + "type": "integer", + "description": "Lookback window, in days, from the last time a given user viewed one of your ads. If you enter 0, impressions will not be considered as triggering events for floodlight tracking. If you leave this field blank, the default value for your account will be used.", + "format": "int32" + } + } + }, + "Metric": { + "id": "Metric", + "type": "object", + "description": "Represents a metric.", + "properties": { + "kind": { + "type": "string", + "description": "The kind of resource this is, in this case dfareporting#metric.", + "default": "dfareporting#metric" + }, + "name": { + "type": "string", + "description": "The metric name, e.g. dfa:impressions" + } + } + }, + "Metro": { + "id": "Metro", + "type": "object", + "description": "Contains information about a metro region that can be targeted by ads.", + "properties": { + "countryCode": { + "type": "string", + "description": "Country code of the country to which this metro region belongs." + }, + "countryDartId": { + "type": "string", + "description": "DART ID of the country to which this metro region belongs.", + "format": "int64" + }, + "dartId": { + "type": "string", + "description": "DART ID of this metro region.", + "format": "int64" + }, + "dmaId": { + "type": "string", + "description": "DMA ID of this metro region. This is the ID used for targeting and generating reports, and is equivalent to metro_code.", + "format": "int64" + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#metro\".", + "default": "dfareporting#metro" + }, + "metroCode": { + "type": "string", + "description": "Metro code of this metro region. This is equivalent to dma_id." + }, + "name": { + "type": "string", + "description": "Name of this metro region." + } + } + }, + "MetrosListResponse": { + "id": "MetrosListResponse", + "type": "object", + "description": "Metro List Response", + "properties": { + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#metrosListResponse\".", + "default": "dfareporting#metrosListResponse" + }, + "metros": { + "type": "array", + "description": "Metro collection.", + "items": { + "$ref": "Metro" + } + } + } + }, + "MobileCarrier": { + "id": "MobileCarrier", + "type": "object", + "description": "Contains information about a mobile carrier that can be targeted by ads.", + "properties": { + "countryCode": { + "type": "string", + "description": "Country code of the country to which this mobile carrier belongs." + }, + "countryDartId": { + "type": "string", + "description": "DART ID of the country to which this mobile carrier belongs.", + "format": "int64" + }, + "id": { + "type": "string", + "description": "ID of this mobile carrier.", + "format": "int64" + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#mobileCarrier\".", + "default": "dfareporting#mobileCarrier" + }, + "name": { + "type": "string", + "description": "Name of this mobile carrier." + } + } + }, + "MobileCarriersListResponse": { + "id": "MobileCarriersListResponse", + "type": "object", + "description": "Mobile Carrier List Response", + "properties": { + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#mobileCarriersListResponse\".", + "default": "dfareporting#mobileCarriersListResponse" + }, + "mobileCarriers": { + "type": "array", + "description": "Mobile carrier collection.", + "items": { + "$ref": "MobileCarrier" + } + } + } + }, + "ObjectFilter": { + "id": "ObjectFilter", + "type": "object", + "description": "Object Filter.", + "properties": { + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#objectFilter\".", + "default": "dfareporting#objectFilter" + }, + "objectIds": { + "type": "array", + "description": "Applicable when status is ASSIGNED. The user has access to objects with these object IDs.", + "items": { + "type": "string", + "format": "int64" + } + }, + "status": { + "type": "string", + "description": "Status of the filter. NONE means the user has access to none of the objects. ALL means the user has access to all objects. ASSIGNED means the user has access to the objects with IDs in the objectIds list.", + "enum": [ + "ALL", + "ASSIGNED", + "NONE" + ], + "enumDescriptions": [ + "", + "", + "" + ] + } + } + }, + "OffsetPosition": { + "id": "OffsetPosition", + "type": "object", + "description": "Offset Position.", + "properties": { + "left": { + "type": "integer", + "description": "Offset distance from left side of an asset or a window.", + "format": "int32" + }, + "top": { + "type": "integer", + "description": "Offset distance from top side of an asset or a window.", + "format": "int32" + } + } + }, + "OmnitureSettings": { + "id": "OmnitureSettings", + "type": "object", + "description": "Omniture Integration Settings.", + "properties": { + "omnitureCostDataEnabled": { + "type": "boolean", + "description": "Whether placement cost data will be sent to Omniture. This property can be enabled only if omnitureIntegrationEnabled is true." + }, + "omnitureIntegrationEnabled": { + "type": "boolean", + "description": "Whether Omniture integration is enabled. This property can be enabled only when the \"Advanced Ad Serving\" account setting is enabled." + } + } + }, + "OperatingSystem": { + "id": "OperatingSystem", + "type": "object", + "description": "Contains information about an operating system that can be targeted by ads.", + "properties": { + "dartId": { + "type": "string", + "description": "DART ID of this operating system. This is the ID used for targeting.", + "format": "int64" + }, + "desktop": { + "type": "boolean", + "description": "Whether this operating system is for desktop." + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#operatingSystem\".", + "default": "dfareporting#operatingSystem" + }, + "mobile": { + "type": "boolean", + "description": "Whether this operating system is for mobile." + }, + "name": { + "type": "string", + "description": "Name of this operating system." + } + } + }, + "OperatingSystemVersion": { + "id": "OperatingSystemVersion", + "type": "object", + "description": "Contains information about a particular version of an operating system that can be targeted by ads.", + "properties": { + "id": { + "type": "string", + "description": "ID of this operating system version.", + "format": "int64" + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#operatingSystemVersion\".", + "default": "dfareporting#operatingSystemVersion" + }, + "majorVersion": { + "type": "string", + "description": "Major version (leftmost number) of this operating system version." + }, + "minorVersion": { + "type": "string", + "description": "Minor version (number after the first dot) of this operating system version." + }, + "name": { + "type": "string", + "description": "Name of this operating system version." + }, + "operatingSystem": { + "$ref": "OperatingSystem", + "description": "Operating system of this operating system version." + } + } + }, + "OperatingSystemVersionsListResponse": { + "id": "OperatingSystemVersionsListResponse", + "type": "object", + "description": "Operating System Version List Response", + "properties": { + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#operatingSystemVersionsListResponse\".", + "default": "dfareporting#operatingSystemVersionsListResponse" + }, + "operatingSystemVersions": { + "type": "array", + "description": "Operating system version collection.", + "items": { + "$ref": "OperatingSystemVersion" + } + } + } + }, + "OperatingSystemsListResponse": { + "id": "OperatingSystemsListResponse", + "type": "object", + "description": "Operating System List Response", + "properties": { + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#operatingSystemsListResponse\".", + "default": "dfareporting#operatingSystemsListResponse" + }, + "operatingSystems": { + "type": "array", + "description": "Operating system collection.", + "items": { + "$ref": "OperatingSystem" + } + } + } + }, + "OptimizationActivity": { + "id": "OptimizationActivity", + "type": "object", + "description": "Creative optimization activity.", + "properties": { + "floodlightActivityId": { + "type": "string", + "description": "Floodlight activity ID of this optimization activity. This is a required field.", + "format": "int64" + }, + "floodlightActivityIdDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the ID of the floodlight activity. This is a read-only, auto-generated field." + }, + "weight": { + "type": "integer", + "description": "Weight associated with this optimization. Must be greater than 1. The weight assigned will be understood in proportion to the weights assigned to the other optimization activities.", + "format": "int32" + } + } + }, + "Order": { + "id": "Order", + "type": "object", + "description": "Describes properties of a DoubleClick Planning order.", + "properties": { + "accountId": { + "type": "string", + "description": "Account ID of this order.", + "format": "int64" + }, + "advertiserId": { + "type": "string", + "description": "Advertiser ID of this order.", + "format": "int64" + }, + "approverUserProfileIds": { + "type": "array", + "description": "IDs for users that have to approve documents created for this order.", + "items": { + "type": "string", + "format": "int64" + } + }, + "buyerInvoiceId": { + "type": "string", + "description": "Buyer invoice ID associated with this order." + }, + "buyerOrganizationName": { + "type": "string", + "description": "Name of the buyer organization." + }, + "comments": { + "type": "string", + "description": "Comments in this order." + }, + "contacts": { + "type": "array", + "description": "Contacts for this order.", + "items": { + "$ref": "OrderContact" + } + }, + "id": { + "type": "string", + "description": "ID of this order. This is a read-only, auto-generated field.", + "format": "int64" + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#order\".", + "default": "dfareporting#order" + }, + "lastModifiedInfo": { + "$ref": "LastModifiedInfo", + "description": "Information about the most recent modification of this order." + }, + "name": { + "type": "string", + "description": "Name of this order." + }, + "notes": { + "type": "string", + "description": "Notes of this order." + }, + "planningTermId": { + "type": "string", + "description": "ID of the terms and conditions template used in this order.", + "format": "int64" + }, + "projectId": { + "type": "string", + "description": "Project ID of this order.", + "format": "int64" + }, + "sellerOrderId": { + "type": "string", + "description": "Seller order ID associated with this order." + }, + "sellerOrganizationName": { + "type": "string", + "description": "Name of the seller organization." + }, + "siteId": { + "type": "array", + "description": "Site IDs this order is associated with.", + "items": { + "type": "string", + "format": "int64" + } + }, + "siteNames": { + "type": "array", + "description": "Free-form site names this order is associated with.", + "items": { + "type": "string" + } + }, + "subaccountId": { + "type": "string", + "description": "Subaccount ID of this order.", + "format": "int64" + }, + "termsAndConditions": { + "type": "string", + "description": "Terms and conditions of this order." + } + } + }, + "OrderContact": { + "id": "OrderContact", + "type": "object", + "description": "Contact of an order.", + "properties": { + "contactInfo": { + "type": "string", + "description": "Free-form information about this contact. It could be any information related to this contact in addition to type, title, name, and signature user profile ID." + }, + "contactName": { + "type": "string", + "description": "Name of this contact." + }, + "contactTitle": { + "type": "string", + "description": "Title of this contact." + }, + "contactType": { + "type": "string", + "description": "Type of this contact.", + "enum": [ + "PLANNING_ORDER_CONTACT_BUYER_BILLING_CONTACT", + "PLANNING_ORDER_CONTACT_BUYER_CONTACT", + "PLANNING_ORDER_CONTACT_SELLER_CONTACT" + ], + "enumDescriptions": [ + "", + "", + "" + ] + }, + "signatureUserProfileId": { + "type": "string", + "description": "ID of the user profile containing the signature that will be embedded into order documents.", + "format": "int64" + } + } + }, + "OrderDocument": { + "id": "OrderDocument", + "type": "object", + "description": "Contains properties of a DoubleClick Planning order document.", + "properties": { + "accountId": { + "type": "string", + "description": "Account ID of this order document.", + "format": "int64" + }, + "advertiserId": { + "type": "string", + "description": "Advertiser ID of this order document.", + "format": "int64" + }, + "amendedOrderDocumentId": { + "type": "string", + "description": "The amended order document ID of this order document. An order document can be created by optionally amending another order document so that the change history can be preserved.", + "format": "int64" + }, + "approvedByUserProfileIds": { + "type": "array", + "description": "IDs of users who have approved this order document.", + "items": { + "type": "string", + "format": "int64" + } + }, + "cancelled": { + "type": "boolean", + "description": "Whether this order document is cancelled." + }, + "createdInfo": { + "$ref": "LastModifiedInfo", + "description": "Information about the creation of this order document." + }, + "effectiveDate": { + "type": "string", + "description": "Effective date of this order document.", + "format": "date" + }, + "id": { + "type": "string", + "description": "ID of this order document.", + "format": "int64" + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#orderDocument\".", + "default": "dfareporting#orderDocument" + }, + "lastSentRecipients": { + "type": "array", + "description": "List of email addresses that received the last sent document.", + "items": { + "type": "string" + } + }, + "lastSentTime": { + "type": "string", + "description": "Timestamp of the last email sent with this order document.", + "format": "date-time" + }, + "orderId": { + "type": "string", + "description": "ID of the order from which this order document is created.", + "format": "int64" + }, + "projectId": { + "type": "string", + "description": "Project ID of this order document.", + "format": "int64" + }, + "signed": { + "type": "boolean", + "description": "Whether this order document has been signed." + }, + "subaccountId": { + "type": "string", + "description": "Subaccount ID of this order document.", + "format": "int64" + }, + "title": { + "type": "string", + "description": "Title of this order document." + }, + "type": { + "type": "string", + "description": "Type of this order document", + "enum": [ + "PLANNING_ORDER_TYPE_CHANGE_ORDER", + "PLANNING_ORDER_TYPE_INSERTION_ORDER" + ], + "enumDescriptions": [ + "", + "" + ] + } + } + }, + "OrderDocumentsListResponse": { + "id": "OrderDocumentsListResponse", + "type": "object", + "description": "Order document List Response", + "properties": { + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#orderDocumentsListResponse\".", + "default": "dfareporting#orderDocumentsListResponse" + }, + "nextPageToken": { + "type": "string", + "description": "Pagination token to be used for the next list operation." + }, + "orderDocuments": { + "type": "array", + "description": "Order document collection", + "items": { + "$ref": "OrderDocument" + } + } + } + }, + "OrdersListResponse": { + "id": "OrdersListResponse", + "type": "object", + "description": "Order List Response", + "properties": { + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#ordersListResponse\".", + "default": "dfareporting#ordersListResponse" + }, + "nextPageToken": { + "type": "string", + "description": "Pagination token to be used for the next list operation." + }, + "orders": { + "type": "array", + "description": "Order collection.", + "items": { + "$ref": "Order" + } + } + } + }, + "PathToConversionReportCompatibleFields": { + "id": "PathToConversionReportCompatibleFields", + "type": "object", + "description": "Represents fields that are compatible to be selected for a report of type \"PATH_TO_CONVERSION\".", + "properties": { + "conversionDimensions": { + "type": "array", + "description": "Conversion dimensions which are compatible to be selected in the \"conversionDimensions\" section of the report.", + "items": { + "$ref": "Dimension" + } + }, + "customFloodlightVariables": { + "type": "array", + "description": "Custom floodlight variables which are compatible to be selected in the \"customFloodlightVariables\" section of the report.", + "items": { + "$ref": "Dimension" + } + }, + "kind": { + "type": "string", + "description": "The kind of resource this is, in this case dfareporting#pathToConversionReportCompatibleFields.", + "default": "dfareporting#pathToConversionReportCompatibleFields" + }, + "metrics": { + "type": "array", + "description": "Metrics which are compatible to be selected in the \"metricNames\" section of the report.", + "items": { + "$ref": "Metric" + } + }, + "perInteractionDimensions": { + "type": "array", + "description": "Per-interaction dimensions which are compatible to be selected in the \"perInteractionDimensions\" section of the report.", + "items": { + "$ref": "Dimension" + } + } + } + }, + "Placement": { + "id": "Placement", + "type": "object", + "description": "Contains properties of a placement.", + "properties": { + "accountId": { + "type": "string", + "description": "Account ID of this placement. This field can be left blank.", + "format": "int64" + }, + "advertiserId": { + "type": "string", + "description": "Advertiser ID of this placement. This field can be left blank.", + "format": "int64" + }, + "advertiserIdDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the ID of the advertiser. This is a read-only, auto-generated field." + }, + "archived": { + "type": "boolean", + "description": "Whether this placement is archived." + }, + "campaignId": { + "type": "string", + "description": "Campaign ID of this placement. This field is a required field on insertion.", + "format": "int64" + }, + "campaignIdDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the ID of the campaign. This is a read-only, auto-generated field." + }, + "comment": { + "type": "string", + "description": "Comments for this placement." + }, + "compatibility": { + "type": "string", + "description": "Placement compatibility. DISPLAY and DISPLAY_INTERSTITIAL refer to rendering on desktop, on mobile devices or in mobile apps for regular or interstitial ads respectively. APP and APP_INTERSTITIAL are no longer allowed for new placement insertions. Instead, use DISPLAY or DISPLAY_INTERSTITIAL. IN_STREAM_VIDEO refers to rendering in in-stream video ads developed with the VAST standard. This field is required on insertion.", + "enum": [ + "APP", + "APP_INTERSTITIAL", + "DISPLAY", + "DISPLAY_INTERSTITIAL", + "IN_STREAM_VIDEO" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "" + ] + }, + "contentCategoryId": { + "type": "string", + "description": "ID of the content category assigned to this placement.", + "format": "int64" + }, + "createInfo": { + "$ref": "LastModifiedInfo", + "description": "Information about the creation of this placement. This is a read-only field." + }, + "directorySiteId": { + "type": "string", + "description": "Directory site ID of this placement. On insert, you must set either this field or the siteId field to specify the site associated with this placement. This is a required field that is read-only after insertion.", + "format": "int64" + }, + "directorySiteIdDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the ID of the directory site. This is a read-only, auto-generated field." + }, + "externalId": { + "type": "string", + "description": "External ID for this placement." + }, + "id": { + "type": "string", + "description": "ID of this placement. This is a read-only, auto-generated field.", + "format": "int64" + }, + "idDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the ID of this placement. This is a read-only, auto-generated field." + }, + "keyName": { + "type": "string", + "description": "Key name of this placement. This is a read-only, auto-generated field." + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#placement\".", + "default": "dfareporting#placement" + }, + "lastModifiedInfo": { + "$ref": "LastModifiedInfo", + "description": "Information about the most recent modification of this placement. This is a read-only field." + }, + "lookbackConfiguration": { + "$ref": "LookbackConfiguration", + "description": "Lookback window settings for this placement." + }, + "name": { + "type": "string", + "description": "Name of this placement.This is a required field and must be less than 256 characters long." + }, + "paymentApproved": { + "type": "boolean", + "description": "Whether payment was approved for this placement. This is a read-only field relevant only to publisher-paid placements." + }, + "paymentSource": { + "type": "string", + "description": "Payment source for this placement. This is a required field that is read-only after insertion.", + "enum": [ + "PLACEMENT_AGENCY_PAID", + "PLACEMENT_PUBLISHER_PAID" + ], + "enumDescriptions": [ + "", + "" + ] + }, + "placementGroupId": { + "type": "string", + "description": "ID of this placement's group, if applicable.", + "format": "int64" + }, + "placementGroupIdDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the ID of the placement group. This is a read-only, auto-generated field." + }, + "placementStrategyId": { + "type": "string", + "description": "ID of the placement strategy assigned to this placement.", + "format": "int64" + }, + "pricingSchedule": { + "$ref": "PricingSchedule", + "description": "Pricing schedule of this placement. This field is required on insertion, specifically subfields startDate, endDate and pricingType." + }, + "primary": { + "type": "boolean", + "description": "Whether this placement is the primary placement of a roadblock (placement group). You cannot change this field from true to false. Setting this field to true will automatically set the primary field on the original primary placement of the roadblock to false, and it will automatically set the roadblock's primaryPlacementId field to the ID of this placement." + }, + "publisherUpdateInfo": { + "$ref": "LastModifiedInfo", + "description": "Information about the last publisher update. This is a read-only field." + }, + "siteId": { + "type": "string", + "description": "Site ID associated with this placement. On insert, you must set either this field or the directorySiteId field to specify the site associated with this placement. This is a required field that is read-only after insertion.", + "format": "int64" + }, + "siteIdDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the ID of the site. This is a read-only, auto-generated field." + }, + "size": { + "$ref": "Size", + "description": "Size associated with this placement. When inserting or updating a placement, only the size ID field is used. This field is required on insertion." + }, + "sslRequired": { + "type": "boolean", + "description": "Whether creatives assigned to this placement must be SSL-compliant." + }, + "status": { + "type": "string", + "description": "Third-party placement status.", + "enum": [ + "ACKNOWLEDGE_ACCEPTANCE", + "ACKNOWLEDGE_REJECTION", + "DRAFT", + "PAYMENT_ACCEPTED", + "PAYMENT_REJECTED", + "PENDING_REVIEW" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "", + "" + ] + }, + "subaccountId": { + "type": "string", + "description": "Subaccount ID of this placement. This field can be left blank.", + "format": "int64" + }, + "tagFormats": { + "type": "array", + "description": "Tag formats to generate for this placement. This field is required on insertion.\nAcceptable values are:\n- \"PLACEMENT_TAG_STANDARD\"\n- \"PLACEMENT_TAG_IFRAME_JAVASCRIPT\"\n- \"PLACEMENT_TAG_IFRAME_ILAYER\"\n- \"PLACEMENT_TAG_INTERNAL_REDIRECT\"\n- \"PLACEMENT_TAG_JAVASCRIPT\"\n- \"PLACEMENT_TAG_INTERSTITIAL_IFRAME_JAVASCRIPT\"\n- \"PLACEMENT_TAG_INTERSTITIAL_INTERNAL_REDIRECT\"\n- \"PLACEMENT_TAG_INTERSTITIAL_JAVASCRIPT\"\n- \"PLACEMENT_TAG_CLICK_COMMANDS\"\n- \"PLACEMENT_TAG_INSTREAM_VIDEO_PREFETCH\"\n- \"PLACEMENT_TAG_TRACKING\"\n- \"PLACEMENT_TAG_TRACKING_IFRAME\"\n- \"PLACEMENT_TAG_TRACKING_JAVASCRIPT\"", + "items": { + "type": "string", + "enum": [ + "PLACEMENT_TAG_CLICK_COMMANDS", + "PLACEMENT_TAG_IFRAME_ILAYER", + "PLACEMENT_TAG_IFRAME_JAVASCRIPT", + "PLACEMENT_TAG_IFRAME_JAVASCRIPT_LEGACY", + "PLACEMENT_TAG_INSTREAM_VIDEO_PREFETCH", + "PLACEMENT_TAG_INSTREAM_VIDEO_PREFETCH_VAST_3", + "PLACEMENT_TAG_INTERNAL_REDIRECT", + "PLACEMENT_TAG_INTERSTITIAL_IFRAME_JAVASCRIPT", + "PLACEMENT_TAG_INTERSTITIAL_IFRAME_JAVASCRIPT_LEGACY", + "PLACEMENT_TAG_INTERSTITIAL_INTERNAL_REDIRECT", + "PLACEMENT_TAG_INTERSTITIAL_JAVASCRIPT", + "PLACEMENT_TAG_INTERSTITIAL_JAVASCRIPT_LEGACY", + "PLACEMENT_TAG_JAVASCRIPT", + "PLACEMENT_TAG_JAVASCRIPT_LEGACY", + "PLACEMENT_TAG_STANDARD", + "PLACEMENT_TAG_TRACKING", + "PLACEMENT_TAG_TRACKING_IFRAME", + "PLACEMENT_TAG_TRACKING_JAVASCRIPT" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ] + } + }, + "tagSetting": { + "$ref": "TagSetting", + "description": "Tag settings for this placement." + }, + "videoActiveViewOptOut": { + "type": "boolean", + "description": "Whether Verification and ActiveView are disabled for in-stream video creatives for this placement. The same setting videoActiveViewOptOut exists on the site level -- the opt out occurs if either of these settings are true. These settings are distinct from DirectorySites.settings.activeViewOptOut or Sites.siteSettings.activeViewOptOut which only apply to display ads. However, Accounts.activeViewOptOut opts out both video traffic, as well as display ads, from Verification and ActiveView." + }, + "videoSettings": { + "$ref": "VideoSettings", + "description": "A collection of settings which affect video creatives served through this placement. Applicable to placements with IN_STREAM_VIDEO compatibility." + }, + "vpaidAdapterChoice": { + "type": "string", + "description": "VPAID adapter setting for this placement. Controls which VPAID format the measurement adapter will use for in-stream video creatives assigned to this placement.", + "enum": [ + "BOTH", + "DEFAULT", + "FLASH", + "HTML5" + ], + "enumDescriptions": [ + "", + "", + "", + "" + ] + } + } + }, + "PlacementAssignment": { + "id": "PlacementAssignment", + "type": "object", + "description": "Placement Assignment.", + "properties": { + "active": { + "type": "boolean", + "description": "Whether this placement assignment is active. When true, the placement will be included in the ad's rotation." + }, + "placementId": { + "type": "string", + "description": "ID of the placement to be assigned. This is a required field.", + "format": "int64" + }, + "placementIdDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the ID of the placement. This is a read-only, auto-generated field." + }, + "sslRequired": { + "type": "boolean", + "description": "Whether the placement to be assigned requires SSL. This is a read-only field that is auto-generated when the ad is inserted or updated." + } + } + }, + "PlacementGroup": { + "id": "PlacementGroup", + "type": "object", + "description": "Contains properties of a package or roadblock.", + "properties": { + "accountId": { + "type": "string", + "description": "Account ID of this placement group. This is a read-only field that can be left blank.", + "format": "int64" + }, + "advertiserId": { + "type": "string", + "description": "Advertiser ID of this placement group. This is a required field on insertion.", + "format": "int64" + }, + "advertiserIdDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the ID of the advertiser. This is a read-only, auto-generated field." + }, + "archived": { + "type": "boolean", + "description": "Whether this placement group is archived." + }, + "campaignId": { + "type": "string", + "description": "Campaign ID of this placement group. This field is required on insertion.", + "format": "int64" + }, + "campaignIdDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the ID of the campaign. This is a read-only, auto-generated field." + }, + "childPlacementIds": { + "type": "array", + "description": "IDs of placements which are assigned to this placement group. This is a read-only, auto-generated field.", + "items": { + "type": "string", + "format": "int64" + } + }, + "comment": { + "type": "string", + "description": "Comments for this placement group." + }, + "contentCategoryId": { + "type": "string", + "description": "ID of the content category assigned to this placement group.", + "format": "int64" + }, + "createInfo": { + "$ref": "LastModifiedInfo", + "description": "Information about the creation of this placement group. This is a read-only field." + }, + "directorySiteId": { + "type": "string", + "description": "Directory site ID associated with this placement group. On insert, you must set either this field or the site_id field to specify the site associated with this placement group. This is a required field that is read-only after insertion.", + "format": "int64" + }, + "directorySiteIdDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the ID of the directory site. This is a read-only, auto-generated field." + }, + "externalId": { + "type": "string", + "description": "External ID for this placement." + }, + "id": { + "type": "string", + "description": "ID of this placement group. This is a read-only, auto-generated field.", + "format": "int64" + }, + "idDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the ID of this placement group. This is a read-only, auto-generated field." + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#placementGroup\".", + "default": "dfareporting#placementGroup" + }, + "lastModifiedInfo": { + "$ref": "LastModifiedInfo", + "description": "Information about the most recent modification of this placement group. This is a read-only field." + }, + "name": { + "type": "string", + "description": "Name of this placement group. This is a required field and must be less than 256 characters long." + }, + "placementGroupType": { + "type": "string", + "description": "Type of this placement group. A package is a simple group of placements that acts as a single pricing point for a group of tags. A roadblock is a group of placements that not only acts as a single pricing point, but also assumes that all the tags in it will be served at the same time. A roadblock requires one of its assigned placements to be marked as primary for reporting. This field is required on insertion.", + "enum": [ + "PLACEMENT_PACKAGE", + "PLACEMENT_ROADBLOCK" + ], + "enumDescriptions": [ + "", + "" + ] + }, + "placementStrategyId": { + "type": "string", + "description": "ID of the placement strategy assigned to this placement group.", + "format": "int64" + }, + "pricingSchedule": { + "$ref": "PricingSchedule", + "description": "Pricing schedule of this placement group. This field is required on insertion." + }, + "primaryPlacementId": { + "type": "string", + "description": "ID of the primary placement, used to calculate the media cost of a roadblock (placement group). Modifying this field will automatically modify the primary field on all affected roadblock child placements.", + "format": "int64" + }, + "primaryPlacementIdDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the ID of the primary placement. This is a read-only, auto-generated field." + }, + "siteId": { + "type": "string", + "description": "Site ID associated with this placement group. On insert, you must set either this field or the directorySiteId field to specify the site associated with this placement group. This is a required field that is read-only after insertion.", + "format": "int64" + }, + "siteIdDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the ID of the site. This is a read-only, auto-generated field." + }, + "subaccountId": { + "type": "string", + "description": "Subaccount ID of this placement group. This is a read-only field that can be left blank.", + "format": "int64" + } + } + }, + "PlacementGroupsListResponse": { + "id": "PlacementGroupsListResponse", + "type": "object", + "description": "Placement Group List Response", + "properties": { + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#placementGroupsListResponse\".", + "default": "dfareporting#placementGroupsListResponse" + }, + "nextPageToken": { + "type": "string", + "description": "Pagination token to be used for the next list operation." + }, + "placementGroups": { + "type": "array", + "description": "Placement group collection.", + "items": { + "$ref": "PlacementGroup" + } + } + } + }, + "PlacementStrategiesListResponse": { + "id": "PlacementStrategiesListResponse", + "type": "object", + "description": "Placement Strategy List Response", + "properties": { + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#placementStrategiesListResponse\".", + "default": "dfareporting#placementStrategiesListResponse" + }, + "nextPageToken": { + "type": "string", + "description": "Pagination token to be used for the next list operation." + }, + "placementStrategies": { + "type": "array", + "description": "Placement strategy collection.", + "items": { + "$ref": "PlacementStrategy" + } + } + } + }, + "PlacementStrategy": { + "id": "PlacementStrategy", + "type": "object", + "description": "Contains properties of a placement strategy.", + "properties": { + "accountId": { + "type": "string", + "description": "Account ID of this placement strategy.This is a read-only field that can be left blank.", + "format": "int64" + }, + "id": { + "type": "string", + "description": "ID of this placement strategy. This is a read-only, auto-generated field.", + "format": "int64" + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#placementStrategy\".", + "default": "dfareporting#placementStrategy" + }, + "name": { + "type": "string", + "description": "Name of this placement strategy. This is a required field. It must be less than 256 characters long and unique among placement strategies of the same account." + } + } + }, + "PlacementTag": { + "id": "PlacementTag", + "type": "object", + "description": "Placement Tag", + "properties": { + "placementId": { + "type": "string", + "description": "Placement ID", + "format": "int64" + }, + "tagDatas": { + "type": "array", + "description": "Tags generated for this placement.", + "items": { + "$ref": "TagData" + } + } + } + }, + "PlacementsGenerateTagsResponse": { + "id": "PlacementsGenerateTagsResponse", + "type": "object", + "description": "Placement GenerateTags Response", + "properties": { + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#placementsGenerateTagsResponse\".", + "default": "dfareporting#placementsGenerateTagsResponse" + }, + "placementTags": { + "type": "array", + "description": "Set of generated tags for the specified placements.", + "items": { + "$ref": "PlacementTag" + } + } + } + }, + "PlacementsListResponse": { + "id": "PlacementsListResponse", + "type": "object", + "description": "Placement List Response", + "properties": { + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#placementsListResponse\".", + "default": "dfareporting#placementsListResponse" + }, + "nextPageToken": { + "type": "string", + "description": "Pagination token to be used for the next list operation." + }, + "placements": { + "type": "array", + "description": "Placement collection.", + "items": { + "$ref": "Placement" + } + } + } + }, + "PlatformType": { + "id": "PlatformType", + "type": "object", + "description": "Contains information about a platform type that can be targeted by ads.", + "properties": { + "id": { + "type": "string", + "description": "ID of this platform type.", + "format": "int64" + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#platformType\".", + "default": "dfareporting#platformType" + }, + "name": { + "type": "string", + "description": "Name of this platform type." + } + } + }, + "PlatformTypesListResponse": { + "id": "PlatformTypesListResponse", + "type": "object", + "description": "Platform Type List Response", + "properties": { + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#platformTypesListResponse\".", + "default": "dfareporting#platformTypesListResponse" + }, + "platformTypes": { + "type": "array", + "description": "Platform type collection.", + "items": { + "$ref": "PlatformType" + } + } + } + }, + "PopupWindowProperties": { + "id": "PopupWindowProperties", + "type": "object", + "description": "Popup Window Properties.", + "properties": { + "dimension": { + "$ref": "Size", + "description": "Popup dimension for a creative. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA and all VPAID" + }, + "offset": { + "$ref": "OffsetPosition", + "description": "Upper-left corner coordinates of the popup window. Applicable if positionType is COORDINATES." + }, + "positionType": { + "type": "string", + "description": "Popup window position either centered or at specific coordinate.", + "enum": [ + "CENTER", + "COORDINATES" + ], + "enumDescriptions": [ + "", + "" + ] + }, + "showAddressBar": { + "type": "boolean", + "description": "Whether to display the browser address bar." + }, + "showMenuBar": { + "type": "boolean", + "description": "Whether to display the browser menu bar." + }, + "showScrollBar": { + "type": "boolean", + "description": "Whether to display the browser scroll bar." + }, + "showStatusBar": { + "type": "boolean", + "description": "Whether to display the browser status bar." + }, + "showToolBar": { + "type": "boolean", + "description": "Whether to display the browser tool bar." + }, + "title": { + "type": "string", + "description": "Title of popup window." + } + } + }, + "PostalCode": { + "id": "PostalCode", + "type": "object", + "description": "Contains information about a postal code that can be targeted by ads.", + "properties": { + "code": { + "type": "string", + "description": "Postal code. This is equivalent to the id field." + }, + "countryCode": { + "type": "string", + "description": "Country code of the country to which this postal code belongs." + }, + "countryDartId": { + "type": "string", + "description": "DART ID of the country to which this postal code belongs.", + "format": "int64" + }, + "id": { + "type": "string", + "description": "ID of this postal code." + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#postalCode\".", + "default": "dfareporting#postalCode" + } + } + }, + "PostalCodesListResponse": { + "id": "PostalCodesListResponse", + "type": "object", + "description": "Postal Code List Response", + "properties": { + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#postalCodesListResponse\".", + "default": "dfareporting#postalCodesListResponse" + }, + "postalCodes": { + "type": "array", + "description": "Postal code collection.", + "items": { + "$ref": "PostalCode" + } + } + } + }, + "Pricing": { + "id": "Pricing", + "type": "object", + "description": "Pricing Information", + "properties": { + "capCostType": { + "type": "string", + "description": "Cap cost type of this inventory item.", + "enum": [ + "PLANNING_PLACEMENT_CAP_COST_TYPE_CUMULATIVE", + "PLANNING_PLACEMENT_CAP_COST_TYPE_MONTHLY", + "PLANNING_PLACEMENT_CAP_COST_TYPE_NONE" + ], + "enumDescriptions": [ + "", + "", + "" + ] + }, + "endDate": { + "type": "string", + "description": "End date of this inventory item.", + "format": "date" + }, + "flights": { + "type": "array", + "description": "Flights of this inventory item. A flight (a.k.a. pricing period) represents the inventory item pricing information for a specific period of time.", + "items": { + "$ref": "Flight" + } + }, + "groupType": { + "type": "string", + "description": "Group type of this inventory item if it represents a placement group. Is null otherwise. There are two type of placement groups: PLANNING_PLACEMENT_GROUP_TYPE_PACKAGE is a simple group of inventory items that acts as a single pricing point for a group of tags. PLANNING_PLACEMENT_GROUP_TYPE_ROADBLOCK is a group of inventory items that not only acts as a single pricing point, but also assumes that all the tags in it will be served at the same time. A roadblock requires one of its assigned inventory items to be marked as primary.", + "enum": [ + "PLANNING_PLACEMENT_GROUP_TYPE_PACKAGE", + "PLANNING_PLACEMENT_GROUP_TYPE_ROADBLOCK" + ], + "enumDescriptions": [ + "", + "" + ] + }, + "pricingType": { + "type": "string", + "description": "Pricing type of this inventory item.", + "enum": [ + "PLANNING_PLACEMENT_PRICING_TYPE_CLICKS", + "PLANNING_PLACEMENT_PRICING_TYPE_CPA", + "PLANNING_PLACEMENT_PRICING_TYPE_CPC", + "PLANNING_PLACEMENT_PRICING_TYPE_CPM", + "PLANNING_PLACEMENT_PRICING_TYPE_CPM_ACTIVEVIEW", + "PLANNING_PLACEMENT_PRICING_TYPE_FLAT_RATE_CLICKS", + "PLANNING_PLACEMENT_PRICING_TYPE_FLAT_RATE_IMPRESSIONS", + "PLANNING_PLACEMENT_PRICING_TYPE_IMPRESSIONS" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "", + "", + "", + "" + ] + }, + "startDate": { + "type": "string", + "description": "Start date of this inventory item.", + "format": "date" + } + } + }, + "PricingSchedule": { + "id": "PricingSchedule", + "type": "object", + "description": "Pricing Schedule", + "properties": { + "capCostOption": { + "type": "string", + "description": "Placement cap cost option.", + "enum": [ + "CAP_COST_CUMULATIVE", + "CAP_COST_MONTHLY", + "CAP_COST_NONE" + ], + "enumDescriptions": [ + "", + "", + "" + ] + }, + "disregardOverdelivery": { + "type": "boolean", + "description": "Whether cap costs are ignored by ad serving." + }, + "endDate": { + "type": "string", + "description": "Placement end date. This date must be later than, or the same day as, the placement start date, but not later than the campaign end date. If, for example, you set 6/25/2015 as both the start and end dates, the effective placement date is just that day only, 6/25/2015. The hours, minutes, and seconds of the end date should not be set, as doing so will result in an error. This field is required on insertion.", + "format": "date" + }, + "flighted": { + "type": "boolean", + "description": "Whether this placement is flighted. If true, pricing periods will be computed automatically." + }, + "floodlightActivityId": { + "type": "string", + "description": "Floodlight activity ID associated with this placement. This field should be set when placement pricing type is set to PRICING_TYPE_CPA.", + "format": "int64" + }, + "pricingPeriods": { + "type": "array", + "description": "Pricing periods for this placement.", + "items": { + "$ref": "PricingSchedulePricingPeriod" + } + }, + "pricingType": { + "type": "string", + "description": "Placement pricing type. This field is required on insertion.", + "enum": [ + "PRICING_TYPE_CPA", + "PRICING_TYPE_CPC", + "PRICING_TYPE_CPM", + "PRICING_TYPE_CPM_ACTIVEVIEW", + "PRICING_TYPE_FLAT_RATE_CLICKS", + "PRICING_TYPE_FLAT_RATE_IMPRESSIONS" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "", + "" + ] + }, + "startDate": { + "type": "string", + "description": "Placement start date. This date must be later than, or the same day as, the campaign start date. The hours, minutes, and seconds of the start date should not be set, as doing so will result in an error. This field is required on insertion.", + "format": "date" + }, + "testingStartDate": { + "type": "string", + "description": "Testing start date of this placement. The hours, minutes, and seconds of the start date should not be set, as doing so will result in an error.", + "format": "date" + } + } + }, + "PricingSchedulePricingPeriod": { + "id": "PricingSchedulePricingPeriod", + "type": "object", + "description": "Pricing Period", + "properties": { + "endDate": { + "type": "string", + "description": "Pricing period end date. This date must be later than, or the same day as, the pricing period start date, but not later than the placement end date. The period end date can be the same date as the period start date. If, for example, you set 6/25/2015 as both the start and end dates, the effective pricing period date is just that day only, 6/25/2015. The hours, minutes, and seconds of the end date should not be set, as doing so will result in an error.", + "format": "date" + }, + "pricingComment": { + "type": "string", + "description": "Comments for this pricing period." + }, + "rateOrCostNanos": { + "type": "string", + "description": "Rate or cost of this pricing period.", + "format": "int64" + }, + "startDate": { + "type": "string", + "description": "Pricing period start date. This date must be later than, or the same day as, the placement start date. The hours, minutes, and seconds of the start date should not be set, as doing so will result in an error.", + "format": "date" + }, + "units": { + "type": "string", + "description": "Units of this pricing period.", + "format": "int64" + } + } + }, + "Project": { + "id": "Project", + "type": "object", + "description": "Contains properties of a DoubleClick Planning project.", + "properties": { + "accountId": { + "type": "string", + "description": "Account ID of this project.", + "format": "int64" + }, + "advertiserId": { + "type": "string", + "description": "Advertiser ID of this project.", + "format": "int64" + }, + "audienceAgeGroup": { + "type": "string", + "description": "Audience age group of this project.", + "enum": [ + "PLANNING_AUDIENCE_AGE_18_24", + "PLANNING_AUDIENCE_AGE_25_34", + "PLANNING_AUDIENCE_AGE_35_44", + "PLANNING_AUDIENCE_AGE_45_54", + "PLANNING_AUDIENCE_AGE_55_64", + "PLANNING_AUDIENCE_AGE_65_OR_MORE", + "PLANNING_AUDIENCE_AGE_UNKNOWN" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "", + "", + "" + ] + }, + "audienceGender": { + "type": "string", + "description": "Audience gender of this project.", + "enum": [ + "PLANNING_AUDIENCE_GENDER_FEMALE", + "PLANNING_AUDIENCE_GENDER_MALE" + ], + "enumDescriptions": [ + "", + "" + ] + }, + "budget": { + "type": "string", + "description": "Budget of this project in the currency specified by the current account. The value stored in this field represents only the non-fractional amount. For example, for USD, the smallest value that can be represented by this field is 1 US dollar.", + "format": "int64" + }, + "clientBillingCode": { + "type": "string", + "description": "Client billing code of this project." + }, + "clientName": { + "type": "string", + "description": "Name of the project client." + }, + "endDate": { + "type": "string", + "description": "End date of the project.", + "format": "date" + }, + "id": { + "type": "string", + "description": "ID of this project. This is a read-only, auto-generated field.", + "format": "int64" + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#project\".", + "default": "dfareporting#project" + }, + "lastModifiedInfo": { + "$ref": "LastModifiedInfo", + "description": "Information about the most recent modification of this project." + }, + "name": { + "type": "string", + "description": "Name of this project." + }, + "overview": { + "type": "string", + "description": "Overview of this project." + }, + "startDate": { + "type": "string", + "description": "Start date of the project.", + "format": "date" + }, + "subaccountId": { + "type": "string", + "description": "Subaccount ID of this project.", + "format": "int64" + }, + "targetClicks": { + "type": "string", + "description": "Number of clicks that the advertiser is targeting.", + "format": "int64" + }, + "targetConversions": { + "type": "string", + "description": "Number of conversions that the advertiser is targeting.", + "format": "int64" + }, + "targetCpaNanos": { + "type": "string", + "description": "CPA that the advertiser is targeting.", + "format": "int64" + }, + "targetCpcNanos": { + "type": "string", + "description": "CPC that the advertiser is targeting.", + "format": "int64" + }, + "targetCpmActiveViewNanos": { + "type": "string", + "description": "vCPM from Active View that the advertiser is targeting.", + "format": "int64" + }, + "targetCpmNanos": { + "type": "string", + "description": "CPM that the advertiser is targeting.", + "format": "int64" + }, + "targetImpressions": { + "type": "string", + "description": "Number of impressions that the advertiser is targeting.", + "format": "int64" + } + } + }, + "ProjectsListResponse": { + "id": "ProjectsListResponse", + "type": "object", + "description": "Project List Response", + "properties": { + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#projectsListResponse\".", + "default": "dfareporting#projectsListResponse" + }, + "nextPageToken": { + "type": "string", + "description": "Pagination token to be used for the next list operation." + }, + "projects": { + "type": "array", + "description": "Project collection.", + "items": { + "$ref": "Project" + } + } + } + }, + "ReachReportCompatibleFields": { + "id": "ReachReportCompatibleFields", + "type": "object", + "description": "Represents fields that are compatible to be selected for a report of type \"REACH\".", + "properties": { + "dimensionFilters": { + "type": "array", + "description": "Dimensions which are compatible to be selected in the \"dimensionFilters\" section of the report.", + "items": { + "$ref": "Dimension" + } + }, + "dimensions": { + "type": "array", + "description": "Dimensions which are compatible to be selected in the \"dimensions\" section of the report.", + "items": { + "$ref": "Dimension" + } + }, + "kind": { + "type": "string", + "description": "The kind of resource this is, in this case dfareporting#reachReportCompatibleFields.", + "default": "dfareporting#reachReportCompatibleFields" + }, + "metrics": { + "type": "array", + "description": "Metrics which are compatible to be selected in the \"metricNames\" section of the report.", + "items": { + "$ref": "Metric" + } + }, + "pivotedActivityMetrics": { + "type": "array", + "description": "Metrics which are compatible to be selected as activity metrics to pivot on in the \"activities\" section of the report.", + "items": { + "$ref": "Metric" + } + }, + "reachByFrequencyMetrics": { + "type": "array", + "description": "Metrics which are compatible to be selected in the \"reachByFrequencyMetricNames\" section of the report.", + "items": { + "$ref": "Metric" + } + } + } + }, + "Recipient": { + "id": "Recipient", + "type": "object", + "description": "Represents a recipient.", + "properties": { + "deliveryType": { + "type": "string", + "description": "The delivery type for the recipient.", + "enum": [ + "ATTACHMENT", + "LINK" + ], + "enumDescriptions": [ + "", + "" + ], + "annotations": { + "required": [ + "dfareporting.reports.insert", + "dfareporting.reports.update" + ] + } + }, + "email": { + "type": "string", + "description": "The email address of the recipient.", + "annotations": { + "required": [ + "dfareporting.reports.insert", + "dfareporting.reports.update" + ] + } + }, + "kind": { + "type": "string", + "description": "The kind of resource this is, in this case dfareporting#recipient.", + "default": "dfareporting#recipient" + } + } + }, + "Region": { + "id": "Region", + "type": "object", + "description": "Contains information about a region that can be targeted by ads.", + "properties": { + "countryCode": { + "type": "string", + "description": "Country code of the country to which this region belongs." + }, + "countryDartId": { + "type": "string", + "description": "DART ID of the country to which this region belongs.", + "format": "int64" + }, + "dartId": { + "type": "string", + "description": "DART ID of this region.", + "format": "int64" + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#region\".", + "default": "dfareporting#region" + }, + "name": { + "type": "string", + "description": "Name of this region." + }, + "regionCode": { + "type": "string", + "description": "Region code." + } + } + }, + "RegionsListResponse": { + "id": "RegionsListResponse", + "type": "object", + "description": "Region List Response", + "properties": { + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#regionsListResponse\".", + "default": "dfareporting#regionsListResponse" + }, + "regions": { + "type": "array", + "description": "Region collection.", + "items": { + "$ref": "Region" + } + } + } + }, + "RemarketingList": { + "id": "RemarketingList", + "type": "object", + "description": "Contains properties of a remarketing list. Remarketing enables you to create lists of users who have performed specific actions on a site, then target ads to members of those lists. This resource can be used to manage remarketing lists that are owned by your advertisers. To see all remarketing lists that are visible to your advertisers, including those that are shared to your advertiser or account, use the TargetableRemarketingLists resource.", + "properties": { + "accountId": { + "type": "string", + "description": "Account ID of this remarketing list. This is a read-only, auto-generated field that is only returned in GET requests.", + "format": "int64" + }, + "active": { + "type": "boolean", + "description": "Whether this remarketing list is active." + }, + "advertiserId": { + "type": "string", + "description": "Dimension value for the advertiser ID that owns this remarketing list. This is a required field.", + "format": "int64" + }, + "advertiserIdDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the ID of the advertiser. This is a read-only, auto-generated field." + }, + "description": { + "type": "string", + "description": "Remarketing list description." + }, + "id": { + "type": "string", + "description": "Remarketing list ID. This is a read-only, auto-generated field.", + "format": "int64" + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#remarketingList\".", + "default": "dfareporting#remarketingList" + }, + "lifeSpan": { + "type": "string", + "description": "Number of days that a user should remain in the remarketing list without an impression.", + "format": "int64" + }, + "listPopulationRule": { + "$ref": "ListPopulationRule", + "description": "Rule used to populate the remarketing list with users." + }, + "listSize": { + "type": "string", + "description": "Number of users currently in the list. This is a read-only field.", + "format": "int64" + }, + "listSource": { + "type": "string", + "description": "Product from which this remarketing list was originated.", + "enum": [ + "REMARKETING_LIST_SOURCE_ADX", + "REMARKETING_LIST_SOURCE_DBM", + "REMARKETING_LIST_SOURCE_DFA", + "REMARKETING_LIST_SOURCE_DFP", + "REMARKETING_LIST_SOURCE_DMP", + "REMARKETING_LIST_SOURCE_GA", + "REMARKETING_LIST_SOURCE_GPLUS", + "REMARKETING_LIST_SOURCE_OTHER", + "REMARKETING_LIST_SOURCE_PLAY_STORE", + "REMARKETING_LIST_SOURCE_XFP", + "REMARKETING_LIST_SOURCE_YOUTUBE" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ] + }, + "name": { + "type": "string", + "description": "Name of the remarketing list. This is a required field. Must be no greater than 128 characters long." + }, + "subaccountId": { + "type": "string", + "description": "Subaccount ID of this remarketing list. This is a read-only, auto-generated field that is only returned in GET requests.", + "format": "int64" + } + } + }, + "RemarketingListShare": { + "id": "RemarketingListShare", + "type": "object", + "description": "Contains properties of a remarketing list's sharing information. Sharing allows other accounts or advertisers to target to your remarketing lists. This resource can be used to manage remarketing list sharing to other accounts and advertisers.", + "properties": { + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#remarketingListShare\".", + "default": "dfareporting#remarketingListShare" + }, + "remarketingListId": { + "type": "string", + "description": "Remarketing list ID. This is a read-only, auto-generated field.", + "format": "int64" + }, + "sharedAccountIds": { + "type": "array", + "description": "Accounts that the remarketing list is shared with.", + "items": { + "type": "string", + "format": "int64" + } + }, + "sharedAdvertiserIds": { + "type": "array", + "description": "Advertisers that the remarketing list is shared with.", + "items": { + "type": "string", + "format": "int64" + } + } + } + }, + "RemarketingListsListResponse": { + "id": "RemarketingListsListResponse", + "type": "object", + "description": "Remarketing list response", + "properties": { + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#remarketingListsListResponse\".", + "default": "dfareporting#remarketingListsListResponse" + }, + "nextPageToken": { + "type": "string", + "description": "Pagination token to be used for the next list operation." + }, + "remarketingLists": { + "type": "array", + "description": "Remarketing list collection.", + "items": { + "$ref": "RemarketingList" + } + } + } + }, + "Report": { + "id": "Report", + "type": "object", + "description": "Represents a Report resource.", + "properties": { + "accountId": { + "type": "string", + "description": "The account ID to which this report belongs.", + "format": "int64", + "annotations": { + "required": [ + "dfareporting.reports.update" + ] + } + }, + "criteria": { + "type": "object", + "description": "The report criteria for a report of type \"STANDARD\".", + "properties": { + "activities": { + "$ref": "Activities", + "description": "Activity group." + }, + "customRichMediaEvents": { + "$ref": "CustomRichMediaEvents", + "description": "Custom Rich Media Events group." + }, + "dateRange": { + "$ref": "DateRange", + "description": "The date range for which this report should be run." + }, + "dimensionFilters": { + "type": "array", + "description": "The list of filters on which dimensions are filtered.\nFilters for different dimensions are ANDed, filters for the same dimension are grouped together and ORed.", + "items": { + "$ref": "DimensionValue" + } + }, + "dimensions": { + "type": "array", + "description": "The list of standard dimensions the report should include.", + "items": { + "$ref": "SortedDimension" + } + }, + "metricNames": { + "type": "array", + "description": "The list of names of metrics the report should include.", + "items": { + "type": "string" + } + } + } + }, + "crossDimensionReachCriteria": { + "type": "object", + "description": "The report criteria for a report of type \"CROSS_DIMENSION_REACH\".", + "properties": { + "breakdown": { + "type": "array", + "description": "The list of dimensions the report should include.", + "items": { + "$ref": "SortedDimension" + } + }, + "dateRange": { + "$ref": "DateRange", + "description": "The date range this report should be run for." + }, + "dimension": { + "type": "string", + "description": "The dimension option.", + "enum": [ + "ADVERTISER", + "CAMPAIGN", + "SITE_BY_ADVERTISER", + "SITE_BY_CAMPAIGN" + ], + "enumDescriptions": [ + "", + "", + "", + "" + ] + }, + "dimensionFilters": { + "type": "array", + "description": "The list of filters on which dimensions are filtered.", + "items": { + "$ref": "DimensionValue" + } + }, + "metricNames": { + "type": "array", + "description": "The list of names of metrics the report should include.", + "items": { + "type": "string" + } + }, + "overlapMetricNames": { + "type": "array", + "description": "The list of names of overlap metrics the report should include.", + "items": { + "type": "string" + } + }, + "pivoted": { + "type": "boolean", + "description": "Whether the report is pivoted or not. Defaults to true." + } + } + }, + "delivery": { + "type": "object", + "description": "The report's email delivery settings.", + "properties": { + "emailOwner": { + "type": "boolean", + "description": "Whether the report should be emailed to the report owner." + }, + "emailOwnerDeliveryType": { + "type": "string", + "description": "The type of delivery for the owner to receive, if enabled.", + "enum": [ + "ATTACHMENT", + "LINK" + ], + "enumDescriptions": [ + "", + "" + ] + }, + "message": { + "type": "string", + "description": "The message to be sent with each email." + }, + "recipients": { + "type": "array", + "description": "The list of recipients to which to email the report.", + "items": { + "$ref": "Recipient" + } + } + } + }, + "etag": { + "type": "string", + "description": "The eTag of this response for caching purposes." + }, + "fileName": { + "type": "string", + "description": "The filename used when generating report files for this report." + }, + "floodlightCriteria": { + "type": "object", + "description": "The report criteria for a report of type \"FLOODLIGHT\".", + "properties": { + "customRichMediaEvents": { + "type": "array", + "description": "The list of custom rich media events to include.", + "items": { + "$ref": "DimensionValue" + } + }, + "dateRange": { + "$ref": "DateRange", + "description": "The date range this report should be run for." + }, + "dimensionFilters": { + "type": "array", + "description": "The list of filters on which dimensions are filtered.\nFilters for different dimensions are ANDed, filters for the same dimension are grouped together and ORed.", + "items": { + "$ref": "DimensionValue" + } + }, + "dimensions": { + "type": "array", + "description": "The list of dimensions the report should include.", + "items": { + "$ref": "SortedDimension" + } + }, + "floodlightConfigId": { + "$ref": "DimensionValue", + "description": "The floodlight ID for which to show data in this report. All advertisers associated with that ID will automatically be added. The dimension of the value needs to be 'dfa:floodlightConfigId'." + }, + "metricNames": { + "type": "array", + "description": "The list of names of metrics the report should include.", + "items": { + "type": "string" + } + }, + "reportProperties": { + "type": "object", + "description": "The properties of the report.", + "properties": { + "includeAttributedIPConversions": { + "type": "boolean", + "description": "Include conversions that have no cookie, but do have an exposure path." + }, + "includeUnattributedCookieConversions": { + "type": "boolean", + "description": "Include conversions of users with a DoubleClick cookie but without an exposure. That means the user did not click or see an ad from the advertiser within the Floodlight group, or that the interaction happened outside the lookback window." + }, + "includeUnattributedIPConversions": { + "type": "boolean", + "description": "Include conversions that have no associated cookies and no exposures. It’s therefore impossible to know how the user was exposed to your ads during the lookback window prior to a conversion." + } + } + } + } + }, + "format": { + "type": "string", + "description": "The output format of the report. If not specified, default format is \"CSV\". Note that the actual format in the completed report file might differ if for instance the report's size exceeds the format's capabilities. \"CSV\" will then be the fallback format.", + "enum": [ + "CSV", + "EXCEL" + ], + "enumDescriptions": [ + "", + "" + ] + }, + "id": { + "type": "string", + "description": "The unique ID identifying this report resource.", + "format": "int64", + "annotations": { + "required": [ + "dfareporting.reports.update" + ] + } + }, + "kind": { + "type": "string", + "description": "The kind of resource this is, in this case dfareporting#report.", + "default": "dfareporting#report" + }, + "lastModifiedTime": { + "type": "string", + "description": "The timestamp (in milliseconds since epoch) of when this report was last modified.", + "format": "uint64", + "annotations": { + "required": [ + "dfareporting.reports.update" + ] + } + }, + "name": { + "type": "string", + "description": "The name of the report.", + "annotations": { + "required": [ + "dfareporting.reports.insert", + "dfareporting.reports.update" + ] + } + }, + "ownerProfileId": { + "type": "string", + "description": "The user profile id of the owner of this report.", + "format": "int64", + "annotations": { + "required": [ + "dfareporting.reports.update" + ] + } + }, + "pathToConversionCriteria": { + "type": "object", + "description": "The report criteria for a report of type \"PATH_TO_CONVERSION\".", + "properties": { + "activityFilters": { + "type": "array", + "description": "The list of 'dfa:activity' values to filter on.", + "items": { + "$ref": "DimensionValue" + } + }, + "conversionDimensions": { + "type": "array", + "description": "The list of conversion dimensions the report should include.", + "items": { + "$ref": "SortedDimension" + } + }, + "customFloodlightVariables": { + "type": "array", + "description": "The list of custom floodlight variables the report should include.", + "items": { + "$ref": "SortedDimension" + } + }, + "customRichMediaEvents": { + "type": "array", + "description": "The list of custom rich media events to include.", + "items": { + "$ref": "DimensionValue" + } + }, + "dateRange": { + "$ref": "DateRange", + "description": "The date range this report should be run for." + }, + "floodlightConfigId": { + "$ref": "DimensionValue", + "description": "The floodlight ID for which to show data in this report. All advertisers associated with that ID will automatically be added. The dimension of the value needs to be 'dfa:floodlightConfigId'." + }, + "metricNames": { + "type": "array", + "description": "The list of names of metrics the report should include.", + "items": { + "type": "string" + } + }, + "perInteractionDimensions": { + "type": "array", + "description": "The list of per interaction dimensions the report should include.", + "items": { + "$ref": "SortedDimension" + } + }, + "reportProperties": { + "type": "object", + "description": "The properties of the report.", + "properties": { + "clicksLookbackWindow": { + "type": "integer", + "description": "DFA checks to see if a click interaction occurred within the specified period of time before a conversion. By default the value is pulled from Floodlight or you can manually enter a custom value. Valid values: 1-90.", + "format": "int32" + }, + "impressionsLookbackWindow": { + "type": "integer", + "description": "DFA checks to see if an impression interaction occurred within the specified period of time before a conversion. By default the value is pulled from Floodlight or you can manually enter a custom value. Valid values: 1-90.", + "format": "int32" + }, + "includeAttributedIPConversions": { + "type": "boolean", + "description": "Deprecated: has no effect." + }, + "includeUnattributedCookieConversions": { + "type": "boolean", + "description": "Include conversions of users with a DoubleClick cookie but without an exposure. That means the user did not click or see an ad from the advertiser within the Floodlight group, or that the interaction happened outside the lookback window." + }, + "includeUnattributedIPConversions": { + "type": "boolean", + "description": "Include conversions that have no associated cookies and no exposures. It’s therefore impossible to know how the user was exposed to your ads during the lookback window prior to a conversion." + }, + "maximumClickInteractions": { + "type": "integer", + "description": "The maximum number of click interactions to include in the report. Advertisers currently paying for E2C reports get up to 200 (100 clicks, 100 impressions). If another advertiser in your network is paying for E2C, you can have up to 5 total exposures per report.", + "format": "int32" + }, + "maximumImpressionInteractions": { + "type": "integer", + "description": "The maximum number of click interactions to include in the report. Advertisers currently paying for E2C reports get up to 200 (100 clicks, 100 impressions). If another advertiser in your network is paying for E2C, you can have up to 5 total exposures per report.", + "format": "int32" + }, + "maximumInteractionGap": { + "type": "integer", + "description": "The maximum amount of time that can take place between interactions (clicks or impressions) by the same user. Valid values: 1-90.", + "format": "int32" + }, + "pivotOnInteractionPath": { + "type": "boolean", + "description": "Enable pivoting on interaction path." + } + } + } + } + }, + "reachCriteria": { + "type": "object", + "description": "The report criteria for a report of type \"REACH\".", + "properties": { + "activities": { + "$ref": "Activities", + "description": "Activity group." + }, + "customRichMediaEvents": { + "$ref": "CustomRichMediaEvents", + "description": "Custom Rich Media Events group." + }, + "dateRange": { + "$ref": "DateRange", + "description": "The date range this report should be run for." + }, + "dimensionFilters": { + "type": "array", + "description": "The list of filters on which dimensions are filtered.\nFilters for different dimensions are ANDed, filters for the same dimension are grouped together and ORed.", + "items": { + "$ref": "DimensionValue" + } + }, + "dimensions": { + "type": "array", + "description": "The list of dimensions the report should include.", + "items": { + "$ref": "SortedDimension" + } + }, + "enableAllDimensionCombinations": { + "type": "boolean", + "description": "Whether to enable all reach dimension combinations in the report. Defaults to false. If enabled, the date range of the report should be within the last three months." + }, + "metricNames": { + "type": "array", + "description": "The list of names of metrics the report should include.", + "items": { + "type": "string" + } + }, + "reachByFrequencyMetricNames": { + "type": "array", + "description": "The list of names of Reach By Frequency metrics the report should include.", + "items": { + "type": "string" + } + } + } + }, + "schedule": { + "type": "object", + "description": "The report's schedule. Can only be set if the report's 'dateRange' is a relative date range and the relative date range is not \"TODAY\".", + "properties": { + "active": { + "type": "boolean", + "description": "Whether the schedule is active or not. Must be set to either true or false.", + "annotations": { + "required": [ + "dfareporting.reports.insert", + "dfareporting.reports.update" + ] + } + }, + "every": { + "type": "integer", + "description": "Defines every how many days, weeks or months the report should be run. Needs to be set when \"repeats\" is either \"DAILY\", \"WEEKLY\" or \"MONTHLY\".", + "format": "int32" + }, + "expirationDate": { + "type": "string", + "description": "The expiration date when the scheduled report stops running.", + "format": "date", + "annotations": { + "required": [ + "dfareporting.reports.insert", + "dfareporting.reports.update" + ] + } + }, + "repeats": { + "type": "string", + "description": "The interval for which the report is repeated. Note: \n- \"DAILY\" also requires field \"every\" to be set. \n- \"WEEKLY\" also requires fields \"every\" and \"repeatsOnWeekDays\" to be set. \n- \"MONTHLY\" also requires fields \"every\" and \"runsOnDayOfMonth\" to be set.", + "annotations": { + "required": [ + "dfareporting.reports.insert", + "dfareporting.reports.update" + ] + } + }, + "repeatsOnWeekDays": { + "type": "array", + "description": "List of week days \"WEEKLY\" on which scheduled reports should run.", + "items": { + "type": "string", + "enum": [ + "FRIDAY", + "MONDAY", + "SATURDAY", + "SUNDAY", + "THURSDAY", + "TUESDAY", + "WEDNESDAY" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "", + "", + "" + ] + } + }, + "runsOnDayOfMonth": { + "type": "string", + "description": "Enum to define for \"MONTHLY\" scheduled reports whether reports should be repeated on the same day of the month as \"startDate\" or the same day of the week of the month.\nExample: If 'startDate' is Monday, April 2nd 2012 (2012-04-02), \"DAY_OF_MONTH\" would run subsequent reports on the 2nd of every Month, and \"WEEK_OF_MONTH\" would run subsequent reports on the first Monday of the month.", + "enum": [ + "DAY_OF_MONTH", + "WEEK_OF_MONTH" + ], + "enumDescriptions": [ + "", + "" + ] + }, + "startDate": { + "type": "string", + "description": "Start date of date range for which scheduled reports should be run.", + "format": "date", + "annotations": { + "required": [ + "dfareporting.reports.insert", + "dfareporting.reports.update" + ] + } + } + } + }, + "subAccountId": { + "type": "string", + "description": "The subaccount ID to which this report belongs if applicable.", + "format": "int64" + }, + "type": { + "type": "string", + "description": "The type of the report.", + "enum": [ + "CROSS_DIMENSION_REACH", + "FLOODLIGHT", + "PATH_TO_CONVERSION", + "REACH", + "STANDARD" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "" + ], + "annotations": { + "required": [ + "dfareporting.reports.insert", + "dfareporting.reports.update" + ] + } + } + } + }, + "ReportCompatibleFields": { + "id": "ReportCompatibleFields", + "type": "object", + "description": "Represents fields that are compatible to be selected for a report of type \"STANDARD\".", + "properties": { + "dimensionFilters": { + "type": "array", + "description": "Dimensions which are compatible to be selected in the \"dimensionFilters\" section of the report.", + "items": { + "$ref": "Dimension" + } + }, + "dimensions": { + "type": "array", + "description": "Dimensions which are compatible to be selected in the \"dimensions\" section of the report.", + "items": { + "$ref": "Dimension" + } + }, + "kind": { + "type": "string", + "description": "The kind of resource this is, in this case dfareporting#reportCompatibleFields.", + "default": "dfareporting#reportCompatibleFields" + }, + "metrics": { + "type": "array", + "description": "Metrics which are compatible to be selected in the \"metricNames\" section of the report.", + "items": { + "$ref": "Metric" + } + }, + "pivotedActivityMetrics": { + "type": "array", + "description": "Metrics which are compatible to be selected as activity metrics to pivot on in the \"activities\" section of the report.", + "items": { + "$ref": "Metric" + } + } + } + }, + "ReportList": { + "id": "ReportList", + "type": "object", + "description": "Represents the list of reports.", + "properties": { + "etag": { + "type": "string", + "description": "The eTag of this response for caching purposes." + }, + "items": { + "type": "array", + "description": "The reports returned in this response.", + "items": { + "$ref": "Report" + } + }, + "kind": { + "type": "string", + "description": "The kind of list this is, in this case dfareporting#reportList.", + "default": "dfareporting#reportList" + }, + "nextPageToken": { + "type": "string", + "description": "Continuation token used to page through reports. To retrieve the next page of results, set the next request's \"pageToken\" to the value of this field. The page token is only valid for a limited amount of time and should not be persisted." + } + } + }, + "ReportsConfiguration": { + "id": "ReportsConfiguration", + "type": "object", + "description": "Reporting Configuration", + "properties": { + "exposureToConversionEnabled": { + "type": "boolean", + "description": "Whether the exposure to conversion report is enabled. This report shows detailed pathway information on up to 10 of the most recent ad exposures seen by a user before converting." + }, + "lookbackConfiguration": { + "$ref": "LookbackConfiguration", + "description": "Default lookback windows for new advertisers in this account." + }, + "reportGenerationTimeZoneId": { + "type": "string", + "description": "Report generation time zone ID of this account. This is a required field that can only be changed by a superuser.\nAcceptable values are:\n\n- \"1\" for \"America/New_York\" \n- \"2\" for \"Europe/London\" \n- \"3\" for \"Europe/Paris\" \n- \"4\" for \"Africa/Johannesburg\" \n- \"5\" for \"Asia/Jerusalem\" \n- \"6\" for \"Asia/Shanghai\" \n- \"7\" for \"Asia/Hong_Kong\" \n- \"8\" for \"Asia/Tokyo\" \n- \"9\" for \"Australia/Sydney\" \n- \"10\" for \"Asia/Dubai\" \n- \"11\" for \"America/Los_Angeles\" \n- \"12\" for \"Pacific/Auckland\" \n- \"13\" for \"America/Sao_Paulo\"", + "format": "int64" + } + } + }, + "RichMediaExitOverride": { + "id": "RichMediaExitOverride", + "type": "object", + "description": "Rich Media Exit Override.", + "properties": { + "clickThroughUrl": { + "$ref": "ClickThroughUrl", + "description": "Click-through URL of this rich media exit override. Applicable if the enabled field is set to true." + }, + "enabled": { + "type": "boolean", + "description": "Whether to use the clickThroughUrl. If false, the creative-level exit will be used." + }, + "exitId": { + "type": "string", + "description": "ID for the override to refer to a specific exit in the creative.", + "format": "int64" + } + } + }, + "Rule": { + "id": "Rule", + "type": "object", + "description": "A rule associates an asset with a targeting template for asset-level targeting. Applicable to INSTREAM_VIDEO creatives.", + "properties": { + "assetId": { + "type": "string", + "description": "A creativeAssets[].id. This should refer to one of the parent assets in this creative. This is a required field.", + "format": "int64" + }, + "name": { + "type": "string", + "description": "A user-friendly name for this rule. This is a required field." + }, + "targetingTemplateId": { + "type": "string", + "description": "A targeting template ID. The targeting from the targeting template will be used to determine whether this asset should be served. This is a required field.", + "format": "int64" + } + } + }, + "Site": { + "id": "Site", + "type": "object", + "description": "Contains properties of a site.", + "properties": { + "accountId": { + "type": "string", + "description": "Account ID of this site. This is a read-only field that can be left blank.", + "format": "int64" + }, + "approved": { + "type": "boolean", + "description": "Whether this site is approved." + }, + "directorySiteId": { + "type": "string", + "description": "Directory site associated with this site. This is a required field that is read-only after insertion.", + "format": "int64" + }, + "directorySiteIdDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the ID of the directory site. This is a read-only, auto-generated field." + }, + "id": { + "type": "string", + "description": "ID of this site. This is a read-only, auto-generated field.", + "format": "int64" + }, + "idDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the ID of this site. This is a read-only, auto-generated field." + }, + "keyName": { + "type": "string", + "description": "Key name of this site. This is a read-only, auto-generated field." + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#site\".", + "default": "dfareporting#site" + }, + "name": { + "type": "string", + "description": "Name of this site.This is a required field. Must be less than 128 characters long. If this site is under a subaccount, the name must be unique among sites of the same subaccount. Otherwise, this site is a top-level site, and the name must be unique among top-level sites of the same account." + }, + "siteContacts": { + "type": "array", + "description": "Site contacts.", + "items": { + "$ref": "SiteContact" + } + }, + "siteSettings": { + "$ref": "SiteSettings", + "description": "Site-wide settings." + }, + "subaccountId": { + "type": "string", + "description": "Subaccount ID of this site. This is a read-only field that can be left blank.", + "format": "int64" + } + } + }, + "SiteContact": { + "id": "SiteContact", + "type": "object", + "description": "Site Contact", + "properties": { + "address": { + "type": "string", + "description": "Address of this site contact." + }, + "contactType": { + "type": "string", + "description": "Site contact type.", + "enum": [ + "SALES_PERSON", + "TRAFFICKER" + ], + "enumDescriptions": [ + "", + "" + ] + }, + "email": { + "type": "string", + "description": "Email address of this site contact. This is a required field." + }, + "firstName": { + "type": "string", + "description": "First name of this site contact." + }, + "id": { + "type": "string", + "description": "ID of this site contact. This is a read-only, auto-generated field.", + "format": "int64" + }, + "lastName": { + "type": "string", + "description": "Last name of this site contact." + }, + "phone": { + "type": "string", + "description": "Primary phone number of this site contact." + }, + "title": { + "type": "string", + "description": "Title or designation of this site contact." + } + } + }, + "SiteSettings": { + "id": "SiteSettings", + "type": "object", + "description": "Site Settings", + "properties": { + "activeViewOptOut": { + "type": "boolean", + "description": "Whether active view creatives are disabled for this site." + }, + "creativeSettings": { + "$ref": "CreativeSettings", + "description": "Site-wide creative settings." + }, + "disableBrandSafeAds": { + "type": "boolean", + "description": "Whether brand safe ads are disabled for this site." + }, + "disableNewCookie": { + "type": "boolean", + "description": "Whether new cookies are disabled for this site." + }, + "lookbackConfiguration": { + "$ref": "LookbackConfiguration", + "description": "Lookback window settings for this site." + }, + "tagSetting": { + "$ref": "TagSetting", + "description": "Configuration settings for dynamic and image floodlight tags." + }, + "videoActiveViewOptOutTemplate": { + "type": "boolean", + "description": "Whether Verification and ActiveView for in-stream video creatives are disabled by default for new placements created under this site. This value will be used to populate the placement.videoActiveViewOptOut field, when no value is specified for the new placement." + }, + "vpaidAdapterChoiceTemplate": { + "type": "string", + "description": "Default VPAID adapter setting for new placements created under this site. This value will be used to populate the placements.vpaidAdapterChoice field, when no value is specified for the new placement. Controls which VPAID format the measurement adapter will use for in-stream video creatives assigned to the placement. The publisher's specifications will typically determine this setting. For VPAID creatives, the adapter format will match the VPAID format (HTML5 VPAID creatives use the HTML5 adapter, and Flash VPAID creatives use the Flash adapter).", + "enum": [ + "BOTH", + "DEFAULT", + "FLASH", + "HTML5" + ], + "enumDescriptions": [ + "", + "", + "", + "" + ] + } + } + }, + "SitesListResponse": { + "id": "SitesListResponse", + "type": "object", + "description": "Site List Response", + "properties": { + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#sitesListResponse\".", + "default": "dfareporting#sitesListResponse" + }, + "nextPageToken": { + "type": "string", + "description": "Pagination token to be used for the next list operation." + }, + "sites": { + "type": "array", + "description": "Site collection.", + "items": { + "$ref": "Site" + } + } + } + }, + "Size": { + "id": "Size", + "type": "object", + "description": "Represents the dimensions of ads, placements, creatives, or creative assets.", + "properties": { + "height": { + "type": "integer", + "description": "Height of this size.", + "format": "int32" + }, + "iab": { + "type": "boolean", + "description": "IAB standard size. This is a read-only, auto-generated field." + }, + "id": { + "type": "string", + "description": "ID of this size. This is a read-only, auto-generated field.", + "format": "int64" + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#size\".", + "default": "dfareporting#size" + }, + "width": { + "type": "integer", + "description": "Width of this size.", + "format": "int32" + } + } + }, + "SizesListResponse": { + "id": "SizesListResponse", + "type": "object", + "description": "Size List Response", + "properties": { + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#sizesListResponse\".", + "default": "dfareporting#sizesListResponse" + }, + "sizes": { + "type": "array", + "description": "Size collection.", + "items": { + "$ref": "Size" + } + } + } + }, + "SkippableSetting": { + "id": "SkippableSetting", + "type": "object", + "description": "Skippable Settings", + "properties": { + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#skippableSetting\".", + "default": "dfareporting#skippableSetting" + }, + "progressOffset": { + "$ref": "VideoOffset", + "description": "Amount of time to play videos served to this placement before counting a view. Applicable when skippable is true." + }, + "skipOffset": { + "$ref": "VideoOffset", + "description": "Amount of time to play videos served to this placement before the skip button should appear. Applicable when skippable is true." + }, + "skippable": { + "type": "boolean", + "description": "Whether the user can skip creatives served to this placement." + } + } + }, + "SortedDimension": { + "id": "SortedDimension", + "type": "object", + "description": "Represents a sorted dimension.", + "properties": { + "kind": { + "type": "string", + "description": "The kind of resource this is, in this case dfareporting#sortedDimension.", + "default": "dfareporting#sortedDimension" + }, + "name": { + "type": "string", + "description": "The name of the dimension." + }, + "sortOrder": { + "type": "string", + "description": "An optional sort order for the dimension column.", + "enum": [ + "ASCENDING", + "DESCENDING" + ], + "enumDescriptions": [ + "", + "" + ] + } + } + }, + "Subaccount": { + "id": "Subaccount", + "type": "object", + "description": "Contains properties of a DCM subaccount.", + "properties": { + "accountId": { + "type": "string", + "description": "ID of the account that contains this subaccount. This is a read-only field that can be left blank.", + "format": "int64" + }, + "availablePermissionIds": { + "type": "array", + "description": "IDs of the available user role permissions for this subaccount.", + "items": { + "type": "string", + "format": "int64" + } + }, + "id": { + "type": "string", + "description": "ID of this subaccount. This is a read-only, auto-generated field.", + "format": "int64" + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#subaccount\".", + "default": "dfareporting#subaccount" + }, + "name": { + "type": "string", + "description": "Name of this subaccount. This is a required field. Must be less than 128 characters long and be unique among subaccounts of the same account." + } + } + }, + "SubaccountsListResponse": { + "id": "SubaccountsListResponse", + "type": "object", + "description": "Subaccount List Response", + "properties": { + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#subaccountsListResponse\".", + "default": "dfareporting#subaccountsListResponse" + }, + "nextPageToken": { + "type": "string", + "description": "Pagination token to be used for the next list operation." + }, + "subaccounts": { + "type": "array", + "description": "Subaccount collection.", + "items": { + "$ref": "Subaccount" + } + } + } + }, + "TagData": { + "id": "TagData", + "type": "object", + "description": "Placement Tag Data", + "properties": { + "adId": { + "type": "string", + "description": "Ad associated with this placement tag.", + "format": "int64" + }, + "clickTag": { + "type": "string", + "description": "Tag string to record a click." + }, + "creativeId": { + "type": "string", + "description": "Creative associated with this placement tag.", + "format": "int64" + }, + "format": { + "type": "string", + "description": "TagData tag format of this tag.", + "enum": [ + "PLACEMENT_TAG_CLICK_COMMANDS", + "PLACEMENT_TAG_IFRAME_ILAYER", + "PLACEMENT_TAG_IFRAME_JAVASCRIPT", + "PLACEMENT_TAG_IFRAME_JAVASCRIPT_LEGACY", + "PLACEMENT_TAG_INSTREAM_VIDEO_PREFETCH", + "PLACEMENT_TAG_INSTREAM_VIDEO_PREFETCH_VAST_3", + "PLACEMENT_TAG_INTERNAL_REDIRECT", + "PLACEMENT_TAG_INTERSTITIAL_IFRAME_JAVASCRIPT", + "PLACEMENT_TAG_INTERSTITIAL_IFRAME_JAVASCRIPT_LEGACY", + "PLACEMENT_TAG_INTERSTITIAL_INTERNAL_REDIRECT", + "PLACEMENT_TAG_INTERSTITIAL_JAVASCRIPT", + "PLACEMENT_TAG_INTERSTITIAL_JAVASCRIPT_LEGACY", + "PLACEMENT_TAG_JAVASCRIPT", + "PLACEMENT_TAG_JAVASCRIPT_LEGACY", + "PLACEMENT_TAG_STANDARD", + "PLACEMENT_TAG_TRACKING", + "PLACEMENT_TAG_TRACKING_IFRAME", + "PLACEMENT_TAG_TRACKING_JAVASCRIPT" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ] + }, + "impressionTag": { + "type": "string", + "description": "Tag string for serving an ad." + } + } + }, + "TagSetting": { + "id": "TagSetting", + "type": "object", + "description": "Tag Settings", + "properties": { + "additionalKeyValues": { + "type": "string", + "description": "Additional key-values to be included in tags. Each key-value pair must be of the form key=value, and pairs must be separated by a semicolon (;). Keys and values must not contain commas. For example, id=2;color=red is a valid value for this field." + }, + "includeClickThroughUrls": { + "type": "boolean", + "description": "Whether static landing page URLs should be included in the tags. This setting applies only to placements." + }, + "includeClickTracking": { + "type": "boolean", + "description": "Whether click-tracking string should be included in the tags." + }, + "keywordOption": { + "type": "string", + "description": "Option specifying how keywords are embedded in ad tags. This setting can be used to specify whether keyword placeholders are inserted in placement tags for this site. Publishers can then add keywords to those placeholders.", + "enum": [ + "GENERATE_SEPARATE_TAG_FOR_EACH_KEYWORD", + "IGNORE", + "PLACEHOLDER_WITH_LIST_OF_KEYWORDS" + ], + "enumDescriptions": [ + "", + "", + "" + ] + } + } + }, + "TagSettings": { + "id": "TagSettings", + "type": "object", + "description": "Dynamic and Image Tag Settings.", + "properties": { + "dynamicTagEnabled": { + "type": "boolean", + "description": "Whether dynamic floodlight tags are enabled." + }, + "imageTagEnabled": { + "type": "boolean", + "description": "Whether image tags are enabled." + } + } + }, + "TargetWindow": { + "id": "TargetWindow", + "type": "object", + "description": "Target Window.", + "properties": { + "customHtml": { + "type": "string", + "description": "User-entered value." + }, + "targetWindowOption": { + "type": "string", + "description": "Type of browser window for which the backup image of the flash creative can be displayed.", + "enum": [ + "CURRENT_WINDOW", + "CUSTOM", + "NEW_WINDOW" + ], + "enumDescriptions": [ + "", + "", + "" + ] + } + } + }, + "TargetableRemarketingList": { + "id": "TargetableRemarketingList", + "type": "object", + "description": "Contains properties of a targetable remarketing list. Remarketing enables you to create lists of users who have performed specific actions on a site, then target ads to members of those lists. This resource is a read-only view of a remarketing list to be used to faciliate targeting ads to specific lists. Remarketing lists that are owned by your advertisers and those that are shared to your advertisers or account are accessible via this resource. To manage remarketing lists that are owned by your advertisers, use the RemarketingLists resource.", + "properties": { + "accountId": { + "type": "string", + "description": "Account ID of this remarketing list. This is a read-only, auto-generated field that is only returned in GET requests.", + "format": "int64" + }, + "active": { + "type": "boolean", + "description": "Whether this targetable remarketing list is active." + }, + "advertiserId": { + "type": "string", + "description": "Dimension value for the advertiser ID that owns this targetable remarketing list.", + "format": "int64" + }, + "advertiserIdDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the ID of the advertiser." + }, + "description": { + "type": "string", + "description": "Targetable remarketing list description." + }, + "id": { + "type": "string", + "description": "Targetable remarketing list ID.", + "format": "int64" + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#targetableRemarketingList\".", + "default": "dfareporting#targetableRemarketingList" + }, + "lifeSpan": { + "type": "string", + "description": "Number of days that a user should remain in the targetable remarketing list without an impression.", + "format": "int64" + }, + "listSize": { + "type": "string", + "description": "Number of users currently in the list. This is a read-only field.", + "format": "int64" + }, + "listSource": { + "type": "string", + "description": "Product from which this targetable remarketing list was originated.", + "enum": [ + "REMARKETING_LIST_SOURCE_ADX", + "REMARKETING_LIST_SOURCE_DBM", + "REMARKETING_LIST_SOURCE_DFA", + "REMARKETING_LIST_SOURCE_DFP", + "REMARKETING_LIST_SOURCE_DMP", + "REMARKETING_LIST_SOURCE_GA", + "REMARKETING_LIST_SOURCE_GPLUS", + "REMARKETING_LIST_SOURCE_OTHER", + "REMARKETING_LIST_SOURCE_PLAY_STORE", + "REMARKETING_LIST_SOURCE_XFP", + "REMARKETING_LIST_SOURCE_YOUTUBE" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ] + }, + "name": { + "type": "string", + "description": "Name of the targetable remarketing list. Is no greater than 128 characters long." + }, + "subaccountId": { + "type": "string", + "description": "Subaccount ID of this remarketing list. This is a read-only, auto-generated field that is only returned in GET requests.", + "format": "int64" + } + } + }, + "TargetableRemarketingListsListResponse": { + "id": "TargetableRemarketingListsListResponse", + "type": "object", + "description": "Targetable remarketing list response", + "properties": { + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#targetableRemarketingListsListResponse\".", + "default": "dfareporting#targetableRemarketingListsListResponse" + }, + "nextPageToken": { + "type": "string", + "description": "Pagination token to be used for the next list operation." + }, + "targetableRemarketingLists": { + "type": "array", + "description": "Targetable remarketing list collection.", + "items": { + "$ref": "TargetableRemarketingList" + } + } + } + }, + "TargetingTemplate": { + "id": "TargetingTemplate", + "type": "object", + "description": "Contains properties of a targeting template. A targeting template encapsulates targeting information which can be reused across multiple ads.", + "properties": { + "accountId": { + "type": "string", + "description": "Account ID of this targeting template. This field, if left unset, will be auto-generated on insert and is read-only after insert.", + "format": "int64" + }, + "advertiserId": { + "type": "string", + "description": "Advertiser ID of this targeting template. This is a required field on insert and is read-only after insert.", + "format": "int64" + }, + "advertiserIdDimensionValue": { + "$ref": "DimensionValue", + "description": "Dimension value for the ID of the advertiser. This is a read-only, auto-generated field." + }, + "dayPartTargeting": { + "$ref": "DayPartTargeting", + "description": "Time and day targeting criteria." + }, + "geoTargeting": { + "$ref": "GeoTargeting", + "description": "Geographical targeting criteria." + }, + "id": { + "type": "string", + "description": "ID of this targeting template. This is a read-only, auto-generated field.", + "format": "int64" + }, + "keyValueTargetingExpression": { + "$ref": "KeyValueTargetingExpression", + "description": "Key-value targeting criteria." + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#targetingTemplate\".", + "default": "dfareporting#targetingTemplate" + }, + "languageTargeting": { + "$ref": "LanguageTargeting", + "description": "Language targeting criteria." + }, + "listTargetingExpression": { + "$ref": "ListTargetingExpression", + "description": "Remarketing list targeting criteria." + }, + "name": { + "type": "string", + "description": "Name of this targeting template. This field is required. It must be less than 256 characters long and unique within an advertiser." + }, + "subaccountId": { + "type": "string", + "description": "Subaccount ID of this targeting template. This field, if left unset, will be auto-generated on insert and is read-only after insert.", + "format": "int64" + }, + "technologyTargeting": { + "$ref": "TechnologyTargeting", + "description": "Technology platform targeting criteria." + } + } + }, + "TargetingTemplatesListResponse": { + "id": "TargetingTemplatesListResponse", + "type": "object", + "description": "Targeting Template List Response", + "properties": { + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#targetingTemplatesListResponse\".", + "default": "dfareporting#targetingTemplatesListResponse" + }, + "nextPageToken": { + "type": "string", + "description": "Pagination token to be used for the next list operation." + }, + "targetingTemplates": { + "type": "array", + "description": "Targeting template collection.", + "items": { + "$ref": "TargetingTemplate" + } + } + } + }, + "TechnologyTargeting": { + "id": "TechnologyTargeting", + "type": "object", + "description": "Technology Targeting.", + "properties": { + "browsers": { + "type": "array", + "description": "Browsers that this ad targets. For each browser either set browserVersionId or dartId along with the version numbers. If both are specified, only browserVersionId will be used. The other fields are populated automatically when the ad is inserted or updated.", + "items": { + "$ref": "Browser" + } + }, + "connectionTypes": { + "type": "array", + "description": "Connection types that this ad targets. For each connection type only id is required. The other fields are populated automatically when the ad is inserted or updated.", + "items": { + "$ref": "ConnectionType" + } + }, + "mobileCarriers": { + "type": "array", + "description": "Mobile carriers that this ad targets. For each mobile carrier only id is required, and the other fields are populated automatically when the ad is inserted or updated. If targeting a mobile carrier, do not set targeting for any zip codes.", + "items": { + "$ref": "MobileCarrier" + } + }, + "operatingSystemVersions": { + "type": "array", + "description": "Operating system versions that this ad targets. To target all versions, use operatingSystems. For each operating system version, only id is required. The other fields are populated automatically when the ad is inserted or updated. If targeting an operating system version, do not set targeting for the corresponding operating system in operatingSystems.", + "items": { + "$ref": "OperatingSystemVersion" + } + }, + "operatingSystems": { + "type": "array", + "description": "Operating systems that this ad targets. To target specific versions, use operatingSystemVersions. For each operating system only dartId is required. The other fields are populated automatically when the ad is inserted or updated. If targeting an operating system, do not set targeting for operating system versions for the same operating system.", + "items": { + "$ref": "OperatingSystem" + } + }, + "platformTypes": { + "type": "array", + "description": "Platform types that this ad targets. For example, desktop, mobile, or tablet. For each platform type, only id is required, and the other fields are populated automatically when the ad is inserted or updated.", + "items": { + "$ref": "PlatformType" + } + } + } + }, + "ThirdPartyAuthenticationToken": { + "id": "ThirdPartyAuthenticationToken", + "type": "object", + "description": "Third Party Authentication Token", + "properties": { + "name": { + "type": "string", + "description": "Name of the third-party authentication token." + }, + "value": { + "type": "string", + "description": "Value of the third-party authentication token. This is a read-only, auto-generated field." + } + } + }, + "ThirdPartyTrackingUrl": { + "id": "ThirdPartyTrackingUrl", + "type": "object", + "description": "Third-party Tracking URL.", + "properties": { + "thirdPartyUrlType": { + "type": "string", + "description": "Third-party URL type for in-stream video creatives.", + "enum": [ + "CLICK_TRACKING", + "IMPRESSION", + "RICH_MEDIA_BACKUP_IMPRESSION", + "RICH_MEDIA_IMPRESSION", + "RICH_MEDIA_RM_IMPRESSION", + "SURVEY", + "VIDEO_COMPLETE", + "VIDEO_CUSTOM", + "VIDEO_FIRST_QUARTILE", + "VIDEO_FULLSCREEN", + "VIDEO_MIDPOINT", + "VIDEO_MUTE", + "VIDEO_PAUSE", + "VIDEO_PROGRESS", + "VIDEO_REWIND", + "VIDEO_SKIP", + "VIDEO_START", + "VIDEO_STOP", + "VIDEO_THIRD_QUARTILE" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ] + }, + "url": { + "type": "string", + "description": "URL for the specified third-party URL type." + } + } + }, + "TranscodeSetting": { + "id": "TranscodeSetting", + "type": "object", + "description": "Transcode Settings", + "properties": { + "enabledVideoFormats": { + "type": "array", + "description": "Whitelist of video formats to be served to this placement. Set this list to null or empty to serve all video formats.", + "items": { + "type": "integer", + "format": "int32" + } + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#transcodeSetting\".", + "default": "dfareporting#transcodeSetting" + } + } + }, + "UserDefinedVariableConfiguration": { + "id": "UserDefinedVariableConfiguration", + "type": "object", + "description": "User Defined Variable configuration.", + "properties": { + "dataType": { + "type": "string", + "description": "Data type for the variable. This is a required field.", + "enum": [ + "NUMBER", + "STRING" + ], + "enumDescriptions": [ + "", + "" + ] + }, + "reportName": { + "type": "string", + "description": "User-friendly name for the variable which will appear in reports. This is a required field, must be less than 64 characters long, and cannot contain the following characters: \"\"\u003c\u003e\"." + }, + "variableType": { + "type": "string", + "description": "Variable name in the tag. This is a required field.", + "enum": [ + "U1", + "U10", + "U100", + "U11", + "U12", + "U13", + "U14", + "U15", + "U16", + "U17", + "U18", + "U19", + "U2", + "U20", + "U21", + "U22", + "U23", + "U24", + "U25", + "U26", + "U27", + "U28", + "U29", + "U3", + "U30", + "U31", + "U32", + "U33", + "U34", + "U35", + "U36", + "U37", + "U38", + "U39", + "U4", + "U40", + "U41", + "U42", + "U43", + "U44", + "U45", + "U46", + "U47", + "U48", + "U49", + "U5", + "U50", + "U51", + "U52", + "U53", + "U54", + "U55", + "U56", + "U57", + "U58", + "U59", + "U6", + "U60", + "U61", + "U62", + "U63", + "U64", + "U65", + "U66", + "U67", + "U68", + "U69", + "U7", + "U70", + "U71", + "U72", + "U73", + "U74", + "U75", + "U76", + "U77", + "U78", + "U79", + "U8", + "U80", + "U81", + "U82", + "U83", + "U84", + "U85", + "U86", + "U87", + "U88", + "U89", + "U9", + "U90", + "U91", + "U92", + "U93", + "U94", + "U95", + "U96", + "U97", + "U98", + "U99" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ] + } + } + }, + "UserProfile": { + "id": "UserProfile", + "type": "object", + "description": "Represents a UserProfile resource.", + "properties": { + "accountId": { + "type": "string", + "description": "The account ID to which this profile belongs.", + "format": "int64" + }, + "accountName": { + "type": "string", + "description": "The account name this profile belongs to." + }, + "etag": { + "type": "string", + "description": "The eTag of this response for caching purposes." + }, + "kind": { + "type": "string", + "description": "The kind of resource this is, in this case dfareporting#userProfile.", + "default": "dfareporting#userProfile" + }, + "profileId": { + "type": "string", + "description": "The unique ID of the user profile.", + "format": "int64" + }, + "subAccountId": { + "type": "string", + "description": "The sub account ID this profile belongs to if applicable.", + "format": "int64" + }, + "subAccountName": { + "type": "string", + "description": "The sub account name this profile belongs to if applicable." + }, + "userName": { + "type": "string", + "description": "The user name." + } + } + }, + "UserProfileList": { + "id": "UserProfileList", + "type": "object", + "description": "Represents the list of user profiles.", + "properties": { + "etag": { + "type": "string", + "description": "The eTag of this response for caching purposes." + }, + "items": { + "type": "array", + "description": "The user profiles returned in this response.", + "items": { + "$ref": "UserProfile" + } + }, + "kind": { + "type": "string", + "description": "The kind of list this is, in this case dfareporting#userProfileList.", + "default": "dfareporting#userProfileList" + } + } + }, + "UserRole": { + "id": "UserRole", + "type": "object", + "description": "Contains properties of auser role, which is used to manage user access.", + "properties": { + "accountId": { + "type": "string", + "description": "Account ID of this user role. This is a read-only field that can be left blank.", + "format": "int64" + }, + "defaultUserRole": { + "type": "boolean", + "description": "Whether this is a default user role. Default user roles are created by the system for the account/subaccount and cannot be modified or deleted. Each default user role comes with a basic set of preassigned permissions." + }, + "id": { + "type": "string", + "description": "ID of this user role. This is a read-only, auto-generated field.", + "format": "int64" + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#userRole\".", + "default": "dfareporting#userRole" + }, + "name": { + "type": "string", + "description": "Name of this user role. This is a required field. Must be less than 256 characters long. If this user role is under a subaccount, the name must be unique among sites of the same subaccount. Otherwise, this user role is a top-level user role, and the name must be unique among top-level user roles of the same account." + }, + "parentUserRoleId": { + "type": "string", + "description": "ID of the user role that this user role is based on or copied from. This is a required field.", + "format": "int64" + }, + "permissions": { + "type": "array", + "description": "List of permissions associated with this user role.", + "items": { + "$ref": "UserRolePermission" + } + }, + "subaccountId": { + "type": "string", + "description": "Subaccount ID of this user role. This is a read-only field that can be left blank.", + "format": "int64" + } + } + }, + "UserRolePermission": { + "id": "UserRolePermission", + "type": "object", + "description": "Contains properties of a user role permission.", + "properties": { + "availability": { + "type": "string", + "description": "Levels of availability for a user role permission.", + "enum": [ + "ACCOUNT_ALWAYS", + "ACCOUNT_BY_DEFAULT", + "NOT_AVAILABLE_BY_DEFAULT", + "SUBACCOUNT_AND_ACCOUNT_ALWAYS", + "SUBACCOUNT_AND_ACCOUNT_BY_DEFAULT" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "" + ] + }, + "id": { + "type": "string", + "description": "ID of this user role permission.", + "format": "int64" + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#userRolePermission\".", + "default": "dfareporting#userRolePermission" + }, + "name": { + "type": "string", + "description": "Name of this user role permission." + }, + "permissionGroupId": { + "type": "string", + "description": "ID of the permission group that this user role permission belongs to.", + "format": "int64" + } + } + }, + "UserRolePermissionGroup": { + "id": "UserRolePermissionGroup", + "type": "object", + "description": "Represents a grouping of related user role permissions.", + "properties": { + "id": { + "type": "string", + "description": "ID of this user role permission.", + "format": "int64" + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#userRolePermissionGroup\".", + "default": "dfareporting#userRolePermissionGroup" + }, + "name": { + "type": "string", + "description": "Name of this user role permission group." + } + } + }, + "UserRolePermissionGroupsListResponse": { + "id": "UserRolePermissionGroupsListResponse", + "type": "object", + "description": "User Role Permission Group List Response", + "properties": { + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#userRolePermissionGroupsListResponse\".", + "default": "dfareporting#userRolePermissionGroupsListResponse" + }, + "userRolePermissionGroups": { + "type": "array", + "description": "User role permission group collection.", + "items": { + "$ref": "UserRolePermissionGroup" + } + } + } + }, + "UserRolePermissionsListResponse": { + "id": "UserRolePermissionsListResponse", + "type": "object", + "description": "User Role Permission List Response", + "properties": { + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#userRolePermissionsListResponse\".", + "default": "dfareporting#userRolePermissionsListResponse" + }, + "userRolePermissions": { + "type": "array", + "description": "User role permission collection.", + "items": { + "$ref": "UserRolePermission" + } + } + } + }, + "UserRolesListResponse": { + "id": "UserRolesListResponse", + "type": "object", + "description": "User Role List Response", + "properties": { + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#userRolesListResponse\".", + "default": "dfareporting#userRolesListResponse" + }, + "nextPageToken": { + "type": "string", + "description": "Pagination token to be used for the next list operation." + }, + "userRoles": { + "type": "array", + "description": "User role collection.", + "items": { + "$ref": "UserRole" + } + } + } + }, + "VideoFormat": { + "id": "VideoFormat", + "type": "object", + "description": "Contains information about supported video formats.", + "properties": { + "fileType": { + "type": "string", + "description": "File type of the video format.", + "enum": [ + "FLV", + "M3U8", + "MP4", + "THREEGPP", + "WEBM" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "" + ] + }, + "id": { + "type": "integer", + "description": "ID of the video format.", + "format": "int32" + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#videoFormat\".", + "default": "dfareporting#videoFormat" + }, + "resolution": { + "$ref": "Size", + "description": "The resolution of this video format." + }, + "targetBitRate": { + "type": "integer", + "description": "The target bit rate of this video format.", + "format": "int32" + } + } + }, + "VideoFormatsListResponse": { + "id": "VideoFormatsListResponse", + "type": "object", + "description": "Video Format List Response", + "properties": { + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#videoFormatsListResponse\".", + "default": "dfareporting#videoFormatsListResponse" + }, + "videoFormats": { + "type": "array", + "description": "Video format collection.", + "items": { + "$ref": "VideoFormat" + } + } + } + }, + "VideoOffset": { + "id": "VideoOffset", + "type": "object", + "description": "Video Offset", + "properties": { + "offsetPercentage": { + "type": "integer", + "description": "Duration, as a percentage of video duration. Do not set when offsetSeconds is set.", + "format": "int32" + }, + "offsetSeconds": { + "type": "integer", + "description": "Duration, in seconds. Do not set when offsetPercentage is set.", + "format": "int32" + } + } + }, + "VideoSettings": { + "id": "VideoSettings", + "type": "object", + "description": "Video Settings", + "properties": { + "companionSettings": { + "$ref": "CompanionSetting", + "description": "Settings for the companion creatives of video creatives served to this placement." + }, + "kind": { + "type": "string", + "description": "Identifies what kind of resource this is. Value: the fixed string \"dfareporting#videoSettings\".", + "default": "dfareporting#videoSettings" + }, + "skippableSettings": { + "$ref": "SkippableSetting", + "description": "Settings for the skippability of video creatives served to this placement. If this object is provided, the creative-level skippable settings will be overridden." + }, + "transcodeSettings": { + "$ref": "TranscodeSetting", + "description": "Settings for the transcodes of video creatives served to this placement. If this object is provided, the creative-level transcode settings will be overridden." + } + } + } + }, + "resources": { + "accountActiveAdSummaries": { + "methods": { + "get": { + "id": "dfareporting.accountActiveAdSummaries.get", + "path": "userprofiles/{profileId}/accountActiveAdSummaries/{summaryAccountId}", + "httpMethod": "GET", + "description": "Gets the account's active ad summary by account ID.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + }, + "summaryAccountId": { + "type": "string", + "description": "Account ID.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "summaryAccountId" + ], + "response": { + "$ref": "AccountActiveAdSummary" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "accountPermissionGroups": { + "methods": { + "get": { + "id": "dfareporting.accountPermissionGroups.get", + "path": "userprofiles/{profileId}/accountPermissionGroups/{id}", + "httpMethod": "GET", + "description": "Gets one account permission group by ID.", + "parameters": { + "id": { + "type": "string", + "description": "Account permission group ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "response": { + "$ref": "AccountPermissionGroup" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.accountPermissionGroups.list", + "path": "userprofiles/{profileId}/accountPermissionGroups", + "httpMethod": "GET", + "description": "Retrieves the list of account permission groups.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "AccountPermissionGroupsListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "accountPermissions": { + "methods": { + "get": { + "id": "dfareporting.accountPermissions.get", + "path": "userprofiles/{profileId}/accountPermissions/{id}", + "httpMethod": "GET", + "description": "Gets one account permission by ID.", + "parameters": { + "id": { + "type": "string", + "description": "Account permission ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "response": { + "$ref": "AccountPermission" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.accountPermissions.list", + "path": "userprofiles/{profileId}/accountPermissions", + "httpMethod": "GET", + "description": "Retrieves the list of account permissions.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "AccountPermissionsListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "accountUserProfiles": { + "methods": { + "get": { + "id": "dfareporting.accountUserProfiles.get", + "path": "userprofiles/{profileId}/accountUserProfiles/{id}", + "httpMethod": "GET", + "description": "Gets one account user profile by ID.", + "parameters": { + "id": { + "type": "string", + "description": "User profile ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "response": { + "$ref": "AccountUserProfile" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "insert": { + "id": "dfareporting.accountUserProfiles.insert", + "path": "userprofiles/{profileId}/accountUserProfiles", + "httpMethod": "POST", + "description": "Inserts a new account user profile.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "AccountUserProfile" + }, + "response": { + "$ref": "AccountUserProfile" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.accountUserProfiles.list", + "path": "userprofiles/{profileId}/accountUserProfiles", + "httpMethod": "GET", + "description": "Retrieves a list of account user profiles, possibly filtered. This method supports paging.", + "parameters": { + "active": { + "type": "boolean", + "description": "Select only active user profiles.", + "location": "query" + }, + "ids": { + "type": "string", + "description": "Select only user profiles with these IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "maxResults": { + "type": "integer", + "description": "Maximum number of results to return.", + "format": "int32", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "Value of the nextPageToken from the previous result page.", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + }, + "searchString": { + "type": "string", + "description": "Allows searching for objects by name, ID or email. Wildcards (*) are allowed. For example, \"user profile*2015\" will return objects with names like \"user profile June 2015\", \"user profile April 2015\", or simply \"user profile 2015\". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of \"user profile\" will match objects with name \"my user profile\", \"user profile 2015\", or simply \"user profile\".", + "location": "query" + }, + "sortField": { + "type": "string", + "description": "Field by which to sort the list.", + "enum": [ + "ID", + "NAME" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + }, + "sortOrder": { + "type": "string", + "description": "Order of sorted results, default is ASCENDING.", + "enum": [ + "ASCENDING", + "DESCENDING" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + }, + "subaccountId": { + "type": "string", + "description": "Select only user profiles with the specified subaccount ID.", + "format": "int64", + "location": "query" + }, + "userRoleId": { + "type": "string", + "description": "Select only user profiles with the specified user role ID.", + "format": "int64", + "location": "query" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "AccountUserProfilesListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "patch": { + "id": "dfareporting.accountUserProfiles.patch", + "path": "userprofiles/{profileId}/accountUserProfiles", + "httpMethod": "PATCH", + "description": "Updates an existing account user profile. This method supports patch semantics.", + "parameters": { + "id": { + "type": "string", + "description": "User profile ID.", + "required": true, + "format": "int64", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "request": { + "$ref": "AccountUserProfile" + }, + "response": { + "$ref": "AccountUserProfile" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "update": { + "id": "dfareporting.accountUserProfiles.update", + "path": "userprofiles/{profileId}/accountUserProfiles", + "httpMethod": "PUT", + "description": "Updates an existing account user profile.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "AccountUserProfile" + }, + "response": { + "$ref": "AccountUserProfile" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "accounts": { + "methods": { + "get": { + "id": "dfareporting.accounts.get", + "path": "userprofiles/{profileId}/accounts/{id}", + "httpMethod": "GET", + "description": "Gets one account by ID.", + "parameters": { + "id": { + "type": "string", + "description": "Account ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "response": { + "$ref": "Account" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.accounts.list", + "path": "userprofiles/{profileId}/accounts", + "httpMethod": "GET", + "description": "Retrieves the list of accounts, possibly filtered. This method supports paging.", + "parameters": { + "active": { + "type": "boolean", + "description": "Select only active accounts. Don't set this field to select both active and non-active accounts.", + "location": "query" + }, + "ids": { + "type": "string", + "description": "Select only accounts with these IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "maxResults": { + "type": "integer", + "description": "Maximum number of results to return.", + "format": "int32", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "Value of the nextPageToken from the previous result page.", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + }, + "searchString": { + "type": "string", + "description": "Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, \"account*2015\" will return objects with names like \"account June 2015\", \"account April 2015\", or simply \"account 2015\". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of \"account\" will match objects with name \"my account\", \"account 2015\", or simply \"account\".", + "location": "query" + }, + "sortField": { + "type": "string", + "description": "Field by which to sort the list.", + "enum": [ + "ID", + "NAME" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + }, + "sortOrder": { + "type": "string", + "description": "Order of sorted results, default is ASCENDING.", + "enum": [ + "ASCENDING", + "DESCENDING" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "AccountsListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "patch": { + "id": "dfareporting.accounts.patch", + "path": "userprofiles/{profileId}/accounts", + "httpMethod": "PATCH", + "description": "Updates an existing account. This method supports patch semantics.", + "parameters": { + "id": { + "type": "string", + "description": "Account ID.", + "required": true, + "format": "int64", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "request": { + "$ref": "Account" + }, + "response": { + "$ref": "Account" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "update": { + "id": "dfareporting.accounts.update", + "path": "userprofiles/{profileId}/accounts", + "httpMethod": "PUT", + "description": "Updates an existing account.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "Account" + }, + "response": { + "$ref": "Account" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "ads": { + "methods": { + "get": { + "id": "dfareporting.ads.get", + "path": "userprofiles/{profileId}/ads/{id}", + "httpMethod": "GET", + "description": "Gets one ad by ID.", + "parameters": { + "id": { + "type": "string", + "description": "Ad ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "response": { + "$ref": "Ad" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "insert": { + "id": "dfareporting.ads.insert", + "path": "userprofiles/{profileId}/ads", + "httpMethod": "POST", + "description": "Inserts a new ad.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "Ad" + }, + "response": { + "$ref": "Ad" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.ads.list", + "path": "userprofiles/{profileId}/ads", + "httpMethod": "GET", + "description": "Retrieves a list of ads, possibly filtered. This method supports paging.", + "parameters": { + "active": { + "type": "boolean", + "description": "Select only active ads.", + "location": "query" + }, + "advertiserId": { + "type": "string", + "description": "Select only ads with this advertiser ID.", + "format": "int64", + "location": "query" + }, + "archived": { + "type": "boolean", + "description": "Select only archived ads.", + "location": "query" + }, + "audienceSegmentIds": { + "type": "string", + "description": "Select only ads with these audience segment IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "campaignIds": { + "type": "string", + "description": "Select only ads with these campaign IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "compatibility": { + "type": "string", + "description": "Select default ads with the specified compatibility. Applicable when type is AD_SERVING_DEFAULT_AD. DISPLAY and DISPLAY_INTERSTITIAL refer to rendering either on desktop or on mobile devices for regular or interstitial ads, respectively. APP and APP_INTERSTITIAL are for rendering in mobile apps. IN_STREAM_VIDEO refers to rendering an in-stream video ads developed with the VAST standard.", + "enum": [ + "APP", + "APP_INTERSTITIAL", + "DISPLAY", + "DISPLAY_INTERSTITIAL", + "IN_STREAM_VIDEO" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "" + ], + "location": "query" + }, + "creativeIds": { + "type": "string", + "description": "Select only ads with these creative IDs assigned.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "creativeOptimizationConfigurationIds": { + "type": "string", + "description": "Select only ads with these creative optimization configuration IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "dynamicClickTracker": { + "type": "boolean", + "description": "Select only dynamic click trackers. Applicable when type is AD_SERVING_CLICK_TRACKER. If true, select dynamic click trackers. If false, select static click trackers. Leave unset to select both.", + "location": "query" + }, + "ids": { + "type": "string", + "description": "Select only ads with these IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "landingPageIds": { + "type": "string", + "description": "Select only ads with these landing page IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "maxResults": { + "type": "integer", + "description": "Maximum number of results to return.", + "format": "int32", + "location": "query" + }, + "overriddenEventTagId": { + "type": "string", + "description": "Select only ads with this event tag override ID.", + "format": "int64", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "Value of the nextPageToken from the previous result page.", + "location": "query" + }, + "placementIds": { + "type": "string", + "description": "Select only ads with these placement IDs assigned.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + }, + "remarketingListIds": { + "type": "string", + "description": "Select only ads whose list targeting expression use these remarketing list IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "searchString": { + "type": "string", + "description": "Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, \"ad*2015\" will return objects with names like \"ad June 2015\", \"ad April 2015\", or simply \"ad 2015\". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of \"ad\" will match objects with name \"my ad\", \"ad 2015\", or simply \"ad\".", + "location": "query" + }, + "sizeIds": { + "type": "string", + "description": "Select only ads with these size IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "sortField": { + "type": "string", + "description": "Field by which to sort the list.", + "enum": [ + "ID", + "NAME" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + }, + "sortOrder": { + "type": "string", + "description": "Order of sorted results, default is ASCENDING.", + "enum": [ + "ASCENDING", + "DESCENDING" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + }, + "sslCompliant": { + "type": "boolean", + "description": "Select only ads that are SSL-compliant.", + "location": "query" + }, + "sslRequired": { + "type": "boolean", + "description": "Select only ads that require SSL.", + "location": "query" + }, + "type": { + "type": "string", + "description": "Select only ads with these types.", + "enum": [ + "AD_SERVING_CLICK_TRACKER", + "AD_SERVING_DEFAULT_AD", + "AD_SERVING_STANDARD_AD", + "AD_SERVING_TRACKING" + ], + "enumDescriptions": [ + "", + "", + "", + "" + ], + "repeated": true, + "location": "query" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "AdsListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "patch": { + "id": "dfareporting.ads.patch", + "path": "userprofiles/{profileId}/ads", + "httpMethod": "PATCH", + "description": "Updates an existing ad. This method supports patch semantics.", + "parameters": { + "id": { + "type": "string", + "description": "Ad ID.", + "required": true, + "format": "int64", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "request": { + "$ref": "Ad" + }, + "response": { + "$ref": "Ad" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "update": { + "id": "dfareporting.ads.update", + "path": "userprofiles/{profileId}/ads", + "httpMethod": "PUT", + "description": "Updates an existing ad.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "Ad" + }, + "response": { + "$ref": "Ad" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "advertiserGroups": { + "methods": { + "delete": { + "id": "dfareporting.advertiserGroups.delete", + "path": "userprofiles/{profileId}/advertiserGroups/{id}", + "httpMethod": "DELETE", + "description": "Deletes an existing advertiser group.", + "parameters": { + "id": { + "type": "string", + "description": "Advertiser group ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "get": { + "id": "dfareporting.advertiserGroups.get", + "path": "userprofiles/{profileId}/advertiserGroups/{id}", + "httpMethod": "GET", + "description": "Gets one advertiser group by ID.", + "parameters": { + "id": { + "type": "string", + "description": "Advertiser group ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "response": { + "$ref": "AdvertiserGroup" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "insert": { + "id": "dfareporting.advertiserGroups.insert", + "path": "userprofiles/{profileId}/advertiserGroups", + "httpMethod": "POST", + "description": "Inserts a new advertiser group.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "AdvertiserGroup" + }, + "response": { + "$ref": "AdvertiserGroup" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.advertiserGroups.list", + "path": "userprofiles/{profileId}/advertiserGroups", + "httpMethod": "GET", + "description": "Retrieves a list of advertiser groups, possibly filtered. This method supports paging.", + "parameters": { + "ids": { + "type": "string", + "description": "Select only advertiser groups with these IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "maxResults": { + "type": "integer", + "description": "Maximum number of results to return.", + "format": "int32", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "Value of the nextPageToken from the previous result page.", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + }, + "searchString": { + "type": "string", + "description": "Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, \"advertiser*2015\" will return objects with names like \"advertiser group June 2015\", \"advertiser group April 2015\", or simply \"advertiser group 2015\". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of \"advertisergroup\" will match objects with name \"my advertisergroup\", \"advertisergroup 2015\", or simply \"advertisergroup\".", + "location": "query" + }, + "sortField": { + "type": "string", + "description": "Field by which to sort the list.", + "enum": [ + "ID", + "NAME" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + }, + "sortOrder": { + "type": "string", + "description": "Order of sorted results, default is ASCENDING.", + "enum": [ + "ASCENDING", + "DESCENDING" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "AdvertiserGroupsListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "patch": { + "id": "dfareporting.advertiserGroups.patch", + "path": "userprofiles/{profileId}/advertiserGroups", + "httpMethod": "PATCH", + "description": "Updates an existing advertiser group. This method supports patch semantics.", + "parameters": { + "id": { + "type": "string", + "description": "Advertiser group ID.", + "required": true, + "format": "int64", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "request": { + "$ref": "AdvertiserGroup" + }, + "response": { + "$ref": "AdvertiserGroup" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "update": { + "id": "dfareporting.advertiserGroups.update", + "path": "userprofiles/{profileId}/advertiserGroups", + "httpMethod": "PUT", + "description": "Updates an existing advertiser group.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "AdvertiserGroup" + }, + "response": { + "$ref": "AdvertiserGroup" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "advertisers": { + "methods": { + "get": { + "id": "dfareporting.advertisers.get", + "path": "userprofiles/{profileId}/advertisers/{id}", + "httpMethod": "GET", + "description": "Gets one advertiser by ID.", + "parameters": { + "id": { + "type": "string", + "description": "Advertiser ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "response": { + "$ref": "Advertiser" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "insert": { + "id": "dfareporting.advertisers.insert", + "path": "userprofiles/{profileId}/advertisers", + "httpMethod": "POST", + "description": "Inserts a new advertiser.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "Advertiser" + }, + "response": { + "$ref": "Advertiser" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.advertisers.list", + "path": "userprofiles/{profileId}/advertisers", + "httpMethod": "GET", + "description": "Retrieves a list of advertisers, possibly filtered. This method supports paging.", + "parameters": { + "advertiserGroupIds": { + "type": "string", + "description": "Select only advertisers with these advertiser group IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "floodlightConfigurationIds": { + "type": "string", + "description": "Select only advertisers with these floodlight configuration IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "ids": { + "type": "string", + "description": "Select only advertisers with these IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "includeAdvertisersWithoutGroupsOnly": { + "type": "boolean", + "description": "Select only advertisers which do not belong to any advertiser group.", + "location": "query" + }, + "maxResults": { + "type": "integer", + "description": "Maximum number of results to return.", + "format": "int32", + "location": "query" + }, + "onlyParent": { + "type": "boolean", + "description": "Select only advertisers which use another advertiser's floodlight configuration.", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "Value of the nextPageToken from the previous result page.", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + }, + "searchString": { + "type": "string", + "description": "Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, \"advertiser*2015\" will return objects with names like \"advertiser June 2015\", \"advertiser April 2015\", or simply \"advertiser 2015\". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of \"advertiser\" will match objects with name \"my advertiser\", \"advertiser 2015\", or simply \"advertiser\".", + "location": "query" + }, + "sortField": { + "type": "string", + "description": "Field by which to sort the list.", + "enum": [ + "ID", + "NAME" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + }, + "sortOrder": { + "type": "string", + "description": "Order of sorted results, default is ASCENDING.", + "enum": [ + "ASCENDING", + "DESCENDING" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + }, + "status": { + "type": "string", + "description": "Select only advertisers with the specified status.", + "enum": [ + "APPROVED", + "ON_HOLD" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + }, + "subaccountId": { + "type": "string", + "description": "Select only advertisers with these subaccount IDs.", + "format": "int64", + "location": "query" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "AdvertisersListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "patch": { + "id": "dfareporting.advertisers.patch", + "path": "userprofiles/{profileId}/advertisers", + "httpMethod": "PATCH", + "description": "Updates an existing advertiser. This method supports patch semantics.", + "parameters": { + "id": { + "type": "string", + "description": "Advertiser ID.", + "required": true, + "format": "int64", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "request": { + "$ref": "Advertiser" + }, + "response": { + "$ref": "Advertiser" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "update": { + "id": "dfareporting.advertisers.update", + "path": "userprofiles/{profileId}/advertisers", + "httpMethod": "PUT", + "description": "Updates an existing advertiser.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "Advertiser" + }, + "response": { + "$ref": "Advertiser" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "browsers": { + "methods": { + "list": { + "id": "dfareporting.browsers.list", + "path": "userprofiles/{profileId}/browsers", + "httpMethod": "GET", + "description": "Retrieves a list of browsers.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "BrowsersListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "campaignCreativeAssociations": { + "methods": { + "insert": { + "id": "dfareporting.campaignCreativeAssociations.insert", + "path": "userprofiles/{profileId}/campaigns/{campaignId}/campaignCreativeAssociations", + "httpMethod": "POST", + "description": "Associates a creative with the specified campaign. This method creates a default ad with dimensions matching the creative in the campaign if such a default ad does not exist already.", + "parameters": { + "campaignId": { + "type": "string", + "description": "Campaign ID in this association.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "campaignId" + ], + "request": { + "$ref": "CampaignCreativeAssociation" + }, + "response": { + "$ref": "CampaignCreativeAssociation" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.campaignCreativeAssociations.list", + "path": "userprofiles/{profileId}/campaigns/{campaignId}/campaignCreativeAssociations", + "httpMethod": "GET", + "description": "Retrieves the list of creative IDs associated with the specified campaign. This method supports paging.", + "parameters": { + "campaignId": { + "type": "string", + "description": "Campaign ID in this association.", + "required": true, + "format": "int64", + "location": "path" + }, + "maxResults": { + "type": "integer", + "description": "Maximum number of results to return.", + "format": "int32", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "Value of the nextPageToken from the previous result page.", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + }, + "sortOrder": { + "type": "string", + "description": "Order of sorted results, default is ASCENDING.", + "enum": [ + "ASCENDING", + "DESCENDING" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + } + }, + "parameterOrder": [ + "profileId", + "campaignId" + ], + "response": { + "$ref": "CampaignCreativeAssociationsListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "campaigns": { + "methods": { + "get": { + "id": "dfareporting.campaigns.get", + "path": "userprofiles/{profileId}/campaigns/{id}", + "httpMethod": "GET", + "description": "Gets one campaign by ID.", + "parameters": { + "id": { + "type": "string", + "description": "Campaign ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "response": { + "$ref": "Campaign" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "insert": { + "id": "dfareporting.campaigns.insert", + "path": "userprofiles/{profileId}/campaigns", + "httpMethod": "POST", + "description": "Inserts a new campaign.", + "parameters": { + "defaultLandingPageName": { + "type": "string", + "description": "Default landing page name for this new campaign. Must be less than 256 characters long.", + "required": true, + "location": "query" + }, + "defaultLandingPageUrl": { + "type": "string", + "description": "Default landing page URL for this new campaign.", + "required": true, + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "defaultLandingPageName", + "defaultLandingPageUrl" + ], + "request": { + "$ref": "Campaign" + }, + "response": { + "$ref": "Campaign" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.campaigns.list", + "path": "userprofiles/{profileId}/campaigns", + "httpMethod": "GET", + "description": "Retrieves a list of campaigns, possibly filtered. This method supports paging.", + "parameters": { + "advertiserGroupIds": { + "type": "string", + "description": "Select only campaigns whose advertisers belong to these advertiser groups.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "advertiserIds": { + "type": "string", + "description": "Select only campaigns that belong to these advertisers.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "archived": { + "type": "boolean", + "description": "Select only archived campaigns. Don't set this field to select both archived and non-archived campaigns.", + "location": "query" + }, + "atLeastOneOptimizationActivity": { + "type": "boolean", + "description": "Select only campaigns that have at least one optimization activity.", + "location": "query" + }, + "excludedIds": { + "type": "string", + "description": "Exclude campaigns with these IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "ids": { + "type": "string", + "description": "Select only campaigns with these IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "maxResults": { + "type": "integer", + "description": "Maximum number of results to return.", + "format": "int32", + "location": "query" + }, + "overriddenEventTagId": { + "type": "string", + "description": "Select only campaigns that have overridden this event tag ID.", + "format": "int64", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "Value of the nextPageToken from the previous result page.", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + }, + "searchString": { + "type": "string", + "description": "Allows searching for campaigns by name or ID. Wildcards (*) are allowed. For example, \"campaign*2015\" will return campaigns with names like \"campaign June 2015\", \"campaign April 2015\", or simply \"campaign 2015\". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of \"campaign\" will match campaigns with name \"my campaign\", \"campaign 2015\", or simply \"campaign\".", + "location": "query" + }, + "sortField": { + "type": "string", + "description": "Field by which to sort the list.", + "enum": [ + "ID", + "NAME" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + }, + "sortOrder": { + "type": "string", + "description": "Order of sorted results, default is ASCENDING.", + "enum": [ + "ASCENDING", + "DESCENDING" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + }, + "subaccountId": { + "type": "string", + "description": "Select only campaigns that belong to this subaccount.", + "format": "int64", + "location": "query" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "CampaignsListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "patch": { + "id": "dfareporting.campaigns.patch", + "path": "userprofiles/{profileId}/campaigns", + "httpMethod": "PATCH", + "description": "Updates an existing campaign. This method supports patch semantics.", + "parameters": { + "id": { + "type": "string", + "description": "Campaign ID.", + "required": true, + "format": "int64", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "request": { + "$ref": "Campaign" + }, + "response": { + "$ref": "Campaign" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "update": { + "id": "dfareporting.campaigns.update", + "path": "userprofiles/{profileId}/campaigns", + "httpMethod": "PUT", + "description": "Updates an existing campaign.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "Campaign" + }, + "response": { + "$ref": "Campaign" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "changeLogs": { + "methods": { + "get": { + "id": "dfareporting.changeLogs.get", + "path": "userprofiles/{profileId}/changeLogs/{id}", + "httpMethod": "GET", + "description": "Gets one change log by ID.", + "parameters": { + "id": { + "type": "string", + "description": "Change log ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "response": { + "$ref": "ChangeLog" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.changeLogs.list", + "path": "userprofiles/{profileId}/changeLogs", + "httpMethod": "GET", + "description": "Retrieves a list of change logs. This method supports paging.", + "parameters": { + "action": { + "type": "string", + "description": "Select only change logs with the specified action.", + "enum": [ + "ACTION_ADD", + "ACTION_ASSIGN", + "ACTION_ASSOCIATE", + "ACTION_CREATE", + "ACTION_DELETE", + "ACTION_DISABLE", + "ACTION_EMAIL_TAGS", + "ACTION_ENABLE", + "ACTION_LINK", + "ACTION_MARK_AS_DEFAULT", + "ACTION_PUSH", + "ACTION_REMOVE", + "ACTION_SEND", + "ACTION_SHARE", + "ACTION_UNASSIGN", + "ACTION_UNLINK", + "ACTION_UPDATE" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "location": "query" + }, + "ids": { + "type": "string", + "description": "Select only change logs with these IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "maxChangeTime": { + "type": "string", + "description": "Select only change logs whose change time is before the specified maxChangeTime.The time should be formatted as an RFC3339 date/time string. For example, for 10:54 PM on July 18th, 2015, in the America/New York time zone, the format is \"2015-07-18T22:54:00-04:00\". In other words, the year, month, day, the letter T, the hour (24-hour clock system), minute, second, and then the time zone offset.", + "location": "query" + }, + "maxResults": { + "type": "integer", + "description": "Maximum number of results to return.", + "format": "int32", + "location": "query" + }, + "minChangeTime": { + "type": "string", + "description": "Select only change logs whose change time is before the specified minChangeTime.The time should be formatted as an RFC3339 date/time string. For example, for 10:54 PM on July 18th, 2015, in the America/New York time zone, the format is \"2015-07-18T22:54:00-04:00\". In other words, the year, month, day, the letter T, the hour (24-hour clock system), minute, second, and then the time zone offset.", + "location": "query" + }, + "objectIds": { + "type": "string", + "description": "Select only change logs with these object IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "objectType": { + "type": "string", + "description": "Select only change logs with the specified object type.", + "enum": [ + "OBJECT_ACCOUNT", + "OBJECT_ACCOUNT_BILLING_FEATURE", + "OBJECT_AD", + "OBJECT_ADVERTISER", + "OBJECT_ADVERTISER_GROUP", + "OBJECT_BILLING_ACCOUNT_GROUP", + "OBJECT_BILLING_FEATURE", + "OBJECT_BILLING_MINIMUM_FEE", + "OBJECT_BILLING_PROFILE", + "OBJECT_CAMPAIGN", + "OBJECT_CONTENT_CATEGORY", + "OBJECT_CREATIVE", + "OBJECT_CREATIVE_ASSET", + "OBJECT_CREATIVE_BUNDLE", + "OBJECT_CREATIVE_FIELD", + "OBJECT_CREATIVE_GROUP", + "OBJECT_DFA_SITE", + "OBJECT_EVENT_TAG", + "OBJECT_FLOODLIGHT_ACTIVITY_GROUP", + "OBJECT_FLOODLIGHT_ACTVITY", + "OBJECT_FLOODLIGHT_CONFIGURATION", + "OBJECT_INSTREAM_CREATIVE", + "OBJECT_LANDING_PAGE", + "OBJECT_MEDIA_ORDER", + "OBJECT_PLACEMENT", + "OBJECT_PLACEMENT_STRATEGY", + "OBJECT_PLAYSTORE_LINK", + "OBJECT_PROVIDED_LIST_CLIENT", + "OBJECT_RATE_CARD", + "OBJECT_REMARKETING_LIST", + "OBJECT_RICHMEDIA_CREATIVE", + "OBJECT_SD_SITE", + "OBJECT_SEARCH_LIFT_STUDY", + "OBJECT_SIZE", + "OBJECT_SUBACCOUNT", + "OBJECT_TARGETING_TEMPLATE", + "OBJECT_USER_PROFILE", + "OBJECT_USER_PROFILE_FILTER", + "OBJECT_USER_ROLE" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "Value of the nextPageToken from the previous result page.", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + }, + "searchString": { + "type": "string", + "description": "Select only change logs whose object ID, user name, old or new values match the search string.", + "location": "query" + }, + "userProfileIds": { + "type": "string", + "description": "Select only change logs with these user profile IDs.", + "format": "int64", + "repeated": true, + "location": "query" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "ChangeLogsListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "cities": { + "methods": { + "list": { + "id": "dfareporting.cities.list", + "path": "userprofiles/{profileId}/cities", + "httpMethod": "GET", + "description": "Retrieves a list of cities, possibly filtered.", + "parameters": { + "countryDartIds": { + "type": "string", + "description": "Select only cities from these countries.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "dartIds": { + "type": "string", + "description": "Select only cities with these DART IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "namePrefix": { + "type": "string", + "description": "Select only cities with names starting with this prefix.", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + }, + "regionDartIds": { + "type": "string", + "description": "Select only cities from these regions.", + "format": "int64", + "repeated": true, + "location": "query" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "CitiesListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "connectionTypes": { + "methods": { + "get": { + "id": "dfareporting.connectionTypes.get", + "path": "userprofiles/{profileId}/connectionTypes/{id}", + "httpMethod": "GET", + "description": "Gets one connection type by ID.", + "parameters": { + "id": { + "type": "string", + "description": "Connection type ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "response": { + "$ref": "ConnectionType" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.connectionTypes.list", + "path": "userprofiles/{profileId}/connectionTypes", + "httpMethod": "GET", + "description": "Retrieves a list of connection types.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "ConnectionTypesListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "contentCategories": { + "methods": { + "delete": { + "id": "dfareporting.contentCategories.delete", + "path": "userprofiles/{profileId}/contentCategories/{id}", + "httpMethod": "DELETE", + "description": "Deletes an existing content category.", + "parameters": { + "id": { + "type": "string", + "description": "Content category ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "get": { + "id": "dfareporting.contentCategories.get", + "path": "userprofiles/{profileId}/contentCategories/{id}", + "httpMethod": "GET", + "description": "Gets one content category by ID.", + "parameters": { + "id": { + "type": "string", + "description": "Content category ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "response": { + "$ref": "ContentCategory" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "insert": { + "id": "dfareporting.contentCategories.insert", + "path": "userprofiles/{profileId}/contentCategories", + "httpMethod": "POST", + "description": "Inserts a new content category.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "ContentCategory" + }, + "response": { + "$ref": "ContentCategory" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.contentCategories.list", + "path": "userprofiles/{profileId}/contentCategories", + "httpMethod": "GET", + "description": "Retrieves a list of content categories, possibly filtered. This method supports paging.", + "parameters": { + "ids": { + "type": "string", + "description": "Select only content categories with these IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "maxResults": { + "type": "integer", + "description": "Maximum number of results to return.", + "format": "int32", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "Value of the nextPageToken from the previous result page.", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + }, + "searchString": { + "type": "string", + "description": "Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, \"contentcategory*2015\" will return objects with names like \"contentcategory June 2015\", \"contentcategory April 2015\", or simply \"contentcategory 2015\". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of \"contentcategory\" will match objects with name \"my contentcategory\", \"contentcategory 2015\", or simply \"contentcategory\".", + "location": "query" + }, + "sortField": { + "type": "string", + "description": "Field by which to sort the list.", + "enum": [ + "ID", + "NAME" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + }, + "sortOrder": { + "type": "string", + "description": "Order of sorted results, default is ASCENDING.", + "enum": [ + "ASCENDING", + "DESCENDING" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "ContentCategoriesListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "patch": { + "id": "dfareporting.contentCategories.patch", + "path": "userprofiles/{profileId}/contentCategories", + "httpMethod": "PATCH", + "description": "Updates an existing content category. This method supports patch semantics.", + "parameters": { + "id": { + "type": "string", + "description": "Content category ID.", + "required": true, + "format": "int64", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "request": { + "$ref": "ContentCategory" + }, + "response": { + "$ref": "ContentCategory" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "update": { + "id": "dfareporting.contentCategories.update", + "path": "userprofiles/{profileId}/contentCategories", + "httpMethod": "PUT", + "description": "Updates an existing content category.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "ContentCategory" + }, + "response": { + "$ref": "ContentCategory" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "conversions": { + "methods": { + "batchinsert": { + "id": "dfareporting.conversions.batchinsert", + "path": "userprofiles/{profileId}/conversions/batchinsert", + "httpMethod": "POST", + "description": "Inserts conversions.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "ConversionsBatchInsertRequest" + }, + "response": { + "$ref": "ConversionsBatchInsertResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/ddmconversions" + ] + } + } + }, + "countries": { + "methods": { + "get": { + "id": "dfareporting.countries.get", + "path": "userprofiles/{profileId}/countries/{dartId}", + "httpMethod": "GET", + "description": "Gets one country by ID.", + "parameters": { + "dartId": { + "type": "string", + "description": "Country DART ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "dartId" + ], + "response": { + "$ref": "Country" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.countries.list", + "path": "userprofiles/{profileId}/countries", + "httpMethod": "GET", + "description": "Retrieves a list of countries.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "CountriesListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "creativeAssets": { + "methods": { + "insert": { + "id": "dfareporting.creativeAssets.insert", + "path": "userprofiles/{profileId}/creativeAssets/{advertiserId}/creativeAssets", + "httpMethod": "POST", + "description": "Inserts a new creative asset.", + "parameters": { + "advertiserId": { + "type": "string", + "description": "Advertiser ID of this creative. This is a required field.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "advertiserId" + ], + "request": { + "$ref": "CreativeAssetMetadata" + }, + "response": { + "$ref": "CreativeAssetMetadata" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ], + "supportsMediaUpload": true, + "mediaUpload": { + "accept": [ + "*/*" + ], + "maxSize": "1024MB", + "protocols": { + "simple": { + "multipart": true, + "path": "/upload/dfareporting/v2.7/userprofiles/{profileId}/creativeAssets/{advertiserId}/creativeAssets" + }, + "resumable": { + "multipart": true, + "path": "/resumable/upload/dfareporting/v2.7/userprofiles/{profileId}/creativeAssets/{advertiserId}/creativeAssets" + } + } + } + } + } + }, + "creativeFieldValues": { + "methods": { + "delete": { + "id": "dfareporting.creativeFieldValues.delete", + "path": "userprofiles/{profileId}/creativeFields/{creativeFieldId}/creativeFieldValues/{id}", + "httpMethod": "DELETE", + "description": "Deletes an existing creative field value.", + "parameters": { + "creativeFieldId": { + "type": "string", + "description": "Creative field ID for this creative field value.", + "required": true, + "format": "int64", + "location": "path" + }, + "id": { + "type": "string", + "description": "Creative Field Value ID", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "creativeFieldId", + "id" + ], + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "get": { + "id": "dfareporting.creativeFieldValues.get", + "path": "userprofiles/{profileId}/creativeFields/{creativeFieldId}/creativeFieldValues/{id}", + "httpMethod": "GET", + "description": "Gets one creative field value by ID.", + "parameters": { + "creativeFieldId": { + "type": "string", + "description": "Creative field ID for this creative field value.", + "required": true, + "format": "int64", + "location": "path" + }, + "id": { + "type": "string", + "description": "Creative Field Value ID", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "creativeFieldId", + "id" + ], + "response": { + "$ref": "CreativeFieldValue" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "insert": { + "id": "dfareporting.creativeFieldValues.insert", + "path": "userprofiles/{profileId}/creativeFields/{creativeFieldId}/creativeFieldValues", + "httpMethod": "POST", + "description": "Inserts a new creative field value.", + "parameters": { + "creativeFieldId": { + "type": "string", + "description": "Creative field ID for this creative field value.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "creativeFieldId" + ], + "request": { + "$ref": "CreativeFieldValue" + }, + "response": { + "$ref": "CreativeFieldValue" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.creativeFieldValues.list", + "path": "userprofiles/{profileId}/creativeFields/{creativeFieldId}/creativeFieldValues", + "httpMethod": "GET", + "description": "Retrieves a list of creative field values, possibly filtered. This method supports paging.", + "parameters": { + "creativeFieldId": { + "type": "string", + "description": "Creative field ID for this creative field value.", + "required": true, + "format": "int64", + "location": "path" + }, + "ids": { + "type": "string", + "description": "Select only creative field values with these IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "maxResults": { + "type": "integer", + "description": "Maximum number of results to return.", + "format": "int32", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "Value of the nextPageToken from the previous result page.", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + }, + "searchString": { + "type": "string", + "description": "Allows searching for creative field values by their values. Wildcards (e.g. *) are not allowed.", + "location": "query" + }, + "sortField": { + "type": "string", + "description": "Field by which to sort the list.", + "enum": [ + "ID", + "VALUE" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + }, + "sortOrder": { + "type": "string", + "description": "Order of sorted results, default is ASCENDING.", + "enum": [ + "ASCENDING", + "DESCENDING" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + } + }, + "parameterOrder": [ + "profileId", + "creativeFieldId" + ], + "response": { + "$ref": "CreativeFieldValuesListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "patch": { + "id": "dfareporting.creativeFieldValues.patch", + "path": "userprofiles/{profileId}/creativeFields/{creativeFieldId}/creativeFieldValues", + "httpMethod": "PATCH", + "description": "Updates an existing creative field value. This method supports patch semantics.", + "parameters": { + "creativeFieldId": { + "type": "string", + "description": "Creative field ID for this creative field value.", + "required": true, + "format": "int64", + "location": "path" + }, + "id": { + "type": "string", + "description": "Creative Field Value ID", + "required": true, + "format": "int64", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "creativeFieldId", + "id" + ], + "request": { + "$ref": "CreativeFieldValue" + }, + "response": { + "$ref": "CreativeFieldValue" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "update": { + "id": "dfareporting.creativeFieldValues.update", + "path": "userprofiles/{profileId}/creativeFields/{creativeFieldId}/creativeFieldValues", + "httpMethod": "PUT", + "description": "Updates an existing creative field value.", + "parameters": { + "creativeFieldId": { + "type": "string", + "description": "Creative field ID for this creative field value.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "creativeFieldId" + ], + "request": { + "$ref": "CreativeFieldValue" + }, + "response": { + "$ref": "CreativeFieldValue" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "creativeFields": { + "methods": { + "delete": { + "id": "dfareporting.creativeFields.delete", + "path": "userprofiles/{profileId}/creativeFields/{id}", + "httpMethod": "DELETE", + "description": "Deletes an existing creative field.", + "parameters": { + "id": { + "type": "string", + "description": "Creative Field ID", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "get": { + "id": "dfareporting.creativeFields.get", + "path": "userprofiles/{profileId}/creativeFields/{id}", + "httpMethod": "GET", + "description": "Gets one creative field by ID.", + "parameters": { + "id": { + "type": "string", + "description": "Creative Field ID", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "response": { + "$ref": "CreativeField" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "insert": { + "id": "dfareporting.creativeFields.insert", + "path": "userprofiles/{profileId}/creativeFields", + "httpMethod": "POST", + "description": "Inserts a new creative field.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "CreativeField" + }, + "response": { + "$ref": "CreativeField" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.creativeFields.list", + "path": "userprofiles/{profileId}/creativeFields", + "httpMethod": "GET", + "description": "Retrieves a list of creative fields, possibly filtered. This method supports paging.", + "parameters": { + "advertiserIds": { + "type": "string", + "description": "Select only creative fields that belong to these advertisers.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "ids": { + "type": "string", + "description": "Select only creative fields with these IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "maxResults": { + "type": "integer", + "description": "Maximum number of results to return.", + "format": "int32", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "Value of the nextPageToken from the previous result page.", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + }, + "searchString": { + "type": "string", + "description": "Allows searching for creative fields by name or ID. Wildcards (*) are allowed. For example, \"creativefield*2015\" will return creative fields with names like \"creativefield June 2015\", \"creativefield April 2015\", or simply \"creativefield 2015\". Most of the searches also add wild-cards implicitly at the start and the end of the search string. For example, a search string of \"creativefield\" will match creative fields with the name \"my creativefield\", \"creativefield 2015\", or simply \"creativefield\".", + "location": "query" + }, + "sortField": { + "type": "string", + "description": "Field by which to sort the list.", + "enum": [ + "ID", + "NAME" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + }, + "sortOrder": { + "type": "string", + "description": "Order of sorted results, default is ASCENDING.", + "enum": [ + "ASCENDING", + "DESCENDING" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "CreativeFieldsListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "patch": { + "id": "dfareporting.creativeFields.patch", + "path": "userprofiles/{profileId}/creativeFields", + "httpMethod": "PATCH", + "description": "Updates an existing creative field. This method supports patch semantics.", + "parameters": { + "id": { + "type": "string", + "description": "Creative Field ID", + "required": true, + "format": "int64", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "request": { + "$ref": "CreativeField" + }, + "response": { + "$ref": "CreativeField" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "update": { + "id": "dfareporting.creativeFields.update", + "path": "userprofiles/{profileId}/creativeFields", + "httpMethod": "PUT", + "description": "Updates an existing creative field.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "CreativeField" + }, + "response": { + "$ref": "CreativeField" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "creativeGroups": { + "methods": { + "get": { + "id": "dfareporting.creativeGroups.get", + "path": "userprofiles/{profileId}/creativeGroups/{id}", + "httpMethod": "GET", + "description": "Gets one creative group by ID.", + "parameters": { + "id": { + "type": "string", + "description": "Creative group ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "response": { + "$ref": "CreativeGroup" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "insert": { + "id": "dfareporting.creativeGroups.insert", + "path": "userprofiles/{profileId}/creativeGroups", + "httpMethod": "POST", + "description": "Inserts a new creative group.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "CreativeGroup" + }, + "response": { + "$ref": "CreativeGroup" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.creativeGroups.list", + "path": "userprofiles/{profileId}/creativeGroups", + "httpMethod": "GET", + "description": "Retrieves a list of creative groups, possibly filtered. This method supports paging.", + "parameters": { + "advertiserIds": { + "type": "string", + "description": "Select only creative groups that belong to these advertisers.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "groupNumber": { + "type": "integer", + "description": "Select only creative groups that belong to this subgroup.", + "format": "int32", + "location": "query" + }, + "ids": { + "type": "string", + "description": "Select only creative groups with these IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "maxResults": { + "type": "integer", + "description": "Maximum number of results to return.", + "format": "int32", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "Value of the nextPageToken from the previous result page.", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + }, + "searchString": { + "type": "string", + "description": "Allows searching for creative groups by name or ID. Wildcards (*) are allowed. For example, \"creativegroup*2015\" will return creative groups with names like \"creativegroup June 2015\", \"creativegroup April 2015\", or simply \"creativegroup 2015\". Most of the searches also add wild-cards implicitly at the start and the end of the search string. For example, a search string of \"creativegroup\" will match creative groups with the name \"my creativegroup\", \"creativegroup 2015\", or simply \"creativegroup\".", + "location": "query" + }, + "sortField": { + "type": "string", + "description": "Field by which to sort the list.", + "enum": [ + "ID", + "NAME" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + }, + "sortOrder": { + "type": "string", + "description": "Order of sorted results, default is ASCENDING.", + "enum": [ + "ASCENDING", + "DESCENDING" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "CreativeGroupsListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "patch": { + "id": "dfareporting.creativeGroups.patch", + "path": "userprofiles/{profileId}/creativeGroups", + "httpMethod": "PATCH", + "description": "Updates an existing creative group. This method supports patch semantics.", + "parameters": { + "id": { + "type": "string", + "description": "Creative group ID.", + "required": true, + "format": "int64", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "request": { + "$ref": "CreativeGroup" + }, + "response": { + "$ref": "CreativeGroup" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "update": { + "id": "dfareporting.creativeGroups.update", + "path": "userprofiles/{profileId}/creativeGroups", + "httpMethod": "PUT", + "description": "Updates an existing creative group.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "CreativeGroup" + }, + "response": { + "$ref": "CreativeGroup" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "creatives": { + "methods": { + "get": { + "id": "dfareporting.creatives.get", + "path": "userprofiles/{profileId}/creatives/{id}", + "httpMethod": "GET", + "description": "Gets one creative by ID.", + "parameters": { + "id": { + "type": "string", + "description": "Creative ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "response": { + "$ref": "Creative" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "insert": { + "id": "dfareporting.creatives.insert", + "path": "userprofiles/{profileId}/creatives", + "httpMethod": "POST", + "description": "Inserts a new creative.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "Creative" + }, + "response": { + "$ref": "Creative" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.creatives.list", + "path": "userprofiles/{profileId}/creatives", + "httpMethod": "GET", + "description": "Retrieves a list of creatives, possibly filtered. This method supports paging.", + "parameters": { + "active": { + "type": "boolean", + "description": "Select only active creatives. Leave blank to select active and inactive creatives.", + "location": "query" + }, + "advertiserId": { + "type": "string", + "description": "Select only creatives with this advertiser ID.", + "format": "int64", + "location": "query" + }, + "archived": { + "type": "boolean", + "description": "Select only archived creatives. Leave blank to select archived and unarchived creatives.", + "location": "query" + }, + "campaignId": { + "type": "string", + "description": "Select only creatives with this campaign ID.", + "format": "int64", + "location": "query" + }, + "companionCreativeIds": { + "type": "string", + "description": "Select only in-stream video creatives with these companion IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "creativeFieldIds": { + "type": "string", + "description": "Select only creatives with these creative field IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "ids": { + "type": "string", + "description": "Select only creatives with these IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "maxResults": { + "type": "integer", + "description": "Maximum number of results to return.", + "format": "int32", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "Value of the nextPageToken from the previous result page.", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + }, + "renderingIds": { + "type": "string", + "description": "Select only creatives with these rendering IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "searchString": { + "type": "string", + "description": "Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, \"creative*2015\" will return objects with names like \"creative June 2015\", \"creative April 2015\", or simply \"creative 2015\". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of \"creative\" will match objects with name \"my creative\", \"creative 2015\", or simply \"creative\".", + "location": "query" + }, + "sizeIds": { + "type": "string", + "description": "Select only creatives with these size IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "sortField": { + "type": "string", + "description": "Field by which to sort the list.", + "enum": [ + "ID", + "NAME" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + }, + "sortOrder": { + "type": "string", + "description": "Order of sorted results, default is ASCENDING.", + "enum": [ + "ASCENDING", + "DESCENDING" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + }, + "studioCreativeId": { + "type": "string", + "description": "Select only creatives corresponding to this Studio creative ID.", + "format": "int64", + "location": "query" + }, + "types": { + "type": "string", + "description": "Select only creatives with these creative types.", + "enum": [ + "BRAND_SAFE_DEFAULT_INSTREAM_VIDEO", + "CUSTOM_DISPLAY", + "CUSTOM_DISPLAY_INTERSTITIAL", + "DISPLAY", + "DISPLAY_IMAGE_GALLERY", + "DISPLAY_REDIRECT", + "FLASH_INPAGE", + "HTML5_BANNER", + "IMAGE", + "INSTREAM_VIDEO", + "INSTREAM_VIDEO_REDIRECT", + "INTERNAL_REDIRECT", + "INTERSTITIAL_INTERNAL_REDIRECT", + "RICH_MEDIA_DISPLAY_BANNER", + "RICH_MEDIA_DISPLAY_EXPANDING", + "RICH_MEDIA_DISPLAY_INTERSTITIAL", + "RICH_MEDIA_DISPLAY_MULTI_FLOATING_INTERSTITIAL", + "RICH_MEDIA_IM_EXPAND", + "RICH_MEDIA_INPAGE_FLOATING", + "RICH_MEDIA_MOBILE_IN_APP", + "RICH_MEDIA_PEEL_DOWN", + "TRACKING_TEXT", + "VPAID_LINEAR_VIDEO", + "VPAID_NON_LINEAR_VIDEO" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "repeated": true, + "location": "query" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "CreativesListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "patch": { + "id": "dfareporting.creatives.patch", + "path": "userprofiles/{profileId}/creatives", + "httpMethod": "PATCH", + "description": "Updates an existing creative. This method supports patch semantics.", + "parameters": { + "id": { + "type": "string", + "description": "Creative ID.", + "required": true, + "format": "int64", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "request": { + "$ref": "Creative" + }, + "response": { + "$ref": "Creative" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "update": { + "id": "dfareporting.creatives.update", + "path": "userprofiles/{profileId}/creatives", + "httpMethod": "PUT", + "description": "Updates an existing creative.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "Creative" + }, + "response": { + "$ref": "Creative" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "dimensionValues": { + "methods": { + "query": { + "id": "dfareporting.dimensionValues.query", + "path": "userprofiles/{profileId}/dimensionvalues/query", + "httpMethod": "POST", + "description": "Retrieves list of report dimension values for a list of filters.", + "parameters": { + "maxResults": { + "type": "integer", + "description": "Maximum number of results to return.", + "format": "int32", + "minimum": "0", + "maximum": "100", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "The value of the nextToken from the previous result page.", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "The DFA user profile ID.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "DimensionValueRequest" + }, + "response": { + "$ref": "DimensionValueList" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfareporting" + ] + } + } + }, + "directorySiteContacts": { + "methods": { + "get": { + "id": "dfareporting.directorySiteContacts.get", + "path": "userprofiles/{profileId}/directorySiteContacts/{id}", + "httpMethod": "GET", + "description": "Gets one directory site contact by ID.", + "parameters": { + "id": { + "type": "string", + "description": "Directory site contact ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "response": { + "$ref": "DirectorySiteContact" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.directorySiteContacts.list", + "path": "userprofiles/{profileId}/directorySiteContacts", + "httpMethod": "GET", + "description": "Retrieves a list of directory site contacts, possibly filtered. This method supports paging.", + "parameters": { + "directorySiteIds": { + "type": "string", + "description": "Select only directory site contacts with these directory site IDs. This is a required field.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "ids": { + "type": "string", + "description": "Select only directory site contacts with these IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "maxResults": { + "type": "integer", + "description": "Maximum number of results to return.", + "format": "int32", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "Value of the nextPageToken from the previous result page.", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + }, + "searchString": { + "type": "string", + "description": "Allows searching for objects by name, ID or email. Wildcards (*) are allowed. For example, \"directory site contact*2015\" will return objects with names like \"directory site contact June 2015\", \"directory site contact April 2015\", or simply \"directory site contact 2015\". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of \"directory site contact\" will match objects with name \"my directory site contact\", \"directory site contact 2015\", or simply \"directory site contact\".", + "location": "query" + }, + "sortField": { + "type": "string", + "description": "Field by which to sort the list.", + "enum": [ + "ID", + "NAME" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + }, + "sortOrder": { + "type": "string", + "description": "Order of sorted results, default is ASCENDING.", + "enum": [ + "ASCENDING", + "DESCENDING" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "DirectorySiteContactsListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "directorySites": { + "methods": { + "get": { + "id": "dfareporting.directorySites.get", + "path": "userprofiles/{profileId}/directorySites/{id}", + "httpMethod": "GET", + "description": "Gets one directory site by ID.", + "parameters": { + "id": { + "type": "string", + "description": "Directory site ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "response": { + "$ref": "DirectorySite" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "insert": { + "id": "dfareporting.directorySites.insert", + "path": "userprofiles/{profileId}/directorySites", + "httpMethod": "POST", + "description": "Inserts a new directory site.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "DirectorySite" + }, + "response": { + "$ref": "DirectorySite" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.directorySites.list", + "path": "userprofiles/{profileId}/directorySites", + "httpMethod": "GET", + "description": "Retrieves a list of directory sites, possibly filtered. This method supports paging.", + "parameters": { + "acceptsInStreamVideoPlacements": { + "type": "boolean", + "description": "This search filter is no longer supported and will have no effect on the results returned.", + "location": "query" + }, + "acceptsInterstitialPlacements": { + "type": "boolean", + "description": "This search filter is no longer supported and will have no effect on the results returned.", + "location": "query" + }, + "acceptsPublisherPaidPlacements": { + "type": "boolean", + "description": "Select only directory sites that accept publisher paid placements. This field can be left blank.", + "location": "query" + }, + "active": { + "type": "boolean", + "description": "Select only active directory sites. Leave blank to retrieve both active and inactive directory sites.", + "location": "query" + }, + "countryId": { + "type": "string", + "description": "Select only directory sites with this country ID.", + "format": "int64", + "location": "query" + }, + "dfp_network_code": { + "type": "string", + "description": "Select only directory sites with this DFP network code.", + "location": "query" + }, + "ids": { + "type": "string", + "description": "Select only directory sites with these IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "maxResults": { + "type": "integer", + "description": "Maximum number of results to return.", + "format": "int32", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "Value of the nextPageToken from the previous result page.", + "location": "query" + }, + "parentId": { + "type": "string", + "description": "Select only directory sites with this parent ID.", + "format": "int64", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + }, + "searchString": { + "type": "string", + "description": "Allows searching for objects by name, ID or URL. Wildcards (*) are allowed. For example, \"directory site*2015\" will return objects with names like \"directory site June 2015\", \"directory site April 2015\", or simply \"directory site 2015\". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of \"directory site\" will match objects with name \"my directory site\", \"directory site 2015\" or simply, \"directory site\".", + "location": "query" + }, + "sortField": { + "type": "string", + "description": "Field by which to sort the list.", + "enum": [ + "ID", + "NAME" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + }, + "sortOrder": { + "type": "string", + "description": "Order of sorted results, default is ASCENDING.", + "enum": [ + "ASCENDING", + "DESCENDING" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "DirectorySitesListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "dynamicTargetingKeys": { + "methods": { + "delete": { + "id": "dfareporting.dynamicTargetingKeys.delete", + "path": "userprofiles/{profileId}/dynamicTargetingKeys/{objectId}", + "httpMethod": "DELETE", + "description": "Deletes an existing dynamic targeting key.", + "parameters": { + "name": { + "type": "string", + "description": "Name of this dynamic targeting key. This is a required field. Must be less than 256 characters long and cannot contain commas. All characters are converted to lowercase.", + "required": true, + "location": "query" + }, + "objectId": { + "type": "string", + "description": "ID of the object of this dynamic targeting key. This is a required field.", + "required": true, + "format": "int64", + "location": "path" + }, + "objectType": { + "type": "string", + "description": "Type of the object of this dynamic targeting key. This is a required field.", + "required": true, + "enum": [ + "OBJECT_AD", + "OBJECT_ADVERTISER", + "OBJECT_CREATIVE", + "OBJECT_PLACEMENT" + ], + "enumDescriptions": [ + "", + "", + "", + "" + ], + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "objectId", + "name", + "objectType" + ], + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "insert": { + "id": "dfareporting.dynamicTargetingKeys.insert", + "path": "userprofiles/{profileId}/dynamicTargetingKeys", + "httpMethod": "POST", + "description": "Inserts a new dynamic targeting key. Keys must be created at the advertiser level before being assigned to the advertiser's ads, creatives, or placements. There is a maximum of 1000 keys per advertiser, out of which a maximum of 20 keys can be assigned per ad, creative, or placement.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "DynamicTargetingKey" + }, + "response": { + "$ref": "DynamicTargetingKey" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.dynamicTargetingKeys.list", + "path": "userprofiles/{profileId}/dynamicTargetingKeys", + "httpMethod": "GET", + "description": "Retrieves a list of dynamic targeting keys.", + "parameters": { + "advertiserId": { + "type": "string", + "description": "Select only dynamic targeting keys whose object has this advertiser ID.", + "format": "int64", + "location": "query" + }, + "names": { + "type": "string", + "description": "Select only dynamic targeting keys exactly matching these names.", + "repeated": true, + "location": "query" + }, + "objectId": { + "type": "string", + "description": "Select only dynamic targeting keys with this object ID.", + "format": "int64", + "location": "query" + }, + "objectType": { + "type": "string", + "description": "Select only dynamic targeting keys with this object type.", + "enum": [ + "OBJECT_AD", + "OBJECT_ADVERTISER", + "OBJECT_CREATIVE", + "OBJECT_PLACEMENT" + ], + "enumDescriptions": [ + "", + "", + "", + "" + ], + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "DynamicTargetingKeysListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "eventTags": { + "methods": { + "delete": { + "id": "dfareporting.eventTags.delete", + "path": "userprofiles/{profileId}/eventTags/{id}", + "httpMethod": "DELETE", + "description": "Deletes an existing event tag.", + "parameters": { + "id": { + "type": "string", + "description": "Event tag ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "get": { + "id": "dfareporting.eventTags.get", + "path": "userprofiles/{profileId}/eventTags/{id}", + "httpMethod": "GET", + "description": "Gets one event tag by ID.", + "parameters": { + "id": { + "type": "string", + "description": "Event tag ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "response": { + "$ref": "EventTag" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "insert": { + "id": "dfareporting.eventTags.insert", + "path": "userprofiles/{profileId}/eventTags", + "httpMethod": "POST", + "description": "Inserts a new event tag.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "EventTag" + }, + "response": { + "$ref": "EventTag" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.eventTags.list", + "path": "userprofiles/{profileId}/eventTags", + "httpMethod": "GET", + "description": "Retrieves a list of event tags, possibly filtered.", + "parameters": { + "adId": { + "type": "string", + "description": "Select only event tags that belong to this ad.", + "format": "int64", + "location": "query" + }, + "advertiserId": { + "type": "string", + "description": "Select only event tags that belong to this advertiser.", + "format": "int64", + "location": "query" + }, + "campaignId": { + "type": "string", + "description": "Select only event tags that belong to this campaign.", + "format": "int64", + "location": "query" + }, + "definitionsOnly": { + "type": "boolean", + "description": "Examine only the specified campaign or advertiser's event tags for matching selector criteria. When set to false, the parent advertiser and parent campaign of the specified ad or campaign is examined as well. In addition, when set to false, the status field is examined as well, along with the enabledByDefault field. This parameter can not be set to true when adId is specified as ads do not define their own even tags.", + "location": "query" + }, + "enabled": { + "type": "boolean", + "description": "Select only enabled event tags. What is considered enabled or disabled depends on the definitionsOnly parameter. When definitionsOnly is set to true, only the specified advertiser or campaign's event tags' enabledByDefault field is examined. When definitionsOnly is set to false, the specified ad or specified campaign's parent advertiser's or parent campaign's event tags' enabledByDefault and status fields are examined as well.", + "location": "query" + }, + "eventTagTypes": { + "type": "string", + "description": "Select only event tags with the specified event tag types. Event tag types can be used to specify whether to use a third-party pixel, a third-party JavaScript URL, or a third-party click-through URL for either impression or click tracking.", + "enum": [ + "CLICK_THROUGH_EVENT_TAG", + "IMPRESSION_IMAGE_EVENT_TAG", + "IMPRESSION_JAVASCRIPT_EVENT_TAG" + ], + "enumDescriptions": [ + "", + "", + "" + ], + "repeated": true, + "location": "query" + }, + "ids": { + "type": "string", + "description": "Select only event tags with these IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + }, + "searchString": { + "type": "string", + "description": "Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, \"eventtag*2015\" will return objects with names like \"eventtag June 2015\", \"eventtag April 2015\", or simply \"eventtag 2015\". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of \"eventtag\" will match objects with name \"my eventtag\", \"eventtag 2015\", or simply \"eventtag\".", + "location": "query" + }, + "sortField": { + "type": "string", + "description": "Field by which to sort the list.", + "enum": [ + "ID", + "NAME" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + }, + "sortOrder": { + "type": "string", + "description": "Order of sorted results, default is ASCENDING.", + "enum": [ + "ASCENDING", + "DESCENDING" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "EventTagsListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "patch": { + "id": "dfareporting.eventTags.patch", + "path": "userprofiles/{profileId}/eventTags", + "httpMethod": "PATCH", + "description": "Updates an existing event tag. This method supports patch semantics.", + "parameters": { + "id": { + "type": "string", + "description": "Event tag ID.", + "required": true, + "format": "int64", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "request": { + "$ref": "EventTag" + }, + "response": { + "$ref": "EventTag" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "update": { + "id": "dfareporting.eventTags.update", + "path": "userprofiles/{profileId}/eventTags", + "httpMethod": "PUT", + "description": "Updates an existing event tag.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "EventTag" + }, + "response": { + "$ref": "EventTag" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "files": { + "methods": { + "get": { + "id": "dfareporting.files.get", + "path": "reports/{reportId}/files/{fileId}", + "httpMethod": "GET", + "description": "Retrieves a report file by its report ID and file ID.", + "parameters": { + "fileId": { + "type": "string", + "description": "The ID of the report file.", + "required": true, + "format": "int64", + "location": "path" + }, + "reportId": { + "type": "string", + "description": "The ID of the report.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "reportId", + "fileId" + ], + "response": { + "$ref": "File" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfareporting" + ], + "supportsMediaDownload": true + }, + "list": { + "id": "dfareporting.files.list", + "path": "userprofiles/{profileId}/files", + "httpMethod": "GET", + "description": "Lists files for a user profile.", + "parameters": { + "maxResults": { + "type": "integer", + "description": "Maximum number of results to return.", + "format": "int32", + "minimum": "0", + "maximum": "10", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "The value of the nextToken from the previous result page.", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "The DFA profile ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "scope": { + "type": "string", + "description": "The scope that defines which results are returned, default is 'MINE'.", + "default": "MINE", + "enum": [ + "ALL", + "MINE", + "SHARED_WITH_ME" + ], + "enumDescriptions": [ + "All files in account.", + "My files.", + "Files shared with me." + ], + "location": "query" + }, + "sortField": { + "type": "string", + "description": "The field by which to sort the list.", + "default": "LAST_MODIFIED_TIME", + "enum": [ + "ID", + "LAST_MODIFIED_TIME" + ], + "enumDescriptions": [ + "Sort by file ID.", + "Sort by 'lastmodifiedAt' field." + ], + "location": "query" + }, + "sortOrder": { + "type": "string", + "description": "Order of sorted results, default is 'DESCENDING'.", + "default": "DESCENDING", + "enum": [ + "ASCENDING", + "DESCENDING" + ], + "enumDescriptions": [ + "Ascending order.", + "Descending order." + ], + "location": "query" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "FileList" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfareporting" + ] + } + } + }, + "floodlightActivities": { + "methods": { + "delete": { + "id": "dfareporting.floodlightActivities.delete", + "path": "userprofiles/{profileId}/floodlightActivities/{id}", + "httpMethod": "DELETE", + "description": "Deletes an existing floodlight activity.", + "parameters": { + "id": { + "type": "string", + "description": "Floodlight activity ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "generatetag": { + "id": "dfareporting.floodlightActivities.generatetag", + "path": "userprofiles/{profileId}/floodlightActivities/generatetag", + "httpMethod": "POST", + "description": "Generates a tag for a floodlight activity.", + "parameters": { + "floodlightActivityId": { + "type": "string", + "description": "Floodlight activity ID for which we want to generate a tag.", + "format": "int64", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "FloodlightActivitiesGenerateTagResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "get": { + "id": "dfareporting.floodlightActivities.get", + "path": "userprofiles/{profileId}/floodlightActivities/{id}", + "httpMethod": "GET", + "description": "Gets one floodlight activity by ID.", + "parameters": { + "id": { + "type": "string", + "description": "Floodlight activity ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "response": { + "$ref": "FloodlightActivity" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "insert": { + "id": "dfareporting.floodlightActivities.insert", + "path": "userprofiles/{profileId}/floodlightActivities", + "httpMethod": "POST", + "description": "Inserts a new floodlight activity.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "FloodlightActivity" + }, + "response": { + "$ref": "FloodlightActivity" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.floodlightActivities.list", + "path": "userprofiles/{profileId}/floodlightActivities", + "httpMethod": "GET", + "description": "Retrieves a list of floodlight activities, possibly filtered. This method supports paging.", + "parameters": { + "advertiserId": { + "type": "string", + "description": "Select only floodlight activities for the specified advertiser ID. Must specify either ids, advertiserId, or floodlightConfigurationId for a non-empty result.", + "format": "int64", + "location": "query" + }, + "floodlightActivityGroupIds": { + "type": "string", + "description": "Select only floodlight activities with the specified floodlight activity group IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "floodlightActivityGroupName": { + "type": "string", + "description": "Select only floodlight activities with the specified floodlight activity group name.", + "location": "query" + }, + "floodlightActivityGroupTagString": { + "type": "string", + "description": "Select only floodlight activities with the specified floodlight activity group tag string.", + "location": "query" + }, + "floodlightActivityGroupType": { + "type": "string", + "description": "Select only floodlight activities with the specified floodlight activity group type.", + "enum": [ + "COUNTER", + "SALE" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + }, + "floodlightConfigurationId": { + "type": "string", + "description": "Select only floodlight activities for the specified floodlight configuration ID. Must specify either ids, advertiserId, or floodlightConfigurationId for a non-empty result.", + "format": "int64", + "location": "query" + }, + "ids": { + "type": "string", + "description": "Select only floodlight activities with the specified IDs. Must specify either ids, advertiserId, or floodlightConfigurationId for a non-empty result.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "maxResults": { + "type": "integer", + "description": "Maximum number of results to return.", + "format": "int32", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "Value of the nextPageToken from the previous result page.", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + }, + "searchString": { + "type": "string", + "description": "Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, \"floodlightactivity*2015\" will return objects with names like \"floodlightactivity June 2015\", \"floodlightactivity April 2015\", or simply \"floodlightactivity 2015\". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of \"floodlightactivity\" will match objects with name \"my floodlightactivity activity\", \"floodlightactivity 2015\", or simply \"floodlightactivity\".", + "location": "query" + }, + "sortField": { + "type": "string", + "description": "Field by which to sort the list.", + "enum": [ + "ID", + "NAME" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + }, + "sortOrder": { + "type": "string", + "description": "Order of sorted results, default is ASCENDING.", + "enum": [ + "ASCENDING", + "DESCENDING" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + }, + "tagString": { + "type": "string", + "description": "Select only floodlight activities with the specified tag string.", + "location": "query" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "FloodlightActivitiesListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "patch": { + "id": "dfareporting.floodlightActivities.patch", + "path": "userprofiles/{profileId}/floodlightActivities", + "httpMethod": "PATCH", + "description": "Updates an existing floodlight activity. This method supports patch semantics.", + "parameters": { + "id": { + "type": "string", + "description": "Floodlight activity ID.", + "required": true, + "format": "int64", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "request": { + "$ref": "FloodlightActivity" + }, + "response": { + "$ref": "FloodlightActivity" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "update": { + "id": "dfareporting.floodlightActivities.update", + "path": "userprofiles/{profileId}/floodlightActivities", + "httpMethod": "PUT", + "description": "Updates an existing floodlight activity.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "FloodlightActivity" + }, + "response": { + "$ref": "FloodlightActivity" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "floodlightActivityGroups": { + "methods": { + "get": { + "id": "dfareporting.floodlightActivityGroups.get", + "path": "userprofiles/{profileId}/floodlightActivityGroups/{id}", + "httpMethod": "GET", + "description": "Gets one floodlight activity group by ID.", + "parameters": { + "id": { + "type": "string", + "description": "Floodlight activity Group ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "response": { + "$ref": "FloodlightActivityGroup" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "insert": { + "id": "dfareporting.floodlightActivityGroups.insert", + "path": "userprofiles/{profileId}/floodlightActivityGroups", + "httpMethod": "POST", + "description": "Inserts a new floodlight activity group.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "FloodlightActivityGroup" + }, + "response": { + "$ref": "FloodlightActivityGroup" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.floodlightActivityGroups.list", + "path": "userprofiles/{profileId}/floodlightActivityGroups", + "httpMethod": "GET", + "description": "Retrieves a list of floodlight activity groups, possibly filtered. This method supports paging.", + "parameters": { + "advertiserId": { + "type": "string", + "description": "Select only floodlight activity groups with the specified advertiser ID. Must specify either advertiserId or floodlightConfigurationId for a non-empty result.", + "format": "int64", + "location": "query" + }, + "floodlightConfigurationId": { + "type": "string", + "description": "Select only floodlight activity groups with the specified floodlight configuration ID. Must specify either advertiserId, or floodlightConfigurationId for a non-empty result.", + "format": "int64", + "location": "query" + }, + "ids": { + "type": "string", + "description": "Select only floodlight activity groups with the specified IDs. Must specify either advertiserId or floodlightConfigurationId for a non-empty result.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "maxResults": { + "type": "integer", + "description": "Maximum number of results to return.", + "format": "int32", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "Value of the nextPageToken from the previous result page.", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + }, + "searchString": { + "type": "string", + "description": "Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, \"floodlightactivitygroup*2015\" will return objects with names like \"floodlightactivitygroup June 2015\", \"floodlightactivitygroup April 2015\", or simply \"floodlightactivitygroup 2015\". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of \"floodlightactivitygroup\" will match objects with name \"my floodlightactivitygroup activity\", \"floodlightactivitygroup 2015\", or simply \"floodlightactivitygroup\".", + "location": "query" + }, + "sortField": { + "type": "string", + "description": "Field by which to sort the list.", + "enum": [ + "ID", + "NAME" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + }, + "sortOrder": { + "type": "string", + "description": "Order of sorted results, default is ASCENDING.", + "enum": [ + "ASCENDING", + "DESCENDING" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + }, + "type": { + "type": "string", + "description": "Select only floodlight activity groups with the specified floodlight activity group type.", + "enum": [ + "COUNTER", + "SALE" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "FloodlightActivityGroupsListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "patch": { + "id": "dfareporting.floodlightActivityGroups.patch", + "path": "userprofiles/{profileId}/floodlightActivityGroups", + "httpMethod": "PATCH", + "description": "Updates an existing floodlight activity group. This method supports patch semantics.", + "parameters": { + "id": { + "type": "string", + "description": "Floodlight activity Group ID.", + "required": true, + "format": "int64", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "request": { + "$ref": "FloodlightActivityGroup" + }, + "response": { + "$ref": "FloodlightActivityGroup" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "update": { + "id": "dfareporting.floodlightActivityGroups.update", + "path": "userprofiles/{profileId}/floodlightActivityGroups", + "httpMethod": "PUT", + "description": "Updates an existing floodlight activity group.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "FloodlightActivityGroup" + }, + "response": { + "$ref": "FloodlightActivityGroup" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "floodlightConfigurations": { + "methods": { + "get": { + "id": "dfareporting.floodlightConfigurations.get", + "path": "userprofiles/{profileId}/floodlightConfigurations/{id}", + "httpMethod": "GET", + "description": "Gets one floodlight configuration by ID.", + "parameters": { + "id": { + "type": "string", + "description": "Floodlight configuration ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "response": { + "$ref": "FloodlightConfiguration" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.floodlightConfigurations.list", + "path": "userprofiles/{profileId}/floodlightConfigurations", + "httpMethod": "GET", + "description": "Retrieves a list of floodlight configurations, possibly filtered.", + "parameters": { + "ids": { + "type": "string", + "description": "Set of IDs of floodlight configurations to retrieve. Required field; otherwise an empty list will be returned.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "FloodlightConfigurationsListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "patch": { + "id": "dfareporting.floodlightConfigurations.patch", + "path": "userprofiles/{profileId}/floodlightConfigurations", + "httpMethod": "PATCH", + "description": "Updates an existing floodlight configuration. This method supports patch semantics.", + "parameters": { + "id": { + "type": "string", + "description": "Floodlight configuration ID.", + "required": true, + "format": "int64", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "request": { + "$ref": "FloodlightConfiguration" + }, + "response": { + "$ref": "FloodlightConfiguration" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "update": { + "id": "dfareporting.floodlightConfigurations.update", + "path": "userprofiles/{profileId}/floodlightConfigurations", + "httpMethod": "PUT", + "description": "Updates an existing floodlight configuration.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "FloodlightConfiguration" + }, + "response": { + "$ref": "FloodlightConfiguration" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "inventoryItems": { + "methods": { + "get": { + "id": "dfareporting.inventoryItems.get", + "path": "userprofiles/{profileId}/projects/{projectId}/inventoryItems/{id}", + "httpMethod": "GET", + "description": "Gets one inventory item by ID.", + "parameters": { + "id": { + "type": "string", + "description": "Inventory item ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + }, + "projectId": { + "type": "string", + "description": "Project ID for order documents.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "projectId", + "id" + ], + "response": { + "$ref": "InventoryItem" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.inventoryItems.list", + "path": "userprofiles/{profileId}/projects/{projectId}/inventoryItems", + "httpMethod": "GET", + "description": "Retrieves a list of inventory items, possibly filtered. This method supports paging.", + "parameters": { + "ids": { + "type": "string", + "description": "Select only inventory items with these IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "inPlan": { + "type": "boolean", + "description": "Select only inventory items that are in plan.", + "location": "query" + }, + "maxResults": { + "type": "integer", + "description": "Maximum number of results to return.", + "format": "int32", + "location": "query" + }, + "orderId": { + "type": "string", + "description": "Select only inventory items that belong to specified orders.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "Value of the nextPageToken from the previous result page.", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + }, + "projectId": { + "type": "string", + "description": "Project ID for order documents.", + "required": true, + "format": "int64", + "location": "path" + }, + "siteId": { + "type": "string", + "description": "Select only inventory items that are associated with these sites.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "sortField": { + "type": "string", + "description": "Field by which to sort the list.", + "enum": [ + "ID", + "NAME" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + }, + "sortOrder": { + "type": "string", + "description": "Order of sorted results, default is ASCENDING.", + "enum": [ + "ASCENDING", + "DESCENDING" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + }, + "type": { + "type": "string", + "description": "Select only inventory items with this type.", + "enum": [ + "PLANNING_PLACEMENT_TYPE_CREDIT", + "PLANNING_PLACEMENT_TYPE_REGULAR" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + } + }, + "parameterOrder": [ + "profileId", + "projectId" + ], + "response": { + "$ref": "InventoryItemsListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "landingPages": { + "methods": { + "delete": { + "id": "dfareporting.landingPages.delete", + "path": "userprofiles/{profileId}/campaigns/{campaignId}/landingPages/{id}", + "httpMethod": "DELETE", + "description": "Deletes an existing campaign landing page.", + "parameters": { + "campaignId": { + "type": "string", + "description": "Landing page campaign ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "id": { + "type": "string", + "description": "Landing page ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "campaignId", + "id" + ], + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "get": { + "id": "dfareporting.landingPages.get", + "path": "userprofiles/{profileId}/campaigns/{campaignId}/landingPages/{id}", + "httpMethod": "GET", + "description": "Gets one campaign landing page by ID.", + "parameters": { + "campaignId": { + "type": "string", + "description": "Landing page campaign ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "id": { + "type": "string", + "description": "Landing page ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "campaignId", + "id" + ], + "response": { + "$ref": "LandingPage" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "insert": { + "id": "dfareporting.landingPages.insert", + "path": "userprofiles/{profileId}/campaigns/{campaignId}/landingPages", + "httpMethod": "POST", + "description": "Inserts a new landing page for the specified campaign.", + "parameters": { + "campaignId": { + "type": "string", + "description": "Landing page campaign ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "campaignId" + ], + "request": { + "$ref": "LandingPage" + }, + "response": { + "$ref": "LandingPage" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.landingPages.list", + "path": "userprofiles/{profileId}/campaigns/{campaignId}/landingPages", + "httpMethod": "GET", + "description": "Retrieves the list of landing pages for the specified campaign.", + "parameters": { + "campaignId": { + "type": "string", + "description": "Landing page campaign ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "campaignId" + ], + "response": { + "$ref": "LandingPagesListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "patch": { + "id": "dfareporting.landingPages.patch", + "path": "userprofiles/{profileId}/campaigns/{campaignId}/landingPages", + "httpMethod": "PATCH", + "description": "Updates an existing campaign landing page. This method supports patch semantics.", + "parameters": { + "campaignId": { + "type": "string", + "description": "Landing page campaign ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "id": { + "type": "string", + "description": "Landing page ID.", + "required": true, + "format": "int64", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "campaignId", + "id" + ], + "request": { + "$ref": "LandingPage" + }, + "response": { + "$ref": "LandingPage" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "update": { + "id": "dfareporting.landingPages.update", + "path": "userprofiles/{profileId}/campaigns/{campaignId}/landingPages", + "httpMethod": "PUT", + "description": "Updates an existing campaign landing page.", + "parameters": { + "campaignId": { + "type": "string", + "description": "Landing page campaign ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "campaignId" + ], + "request": { + "$ref": "LandingPage" + }, + "response": { + "$ref": "LandingPage" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "languages": { + "methods": { + "list": { + "id": "dfareporting.languages.list", + "path": "userprofiles/{profileId}/languages", + "httpMethod": "GET", + "description": "Retrieves a list of languages.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "LanguagesListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "metros": { + "methods": { + "list": { + "id": "dfareporting.metros.list", + "path": "userprofiles/{profileId}/metros", + "httpMethod": "GET", + "description": "Retrieves a list of metros.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "MetrosListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "mobileCarriers": { + "methods": { + "get": { + "id": "dfareporting.mobileCarriers.get", + "path": "userprofiles/{profileId}/mobileCarriers/{id}", + "httpMethod": "GET", + "description": "Gets one mobile carrier by ID.", + "parameters": { + "id": { + "type": "string", + "description": "Mobile carrier ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "response": { + "$ref": "MobileCarrier" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.mobileCarriers.list", + "path": "userprofiles/{profileId}/mobileCarriers", + "httpMethod": "GET", + "description": "Retrieves a list of mobile carriers.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "MobileCarriersListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "operatingSystemVersions": { + "methods": { + "get": { + "id": "dfareporting.operatingSystemVersions.get", + "path": "userprofiles/{profileId}/operatingSystemVersions/{id}", + "httpMethod": "GET", + "description": "Gets one operating system version by ID.", + "parameters": { + "id": { + "type": "string", + "description": "Operating system version ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "response": { + "$ref": "OperatingSystemVersion" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.operatingSystemVersions.list", + "path": "userprofiles/{profileId}/operatingSystemVersions", + "httpMethod": "GET", + "description": "Retrieves a list of operating system versions.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "OperatingSystemVersionsListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "operatingSystems": { + "methods": { + "get": { + "id": "dfareporting.operatingSystems.get", + "path": "userprofiles/{profileId}/operatingSystems/{dartId}", + "httpMethod": "GET", + "description": "Gets one operating system by DART ID.", + "parameters": { + "dartId": { + "type": "string", + "description": "Operating system DART ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "dartId" + ], + "response": { + "$ref": "OperatingSystem" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.operatingSystems.list", + "path": "userprofiles/{profileId}/operatingSystems", + "httpMethod": "GET", + "description": "Retrieves a list of operating systems.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "OperatingSystemsListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "orderDocuments": { + "methods": { + "get": { + "id": "dfareporting.orderDocuments.get", + "path": "userprofiles/{profileId}/projects/{projectId}/orderDocuments/{id}", + "httpMethod": "GET", + "description": "Gets one order document by ID.", + "parameters": { + "id": { + "type": "string", + "description": "Order document ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + }, + "projectId": { + "type": "string", + "description": "Project ID for order documents.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "projectId", + "id" + ], + "response": { + "$ref": "OrderDocument" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.orderDocuments.list", + "path": "userprofiles/{profileId}/projects/{projectId}/orderDocuments", + "httpMethod": "GET", + "description": "Retrieves a list of order documents, possibly filtered. This method supports paging.", + "parameters": { + "approved": { + "type": "boolean", + "description": "Select only order documents that have been approved by at least one user.", + "location": "query" + }, + "ids": { + "type": "string", + "description": "Select only order documents with these IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "maxResults": { + "type": "integer", + "description": "Maximum number of results to return.", + "format": "int32", + "location": "query" + }, + "orderId": { + "type": "string", + "description": "Select only order documents for specified orders.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "Value of the nextPageToken from the previous result page.", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + }, + "projectId": { + "type": "string", + "description": "Project ID for order documents.", + "required": true, + "format": "int64", + "location": "path" + }, + "searchString": { + "type": "string", + "description": "Allows searching for order documents by name or ID. Wildcards (*) are allowed. For example, \"orderdocument*2015\" will return order documents with names like \"orderdocument June 2015\", \"orderdocument April 2015\", or simply \"orderdocument 2015\". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of \"orderdocument\" will match order documents with name \"my orderdocument\", \"orderdocument 2015\", or simply \"orderdocument\".", + "location": "query" + }, + "siteId": { + "type": "string", + "description": "Select only order documents that are associated with these sites.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "sortField": { + "type": "string", + "description": "Field by which to sort the list.", + "enum": [ + "ID", + "NAME" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + }, + "sortOrder": { + "type": "string", + "description": "Order of sorted results, default is ASCENDING.", + "enum": [ + "ASCENDING", + "DESCENDING" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + } + }, + "parameterOrder": [ + "profileId", + "projectId" + ], + "response": { + "$ref": "OrderDocumentsListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "orders": { + "methods": { + "get": { + "id": "dfareporting.orders.get", + "path": "userprofiles/{profileId}/projects/{projectId}/orders/{id}", + "httpMethod": "GET", + "description": "Gets one order by ID.", + "parameters": { + "id": { + "type": "string", + "description": "Order ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + }, + "projectId": { + "type": "string", + "description": "Project ID for orders.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "projectId", + "id" + ], + "response": { + "$ref": "Order" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.orders.list", + "path": "userprofiles/{profileId}/projects/{projectId}/orders", + "httpMethod": "GET", + "description": "Retrieves a list of orders, possibly filtered. This method supports paging.", + "parameters": { + "ids": { + "type": "string", + "description": "Select only orders with these IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "maxResults": { + "type": "integer", + "description": "Maximum number of results to return.", + "format": "int32", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "Value of the nextPageToken from the previous result page.", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + }, + "projectId": { + "type": "string", + "description": "Project ID for orders.", + "required": true, + "format": "int64", + "location": "path" + }, + "searchString": { + "type": "string", + "description": "Allows searching for orders by name or ID. Wildcards (*) are allowed. For example, \"order*2015\" will return orders with names like \"order June 2015\", \"order April 2015\", or simply \"order 2015\". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of \"order\" will match orders with name \"my order\", \"order 2015\", or simply \"order\".", + "location": "query" + }, + "siteId": { + "type": "string", + "description": "Select only orders that are associated with these site IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "sortField": { + "type": "string", + "description": "Field by which to sort the list.", + "enum": [ + "ID", + "NAME" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + }, + "sortOrder": { + "type": "string", + "description": "Order of sorted results, default is ASCENDING.", + "enum": [ + "ASCENDING", + "DESCENDING" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + } + }, + "parameterOrder": [ + "profileId", + "projectId" + ], + "response": { + "$ref": "OrdersListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "placementGroups": { + "methods": { + "get": { + "id": "dfareporting.placementGroups.get", + "path": "userprofiles/{profileId}/placementGroups/{id}", + "httpMethod": "GET", + "description": "Gets one placement group by ID.", + "parameters": { + "id": { + "type": "string", + "description": "Placement group ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "response": { + "$ref": "PlacementGroup" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "insert": { + "id": "dfareporting.placementGroups.insert", + "path": "userprofiles/{profileId}/placementGroups", + "httpMethod": "POST", + "description": "Inserts a new placement group.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "PlacementGroup" + }, + "response": { + "$ref": "PlacementGroup" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.placementGroups.list", + "path": "userprofiles/{profileId}/placementGroups", + "httpMethod": "GET", + "description": "Retrieves a list of placement groups, possibly filtered. This method supports paging.", + "parameters": { + "advertiserIds": { + "type": "string", + "description": "Select only placement groups that belong to these advertisers.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "archived": { + "type": "boolean", + "description": "Select only archived placements. Don't set this field to select both archived and non-archived placements.", + "location": "query" + }, + "campaignIds": { + "type": "string", + "description": "Select only placement groups that belong to these campaigns.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "contentCategoryIds": { + "type": "string", + "description": "Select only placement groups that are associated with these content categories.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "directorySiteIds": { + "type": "string", + "description": "Select only placement groups that are associated with these directory sites.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "ids": { + "type": "string", + "description": "Select only placement groups with these IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "maxEndDate": { + "type": "string", + "description": "Select only placements or placement groups whose end date is on or before the specified maxEndDate. The date should be formatted as \"yyyy-MM-dd\".", + "location": "query" + }, + "maxResults": { + "type": "integer", + "description": "Maximum number of results to return.", + "format": "int32", + "location": "query" + }, + "maxStartDate": { + "type": "string", + "description": "Select only placements or placement groups whose start date is on or before the specified maxStartDate. The date should be formatted as \"yyyy-MM-dd\".", + "location": "query" + }, + "minEndDate": { + "type": "string", + "description": "Select only placements or placement groups whose end date is on or after the specified minEndDate. The date should be formatted as \"yyyy-MM-dd\".", + "location": "query" + }, + "minStartDate": { + "type": "string", + "description": "Select only placements or placement groups whose start date is on or after the specified minStartDate. The date should be formatted as \"yyyy-MM-dd\".", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "Value of the nextPageToken from the previous result page.", + "location": "query" + }, + "placementGroupType": { + "type": "string", + "description": "Select only placement groups belonging with this group type. A package is a simple group of placements that acts as a single pricing point for a group of tags. A roadblock is a group of placements that not only acts as a single pricing point but also assumes that all the tags in it will be served at the same time. A roadblock requires one of its assigned placements to be marked as primary for reporting.", + "enum": [ + "PLACEMENT_PACKAGE", + "PLACEMENT_ROADBLOCK" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + }, + "placementStrategyIds": { + "type": "string", + "description": "Select only placement groups that are associated with these placement strategies.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "pricingTypes": { + "type": "string", + "description": "Select only placement groups with these pricing types.", + "enum": [ + "PRICING_TYPE_CPA", + "PRICING_TYPE_CPC", + "PRICING_TYPE_CPM", + "PRICING_TYPE_CPM_ACTIVEVIEW", + "PRICING_TYPE_FLAT_RATE_CLICKS", + "PRICING_TYPE_FLAT_RATE_IMPRESSIONS" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "", + "" + ], + "repeated": true, + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + }, + "searchString": { + "type": "string", + "description": "Allows searching for placement groups by name or ID. Wildcards (*) are allowed. For example, \"placement*2015\" will return placement groups with names like \"placement group June 2015\", \"placement group May 2015\", or simply \"placements 2015\". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of \"placementgroup\" will match placement groups with name \"my placementgroup\", \"placementgroup 2015\", or simply \"placementgroup\".", + "location": "query" + }, + "siteIds": { + "type": "string", + "description": "Select only placement groups that are associated with these sites.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "sortField": { + "type": "string", + "description": "Field by which to sort the list.", + "enum": [ + "ID", + "NAME" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + }, + "sortOrder": { + "type": "string", + "description": "Order of sorted results, default is ASCENDING.", + "enum": [ + "ASCENDING", + "DESCENDING" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "PlacementGroupsListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "patch": { + "id": "dfareporting.placementGroups.patch", + "path": "userprofiles/{profileId}/placementGroups", + "httpMethod": "PATCH", + "description": "Updates an existing placement group. This method supports patch semantics.", + "parameters": { + "id": { + "type": "string", + "description": "Placement group ID.", + "required": true, + "format": "int64", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "request": { + "$ref": "PlacementGroup" + }, + "response": { + "$ref": "PlacementGroup" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "update": { + "id": "dfareporting.placementGroups.update", + "path": "userprofiles/{profileId}/placementGroups", + "httpMethod": "PUT", + "description": "Updates an existing placement group.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "PlacementGroup" + }, + "response": { + "$ref": "PlacementGroup" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "placementStrategies": { + "methods": { + "delete": { + "id": "dfareporting.placementStrategies.delete", + "path": "userprofiles/{profileId}/placementStrategies/{id}", + "httpMethod": "DELETE", + "description": "Deletes an existing placement strategy.", + "parameters": { + "id": { + "type": "string", + "description": "Placement strategy ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "get": { + "id": "dfareporting.placementStrategies.get", + "path": "userprofiles/{profileId}/placementStrategies/{id}", + "httpMethod": "GET", + "description": "Gets one placement strategy by ID.", + "parameters": { + "id": { + "type": "string", + "description": "Placement strategy ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "response": { + "$ref": "PlacementStrategy" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "insert": { + "id": "dfareporting.placementStrategies.insert", + "path": "userprofiles/{profileId}/placementStrategies", + "httpMethod": "POST", + "description": "Inserts a new placement strategy.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "PlacementStrategy" + }, + "response": { + "$ref": "PlacementStrategy" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.placementStrategies.list", + "path": "userprofiles/{profileId}/placementStrategies", + "httpMethod": "GET", + "description": "Retrieves a list of placement strategies, possibly filtered. This method supports paging.", + "parameters": { + "ids": { + "type": "string", + "description": "Select only placement strategies with these IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "maxResults": { + "type": "integer", + "description": "Maximum number of results to return.", + "format": "int32", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "Value of the nextPageToken from the previous result page.", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + }, + "searchString": { + "type": "string", + "description": "Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, \"placementstrategy*2015\" will return objects with names like \"placementstrategy June 2015\", \"placementstrategy April 2015\", or simply \"placementstrategy 2015\". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of \"placementstrategy\" will match objects with name \"my placementstrategy\", \"placementstrategy 2015\", or simply \"placementstrategy\".", + "location": "query" + }, + "sortField": { + "type": "string", + "description": "Field by which to sort the list.", + "enum": [ + "ID", + "NAME" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + }, + "sortOrder": { + "type": "string", + "description": "Order of sorted results, default is ASCENDING.", + "enum": [ + "ASCENDING", + "DESCENDING" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "PlacementStrategiesListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "patch": { + "id": "dfareporting.placementStrategies.patch", + "path": "userprofiles/{profileId}/placementStrategies", + "httpMethod": "PATCH", + "description": "Updates an existing placement strategy. This method supports patch semantics.", + "parameters": { + "id": { + "type": "string", + "description": "Placement strategy ID.", + "required": true, + "format": "int64", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "request": { + "$ref": "PlacementStrategy" + }, + "response": { + "$ref": "PlacementStrategy" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "update": { + "id": "dfareporting.placementStrategies.update", + "path": "userprofiles/{profileId}/placementStrategies", + "httpMethod": "PUT", + "description": "Updates an existing placement strategy.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "PlacementStrategy" + }, + "response": { + "$ref": "PlacementStrategy" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "placements": { + "methods": { + "generatetags": { + "id": "dfareporting.placements.generatetags", + "path": "userprofiles/{profileId}/placements/generatetags", + "httpMethod": "POST", + "description": "Generates tags for a placement.", + "parameters": { + "campaignId": { + "type": "string", + "description": "Generate placements belonging to this campaign. This is a required field.", + "format": "int64", + "location": "query" + }, + "placementIds": { + "type": "string", + "description": "Generate tags for these placements.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + }, + "tagFormats": { + "type": "string", + "description": "Tag formats to generate for these placements.", + "enum": [ + "PLACEMENT_TAG_CLICK_COMMANDS", + "PLACEMENT_TAG_IFRAME_ILAYER", + "PLACEMENT_TAG_IFRAME_JAVASCRIPT", + "PLACEMENT_TAG_IFRAME_JAVASCRIPT_LEGACY", + "PLACEMENT_TAG_INSTREAM_VIDEO_PREFETCH", + "PLACEMENT_TAG_INSTREAM_VIDEO_PREFETCH_VAST_3", + "PLACEMENT_TAG_INTERNAL_REDIRECT", + "PLACEMENT_TAG_INTERSTITIAL_IFRAME_JAVASCRIPT", + "PLACEMENT_TAG_INTERSTITIAL_IFRAME_JAVASCRIPT_LEGACY", + "PLACEMENT_TAG_INTERSTITIAL_INTERNAL_REDIRECT", + "PLACEMENT_TAG_INTERSTITIAL_JAVASCRIPT", + "PLACEMENT_TAG_INTERSTITIAL_JAVASCRIPT_LEGACY", + "PLACEMENT_TAG_JAVASCRIPT", + "PLACEMENT_TAG_JAVASCRIPT_LEGACY", + "PLACEMENT_TAG_STANDARD", + "PLACEMENT_TAG_TRACKING", + "PLACEMENT_TAG_TRACKING_IFRAME", + "PLACEMENT_TAG_TRACKING_JAVASCRIPT" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "repeated": true, + "location": "query" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "PlacementsGenerateTagsResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "get": { + "id": "dfareporting.placements.get", + "path": "userprofiles/{profileId}/placements/{id}", + "httpMethod": "GET", + "description": "Gets one placement by ID.", + "parameters": { + "id": { + "type": "string", + "description": "Placement ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "response": { + "$ref": "Placement" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "insert": { + "id": "dfareporting.placements.insert", + "path": "userprofiles/{profileId}/placements", + "httpMethod": "POST", + "description": "Inserts a new placement.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "Placement" + }, + "response": { + "$ref": "Placement" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.placements.list", + "path": "userprofiles/{profileId}/placements", + "httpMethod": "GET", + "description": "Retrieves a list of placements, possibly filtered. This method supports paging.", + "parameters": { + "advertiserIds": { + "type": "string", + "description": "Select only placements that belong to these advertisers.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "archived": { + "type": "boolean", + "description": "Select only archived placements. Don't set this field to select both archived and non-archived placements.", + "location": "query" + }, + "campaignIds": { + "type": "string", + "description": "Select only placements that belong to these campaigns.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "compatibilities": { + "type": "string", + "description": "Select only placements that are associated with these compatibilities. DISPLAY and DISPLAY_INTERSTITIAL refer to rendering either on desktop or on mobile devices for regular or interstitial ads respectively. APP and APP_INTERSTITIAL are for rendering in mobile apps. IN_STREAM_VIDEO refers to rendering in in-stream video ads developed with the VAST standard.", + "enum": [ + "APP", + "APP_INTERSTITIAL", + "DISPLAY", + "DISPLAY_INTERSTITIAL", + "IN_STREAM_VIDEO" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "" + ], + "repeated": true, + "location": "query" + }, + "contentCategoryIds": { + "type": "string", + "description": "Select only placements that are associated with these content categories.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "directorySiteIds": { + "type": "string", + "description": "Select only placements that are associated with these directory sites.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "groupIds": { + "type": "string", + "description": "Select only placements that belong to these placement groups.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "ids": { + "type": "string", + "description": "Select only placements with these IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "maxEndDate": { + "type": "string", + "description": "Select only placements or placement groups whose end date is on or before the specified maxEndDate. The date should be formatted as \"yyyy-MM-dd\".", + "location": "query" + }, + "maxResults": { + "type": "integer", + "description": "Maximum number of results to return.", + "format": "int32", + "location": "query" + }, + "maxStartDate": { + "type": "string", + "description": "Select only placements or placement groups whose start date is on or before the specified maxStartDate. The date should be formatted as \"yyyy-MM-dd\".", + "location": "query" + }, + "minEndDate": { + "type": "string", + "description": "Select only placements or placement groups whose end date is on or after the specified minEndDate. The date should be formatted as \"yyyy-MM-dd\".", + "location": "query" + }, + "minStartDate": { + "type": "string", + "description": "Select only placements or placement groups whose start date is on or after the specified minStartDate. The date should be formatted as \"yyyy-MM-dd\".", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "Value of the nextPageToken from the previous result page.", + "location": "query" + }, + "paymentSource": { + "type": "string", + "description": "Select only placements with this payment source.", + "enum": [ + "PLACEMENT_AGENCY_PAID", + "PLACEMENT_PUBLISHER_PAID" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + }, + "placementStrategyIds": { + "type": "string", + "description": "Select only placements that are associated with these placement strategies.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "pricingTypes": { + "type": "string", + "description": "Select only placements with these pricing types.", + "enum": [ + "PRICING_TYPE_CPA", + "PRICING_TYPE_CPC", + "PRICING_TYPE_CPM", + "PRICING_TYPE_CPM_ACTIVEVIEW", + "PRICING_TYPE_FLAT_RATE_CLICKS", + "PRICING_TYPE_FLAT_RATE_IMPRESSIONS" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "", + "" + ], + "repeated": true, + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + }, + "searchString": { + "type": "string", + "description": "Allows searching for placements by name or ID. Wildcards (*) are allowed. For example, \"placement*2015\" will return placements with names like \"placement June 2015\", \"placement May 2015\", or simply \"placements 2015\". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of \"placement\" will match placements with name \"my placement\", \"placement 2015\", or simply \"placement\".", + "location": "query" + }, + "siteIds": { + "type": "string", + "description": "Select only placements that are associated with these sites.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "sizeIds": { + "type": "string", + "description": "Select only placements that are associated with these sizes.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "sortField": { + "type": "string", + "description": "Field by which to sort the list.", + "enum": [ + "ID", + "NAME" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + }, + "sortOrder": { + "type": "string", + "description": "Order of sorted results, default is ASCENDING.", + "enum": [ + "ASCENDING", + "DESCENDING" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "PlacementsListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "patch": { + "id": "dfareporting.placements.patch", + "path": "userprofiles/{profileId}/placements", + "httpMethod": "PATCH", + "description": "Updates an existing placement. This method supports patch semantics.", + "parameters": { + "id": { + "type": "string", + "description": "Placement ID.", + "required": true, + "format": "int64", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "request": { + "$ref": "Placement" + }, + "response": { + "$ref": "Placement" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "update": { + "id": "dfareporting.placements.update", + "path": "userprofiles/{profileId}/placements", + "httpMethod": "PUT", + "description": "Updates an existing placement.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "Placement" + }, + "response": { + "$ref": "Placement" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "platformTypes": { + "methods": { + "get": { + "id": "dfareporting.platformTypes.get", + "path": "userprofiles/{profileId}/platformTypes/{id}", + "httpMethod": "GET", + "description": "Gets one platform type by ID.", + "parameters": { + "id": { + "type": "string", + "description": "Platform type ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "response": { + "$ref": "PlatformType" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.platformTypes.list", + "path": "userprofiles/{profileId}/platformTypes", + "httpMethod": "GET", + "description": "Retrieves a list of platform types.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "PlatformTypesListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "postalCodes": { + "methods": { + "get": { + "id": "dfareporting.postalCodes.get", + "path": "userprofiles/{profileId}/postalCodes/{code}", + "httpMethod": "GET", + "description": "Gets one postal code by ID.", + "parameters": { + "code": { + "type": "string", + "description": "Postal code ID.", + "required": true, + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "code" + ], + "response": { + "$ref": "PostalCode" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.postalCodes.list", + "path": "userprofiles/{profileId}/postalCodes", + "httpMethod": "GET", + "description": "Retrieves a list of postal codes.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "PostalCodesListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "projects": { + "methods": { + "get": { + "id": "dfareporting.projects.get", + "path": "userprofiles/{profileId}/projects/{id}", + "httpMethod": "GET", + "description": "Gets one project by ID.", + "parameters": { + "id": { + "type": "string", + "description": "Project ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "response": { + "$ref": "Project" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.projects.list", + "path": "userprofiles/{profileId}/projects", + "httpMethod": "GET", + "description": "Retrieves a list of projects, possibly filtered. This method supports paging.", + "parameters": { + "advertiserIds": { + "type": "string", + "description": "Select only projects with these advertiser IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "ids": { + "type": "string", + "description": "Select only projects with these IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "maxResults": { + "type": "integer", + "description": "Maximum number of results to return.", + "format": "int32", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "Value of the nextPageToken from the previous result page.", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + }, + "searchString": { + "type": "string", + "description": "Allows searching for projects by name or ID. Wildcards (*) are allowed. For example, \"project*2015\" will return projects with names like \"project June 2015\", \"project April 2015\", or simply \"project 2015\". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of \"project\" will match projects with name \"my project\", \"project 2015\", or simply \"project\".", + "location": "query" + }, + "sortField": { + "type": "string", + "description": "Field by which to sort the list.", + "enum": [ + "ID", + "NAME" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + }, + "sortOrder": { + "type": "string", + "description": "Order of sorted results, default is ASCENDING.", + "enum": [ + "ASCENDING", + "DESCENDING" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "ProjectsListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "regions": { + "methods": { + "list": { + "id": "dfareporting.regions.list", + "path": "userprofiles/{profileId}/regions", + "httpMethod": "GET", + "description": "Retrieves a list of regions.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "RegionsListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "remarketingListShares": { + "methods": { + "get": { + "id": "dfareporting.remarketingListShares.get", + "path": "userprofiles/{profileId}/remarketingListShares/{remarketingListId}", + "httpMethod": "GET", + "description": "Gets one remarketing list share by remarketing list ID.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + }, + "remarketingListId": { + "type": "string", + "description": "Remarketing list ID.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "remarketingListId" + ], + "response": { + "$ref": "RemarketingListShare" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "patch": { + "id": "dfareporting.remarketingListShares.patch", + "path": "userprofiles/{profileId}/remarketingListShares", + "httpMethod": "PATCH", + "description": "Updates an existing remarketing list share. This method supports patch semantics.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + }, + "remarketingListId": { + "type": "string", + "description": "Remarketing list ID.", + "required": true, + "format": "int64", + "location": "query" + } + }, + "parameterOrder": [ + "profileId", + "remarketingListId" + ], + "request": { + "$ref": "RemarketingListShare" + }, + "response": { + "$ref": "RemarketingListShare" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "update": { + "id": "dfareporting.remarketingListShares.update", + "path": "userprofiles/{profileId}/remarketingListShares", + "httpMethod": "PUT", + "description": "Updates an existing remarketing list share.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "RemarketingListShare" + }, + "response": { + "$ref": "RemarketingListShare" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "remarketingLists": { + "methods": { + "get": { + "id": "dfareporting.remarketingLists.get", + "path": "userprofiles/{profileId}/remarketingLists/{id}", + "httpMethod": "GET", + "description": "Gets one remarketing list by ID.", + "parameters": { + "id": { + "type": "string", + "description": "Remarketing list ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "response": { + "$ref": "RemarketingList" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "insert": { + "id": "dfareporting.remarketingLists.insert", + "path": "userprofiles/{profileId}/remarketingLists", + "httpMethod": "POST", + "description": "Inserts a new remarketing list.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "RemarketingList" + }, + "response": { + "$ref": "RemarketingList" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.remarketingLists.list", + "path": "userprofiles/{profileId}/remarketingLists", + "httpMethod": "GET", + "description": "Retrieves a list of remarketing lists, possibly filtered. This method supports paging.", + "parameters": { + "active": { + "type": "boolean", + "description": "Select only active or only inactive remarketing lists.", + "location": "query" + }, + "advertiserId": { + "type": "string", + "description": "Select only remarketing lists owned by this advertiser.", + "required": true, + "format": "int64", + "location": "query" + }, + "floodlightActivityId": { + "type": "string", + "description": "Select only remarketing lists that have this floodlight activity ID.", + "format": "int64", + "location": "query" + }, + "maxResults": { + "type": "integer", + "description": "Maximum number of results to return.", + "format": "int32", + "location": "query" + }, + "name": { + "type": "string", + "description": "Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, \"remarketing list*2015\" will return objects with names like \"remarketing list June 2015\", \"remarketing list April 2015\", or simply \"remarketing list 2015\". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of \"remarketing list\" will match objects with name \"my remarketing list\", \"remarketing list 2015\", or simply \"remarketing list\".", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "Value of the nextPageToken from the previous result page.", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + }, + "sortField": { + "type": "string", + "description": "Field by which to sort the list.", + "enum": [ + "ID", + "NAME" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + }, + "sortOrder": { + "type": "string", + "description": "Order of sorted results, default is ASCENDING.", + "enum": [ + "ASCENDING", + "DESCENDING" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + } + }, + "parameterOrder": [ + "profileId", + "advertiserId" + ], + "response": { + "$ref": "RemarketingListsListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "patch": { + "id": "dfareporting.remarketingLists.patch", + "path": "userprofiles/{profileId}/remarketingLists", + "httpMethod": "PATCH", + "description": "Updates an existing remarketing list. This method supports patch semantics.", + "parameters": { + "id": { + "type": "string", + "description": "Remarketing list ID.", + "required": true, + "format": "int64", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "request": { + "$ref": "RemarketingList" + }, + "response": { + "$ref": "RemarketingList" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "update": { + "id": "dfareporting.remarketingLists.update", + "path": "userprofiles/{profileId}/remarketingLists", + "httpMethod": "PUT", + "description": "Updates an existing remarketing list.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "RemarketingList" + }, + "response": { + "$ref": "RemarketingList" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "reports": { + "methods": { + "delete": { + "id": "dfareporting.reports.delete", + "path": "userprofiles/{profileId}/reports/{reportId}", + "httpMethod": "DELETE", + "description": "Deletes a report by its ID.", + "parameters": { + "profileId": { + "type": "string", + "description": "The DFA user profile ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "reportId": { + "type": "string", + "description": "The ID of the report.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "reportId" + ], + "scopes": [ + "https://www.googleapis.com/auth/dfareporting" + ] + }, + "get": { + "id": "dfareporting.reports.get", + "path": "userprofiles/{profileId}/reports/{reportId}", + "httpMethod": "GET", + "description": "Retrieves a report by its ID.", + "parameters": { + "profileId": { + "type": "string", + "description": "The DFA user profile ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "reportId": { + "type": "string", + "description": "The ID of the report.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "reportId" + ], + "response": { + "$ref": "Report" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfareporting" + ] + }, + "insert": { + "id": "dfareporting.reports.insert", + "path": "userprofiles/{profileId}/reports", + "httpMethod": "POST", + "description": "Creates a report.", + "parameters": { + "profileId": { + "type": "string", + "description": "The DFA user profile ID.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "Report" + }, + "response": { + "$ref": "Report" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfareporting" + ] + }, + "list": { + "id": "dfareporting.reports.list", + "path": "userprofiles/{profileId}/reports", + "httpMethod": "GET", + "description": "Retrieves list of reports.", + "parameters": { + "maxResults": { + "type": "integer", + "description": "Maximum number of results to return.", + "format": "int32", + "minimum": "0", + "maximum": "10", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "The value of the nextToken from the previous result page.", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "The DFA user profile ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "scope": { + "type": "string", + "description": "The scope that defines which results are returned, default is 'MINE'.", + "default": "MINE", + "enum": [ + "ALL", + "MINE" + ], + "enumDescriptions": [ + "All reports in account.", + "My reports." + ], + "location": "query" + }, + "sortField": { + "type": "string", + "description": "The field by which to sort the list.", + "default": "LAST_MODIFIED_TIME", + "enum": [ + "ID", + "LAST_MODIFIED_TIME", + "NAME" + ], + "enumDescriptions": [ + "Sort by report ID.", + "Sort by 'lastModifiedTime' field.", + "Sort by name of reports." + ], + "location": "query" + }, + "sortOrder": { + "type": "string", + "description": "Order of sorted results, default is 'DESCENDING'.", + "default": "DESCENDING", + "enum": [ + "ASCENDING", + "DESCENDING" + ], + "enumDescriptions": [ + "Ascending order.", + "Descending order." + ], + "location": "query" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "ReportList" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfareporting" + ] + }, + "patch": { + "id": "dfareporting.reports.patch", + "path": "userprofiles/{profileId}/reports/{reportId}", + "httpMethod": "PATCH", + "description": "Updates a report. This method supports patch semantics.", + "parameters": { + "profileId": { + "type": "string", + "description": "The DFA user profile ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "reportId": { + "type": "string", + "description": "The ID of the report.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "reportId" + ], + "request": { + "$ref": "Report" + }, + "response": { + "$ref": "Report" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfareporting" + ] + }, + "run": { + "id": "dfareporting.reports.run", + "path": "userprofiles/{profileId}/reports/{reportId}/run", + "httpMethod": "POST", + "description": "Runs a report.", + "parameters": { + "profileId": { + "type": "string", + "description": "The DFA profile ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "reportId": { + "type": "string", + "description": "The ID of the report.", + "required": true, + "format": "int64", + "location": "path" + }, + "synchronous": { + "type": "boolean", + "description": "If set and true, tries to run the report synchronously.", + "location": "query" + } + }, + "parameterOrder": [ + "profileId", + "reportId" + ], + "response": { + "$ref": "File" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfareporting" + ] + }, + "update": { + "id": "dfareporting.reports.update", + "path": "userprofiles/{profileId}/reports/{reportId}", + "httpMethod": "PUT", + "description": "Updates a report.", + "parameters": { + "profileId": { + "type": "string", + "description": "The DFA user profile ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "reportId": { + "type": "string", + "description": "The ID of the report.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "reportId" + ], + "request": { + "$ref": "Report" + }, + "response": { + "$ref": "Report" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfareporting" + ] + } + }, + "resources": { + "compatibleFields": { + "methods": { + "query": { + "id": "dfareporting.reports.compatibleFields.query", + "path": "userprofiles/{profileId}/reports/compatiblefields/query", + "httpMethod": "POST", + "description": "Returns the fields that are compatible to be selected in the respective sections of a report criteria, given the fields already selected in the input report and user permissions.", + "parameters": { + "profileId": { + "type": "string", + "description": "The DFA user profile ID.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "Report" + }, + "response": { + "$ref": "CompatibleFields" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfareporting" + ] + } + } + }, + "files": { + "methods": { + "get": { + "id": "dfareporting.reports.files.get", + "path": "userprofiles/{profileId}/reports/{reportId}/files/{fileId}", + "httpMethod": "GET", + "description": "Retrieves a report file.", + "parameters": { + "fileId": { + "type": "string", + "description": "The ID of the report file.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "The DFA profile ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "reportId": { + "type": "string", + "description": "The ID of the report.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "reportId", + "fileId" + ], + "response": { + "$ref": "File" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfareporting" + ], + "supportsMediaDownload": true + }, + "list": { + "id": "dfareporting.reports.files.list", + "path": "userprofiles/{profileId}/reports/{reportId}/files", + "httpMethod": "GET", + "description": "Lists files for a report.", + "parameters": { + "maxResults": { + "type": "integer", + "description": "Maximum number of results to return.", + "format": "int32", + "minimum": "0", + "maximum": "10", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "The value of the nextToken from the previous result page.", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "The DFA profile ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "reportId": { + "type": "string", + "description": "The ID of the parent report.", + "required": true, + "format": "int64", + "location": "path" + }, + "sortField": { + "type": "string", + "description": "The field by which to sort the list.", + "default": "LAST_MODIFIED_TIME", + "enum": [ + "ID", + "LAST_MODIFIED_TIME" + ], + "enumDescriptions": [ + "Sort by file ID.", + "Sort by 'lastmodifiedAt' field." + ], + "location": "query" + }, + "sortOrder": { + "type": "string", + "description": "Order of sorted results, default is 'DESCENDING'.", + "default": "DESCENDING", + "enum": [ + "ASCENDING", + "DESCENDING" + ], + "enumDescriptions": [ + "Ascending order.", + "Descending order." + ], + "location": "query" + } + }, + "parameterOrder": [ + "profileId", + "reportId" + ], + "response": { + "$ref": "FileList" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfareporting" + ] + } + } + } + } + }, + "sites": { + "methods": { + "get": { + "id": "dfareporting.sites.get", + "path": "userprofiles/{profileId}/sites/{id}", + "httpMethod": "GET", + "description": "Gets one site by ID.", + "parameters": { + "id": { + "type": "string", + "description": "Site ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "response": { + "$ref": "Site" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "insert": { + "id": "dfareporting.sites.insert", + "path": "userprofiles/{profileId}/sites", + "httpMethod": "POST", + "description": "Inserts a new site.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "Site" + }, + "response": { + "$ref": "Site" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.sites.list", + "path": "userprofiles/{profileId}/sites", + "httpMethod": "GET", + "description": "Retrieves a list of sites, possibly filtered. This method supports paging.", + "parameters": { + "acceptsInStreamVideoPlacements": { + "type": "boolean", + "description": "This search filter is no longer supported and will have no effect on the results returned.", + "location": "query" + }, + "acceptsInterstitialPlacements": { + "type": "boolean", + "description": "This search filter is no longer supported and will have no effect on the results returned.", + "location": "query" + }, + "acceptsPublisherPaidPlacements": { + "type": "boolean", + "description": "Select only sites that accept publisher paid placements.", + "location": "query" + }, + "adWordsSite": { + "type": "boolean", + "description": "Select only AdWords sites.", + "location": "query" + }, + "approved": { + "type": "boolean", + "description": "Select only approved sites.", + "location": "query" + }, + "campaignIds": { + "type": "string", + "description": "Select only sites with these campaign IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "directorySiteIds": { + "type": "string", + "description": "Select only sites with these directory site IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "ids": { + "type": "string", + "description": "Select only sites with these IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "maxResults": { + "type": "integer", + "description": "Maximum number of results to return.", + "format": "int32", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "Value of the nextPageToken from the previous result page.", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + }, + "searchString": { + "type": "string", + "description": "Allows searching for objects by name, ID or keyName. Wildcards (*) are allowed. For example, \"site*2015\" will return objects with names like \"site June 2015\", \"site April 2015\", or simply \"site 2015\". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of \"site\" will match objects with name \"my site\", \"site 2015\", or simply \"site\".", + "location": "query" + }, + "sortField": { + "type": "string", + "description": "Field by which to sort the list.", + "enum": [ + "ID", + "NAME" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + }, + "sortOrder": { + "type": "string", + "description": "Order of sorted results, default is ASCENDING.", + "enum": [ + "ASCENDING", + "DESCENDING" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + }, + "subaccountId": { + "type": "string", + "description": "Select only sites with this subaccount ID.", + "format": "int64", + "location": "query" + }, + "unmappedSite": { + "type": "boolean", + "description": "Select only sites that have not been mapped to a directory site.", + "location": "query" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "SitesListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "patch": { + "id": "dfareporting.sites.patch", + "path": "userprofiles/{profileId}/sites", + "httpMethod": "PATCH", + "description": "Updates an existing site. This method supports patch semantics.", + "parameters": { + "id": { + "type": "string", + "description": "Site ID.", + "required": true, + "format": "int64", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "request": { + "$ref": "Site" + }, + "response": { + "$ref": "Site" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "update": { + "id": "dfareporting.sites.update", + "path": "userprofiles/{profileId}/sites", + "httpMethod": "PUT", + "description": "Updates an existing site.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "Site" + }, + "response": { + "$ref": "Site" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "sizes": { + "methods": { + "get": { + "id": "dfareporting.sizes.get", + "path": "userprofiles/{profileId}/sizes/{id}", + "httpMethod": "GET", + "description": "Gets one size by ID.", + "parameters": { + "id": { + "type": "string", + "description": "Size ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "response": { + "$ref": "Size" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "insert": { + "id": "dfareporting.sizes.insert", + "path": "userprofiles/{profileId}/sizes", + "httpMethod": "POST", + "description": "Inserts a new size.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "Size" + }, + "response": { + "$ref": "Size" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.sizes.list", + "path": "userprofiles/{profileId}/sizes", + "httpMethod": "GET", + "description": "Retrieves a list of sizes, possibly filtered.", + "parameters": { + "height": { + "type": "integer", + "description": "Select only sizes with this height.", + "format": "int32", + "location": "query" + }, + "iabStandard": { + "type": "boolean", + "description": "Select only IAB standard sizes.", + "location": "query" + }, + "ids": { + "type": "string", + "description": "Select only sizes with these IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + }, + "width": { + "type": "integer", + "description": "Select only sizes with this width.", + "format": "int32", + "location": "query" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "SizesListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "subaccounts": { + "methods": { + "get": { + "id": "dfareporting.subaccounts.get", + "path": "userprofiles/{profileId}/subaccounts/{id}", + "httpMethod": "GET", + "description": "Gets one subaccount by ID.", + "parameters": { + "id": { + "type": "string", + "description": "Subaccount ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "response": { + "$ref": "Subaccount" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "insert": { + "id": "dfareporting.subaccounts.insert", + "path": "userprofiles/{profileId}/subaccounts", + "httpMethod": "POST", + "description": "Inserts a new subaccount.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "Subaccount" + }, + "response": { + "$ref": "Subaccount" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.subaccounts.list", + "path": "userprofiles/{profileId}/subaccounts", + "httpMethod": "GET", + "description": "Gets a list of subaccounts, possibly filtered. This method supports paging.", + "parameters": { + "ids": { + "type": "string", + "description": "Select only subaccounts with these IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "maxResults": { + "type": "integer", + "description": "Maximum number of results to return.", + "format": "int32", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "Value of the nextPageToken from the previous result page.", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + }, + "searchString": { + "type": "string", + "description": "Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, \"subaccount*2015\" will return objects with names like \"subaccount June 2015\", \"subaccount April 2015\", or simply \"subaccount 2015\". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of \"subaccount\" will match objects with name \"my subaccount\", \"subaccount 2015\", or simply \"subaccount\".", + "location": "query" + }, + "sortField": { + "type": "string", + "description": "Field by which to sort the list.", + "enum": [ + "ID", + "NAME" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + }, + "sortOrder": { + "type": "string", + "description": "Order of sorted results, default is ASCENDING.", + "enum": [ + "ASCENDING", + "DESCENDING" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "SubaccountsListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "patch": { + "id": "dfareporting.subaccounts.patch", + "path": "userprofiles/{profileId}/subaccounts", + "httpMethod": "PATCH", + "description": "Updates an existing subaccount. This method supports patch semantics.", + "parameters": { + "id": { + "type": "string", + "description": "Subaccount ID.", + "required": true, + "format": "int64", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "request": { + "$ref": "Subaccount" + }, + "response": { + "$ref": "Subaccount" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "update": { + "id": "dfareporting.subaccounts.update", + "path": "userprofiles/{profileId}/subaccounts", + "httpMethod": "PUT", + "description": "Updates an existing subaccount.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "Subaccount" + }, + "response": { + "$ref": "Subaccount" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "targetableRemarketingLists": { + "methods": { + "get": { + "id": "dfareporting.targetableRemarketingLists.get", + "path": "userprofiles/{profileId}/targetableRemarketingLists/{id}", + "httpMethod": "GET", + "description": "Gets one remarketing list by ID.", + "parameters": { + "id": { + "type": "string", + "description": "Remarketing list ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "response": { + "$ref": "TargetableRemarketingList" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.targetableRemarketingLists.list", + "path": "userprofiles/{profileId}/targetableRemarketingLists", + "httpMethod": "GET", + "description": "Retrieves a list of targetable remarketing lists, possibly filtered. This method supports paging.", + "parameters": { + "active": { + "type": "boolean", + "description": "Select only active or only inactive targetable remarketing lists.", + "location": "query" + }, + "advertiserId": { + "type": "string", + "description": "Select only targetable remarketing lists targetable by these advertisers.", + "required": true, + "format": "int64", + "location": "query" + }, + "maxResults": { + "type": "integer", + "description": "Maximum number of results to return.", + "format": "int32", + "location": "query" + }, + "name": { + "type": "string", + "description": "Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, \"remarketing list*2015\" will return objects with names like \"remarketing list June 2015\", \"remarketing list April 2015\", or simply \"remarketing list 2015\". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of \"remarketing list\" will match objects with name \"my remarketing list\", \"remarketing list 2015\", or simply \"remarketing list\".", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "Value of the nextPageToken from the previous result page.", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + }, + "sortField": { + "type": "string", + "description": "Field by which to sort the list.", + "enum": [ + "ID", + "NAME" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + }, + "sortOrder": { + "type": "string", + "description": "Order of sorted results, default is ASCENDING.", + "enum": [ + "ASCENDING", + "DESCENDING" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + } + }, + "parameterOrder": [ + "profileId", + "advertiserId" + ], + "response": { + "$ref": "TargetableRemarketingListsListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "targetingTemplates": { + "methods": { + "get": { + "id": "dfareporting.targetingTemplates.get", + "path": "userprofiles/{profileId}/targetingTemplates/{id}", + "httpMethod": "GET", + "description": "Gets one targeting template by ID.", + "parameters": { + "id": { + "type": "string", + "description": "Targeting template ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "response": { + "$ref": "TargetingTemplate" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "insert": { + "id": "dfareporting.targetingTemplates.insert", + "path": "userprofiles/{profileId}/targetingTemplates", + "httpMethod": "POST", + "description": "Inserts a new targeting template.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "TargetingTemplate" + }, + "response": { + "$ref": "TargetingTemplate" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.targetingTemplates.list", + "path": "userprofiles/{profileId}/targetingTemplates", + "httpMethod": "GET", + "description": "Retrieves a list of targeting templates, optionally filtered. This method supports paging.", + "parameters": { + "advertiserId": { + "type": "string", + "description": "Select only targeting templates with this advertiser ID.", + "format": "int64", + "location": "query" + }, + "ids": { + "type": "string", + "description": "Select only targeting templates with these IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "maxResults": { + "type": "integer", + "description": "Maximum number of results to return.", + "format": "int32", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "Value of the nextPageToken from the previous result page.", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + }, + "searchString": { + "type": "string", + "description": "Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, \"template*2015\" will return objects with names like \"template June 2015\", \"template April 2015\", or simply \"template 2015\". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of \"template\" will match objects with name \"my template\", \"template 2015\", or simply \"template\".", + "location": "query" + }, + "sortField": { + "type": "string", + "description": "Field by which to sort the list.", + "enum": [ + "ID", + "NAME" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + }, + "sortOrder": { + "type": "string", + "description": "Order of sorted results, default is ASCENDING.", + "enum": [ + "ASCENDING", + "DESCENDING" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "TargetingTemplatesListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "patch": { + "id": "dfareporting.targetingTemplates.patch", + "path": "userprofiles/{profileId}/targetingTemplates", + "httpMethod": "PATCH", + "description": "Updates an existing targeting template. This method supports patch semantics.", + "parameters": { + "id": { + "type": "string", + "description": "Targeting template ID.", + "required": true, + "format": "int64", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "request": { + "$ref": "TargetingTemplate" + }, + "response": { + "$ref": "TargetingTemplate" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "update": { + "id": "dfareporting.targetingTemplates.update", + "path": "userprofiles/{profileId}/targetingTemplates", + "httpMethod": "PUT", + "description": "Updates an existing targeting template.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "TargetingTemplate" + }, + "response": { + "$ref": "TargetingTemplate" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "userProfiles": { + "methods": { + "get": { + "id": "dfareporting.userProfiles.get", + "path": "userprofiles/{profileId}", + "httpMethod": "GET", + "description": "Gets one user profile by ID.", + "parameters": { + "profileId": { + "type": "string", + "description": "The user profile ID.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "UserProfile" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfareporting", + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.userProfiles.list", + "path": "userprofiles", + "httpMethod": "GET", + "description": "Retrieves list of user profiles for a user.", + "response": { + "$ref": "UserProfileList" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfareporting", + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "userRolePermissionGroups": { + "methods": { + "get": { + "id": "dfareporting.userRolePermissionGroups.get", + "path": "userprofiles/{profileId}/userRolePermissionGroups/{id}", + "httpMethod": "GET", + "description": "Gets one user role permission group by ID.", + "parameters": { + "id": { + "type": "string", + "description": "User role permission group ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "response": { + "$ref": "UserRolePermissionGroup" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.userRolePermissionGroups.list", + "path": "userprofiles/{profileId}/userRolePermissionGroups", + "httpMethod": "GET", + "description": "Gets a list of all supported user role permission groups.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "UserRolePermissionGroupsListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "userRolePermissions": { + "methods": { + "get": { + "id": "dfareporting.userRolePermissions.get", + "path": "userprofiles/{profileId}/userRolePermissions/{id}", + "httpMethod": "GET", + "description": "Gets one user role permission by ID.", + "parameters": { + "id": { + "type": "string", + "description": "User role permission ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "response": { + "$ref": "UserRolePermission" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.userRolePermissions.list", + "path": "userprofiles/{profileId}/userRolePermissions", + "httpMethod": "GET", + "description": "Gets a list of user role permissions, possibly filtered.", + "parameters": { + "ids": { + "type": "string", + "description": "Select only user role permissions with these IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "UserRolePermissionsListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "userRoles": { + "methods": { + "delete": { + "id": "dfareporting.userRoles.delete", + "path": "userprofiles/{profileId}/userRoles/{id}", + "httpMethod": "DELETE", + "description": "Deletes an existing user role.", + "parameters": { + "id": { + "type": "string", + "description": "User role ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "get": { + "id": "dfareporting.userRoles.get", + "path": "userprofiles/{profileId}/userRoles/{id}", + "httpMethod": "GET", + "description": "Gets one user role by ID.", + "parameters": { + "id": { + "type": "string", + "description": "User role ID.", + "required": true, + "format": "int64", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "response": { + "$ref": "UserRole" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "insert": { + "id": "dfareporting.userRoles.insert", + "path": "userprofiles/{profileId}/userRoles", + "httpMethod": "POST", + "description": "Inserts a new user role.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "UserRole" + }, + "response": { + "$ref": "UserRole" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.userRoles.list", + "path": "userprofiles/{profileId}/userRoles", + "httpMethod": "GET", + "description": "Retrieves a list of user roles, possibly filtered. This method supports paging.", + "parameters": { + "accountUserRoleOnly": { + "type": "boolean", + "description": "Select only account level user roles not associated with any specific subaccount.", + "location": "query" + }, + "ids": { + "type": "string", + "description": "Select only user roles with the specified IDs.", + "format": "int64", + "repeated": true, + "location": "query" + }, + "maxResults": { + "type": "integer", + "description": "Maximum number of results to return.", + "format": "int32", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "Value of the nextPageToken from the previous result page.", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + }, + "searchString": { + "type": "string", + "description": "Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, \"userrole*2015\" will return objects with names like \"userrole June 2015\", \"userrole April 2015\", or simply \"userrole 2015\". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of \"userrole\" will match objects with name \"my userrole\", \"userrole 2015\", or simply \"userrole\".", + "location": "query" + }, + "sortField": { + "type": "string", + "description": "Field by which to sort the list.", + "enum": [ + "ID", + "NAME" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + }, + "sortOrder": { + "type": "string", + "description": "Order of sorted results, default is ASCENDING.", + "enum": [ + "ASCENDING", + "DESCENDING" + ], + "enumDescriptions": [ + "", + "" + ], + "location": "query" + }, + "subaccountId": { + "type": "string", + "description": "Select only user roles that belong to this subaccount.", + "format": "int64", + "location": "query" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "UserRolesListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "patch": { + "id": "dfareporting.userRoles.patch", + "path": "userprofiles/{profileId}/userRoles", + "httpMethod": "PATCH", + "description": "Updates an existing user role. This method supports patch semantics.", + "parameters": { + "id": { + "type": "string", + "description": "User role ID.", + "required": true, + "format": "int64", + "location": "query" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "request": { + "$ref": "UserRole" + }, + "response": { + "$ref": "UserRole" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "update": { + "id": "dfareporting.userRoles.update", + "path": "userprofiles/{profileId}/userRoles", + "httpMethod": "PUT", + "description": "Updates an existing user role.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "request": { + "$ref": "UserRole" + }, + "response": { + "$ref": "UserRole" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + }, + "videoFormats": { + "methods": { + "get": { + "id": "dfareporting.videoFormats.get", + "path": "userprofiles/{profileId}/videoFormats/{id}", + "httpMethod": "GET", + "description": "Gets one video format by ID.", + "parameters": { + "id": { + "type": "integer", + "description": "Video format ID.", + "required": true, + "format": "int32", + "location": "path" + }, + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId", + "id" + ], + "response": { + "$ref": "VideoFormat" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + }, + "list": { + "id": "dfareporting.videoFormats.list", + "path": "userprofiles/{profileId}/videoFormats", + "httpMethod": "GET", + "description": "Lists available video formats.", + "parameters": { + "profileId": { + "type": "string", + "description": "User profile ID associated with this request.", + "required": true, + "format": "int64", + "location": "path" + } + }, + "parameterOrder": [ + "profileId" + ], + "response": { + "$ref": "VideoFormatsListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/dfatrafficking" + ] + } + } + } + } +} diff --git a/etc/api/discovery/v1/discovery-api.json b/etc/api/discovery/v1/discovery-api.json index f3bd2ea22c..fd0afa0c21 100644 --- a/etc/api/discovery/v1/discovery-api.json +++ b/etc/api/discovery/v1/discovery-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/Pyg0A4J33Dq212hoe9BYpSm0dl4\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/Pyg0A4J33Dq212hoe9BYpSm0dl4\"", "discoveryVersion": "v1", "id": "discovery:v1", "name": "discovery", diff --git a/etc/api/dns/v1/dns-api.json b/etc/api/dns/v1/dns-api.json index b7b6d29430..f7d4415831 100644 --- a/etc/api/dns/v1/dns-api.json +++ b/etc/api/dns/v1/dns-api.json @@ -1,18 +1,18 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/NTmeGmyi7CpprG1xT8MLokjrTP8\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/kZhVBEml6IgIs86-wixFuVP5H9c\"", "discoveryVersion": "v1", "id": "dns:v1", "name": "dns", "version": "v1", - "revision": "20160825", + "revision": "20161130", "title": "Google Cloud DNS API", "description": "Configures and serves authoritative DNS records.", "ownerDomain": "google.com", "ownerName": "Google", "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" }, "documentationLink": "https://developers.google.com/cloud-dns", "protocol": "rest", diff --git a/etc/api/dns/v2beta1/dns-api.json b/etc/api/dns/v2beta1/dns-api.json index 79f5686e76..c7df530049 100644 --- a/etc/api/dns/v2beta1/dns-api.json +++ b/etc/api/dns/v2beta1/dns-api.json @@ -1,18 +1,18 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/PQ71CNC0zbDU3bik-BkiSGiNtVU\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/VNWoCHk2DTUctXjZhpj19vf2iTM\"", "discoveryVersion": "v1", "id": "dns:v2beta1", "name": "dns", "version": "v2beta1", - "revision": "20160825", + "revision": "20161130", "title": "Google Cloud DNS API", "description": "Configures and serves authoritative DNS records.", "ownerDomain": "google.com", "ownerName": "Google", "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" }, "documentationLink": "https://developers.google.com/cloud-dns", "protocol": "rest", @@ -869,10 +869,10 @@ } } }, - "dnskeys": { + "dnsKeys": { "methods": { "get": { - "id": "dns.dnskeys.get", + "id": "dns.dnsKeys.get", "path": "{project}/managedZones/{managedZone}/dnsKeys/{dnsKeyId}", "httpMethod": "GET", "description": "Fetch the representation of an existing DnsKey.", @@ -922,7 +922,7 @@ ] }, "list": { - "id": "dns.dnskeys.list", + "id": "dns.dnsKeys.list", "path": "{project}/managedZones/{managedZone}/dnsKeys", "httpMethod": "GET", "description": "Enumerate DnsKeys to a ResourceRecordSet collection.", diff --git a/etc/api/doubleclickbidmanager/v1/doubleclickbidmanager-api.json b/etc/api/doubleclickbidmanager/v1/doubleclickbidmanager-api.json index e2db49028e..1eab141f73 100644 --- a/etc/api/doubleclickbidmanager/v1/doubleclickbidmanager-api.json +++ b/etc/api/doubleclickbidmanager/v1/doubleclickbidmanager-api.json @@ -1,19 +1,19 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/APNHThgbF23N6qKTgbCZClI5UfQ\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/xZhMuyiLnKVSMmQ3sSqyBn6nxs0\"", "discoveryVersion": "v1", "id": "doubleclickbidmanager:v1", "name": "doubleclickbidmanager", "canonicalName": "DoubleClick Bid Manager", "version": "v1", - "revision": "20160608", + "revision": "20161010", "title": "DoubleClick Bid Manager API", "description": "API for viewing and managing your reports in DoubleClick Bid Manager.", "ownerDomain": "google.com", "ownerName": "Google", "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" }, "documentationLink": "https://developers.google.com/bid-manager/", "labels": [ @@ -133,6 +133,81 @@ } } }, + "DownloadRequest": { + "id": "DownloadRequest", + "type": "object", + "description": "Request to fetch stored insertion orders, line items, TrueView ad groups and ads.", + "properties": { + "fileTypes": { + "type": "array", + "description": "File types that will be returned.", + "items": { + "type": "string", + "enum": [ + "AD", + "AD_GROUP", + "INSERTION_ORDER", + "LINE_ITEM" + ], + "enumDescriptions": [ + "", + "", + "", + "" + ] + } + }, + "filterIds": { + "type": "array", + "description": "The IDs of the specified filter type. This is used to filter entities to fetch. At least one ID must be specified. Only one ID is allowed for the ADVERTISER_ID filter type. For INSERTION_ORDER_ID or LINE_ITEM_ID filter types all IDs must be from the same Advertiser.", + "items": { + "type": "string", + "format": "int64" + } + }, + "filterType": { + "type": "string", + "description": "Filter type used to filter line items to fetch.", + "enum": [ + "ADVERTISER_ID", + "INSERTION_ORDER_ID", + "LINE_ITEM_ID" + ], + "enumDescriptions": [ + "", + "", + "" + ] + }, + "version": { + "type": "string", + "description": "SDF Version (column names, types, order) in which the entities will be returned. Default to 3." + } + } + }, + "DownloadResponse": { + "id": "DownloadResponse", + "type": "object", + "description": "Download response.", + "properties": { + "adGroups": { + "type": "string", + "description": "Retrieved ad groups in SDF format." + }, + "ads": { + "type": "string", + "description": "Retrieved ads in SDF format." + }, + "insertionOrders": { + "type": "string", + "description": "Retrieved insertion orders in SDF format." + }, + "lineItems": { + "type": "string", + "description": "Retrieved line items in SDF format." + } + } + }, "FilterPair": { "id": "FilterPair", "type": "object", @@ -179,6 +254,7 @@ "FILTER_LINE_ITEM_DAILY_FREQUENCY", "FILTER_LINE_ITEM_LIFETIME_FREQUENCY", "FILTER_LINE_ITEM_TYPE", + "FILTER_MEDIA_PLAN", "FILTER_MOBILE_DEVICE_MAKE", "FILTER_MOBILE_DEVICE_MAKE_MODEL", "FILTER_MOBILE_DEVICE_TYPE", @@ -189,6 +265,7 @@ "FILTER_NIELSEN_COUNTRY_CODE", "FILTER_NIELSEN_DEVICE_ID", "FILTER_NIELSEN_GENDER", + "FILTER_NOT_SUPPORTED", "FILTER_ORDER_ID", "FILTER_OS", "FILTER_PAGE_CATEGORY", @@ -224,6 +301,8 @@ "FILTER_TRUEVIEW_IAR_REGION", "FILTER_TRUEVIEW_IAR_REMARKETING_LIST", "FILTER_TRUEVIEW_IAR_TIME_OF_DAY", + "FILTER_TRUEVIEW_IAR_YOUTUBE_CHANNEL", + "FILTER_TRUEVIEW_IAR_YOUTUBE_VIDEO", "FILTER_TRUEVIEW_IAR_ZIPCODE", "FILTER_TRUEVIEW_INTEREST", "FILTER_TRUEVIEW_KEYWORD", @@ -365,6 +444,10 @@ "", "", "", + "", + "", + "", + "", "" ] }, @@ -412,65 +495,6 @@ } } }, - "Note": { - "id": "Note", - "type": "object", - "description": "Publisher comment from Rubicon.", - "properties": { - "id": { - "type": "string", - "description": "Note id.", - "format": "int64" - }, - "message": { - "type": "string", - "description": "Message from publisher." - }, - "source": { - "type": "string", - "description": "Equals \"publisher\" for notification from Rubicon." - }, - "timestamp": { - "type": "string", - "description": "Time when the note was added, e.g. \"2015-12-16T17:25:35.000-08:00\"." - }, - "username": { - "type": "string", - "description": "Publisher user name." - } - } - }, - "NotifyProposalChangeRequest": { - "id": "NotifyProposalChangeRequest", - "type": "object", - "description": "NotifyProposalChange request.", - "properties": { - "action": { - "type": "string", - "description": "Action taken by publisher. One of: Accept, Decline, Append" - }, - "href": { - "type": "string", - "description": "URL to access proposal detail." - }, - "id": { - "type": "string", - "description": "Below are contents of notification from Rubicon. Proposal id.", - "format": "int64" - }, - "notes": { - "type": "array", - "description": "Notes from publisher", - "items": { - "$ref": "Note" - } - }, - "token": { - "type": "string", - "description": "Deal token, available when proposal is accepted by publisher." - } - } - }, "Parameters": { "id": "Parameters", "type": "object", @@ -526,6 +550,7 @@ "FILTER_LINE_ITEM_DAILY_FREQUENCY", "FILTER_LINE_ITEM_LIFETIME_FREQUENCY", "FILTER_LINE_ITEM_TYPE", + "FILTER_MEDIA_PLAN", "FILTER_MOBILE_DEVICE_MAKE", "FILTER_MOBILE_DEVICE_MAKE_MODEL", "FILTER_MOBILE_DEVICE_TYPE", @@ -536,6 +561,7 @@ "FILTER_NIELSEN_COUNTRY_CODE", "FILTER_NIELSEN_DEVICE_ID", "FILTER_NIELSEN_GENDER", + "FILTER_NOT_SUPPORTED", "FILTER_ORDER_ID", "FILTER_OS", "FILTER_PAGE_CATEGORY", @@ -571,6 +597,8 @@ "FILTER_TRUEVIEW_IAR_REGION", "FILTER_TRUEVIEW_IAR_REMARKETING_LIST", "FILTER_TRUEVIEW_IAR_TIME_OF_DAY", + "FILTER_TRUEVIEW_IAR_YOUTUBE_CHANNEL", + "FILTER_TRUEVIEW_IAR_YOUTUBE_VIDEO", "FILTER_TRUEVIEW_IAR_ZIPCODE", "FILTER_TRUEVIEW_INTEREST", "FILTER_TRUEVIEW_KEYWORD", @@ -712,6 +740,10 @@ "", "", "", + "", + "", + "", + "", "" ] } @@ -726,6 +758,17 @@ "items": { "type": "string", "enum": [ + "METRIC_ACTIVE_VIEW_AVERAGE_VIEWABLE_TIME", + "METRIC_ACTIVE_VIEW_DISTRIBUTION_UNMEASURABLE", + "METRIC_ACTIVE_VIEW_DISTRIBUTION_UNVIEWABLE", + "METRIC_ACTIVE_VIEW_DISTRIBUTION_VIEWABLE", + "METRIC_ACTIVE_VIEW_ELIGIBLE_IMPRESSIONS", + "METRIC_ACTIVE_VIEW_MEASURABLE_IMPRESSIONS", + "METRIC_ACTIVE_VIEW_PCT_MEASURABLE_IMPRESSIONS", + "METRIC_ACTIVE_VIEW_PCT_VIEWABLE_IMPRESSIONS", + "METRIC_ACTIVE_VIEW_UNMEASURABLE_IMPRESSIONS", + "METRIC_ACTIVE_VIEW_UNVIEWABLE_IMPRESSIONS", + "METRIC_ACTIVE_VIEW_VIEWABLE_IMPRESSIONS", "METRIC_BID_REQUESTS", "METRIC_BILLABLE_COST_ADVERTISER", "METRIC_BILLABLE_COST_PARTNER", @@ -1283,6 +1326,17 @@ "", "", "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", "" ] } @@ -2005,15 +2059,18 @@ } } }, - "rubicon": { + "sdf": { "methods": { - "notifyproposalchange": { - "id": "doubleclickbidmanager.rubicon.notifyproposalchange", - "path": "rubicon/notifyproposalchange", + "download": { + "id": "doubleclickbidmanager.sdf.download", + "path": "sdf/download", "httpMethod": "POST", - "description": "Update proposal upon actions of Rubicon publisher.", + "description": "Retrieves entities in SDF format.", "request": { - "$ref": "NotifyProposalChangeRequest" + "$ref": "DownloadRequest" + }, + "response": { + "$ref": "DownloadResponse" } } } diff --git a/etc/api/doubleclicksearch/v2/doubleclicksearch-api.json b/etc/api/doubleclicksearch/v2/doubleclicksearch-api.json index d7f678cb62..d8021102b5 100644 --- a/etc/api/doubleclicksearch/v2/doubleclicksearch-api.json +++ b/etc/api/doubleclicksearch/v2/doubleclicksearch-api.json @@ -1,18 +1,18 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/3EpE7K-TIr-3D232nGx3ph-P87g\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/HRuJCCIlMtHocq2WCX0lbnhTmso\"", "discoveryVersion": "v1", "id": "doubleclicksearch:v2", "name": "doubleclicksearch", "version": "v2", - "revision": "20160831", + "revision": "20161108", "title": "DoubleClick Search API", "description": "Reports and modifies your advertising data in DoubleClick Search (for example, campaigns, ad groups, keywords, and conversions).", "ownerDomain": "google.com", "ownerName": "Google", "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" }, "documentationLink": "https://developers.google.com/doubleclick-search/", "protocol": "rest", diff --git a/etc/api/drive/v2/drive-api.json b/etc/api/drive/v2/drive-api.json index e2c1a71f14..5c28a2c116 100644 --- a/etc/api/drive/v2/drive-api.json +++ b/etc/api/drive/v2/drive-api.json @@ -1,11 +1,11 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/PDe69Eq2j9-xpzST6tMQ5MRPx_I\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/W9mfjzQR1RkzHwNqZlCoG9HjWHE\"", "discoveryVersion": "v1", "id": "drive:v2", "name": "drive", "version": "v2", - "revision": "20160901", + "revision": "20161212", "title": "Drive API", "description": "Manages files in Drive including uploading, downloading, searching, detecting changes, and updating sharing permissions.", "ownerDomain": "google.com", @@ -963,6 +963,10 @@ "type": "string", "description": "The full file extension; extracted from the title. May contain multiple concatenated extensions, such as \"tar.gz\". Removing an extension from the title does not clear this field; however, changing the extension on the title does update this field. This field is only populated for files with content stored in Drive; it is not populated for Google Docs or shortcut files." }, + "hasThumbnail": { + "type": "boolean", + "description": "Whether this file has a thumbnail." + }, "headRevisionId": { "type": "string", "description": "The ID of the file's head revision. This field is only populated for files with content stored in Drive; it is not populated for Google Docs or shortcut files." @@ -1119,6 +1123,10 @@ "type": "boolean", "description": "Deprecated." }, + "modified": { + "type": "boolean", + "description": "Whether the file has been modified by this user." + }, "restricted": { "type": "boolean", "description": "Whether viewers and commenters are prevented from downloading, printing, and copying this file." @@ -1258,7 +1266,7 @@ }, "thumbnail": { "type": "object", - "description": "Thumbnail for the file. Only accepted on upload and for files that are not already thumbnailed by Google.", + "description": "A thumbnail for the file. This will only be used if Drive cannot generate a standard thumbnail.", "properties": { "image": { "type": "string", @@ -1273,7 +1281,12 @@ }, "thumbnailLink": { "type": "string", - "description": "A short-lived link to the file's thumbnail. Typically lasts on the order of hours." + "description": "A short-lived link to the file's thumbnail. Typically lasts on the order of hours. Only populated when the requesting app can access the file's content." + }, + "thumbnailVersion": { + "type": "string", + "description": "The thumbnail version for use in client-contructable thumbnail URLs or thumbnail cache invalidation.", + "format": "int64" }, "title": { "type": "string", @@ -1476,7 +1489,7 @@ }, "id": { "type": "string", - "description": "The ID of the user this permission refers to, and identical to the permissionId in the About and Files resources. When making a drive.permissions.insert request, exactly one of the id or value fields must be specified unless the permission type anyone, in which case both id and value are ignored." + "description": "The ID of the user this permission refers to, and identical to the permissionId in the About and Files resources. When making a drive.permissions.insert request, exactly one of the id or value fields must be specified unless the permission type is anyone, in which case both id and value are ignored." }, "kind": { "type": "string", @@ -1515,7 +1528,7 @@ }, "value": { "type": "string", - "description": "The email address or domain name for the entity. This is used during inserts and is not populated in responses. When making a drive.permissions.insert request, exactly one of the id or value fields must be specified unless the permission type anyone, in which case both id and value are ignored." + "description": "The email address or domain name for the entity. This is used during inserts and is not populated in responses. When making a drive.permissions.insert request, exactly one of the id or value fields must be specified unless the permission type is anyone, in which case both id and value are ignored." }, "withLink": { "type": "boolean", @@ -1732,6 +1745,10 @@ "description": "This is always drive#revisionList.", "default": "drive#revisionList" }, + "nextPageToken": { + "type": "string", + "description": "The page token for the next page of revisions. This field will be absent if the end of the revisions list has been reached. If the token is rejected for any reason, it should be discarded and pagination should be restarted from the first page of results." + }, "selfLink": { "type": "string", "description": "A link back to this list." @@ -4238,6 +4255,20 @@ "description": "The ID of the file.", "required": true, "location": "path" + }, + "maxResults": { + "type": "integer", + "description": "Maximum number of revisions to return.", + "default": "200", + "format": "int32", + "minimum": "1", + "maximum": "1000", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "Page token for revisions. To get the next page of results, set this parameter to the value of \"nextPageToken\" from the previous response.", + "location": "query" } }, "parameterOrder": [ diff --git a/etc/api/drive/v3/drive-api.json b/etc/api/drive/v3/drive-api.json index 97afa5ed2f..af7b2445cc 100644 --- a/etc/api/drive/v3/drive-api.json +++ b/etc/api/drive/v3/drive-api.json @@ -1,11 +1,11 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/b4mg2dvgTW9WKWXzE5c-R5m9Ggc\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/4kaUogU191OXLH6MjJOHkd-Z-o8\"", "discoveryVersion": "v1", "id": "drive:v3", "name": "drive", "version": "v3", - "revision": "20160901", + "revision": "20161212", "title": "Drive API", "description": "Manages files in Drive including uploading, downloading, searching, detecting changes, and updating sharing permissions.", "ownerDomain": "google.com", @@ -480,6 +480,10 @@ "type": "string", "description": "The full file extension extracted from the name field. May contain multiple concatenated extensions, such as \"tar.gz\". This is only available for files with binary content in Drive.\nThis is automatically updated when the name field changes, however it is not cleared if the new name does not contain a valid extension." }, + "hasThumbnail": { + "type": "boolean", + "description": "Whether this file has a thumbnail." + }, "headRevisionId": { "type": "string", "description": "The ID of the file's head revision. This is currently only available for files with binary content in Drive." @@ -630,6 +634,10 @@ "type": "string", "description": "The MIME type of the file.\nDrive will attempt to automatically detect an appropriate value from uploaded content if no value is provided. The value cannot be changed unless a new revision is uploaded.\nIf a file is created with a Google Doc MIME type, the uploaded content will be imported if possible. The supported import formats are published in the About resource." }, + "modifiedByMe": { + "type": "boolean", + "description": "Whether the file has been modified by this user." + }, "modifiedByMeTime": { "type": "string", "description": "The last time the file was modified by the user (RFC 3339 date-time).", @@ -716,7 +724,12 @@ }, "thumbnailLink": { "type": "string", - "description": "A short-lived link to the file's thumbnail, if available. Typically lasts on the order of hours." + "description": "A short-lived link to the file's thumbnail, if available. Typically lasts on the order of hours. Only populated when the requesting app can access the file's content." + }, + "thumbnailVersion": { + "type": "string", + "description": "The thumbnail version for use in client-contructable thumbnail URLs or thumbnail cache invalidation.", + "format": "int64" }, "trashed": { "type": "boolean", @@ -1041,6 +1054,10 @@ "description": "Identifies what kind of resource this is. Value: the fixed string \"drive#revisionList\".", "default": "drive#revisionList" }, + "nextPageToken": { + "type": "string", + "description": "The page token for the next page of revisions. This will be absent if the end of the revisions list has been reached." + }, "revisions": { "type": "array", "description": "The full list of revisions.", @@ -2366,6 +2383,20 @@ "description": "The ID of the file.", "required": true, "location": "path" + }, + "pageSize": { + "type": "integer", + "description": "The maximum number of revisions to return per page.", + "default": "200", + "format": "int32", + "minimum": "1", + "maximum": "1000", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "The token for continuing a previous list request on the next page. This should be set to the value of 'nextPageToken' from the previous response.", + "location": "query" } }, "parameterOrder": [ diff --git a/etc/api/firebasedynamiclinks/v1/firebasedynamiclinks-api.json b/etc/api/firebasedynamiclinks/v1/firebasedynamiclinks-api.json new file mode 100644 index 0000000000..29e5ba2d13 --- /dev/null +++ b/etc/api/firebasedynamiclinks/v1/firebasedynamiclinks-api.json @@ -0,0 +1,460 @@ +{ + "id": "firebasedynamiclinks:v1", + "auth": { + "oauth2": { + "scopes": { + "https://www.googleapis.com/auth/firebase": { + "description": "View and administer all your Firebase data and settings" + } + } + } + }, + "description": "Firebase Dynamic Links API enables third party developers to programmatically create and manage Dynamic Links.", + "protocol": "rest", + "title": "Firebase Dynamic Links API", + "resources": { + "shortLinks": { + "methods": { + "create": { + "id": "firebasedynamiclinks.shortLinks.create", + "response": { + "$ref": "CreateShortDynamicLinkResponse" + }, + "parameterOrder": [], + "description": "Creates a short Dynamic Link given either a valid long Dynamic Link or\ndetails such as Dynamic Link domain, Android and iOS app information.\nThe created short Dynamic Link will not expire.\n\nRepeated calls with the same long Dynamic Link or Dynamic Link information\nwill produce the same short Dynamic Link.\n\nThe Dynamic Link domain in the request must be owned by requester's\nFirebase project.", + "request": { + "$ref": "CreateShortDynamicLinkRequest" + }, + "flatPath": "v1/shortLinks", + "httpMethod": "POST", + "parameters": {}, + "path": "v1/shortLinks", + "scopes": [ + "https://www.googleapis.com/auth/firebase" + ] + } + } + } + }, + "schemas": { + "DynamicLinkInfo": { + "description": "Information about a Dynamic Link.", + "type": "object", + "properties": { + "socialMetaTagInfo": { + "description": "Parameters for social meta tag params.\nUsed to set meta tag data for link previews on social sites.", + "$ref": "SocialMetaTagInfo" + }, + "analyticsInfo": { + "description": "Parameters used for tracking. See all tracking parameters in the\n[documentation](https://firebase.google.com/docs/dynamic-links/android#create-a-dynamic-link-programmatically).", + "$ref": "AnalyticsInfo" + }, + "link": { + "description": "The link your app will open, You can specify any URL your app can handle.\nThis link must be a well-formatted URL, be properly URL-encoded, and use\nthe HTTP or HTTPS scheme. See 'link' parameters in the\n[documentation](https://firebase.google.com/docs/dynamic-links/android#create-a-dynamic-link-programmatically).\n\nRequired.", + "type": "string" + }, + "dynamicLinkDomain": { + "description": "Dynamic Links domain that the project owns, e.g. abcd.app.goo.gl\n[Learn more](https://firebase.google.com/docs/dynamic-links/android#set-up-firebase-and-the-dynamic-links-sdk)\non how to set up Dynamic Link domain associated with your Firebase project.\n\nRequired.", + "type": "string" + }, + "iosInfo": { + "description": "iOS related information. See iOS related parameters in the\n[documentation](https://firebase.google.com/docs/dynamic-links/ios#create-a-dynamic-link-programmatically).", + "$ref": "IosInfo" + }, + "androidInfo": { + "description": "Android related information. See Android related parameters in the\n[documentation](https://firebase.google.com/docs/dynamic-links/android#create-a-dynamic-link-programmatically).", + "$ref": "AndroidInfo" + } + }, + "id": "DynamicLinkInfo" + }, + "ITunesConnectAnalytics": { + "description": "Parameters for iTunes Connect App Analytics.", + "type": "object", + "properties": { + "mt": { + "description": "iTune media types, including music, podcasts, audiobooks and so on.", + "type": "string" + }, + "at": { + "description": "Affiliate token used to create affiliate-coded links.", + "type": "string" + }, + "ct": { + "description": "Campaign text that developers can optionally add to any link in order to\ntrack sales from a specific marketing campaign.", + "type": "string" + }, + "pt": { + "description": "Provider token that enables analytics for Dynamic Links from within iTunes\nConnect.", + "type": "string" + } + }, + "id": "ITunesConnectAnalytics" + }, + "DynamicLinkWarning": { + "description": "Dynamic Links warning messages.", + "type": "object", + "properties": { + "warningCode": { + "description": "The warning code.", + "enum": [ + "CODE_UNSPECIFIED", + "NOT_IN_PROJECT_ANDROID_PACKAGE_NAME", + "NOT_INTEGER_ANDROID_PACKAGE_MIN_VERSION", + "UNNECESSARY_ANDROID_PACKAGE_MIN_VERSION", + "NOT_URI_ANDROID_LINK", + "UNNECESSARY_ANDROID_LINK", + "NOT_URI_ANDROID_FALLBACK_LINK", + "BAD_URI_SCHEME_ANDROID_FALLBACK_LINK", + "NOT_IN_PROJECT_IOS_BUNDLE_ID", + "NOT_IN_PROJECT_IPAD_BUNDLE_ID", + "UNNECESSARY_IOS_URL_SCHEME", + "NOT_NUMERIC_IOS_APP_STORE_ID", + "UNNECESSARY_IOS_APP_STORE_ID", + "NOT_URI_IOS_FALLBACK_LINK", + "BAD_URI_SCHEME_IOS_FALLBACK_LINK", + "NOT_URI_IPAD_FALLBACK_LINK", + "BAD_URI_SCHEME_IPAD_FALLBACK_LINK", + "BAD_DEBUG_PARAM", + "BAD_AD_PARAM", + "DEPRECATED_PARAM", + "UNRECOGNIZED_PARAM", + "TOO_LONG_PARAM", + "NOT_URI_SOCIAL_IMAGE_LINK", + "BAD_URI_SCHEME_SOCIAL_IMAGE_LINK", + "NOT_URI_SOCIAL_URL", + "BAD_URI_SCHEME_SOCIAL_URL", + "LINK_LENGTH_TOO_LONG", + "LINK_WITH_FRAGMENTS", + "NOT_MATCHING_IOS_BUNDLE_ID_AND_STORE_ID" + ], + "enumDescriptions": [ + "Unknown code.", + "The Android package does not match any in developer's DevConsole project.", + "The Android minimum version code has to be a valid integer.", + "Android package min version param is not needed, e.g. when\n'apn' is missing.", + "Android link is not a valid URI.", + "Android link param is not needed, e.g. when param 'al' and 'link' have\nthe same value..", + "Android fallback link is not a valid URI.", + "Android fallback link has an invalid (non http/https) URI scheme.", + "The iOS bundle ID does not match any in developer's DevConsole project.", + "The iPad bundle ID does not match any in developer's DevConsole project.", + "iOS URL scheme is not needed, e.g. when 'ibi' are 'ipbi' are all missing.", + "iOS app store ID format is incorrect, e.g. not numeric.", + "iOS app store ID is not needed.", + "iOS fallback link is not a valid URI.", + "iOS fallback link has an invalid (non http/https) URI scheme.", + "iPad fallback link is not a valid URI.", + "iPad fallback link has an invalid (non http/https) URI scheme.", + "Debug param format is incorrect.", + "isAd param format is incorrect.", + "Indicates a certain param is deprecated.", + "Indicates certain paramater is not recognized.", + "Indicates certain paramater is too long.", + "Social meta tag image link is not a valid URI.", + "Social meta tag image link has an invalid (non http/https) URI scheme.", + "", + "", + "Dynamic Link URL length is too long.", + "Dynamic Link URL contains fragments.", + "The iOS bundle ID does not match with the given iOS store ID." + ], + "type": "string" + }, + "warningMessage": { + "description": "The warning message to help developers improve their requests.", + "type": "string" + } + }, + "id": "DynamicLinkWarning" + }, + "CreateShortDynamicLinkRequest": { + "description": "Request to create a short Dynamic Link.", + "type": "object", + "properties": { + "dynamicLinkInfo": { + "description": "Information about the Dynamic Link to be shortened.\n[Learn more](https://firebase.google.com/docs/dynamic-links/android#create-a-dynamic-link-programmatically).", + "$ref": "DynamicLinkInfo" + }, + "longDynamicLink": { + "description": "Full long Dynamic Link URL with desired query parameters specified.\nFor example,\n\"https://sample.app.goo.gl/?link=http://www.google.com&apn=com.sample\",\n[Learn more](https://firebase.google.com/docs/dynamic-links/android#create-a-dynamic-link-programmatically).", + "type": "string" + }, + "suffix": { + "description": "Short Dynamic Link suffix. Optional.", + "$ref": "Suffix" + } + }, + "id": "CreateShortDynamicLinkRequest" + }, + "AnalyticsInfo": { + "description": "Tracking parameters supported by Dynamic Link.", + "type": "object", + "properties": { + "googlePlayAnalytics": { + "description": "Google Play Campaign Measurements.", + "$ref": "GooglePlayAnalytics" + }, + "itunesConnectAnalytics": { + "description": "iTunes Connect App Analytics.", + "$ref": "ITunesConnectAnalytics" + } + }, + "id": "AnalyticsInfo" + }, + "Suffix": { + "description": "Short Dynamic Link suffix.", + "type": "object", + "properties": { + "option": { + "description": "Suffix option.", + "enum": [ + "OPTION_UNSPECIFIED", + "UNGUESSABLE", + "SHORT" + ], + "enumDescriptions": [ + "The suffix option is not specified, performs as NOT_GUESSABLE .", + "Short Dynamic Link suffix is a base62 [0-9A-Za-z] encoded string of\na random generated 96 bit random number, which has a length of 17 chars.\nFor example, \"nlAR8U4SlKRZw1cb2\".\nIt prevents other people from guessing and crawling short Dynamic Links\nthat contain personal identifiable information.", + "Short Dynamic Link suffix is a base62 [0-9A-Za-z] string starting with a\nlength of 4 chars. the length will increase when all the space is\noccupied." + ], + "type": "string" + } + }, + "id": "Suffix" + }, + "CreateShortDynamicLinkResponse": { + "description": "Response to create a short Dynamic Link.", + "type": "object", + "properties": { + "previewLink": { + "description": "Preivew link to show the link flow chart.", + "type": "string" + }, + "warning": { + "description": "Information about potential warnings on link creation.", + "type": "array", + "items": { + "$ref": "DynamicLinkWarning" + } + }, + "shortLink": { + "description": "Short Dynamic Link value. e.g. https://abcd.app.goo.gl/wxyz", + "type": "string" + } + }, + "id": "CreateShortDynamicLinkResponse" + }, + "IosInfo": { + "description": "iOS related attributes to the Dynamic Link..", + "type": "object", + "properties": { + "iosAppStoreId": { + "description": "iOS App Store ID.", + "type": "string" + }, + "iosIpadFallbackLink": { + "description": "If specified, this overrides the ios_fallback_link value on iPads.", + "type": "string" + }, + "iosBundleId": { + "description": "iOS bundle ID of the app.", + "type": "string" + }, + "iosFallbackLink": { + "description": "Link to open on iOS if the app is not installed.", + "type": "string" + }, + "iosIpadBundleId": { + "description": "iPad bundle ID of the app.", + "type": "string" + }, + "iosCustomScheme": { + "description": "Custom (destination) scheme to use for iOS. By default, we’ll use the\nbundle ID as the custom scheme. Developer can override this behavior using\nthis param.", + "type": "string" + } + }, + "id": "IosInfo" + }, + "AndroidInfo": { + "description": "Android related attributes to the Dynamic Link.", + "type": "object", + "properties": { + "androidMinPackageVersionCode": { + "description": "Minimum version code for the Android app. If the installed app’s version\ncode is lower, then the user is taken to the Play Store.", + "type": "string" + }, + "androidLink": { + "description": "If specified, this overrides the ‘link’ parameter on Android.", + "type": "string" + }, + "androidFallbackLink": { + "description": "Link to open on Android if the app is not installed.", + "type": "string" + }, + "androidPackageName": { + "description": "Android package name of the app.", + "type": "string" + } + }, + "id": "AndroidInfo" + }, + "SocialMetaTagInfo": { + "description": "Parameters for social meta tag params.\nUsed to set meta tag data for link previews on social sites.", + "type": "object", + "properties": { + "socialTitle": { + "description": "Title to be displayed. Optional.", + "type": "string" + }, + "socialDescription": { + "description": "A short description of the link. Optional.", + "type": "string" + }, + "socialImageLink": { + "description": "An image url string. Optional.", + "type": "string" + } + }, + "id": "SocialMetaTagInfo" + }, + "GooglePlayAnalytics": { + "description": "Parameters for Google Play Campaign Measurements.\n[Learn more](https://developers.google.com/analytics/devguides/collection/android/v4/campaigns#campaign-params)", + "type": "object", + "properties": { + "utmCampaign": { + "description": "Campaign name; used for keyword analysis to identify a specific product\npromotion or strategic campaign.", + "type": "string" + }, + "utmTerm": { + "description": "Campaign term; used with paid search to supply the keywords for ads.", + "type": "string" + }, + "gclid": { + "description": "[AdWords autotagging parameter](https://support.google.com/analytics/answer/1033981?hl=en);\nused to measure Google AdWords ads. This value is generated dynamically\nand should never be modified.", + "type": "string" + }, + "utmSource": { + "description": "Campaign source; used to identify a search engine, newsletter, or other\nsource.", + "type": "string" + }, + "utmMedium": { + "description": "Campaign medium; used to identify a medium such as email or cost-per-click.", + "type": "string" + }, + "utmContent": { + "description": "Campaign content; used for A/B testing and content-targeted ads to\ndifferentiate ads or links that point to the same URL.", + "type": "string" + } + }, + "id": "GooglePlayAnalytics" + } + }, + "revision": "20161118", + "basePath": "", + "icons": { + "x32": "http://www.google.com/images/icons/product/search-32.gif", + "x16": "http://www.google.com/images/icons/product/search-16.gif" + }, + "version_module": "True", + "canonicalName": "Firebase Dynamic Links", + "discoveryVersion": "v1", + "baseUrl": "https://firebasedynamiclinks.googleapis.com/", + "name": "firebasedynamiclinks", + "parameters": { + "access_token": { + "description": "OAuth access token.", + "type": "string", + "location": "query" + }, + "prettyPrint": { + "description": "Returns response with indentations and line breaks.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "key": { + "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", + "type": "string", + "location": "query" + }, + "quotaUser": { + "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.", + "type": "string", + "location": "query" + }, + "pp": { + "description": "Pretty-print response.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "fields": { + "description": "Selector specifying which fields to include in a partial response.", + "type": "string", + "location": "query" + }, + "alt": { + "description": "Data format for response.", + "location": "query", + "enum": [ + "json", + "media", + "proto" + ], + "default": "json", + "enumDescriptions": [ + "Responses with Content-Type of application/json", + "Media download with context-dependent Content-Type", + "Responses with Content-Type of application/x-protobuf" + ], + "type": "string" + }, + "$.xgafv": { + "description": "V1 error format.", + "enum": [ + "1", + "2" + ], + "enumDescriptions": [ + "v1 error format", + "v2 error format" + ], + "type": "string", + "location": "query" + }, + "callback": { + "description": "JSONP", + "type": "string", + "location": "query" + }, + "oauth_token": { + "description": "OAuth 2.0 token for the current user.", + "type": "string", + "location": "query" + }, + "uploadType": { + "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").", + "type": "string", + "location": "query" + }, + "bearer_token": { + "description": "OAuth bearer token.", + "type": "string", + "location": "query" + }, + "upload_protocol": { + "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").", + "type": "string", + "location": "query" + } + }, + "documentationLink": "https://firebase.google.com/docs/dynamic-links/", + "ownerDomain": "google.com", + "batchPath": "batch", + "servicePath": "", + "ownerName": "Google", + "version": "v1", + "rootUrl": "https://firebasedynamiclinks.googleapis.com/", + "kind": "discovery#restDescription" +} diff --git a/etc/api/firebaserules/v1/firebaserules-api.json b/etc/api/firebaserules/v1/firebaserules-api.json index e69de29bb2..7de796337d 100644 --- a/etc/api/firebaserules/v1/firebaserules-api.json +++ b/etc/api/firebaserules/v1/firebaserules-api.json @@ -0,0 +1,648 @@ +{ + "id": "firebaserules:v1", + "auth": { + "oauth2": { + "scopes": { + "https://www.googleapis.com/auth/cloud-platform": { + "description": "View and manage your data across Google Cloud Platform services" + }, + "https://www.googleapis.com/auth/firebase": { + "description": "View and administer all your Firebase data and settings" + }, + "https://www.googleapis.com/auth/firebase.readonly": { + "description": "View all your Firebase data and settings" + } + } + } + }, + "description": "Creates and manages rules that determine when a Firebase Rules-enabled service should permit a request.\n", + "protocol": "rest", + "title": "Firebase Rules API", + "resources": { + "projects": { + "resources": { + "rulesets": { + "methods": { + "create": { + "id": "firebaserules.projects.rulesets.create", + "response": { + "$ref": "Ruleset" + }, + "parameterOrder": [ + "name" + ], + "description": "Create a `Ruleset` from `Source`.\n\nThe `Ruleset` is given a unique generated name which is returned to the\ncaller. `Source` containing syntactic or semantics errors will result in an\nerror response indicating the first error encountered. For a detailed view\nof `Source` issues, use TestRuleset.", + "request": { + "$ref": "Ruleset" + }, + "flatPath": "v1/projects/{projectsId}/rulesets", + "httpMethod": "POST", + "parameters": { + "name": { + "description": "Resource name for Project which owns this `Ruleset`.\n\nFormat: `projects/{project_id}`", + "required": true, + "pattern": "^projects/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1/{+name}/rulesets", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/firebase" + ] + }, + "get": { + "id": "firebaserules.projects.rulesets.get", + "response": { + "$ref": "Ruleset" + }, + "parameterOrder": [ + "name" + ], + "description": "Get a `Ruleset` by name including the full `Source` contents.", + "flatPath": "v1/projects/{projectsId}/rulesets/{rulesetsId}", + "httpMethod": "GET", + "parameters": { + "name": { + "description": "Resource name for the ruleset to get.\n\nFormat: `projects/{project_id}/rulesets/{ruleset_id}`", + "required": true, + "pattern": "^projects/[^/]+/rulesets/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1/{+name}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/firebase", + "https://www.googleapis.com/auth/firebase.readonly" + ] + }, + "list": { + "id": "firebaserules.projects.rulesets.list", + "response": { + "$ref": "ListRulesetsResponse" + }, + "parameterOrder": [ + "name" + ], + "description": "List `Ruleset` metadata only and optionally filter the results by Ruleset\nname.\n\nThe full `Source` contents of a `Ruleset` may be retrieved with\nGetRuleset.", + "flatPath": "v1/projects/{projectsId}/rulesets", + "httpMethod": "GET", + "parameters": { + "pageSize": { + "description": "Page size to load. Maximum of 100. Defaults to 10.\nNote: `page_size` is just a hint and the service may choose to load less\nthan `page_size` due to the size of the output. To traverse all of the\nreleases, caller should iterate until the `page_token` is empty.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "name": { + "description": "Resource name for the project.\n\nFormat: `projects/{project_id}`", + "required": true, + "pattern": "^projects/[^/]+$", + "location": "path", + "type": "string" + }, + "pageToken": { + "description": "Next page token for loading the next batch of `Ruleset` instances.", + "location": "query", + "type": "string" + } + }, + "path": "v1/{+name}/rulesets", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/firebase", + "https://www.googleapis.com/auth/firebase.readonly" + ] + }, + "delete": { + "id": "firebaserules.projects.rulesets.delete", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "name" + ], + "description": "Delete a `Ruleset` by resource name.\n\nIf the `Ruleset` is referenced by a `Release` the operation will fail.", + "flatPath": "v1/projects/{projectsId}/rulesets/{rulesetsId}", + "httpMethod": "DELETE", + "parameters": { + "name": { + "description": "Resource name for the ruleset to delete.\n\nFormat: `projects/{project_id}/rulesets/{ruleset_id}`", + "required": true, + "pattern": "^projects/[^/]+/rulesets/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1/{+name}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/firebase" + ] + } + } + }, + "releases": { + "methods": { + "update": { + "id": "firebaserules.projects.releases.update", + "response": { + "$ref": "Release" + }, + "parameterOrder": [ + "name" + ], + "description": "Update a `Release`.\n\nOnly updates to the `ruleset_name` field will be honored. `Release` rename\nis not supported. To create a `Release` use the CreateRelease method\ninstead.", + "request": { + "$ref": "Release" + }, + "flatPath": "v1/projects/{projectsId}/releases/{releasesId}", + "httpMethod": "PUT", + "parameters": { + "name": { + "description": "Resource name for the `Release`.\n\n`Release` names may be structured `app1/prod/v2` or flat `app1_prod_v2`\nwhich affords developers a great deal of flexibility in mapping the name\nto the style that best fits their existing development practices. For\nexample, a name could refer to an environment, an app, a version, or some\ncombination of three.\n\nIn the table below, for the project name `projects/foo`, the following\nrelative release paths show how flat and structured names might be chosen\nto match a desired development / deployment strategy.\n\nUse Case | Flat Name | Structured Name\n-------------|---------------------|----------------\nEnvironments | releases/qa | releases/qa\nApps | releases/app1_qa | releases/app1/qa\nVersions | releases/app1_v2_qa | releases/app1/v2/qa\n\nThe delimiter between the release name path elements can be almost anything\nand it should work equally well with the release name list filter, but in\nmany ways the structured paths provide a clearer picture of the\nrelationship between `Release` instances.\n\nFormat: `projects/{project_id}/releases/{release_id}`", + "required": true, + "pattern": "^projects/[^/]+/releases/.+$", + "location": "path", + "type": "string" + } + }, + "path": "v1/{+name}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/firebase" + ] + }, + "create": { + "id": "firebaserules.projects.releases.create", + "response": { + "$ref": "Release" + }, + "parameterOrder": [ + "name" + ], + "description": "Create a `Release`.\n\nRelease names should reflect the developer's deployment practices. For\nexample, the release name may include the environment name, application\nname, application version, or any other name meaningful to the developer.\nOnce a `Release` refers to a `Ruleset`, the rules can be enforced by\nFirebase Rules-enabled services.\n\nMore than one `Release` may be 'live' concurrently. Consider the following\nthree `Release` names for `projects/foo` and the `Ruleset` to which they\nrefer.\n\nRelease Name | Ruleset Name\n--------------------------------|-------------\nprojects/foo/releases/prod | projects/foo/rulesets/uuid123\nprojects/foo/releases/prod/beta | projects/foo/rulesets/uuid123\nprojects/foo/releases/prod/v23 | projects/foo/rulesets/uuid456\n\nThe table reflects the `Ruleset` rollout in progress. The `prod` and\n`prod/beta` releases refer to the same `Ruleset`. However, `prod/v23`\nrefers to a new `Ruleset`. The `Ruleset` reference for a `Release` may be\nupdated using the UpdateRelease method, and the custom `Release` name\nmay be referenced by specifying the `X-Firebase-Rules-Release-Name` header.", + "request": { + "$ref": "Release" + }, + "flatPath": "v1/projects/{projectsId}/releases", + "httpMethod": "POST", + "parameters": { + "name": { + "description": "Resource name for the project which owns this `Release`.\n\nFormat: `projects/{project_id}`", + "required": true, + "pattern": "^projects/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1/{+name}/releases", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/firebase" + ] + }, + "get": { + "id": "firebaserules.projects.releases.get", + "response": { + "$ref": "Release" + }, + "parameterOrder": [ + "name" + ], + "description": "Get a `Release` by name.", + "flatPath": "v1/projects/{projectsId}/releases/{releasesId}", + "httpMethod": "GET", + "parameters": { + "name": { + "description": "Resource name of the `Release`.\n\n\nFormat: `projects/{project_id}/releases/{release_id}`", + "required": true, + "pattern": "^projects/[^/]+/releases/.+$", + "location": "path", + "type": "string" + } + }, + "path": "v1/{+name}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/firebase", + "https://www.googleapis.com/auth/firebase.readonly" + ] + }, + "list": { + "id": "firebaserules.projects.releases.list", + "response": { + "$ref": "ListReleasesResponse" + }, + "parameterOrder": [ + "name" + ], + "description": "List the `Release` values for a project. This list may optionally be\nfiltered by `Release` name or `Ruleset` id or both.", + "flatPath": "v1/projects/{projectsId}/releases", + "httpMethod": "GET", + "parameters": { + "pageSize": { + "description": "Page size to load. Maximum of 100. Defaults to 10.\nNote: `page_size` is just a hint and the service may choose to load less\nthan `page_size` due to the size of the output. To traverse all of the\nreleases, caller should iterate until the `page_token` is empty.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "filter": { + "description": "`Release` filter. The list method supports filters with restrictions on the\n`Release` `name` and also on the `Ruleset` `ruleset_name`.\n\nExample 1) A filter of 'name=prod*' might return `Release`s with names\nwithin 'projects/foo' prefixed with 'prod':\n\nName | Ruleset Name\n------------------------------|-------------\nprojects/foo/releases/prod | projects/foo/rulesets/uuid1234\nprojects/foo/releases/prod/v1 | projects/foo/rulesets/uuid1234\nprojects/foo/releases/prod/v2 | projects/foo/rulesets/uuid8888\n\nExample 2) A filter of `name=prod* ruleset_name=uuid1234` would return only\n`Release` instances for 'projects/foo' with names prefixed with 'prod'\nreferring to the same `Ruleset` name of 'uuid1234':\n\nName | Ruleset Name\n------------------------------|-------------\nprojects/foo/releases/prod | projects/foo/rulesets/1234\nprojects/foo/releases/prod/v1 | projects/foo/rulesets/1234\n\nIn the examples, the filter parameters refer to the search filters for\nrelease and ruleset names are relative to the project releases and rulesets\ncollections. Fully qualified prefixed may also be used. e.g.\n`name=projects/foo/releases/prod* ruleset_name=projects/foo/rulesets/uuid1`", + "location": "query", + "type": "string" + }, + "name": { + "description": "Resource name for the project.\n\nFormat: `projects/{project_id}`", + "required": true, + "pattern": "^projects/[^/]+$", + "location": "path", + "type": "string" + }, + "pageToken": { + "description": "Next page token for the next batch of `Release` instances.", + "location": "query", + "type": "string" + } + }, + "path": "v1/{+name}/releases", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/firebase", + "https://www.googleapis.com/auth/firebase.readonly" + ] + }, + "delete": { + "id": "firebaserules.projects.releases.delete", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "name" + ], + "description": "Delete a `Release` by resource name.", + "flatPath": "v1/projects/{projectsId}/releases/{releasesId}", + "httpMethod": "DELETE", + "parameters": { + "name": { + "description": "Resource name for the `Release` to delete.\n\nFormat: `projects/{project_id}/releases/{release_id}`", + "required": true, + "pattern": "^projects/[^/]+/releases/.+$", + "location": "path", + "type": "string" + } + }, + "path": "v1/{+name}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/firebase" + ] + } + } + } + }, + "methods": { + "test": { + "id": "firebaserules.projects.test", + "response": { + "$ref": "TestRulesetResponse" + }, + "parameterOrder": [ + "name" + ], + "description": "Test `Source` for syntactic and semantic correctness. Issues present in the\nrules, if any, will be returned to the caller with a description, severity,\nand source location.\n\nThe test method will typically be executed with a developer provided\n`Source`, but if regression testing is desired, this method may be\nexecuted against a `Ruleset` resource name and the `Source` will be\nretrieved from the persisted `Ruleset`.\n\nThe following is an example of `Source` that permits users to upload images\nto a bucket bearing their user id and matching the correct metadata:\n\n_*Example*_\n\n // Users are allowed to subscribe and unsubscribe to the blog.\n service firebase.storage {\n match /users/{userId}/images/{imageName} {\n allow write: if userId == request.userId\n && (imageName.endsWith('.png') || imageName.endsWith('.jpg'))\n && resource.mimeType.startsWith('image/')\n }\n }", + "request": { + "$ref": "TestRulesetRequest" + }, + "flatPath": "v1/projects/{projectsId}:test", + "httpMethod": "POST", + "parameters": { + "name": { + "description": "Name of the project.\n\nFormat: `projects/{project_id}`", + "required": true, + "pattern": "^projects/.+$", + "location": "path", + "type": "string" + } + }, + "path": "v1/{+name}:test", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/firebase", + "https://www.googleapis.com/auth/firebase.readonly" + ] + } + } + } + }, + "schemas": { + "Release": { + "description": "`Release` is a named reference to a `Ruleset`. Once a `Release` refers to a\n`Ruleset`, rules-enabled services will be able to enforce the `Ruleset`.", + "type": "object", + "properties": { + "updateTime": { + "description": "Time the release was updated.\n@OutputOnly", + "type": "string", + "format": "google-datetime" + }, + "createTime": { + "description": "Time the release was created.\n@OutputOnly", + "type": "string", + "format": "google-datetime" + }, + "name": { + "description": "Resource name for the `Release`.\n\n`Release` names may be structured `app1/prod/v2` or flat `app1_prod_v2`\nwhich affords developers a great deal of flexibility in mapping the name\nto the style that best fits their existing development practices. For\nexample, a name could refer to an environment, an app, a version, or some\ncombination of three.\n\nIn the table below, for the project name `projects/foo`, the following\nrelative release paths show how flat and structured names might be chosen\nto match a desired development / deployment strategy.\n\nUse Case | Flat Name | Structured Name\n-------------|---------------------|----------------\nEnvironments | releases/qa | releases/qa\nApps | releases/app1_qa | releases/app1/qa\nVersions | releases/app1_v2_qa | releases/app1/v2/qa\n\nThe delimiter between the release name path elements can be almost anything\nand it should work equally well with the release name list filter, but in\nmany ways the structured paths provide a clearer picture of the\nrelationship between `Release` instances.\n\nFormat: `projects/{project_id}/releases/{release_id}`", + "type": "string" + }, + "rulesetName": { + "description": "Name of the `Ruleset` referred to by this `Release`. The `Ruleset` must\nexist the `Release` to be created.", + "type": "string" + } + }, + "id": "Release" + }, + "Source": { + "description": "`Source` is one or more `File` messages comprising a logical set of rules.", + "type": "object", + "properties": { + "files": { + "description": "`File` set constituting the `Source` bundle.", + "type": "array", + "items": { + "$ref": "File" + } + } + }, + "id": "Source" + }, + "SourcePosition": { + "description": "Position in the `Source` content including its line, column number, and an\nindex of the `File` in the `Source` message. Used for debug purposes.", + "type": "object", + "properties": { + "fileName": { + "description": "Name of the `File`.", + "type": "string" + }, + "column": { + "description": "First column on the source line associated with the source fragment.", + "type": "integer", + "format": "int32" + }, + "line": { + "description": "Line number of the source fragment. 1-based.", + "type": "integer", + "format": "int32" + } + }, + "id": "SourcePosition" + }, + "TestRulesetResponse": { + "description": "The response for FirebaseRulesService.TestRuleset.", + "type": "object", + "properties": { + "issues": { + "description": "Syntactic and semantic `Source` issues of varying severity. Issues of\n`ERROR` severity will prevent tests from executing.", + "type": "array", + "items": { + "$ref": "Issue" + } + } + }, + "id": "TestRulesetResponse" + }, + "Ruleset": { + "description": "`Ruleset` is an immutable copy of `Source` with a globally unique identifier\nand a creation time.", + "type": "object", + "properties": { + "source": { + "description": "`Source` for the `Ruleset`.", + "$ref": "Source" + }, + "createTime": { + "description": "Time the `Ruleset` was created.\n@OutputOnly", + "type": "string", + "format": "google-datetime" + }, + "name": { + "description": "Name of the `Ruleset`. The ruleset_id is auto generated by the service.\nFormat: `projects/{project_id}/rulesets/{ruleset_id}`\n@OutputOnly", + "type": "string" + } + }, + "id": "Ruleset" + }, + "ListReleasesResponse": { + "description": "The response for FirebaseRulesService.ListReleases.", + "type": "object", + "properties": { + "nextPageToken": { + "description": "The pagination token to retrieve the next page of results. If the value is\nempty, no further results remain.", + "type": "string" + }, + "releases": { + "description": "List of `Release` instances.", + "type": "array", + "items": { + "$ref": "Release" + } + } + }, + "id": "ListReleasesResponse" + }, + "ListRulesetsResponse": { + "description": "The response for FirebaseRulesService.ListRulesets", + "type": "object", + "properties": { + "rulesets": { + "description": "List of `Ruleset` instances.", + "type": "array", + "items": { + "$ref": "Ruleset" + } + }, + "nextPageToken": { + "description": "The pagination token to retrieve the next page of results. If the value is\nempty, no further results remain.", + "type": "string" + } + }, + "id": "ListRulesetsResponse" + }, + "Empty": { + "description": "A generic empty message that you can re-use to avoid defining duplicated\nempty messages in your APIs. A typical example is to use it as the request\nor the response type of an API method. For instance:\n\n service Foo {\n rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);\n }\n\nThe JSON representation for `Empty` is empty JSON object `{}`.", + "type": "object", + "properties": {}, + "id": "Empty" + }, + "File": { + "description": "`File` containing source content.", + "type": "object", + "properties": { + "content": { + "description": "Textual Content.", + "type": "string" + }, + "name": { + "description": "File name.", + "type": "string" + }, + "fingerprint": { + "description": "Fingerprint (e.g. github sha) associated with the `File`.", + "type": "string", + "format": "byte" + } + }, + "id": "File" + }, + "TestRulesetRequest": { + "description": "The request for FirebaseRulesService.TestRuleset.", + "type": "object", + "properties": { + "source": { + "description": "`Source` to be checked for correctness.", + "$ref": "Source" + } + }, + "id": "TestRulesetRequest" + }, + "Issue": { + "description": "Issues include warnings, errors, and deprecation notices.", + "type": "object", + "properties": { + "description": { + "description": "Short error description.", + "type": "string" + }, + "severity": { + "description": "The severity of the issue.", + "enum": [ + "SEVERITY_UNSPECIFIED", + "DEPRECATION", + "WARNING", + "ERROR" + ], + "enumDescriptions": [ + "An unspecified severity.", + "Deprecation issue for statements and method that may no longer be\nsupported or maintained.", + "Warnings such as: unused variables.", + "Errors such as: unmatched curly braces or variable redefinition." + ], + "type": "string" + }, + "sourcePosition": { + "description": "Position of the issue in the `Source`.", + "$ref": "SourcePosition" + } + }, + "id": "Issue" + } + }, + "revision": "20161205", + "basePath": "", + "icons": { + "x32": "http://www.google.com/images/icons/product/search-32.gif", + "x16": "http://www.google.com/images/icons/product/search-16.gif" + }, + "version_module": "True", + "canonicalName": "Firebase Rules API", + "discoveryVersion": "v1", + "baseUrl": "https://firebaserules.googleapis.com/", + "name": "firebaserules", + "parameters": { + "access_token": { + "description": "OAuth access token.", + "type": "string", + "location": "query" + }, + "prettyPrint": { + "description": "Returns response with indentations and line breaks.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "key": { + "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", + "type": "string", + "location": "query" + }, + "quotaUser": { + "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.", + "type": "string", + "location": "query" + }, + "pp": { + "description": "Pretty-print response.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "fields": { + "description": "Selector specifying which fields to include in a partial response.", + "type": "string", + "location": "query" + }, + "alt": { + "description": "Data format for response.", + "location": "query", + "enum": [ + "json", + "media", + "proto" + ], + "default": "json", + "enumDescriptions": [ + "Responses with Content-Type of application/json", + "Media download with context-dependent Content-Type", + "Responses with Content-Type of application/x-protobuf" + ], + "type": "string" + }, + "$.xgafv": { + "description": "V1 error format.", + "enum": [ + "1", + "2" + ], + "enumDescriptions": [ + "v1 error format", + "v2 error format" + ], + "type": "string", + "location": "query" + }, + "callback": { + "description": "JSONP", + "type": "string", + "location": "query" + }, + "oauth_token": { + "description": "OAuth 2.0 token for the current user.", + "type": "string", + "location": "query" + }, + "uploadType": { + "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").", + "type": "string", + "location": "query" + }, + "bearer_token": { + "description": "OAuth bearer token.", + "type": "string", + "location": "query" + }, + "upload_protocol": { + "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").", + "type": "string", + "location": "query" + } + }, + "documentationLink": "https://firebase.google.com/docs/storage/security", + "ownerDomain": "google.com", + "batchPath": "batch", + "servicePath": "", + "ownerName": "Google", + "version": "v1", + "rootUrl": "https://firebaserules.googleapis.com/", + "kind": "discovery#restDescription" +} diff --git a/etc/api/fitness/v1/fitness-api.json b/etc/api/fitness/v1/fitness-api.json index 162d4687d6..2f19d42bf2 100644 --- a/etc/api/fitness/v1/fitness-api.json +++ b/etc/api/fitness/v1/fitness-api.json @@ -1,18 +1,18 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/C_efOoRNuMwDVzh1-1r-3k_wkJo\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/ijeguRXyVpN9uEUSOI4kjLGOD9E\"", "discoveryVersion": "v1", "id": "fitness:v1", "name": "fitness", "version": "v1", - "revision": "20160801", + "revision": "20161128", "title": "Fitness", "description": "Stores and accesses user data in the fitness store from apps on any platform.", "ownerDomain": "google.com", "ownerName": "Google", "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" }, "documentationLink": "https://developers.google.com/fit/rest/", "protocol": "rest", @@ -75,12 +75,30 @@ "https://www.googleapis.com/auth/fitness.activity.write": { "description": "View and store your activity information in Google Fit" }, + "https://www.googleapis.com/auth/fitness.blood_glucose.read": { + "description": "View blood glucose data in Google Fit" + }, + "https://www.googleapis.com/auth/fitness.blood_glucose.write": { + "description": "View and store blood glucose data in Google Fit" + }, + "https://www.googleapis.com/auth/fitness.blood_pressure.read": { + "description": "View blood pressure data in Google Fit" + }, + "https://www.googleapis.com/auth/fitness.blood_pressure.write": { + "description": "View and store blood pressure data in Google Fit" + }, "https://www.googleapis.com/auth/fitness.body.read": { "description": "View body sensor information in Google Fit" }, "https://www.googleapis.com/auth/fitness.body.write": { "description": "View and store body sensor data in Google Fit" }, + "https://www.googleapis.com/auth/fitness.body_temperature.read": { + "description": "View body temperature data in Google Fit" + }, + "https://www.googleapis.com/auth/fitness.body_temperature.write": { + "description": "View and store body temperature data in Google Fit" + }, "https://www.googleapis.com/auth/fitness.location.read": { "description": "View your stored location data in Google Fit" }, @@ -92,6 +110,18 @@ }, "https://www.googleapis.com/auth/fitness.nutrition.write": { "description": "View and store nutrition information in Google Fit" + }, + "https://www.googleapis.com/auth/fitness.oxygen_saturation.read": { + "description": "View oxygen saturation data in Google Fit" + }, + "https://www.googleapis.com/auth/fitness.oxygen_saturation.write": { + "description": "View and store oxygen saturation data in Google Fit" + }, + "https://www.googleapis.com/auth/fitness.reproductive_health.read": { + "description": "View reproductive health data in Google Fit" + }, + "https://www.googleapis.com/auth/fitness.reproductive_health.write": { + "description": "View and store reproductive health data in Google Fit" } } } @@ -165,6 +195,7 @@ "AggregateRequest": { "id": "AggregateRequest", "type": "object", + "description": "Next id: 10", "properties": { "aggregateBy": { "type": "array", @@ -756,6 +787,10 @@ "$ref": "Session" } }, + "hasMoreData": { + "type": "boolean", + "description": "Flag to indicate server has more data to transfer" + }, "nextPageToken": { "type": "string", "description": "The continuation token, which is used to page through large result sets. Provide this value in a subsequent request to return the next page of results." @@ -862,7 +897,7 @@ "Value": { "id": "Value", "type": "object", - "description": "Holder object for the value of a single field in a data point.\n\nA field value has a particular format and is only ever set to one of an integer or a floating point value.", + "description": "Holder object for the value of a single field in a data point.\n\nA field value has a particular format and is only ever set to one of an integer or a floating point value. LINT.IfChange", "properties": { "fpVal": { "type": "number", @@ -929,9 +964,14 @@ }, "scopes": [ "https://www.googleapis.com/auth/fitness.activity.write", + "https://www.googleapis.com/auth/fitness.blood_glucose.write", + "https://www.googleapis.com/auth/fitness.blood_pressure.write", "https://www.googleapis.com/auth/fitness.body.write", + "https://www.googleapis.com/auth/fitness.body_temperature.write", "https://www.googleapis.com/auth/fitness.location.write", - "https://www.googleapis.com/auth/fitness.nutrition.write" + "https://www.googleapis.com/auth/fitness.nutrition.write", + "https://www.googleapis.com/auth/fitness.oxygen_saturation.write", + "https://www.googleapis.com/auth/fitness.reproductive_health.write" ] }, "delete": { @@ -962,9 +1002,14 @@ }, "scopes": [ "https://www.googleapis.com/auth/fitness.activity.write", + "https://www.googleapis.com/auth/fitness.blood_glucose.write", + "https://www.googleapis.com/auth/fitness.blood_pressure.write", "https://www.googleapis.com/auth/fitness.body.write", + "https://www.googleapis.com/auth/fitness.body_temperature.write", "https://www.googleapis.com/auth/fitness.location.write", - "https://www.googleapis.com/auth/fitness.nutrition.write" + "https://www.googleapis.com/auth/fitness.nutrition.write", + "https://www.googleapis.com/auth/fitness.oxygen_saturation.write", + "https://www.googleapis.com/auth/fitness.reproductive_health.write" ] }, "get": { @@ -996,12 +1041,22 @@ "scopes": [ "https://www.googleapis.com/auth/fitness.activity.read", "https://www.googleapis.com/auth/fitness.activity.write", + "https://www.googleapis.com/auth/fitness.blood_glucose.read", + "https://www.googleapis.com/auth/fitness.blood_glucose.write", + "https://www.googleapis.com/auth/fitness.blood_pressure.read", + "https://www.googleapis.com/auth/fitness.blood_pressure.write", "https://www.googleapis.com/auth/fitness.body.read", "https://www.googleapis.com/auth/fitness.body.write", + "https://www.googleapis.com/auth/fitness.body_temperature.read", + "https://www.googleapis.com/auth/fitness.body_temperature.write", "https://www.googleapis.com/auth/fitness.location.read", "https://www.googleapis.com/auth/fitness.location.write", "https://www.googleapis.com/auth/fitness.nutrition.read", - "https://www.googleapis.com/auth/fitness.nutrition.write" + "https://www.googleapis.com/auth/fitness.nutrition.write", + "https://www.googleapis.com/auth/fitness.oxygen_saturation.read", + "https://www.googleapis.com/auth/fitness.oxygen_saturation.write", + "https://www.googleapis.com/auth/fitness.reproductive_health.read", + "https://www.googleapis.com/auth/fitness.reproductive_health.write" ] }, "list": { @@ -1032,12 +1087,22 @@ "scopes": [ "https://www.googleapis.com/auth/fitness.activity.read", "https://www.googleapis.com/auth/fitness.activity.write", + "https://www.googleapis.com/auth/fitness.blood_glucose.read", + "https://www.googleapis.com/auth/fitness.blood_glucose.write", + "https://www.googleapis.com/auth/fitness.blood_pressure.read", + "https://www.googleapis.com/auth/fitness.blood_pressure.write", "https://www.googleapis.com/auth/fitness.body.read", "https://www.googleapis.com/auth/fitness.body.write", + "https://www.googleapis.com/auth/fitness.body_temperature.read", + "https://www.googleapis.com/auth/fitness.body_temperature.write", "https://www.googleapis.com/auth/fitness.location.read", "https://www.googleapis.com/auth/fitness.location.write", "https://www.googleapis.com/auth/fitness.nutrition.read", - "https://www.googleapis.com/auth/fitness.nutrition.write" + "https://www.googleapis.com/auth/fitness.nutrition.write", + "https://www.googleapis.com/auth/fitness.oxygen_saturation.read", + "https://www.googleapis.com/auth/fitness.oxygen_saturation.write", + "https://www.googleapis.com/auth/fitness.reproductive_health.read", + "https://www.googleapis.com/auth/fitness.reproductive_health.write" ] }, "patch": { @@ -1071,9 +1136,14 @@ }, "scopes": [ "https://www.googleapis.com/auth/fitness.activity.write", + "https://www.googleapis.com/auth/fitness.blood_glucose.write", + "https://www.googleapis.com/auth/fitness.blood_pressure.write", "https://www.googleapis.com/auth/fitness.body.write", + "https://www.googleapis.com/auth/fitness.body_temperature.write", "https://www.googleapis.com/auth/fitness.location.write", - "https://www.googleapis.com/auth/fitness.nutrition.write" + "https://www.googleapis.com/auth/fitness.nutrition.write", + "https://www.googleapis.com/auth/fitness.oxygen_saturation.write", + "https://www.googleapis.com/auth/fitness.reproductive_health.write" ] }, "update": { @@ -1107,9 +1177,14 @@ }, "scopes": [ "https://www.googleapis.com/auth/fitness.activity.write", + "https://www.googleapis.com/auth/fitness.blood_glucose.write", + "https://www.googleapis.com/auth/fitness.blood_pressure.write", "https://www.googleapis.com/auth/fitness.body.write", + "https://www.googleapis.com/auth/fitness.body_temperature.write", "https://www.googleapis.com/auth/fitness.location.write", - "https://www.googleapis.com/auth/fitness.nutrition.write" + "https://www.googleapis.com/auth/fitness.nutrition.write", + "https://www.googleapis.com/auth/fitness.oxygen_saturation.write", + "https://www.googleapis.com/auth/fitness.reproductive_health.write" ] } }, @@ -1160,9 +1235,14 @@ ], "scopes": [ "https://www.googleapis.com/auth/fitness.activity.write", + "https://www.googleapis.com/auth/fitness.blood_glucose.write", + "https://www.googleapis.com/auth/fitness.blood_pressure.write", "https://www.googleapis.com/auth/fitness.body.write", + "https://www.googleapis.com/auth/fitness.body_temperature.write", "https://www.googleapis.com/auth/fitness.location.write", - "https://www.googleapis.com/auth/fitness.nutrition.write" + "https://www.googleapis.com/auth/fitness.nutrition.write", + "https://www.googleapis.com/auth/fitness.oxygen_saturation.write", + "https://www.googleapis.com/auth/fitness.reproductive_health.write" ] }, "get": { @@ -1212,12 +1292,22 @@ "scopes": [ "https://www.googleapis.com/auth/fitness.activity.read", "https://www.googleapis.com/auth/fitness.activity.write", + "https://www.googleapis.com/auth/fitness.blood_glucose.read", + "https://www.googleapis.com/auth/fitness.blood_glucose.write", + "https://www.googleapis.com/auth/fitness.blood_pressure.read", + "https://www.googleapis.com/auth/fitness.blood_pressure.write", "https://www.googleapis.com/auth/fitness.body.read", "https://www.googleapis.com/auth/fitness.body.write", + "https://www.googleapis.com/auth/fitness.body_temperature.read", + "https://www.googleapis.com/auth/fitness.body_temperature.write", "https://www.googleapis.com/auth/fitness.location.read", "https://www.googleapis.com/auth/fitness.location.write", "https://www.googleapis.com/auth/fitness.nutrition.read", - "https://www.googleapis.com/auth/fitness.nutrition.write" + "https://www.googleapis.com/auth/fitness.nutrition.write", + "https://www.googleapis.com/auth/fitness.oxygen_saturation.read", + "https://www.googleapis.com/auth/fitness.oxygen_saturation.write", + "https://www.googleapis.com/auth/fitness.reproductive_health.read", + "https://www.googleapis.com/auth/fitness.reproductive_health.write" ] }, "patch": { @@ -1264,9 +1354,14 @@ }, "scopes": [ "https://www.googleapis.com/auth/fitness.activity.write", + "https://www.googleapis.com/auth/fitness.blood_glucose.write", + "https://www.googleapis.com/auth/fitness.blood_pressure.write", "https://www.googleapis.com/auth/fitness.body.write", + "https://www.googleapis.com/auth/fitness.body_temperature.write", "https://www.googleapis.com/auth/fitness.location.write", - "https://www.googleapis.com/auth/fitness.nutrition.write" + "https://www.googleapis.com/auth/fitness.nutrition.write", + "https://www.googleapis.com/auth/fitness.oxygen_saturation.write", + "https://www.googleapis.com/auth/fitness.reproductive_health.write" ] } } @@ -1300,12 +1395,22 @@ "scopes": [ "https://www.googleapis.com/auth/fitness.activity.read", "https://www.googleapis.com/auth/fitness.activity.write", + "https://www.googleapis.com/auth/fitness.blood_glucose.read", + "https://www.googleapis.com/auth/fitness.blood_glucose.write", + "https://www.googleapis.com/auth/fitness.blood_pressure.read", + "https://www.googleapis.com/auth/fitness.blood_pressure.write", "https://www.googleapis.com/auth/fitness.body.read", "https://www.googleapis.com/auth/fitness.body.write", + "https://www.googleapis.com/auth/fitness.body_temperature.read", + "https://www.googleapis.com/auth/fitness.body_temperature.write", "https://www.googleapis.com/auth/fitness.location.read", "https://www.googleapis.com/auth/fitness.location.write", "https://www.googleapis.com/auth/fitness.nutrition.read", - "https://www.googleapis.com/auth/fitness.nutrition.write" + "https://www.googleapis.com/auth/fitness.nutrition.write", + "https://www.googleapis.com/auth/fitness.oxygen_saturation.read", + "https://www.googleapis.com/auth/fitness.oxygen_saturation.write", + "https://www.googleapis.com/auth/fitness.reproductive_health.read", + "https://www.googleapis.com/auth/fitness.reproductive_health.write" ] } } @@ -1387,12 +1492,22 @@ "scopes": [ "https://www.googleapis.com/auth/fitness.activity.read", "https://www.googleapis.com/auth/fitness.activity.write", + "https://www.googleapis.com/auth/fitness.blood_glucose.read", + "https://www.googleapis.com/auth/fitness.blood_glucose.write", + "https://www.googleapis.com/auth/fitness.blood_pressure.read", + "https://www.googleapis.com/auth/fitness.blood_pressure.write", "https://www.googleapis.com/auth/fitness.body.read", "https://www.googleapis.com/auth/fitness.body.write", + "https://www.googleapis.com/auth/fitness.body_temperature.read", + "https://www.googleapis.com/auth/fitness.body_temperature.write", "https://www.googleapis.com/auth/fitness.location.read", "https://www.googleapis.com/auth/fitness.location.write", "https://www.googleapis.com/auth/fitness.nutrition.read", - "https://www.googleapis.com/auth/fitness.nutrition.write" + "https://www.googleapis.com/auth/fitness.nutrition.write", + "https://www.googleapis.com/auth/fitness.oxygen_saturation.read", + "https://www.googleapis.com/auth/fitness.oxygen_saturation.write", + "https://www.googleapis.com/auth/fitness.reproductive_health.read", + "https://www.googleapis.com/auth/fitness.reproductive_health.write" ] }, "update": { diff --git a/etc/api/fusiontables/v1/fusiontables-api.json b/etc/api/fusiontables/v1/fusiontables-api.json index 297c671b57..7c4ea6718c 100644 --- a/etc/api/fusiontables/v1/fusiontables-api.json +++ b/etc/api/fusiontables/v1/fusiontables-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/-xDlQ3Z80n_rfxYaz7dDf-mP00c\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/0FCdL0BWEx8yMtZQU6marCZhfgI\"", "discoveryVersion": "v1", "id": "fusiontables:v1", "name": "fusiontables", @@ -11,8 +11,8 @@ "ownerDomain": "google.com", "ownerName": "Google", "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" }, "documentationLink": "https://developers.google.com/fusiontables", "protocol": "rest", diff --git a/etc/api/fusiontables/v2/fusiontables-api.json b/etc/api/fusiontables/v2/fusiontables-api.json index a6a31356a2..1d198175a5 100644 --- a/etc/api/fusiontables/v2/fusiontables-api.json +++ b/etc/api/fusiontables/v2/fusiontables-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/kDVOG_nLeWEXUFYsMAXo19Rc6tI\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/QkjGIRroDT5nHgu1Wy3bp0C7GqA\"", "discoveryVersion": "v1", "id": "fusiontables:v2", "name": "fusiontables", @@ -11,8 +11,8 @@ "ownerDomain": "google.com", "ownerName": "Google", "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" }, "documentationLink": "https://developers.google.com/fusiontables", "protocol": "rest", diff --git a/etc/api/games/v1/games-api.json b/etc/api/games/v1/games-api.json index 40d25f68f8..ab8ac6d7e5 100644 --- a/etc/api/games/v1/games-api.json +++ b/etc/api/games/v1/games-api.json @@ -1,19 +1,19 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/L-Wk4BXhe_pdw7ImRg3HloxNFiA\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/di4Um_ykilUe3tcpJDyVB0T7e64\"", "discoveryVersion": "v1", "id": "games:v1", "name": "games", "canonicalName": "Games", "version": "v1", - "revision": "20160901", + "revision": "20161207", "title": "Google Play Game Services API", "description": "The API for Google Play Game Services.", "ownerDomain": "google.com", "ownerName": "Google", "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" }, "documentationLink": "https://developers.google.com/games/services/", "protocol": "rest", diff --git a/etc/api/gamesconfiguration/v1configuration/gamesconfiguration-api.json b/etc/api/gamesconfiguration/v1configuration/gamesconfiguration-api.json index bfc96105d3..3f3c0e3559 100644 --- a/etc/api/gamesconfiguration/v1configuration/gamesconfiguration-api.json +++ b/etc/api/gamesconfiguration/v1configuration/gamesconfiguration-api.json @@ -1,19 +1,19 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/o78OyoeLvLsQCM448N-aWjOFcbY\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/xMP3-t2S3m8oLMTQw_TGyMQw30Y\"", "discoveryVersion": "v1", "id": "gamesConfiguration:v1configuration", "name": "gamesConfiguration", "canonicalName": "Games Configuration", "version": "v1configuration", - "revision": "20160901", + "revision": "20161207", "title": "Google Play Game Services Publishing API", "description": "The Publishing API for Google Play Game Services.", "ownerDomain": "google.com", "ownerName": "Google", "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" }, "documentationLink": "https://developers.google.com/games/services", "protocol": "rest", diff --git a/etc/api/gamesmanagement/v1management/gamesmanagement-api.json b/etc/api/gamesmanagement/v1management/gamesmanagement-api.json index eaf2c28c9b..0ea9ea943d 100644 --- a/etc/api/gamesmanagement/v1management/gamesmanagement-api.json +++ b/etc/api/gamesmanagement/v1management/gamesmanagement-api.json @@ -1,19 +1,19 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/qREjEbusb3dopi2k7gxmwND6yjQ\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/YwPBC4iYbpIMphCGliTYOBhrujY\"", "discoveryVersion": "v1", "id": "gamesManagement:v1management", "name": "gamesManagement", "canonicalName": "Games Management", "version": "v1management", - "revision": "20160901", + "revision": "20161207", "title": "Google Play Game Services Management API", "description": "The Management API for Google Play Game Services.", "ownerDomain": "google.com", "ownerName": "Google", "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" }, "documentationLink": "https://developers.google.com/games/services", "protocol": "rest", diff --git a/etc/api/genomics/v1/genomics-api.json b/etc/api/genomics/v1/genomics-api.json index 30a2cc44ed..6a520f355d 100644 --- a/etc/api/genomics/v1/genomics-api.json +++ b/etc/api/genomics/v1/genomics-api.json @@ -1,11 +1,11 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/eElt1TJDnW0IokCJ9H0sGXTCyq0\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/jo14IJ9oMjJmju16_ICU62ty30c\"", "discoveryVersion": "v1", "id": "genomics:v1", "name": "genomics", "version": "v1", - "revision": "20160905", + "revision": "20160928", "title": "Genomics API", "description": "Stores, processes, explores and shares genomic data.", "ownerDomain": "google.com", @@ -750,6 +750,24 @@ } } }, + "ListOperationsResponse": { + "id": "ListOperationsResponse", + "type": "object", + "description": "The response message for Operations.ListOperations.", + "properties": { + "operations": { + "type": "array", + "description": "A list of operations that matches the specified filter in the request.", + "items": { + "$ref": "Operation" + } + }, + "nextPageToken": { + "type": "string", + "description": "The standard List next-page token." + } + } + }, "Operation": { "id": "Operation", "type": "object", @@ -773,7 +791,7 @@ }, "error": { "$ref": "Status", - "description": "The error result of the operation in case of failure." + "description": "The error result of the operation in case of failure or cancellation." }, "response": { "type": "object", @@ -785,24 +803,6 @@ } } }, - "ListOperationsResponse": { - "id": "ListOperationsResponse", - "type": "object", - "description": "The response message for Operations.ListOperations.", - "properties": { - "operations": { - "type": "array", - "description": "A list of operations that matches the specified filter in the request.", - "items": { - "$ref": "Operation" - } - }, - "nextPageToken": { - "type": "string", - "description": "The standard List next-page token." - } - } - }, "CancelOperationRequest": { "id": "CancelOperationRequest", "type": "object", @@ -2244,7 +2244,7 @@ }, "clientId": { "type": "string", - "description": "Optionally provided by the caller when submitting the request that creates the operation." + "description": "This field is deprecated. Use `labels` instead. Optionally provided by the caller when submitting the request that creates the operation." }, "runtimeMetadata": { "type": "object", @@ -2253,6 +2253,13 @@ "type": "any", "description": "Properties of the object. Contains field @type with type URL." } + }, + "labels": { + "type": "object", + "description": "Optionally provided by the caller when submitting the request that creates the operation.", + "additionalProperties": { + "type": "string" + } } } }, @@ -2734,7 +2741,7 @@ "type": "string", "description": "REQUIRED: The resource for which policy is being specified. Format is `datasets/`.", "required": true, - "pattern": "^datasets/[^/]*$", + "pattern": "^datasets/[^/]+$", "location": "path" } }, @@ -2762,7 +2769,7 @@ "type": "string", "description": "REQUIRED: The resource for which policy is being specified. Format is `datasets/`.", "required": true, - "pattern": "^datasets/[^/]*$", + "pattern": "^datasets/[^/]+$", "location": "path" } }, @@ -2790,7 +2797,7 @@ "type": "string", "description": "REQUIRED: The resource for which policy is being specified. Format is `datasets/`.", "required": true, - "pattern": "^datasets/[^/]*$", + "pattern": "^datasets/[^/]+$", "location": "path" } }, @@ -2812,31 +2819,6 @@ }, "operations": { "methods": { - "get": { - "id": "genomics.operations.get", - "path": "v1/{+name}", - "httpMethod": "GET", - "description": "Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.", - "parameters": { - "name": { - "type": "string", - "description": "The name of the operation resource.", - "required": true, - "pattern": "^operations/.*$", - "location": "path" - } - }, - "parameterOrder": [ - "name" - ], - "response": { - "$ref": "Operation" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/genomics" - ] - }, "list": { "id": "genomics.operations.list", "path": "v1/{+name}", @@ -2852,7 +2834,7 @@ }, "filter": { "type": "string", - "description": "A string for filtering Operations. The following filter fields are supported: * projectId: Required. Corresponds to OperationMetadata.projectId. * createTime: The time this job was created, in seconds from the [epoch](http://en.wikipedia.org/wiki/Unix_time). Can use `\u003e=` and/or `= 1432140000` * `projectId = my-project AND createTime \u003e= 1432140000 AND createTime \u003c= 1432150000 AND status = RUNNING`", + "description": "A string for filtering Operations. The following filter fields are supported: * projectId: Required. Corresponds to OperationMetadata.projectId. * createTime: The time this job was created, in seconds from the [epoch](http://en.wikipedia.org/wiki/Unix_time). Can use `\u003e=` and/or `= 1432140000` * `projectId = my-project AND createTime \u003e= 1432140000 AND createTime \u003c= 1432150000 AND status = RUNNING` * `projectId = my-project AND labels.color = *` * `projectId = my-project AND labels.color = red`", "location": "query" }, "pageSize": { @@ -2878,6 +2860,31 @@ "https://www.googleapis.com/auth/genomics" ] }, + "get": { + "id": "genomics.operations.get", + "path": "v1/{+name}", + "httpMethod": "GET", + "description": "Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.", + "parameters": { + "name": { + "type": "string", + "description": "The name of the operation resource.", + "required": true, + "pattern": "^operations/.+$", + "location": "path" + } + }, + "parameterOrder": [ + "name" + ], + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/genomics" + ] + }, "cancel": { "id": "genomics.operations.cancel", "path": "v1/{+name}:cancel", @@ -2888,7 +2895,7 @@ "type": "string", "description": "The name of the operation resource to be cancelled.", "required": true, - "pattern": "^operations/.*$", + "pattern": "^operations/.+$", "location": "path" } }, diff --git a/etc/api/genomics/v1alpha2/genomics-api.json b/etc/api/genomics/v1alpha2/genomics-api.json index 5c92aaa303..c7567f8aa9 100644 --- a/etc/api/genomics/v1alpha2/genomics-api.json +++ b/etc/api/genomics/v1alpha2/genomics-api.json @@ -1,11 +1,11 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/W87lVft6jezJJo2WLSMnHm7oS64\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/sdWGjK18RRF0Jy_-SVhZDih5U4M\"", "discoveryVersion": "v1", "id": "genomics:v1alpha2", "name": "genomics", "version": "v1alpha2", - "revision": "20160905", + "revision": "20160928", "title": "Genomics API", "description": "Stores, processes, explores and shares genomic data.", "ownerDomain": "google.com", @@ -116,6 +116,24 @@ } }, "schemas": { + "ListOperationsResponse": { + "id": "ListOperationsResponse", + "type": "object", + "description": "The response message for Operations.ListOperations.", + "properties": { + "operations": { + "type": "array", + "description": "A list of operations that matches the specified filter in the request.", + "items": { + "$ref": "Operation" + } + }, + "nextPageToken": { + "type": "string", + "description": "The standard List next-page token." + } + } + }, "Operation": { "id": "Operation", "type": "object", @@ -139,7 +157,7 @@ }, "error": { "$ref": "Status", - "description": "The error result of the operation in case of failure." + "description": "The error result of the operation in case of failure or cancellation." }, "response": { "type": "object", @@ -178,24 +196,6 @@ } } }, - "ListOperationsResponse": { - "id": "ListOperationsResponse", - "type": "object", - "description": "The response message for Operations.ListOperations.", - "properties": { - "operations": { - "type": "array", - "description": "A list of operations that matches the specified filter in the request.", - "items": { - "$ref": "Operation" - } - }, - "nextPageToken": { - "type": "string", - "description": "The standard List next-page token." - } - } - }, "CancelOperationRequest": { "id": "CancelOperationRequest", "type": "object", @@ -296,11 +296,11 @@ "properties": { "imageName": { "type": "string", - "description": "Required. Image name from either Docker Hub or Google Container Repository. Users that run pipelines must have READ access to the image." + "description": "Required. Image name from either Docker Hub or Google Container Registry. Users that run pipelines must have READ access to the image." }, "cmd": { "type": "string", - "description": "Required. The command string to run. Parameters that do not have `localCopy` specified should be used as environment variables, while those that do can be accessed at the defined paths." + "description": "Required. The command or newline delimited script to run. The command string will be executed within a bash shell. If the command exits with a non-zero exit code, output parameter de-localization will be skipped and the pipeline operation's `error` field will be populated. Maximum command string length is 16384." } } }, @@ -344,7 +344,7 @@ }, "noAddress": { "type": "boolean", - "description": "Whether to assign an external IP to the instance. Defaults to false. Corresponds to `--no_address` flag for [gcloud compute instances create] (https://cloud.google.com/sdk/gcloud/reference/compute/instances/create). In order to use this, must be true for both create time and run time. Cannot be true at run time if false at create time. ** Note: To use this option, your project must be in Google Access for Private IPs Early Access Program.**" + "description": "Whether to assign an external IP to the instance. This is an experimental feature that may go away. Defaults to false. Corresponds to `--no_address` flag for [gcloud compute instances create] (https://cloud.google.com/sdk/gcloud/reference/compute/instances/create). In order to use this, must be true for both create time and run time. Cannot be true at run time if false at create time. If you need to ssh into a private IP VM for debugging, you can ssh to a public VM and then ssh into the private VM's Internal IP. If noAddress is set, this pipeline run may only load docker images from Google Container Registry and not Docker Hub. ** Note: To use this option, your project must be in Google Access for Private IPs Early Access Program.**" } } }, @@ -438,7 +438,7 @@ }, "clientId": { "type": "string", - "description": "Client-specified pipeline operation identifier." + "description": "This field is deprecated. Use `labels` instead. Client-specified pipeline operation identifier." }, "resources": { "$ref": "PipelineResources", @@ -451,6 +451,13 @@ "keepVmAliveOnFailureDuration": { "type": "string", "description": "How long to keep the VM up after a failure (for example docker command failed, copying input or output files failed, etc). While the VM is up, one can ssh into the VM to debug. Default is 0; maximum allowed value is 1 day." + }, + "labels": { + "type": "object", + "description": "Labels to apply to this pipeline run. Labels will also be applied to compute resources (VM, disks) created by this pipeline run. When listing operations, operations can filtered by labels. Label keys may not be empty; label values may be empty. Non-empty labels must be 1-63 characters long, and comply with [RFC1035] (https://www.ietf.org/rfc/rfc1035.txt). Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.", + "additionalProperties": { + "type": "string" + } } } }, @@ -465,7 +472,7 @@ }, "scopes": { "type": "array", - "description": "List of scopes to be enabled for this service account on the pipeline virtual machine. The following scopes are automatically included: * https://www.googleapis.com/auth/genomics * https://www.googleapis.com/auth/compute * https://www.googleapis.com/auth/devstorage.full_control", + "description": "List of scopes to be enabled for this service account on the VM. The following scopes are automatically included: * https://www.googleapis.com/auth/compute * https://www.googleapis.com/auth/devstorage.full_control * https://www.googleapis.com/auth/genomics * https://www.googleapis.com/auth/logging.write * https://www.googleapis.com/auth/monitoring.write", "items": { "type": "string" } @@ -682,7 +689,7 @@ }, "clientId": { "type": "string", - "description": "Optionally provided by the caller when submitting the request that creates the operation." + "description": "This field is deprecated. Use `labels` instead. Optionally provided by the caller when submitting the request that creates the operation." }, "runtimeMetadata": { "type": "object", @@ -691,6 +698,13 @@ "type": "any", "description": "Properties of the object. Contains field @type with type URL." } + }, + "labels": { + "type": "object", + "description": "Optionally provided by the caller when submitting the request that creates the operation.", + "additionalProperties": { + "type": "string" + } } } }, @@ -754,31 +768,6 @@ "resources": { "operations": { "methods": { - "get": { - "id": "genomics.operations.get", - "path": "v1alpha2/{+name}", - "httpMethod": "GET", - "description": "Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.", - "parameters": { - "name": { - "type": "string", - "description": "The name of the operation resource.", - "required": true, - "pattern": "^operations/.*$", - "location": "path" - } - }, - "parameterOrder": [ - "name" - ], - "response": { - "$ref": "Operation" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/genomics" - ] - }, "list": { "id": "genomics.operations.list", "path": "v1alpha2/{+name}", @@ -794,7 +783,7 @@ }, "filter": { "type": "string", - "description": "A string for filtering Operations. The following filter fields are supported: * projectId: Required. Corresponds to OperationMetadata.projectId. * createTime: The time this job was created, in seconds from the [epoch](http://en.wikipedia.org/wiki/Unix_time). Can use `\u003e=` and/or `= 1432140000` * `projectId = my-project AND createTime \u003e= 1432140000 AND createTime \u003c= 1432150000 AND status = RUNNING`", + "description": "A string for filtering Operations. The following filter fields are supported: * projectId: Required. Corresponds to OperationMetadata.projectId. * createTime: The time this job was created, in seconds from the [epoch](http://en.wikipedia.org/wiki/Unix_time). Can use `\u003e=` and/or `= 1432140000` * `projectId = my-project AND createTime \u003e= 1432140000 AND createTime \u003c= 1432150000 AND status = RUNNING` * `projectId = my-project AND labels.color = *` * `projectId = my-project AND labels.color = red`", "location": "query" }, "pageSize": { @@ -820,6 +809,31 @@ "https://www.googleapis.com/auth/genomics" ] }, + "get": { + "id": "genomics.operations.get", + "path": "v1alpha2/{+name}", + "httpMethod": "GET", + "description": "Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.", + "parameters": { + "name": { + "type": "string", + "description": "The name of the operation resource.", + "required": true, + "pattern": "^operations/.+$", + "location": "path" + } + }, + "parameterOrder": [ + "name" + ], + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/genomics" + ] + }, "cancel": { "id": "genomics.operations.cancel", "path": "v1alpha2/{+name}:cancel", @@ -830,7 +844,7 @@ "type": "string", "description": "The name of the operation resource to be cancelled.", "required": true, - "pattern": "^operations/.*$", + "pattern": "^operations/.+$", "location": "path" } }, diff --git a/etc/api/gmail/v1/gmail-api.json b/etc/api/gmail/v1/gmail-api.json index b31e0f5dc3..6941d50511 100644 --- a/etc/api/gmail/v1/gmail-api.json +++ b/etc/api/gmail/v1/gmail-api.json @@ -1,11 +1,11 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/c9szhoCXYrKaLKrzYGmZhJZBHUc\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/p_Ki8ZAiDCpzN2N5osErTV2szew\"", "discoveryVersion": "v1", "id": "gmail:v1", "name": "gmail", "version": "v1", - "revision": "20160711", + "revision": "20161206", "title": "Gmail API", "description": "Access Gmail mailboxes including sending user email.", "ownerDomain": "google.com", @@ -81,6 +81,9 @@ "https://www.googleapis.com/auth/gmail.labels": { "description": "Manage mailbox labels" }, + "https://www.googleapis.com/auth/gmail.metadata": { + "description": "View your email message metadata such as labels and headers, but not the email body" + }, "https://www.googleapis.com/auth/gmail.modify": { "description": "View and modify but not delete your email" }, @@ -146,6 +149,33 @@ } } }, + "BatchModifyMessagesRequest": { + "id": "BatchModifyMessagesRequest", + "type": "object", + "properties": { + "addLabelIds": { + "type": "array", + "description": "A list of label IDs to add to messages.", + "items": { + "type": "string" + } + }, + "ids": { + "type": "array", + "description": "The IDs of the messages to modify. There is a limit of 1000 ids per request.", + "items": { + "type": "string" + } + }, + "removeLabelIds": { + "type": "array", + "description": "A list of label IDs to remove from messages.", + "items": { + "type": "string" + } + } + } + }, "Draft": { "id": "Draft", "type": "object", @@ -767,12 +797,12 @@ }, "data": { "type": "string", - "description": "The body data of a MIME message part. May be empty for MIME container types that have no message body or when the body data is sent as a separate attachment. An attachment ID is present if the body data is contained in a separate attachment.", + "description": "The body data of a MIME message part as a base64url encoded string. May be empty for MIME container types that have no message body or when the body data is sent as a separate attachment. An attachment ID is present if the body data is contained in a separate attachment.", "format": "byte" }, "size": { "type": "integer", - "description": "Total number of bytes in the body of the message part.", + "description": "Number of bytes for the message part data (encoding notwithstanding).", "format": "int32" } } @@ -901,7 +931,7 @@ "SendAs": { "id": "SendAs", "type": "object", - "description": "Settings associated with a send-as alias, which can be either the primary login address associated with the account or a custom \"from\" address. Send-as aliases correspond to the \"Send Mail As\" feature in the web interface. See for more details.", + "description": "Settings associated with a send-as alias, which can be either the primary login address associated with the account or a custom \"from\" address. Send-as aliases correspond to the \"Send Mail As\" feature in the web interface.", "properties": { "displayName": { "type": "string", @@ -933,7 +963,7 @@ }, "treatAsAlias": { "type": "boolean", - "description": "Whether Gmail should treat this address as an alias for the user's primary email address. See for more details. This setting only applies to custom \"from\" aliases." + "description": "Whether Gmail should treat this address as an alias for the user's primary email address. This setting only applies to custom \"from\" aliases." }, "verificationStatus": { "type": "string", @@ -1021,7 +1051,7 @@ "VacationSettings": { "id": "VacationSettings", "type": "object", - "description": "Vacation auto-reply settings for an account. These settings correspond to the \"Vacation responder\" feature in the web interface. See for more details.", + "description": "Vacation auto-reply settings for an account. These settings correspond to the \"Vacation responder\" feature in the web interface.", "properties": { "enableAutoReply": { "type": "boolean", @@ -1133,6 +1163,7 @@ "scopes": [ "https://mail.google.com/", "https://www.googleapis.com/auth/gmail.compose", + "https://www.googleapis.com/auth/gmail.metadata", "https://www.googleapis.com/auth/gmail.modify", "https://www.googleapis.com/auth/gmail.readonly" ] @@ -1156,6 +1187,7 @@ ], "scopes": [ "https://mail.google.com/", + "https://www.googleapis.com/auth/gmail.metadata", "https://www.googleapis.com/auth/gmail.modify", "https://www.googleapis.com/auth/gmail.readonly" ] @@ -1185,6 +1217,7 @@ }, "scopes": [ "https://mail.google.com/", + "https://www.googleapis.com/auth/gmail.metadata", "https://www.googleapis.com/auth/gmail.modify", "https://www.googleapis.com/auth/gmail.readonly" ] @@ -1519,6 +1552,7 @@ }, "scopes": [ "https://mail.google.com/", + "https://www.googleapis.com/auth/gmail.metadata", "https://www.googleapis.com/auth/gmail.modify", "https://www.googleapis.com/auth/gmail.readonly" ] @@ -1616,6 +1650,7 @@ "scopes": [ "https://mail.google.com/", "https://www.googleapis.com/auth/gmail.labels", + "https://www.googleapis.com/auth/gmail.metadata", "https://www.googleapis.com/auth/gmail.modify", "https://www.googleapis.com/auth/gmail.readonly" ] @@ -1643,6 +1678,7 @@ "scopes": [ "https://mail.google.com/", "https://www.googleapis.com/auth/gmail.labels", + "https://www.googleapis.com/auth/gmail.metadata", "https://www.googleapis.com/auth/gmail.modify", "https://www.googleapis.com/auth/gmail.readonly" ] @@ -1747,6 +1783,31 @@ "https://mail.google.com/" ] }, + "batchModify": { + "id": "gmail.users.messages.batchModify", + "path": "{userId}/messages/batchModify", + "httpMethod": "POST", + "description": "Modifies the labels on the specified messages.", + "parameters": { + "userId": { + "type": "string", + "description": "The user's email address. The special value me can be used to indicate the authenticated user.", + "default": "me", + "required": true, + "location": "path" + } + }, + "parameterOrder": [ + "userId" + ], + "request": { + "$ref": "BatchModifyMessagesRequest" + }, + "scopes": [ + "https://mail.google.com/", + "https://www.googleapis.com/auth/gmail.modify" + ] + }, "delete": { "id": "gmail.users.messages.delete", "path": "{userId}/messages/{id}", @@ -1828,6 +1889,7 @@ }, "scopes": [ "https://mail.google.com/", + "https://www.googleapis.com/auth/gmail.metadata", "https://www.googleapis.com/auth/gmail.modify", "https://www.googleapis.com/auth/gmail.readonly" ] @@ -2008,7 +2070,7 @@ }, "q": { "type": "string", - "description": "Only return messages matching the specified query. Supports the same query format as the Gmail search box. For example, \"from:someuser@example.com rfc822msgid: is:unread\".", + "description": "Only return messages matching the specified query. Supports the same query format as the Gmail search box. For example, \"from:someuser@example.com rfc822msgid: is:unread\". Parameter cannot be used when accessing the api using the gmail.metadata scope.", "location": "query" }, "userId": { @@ -2027,6 +2089,7 @@ }, "scopes": [ "https://mail.google.com/", + "https://www.googleapis.com/auth/gmail.metadata", "https://www.googleapis.com/auth/gmail.modify", "https://www.googleapis.com/auth/gmail.readonly" ] @@ -2986,6 +3049,7 @@ }, "scopes": [ "https://mail.google.com/", + "https://www.googleapis.com/auth/gmail.metadata", "https://www.googleapis.com/auth/gmail.modify", "https://www.googleapis.com/auth/gmail.readonly" ] @@ -3022,7 +3086,7 @@ }, "q": { "type": "string", - "description": "Only return threads matching the specified query. Supports the same query format as the Gmail search box. For example, \"from:someuser@example.com rfc822msgid: is:unread\".", + "description": "Only return threads matching the specified query. Supports the same query format as the Gmail search box. For example, \"from:someuser@example.com rfc822msgid: is:unread\". Parameter cannot be used when accessing the api using the gmail.metadata scope.", "location": "query" }, "userId": { @@ -3041,6 +3105,7 @@ }, "scopes": [ "https://mail.google.com/", + "https://www.googleapis.com/auth/gmail.metadata", "https://www.googleapis.com/auth/gmail.modify", "https://www.googleapis.com/auth/gmail.readonly" ] diff --git a/etc/api/groupsmigration/v1/groupsmigration-api.json b/etc/api/groupsmigration/v1/groupsmigration-api.json index 09374bb95a..4d1c092732 100644 --- a/etc/api/groupsmigration/v1/groupsmigration-api.json +++ b/etc/api/groupsmigration/v1/groupsmigration-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/HWdr3QolTxcnkwueTlDTCxOXBdE\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/HWdr3QolTxcnkwueTlDTCxOXBdE\"", "discoveryVersion": "v1", "id": "groupsmigration:v1", "name": "groupsmigration", diff --git a/etc/api/groupssettings/v1/groupssettings-api.json b/etc/api/groupssettings/v1/groupssettings-api.json index 7108e0380e..a28e82b61b 100644 --- a/etc/api/groupssettings/v1/groupssettings-api.json +++ b/etc/api/groupssettings/v1/groupssettings-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/WmR-pRQA43Avmy6ShfhWJLW2ne8\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/26Y5Yyn2D8WwxhPa2zJyQ3Axz8I\"", "discoveryVersion": "v1", "id": "groupssettings:v1", "name": "groupssettings", @@ -11,8 +11,8 @@ "ownerDomain": "google.com", "ownerName": "Google", "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" }, "documentationLink": "https://developers.google.com/google-apps/groups-settings/get_started", "protocol": "rest", diff --git a/etc/api/iam/v1/iam-api.json b/etc/api/iam/v1/iam-api.json index dc13e3a48f..681a9645e0 100644 --- a/etc/api/iam/v1/iam-api.json +++ b/etc/api/iam/v1/iam-api.json @@ -1,12 +1,13 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/KGIJuBPLol6TqL9arf5YOmp-wQ0\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/bQX0iw41CX8vYvVm7WSKLdyxMvI\"", "discoveryVersion": "v1", "id": "iam:v1", "name": "iam", + "canonicalName": "iam", "version": "v1", - "revision": "20160129", - "title": "Google Identity and Access Management API", + "revision": "20160915", + "title": "Google Identity and Access Management (IAM) API", "description": "Manages identity and access control for Google Cloud Platform resources, including the creation of service accounts, which you can use to authenticate to Google and make API calls.", "ownerDomain": "google.com", "ownerName": "Google", @@ -125,18 +126,18 @@ }, "nextPageToken": { "type": "string", - "description": "To retrieve the next page of results, set [ListServiceAccountsRequest.page_token] to this value." + "description": "To retrieve the next page of results, set ListServiceAccountsRequest.page_token to this value." } } }, "ServiceAccount": { "id": "ServiceAccount", "type": "object", - "description": "A service account in the Identity and Access Management API. To create a service account, you specify the project_id and account_id for the account. The account_id is unique within the project, and used to generate the service account email address and a stable unique id. All other methods can identify accounts using the format \"projects/{project}/serviceAccounts/{account}\". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account.", + "description": "A service account in the Identity and Access Management API. To create a service account, specify the `project_id` and the `account_id` for the account. The `account_id` is unique within the project, and is used to generate the service account email address and a stable `unique_id`. If the account already exists, the account's resource name is returned in util::Status's ResourceInfo.resource_name in the format of projects/{project}/serviceAccounts/{email}. The caller can use the name in other methods to access the account. All other methods can identify the service account using the format `projects/{project}/serviceAccounts/{account}`. Using `-` as a wildcard for the project will infer the project from the account. The `account` value can be the `email` address or the `unique_id` of the service account.", "properties": { "name": { "type": "string", - "description": "The resource name of the service account in the format \"projects/{project}/serviceAccounts/{account}\". In requests using '-' as a wildcard for the project, will infer the project from the account and the account value can be the email address or the unique_id of the service account. In responses the resource name will always be in the format \"projects/{project}/serviceAccounts/{email}\"." + "description": "The resource name of the service account in the following format: `projects/{project}/serviceAccounts/{account}`. Requests using `-` as a wildcard for the project will infer the project from the `account` and the `account` value can be the `email` address or the `unique_id` of the service account. In responses the resource name will always be in the format `projects/{project}/serviceAccounts/{email}`." }, "projectId": { "type": "string", @@ -144,11 +145,11 @@ }, "uniqueId": { "type": "string", - "description": "@OutputOnly unique and stable id of the service account." + "description": "@OutputOnly The unique and stable id of the service account." }, "email": { "type": "string", - "description": "@OutputOnly Email address of the service account." + "description": "@OutputOnly The email address of the service account." }, "displayName": { "type": "string", @@ -172,11 +173,11 @@ "properties": { "accountId": { "type": "string", - "description": "Required. The account id that is used to generate the service account email address and a stable unique id. It is unique within a project, must be 1-63 characters long, and match the regular expression [a-z]([-a-z0-9]*[a-z0-9]) to comply with RFC1035." + "description": "Required. The account id that is used to generate the service account email address and a stable unique id. It is unique within a project, must be 6-30 characters long, and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])` to comply with RFC1035." }, "serviceAccount": { "$ref": "ServiceAccount", - "description": "The ServiceAccount resource to create. Currently, only the following values are user assignable: display_name ." + "description": "The ServiceAccount resource to create. Currently, only the following values are user assignable: `display_name` ." } } }, @@ -202,24 +203,38 @@ "ServiceAccountKey": { "id": "ServiceAccountKey", "type": "object", - "description": "Represents a service account key. A service account can have 0 or more key pairs. The private keys for these are not stored by Google. ServiceAccountKeys are immutable.", + "description": "Represents a service account key. A service account has two sets of key-pairs: user-managed, and system-managed. User-managed key-pairs can be created and deleted by users. Users are responsible for rotating these keys periodically to ensure security of their service accounts. Users retain the private key of these key-pairs, and Google retains ONLY the public key. System-managed key-pairs are managed automatically by Google, and rotated daily without user intervention. The private key never leaves Google's servers to maximize security. Public keys for all service accounts are also published at the OAuth2 Service Account API.", "properties": { "name": { "type": "string", - "description": "The resource name of the service account key in the format \"projects/{project}/serviceAccounts/{email}/keys/{key}\"." + "description": "The resource name of the service account key in the following format `projects/{project}/serviceAccounts/{account}/keys/{key}`." }, "privateKeyType": { "type": "string", - "description": "The type of the private key.", + "description": "The output format for the private key. Only provided in `CreateServiceAccountKey` responses, not in `GetServiceAccountKey` or `ListServiceAccountKey` responses. Google never exposes system-managed private keys, and never retains user-managed private keys.", "enum": [ "TYPE_UNSPECIFIED", "TYPE_PKCS12_FILE", "TYPE_GOOGLE_CREDENTIALS_FILE" ] }, + "keyAlgorithm": { + "type": "string", + "description": "Specifies the algorithm (and possibly key size) for the key.", + "enum": [ + "KEY_ALG_UNSPECIFIED", + "KEY_ALG_RSA_1024", + "KEY_ALG_RSA_2048" + ] + }, "privateKeyData": { "type": "string", - "description": "The key data.", + "description": "The private key data. Only provided in `CreateServiceAccountKey` responses.", + "format": "byte" + }, + "publicKeyData": { + "type": "string", + "description": "The public key data. Only provided in `GetServiceAccountKey` responses.", "format": "byte" }, "validAfterTime": { @@ -239,12 +254,21 @@ "properties": { "privateKeyType": { "type": "string", - "description": "The type of the key requested. GOOGLE_CREDENTIALS is the default key type.", + "description": "The output format of the private key. `GOOGLE_CREDENTIALS_FILE` is the default output format.", "enum": [ "TYPE_UNSPECIFIED", "TYPE_PKCS12_FILE", "TYPE_GOOGLE_CREDENTIALS_FILE" ] + }, + "keyAlgorithm": { + "type": "string", + "description": "Which type of key and algorithm to use for the key. The default is currently a 4K RSA key. However this may change in the future.", + "enum": [ + "KEY_ALG_UNSPECIFIED", + "KEY_ALG_RSA_1024", + "KEY_ALG_RSA_2048" + ] } } }, @@ -255,7 +279,7 @@ "properties": { "bytesToSign": { "type": "string", - "description": "The bytes to sign", + "description": "The bytes to sign.", "format": "byte" } } @@ -279,7 +303,7 @@ "Policy": { "id": "Policy", "type": "object", - "description": "Defines an Identity and Access Management (IAM) policy. It is used to specify access control policies for Cloud Platform resources. A `Policy` consists of a list of `bindings`. A `Binding` binds a list of `members` to a `role`, where the members can be user accounts, Google groups, Google domains, and service accounts. A `role` is a named list of permissions defined by IAM. **Example** { \"bindings\": [ { \"role\": \"roles/owner\", \"members\": [ \"user:mike@example.com\", \"group:admins@example.com\", \"domain:google.com\", \"serviceAccount:my-other-app@appspot.gserviceaccount.com\"] }, { \"role\": \"roles/viewer\", \"members\": [\"user:sean@example.com\"] } ] } For a description of IAM and its features, see the [IAM developer's guide](https://cloud.google.com/iam).", + "description": "Defines an Identity and Access Management (IAM) policy. It is used to specify access control policies for Cloud Platform resources. A `Policy` consists of a list of `bindings`. A `Binding` binds a list of `members` to a `role`, where the members can be user accounts, Google groups, Google domains, and service accounts. A `role` is a named list of permissions defined by IAM. **Example** { \"bindings\": [ { \"role\": \"roles/owner\", \"members\": [ \"user:mike@example.com\", \"group:admins@example.com\", \"domain:google.com\", \"serviceAccount:my-other-app@appspot.gserviceaccount.com\", ] }, { \"role\": \"roles/viewer\", \"members\": [\"user:sean@example.com\"] } ] } For a description of IAM and its features, see the [IAM developer's guide](https://cloud.google.com/iam).", "properties": { "version": { "type": "integer", @@ -293,12 +317,6 @@ "$ref": "Binding" } }, - "rules": { - "type": "array", - "items": { - "$ref": "Rule" - } - }, "etag": { "type": "string", "description": "`etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other. It is strongly suggested that systems make use of the `etag` in the read-modify-write cycle to perform policy updates in order to avoid race conditions: An `etag` is returned in the response to `getIamPolicy`, and systems are expected to put that etag in the request to `setIamPolicy` to ensure that their change will be applied to the same version of the policy. If no `etag` is provided in the call to `setIamPolicy`, then the existing policy is overwritten blindly.", @@ -324,162 +342,6 @@ } } }, - "Rule": { - "id": "Rule", - "type": "object", - "description": "A rule to be applied in a Policy.", - "properties": { - "description": { - "type": "string", - "description": "Human-readable description of the rule." - }, - "permissions": { - "type": "array", - "description": "A permission is a string of form '..' (e.g., 'storage.buckets.list'). A value of '*' matches all permissions, and a verb part of '*' (e.g., 'storage.buckets.*') matches all verbs.", - "items": { - "type": "string" - } - }, - "action": { - "type": "string", - "description": "Required", - "enum": [ - "NO_ACTION", - "ALLOW", - "ALLOW_WITH_LOG", - "DENY", - "DENY_WITH_LOG", - "LOG" - ] - }, - "in": { - "type": "array", - "description": "The rule matches if the PRINCIPAL/AUTHORITY_SELECTOR is in this set of entries.", - "items": { - "type": "string" - } - }, - "notIn": { - "type": "array", - "description": "The rule matches if the PRINCIPAL/AUTHORITY_SELECTOR is not in this set of entries. The format for in and not_in entries is the same as for members in a Binding (see google/iam/v1/policy.proto).", - "items": { - "type": "string" - } - }, - "conditions": { - "type": "array", - "description": "Additional restrictions that must be met", - "items": { - "$ref": "Condition" - } - }, - "logConfig": { - "type": "array", - "description": "The config returned to callers of tech.iam.IAM.CheckPolicy for any entries that match the LOG action.", - "items": { - "$ref": "LogConfig" - } - } - } - }, - "Condition": { - "id": "Condition", - "type": "object", - "description": "A condition to be met.", - "properties": { - "iam": { - "type": "string", - "description": "Trusted attributes supplied by the IAM system.", - "enum": [ - "NO_ATTR", - "AUTHORITY", - "ATTRIBUTION" - ] - }, - "sys": { - "type": "string", - "description": "Trusted attributes supplied by any service that owns resources and uses the IAM system for access control.", - "enum": [ - "NO_ATTR", - "REGION", - "SERVICE", - "NAME", - "IP" - ] - }, - "svc": { - "type": "string", - "description": "Trusted attributes discharged by the service." - }, - "op": { - "type": "string", - "description": "An operator to apply the subject with.", - "enum": [ - "NO_OP", - "EQUALS", - "NOT_EQUALS", - "IN", - "NOT_IN", - "DISCHARGED" - ] - }, - "value": { - "type": "string", - "description": "The object of the condition. Exactly one of these must be set." - }, - "values": { - "type": "array", - "description": "The objects of the condition. This is mutually exclusive with 'value'.", - "items": { - "type": "string" - } - } - } - }, - "LogConfig": { - "id": "LogConfig", - "type": "object", - "description": "Specifies what kind of log the caller must write Increment a streamz counter with the specified metric and field names. Metric names should start with a '/', generally be lowercase-only, and end in \"_count\". Field names should not contain an initial slash. The actual exported metric names will have \"/iam/policy\" prepended. Field names correspond to IAM request parameters and field values are their respective values. At present only \"iam_principal\", corresponding to IAMContext.principal, is supported. Examples: counter { metric: \"/debug_access_count\" field: \"iam_principal\" } ==\u003e increment counter /iam/policy/backend_debug_access_count {iam_principal=[value of IAMContext.principal]} At this time we do not support: * multiple field names (though this may be supported in the future) * decrementing the counter * incrementing it by anything other than 1", - "properties": { - "counter": { - "$ref": "CounterOptions", - "description": "Counter options." - }, - "dataAccess": { - "$ref": "DataAccessOptions", - "description": "Data access options." - }, - "cloudAudit": { - "$ref": "CloudAuditOptions", - "description": "Cloud audit options." - } - } - }, - "CounterOptions": { - "id": "CounterOptions", - "type": "object", - "description": "Options for counters", - "properties": { - "metric": { - "type": "string", - "description": "The metric to update." - }, - "field": { - "type": "string", - "description": "The field value to attribute." - } - } - }, - "DataAccessOptions": { - "id": "DataAccessOptions", - "type": "object", - "description": "Write a Data Access (Gin) log" - }, - "CloudAuditOptions": { - "id": "CloudAuditOptions", - "type": "object", - "description": "Write a Cloud Audit log" - }, "SetIamPolicyRequest": { "id": "SetIamPolicyRequest", "type": "object", @@ -498,7 +360,7 @@ "properties": { "permissions": { "type": "array", - "description": "The set of permissions to check for the `resource`. Permissions with wildcards (such as '*' or 'storage.*') are not allowed. For more information see IAM Overview.", + "description": "The set of permissions to check for the `resource`. Permissions with wildcards (such as '*' or 'storage.*') are not allowed. For more information see [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).", "items": { "type": "string" } @@ -518,6 +380,99 @@ } } } + }, + "QueryGrantableRolesRequest": { + "id": "QueryGrantableRolesRequest", + "type": "object", + "description": "The grantable role query request.", + "properties": { + "fullResourceName": { + "type": "string", + "description": "Required. The full resource name to query from the list of grantable roles. The name follows the Google Cloud Platform resource format. For example, a Cloud Platform project with id `my-project` will be named `//cloudresourcemanager.googleapis.com/projects/my-project`." + } + } + }, + "QueryGrantableRolesResponse": { + "id": "QueryGrantableRolesResponse", + "type": "object", + "description": "The grantable role query response.", + "properties": { + "roles": { + "type": "array", + "description": "The list of matching roles.", + "items": { + "$ref": "Role" + } + } + } + }, + "Role": { + "id": "Role", + "type": "object", + "description": "A role in the Identity and Access Management API.", + "properties": { + "name": { + "type": "string", + "description": "The name of the role. When Role is used in CreateRole, the role name must not be set. When Role is used in output and other input such as UpdateRole, the role name is the complete path, e.g., roles/logging.viewer for curated roles and organizations/{organization-id}/roles/logging.viewer for custom roles." + }, + "title": { + "type": "string", + "description": "Optional. A human-readable title for the role. Typically this is limited to 100 UTF-8 bytes." + }, + "description": { + "type": "string", + "description": "Optional. A human-readable description for the role." + } + } + }, + "AuditData": { + "id": "AuditData", + "type": "object", + "description": "Audit log information specific to Cloud IAM. This message is serialized as an `Any` type in the `ServiceData` message of an `AuditLog` message.", + "properties": { + "policyDelta": { + "$ref": "PolicyDelta", + "description": "Policy delta between the original policy and the newly set policy." + } + } + }, + "PolicyDelta": { + "id": "PolicyDelta", + "type": "object", + "description": "The difference delta between two policies.", + "properties": { + "bindingDeltas": { + "type": "array", + "description": "The delta for Bindings between two policies.", + "items": { + "$ref": "BindingDelta" + } + } + } + }, + "BindingDelta": { + "id": "BindingDelta", + "type": "object", + "description": "One delta entry for Binding. Each individual change (only one member in each entry) to a binding will be a separate entry.", + "properties": { + "action": { + "type": "string", + "description": "The action that was performed on a Binding. Required", + "enum": [ + "ACTION_UNSPECIFIED", + "ADD", + "REMOVE" + ] + }, + "role": { + "type": "string", + "description": "Role that is assigned to `members`. For example, `roles/viewer`, `roles/editor`, or `roles/owner`. Required" + }, + "member": { + "type": "string", + "description": "A single identity requesting access for a Cloud Platform resource. Follows the same format of Binding.members. Required" + } + } } }, "resources": { @@ -529,24 +484,24 @@ "id": "iam.projects.serviceAccounts.list", "path": "v1/{+name}/serviceAccounts", "httpMethod": "GET", - "description": "Lists service accounts for a project.", + "description": "Lists ServiceAccounts for a project.", "parameters": { "name": { "type": "string", - "description": "Required. The resource name of the project associated with the service accounts, such as \"projects/123\"", + "description": "Required. The resource name of the project associated with the service accounts, such as `projects/my-project-123`.", "required": true, "pattern": "^projects/[^/]*$", "location": "path" }, "pageSize": { "type": "integer", - "description": "Optional limit on the number of service accounts to include in the response. Further accounts can subsequently be obtained by including the [ListServiceAccountsResponse.next_page_token] in a subsequent request.", + "description": "Optional limit on the number of service accounts to include in the response. Further accounts can subsequently be obtained by including the ListServiceAccountsResponse.next_page_token in a subsequent request.", "format": "int32", "location": "query" }, "pageToken": { "type": "string", - "description": "Optional pagination token returned in an earlier [ListServiceAccountsResponse.next_page_token].", + "description": "Optional pagination token returned in an earlier ListServiceAccountsResponse.next_page_token.", "location": "query" } }, @@ -564,11 +519,11 @@ "id": "iam.projects.serviceAccounts.get", "path": "v1/{+name}", "httpMethod": "GET", - "description": "Gets a ServiceAccount", + "description": "Gets a ServiceAccount.", "parameters": { "name": { "type": "string", - "description": "The resource name of the service account in the format \"projects/{project}/serviceAccounts/{account}\". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account.", + "description": "The resource name of the service account in the following format: `projects/{project}/serviceAccounts/{account}`. Using `-` as a wildcard for the project will infer the project from the account. The `account` value can be the `email` address or the `unique_id` of the service account.", "required": true, "pattern": "^projects/[^/]*/serviceAccounts/[^/]*$", "location": "path" @@ -588,11 +543,11 @@ "id": "iam.projects.serviceAccounts.create", "path": "v1/{+name}/serviceAccounts", "httpMethod": "POST", - "description": "Creates a service account and returns it.", + "description": "Creates a ServiceAccount and returns it.", "parameters": { "name": { "type": "string", - "description": "Required. The resource name of the project associated with the service accounts, such as \"projects/123\"", + "description": "Required. The resource name of the project associated with the service accounts, such as `projects/my-project-123`.", "required": true, "pattern": "^projects/[^/]*$", "location": "path" @@ -615,11 +570,11 @@ "id": "iam.projects.serviceAccounts.update", "path": "v1/{+name}", "httpMethod": "PUT", - "description": "Updates a service account. Currently, only the following fields are updatable: 'display_name' . The 'etag' is mandatory.", + "description": "Updates a ServiceAccount. Currently, only the following fields are updatable: `display_name` . The `etag` is mandatory.", "parameters": { "name": { "type": "string", - "description": "The resource name of the service account in the format \"projects/{project}/serviceAccounts/{account}\". In requests using '-' as a wildcard for the project, will infer the project from the account and the account value can be the email address or the unique_id of the service account. In responses the resource name will always be in the format \"projects/{project}/serviceAccounts/{email}\".", + "description": "The resource name of the service account in the following format: `projects/{project}/serviceAccounts/{account}`. Requests using `-` as a wildcard for the project will infer the project from the `account` and the `account` value can be the `email` address or the `unique_id` of the service account. In responses the resource name will always be in the format `projects/{project}/serviceAccounts/{email}`.", "required": true, "pattern": "^projects/[^/]*/serviceAccounts/[^/]*$", "location": "path" @@ -642,11 +597,11 @@ "id": "iam.projects.serviceAccounts.delete", "path": "v1/{+name}", "httpMethod": "DELETE", - "description": "Deletes a service acount.", + "description": "Deletes a ServiceAccount.", "parameters": { "name": { "type": "string", - "description": "The resource name of the service account in the format \"projects/{project}/serviceAccounts/{account}\". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account.", + "description": "The resource name of the service account in the following format: `projects/{project}/serviceAccounts/{account}`. Using `-` as a wildcard for the project will infer the project from the account. The `account` value can be the `email` address or the `unique_id` of the service account.", "required": true, "pattern": "^projects/[^/]*/serviceAccounts/[^/]*$", "location": "path" @@ -666,11 +621,11 @@ "id": "iam.projects.serviceAccounts.signBlob", "path": "v1/{+name}:signBlob", "httpMethod": "POST", - "description": "Signs a blob using a service account.", + "description": "Signs a blob using a service account's system-managed private key.", "parameters": { "name": { "type": "string", - "description": "The resource name of the service account in the format \"projects/{project}/serviceAccounts/{account}\". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account.", + "description": "The resource name of the service account in the following format: `projects/{project}/serviceAccounts/{account}`. Using `-` as a wildcard for the project will infer the project from the account. The `account` value can be the `email` address or the `unique_id` of the service account.", "required": true, "pattern": "^projects/[^/]*/serviceAccounts/[^/]*$", "location": "path" @@ -693,11 +648,11 @@ "id": "iam.projects.serviceAccounts.getIamPolicy", "path": "v1/{+resource}:getIamPolicy", "httpMethod": "POST", - "description": "Returns the IAM access control policy for specified IAM resource.", + "description": "Returns the IAM access control policy for a ServiceAccount.", "parameters": { "resource": { "type": "string", - "description": "REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation.", + "description": "REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path. For example, a Project resource is specified as `projects/{project}`.", "required": true, "pattern": "^projects/[^/]*/serviceAccounts/[^/]*$", "location": "path" @@ -717,11 +672,11 @@ "id": "iam.projects.serviceAccounts.setIamPolicy", "path": "v1/{+resource}:setIamPolicy", "httpMethod": "POST", - "description": "Sets the IAM access control policy for the specified IAM resource.", + "description": "Sets the IAM access control policy for a ServiceAccount.", "parameters": { "resource": { "type": "string", - "description": "REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `setIamPolicy` documentation.", + "description": "REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path. For example, a Project resource is specified as `projects/{project}`.", "required": true, "pattern": "^projects/[^/]*/serviceAccounts/[^/]*$", "location": "path" @@ -744,11 +699,11 @@ "id": "iam.projects.serviceAccounts.testIamPermissions", "path": "v1/{+resource}:testIamPermissions", "httpMethod": "POST", - "description": "Tests the specified permissions against the IAM access control policy for the specified IAM resource.", + "description": "Tests the specified permissions against the IAM access control policy for a ServiceAccount.", "parameters": { "resource": { "type": "string", - "description": "REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `testIamPermissions` documentation.", + "description": "REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path. For example, a Project resource is specified as `projects/{project}`.", "required": true, "pattern": "^projects/[^/]*/serviceAccounts/[^/]*$", "location": "path" @@ -775,18 +730,18 @@ "id": "iam.projects.serviceAccounts.keys.list", "path": "v1/{+name}/keys", "httpMethod": "GET", - "description": "Lists service account keys", + "description": "Lists ServiceAccountKeys.", "parameters": { "name": { "type": "string", - "description": "The resource name of the service account in the format \"projects/{project}/serviceAccounts/{account}\". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account.", + "description": "The resource name of the service account in the following format: `projects/{project}/serviceAccounts/{account}`. Using `-` as a wildcard for the project, will infer the project from the account. The `account` value can be the `email` address or the `unique_id` of the service account.", "required": true, "pattern": "^projects/[^/]*/serviceAccounts/[^/]*$", "location": "path" }, "keyTypes": { "type": "string", - "description": "The type of keys the user wants to list. If empty, all key types are included in the response. Duplicate key types are not allowed.", + "description": "Filters the types of keys the user wants to include in the list response. Duplicate key types are not allowed. If no key type is provided, all keys are returned.", "enum": [ "KEY_TYPE_UNSPECIFIED", "USER_MANAGED", @@ -814,10 +769,20 @@ "parameters": { "name": { "type": "string", - "description": "The resource name of the service account key in the format \"projects/{project}/serviceAccounts/{account}/keys/{key}\". Using '-' as a wildcard for the project will infer the project from the account. The account value can be the email address or the unique_id of the service account.", + "description": "The resource name of the service account key in the following format: `projects/{project}/serviceAccounts/{account}/keys/{key}`. Using `-` as a wildcard for the project will infer the project from the account. The `account` value can be the `email` address or the `unique_id` of the service account.", "required": true, "pattern": "^projects/[^/]*/serviceAccounts/[^/]*/keys/[^/]*$", "location": "path" + }, + "publicKeyType": { + "type": "string", + "description": "The output format of the public key requested. X509_PEM is the default output format.", + "enum": [ + "TYPE_NONE", + "TYPE_X509_PEM_FILE", + "TYPE_RAW_PUBLIC_KEY" + ], + "location": "query" } }, "parameterOrder": [ @@ -834,11 +799,11 @@ "id": "iam.projects.serviceAccounts.keys.create", "path": "v1/{+name}/keys", "httpMethod": "POST", - "description": "Creates a service account key and returns it.", + "description": "Creates a ServiceAccountKey and returns it.", "parameters": { "name": { "type": "string", - "description": "The resource name of the service account in the format \"projects/{project}/serviceAccounts/{account}\". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account.", + "description": "The resource name of the service account in the following format: `projects/{project}/serviceAccounts/{account}`. Using `-` as a wildcard for the project will infer the project from the account. The `account` value can be the `email` address or the `unique_id` of the service account.", "required": true, "pattern": "^projects/[^/]*/serviceAccounts/[^/]*$", "location": "path" @@ -861,11 +826,11 @@ "id": "iam.projects.serviceAccounts.keys.delete", "path": "v1/{+name}", "httpMethod": "DELETE", - "description": "Deletes a service account key.", + "description": "Deletes a ServiceAccountKey.", "parameters": { "name": { "type": "string", - "description": "The resource name of the service account key in the format \"projects/{project}/serviceAccounts/{account}/keys/{key}\". Using '-' as a wildcard for the project will infer the project from the account. The account value can be the email address or the unique_id of the service account.", + "description": "The resource name of the service account key in the following format: `projects/{project}/serviceAccounts/{account}/keys/{key}`. Using `-` as a wildcard for the project will infer the project from the account. The `account` value can be the `email` address or the `unique_id` of the service account.", "required": true, "pattern": "^projects/[^/]*/serviceAccounts/[^/]*/keys/[^/]*$", "location": "path" @@ -886,6 +851,25 @@ } } } + }, + "roles": { + "methods": { + "queryGrantableRoles": { + "id": "iam.roles.queryGrantableRoles", + "path": "v1/roles:queryGrantableRoles", + "httpMethod": "POST", + "description": "Queries roles that can be granted on a particular resource. A role is grantable if it can be used as the role in a binding for a policy for that resource.", + "request": { + "$ref": "QueryGrantableRolesRequest" + }, + "response": { + "$ref": "QueryGrantableRolesResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + } + } } } } diff --git a/etc/api/identitytoolkit/v3/identitytoolkit-api.json b/etc/api/identitytoolkit/v3/identitytoolkit-api.json index 8116f084da..dda7ad5985 100644 --- a/etc/api/identitytoolkit/v3/identitytoolkit-api.json +++ b/etc/api/identitytoolkit/v3/identitytoolkit-api.json @@ -1,19 +1,19 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/hUSUQ1FCOLm-WaxWC_MbF3f27YE\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/9lrbPxfnfcTzLSOgIxD2Vj83GmI\"", "discoveryVersion": "v1", "id": "identitytoolkit:v3", "name": "identitytoolkit", "canonicalName": "Identity Toolkit", "version": "v3", - "revision": "20160812", + "revision": "20161206", "title": "Google Identity Toolkit API", "description": "Help the third party sites to implement federated login.", "ownerDomain": "google.com", "ownerName": "Google", "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" }, "documentationLink": "https://developers.google.com/identity-toolkit/v3/", "protocol": "rest", @@ -67,6 +67,18 @@ "location": "query" } }, + "auth": { + "oauth2": { + "scopes": { + "https://www.googleapis.com/auth/cloud-platform": { + "description": "View and manage your data across Google Cloud Platform services" + }, + "https://www.googleapis.com/auth/firebase": { + "description": "View and administer all your Firebase data and settings" + } + } + } + }, "schemas": { "CreateAuthUriResponse": { "id": "CreateAuthUriResponse", @@ -261,6 +273,14 @@ "type": "string", "description": "The URI to which the IDP redirects the user after the federated login flow." }, + "customParameter": { + "type": "object", + "description": "The query parameter that client can customize by themselves in auth url. The following parameters are reserved for server so that they cannot be customized by clients: client_id, response_type, scope, redirect_uri, state, oauth_token.", + "additionalProperties": { + "type": "string", + "description": "The customized query parameter." + } + }, "hostedDomain": { "type": "string", "description": "The hosted domain to restrict sign-in to accounts at that domain for Google Apps hosted accounts." @@ -333,6 +353,10 @@ "nextPageToken": { "type": "string", "description": "The token for the next page. This should be taken from the previous response." + }, + "targetProjectId": { + "type": "string", + "description": "Specify which project (field value is actually project id) to operate. Only used when provided credential." } } }, @@ -390,6 +414,9 @@ "$ref": "EmailTemplate", "description": "Change email template." }, + "dynamicLinksDomain": { + "type": "string" + }, "enableAnonymousUser": { "type": "boolean", "description": "Whether anonymous user is enabled." @@ -666,6 +693,10 @@ "type": "string", "description": "Response to the captcha." }, + "disabled": { + "type": "boolean", + "description": "Whether to disable the user. Only can be used by service account." + }, "displayName": { "type": "string", "description": "The name of the user." @@ -674,6 +705,10 @@ "type": "string", "description": "The email of the user." }, + "emailVerified": { + "type": "boolean", + "description": "Mark the email as verified or not. Only can be used by service account." + }, "idToken": { "type": "string", "description": "The GITKit token of the authenticated user." @@ -685,6 +720,10 @@ "password": { "type": "string", "description": "The new password of the user." + }, + "photoUrl": { + "type": "string", + "description": "The photo url of the user." } } }, @@ -693,6 +732,10 @@ "type": "object", "description": "Request to upload user account in batch.", "properties": { + "allowOverwrite": { + "type": "boolean", + "description": "Whether allow overwrite existing account when user local_id exists." + }, "delegatedProjectNumber": { "type": "string", "description": "GCP project number of the requesting delegated app. Currently only intended for Firebase V1 migration.", @@ -717,11 +760,19 @@ "description": "The salt separator.", "format": "byte" }, + "sanityCheck": { + "type": "boolean", + "description": "If true, backend will do sanity check(including duplicate email and federated id) when uploading account." + }, "signerKey": { "type": "string", "description": "The key for to hash the password.", "format": "byte" }, + "targetProjectId": { + "type": "string", + "description": "Specify which project (field value is actually project id) to operate. Only used when provided credential." + }, "users": { "type": "array", "description": "The account info to be stored.", @@ -929,12 +980,20 @@ "properties": { "email": { "type": "string", - "description": "The user's email." + "description": "The user's email. If the out-of-band code is for email recovery, the user's original email." }, "kind": { "type": "string", "description": "The fixed string \"identitytoolkit#ResetPasswordResponse\".", "default": "identitytoolkit#ResetPasswordResponse" + }, + "newEmail": { + "type": "string", + "description": "If the out-of-band code is for email recovery, the user's new email." + }, + "requestType": { + "type": "string", + "description": "The request type." } } }, @@ -1090,6 +1149,10 @@ "description": "User creation timestamp.", "format": "int64" }, + "customAuth": { + "type": "boolean", + "description": "Whether the user is authenticated by the developer." + }, "disabled": { "type": "boolean", "description": "Whether the user is disabled." @@ -1159,17 +1222,17 @@ "type": "string", "description": "User's raw identifier directly returned from IDP." }, - "rawUserInfo": { - "type": "string", - "description": "Raw IDP-returned user info." - }, "screenName": { "type": "string", - "description": "User's screen name at Twitter." + "description": "User's screen name at Twitter or login name at Github." } } } }, + "rawPassword": { + "type": "string", + "description": "The user's plain text password." + }, "salt": { "type": "string", "description": "The user's password salt.", @@ -1177,7 +1240,7 @@ }, "screenName": { "type": "string", - "description": "User's screen name at Twitter." + "description": "User's screen name at Twitter or login name at Github." }, "validSince": { "type": "string", @@ -1341,7 +1404,7 @@ }, "screenName": { "type": "string", - "description": "The screen_name of a Twitter user." + "description": "The screen_name of a Twitter user or the login name at Github." }, "timeZone": { "type": "string", @@ -1453,7 +1516,10 @@ }, "response": { "$ref": "CreateAuthUriResponse" - } + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] }, "deleteAccount": { "id": "identitytoolkit.relyingparty.deleteAccount", @@ -1465,7 +1531,10 @@ }, "response": { "$ref": "DeleteAccountResponse" - } + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] }, "downloadAccount": { "id": "identitytoolkit.relyingparty.downloadAccount", @@ -1477,7 +1546,11 @@ }, "response": { "$ref": "DownloadAccountResponse" - } + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/firebase" + ] }, "getAccountInfo": { "id": "identitytoolkit.relyingparty.getAccountInfo", @@ -1489,7 +1562,10 @@ }, "response": { "$ref": "GetAccountInfoResponse" - } + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] }, "getOobConfirmationCode": { "id": "identitytoolkit.relyingparty.getOobConfirmationCode", @@ -1501,7 +1577,10 @@ }, "response": { "$ref": "GetOobConfirmationCodeResponse" - } + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] }, "getProjectConfig": { "id": "identitytoolkit.relyingparty.getProjectConfig", @@ -1522,7 +1601,10 @@ }, "response": { "$ref": "IdentitytoolkitRelyingpartyGetProjectConfigResponse" - } + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] }, "getPublicKeys": { "id": "identitytoolkit.relyingparty.getPublicKeys", @@ -1531,7 +1613,10 @@ "description": "Get token signing public key.", "response": { "$ref": "IdentitytoolkitRelyingpartyGetPublicKeysResponse" - } + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] }, "getRecaptchaParam": { "id": "identitytoolkit.relyingparty.getRecaptchaParam", @@ -1540,7 +1625,10 @@ "description": "Get recaptcha secure param.", "response": { "$ref": "GetRecaptchaParamResponse" - } + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] }, "resetPassword": { "id": "identitytoolkit.relyingparty.resetPassword", @@ -1552,7 +1640,10 @@ }, "response": { "$ref": "ResetPasswordResponse" - } + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] }, "setAccountInfo": { "id": "identitytoolkit.relyingparty.setAccountInfo", @@ -1564,7 +1655,10 @@ }, "response": { "$ref": "SetAccountInfoResponse" - } + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] }, "setProjectConfig": { "id": "identitytoolkit.relyingparty.setProjectConfig", @@ -1576,7 +1670,10 @@ }, "response": { "$ref": "IdentitytoolkitRelyingpartySetProjectConfigResponse" - } + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] }, "signOutUser": { "id": "identitytoolkit.relyingparty.signOutUser", @@ -1588,7 +1685,10 @@ }, "response": { "$ref": "IdentitytoolkitRelyingpartySignOutUserResponse" - } + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] }, "signupNewUser": { "id": "identitytoolkit.relyingparty.signupNewUser", @@ -1600,7 +1700,10 @@ }, "response": { "$ref": "SignupNewUserResponse" - } + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] }, "uploadAccount": { "id": "identitytoolkit.relyingparty.uploadAccount", @@ -1612,7 +1715,11 @@ }, "response": { "$ref": "UploadAccountResponse" - } + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/firebase" + ] }, "verifyAssertion": { "id": "identitytoolkit.relyingparty.verifyAssertion", @@ -1624,7 +1731,10 @@ }, "response": { "$ref": "VerifyAssertionResponse" - } + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] }, "verifyCustomToken": { "id": "identitytoolkit.relyingparty.verifyCustomToken", @@ -1636,7 +1746,10 @@ }, "response": { "$ref": "VerifyCustomTokenResponse" - } + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] }, "verifyPassword": { "id": "identitytoolkit.relyingparty.verifyPassword", @@ -1648,7 +1761,10 @@ }, "response": { "$ref": "VerifyPasswordResponse" - } + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] } } } diff --git a/etc/api/kgsearch/v1/kgsearch-api.json b/etc/api/kgsearch/v1/kgsearch-api.json index 5750ca1396..f39764c0c4 100644 --- a/etc/api/kgsearch/v1/kgsearch-api.json +++ b/etc/api/kgsearch/v1/kgsearch-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/MyGIPHuwU0Ku04gaZJZTvYYLLEQ\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/MyGIPHuwU0Ku04gaZJZTvYYLLEQ\"", "discoveryVersion": "v1", "id": "kgsearch:v1", "name": "kgsearch", diff --git a/etc/api/language/v1/language-api.json b/etc/api/language/v1/language-api.json new file mode 100644 index 0000000000..2f5f087150 --- /dev/null +++ b/etc/api/language/v1/language-api.json @@ -0,0 +1,1085 @@ +{ + "id": "language:v1", + "auth": { + "oauth2": { + "scopes": { + "https://www.googleapis.com/auth/cloud-platform": { + "description": "View and manage your data across Google Cloud Platform services" + } + } + } + }, + "description": "Google Cloud Natural Language API provides natural language understanding technologies to developers. Examples include sentiment analysis, entity recognition, and text annotations.", + "protocol": "rest", + "title": "Google Cloud Natural Language API", + "resources": { + "documents": { + "methods": { + "analyzeSentiment": { + "id": "language.documents.analyzeSentiment", + "response": { + "$ref": "AnalyzeSentimentResponse" + }, + "parameterOrder": [], + "description": "Analyzes the sentiment of the provided text.", + "request": { + "$ref": "AnalyzeSentimentRequest" + }, + "flatPath": "v1/documents:analyzeSentiment", + "httpMethod": "POST", + "parameters": {}, + "path": "v1/documents:analyzeSentiment", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "analyzeSyntax": { + "id": "language.documents.analyzeSyntax", + "response": { + "$ref": "AnalyzeSyntaxResponse" + }, + "parameterOrder": [], + "description": "Analyzes the syntax of the text and provides sentence boundaries and\ntokenization along with part of speech tags, dependency trees, and other\nproperties.", + "request": { + "$ref": "AnalyzeSyntaxRequest" + }, + "flatPath": "v1/documents:analyzeSyntax", + "httpMethod": "POST", + "parameters": {}, + "path": "v1/documents:analyzeSyntax", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "annotateText": { + "id": "language.documents.annotateText", + "response": { + "$ref": "AnnotateTextResponse" + }, + "parameterOrder": [], + "description": "A convenience method that provides all the features that analyzeSentiment,\nanalyzeEntities, and analyzeSyntax provide in one call.", + "request": { + "$ref": "AnnotateTextRequest" + }, + "flatPath": "v1/documents:annotateText", + "httpMethod": "POST", + "parameters": {}, + "path": "v1/documents:annotateText", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "analyzeEntities": { + "id": "language.documents.analyzeEntities", + "response": { + "$ref": "AnalyzeEntitiesResponse" + }, + "parameterOrder": [], + "description": "Finds named entities (currently finds proper names) in the text,\nentity types, salience, mentions for each entity, and other properties.", + "request": { + "$ref": "AnalyzeEntitiesRequest" + }, + "flatPath": "v1/documents:analyzeEntities", + "httpMethod": "POST", + "parameters": {}, + "path": "v1/documents:analyzeEntities", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + } + } + } + }, + "schemas": { + "Document": { + "description": "################################################################ #\n\nRepresents the input to API methods.", + "type": "object", + "properties": { + "language": { + "description": "The language of the document (if not specified, the language is\nautomatically detected). Both ISO and BCP-47 language codes are\naccepted.\u003cbr\u003e\n**Current Language Restrictions:**\n\n * Only English, Spanish, and Japanese textual content are supported.\nIf the language (either specified by the caller or automatically detected)\nis not supported by the called API method, an `INVALID_ARGUMENT` error\nis returned.", + "type": "string" + }, + "gcsContentUri": { + "description": "The Google Cloud Storage URI where the file content is located.\nThis URI must be of the form: gs://bucket_name/object_name. For more\ndetails, see https://cloud.google.com/storage/docs/reference-uris.\nNOTE: Cloud Storage object versioning is not supported.", + "type": "string" + }, + "type": { + "description": "Required. If the type is not set or is `TYPE_UNSPECIFIED`,\nreturns an `INVALID_ARGUMENT` error.", + "enum": [ + "TYPE_UNSPECIFIED", + "PLAIN_TEXT", + "HTML" + ], + "enumDescriptions": [ + "The content type is not specified.", + "Plain text", + "HTML" + ], + "type": "string" + }, + "content": { + "description": "The content of the input in string format.", + "type": "string" + } + }, + "id": "Document" + }, + "TextSpan": { + "description": "Represents an output piece of text.", + "type": "object", + "properties": { + "beginOffset": { + "description": "The API calculates the beginning offset of the content in the original\ndocument according to the EncodingType specified in the API request.", + "type": "integer", + "format": "int32" + }, + "content": { + "description": "The content of the output text.", + "type": "string" + } + }, + "id": "TextSpan" + }, + "Status": { + "description": "The `Status` type defines a logical error model that is suitable for different\nprogramming environments, including REST APIs and RPC APIs. It is used by\n[gRPC](https://github.com/grpc). The error model is designed to be:\n\n- Simple to use and understand for most users\n- Flexible enough to meet unexpected needs\n\n# Overview\n\nThe `Status` message contains three pieces of data: error code, error message,\nand error details. The error code should be an enum value of\ngoogle.rpc.Code, but it may accept additional error codes if needed. The\nerror message should be a developer-facing English message that helps\ndevelopers *understand* and *resolve* the error. If a localized user-facing\nerror message is needed, put the localized message in the error details or\nlocalize it in the client. The optional error details may contain arbitrary\ninformation about the error. There is a predefined set of error detail types\nin the package `google.rpc` which can be used for common error conditions.\n\n# Language mapping\n\nThe `Status` message is the logical representation of the error model, but it\nis not necessarily the actual wire format. When the `Status` message is\nexposed in different client libraries and different wire protocols, it can be\nmapped differently. For example, it will likely be mapped to some exceptions\nin Java, but more likely mapped to some error codes in C.\n\n# Other uses\n\nThe error model and the `Status` message can be used in a variety of\nenvironments, either with or without APIs, to provide a\nconsistent developer experience across different environments.\n\nExample uses of this error model include:\n\n- Partial errors. If a service needs to return partial errors to the client,\n it may embed the `Status` in the normal response to indicate the partial\n errors.\n\n- Workflow errors. A typical workflow has multiple steps. Each step may\n have a `Status` message for error reporting purpose.\n\n- Batch operations. If a client uses batch request and batch response, the\n `Status` message should be used directly inside batch response, one for\n each error sub-response.\n\n- Asynchronous operations. If an API call embeds asynchronous operation\n results in its response, the status of those operations should be\n represented directly using the `Status` message.\n\n- Logging. If some API errors are stored in logs, the message `Status` could\n be used directly after any stripping needed for security/privacy reasons.", + "type": "object", + "properties": { + "code": { + "description": "The status code, which should be an enum value of google.rpc.Code.", + "type": "integer", + "format": "int32" + }, + "details": { + "description": "A list of messages that carry the error details. There will be a\ncommon set of message types for APIs to use.", + "type": "array", + "items": { + "additionalProperties": { + "description": "Properties of the object. Contains field @type with type URL.", + "type": "any" + }, + "type": "object" + } + }, + "message": { + "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\ngoogle.rpc.Status.details field, or localized by the client.", + "type": "string" + } + }, + "id": "Status" + }, + "AnalyzeEntitiesRequest": { + "description": "The entity analysis request message.", + "type": "object", + "properties": { + "document": { + "description": "Input document.", + "$ref": "Document" + }, + "encodingType": { + "description": "The encoding type used by the API to calculate offsets.", + "enum": [ + "NONE", + "UTF8", + "UTF16", + "UTF32" + ], + "enumDescriptions": [ + "If `EncodingType` is not specified, encoding-dependent information (such as\n`begin_offset`) will be set at `-1`.", + "Encoding-dependent information (such as `begin_offset`) is calculated based\non the UTF-8 encoding of the input. C++ and Go are examples of languages\nthat use this encoding natively.", + "Encoding-dependent information (such as `begin_offset`) is calculated based\non the UTF-16 encoding of the input. Java and Javascript are examples of\nlanguages that use this encoding natively.", + "Encoding-dependent information (such as `begin_offset`) is calculated based\non the UTF-32 encoding of the input. Python is an example of a language\nthat uses this encoding natively." + ], + "type": "string" + } + }, + "id": "AnalyzeEntitiesRequest" + }, + "EntityMention": { + "description": "Represents a mention for an entity in the text. Currently, proper noun\nmentions are supported.", + "type": "object", + "properties": { + "text": { + "description": "The mention text.", + "$ref": "TextSpan" + }, + "type": { + "description": "The type of the entity mention.", + "enum": [ + "TYPE_UNKNOWN", + "PROPER", + "COMMON" + ], + "enumDescriptions": [ + "Unknown", + "Proper name", + "Common noun (or noun compound)" + ], + "type": "string" + } + }, + "id": "EntityMention" + }, + "AnalyzeSentimentRequest": { + "description": "The sentiment analysis request message.", + "type": "object", + "properties": { + "document": { + "description": "Input document. Currently, `analyzeSentiment` only supports English text\n(Document.language=\"EN\").", + "$ref": "Document" + }, + "encodingType": { + "description": "The encoding type used by the API to calculate sentence offsets.", + "enum": [ + "NONE", + "UTF8", + "UTF16", + "UTF32" + ], + "enumDescriptions": [ + "If `EncodingType` is not specified, encoding-dependent information (such as\n`begin_offset`) will be set at `-1`.", + "Encoding-dependent information (such as `begin_offset`) is calculated based\non the UTF-8 encoding of the input. C++ and Go are examples of languages\nthat use this encoding natively.", + "Encoding-dependent information (such as `begin_offset`) is calculated based\non the UTF-16 encoding of the input. Java and Javascript are examples of\nlanguages that use this encoding natively.", + "Encoding-dependent information (such as `begin_offset`) is calculated based\non the UTF-32 encoding of the input. Python is an example of a language\nthat uses this encoding natively." + ], + "type": "string" + } + }, + "id": "AnalyzeSentimentRequest" + }, + "AnalyzeSentimentResponse": { + "description": "The sentiment analysis response message.", + "type": "object", + "properties": { + "documentSentiment": { + "description": "The overall sentiment of the input document.", + "$ref": "Sentiment" + }, + "language": { + "description": "The language of the text, which will be the same as the language specified\nin the request or, if not specified, the automatically-detected language.\nSee `Document.language` field for more details.", + "type": "string" + }, + "sentences": { + "description": "The sentiment for all the sentences in the document.", + "type": "array", + "items": { + "$ref": "Sentence" + } + } + }, + "id": "AnalyzeSentimentResponse" + }, + "AnalyzeSyntaxRequest": { + "description": "The syntax analysis request message.", + "type": "object", + "properties": { + "document": { + "description": "Input document.", + "$ref": "Document" + }, + "encodingType": { + "description": "The encoding type used by the API to calculate offsets.", + "enum": [ + "NONE", + "UTF8", + "UTF16", + "UTF32" + ], + "enumDescriptions": [ + "If `EncodingType` is not specified, encoding-dependent information (such as\n`begin_offset`) will be set at `-1`.", + "Encoding-dependent information (such as `begin_offset`) is calculated based\non the UTF-8 encoding of the input. C++ and Go are examples of languages\nthat use this encoding natively.", + "Encoding-dependent information (such as `begin_offset`) is calculated based\non the UTF-16 encoding of the input. Java and Javascript are examples of\nlanguages that use this encoding natively.", + "Encoding-dependent information (such as `begin_offset`) is calculated based\non the UTF-32 encoding of the input. Python is an example of a language\nthat uses this encoding natively." + ], + "type": "string" + } + }, + "id": "AnalyzeSyntaxRequest" + }, + "DependencyEdge": { + "description": "Represents dependency parse tree information for a token. (For more\ninformation on dependency labels, see\nhttp://www.aclweb.org/anthology/P13-2017", + "type": "object", + "properties": { + "headTokenIndex": { + "description": "Represents the head of this token in the dependency tree.\nThis is the index of the token which has an arc going to this token.\nThe index is the position of the token in the array of tokens returned\nby the API method. If this token is a root token, then the\n`head_token_index` is its own index.", + "type": "integer", + "format": "int32" + }, + "label": { + "description": "The parse label for the token.", + "enum": [ + "UNKNOWN", + "ABBREV", + "ACOMP", + "ADVCL", + "ADVMOD", + "AMOD", + "APPOS", + "ATTR", + "AUX", + "AUXPASS", + "CC", + "CCOMP", + "CONJ", + "CSUBJ", + "CSUBJPASS", + "DEP", + "DET", + "DISCOURSE", + "DOBJ", + "EXPL", + "GOESWITH", + "IOBJ", + "MARK", + "MWE", + "MWV", + "NEG", + "NN", + "NPADVMOD", + "NSUBJ", + "NSUBJPASS", + "NUM", + "NUMBER", + "P", + "PARATAXIS", + "PARTMOD", + "PCOMP", + "POBJ", + "POSS", + "POSTNEG", + "PRECOMP", + "PRECONJ", + "PREDET", + "PREF", + "PREP", + "PRONL", + "PRT", + "PS", + "QUANTMOD", + "RCMOD", + "RCMODREL", + "RDROP", + "REF", + "REMNANT", + "REPARANDUM", + "ROOT", + "SNUM", + "SUFF", + "TMOD", + "TOPIC", + "VMOD", + "VOCATIVE", + "XCOMP", + "SUFFIX", + "TITLE", + "ADVPHMOD", + "AUXCAUS", + "AUXVV", + "DTMOD", + "FOREIGN", + "KW", + "LIST", + "NOMC", + "NOMCSUBJ", + "NOMCSUBJPASS", + "NUMC", + "COP", + "DISLOCATED" + ], + "enumDescriptions": [ + "Unknown", + "Abbreviation modifier", + "Adjectival complement", + "Adverbial clause modifier", + "Adverbial modifier", + "Adjectival modifier of an NP", + "Appositional modifier of an NP", + "Attribute dependent of a copular verb", + "Auxiliary (non-main) verb", + "Passive auxiliary", + "Coordinating conjunction", + "Clausal complement of a verb or adjective", + "Conjunct", + "Clausal subject", + "Clausal passive subject", + "Dependency (unable to determine)", + "Determiner", + "Discourse", + "Direct object", + "Expletive", + "Goes with (part of a word in a text not well edited)", + "Indirect object", + "Marker (word introducing a subordinate clause)", + "Multi-word expression", + "Multi-word verbal expression", + "Negation modifier", + "Noun compound modifier", + "Noun phrase used as an adverbial modifier", + "Nominal subject", + "Passive nominal subject", + "Numeric modifier of a noun", + "Element of compound number", + "Punctuation mark", + "Parataxis relation", + "Participial modifier", + "The complement of a preposition is a clause", + "Object of a preposition", + "Possession modifier", + "Postverbal negative particle", + "Predicate complement", + "Preconjunt", + "Predeterminer", + "Prefix", + "Prepositional modifier", + "The relationship between a verb and verbal morpheme", + "Particle", + "Associative or possessive marker", + "Quantifier phrase modifier", + "Relative clause modifier", + "Complementizer in relative clause", + "Ellipsis without a preceding predicate", + "Referent", + "Remnant", + "Reparandum", + "Root", + "Suffix specifying a unit of number", + "Suffix", + "Temporal modifier", + "Topic marker", + "Clause headed by an infinite form of the verb that modifies a noun", + "Vocative", + "Open clausal complement", + "Name suffix", + "Name title", + "Adverbial phrase modifier", + "Causative auxiliary", + "Helper auxiliary", + "Rentaishi (Prenominal modifier)", + "Foreign words", + "Keyword", + "List for chains of comparable items", + "Nominalized clause", + "Nominalized clausal subject", + "Nominalized clausal passive", + "Compound of numeric modifier", + "Copula", + "Dislocated relation (for fronted/topicalized elements)" + ], + "type": "string" + } + }, + "id": "DependencyEdge" + }, + "AnalyzeSyntaxResponse": { + "description": "The syntax analysis response message.", + "type": "object", + "properties": { + "language": { + "description": "The language of the text, which will be the same as the language specified\nin the request or, if not specified, the automatically-detected language.\nSee `Document.language` field for more details.", + "type": "string" + }, + "tokens": { + "description": "Tokens, along with their syntactic information, in the input document.", + "type": "array", + "items": { + "$ref": "Token" + } + }, + "sentences": { + "description": "Sentences in the input document.", + "type": "array", + "items": { + "$ref": "Sentence" + } + } + }, + "id": "AnalyzeSyntaxResponse" + }, + "AnnotateTextRequest": { + "description": "The request message for the text annotation API, which can perform multiple\nanalysis types (sentiment, entities, and syntax) in one call.", + "type": "object", + "properties": { + "document": { + "description": "Input document.", + "$ref": "Document" + }, + "encodingType": { + "description": "The encoding type used by the API to calculate offsets.", + "enum": [ + "NONE", + "UTF8", + "UTF16", + "UTF32" + ], + "enumDescriptions": [ + "If `EncodingType` is not specified, encoding-dependent information (such as\n`begin_offset`) will be set at `-1`.", + "Encoding-dependent information (such as `begin_offset`) is calculated based\non the UTF-8 encoding of the input. C++ and Go are examples of languages\nthat use this encoding natively.", + "Encoding-dependent information (such as `begin_offset`) is calculated based\non the UTF-16 encoding of the input. Java and Javascript are examples of\nlanguages that use this encoding natively.", + "Encoding-dependent information (such as `begin_offset`) is calculated based\non the UTF-32 encoding of the input. Python is an example of a language\nthat uses this encoding natively." + ], + "type": "string" + }, + "features": { + "description": "The enabled features.", + "$ref": "Features" + } + }, + "id": "AnnotateTextRequest" + }, + "Sentence": { + "description": "Represents a sentence in the input document.", + "type": "object", + "properties": { + "text": { + "description": "The sentence text.", + "$ref": "TextSpan" + }, + "sentiment": { + "description": "For calls to AnalyzeSentiment or if\nAnnotateTextRequest.Features.extract_document_sentiment is set to\ntrue, this field will contain the sentiment for the sentence.", + "$ref": "Sentiment" + } + }, + "id": "Sentence" + }, + "Features": { + "description": "All available features for sentiment, syntax, and semantic analysis.\nSetting each one to true will enable that specific analysis for the input.", + "type": "object", + "properties": { + "extractDocumentSentiment": { + "description": "Extract document-level sentiment.", + "type": "boolean" + }, + "extractEntities": { + "description": "Extract entities.", + "type": "boolean" + }, + "extractSyntax": { + "description": "Extract syntax information.", + "type": "boolean" + } + }, + "id": "Features" + }, + "PartOfSpeech": { + "description": "Represents part of speech information for a token. Parts of speech\nare as defined in\nhttp://www.lrec-conf.org/proceedings/lrec2012/pdf/274_Paper.pdf", + "type": "object", + "properties": { + "aspect": { + "description": "The grammatical aspect.", + "enum": [ + "ASPECT_UNKNOWN", + "PERFECTIVE", + "IMPERFECTIVE", + "PROGRESSIVE" + ], + "enumDescriptions": [ + "Aspect is not applicable in the analyzed language or is not predicted.", + "Perfective", + "Imperfective", + "Progressive" + ], + "type": "string" + }, + "gender": { + "description": "The grammatical gender.", + "enum": [ + "GENDER_UNKNOWN", + "FEMININE", + "MASCULINE", + "NEUTER" + ], + "enumDescriptions": [ + "Gender is not applicable in the analyzed language or is not predicted.", + "Feminine", + "Masculine", + "Neuter" + ], + "type": "string" + }, + "person": { + "description": "The grammatical person.", + "enum": [ + "PERSON_UNKNOWN", + "FIRST", + "SECOND", + "THIRD", + "REFLEXIVE_PERSON" + ], + "enumDescriptions": [ + "Person is not applicable in the analyzed language or is not predicted.", + "First", + "Second", + "Third", + "Reflexive" + ], + "type": "string" + }, + "case": { + "description": "The grammatical case.", + "enum": [ + "CASE_UNKNOWN", + "ACCUSATIVE", + "ADVERBIAL", + "COMPLEMENTIVE", + "DATIVE", + "GENITIVE", + "INSTRUMENTAL", + "LOCATIVE", + "NOMINATIVE", + "OBLIQUE", + "PARTITIVE", + "PREPOSITIONAL", + "REFLEXIVE_CASE", + "RELATIVE_CASE", + "VOCATIVE" + ], + "enumDescriptions": [ + "Case is not applicable in the analyzed language or is not predicted.", + "Accusative", + "Adverbial", + "Complementive", + "Dative", + "Genitive", + "Instrumental", + "Locative", + "Nominative", + "Oblique", + "Partitive", + "Prepositional", + "Reflexive", + "Relative", + "Vocative" + ], + "type": "string" + }, + "form": { + "description": "The grammatical form.", + "enum": [ + "FORM_UNKNOWN", + "ADNOMIAL", + "AUXILIARY", + "COMPLEMENTIZER", + "FINAL_ENDING", + "GERUND", + "REALIS", + "IRREALIS", + "SHORT", + "LONG", + "ORDER", + "SPECIFIC" + ], + "enumDescriptions": [ + "Form is not applicable in the analyzed language or is not predicted.", + "Adnomial", + "Auxiliary", + "Complementizer", + "Final ending", + "Gerund", + "Realis", + "Irrealis", + "Short form", + "Long form", + "Order form", + "Specific form" + ], + "type": "string" + }, + "tense": { + "description": "The grammatical tense.", + "enum": [ + "TENSE_UNKNOWN", + "CONDITIONAL_TENSE", + "FUTURE", + "PAST", + "PRESENT", + "IMPERFECT", + "PLUPERFECT" + ], + "enumDescriptions": [ + "Tense is not applicable in the analyzed language or is not predicted.", + "Conditional", + "Future", + "Past", + "Present", + "Imperfect", + "Pluperfect" + ], + "type": "string" + }, + "proper": { + "description": "The grammatical properness.", + "enum": [ + "PROPER_UNKNOWN", + "PROPER", + "NOT_PROPER" + ], + "enumDescriptions": [ + "Proper is not applicable in the analyzed language or is not predicted.", + "Proper", + "Not proper" + ], + "type": "string" + }, + "mood": { + "description": "The grammatical mood.", + "enum": [ + "MOOD_UNKNOWN", + "CONDITIONAL_MOOD", + "IMPERATIVE", + "INDICATIVE", + "INTERROGATIVE", + "JUSSIVE", + "SUBJUNCTIVE" + ], + "enumDescriptions": [ + "Mood is not applicable in the analyzed language or is not predicted.", + "Conditional", + "Imperative", + "Indicative", + "Interrogative", + "Jussive", + "Subjunctive" + ], + "type": "string" + }, + "tag": { + "description": "The part of speech tag.", + "enum": [ + "UNKNOWN", + "ADJ", + "ADP", + "ADV", + "CONJ", + "DET", + "NOUN", + "NUM", + "PRON", + "PRT", + "PUNCT", + "VERB", + "X", + "AFFIX" + ], + "enumDescriptions": [ + "Unknown", + "Adjective", + "Adposition (preposition and postposition)", + "Adverb", + "Conjunction", + "Determiner", + "Noun (common and proper)", + "Cardinal number", + "Pronoun", + "Particle or other function word", + "Punctuation", + "Verb (all tenses and modes)", + "Other: foreign words, typos, abbreviations", + "Affix" + ], + "type": "string" + }, + "number": { + "description": "The grammatical number.", + "enum": [ + "NUMBER_UNKNOWN", + "SINGULAR", + "PLURAL", + "DUAL" + ], + "enumDescriptions": [ + "Number is not applicable in the analyzed language or is not predicted.", + "Singular", + "Plural", + "Dual" + ], + "type": "string" + }, + "reciprocity": { + "description": "The grammatical reciprocity.", + "enum": [ + "RECIPROCITY_UNKNOWN", + "RECIPROCAL", + "NON_RECIPROCAL" + ], + "enumDescriptions": [ + "Reciprocity is not applicable in the analyzed language or is not\npredicted.", + "Reciprocal", + "Non-reciprocal" + ], + "type": "string" + }, + "voice": { + "description": "The grammatical voice.", + "enum": [ + "VOICE_UNKNOWN", + "ACTIVE", + "CAUSATIVE", + "PASSIVE" + ], + "enumDescriptions": [ + "Voice is not applicable in the analyzed language or is not predicted.", + "Active", + "Causative", + "Passive" + ], + "type": "string" + } + }, + "id": "PartOfSpeech" + }, + "AnnotateTextResponse": { + "description": "The text annotations response message.", + "type": "object", + "properties": { + "entities": { + "description": "Entities, along with their semantic information, in the input document.\nPopulated if the user enables\nAnnotateTextRequest.Features.extract_entities.", + "type": "array", + "items": { + "$ref": "Entity" + } + }, + "documentSentiment": { + "description": "The overall sentiment for the document. Populated if the user enables\nAnnotateTextRequest.Features.extract_document_sentiment.", + "$ref": "Sentiment" + }, + "language": { + "description": "The language of the text, which will be the same as the language specified\nin the request or, if not specified, the automatically-detected language.\nSee `Document.language` field for more details.", + "type": "string" + }, + "tokens": { + "description": "Tokens, along with their syntactic information, in the input document.\nPopulated if the user enables\nAnnotateTextRequest.Features.extract_syntax.", + "type": "array", + "items": { + "$ref": "Token" + } + }, + "sentences": { + "description": "Sentences in the input document. Populated if the user enables\nAnnotateTextRequest.Features.extract_syntax.", + "type": "array", + "items": { + "$ref": "Sentence" + } + } + }, + "id": "AnnotateTextResponse" + }, + "Entity": { + "description": "Represents a phrase in the text that is a known entity, such as\na person, an organization, or location. The API associates information, such\nas salience and mentions, with entities.", + "type": "object", + "properties": { + "metadata": { + "description": "Metadata associated with the entity.\n\nCurrently, Wikipedia URLs and Knowledge Graph MIDs are provided, if\navailable. The associated keys are \"wikipedia_url\" and \"mid\", respectively.", + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + "salience": { + "description": "The salience score associated with the entity in the [0, 1.0] range.\n\nThe salience score for an entity provides information about the\nimportance or centrality of that entity to the entire document text.\nScores closer to 0 are less salient, while scores closer to 1.0 are highly\nsalient.", + "type": "number", + "format": "float" + }, + "type": { + "description": "The entity type.", + "enum": [ + "UNKNOWN", + "PERSON", + "LOCATION", + "ORGANIZATION", + "EVENT", + "WORK_OF_ART", + "CONSUMER_GOOD", + "OTHER" + ], + "enumDescriptions": [ + "Unknown", + "Person", + "Location", + "Organization", + "Event", + "Work of art", + "Consumer goods", + "Other types" + ], + "type": "string" + }, + "mentions": { + "description": "The mentions of this entity in the input document. The API currently\nsupports proper noun mentions.", + "type": "array", + "items": { + "$ref": "EntityMention" + } + }, + "name": { + "description": "The representative name for the entity.", + "type": "string" + } + }, + "id": "Entity" + }, + "Sentiment": { + "description": "Represents the feeling associated with the entire text or entities in\nthe text.", + "type": "object", + "properties": { + "score": { + "description": "Sentiment score between -1.0 (negative sentiment) and 1.0\n(positive sentiment).", + "type": "number", + "format": "float" + }, + "magnitude": { + "description": "A non-negative number in the [0, +inf) range, which represents\nthe absolute magnitude of sentiment regardless of score (positive or\nnegative).", + "type": "number", + "format": "float" + } + }, + "id": "Sentiment" + }, + "Token": { + "description": "Represents the smallest syntactic building block of the text.", + "type": "object", + "properties": { + "text": { + "description": "The token text.", + "$ref": "TextSpan" + }, + "partOfSpeech": { + "description": "Parts of speech tag for this token.", + "$ref": "PartOfSpeech" + }, + "dependencyEdge": { + "description": "Dependency tree parse for this token.", + "$ref": "DependencyEdge" + }, + "lemma": { + "description": "[Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token.", + "type": "string" + } + }, + "id": "Token" + }, + "AnalyzeEntitiesResponse": { + "description": "The entity analysis response message.", + "type": "object", + "properties": { + "entities": { + "description": "The recognized entities in the input document.", + "type": "array", + "items": { + "$ref": "Entity" + } + }, + "language": { + "description": "The language of the text, which will be the same as the language specified\nin the request or, if not specified, the automatically-detected language.\nSee `Document.language` field for more details.", + "type": "string" + } + }, + "id": "AnalyzeEntitiesResponse" + } + }, + "revision": "20161205", + "basePath": "", + "icons": { + "x32": "http://www.google.com/images/icons/product/search-32.gif", + "x16": "http://www.google.com/images/icons/product/search-16.gif" + }, + "version_module": "True", + "canonicalName": "Cloud Natural Language", + "discoveryVersion": "v1", + "baseUrl": "https://language.googleapis.com/", + "name": "language", + "parameters": { + "access_token": { + "description": "OAuth access token.", + "type": "string", + "location": "query" + }, + "prettyPrint": { + "description": "Returns response with indentations and line breaks.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "key": { + "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", + "type": "string", + "location": "query" + }, + "quotaUser": { + "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.", + "type": "string", + "location": "query" + }, + "pp": { + "description": "Pretty-print response.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "fields": { + "description": "Selector specifying which fields to include in a partial response.", + "type": "string", + "location": "query" + }, + "alt": { + "description": "Data format for response.", + "location": "query", + "enum": [ + "json", + "media", + "proto" + ], + "default": "json", + "enumDescriptions": [ + "Responses with Content-Type of application/json", + "Media download with context-dependent Content-Type", + "Responses with Content-Type of application/x-protobuf" + ], + "type": "string" + }, + "$.xgafv": { + "description": "V1 error format.", + "enum": [ + "1", + "2" + ], + "enumDescriptions": [ + "v1 error format", + "v2 error format" + ], + "type": "string", + "location": "query" + }, + "callback": { + "description": "JSONP", + "type": "string", + "location": "query" + }, + "oauth_token": { + "description": "OAuth 2.0 token for the current user.", + "type": "string", + "location": "query" + }, + "uploadType": { + "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").", + "type": "string", + "location": "query" + }, + "bearer_token": { + "description": "OAuth bearer token.", + "type": "string", + "location": "query" + }, + "upload_protocol": { + "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").", + "type": "string", + "location": "query" + } + }, + "documentationLink": "https://cloud.google.com/natural-language/", + "ownerDomain": "google.com", + "batchPath": "batch", + "servicePath": "", + "ownerName": "Google", + "version": "v1", + "rootUrl": "https://language.googleapis.com/", + "kind": "discovery#restDescription" +} diff --git a/etc/api/language/v1beta1/language-api.json b/etc/api/language/v1beta1/language-api.json index e69de29bb2..0135a3ec48 100644 --- a/etc/api/language/v1beta1/language-api.json +++ b/etc/api/language/v1beta1/language-api.json @@ -0,0 +1,1090 @@ +{ + "id": "language:v1beta1", + "auth": { + "oauth2": { + "scopes": { + "https://www.googleapis.com/auth/cloud-platform": { + "description": "View and manage your data across Google Cloud Platform services" + } + } + } + }, + "description": "Google Cloud Natural Language API provides natural language understanding technologies to developers. Examples include sentiment analysis, entity recognition, and text annotations.", + "protocol": "rest", + "title": "Google Cloud Natural Language API", + "resources": { + "documents": { + "methods": { + "analyzeSentiment": { + "id": "language.documents.analyzeSentiment", + "response": { + "$ref": "AnalyzeSentimentResponse" + }, + "parameterOrder": [], + "description": "Analyzes the sentiment of the provided text.", + "request": { + "$ref": "AnalyzeSentimentRequest" + }, + "flatPath": "v1beta1/documents:analyzeSentiment", + "httpMethod": "POST", + "parameters": {}, + "path": "v1beta1/documents:analyzeSentiment", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "analyzeSyntax": { + "id": "language.documents.analyzeSyntax", + "response": { + "$ref": "AnalyzeSyntaxResponse" + }, + "parameterOrder": [], + "description": "Analyzes the syntax of the text and provides sentence boundaries and\ntokenization along with part of speech tags, dependency trees, and other\nproperties.", + "request": { + "$ref": "AnalyzeSyntaxRequest" + }, + "flatPath": "v1beta1/documents:analyzeSyntax", + "httpMethod": "POST", + "parameters": {}, + "path": "v1beta1/documents:analyzeSyntax", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "annotateText": { + "id": "language.documents.annotateText", + "response": { + "$ref": "AnnotateTextResponse" + }, + "parameterOrder": [], + "description": "A convenience method that provides all the features that analyzeSentiment,\nanalyzeEntities, and analyzeSyntax provide in one call.", + "request": { + "$ref": "AnnotateTextRequest" + }, + "flatPath": "v1beta1/documents:annotateText", + "httpMethod": "POST", + "parameters": {}, + "path": "v1beta1/documents:annotateText", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "analyzeEntities": { + "id": "language.documents.analyzeEntities", + "response": { + "$ref": "AnalyzeEntitiesResponse" + }, + "parameterOrder": [], + "description": "Finds named entities (currently finds proper names) in the text,\nentity types, salience, mentions for each entity, and other properties.", + "request": { + "$ref": "AnalyzeEntitiesRequest" + }, + "flatPath": "v1beta1/documents:analyzeEntities", + "httpMethod": "POST", + "parameters": {}, + "path": "v1beta1/documents:analyzeEntities", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + } + } + } + }, + "schemas": { + "Document": { + "description": "################################################################ #\n\nRepresents the input to API methods.", + "type": "object", + "properties": { + "language": { + "description": "The language of the document (if not specified, the language is\nautomatically detected). Both ISO and BCP-47 language codes are\naccepted.\u003cbr\u003e\n**Current Language Restrictions:**\n\n * Only English, Spanish, and Japanese textual content are supported.\nIf the language (either specified by the caller or automatically detected)\nis not supported by the called API method, an `INVALID_ARGUMENT` error\nis returned.", + "type": "string" + }, + "gcsContentUri": { + "description": "The Google Cloud Storage URI where the file content is located.\nThis URI must be of the form: gs://bucket_name/object_name. For more\ndetails, see https://cloud.google.com/storage/docs/reference-uris.\nNOTE: Cloud Storage object versioning is not supported.", + "type": "string" + }, + "type": { + "description": "Required. If the type is not set or is `TYPE_UNSPECIFIED`,\nreturns an `INVALID_ARGUMENT` error.", + "enum": [ + "TYPE_UNSPECIFIED", + "PLAIN_TEXT", + "HTML" + ], + "enumDescriptions": [ + "The content type is not specified.", + "Plain text", + "HTML" + ], + "type": "string" + }, + "content": { + "description": "The content of the input in string format.", + "type": "string" + } + }, + "id": "Document" + }, + "TextSpan": { + "description": "Represents an output piece of text.", + "type": "object", + "properties": { + "beginOffset": { + "description": "The API calculates the beginning offset of the content in the original\ndocument according to the EncodingType specified in the API request.", + "type": "integer", + "format": "int32" + }, + "content": { + "description": "The content of the output text.", + "type": "string" + } + }, + "id": "TextSpan" + }, + "Status": { + "description": "The `Status` type defines a logical error model that is suitable for different\nprogramming environments, including REST APIs and RPC APIs. It is used by\n[gRPC](https://github.com/grpc). The error model is designed to be:\n\n- Simple to use and understand for most users\n- Flexible enough to meet unexpected needs\n\n# Overview\n\nThe `Status` message contains three pieces of data: error code, error message,\nand error details. The error code should be an enum value of\ngoogle.rpc.Code, but it may accept additional error codes if needed. The\nerror message should be a developer-facing English message that helps\ndevelopers *understand* and *resolve* the error. If a localized user-facing\nerror message is needed, put the localized message in the error details or\nlocalize it in the client. The optional error details may contain arbitrary\ninformation about the error. There is a predefined set of error detail types\nin the package `google.rpc` which can be used for common error conditions.\n\n# Language mapping\n\nThe `Status` message is the logical representation of the error model, but it\nis not necessarily the actual wire format. When the `Status` message is\nexposed in different client libraries and different wire protocols, it can be\nmapped differently. For example, it will likely be mapped to some exceptions\nin Java, but more likely mapped to some error codes in C.\n\n# Other uses\n\nThe error model and the `Status` message can be used in a variety of\nenvironments, either with or without APIs, to provide a\nconsistent developer experience across different environments.\n\nExample uses of this error model include:\n\n- Partial errors. If a service needs to return partial errors to the client,\n it may embed the `Status` in the normal response to indicate the partial\n errors.\n\n- Workflow errors. A typical workflow has multiple steps. Each step may\n have a `Status` message for error reporting purpose.\n\n- Batch operations. If a client uses batch request and batch response, the\n `Status` message should be used directly inside batch response, one for\n each error sub-response.\n\n- Asynchronous operations. If an API call embeds asynchronous operation\n results in its response, the status of those operations should be\n represented directly using the `Status` message.\n\n- Logging. If some API errors are stored in logs, the message `Status` could\n be used directly after any stripping needed for security/privacy reasons.", + "type": "object", + "properties": { + "code": { + "description": "The status code, which should be an enum value of google.rpc.Code.", + "type": "integer", + "format": "int32" + }, + "details": { + "description": "A list of messages that carry the error details. There will be a\ncommon set of message types for APIs to use.", + "type": "array", + "items": { + "additionalProperties": { + "description": "Properties of the object. Contains field @type with type URL.", + "type": "any" + }, + "type": "object" + } + }, + "message": { + "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\ngoogle.rpc.Status.details field, or localized by the client.", + "type": "string" + } + }, + "id": "Status" + }, + "AnalyzeEntitiesRequest": { + "description": "The entity analysis request message.", + "type": "object", + "properties": { + "document": { + "description": "Input document.", + "$ref": "Document" + }, + "encodingType": { + "description": "The encoding type used by the API to calculate offsets.", + "enum": [ + "NONE", + "UTF8", + "UTF16", + "UTF32" + ], + "enumDescriptions": [ + "If `EncodingType` is not specified, encoding-dependent information (such as\n`begin_offset`) will be set at `-1`.", + "Encoding-dependent information (such as `begin_offset`) is calculated based\non the UTF-8 encoding of the input. C++ and Go are examples of languages\nthat use this encoding natively.", + "Encoding-dependent information (such as `begin_offset`) is calculated based\non the UTF-16 encoding of the input. Java and Javascript are examples of\nlanguages that use this encoding natively.", + "Encoding-dependent information (such as `begin_offset`) is calculated based\non the UTF-32 encoding of the input. Python is an example of a language\nthat uses this encoding natively." + ], + "type": "string" + } + }, + "id": "AnalyzeEntitiesRequest" + }, + "EntityMention": { + "description": "Represents a mention for an entity in the text. Currently, proper noun\nmentions are supported.", + "type": "object", + "properties": { + "text": { + "description": "The mention text.", + "$ref": "TextSpan" + }, + "type": { + "description": "The type of the entity mention.", + "enum": [ + "TYPE_UNKNOWN", + "PROPER", + "COMMON" + ], + "enumDescriptions": [ + "Unknown", + "Proper name", + "Common noun (or noun compound)" + ], + "type": "string" + } + }, + "id": "EntityMention" + }, + "AnalyzeSentimentRequest": { + "description": "The sentiment analysis request message.", + "type": "object", + "properties": { + "document": { + "description": "Input document. Currently, `analyzeSentiment` only supports English text\n(Document.language=\"EN\").", + "$ref": "Document" + }, + "encodingType": { + "description": "The encoding type used by the API to calculate sentence offsets for the\nsentence sentiment.", + "enum": [ + "NONE", + "UTF8", + "UTF16", + "UTF32" + ], + "enumDescriptions": [ + "If `EncodingType` is not specified, encoding-dependent information (such as\n`begin_offset`) will be set at `-1`.", + "Encoding-dependent information (such as `begin_offset`) is calculated based\non the UTF-8 encoding of the input. C++ and Go are examples of languages\nthat use this encoding natively.", + "Encoding-dependent information (such as `begin_offset`) is calculated based\non the UTF-16 encoding of the input. Java and Javascript are examples of\nlanguages that use this encoding natively.", + "Encoding-dependent information (such as `begin_offset`) is calculated based\non the UTF-32 encoding of the input. Python is an example of a language\nthat uses this encoding natively." + ], + "type": "string" + } + }, + "id": "AnalyzeSentimentRequest" + }, + "AnalyzeSentimentResponse": { + "description": "The sentiment analysis response message.", + "type": "object", + "properties": { + "documentSentiment": { + "description": "The overall sentiment of the input document.", + "$ref": "Sentiment" + }, + "language": { + "description": "The language of the text, which will be the same as the language specified\nin the request or, if not specified, the automatically-detected language.", + "type": "string" + }, + "sentences": { + "description": "The sentiment for all the sentences in the document.", + "type": "array", + "items": { + "$ref": "Sentence" + } + } + }, + "id": "AnalyzeSentimentResponse" + }, + "AnalyzeSyntaxRequest": { + "description": "The syntax analysis request message.", + "type": "object", + "properties": { + "document": { + "description": "Input document.", + "$ref": "Document" + }, + "encodingType": { + "description": "The encoding type used by the API to calculate offsets.", + "enum": [ + "NONE", + "UTF8", + "UTF16", + "UTF32" + ], + "enumDescriptions": [ + "If `EncodingType` is not specified, encoding-dependent information (such as\n`begin_offset`) will be set at `-1`.", + "Encoding-dependent information (such as `begin_offset`) is calculated based\non the UTF-8 encoding of the input. C++ and Go are examples of languages\nthat use this encoding natively.", + "Encoding-dependent information (such as `begin_offset`) is calculated based\non the UTF-16 encoding of the input. Java and Javascript are examples of\nlanguages that use this encoding natively.", + "Encoding-dependent information (such as `begin_offset`) is calculated based\non the UTF-32 encoding of the input. Python is an example of a language\nthat uses this encoding natively." + ], + "type": "string" + } + }, + "id": "AnalyzeSyntaxRequest" + }, + "DependencyEdge": { + "description": "Represents dependency parse tree information for a token.", + "type": "object", + "properties": { + "headTokenIndex": { + "description": "Represents the head of this token in the dependency tree.\nThis is the index of the token which has an arc going to this token.\nThe index is the position of the token in the array of tokens returned\nby the API method. If this token is a root token, then the\n`head_token_index` is its own index.", + "type": "integer", + "format": "int32" + }, + "label": { + "description": "The parse label for the token.", + "enum": [ + "UNKNOWN", + "ABBREV", + "ACOMP", + "ADVCL", + "ADVMOD", + "AMOD", + "APPOS", + "ATTR", + "AUX", + "AUXPASS", + "CC", + "CCOMP", + "CONJ", + "CSUBJ", + "CSUBJPASS", + "DEP", + "DET", + "DISCOURSE", + "DOBJ", + "EXPL", + "GOESWITH", + "IOBJ", + "MARK", + "MWE", + "MWV", + "NEG", + "NN", + "NPADVMOD", + "NSUBJ", + "NSUBJPASS", + "NUM", + "NUMBER", + "P", + "PARATAXIS", + "PARTMOD", + "PCOMP", + "POBJ", + "POSS", + "POSTNEG", + "PRECOMP", + "PRECONJ", + "PREDET", + "PREF", + "PREP", + "PRONL", + "PRT", + "PS", + "QUANTMOD", + "RCMOD", + "RCMODREL", + "RDROP", + "REF", + "REMNANT", + "REPARANDUM", + "ROOT", + "SNUM", + "SUFF", + "TMOD", + "TOPIC", + "VMOD", + "VOCATIVE", + "XCOMP", + "SUFFIX", + "TITLE", + "ADVPHMOD", + "AUXCAUS", + "AUXVV", + "DTMOD", + "FOREIGN", + "KW", + "LIST", + "NOMC", + "NOMCSUBJ", + "NOMCSUBJPASS", + "NUMC", + "COP", + "DISLOCATED" + ], + "enumDescriptions": [ + "Unknown", + "Abbreviation modifier", + "Adjectival complement", + "Adverbial clause modifier", + "Adverbial modifier", + "Adjectival modifier of an NP", + "Appositional modifier of an NP", + "Attribute dependent of a copular verb", + "Auxiliary (non-main) verb", + "Passive auxiliary", + "Coordinating conjunction", + "Clausal complement of a verb or adjective", + "Conjunct", + "Clausal subject", + "Clausal passive subject", + "Dependency (unable to determine)", + "Determiner", + "Discourse", + "Direct object", + "Expletive", + "Goes with (part of a word in a text not well edited)", + "Indirect object", + "Marker (word introducing a subordinate clause)", + "Multi-word expression", + "Multi-word verbal expression", + "Negation modifier", + "Noun compound modifier", + "Noun phrase used as an adverbial modifier", + "Nominal subject", + "Passive nominal subject", + "Numeric modifier of a noun", + "Element of compound number", + "Punctuation mark", + "Parataxis relation", + "Participial modifier", + "The complement of a preposition is a clause", + "Object of a preposition", + "Possession modifier", + "Postverbal negative particle", + "Predicate complement", + "Preconjunt", + "Predeterminer", + "Prefix", + "Prepositional modifier", + "The relationship between a verb and verbal morpheme", + "Particle", + "Associative or possessive marker", + "Quantifier phrase modifier", + "Relative clause modifier", + "Complementizer in relative clause", + "Ellipsis without a preceding predicate", + "Referent", + "Remnant", + "Reparandum", + "Root", + "Suffix specifying a unit of number", + "Suffix", + "Temporal modifier", + "Topic marker", + "Clause headed by an infinite form of the verb that modifies a noun", + "Vocative", + "Open clausal complement", + "Name suffix", + "Name title", + "Adverbial phrase modifier", + "Causative auxiliary", + "Helper auxiliary", + "Rentaishi (Prenominal modifier)", + "Foreign words", + "Keyword", + "List for chains of comparable items", + "Nominalized clause", + "Nominalized clausal subject", + "Nominalized clausal passive", + "Compound of numeric modifier", + "Copula", + "Dislocated relation (for fronted/topicalized elements)" + ], + "type": "string" + } + }, + "id": "DependencyEdge" + }, + "AnalyzeSyntaxResponse": { + "description": "The syntax analysis response message.", + "type": "object", + "properties": { + "language": { + "description": "The language of the text, which will be the same as the language specified\nin the request or, if not specified, the automatically-detected language.\nSee Document.language field for more details.", + "type": "string" + }, + "tokens": { + "description": "Tokens, along with their syntactic information, in the input document.", + "type": "array", + "items": { + "$ref": "Token" + } + }, + "sentences": { + "description": "Sentences in the input document.", + "type": "array", + "items": { + "$ref": "Sentence" + } + } + }, + "id": "AnalyzeSyntaxResponse" + }, + "AnnotateTextRequest": { + "description": "The request message for the text annotation API, which can perform multiple\nanalysis types (sentiment, entities, and syntax) in one call.", + "type": "object", + "properties": { + "document": { + "description": "Input document.", + "$ref": "Document" + }, + "encodingType": { + "description": "The encoding type used by the API to calculate offsets.", + "enum": [ + "NONE", + "UTF8", + "UTF16", + "UTF32" + ], + "enumDescriptions": [ + "If `EncodingType` is not specified, encoding-dependent information (such as\n`begin_offset`) will be set at `-1`.", + "Encoding-dependent information (such as `begin_offset`) is calculated based\non the UTF-8 encoding of the input. C++ and Go are examples of languages\nthat use this encoding natively.", + "Encoding-dependent information (such as `begin_offset`) is calculated based\non the UTF-16 encoding of the input. Java and Javascript are examples of\nlanguages that use this encoding natively.", + "Encoding-dependent information (such as `begin_offset`) is calculated based\non the UTF-32 encoding of the input. Python is an example of a language\nthat uses this encoding natively." + ], + "type": "string" + }, + "features": { + "description": "The enabled features.", + "$ref": "Features" + } + }, + "id": "AnnotateTextRequest" + }, + "Sentence": { + "description": "Represents a sentence in the input document.", + "type": "object", + "properties": { + "text": { + "description": "The sentence text.", + "$ref": "TextSpan" + }, + "sentiment": { + "description": "For calls to AnalyzeSentiment or if\nAnnotateTextRequest.Features.extract_document_sentiment is set to\ntrue, this field will contain the sentiment for the sentence.", + "$ref": "Sentiment" + } + }, + "id": "Sentence" + }, + "Features": { + "description": "All available features for sentiment, syntax, and semantic analysis.\nSetting each one to true will enable that specific analysis for the input.", + "type": "object", + "properties": { + "extractDocumentSentiment": { + "description": "Extract document-level sentiment.", + "type": "boolean" + }, + "extractEntities": { + "description": "Extract entities.", + "type": "boolean" + }, + "extractSyntax": { + "description": "Extract syntax information.", + "type": "boolean" + } + }, + "id": "Features" + }, + "PartOfSpeech": { + "description": "Represents part of speech information for a token.", + "type": "object", + "properties": { + "aspect": { + "description": "The grammatical aspect.", + "enum": [ + "ASPECT_UNKNOWN", + "PERFECTIVE", + "IMPERFECTIVE", + "PROGRESSIVE" + ], + "enumDescriptions": [ + "Aspect is not applicable in the analyzed language or is not predicted.", + "Perfective", + "Imperfective", + "Progressive" + ], + "type": "string" + }, + "gender": { + "description": "The grammatical gender.", + "enum": [ + "GENDER_UNKNOWN", + "FEMININE", + "MASCULINE", + "NEUTER" + ], + "enumDescriptions": [ + "Gender is not applicable in the analyzed language or is not predicted.", + "Feminine", + "Masculine", + "Neuter" + ], + "type": "string" + }, + "person": { + "description": "The grammatical person.", + "enum": [ + "PERSON_UNKNOWN", + "FIRST", + "SECOND", + "THIRD", + "REFLEXIVE_PERSON" + ], + "enumDescriptions": [ + "Person is not applicable in the analyzed language or is not predicted.", + "First", + "Second", + "Third", + "Reflexive" + ], + "type": "string" + }, + "case": { + "description": "The grammatical case.", + "enum": [ + "CASE_UNKNOWN", + "ACCUSATIVE", + "ADVERBIAL", + "COMPLEMENTIVE", + "DATIVE", + "GENITIVE", + "INSTRUMENTAL", + "LOCATIVE", + "NOMINATIVE", + "OBLIQUE", + "PARTITIVE", + "PREPOSITIONAL", + "REFLEXIVE_CASE", + "RELATIVE_CASE", + "VOCATIVE" + ], + "enumDescriptions": [ + "Case is not applicable in the analyzed language or is not predicted.", + "Accusative", + "Adverbial", + "Complementive", + "Dative", + "Genitive", + "Instrumental", + "Locative", + "Nominative", + "Oblique", + "Partitive", + "Prepositional", + "Reflexive", + "Relative", + "Vocative" + ], + "type": "string" + }, + "form": { + "description": "The grammatical form.", + "enum": [ + "FORM_UNKNOWN", + "ADNOMIAL", + "AUXILIARY", + "COMPLEMENTIZER", + "FINAL_ENDING", + "GERUND", + "REALIS", + "IRREALIS", + "SHORT", + "LONG", + "ORDER", + "SPECIFIC" + ], + "enumDescriptions": [ + "Form is not applicable in the analyzed language or is not predicted.", + "Adnomial", + "Auxiliary", + "Complementizer", + "Final ending", + "Gerund", + "Realis", + "Irrealis", + "Short form", + "Long form", + "Order form", + "Specific form" + ], + "type": "string" + }, + "tense": { + "description": "The grammatical tense.", + "enum": [ + "TENSE_UNKNOWN", + "CONDITIONAL_TENSE", + "FUTURE", + "PAST", + "PRESENT", + "IMPERFECT", + "PLUPERFECT" + ], + "enumDescriptions": [ + "Tense is not applicable in the analyzed language or is not predicted.", + "Conditional", + "Future", + "Past", + "Present", + "Imperfect", + "Pluperfect" + ], + "type": "string" + }, + "proper": { + "description": "The grammatical properness.", + "enum": [ + "PROPER_UNKNOWN", + "PROPER", + "NOT_PROPER" + ], + "enumDescriptions": [ + "Proper is not applicable in the analyzed language or is not predicted.", + "Proper", + "Not proper" + ], + "type": "string" + }, + "mood": { + "description": "The grammatical mood.", + "enum": [ + "MOOD_UNKNOWN", + "CONDITIONAL_MOOD", + "IMPERATIVE", + "INDICATIVE", + "INTERROGATIVE", + "JUSSIVE", + "SUBJUNCTIVE" + ], + "enumDescriptions": [ + "Mood is not applicable in the analyzed language or is not predicted.", + "Conditional", + "Imperative", + "Indicative", + "Interrogative", + "Jussive", + "Subjunctive" + ], + "type": "string" + }, + "tag": { + "description": "The part of speech tag.", + "enum": [ + "UNKNOWN", + "ADJ", + "ADP", + "ADV", + "CONJ", + "DET", + "NOUN", + "NUM", + "PRON", + "PRT", + "PUNCT", + "VERB", + "X", + "AFFIX" + ], + "enumDescriptions": [ + "Unknown", + "Adjective", + "Adposition (preposition and postposition)", + "Adverb", + "Conjunction", + "Determiner", + "Noun (common and proper)", + "Cardinal number", + "Pronoun", + "Particle or other function word", + "Punctuation", + "Verb (all tenses and modes)", + "Other: foreign words, typos, abbreviations", + "Affix" + ], + "type": "string" + }, + "number": { + "description": "The grammatical number.", + "enum": [ + "NUMBER_UNKNOWN", + "SINGULAR", + "PLURAL", + "DUAL" + ], + "enumDescriptions": [ + "Number is not applicable in the analyzed language or is not predicted.", + "Singular", + "Plural", + "Dual" + ], + "type": "string" + }, + "reciprocity": { + "description": "The grammatical reciprocity.", + "enum": [ + "RECIPROCITY_UNKNOWN", + "RECIPROCAL", + "NON_RECIPROCAL" + ], + "enumDescriptions": [ + "Reciprocity is not applicable in the analyzed language or is not\npredicted.", + "Reciprocal", + "Non-reciprocal" + ], + "type": "string" + }, + "voice": { + "description": "The grammatical voice.", + "enum": [ + "VOICE_UNKNOWN", + "ACTIVE", + "CAUSATIVE", + "PASSIVE" + ], + "enumDescriptions": [ + "Voice is not applicable in the analyzed language or is not predicted.", + "Active", + "Causative", + "Passive" + ], + "type": "string" + } + }, + "id": "PartOfSpeech" + }, + "AnnotateTextResponse": { + "description": "The text annotations response message.", + "type": "object", + "properties": { + "entities": { + "description": "Entities, along with their semantic information, in the input document.\nPopulated if the user enables\nAnnotateTextRequest.Features.extract_entities.", + "type": "array", + "items": { + "$ref": "Entity" + } + }, + "documentSentiment": { + "description": "The overall sentiment for the document. Populated if the user enables\nAnnotateTextRequest.Features.extract_document_sentiment.", + "$ref": "Sentiment" + }, + "language": { + "description": "The language of the text, which will be the same as the language specified\nin the request or, if not specified, the automatically-detected language.\nSee Document.language field for more details.", + "type": "string" + }, + "tokens": { + "description": "Tokens, along with their syntactic information, in the input document.\nPopulated if the user enables\nAnnotateTextRequest.Features.extract_syntax.", + "type": "array", + "items": { + "$ref": "Token" + } + }, + "sentences": { + "description": "Sentences in the input document. Populated if the user enables\nAnnotateTextRequest.Features.extract_syntax.", + "type": "array", + "items": { + "$ref": "Sentence" + } + } + }, + "id": "AnnotateTextResponse" + }, + "Entity": { + "description": "Represents a phrase in the text that is a known entity, such as\na person, an organization, or location. The API associates information, such\nas salience and mentions, with entities.", + "type": "object", + "properties": { + "metadata": { + "description": "Metadata associated with the entity.\n\nCurrently, Wikipedia URLs and Knowledge Graph MIDs are provided, if\navailable. The associated keys are \"wikipedia_url\" and \"mid\", respectively.", + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + "salience": { + "description": "The salience score associated with the entity in the [0, 1.0] range.\n\nThe salience score for an entity provides information about the\nimportance or centrality of that entity to the entire document text.\nScores closer to 0 are less salient, while scores closer to 1.0 are highly\nsalient.", + "type": "number", + "format": "float" + }, + "type": { + "description": "The entity type.", + "enum": [ + "UNKNOWN", + "PERSON", + "LOCATION", + "ORGANIZATION", + "EVENT", + "WORK_OF_ART", + "CONSUMER_GOOD", + "OTHER" + ], + "enumDescriptions": [ + "Unknown", + "Person", + "Location", + "Organization", + "Event", + "Work of art", + "Consumer goods", + "Other types" + ], + "type": "string" + }, + "mentions": { + "description": "The mentions of this entity in the input document. The API currently\nsupports proper noun mentions.", + "type": "array", + "items": { + "$ref": "EntityMention" + } + }, + "name": { + "description": "The representative name for the entity.", + "type": "string" + } + }, + "id": "Entity" + }, + "Sentiment": { + "description": "Represents the feeling associated with the entire text or entities in\nthe text.", + "type": "object", + "properties": { + "score": { + "description": "Sentiment score between -1.0 (negative sentiment) and 1.0\n(positive sentiment).", + "type": "number", + "format": "float" + }, + "polarity": { + "description": "DEPRECATED FIELD - This field is being deprecated in\nfavor of score. Please refer to our documentation at\nhttps://cloud.google.com/natural-language/docs for more information.", + "type": "number", + "format": "float" + }, + "magnitude": { + "description": "A non-negative number in the [0, +inf) range, which represents\nthe absolute magnitude of sentiment regardless of score (positive or\nnegative).", + "type": "number", + "format": "float" + } + }, + "id": "Sentiment" + }, + "Token": { + "description": "Represents the smallest syntactic building block of the text.", + "type": "object", + "properties": { + "text": { + "description": "The token text.", + "$ref": "TextSpan" + }, + "partOfSpeech": { + "description": "Parts of speech tag for this token.", + "$ref": "PartOfSpeech" + }, + "dependencyEdge": { + "description": "Dependency tree parse for this token.", + "$ref": "DependencyEdge" + }, + "lemma": { + "description": "[Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token.", + "type": "string" + } + }, + "id": "Token" + }, + "AnalyzeEntitiesResponse": { + "description": "The entity analysis response message.", + "type": "object", + "properties": { + "entities": { + "description": "The recognized entities in the input document.", + "type": "array", + "items": { + "$ref": "Entity" + } + }, + "language": { + "description": "The language of the text, which will be the same as the language specified\nin the request or, if not specified, the automatically-detected language.\nSee Document.language field for more details.", + "type": "string" + } + }, + "id": "AnalyzeEntitiesResponse" + } + }, + "revision": "20161205", + "basePath": "", + "icons": { + "x32": "http://www.google.com/images/icons/product/search-32.gif", + "x16": "http://www.google.com/images/icons/product/search-16.gif" + }, + "version_module": "True", + "canonicalName": "Cloud Natural Language", + "discoveryVersion": "v1", + "baseUrl": "https://language.googleapis.com/", + "name": "language", + "parameters": { + "access_token": { + "description": "OAuth access token.", + "type": "string", + "location": "query" + }, + "prettyPrint": { + "description": "Returns response with indentations and line breaks.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "key": { + "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", + "type": "string", + "location": "query" + }, + "quotaUser": { + "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.", + "type": "string", + "location": "query" + }, + "pp": { + "description": "Pretty-print response.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "fields": { + "description": "Selector specifying which fields to include in a partial response.", + "type": "string", + "location": "query" + }, + "alt": { + "description": "Data format for response.", + "location": "query", + "enum": [ + "json", + "media", + "proto" + ], + "default": "json", + "enumDescriptions": [ + "Responses with Content-Type of application/json", + "Media download with context-dependent Content-Type", + "Responses with Content-Type of application/x-protobuf" + ], + "type": "string" + }, + "$.xgafv": { + "description": "V1 error format.", + "enum": [ + "1", + "2" + ], + "enumDescriptions": [ + "v1 error format", + "v2 error format" + ], + "type": "string", + "location": "query" + }, + "callback": { + "description": "JSONP", + "type": "string", + "location": "query" + }, + "oauth_token": { + "description": "OAuth 2.0 token for the current user.", + "type": "string", + "location": "query" + }, + "uploadType": { + "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").", + "type": "string", + "location": "query" + }, + "bearer_token": { + "description": "OAuth bearer token.", + "type": "string", + "location": "query" + }, + "upload_protocol": { + "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").", + "type": "string", + "location": "query" + } + }, + "documentationLink": "https://cloud.google.com/natural-language/", + "ownerDomain": "google.com", + "batchPath": "batch", + "servicePath": "", + "ownerName": "Google", + "version": "v1beta1", + "rootUrl": "https://language.googleapis.com/", + "kind": "discovery#restDescription" +} diff --git a/etc/api/licensing/v1/licensing-api.json b/etc/api/licensing/v1/licensing-api.json index 5429375cb8..929b4e5634 100644 --- a/etc/api/licensing/v1/licensing-api.json +++ b/etc/api/licensing/v1/licensing-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/e3DwUYJq7cR8DMYb0b0rJ8XCL6k\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/FyUD9D0inmca5JWfAKYW1_Iol18\"", "discoveryVersion": "v1", "id": "licensing:v1", "name": "licensing", @@ -11,8 +11,8 @@ "ownerDomain": "google.com", "ownerName": "Google", "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" }, "documentationLink": "https://developers.google.com/google-apps/licensing/", "protocol": "rest", diff --git a/etc/api/logging/v2/logging-api.json b/etc/api/logging/v2/logging-api.json new file mode 100644 index 0000000000..17584009df --- /dev/null +++ b/etc/api/logging/v2/logging-api.json @@ -0,0 +1,2090 @@ +{ + "id": "logging:v2", + "auth": { + "oauth2": { + "scopes": { + "https://www.googleapis.com/auth/cloud-platform": { + "description": "View and manage your data across Google Cloud Platform services" + }, + "https://www.googleapis.com/auth/cloud-platform.read-only": { + "description": "View your data across Google Cloud Platform services" + }, + "https://www.googleapis.com/auth/logging.read": { + "description": "View log data for your projects" + }, + "https://www.googleapis.com/auth/logging.write": { + "description": "Submit log data for your projects" + }, + "https://www.googleapis.com/auth/logging.admin": { + "description": "Administrate log data for your projects" + } + } + } + }, + "description": "Writes log entries and manages your Stackdriver Logging configuration.", + "protocol": "rest", + "title": "Stackdriver Logging API", + "resources": { + "folders": { + "resources": { + "logs": { + "methods": { + "list": { + "id": "logging.folders.logs.list", + "response": { + "$ref": "ListLogsResponse" + }, + "parameterOrder": [ + "parent" + ], + "description": "Lists the logs in projects or organizations. Only logs that have entries are listed.", + "flatPath": "v2/folders/{foldersId}/logs", + "httpMethod": "GET", + "parameters": { + "pageSize": { + "description": "Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "parent": { + "description": "Required. The resource name that owns the logs:\n\"projects/[PROJECT_ID]\"\n\"organizations/[ORGANIZATION_ID]\"\n", + "required": true, + "pattern": "^folders/[^/]+$", + "location": "path", + "type": "string" + }, + "pageToken": { + "description": "Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call.", + "location": "query", + "type": "string" + } + }, + "path": "v2/{+parent}/logs", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + "https://www.googleapis.com/auth/logging.admin", + "https://www.googleapis.com/auth/logging.read" + ] + }, + "delete": { + "id": "logging.folders.logs.delete", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "logName" + ], + "description": "Deletes all the log entries in a log. The log reappears if it receives new entries.", + "flatPath": "v2/folders/{foldersId}/logs/{logsId}", + "httpMethod": "DELETE", + "parameters": { + "logName": { + "description": "Required. The resource name of the log to delete:\n\"projects/[PROJECT_ID]/logs/[LOG_ID]\"\n\"organizations/[ORGANIZATION_ID]/logs/[LOG_ID]\"\n[LOG_ID] must be URL-encoded. For example, \"projects/my-project-id/logs/syslog\", \"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity\". For more information about log names, see LogEntry.", + "required": true, + "pattern": "^folders/[^/]+/logs/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v2/{+logName}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/logging.admin" + ] + } + } + }, + "sinks": { + "methods": { + "update": { + "id": "logging.folders.sinks.update", + "response": { + "$ref": "LogSink" + }, + "parameterOrder": [ + "sinkName" + ], + "description": "Updates a sink. If the named sink doesn't exist, then this method is identical to sinks.create. If the named sink does exist, then this method replaces the following fields in the existing sink with values from the new sink: destination, filter, output_version_format, start_time, and end_time. The updated filter might also have a new writer_identity; see the unique_writer_identity field.", + "request": { + "$ref": "LogSink" + }, + "flatPath": "v2/folders/{foldersId}/sinks/{sinksId}", + "httpMethod": "PUT", + "parameters": { + "sinkName": { + "description": "Required. The full resource name of the sink to update, including the parent resource and the sink identifier:\n\"projects/[PROJECT_ID]/sinks/[SINK_ID]\"\n\"organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]\"\nExample: \"projects/my-project-id/sinks/my-sink-id\".", + "required": true, + "pattern": "^folders/[^/]+/sinks/[^/]+$", + "location": "path", + "type": "string" + }, + "uniqueWriterIdentity": { + "description": "Optional. See sinks.create for a description of this field. When updating a sink, the effect of this field on the value of writer_identity in the updated sink depends on both the old and new values of this field:\nIf the old and new values of this field are both false or both true, then there is no change to the sink's writer_identity.\nIf the old value was false and the new value is true, then writer_identity is changed to a unique service account.\nIt is an error if the old value was true and the new value is false.", + "location": "query", + "type": "boolean" + } + }, + "path": "v2/{+sinkName}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/logging.admin" + ] + }, + "get": { + "id": "logging.folders.sinks.get", + "response": { + "$ref": "LogSink" + }, + "parameterOrder": [ + "sinkName" + ], + "description": "Gets a sink.", + "flatPath": "v2/folders/{foldersId}/sinks/{sinksId}", + "httpMethod": "GET", + "parameters": { + "sinkName": { + "description": "Required. The parent resource name of the sink:\n\"projects/[PROJECT_ID]/sinks/[SINK_ID]\"\n\"organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]\"\nExample: \"projects/my-project-id/sinks/my-sink-id\".", + "required": true, + "pattern": "^folders/[^/]+/sinks/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v2/{+sinkName}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + "https://www.googleapis.com/auth/logging.admin", + "https://www.googleapis.com/auth/logging.read" + ] + }, + "create": { + "id": "logging.folders.sinks.create", + "response": { + "$ref": "LogSink" + }, + "parameterOrder": [ + "parent" + ], + "description": "Creates a sink that exports specified log entries to a destination. The export of newly-ingested log entries begins immediately, unless the current time is outside the sink's start and end times or the sink's writer_identity is not permitted to write to the destination. A sink can export log entries only from the resource owning the sink.", + "request": { + "$ref": "LogSink" + }, + "flatPath": "v2/folders/{foldersId}/sinks", + "httpMethod": "POST", + "parameters": { + "uniqueWriterIdentity": { + "description": "Optional. Determines the kind of IAM identity returned as writer_identity in the new sink. If this value is omitted or set to false, and if the sink's parent is a project, then the value returned as writer_identity is cloud-logs@google.com, the same identity used before the addition of writer identities to this API. The sink's destination must be in the same project as the sink itself.If this field is set to true, or if the sink is owned by a non-project resource such as an organization, then the value of writer_identity will be a unique service account used only for exports from the new sink. For more information, see writer_identity in LogSink.", + "location": "query", + "type": "boolean" + }, + "parent": { + "description": "Required. The resource in which to create the sink:\n\"projects/[PROJECT_ID]\"\n\"organizations/[ORGANIZATION_ID]\"\nExamples: \"projects/my-logging-project\", \"organizations/123456789\".", + "required": true, + "pattern": "^folders/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v2/{+parent}/sinks", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/logging.admin" + ] + }, + "list": { + "id": "logging.folders.sinks.list", + "response": { + "$ref": "ListSinksResponse" + }, + "parameterOrder": [ + "parent" + ], + "description": "Lists sinks.", + "flatPath": "v2/folders/{foldersId}/sinks", + "httpMethod": "GET", + "parameters": { + "pageSize": { + "description": "Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "parent": { + "description": "Required. The parent resource whose sinks are to be listed. Examples: \"projects/my-logging-project\", \"organizations/123456789\".", + "required": true, + "pattern": "^folders/[^/]+$", + "location": "path", + "type": "string" + }, + "pageToken": { + "description": "Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call.", + "location": "query", + "type": "string" + } + }, + "path": "v2/{+parent}/sinks", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + "https://www.googleapis.com/auth/logging.admin", + "https://www.googleapis.com/auth/logging.read" + ] + }, + "delete": { + "id": "logging.folders.sinks.delete", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "sinkName" + ], + "description": "Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted.", + "flatPath": "v2/folders/{foldersId}/sinks/{sinksId}", + "httpMethod": "DELETE", + "parameters": { + "sinkName": { + "description": "Required. The full resource name of the sink to delete, including the parent resource and the sink identifier:\n\"projects/[PROJECT_ID]/sinks/[SINK_ID]\"\n\"organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]\"\nIt is an error if the sink does not exist. Example: \"projects/my-project-id/sinks/my-sink-id\". It is an error if the sink does not exist.", + "required": true, + "pattern": "^folders/[^/]+/sinks/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v2/{+sinkName}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/logging.admin" + ] + } + } + } + } + }, + "billingAccounts": { + "resources": { + "logs": { + "methods": { + "list": { + "id": "logging.billingAccounts.logs.list", + "response": { + "$ref": "ListLogsResponse" + }, + "parameterOrder": [ + "parent" + ], + "description": "Lists the logs in projects or organizations. Only logs that have entries are listed.", + "flatPath": "v2/billingAccounts/{billingAccountsId}/logs", + "httpMethod": "GET", + "parameters": { + "pageSize": { + "description": "Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "parent": { + "description": "Required. The resource name that owns the logs:\n\"projects/[PROJECT_ID]\"\n\"organizations/[ORGANIZATION_ID]\"\n", + "required": true, + "pattern": "^billingAccounts/[^/]+$", + "location": "path", + "type": "string" + }, + "pageToken": { + "description": "Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call.", + "location": "query", + "type": "string" + } + }, + "path": "v2/{+parent}/logs", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + "https://www.googleapis.com/auth/logging.admin", + "https://www.googleapis.com/auth/logging.read" + ] + }, + "delete": { + "id": "logging.billingAccounts.logs.delete", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "logName" + ], + "description": "Deletes all the log entries in a log. The log reappears if it receives new entries.", + "flatPath": "v2/billingAccounts/{billingAccountsId}/logs/{logsId}", + "httpMethod": "DELETE", + "parameters": { + "logName": { + "description": "Required. The resource name of the log to delete:\n\"projects/[PROJECT_ID]/logs/[LOG_ID]\"\n\"organizations/[ORGANIZATION_ID]/logs/[LOG_ID]\"\n[LOG_ID] must be URL-encoded. For example, \"projects/my-project-id/logs/syslog\", \"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity\". For more information about log names, see LogEntry.", + "required": true, + "pattern": "^billingAccounts/[^/]+/logs/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v2/{+logName}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/logging.admin" + ] + } + } + }, + "sinks": { + "methods": { + "update": { + "id": "logging.billingAccounts.sinks.update", + "response": { + "$ref": "LogSink" + }, + "parameterOrder": [ + "sinkName" + ], + "description": "Updates a sink. If the named sink doesn't exist, then this method is identical to sinks.create. If the named sink does exist, then this method replaces the following fields in the existing sink with values from the new sink: destination, filter, output_version_format, start_time, and end_time. The updated filter might also have a new writer_identity; see the unique_writer_identity field.", + "request": { + "$ref": "LogSink" + }, + "flatPath": "v2/billingAccounts/{billingAccountsId}/sinks/{sinksId}", + "httpMethod": "PUT", + "parameters": { + "sinkName": { + "description": "Required. The full resource name of the sink to update, including the parent resource and the sink identifier:\n\"projects/[PROJECT_ID]/sinks/[SINK_ID]\"\n\"organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]\"\nExample: \"projects/my-project-id/sinks/my-sink-id\".", + "required": true, + "pattern": "^billingAccounts/[^/]+/sinks/[^/]+$", + "location": "path", + "type": "string" + }, + "uniqueWriterIdentity": { + "description": "Optional. See sinks.create for a description of this field. When updating a sink, the effect of this field on the value of writer_identity in the updated sink depends on both the old and new values of this field:\nIf the old and new values of this field are both false or both true, then there is no change to the sink's writer_identity.\nIf the old value was false and the new value is true, then writer_identity is changed to a unique service account.\nIt is an error if the old value was true and the new value is false.", + "location": "query", + "type": "boolean" + } + }, + "path": "v2/{+sinkName}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/logging.admin" + ] + }, + "get": { + "id": "logging.billingAccounts.sinks.get", + "response": { + "$ref": "LogSink" + }, + "parameterOrder": [ + "sinkName" + ], + "description": "Gets a sink.", + "flatPath": "v2/billingAccounts/{billingAccountsId}/sinks/{sinksId}", + "httpMethod": "GET", + "parameters": { + "sinkName": { + "description": "Required. The parent resource name of the sink:\n\"projects/[PROJECT_ID]/sinks/[SINK_ID]\"\n\"organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]\"\nExample: \"projects/my-project-id/sinks/my-sink-id\".", + "required": true, + "pattern": "^billingAccounts/[^/]+/sinks/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v2/{+sinkName}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + "https://www.googleapis.com/auth/logging.admin", + "https://www.googleapis.com/auth/logging.read" + ] + }, + "create": { + "id": "logging.billingAccounts.sinks.create", + "response": { + "$ref": "LogSink" + }, + "parameterOrder": [ + "parent" + ], + "description": "Creates a sink that exports specified log entries to a destination. The export of newly-ingested log entries begins immediately, unless the current time is outside the sink's start and end times or the sink's writer_identity is not permitted to write to the destination. A sink can export log entries only from the resource owning the sink.", + "request": { + "$ref": "LogSink" + }, + "flatPath": "v2/billingAccounts/{billingAccountsId}/sinks", + "httpMethod": "POST", + "parameters": { + "uniqueWriterIdentity": { + "description": "Optional. Determines the kind of IAM identity returned as writer_identity in the new sink. If this value is omitted or set to false, and if the sink's parent is a project, then the value returned as writer_identity is cloud-logs@google.com, the same identity used before the addition of writer identities to this API. The sink's destination must be in the same project as the sink itself.If this field is set to true, or if the sink is owned by a non-project resource such as an organization, then the value of writer_identity will be a unique service account used only for exports from the new sink. For more information, see writer_identity in LogSink.", + "location": "query", + "type": "boolean" + }, + "parent": { + "description": "Required. The resource in which to create the sink:\n\"projects/[PROJECT_ID]\"\n\"organizations/[ORGANIZATION_ID]\"\nExamples: \"projects/my-logging-project\", \"organizations/123456789\".", + "required": true, + "pattern": "^billingAccounts/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v2/{+parent}/sinks", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/logging.admin" + ] + }, + "list": { + "id": "logging.billingAccounts.sinks.list", + "response": { + "$ref": "ListSinksResponse" + }, + "parameterOrder": [ + "parent" + ], + "description": "Lists sinks.", + "flatPath": "v2/billingAccounts/{billingAccountsId}/sinks", + "httpMethod": "GET", + "parameters": { + "pageSize": { + "description": "Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "parent": { + "description": "Required. The parent resource whose sinks are to be listed. Examples: \"projects/my-logging-project\", \"organizations/123456789\".", + "required": true, + "pattern": "^billingAccounts/[^/]+$", + "location": "path", + "type": "string" + }, + "pageToken": { + "description": "Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call.", + "location": "query", + "type": "string" + } + }, + "path": "v2/{+parent}/sinks", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + "https://www.googleapis.com/auth/logging.admin", + "https://www.googleapis.com/auth/logging.read" + ] + }, + "delete": { + "id": "logging.billingAccounts.sinks.delete", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "sinkName" + ], + "description": "Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted.", + "flatPath": "v2/billingAccounts/{billingAccountsId}/sinks/{sinksId}", + "httpMethod": "DELETE", + "parameters": { + "sinkName": { + "description": "Required. The full resource name of the sink to delete, including the parent resource and the sink identifier:\n\"projects/[PROJECT_ID]/sinks/[SINK_ID]\"\n\"organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]\"\nIt is an error if the sink does not exist. Example: \"projects/my-project-id/sinks/my-sink-id\". It is an error if the sink does not exist.", + "required": true, + "pattern": "^billingAccounts/[^/]+/sinks/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v2/{+sinkName}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/logging.admin" + ] + } + } + } + } + }, + "organizations": { + "resources": { + "logs": { + "methods": { + "list": { + "id": "logging.organizations.logs.list", + "response": { + "$ref": "ListLogsResponse" + }, + "parameterOrder": [ + "parent" + ], + "description": "Lists the logs in projects or organizations. Only logs that have entries are listed.", + "flatPath": "v2/organizations/{organizationsId}/logs", + "httpMethod": "GET", + "parameters": { + "pageSize": { + "description": "Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "parent": { + "description": "Required. The resource name that owns the logs:\n\"projects/[PROJECT_ID]\"\n\"organizations/[ORGANIZATION_ID]\"\n", + "required": true, + "pattern": "^organizations/[^/]+$", + "location": "path", + "type": "string" + }, + "pageToken": { + "description": "Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call.", + "location": "query", + "type": "string" + } + }, + "path": "v2/{+parent}/logs", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + "https://www.googleapis.com/auth/logging.admin", + "https://www.googleapis.com/auth/logging.read" + ] + }, + "delete": { + "id": "logging.organizations.logs.delete", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "logName" + ], + "description": "Deletes all the log entries in a log. The log reappears if it receives new entries.", + "flatPath": "v2/organizations/{organizationsId}/logs/{logsId}", + "httpMethod": "DELETE", + "parameters": { + "logName": { + "description": "Required. The resource name of the log to delete:\n\"projects/[PROJECT_ID]/logs/[LOG_ID]\"\n\"organizations/[ORGANIZATION_ID]/logs/[LOG_ID]\"\n[LOG_ID] must be URL-encoded. For example, \"projects/my-project-id/logs/syslog\", \"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity\". For more information about log names, see LogEntry.", + "required": true, + "pattern": "^organizations/[^/]+/logs/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v2/{+logName}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/logging.admin" + ] + } + } + }, + "sinks": { + "methods": { + "update": { + "id": "logging.organizations.sinks.update", + "response": { + "$ref": "LogSink" + }, + "parameterOrder": [ + "sinkName" + ], + "description": "Updates a sink. If the named sink doesn't exist, then this method is identical to sinks.create. If the named sink does exist, then this method replaces the following fields in the existing sink with values from the new sink: destination, filter, output_version_format, start_time, and end_time. The updated filter might also have a new writer_identity; see the unique_writer_identity field.", + "request": { + "$ref": "LogSink" + }, + "flatPath": "v2/organizations/{organizationsId}/sinks/{sinksId}", + "httpMethod": "PUT", + "parameters": { + "sinkName": { + "description": "Required. The full resource name of the sink to update, including the parent resource and the sink identifier:\n\"projects/[PROJECT_ID]/sinks/[SINK_ID]\"\n\"organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]\"\nExample: \"projects/my-project-id/sinks/my-sink-id\".", + "required": true, + "pattern": "^organizations/[^/]+/sinks/[^/]+$", + "location": "path", + "type": "string" + }, + "uniqueWriterIdentity": { + "description": "Optional. See sinks.create for a description of this field. When updating a sink, the effect of this field on the value of writer_identity in the updated sink depends on both the old and new values of this field:\nIf the old and new values of this field are both false or both true, then there is no change to the sink's writer_identity.\nIf the old value was false and the new value is true, then writer_identity is changed to a unique service account.\nIt is an error if the old value was true and the new value is false.", + "location": "query", + "type": "boolean" + } + }, + "path": "v2/{+sinkName}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/logging.admin" + ] + }, + "get": { + "id": "logging.organizations.sinks.get", + "response": { + "$ref": "LogSink" + }, + "parameterOrder": [ + "sinkName" + ], + "description": "Gets a sink.", + "flatPath": "v2/organizations/{organizationsId}/sinks/{sinksId}", + "httpMethod": "GET", + "parameters": { + "sinkName": { + "description": "Required. The parent resource name of the sink:\n\"projects/[PROJECT_ID]/sinks/[SINK_ID]\"\n\"organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]\"\nExample: \"projects/my-project-id/sinks/my-sink-id\".", + "required": true, + "pattern": "^organizations/[^/]+/sinks/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v2/{+sinkName}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + "https://www.googleapis.com/auth/logging.admin", + "https://www.googleapis.com/auth/logging.read" + ] + }, + "create": { + "id": "logging.organizations.sinks.create", + "response": { + "$ref": "LogSink" + }, + "parameterOrder": [ + "parent" + ], + "description": "Creates a sink that exports specified log entries to a destination. The export of newly-ingested log entries begins immediately, unless the current time is outside the sink's start and end times or the sink's writer_identity is not permitted to write to the destination. A sink can export log entries only from the resource owning the sink.", + "request": { + "$ref": "LogSink" + }, + "flatPath": "v2/organizations/{organizationsId}/sinks", + "httpMethod": "POST", + "parameters": { + "uniqueWriterIdentity": { + "description": "Optional. Determines the kind of IAM identity returned as writer_identity in the new sink. If this value is omitted or set to false, and if the sink's parent is a project, then the value returned as writer_identity is cloud-logs@google.com, the same identity used before the addition of writer identities to this API. The sink's destination must be in the same project as the sink itself.If this field is set to true, or if the sink is owned by a non-project resource such as an organization, then the value of writer_identity will be a unique service account used only for exports from the new sink. For more information, see writer_identity in LogSink.", + "location": "query", + "type": "boolean" + }, + "parent": { + "description": "Required. The resource in which to create the sink:\n\"projects/[PROJECT_ID]\"\n\"organizations/[ORGANIZATION_ID]\"\nExamples: \"projects/my-logging-project\", \"organizations/123456789\".", + "required": true, + "pattern": "^organizations/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v2/{+parent}/sinks", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/logging.admin" + ] + }, + "list": { + "id": "logging.organizations.sinks.list", + "response": { + "$ref": "ListSinksResponse" + }, + "parameterOrder": [ + "parent" + ], + "description": "Lists sinks.", + "flatPath": "v2/organizations/{organizationsId}/sinks", + "httpMethod": "GET", + "parameters": { + "pageSize": { + "description": "Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "parent": { + "description": "Required. The parent resource whose sinks are to be listed. Examples: \"projects/my-logging-project\", \"organizations/123456789\".", + "required": true, + "pattern": "^organizations/[^/]+$", + "location": "path", + "type": "string" + }, + "pageToken": { + "description": "Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call.", + "location": "query", + "type": "string" + } + }, + "path": "v2/{+parent}/sinks", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + "https://www.googleapis.com/auth/logging.admin", + "https://www.googleapis.com/auth/logging.read" + ] + }, + "delete": { + "id": "logging.organizations.sinks.delete", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "sinkName" + ], + "description": "Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted.", + "flatPath": "v2/organizations/{organizationsId}/sinks/{sinksId}", + "httpMethod": "DELETE", + "parameters": { + "sinkName": { + "description": "Required. The full resource name of the sink to delete, including the parent resource and the sink identifier:\n\"projects/[PROJECT_ID]/sinks/[SINK_ID]\"\n\"organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]\"\nIt is an error if the sink does not exist. Example: \"projects/my-project-id/sinks/my-sink-id\". It is an error if the sink does not exist.", + "required": true, + "pattern": "^organizations/[^/]+/sinks/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v2/{+sinkName}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/logging.admin" + ] + } + } + } + } + }, + "projects": { + "resources": { + "metrics": { + "methods": { + "update": { + "id": "logging.projects.metrics.update", + "response": { + "$ref": "LogMetric" + }, + "parameterOrder": [ + "metricName" + ], + "description": "Creates or updates a logs-based metric.", + "request": { + "$ref": "LogMetric" + }, + "flatPath": "v2/projects/{projectsId}/metrics/{metricsId}", + "httpMethod": "PUT", + "parameters": { + "metricName": { + "description": "The resource name of the metric to update:\n\"projects/[PROJECT_ID]/metrics/[METRIC_ID]\"\nThe updated metric must be provided in the request and it's name field must be the same as [METRIC_ID] If the metric does not exist in [PROJECT_ID], then a new metric is created.", + "required": true, + "pattern": "^projects/[^/]+/metrics/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v2/{+metricName}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/logging.admin", + "https://www.googleapis.com/auth/logging.write" + ] + }, + "get": { + "id": "logging.projects.metrics.get", + "response": { + "$ref": "LogMetric" + }, + "parameterOrder": [ + "metricName" + ], + "description": "Gets a logs-based metric.", + "flatPath": "v2/projects/{projectsId}/metrics/{metricsId}", + "httpMethod": "GET", + "parameters": { + "metricName": { + "description": "The resource name of the desired metric:\n\"projects/[PROJECT_ID]/metrics/[METRIC_ID]\"\n", + "required": true, + "pattern": "^projects/[^/]+/metrics/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v2/{+metricName}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + "https://www.googleapis.com/auth/logging.admin", + "https://www.googleapis.com/auth/logging.read" + ] + }, + "create": { + "id": "logging.projects.metrics.create", + "response": { + "$ref": "LogMetric" + }, + "parameterOrder": [ + "parent" + ], + "description": "Creates a logs-based metric.", + "request": { + "$ref": "LogMetric" + }, + "flatPath": "v2/projects/{projectsId}/metrics", + "httpMethod": "POST", + "parameters": { + "parent": { + "description": "The resource name of the project in which to create the metric:\n\"projects/[PROJECT_ID]\"\nThe new metric must be provided in the request.", + "required": true, + "pattern": "^projects/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v2/{+parent}/metrics", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/logging.admin", + "https://www.googleapis.com/auth/logging.write" + ] + }, + "list": { + "id": "logging.projects.metrics.list", + "response": { + "$ref": "ListLogMetricsResponse" + }, + "parameterOrder": [ + "parent" + ], + "description": "Lists logs-based metrics.", + "flatPath": "v2/projects/{projectsId}/metrics", + "httpMethod": "GET", + "parameters": { + "pageSize": { + "description": "Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "parent": { + "description": "Required. The name of the project containing the metrics:\n\"projects/[PROJECT_ID]\"\n", + "required": true, + "pattern": "^projects/[^/]+$", + "location": "path", + "type": "string" + }, + "pageToken": { + "description": "Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call.", + "location": "query", + "type": "string" + } + }, + "path": "v2/{+parent}/metrics", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + "https://www.googleapis.com/auth/logging.admin", + "https://www.googleapis.com/auth/logging.read" + ] + }, + "delete": { + "id": "logging.projects.metrics.delete", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "metricName" + ], + "description": "Deletes a logs-based metric.", + "flatPath": "v2/projects/{projectsId}/metrics/{metricsId}", + "httpMethod": "DELETE", + "parameters": { + "metricName": { + "description": "The resource name of the metric to delete:\n\"projects/[PROJECT_ID]/metrics/[METRIC_ID]\"\n", + "required": true, + "pattern": "^projects/[^/]+/metrics/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v2/{+metricName}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/logging.admin", + "https://www.googleapis.com/auth/logging.write" + ] + } + } + }, + "logs": { + "methods": { + "list": { + "id": "logging.projects.logs.list", + "response": { + "$ref": "ListLogsResponse" + }, + "parameterOrder": [ + "parent" + ], + "description": "Lists the logs in projects or organizations. Only logs that have entries are listed.", + "flatPath": "v2/projects/{projectsId}/logs", + "httpMethod": "GET", + "parameters": { + "pageSize": { + "description": "Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "parent": { + "description": "Required. The resource name that owns the logs:\n\"projects/[PROJECT_ID]\"\n\"organizations/[ORGANIZATION_ID]\"\n", + "required": true, + "pattern": "^projects/[^/]+$", + "location": "path", + "type": "string" + }, + "pageToken": { + "description": "Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call.", + "location": "query", + "type": "string" + } + }, + "path": "v2/{+parent}/logs", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + "https://www.googleapis.com/auth/logging.admin", + "https://www.googleapis.com/auth/logging.read" + ] + }, + "delete": { + "id": "logging.projects.logs.delete", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "logName" + ], + "description": "Deletes all the log entries in a log. The log reappears if it receives new entries.", + "flatPath": "v2/projects/{projectsId}/logs/{logsId}", + "httpMethod": "DELETE", + "parameters": { + "logName": { + "description": "Required. The resource name of the log to delete:\n\"projects/[PROJECT_ID]/logs/[LOG_ID]\"\n\"organizations/[ORGANIZATION_ID]/logs/[LOG_ID]\"\n[LOG_ID] must be URL-encoded. For example, \"projects/my-project-id/logs/syslog\", \"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity\". For more information about log names, see LogEntry.", + "required": true, + "pattern": "^projects/[^/]+/logs/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v2/{+logName}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/logging.admin" + ] + } + } + }, + "sinks": { + "methods": { + "update": { + "id": "logging.projects.sinks.update", + "response": { + "$ref": "LogSink" + }, + "parameterOrder": [ + "sinkName" + ], + "description": "Updates a sink. If the named sink doesn't exist, then this method is identical to sinks.create. If the named sink does exist, then this method replaces the following fields in the existing sink with values from the new sink: destination, filter, output_version_format, start_time, and end_time. The updated filter might also have a new writer_identity; see the unique_writer_identity field.", + "request": { + "$ref": "LogSink" + }, + "flatPath": "v2/projects/{projectsId}/sinks/{sinksId}", + "httpMethod": "PUT", + "parameters": { + "sinkName": { + "description": "Required. The full resource name of the sink to update, including the parent resource and the sink identifier:\n\"projects/[PROJECT_ID]/sinks/[SINK_ID]\"\n\"organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]\"\nExample: \"projects/my-project-id/sinks/my-sink-id\".", + "required": true, + "pattern": "^projects/[^/]+/sinks/[^/]+$", + "location": "path", + "type": "string" + }, + "uniqueWriterIdentity": { + "description": "Optional. See sinks.create for a description of this field. When updating a sink, the effect of this field on the value of writer_identity in the updated sink depends on both the old and new values of this field:\nIf the old and new values of this field are both false or both true, then there is no change to the sink's writer_identity.\nIf the old value was false and the new value is true, then writer_identity is changed to a unique service account.\nIt is an error if the old value was true and the new value is false.", + "location": "query", + "type": "boolean" + } + }, + "path": "v2/{+sinkName}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/logging.admin" + ] + }, + "get": { + "id": "logging.projects.sinks.get", + "response": { + "$ref": "LogSink" + }, + "parameterOrder": [ + "sinkName" + ], + "description": "Gets a sink.", + "flatPath": "v2/projects/{projectsId}/sinks/{sinksId}", + "httpMethod": "GET", + "parameters": { + "sinkName": { + "description": "Required. The parent resource name of the sink:\n\"projects/[PROJECT_ID]/sinks/[SINK_ID]\"\n\"organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]\"\nExample: \"projects/my-project-id/sinks/my-sink-id\".", + "required": true, + "pattern": "^projects/[^/]+/sinks/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v2/{+sinkName}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + "https://www.googleapis.com/auth/logging.admin", + "https://www.googleapis.com/auth/logging.read" + ] + }, + "create": { + "id": "logging.projects.sinks.create", + "response": { + "$ref": "LogSink" + }, + "parameterOrder": [ + "parent" + ], + "description": "Creates a sink that exports specified log entries to a destination. The export of newly-ingested log entries begins immediately, unless the current time is outside the sink's start and end times or the sink's writer_identity is not permitted to write to the destination. A sink can export log entries only from the resource owning the sink.", + "request": { + "$ref": "LogSink" + }, + "flatPath": "v2/projects/{projectsId}/sinks", + "httpMethod": "POST", + "parameters": { + "uniqueWriterIdentity": { + "description": "Optional. Determines the kind of IAM identity returned as writer_identity in the new sink. If this value is omitted or set to false, and if the sink's parent is a project, then the value returned as writer_identity is cloud-logs@google.com, the same identity used before the addition of writer identities to this API. The sink's destination must be in the same project as the sink itself.If this field is set to true, or if the sink is owned by a non-project resource such as an organization, then the value of writer_identity will be a unique service account used only for exports from the new sink. For more information, see writer_identity in LogSink.", + "location": "query", + "type": "boolean" + }, + "parent": { + "description": "Required. The resource in which to create the sink:\n\"projects/[PROJECT_ID]\"\n\"organizations/[ORGANIZATION_ID]\"\nExamples: \"projects/my-logging-project\", \"organizations/123456789\".", + "required": true, + "pattern": "^projects/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v2/{+parent}/sinks", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/logging.admin" + ] + }, + "list": { + "id": "logging.projects.sinks.list", + "response": { + "$ref": "ListSinksResponse" + }, + "parameterOrder": [ + "parent" + ], + "description": "Lists sinks.", + "flatPath": "v2/projects/{projectsId}/sinks", + "httpMethod": "GET", + "parameters": { + "pageSize": { + "description": "Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "parent": { + "description": "Required. The parent resource whose sinks are to be listed. Examples: \"projects/my-logging-project\", \"organizations/123456789\".", + "required": true, + "pattern": "^projects/[^/]+$", + "location": "path", + "type": "string" + }, + "pageToken": { + "description": "Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call.", + "location": "query", + "type": "string" + } + }, + "path": "v2/{+parent}/sinks", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + "https://www.googleapis.com/auth/logging.admin", + "https://www.googleapis.com/auth/logging.read" + ] + }, + "delete": { + "id": "logging.projects.sinks.delete", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "sinkName" + ], + "description": "Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted.", + "flatPath": "v2/projects/{projectsId}/sinks/{sinksId}", + "httpMethod": "DELETE", + "parameters": { + "sinkName": { + "description": "Required. The full resource name of the sink to delete, including the parent resource and the sink identifier:\n\"projects/[PROJECT_ID]/sinks/[SINK_ID]\"\n\"organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]\"\nIt is an error if the sink does not exist. Example: \"projects/my-project-id/sinks/my-sink-id\". It is an error if the sink does not exist.", + "required": true, + "pattern": "^projects/[^/]+/sinks/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v2/{+sinkName}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/logging.admin" + ] + } + } + } + } + }, + "entries": { + "methods": { + "write": { + "id": "logging.entries.write", + "response": { + "$ref": "WriteLogEntriesResponse" + }, + "parameterOrder": [], + "description": "Writes log entries to Stackdriver Logging. All log entries are written by this method.", + "request": { + "$ref": "WriteLogEntriesRequest" + }, + "flatPath": "v2/entries:write", + "httpMethod": "POST", + "parameters": {}, + "path": "v2/entries:write", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/logging.admin", + "https://www.googleapis.com/auth/logging.write" + ] + }, + "list": { + "id": "logging.entries.list", + "response": { + "$ref": "ListLogEntriesResponse" + }, + "parameterOrder": [], + "description": "Lists log entries. Use this method to retrieve log entries from Stackdriver Logging. For ways to export log entries, see Exporting Logs.", + "request": { + "$ref": "ListLogEntriesRequest" + }, + "flatPath": "v2/entries:list", + "httpMethod": "POST", + "parameters": {}, + "path": "v2/entries:list", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + "https://www.googleapis.com/auth/logging.admin", + "https://www.googleapis.com/auth/logging.read" + ] + } + } + }, + "monitoredResourceDescriptors": { + "methods": { + "list": { + "id": "logging.monitoredResourceDescriptors.list", + "response": { + "$ref": "ListMonitoredResourceDescriptorsResponse" + }, + "parameterOrder": [], + "description": "Lists the descriptors for monitored resource types used by Stackdriver Logging.", + "flatPath": "v2/monitoredResourceDescriptors", + "httpMethod": "GET", + "parameters": { + "pageSize": { + "description": "Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "pageToken": { + "description": "Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call.", + "location": "query", + "type": "string" + } + }, + "path": "v2/monitoredResourceDescriptors", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + "https://www.googleapis.com/auth/logging.admin", + "https://www.googleapis.com/auth/logging.read" + ] + } + } + } + }, + "schemas": { + "ListLogEntriesResponse": { + "description": "Result returned from ListLogEntries.", + "type": "object", + "properties": { + "entries": { + "description": "A list of log entries.", + "type": "array", + "items": { + "$ref": "LogEntry" + } + }, + "nextPageToken": { + "description": "If there might be more results than those appearing in this response, then nextPageToken is included. To get the next set of results, call this method again using the value of nextPageToken as pageToken.If a value for next_page_token appears and the entries field is empty, it means that the search found no log entries so far but it did not have time to search all the possible log entries. Retry the method with this value for page_token to continue the search. Alternatively, consider speeding up the search by changing your filter to specify a single log name or resource type, or to narrow the time range of the search.", + "type": "string" + } + }, + "id": "ListLogEntriesResponse" + }, + "ListSinksResponse": { + "description": "Result returned from ListSinks.", + "type": "object", + "properties": { + "nextPageToken": { + "description": "If there might be more results than appear in this response, then nextPageToken is included. To get the next set of results, call the same method again using the value of nextPageToken as pageToken.", + "type": "string" + }, + "sinks": { + "description": "A list of sinks.", + "type": "array", + "items": { + "$ref": "LogSink" + } + } + }, + "id": "ListSinksResponse" + }, + "SourceLocation": { + "description": "Specifies a location in a source code file.", + "type": "object", + "properties": { + "file": { + "description": "Source file name. Depending on the runtime environment, this might be a simple name or a fully-qualified name.", + "type": "string" + }, + "functionName": { + "description": "Human-readable name of the function or method being invoked, with optional context such as the class or package name. This information is used in contexts such as the logs viewer, where a file and line number are less meaningful. The format can vary by language. For example: qual.if.ied.Class.method (Java), dir/package.func (Go), function (Python).", + "type": "string" + }, + "line": { + "description": "Line within the source file.", + "type": "string", + "format": "int64" + } + }, + "id": "SourceLocation" + }, + "LogSink": { + "description": "Describes a sink used to export log entries to one of the following destinations in any project: a Cloud Storage bucket, a BigQuery dataset, or a Cloud Pub/Sub topic. A logs filter controls which log entries are exported. The sink must be created within a project or organization.", + "type": "object", + "properties": { + "destination": { + "description": "Required. The export destination:\n\"storage.googleapis.com/[GCS_BUCKET]\"\n\"bigquery.googleapis.com/projects/[PROJECT_ID]/datasets/[DATASET]\"\n\"pubsub.googleapis.com/projects/[PROJECT_ID]/topics/[TOPIC_ID]\"\nThe sink's writer_identity, set when the sink is created, must have permission to write to the destination or else the log entries are not exported. For more information, see Exporting Logs With Sinks.", + "type": "string" + }, + "filter": { + "description": "Optional. An advanced logs filter. The only exported log entries are those that are in the resource owning the sink and that match the filter. The filter must use the log entry format specified by the output_version_format parameter. For example, in the v2 format:\nlogName=\"projects/[PROJECT_ID]/logs/[LOG_ID]\" AND severity\u003e=ERROR\n", + "type": "string" + }, + "endTime": { + "description": "Optional. The time at which this sink will stop exporting log entries. Log entries are exported only if their timestamp is earlier than the end time. If this field is not supplied, there is no end time. If both a start time and an end time are provided, then the end time must be later than the start time.", + "type": "string", + "format": "google-datetime" + }, + "name": { + "description": "Required. The client-assigned sink identifier, unique within the project. Example: \"my-syslog-errors-to-pubsub\". Sink identifiers are limited to 100 characters and can include only the following characters: upper and lower-case alphanumeric characters, underscores, hyphens, and periods.", + "type": "string" + }, + "startTime": { + "description": "Optional. The time at which this sink will begin exporting log entries. Log entries are exported only if their timestamp is not earlier than the start time. The default value of this field is the time the sink is created or updated.", + "type": "string", + "format": "google-datetime" + }, + "outputVersionFormat": { + "description": "Optional. The log entry format to use for this sink's exported log entries. The v2 format is used by default. The v1 format is deprecated and should be used only as part of a migration effort to v2. See Migration to the v2 API.", + "enum": [ + "VERSION_FORMAT_UNSPECIFIED", + "V2", + "V1" + ], + "enumDescriptions": [ + "An unspecified format version that will default to V2.", + "LogEntry version 2 format.", + "LogEntry version 1 format." + ], + "type": "string" + }, + "writerIdentity": { + "description": "Output only. An IAM identity—a service account or group—under which Stackdriver Logging writes the exported log entries to the sink's destination. This field is set by sinks.create and sinks.update, based on the setting of unique_writer_identity in those methods.Until you grant this identity write-access to the destination, log entry exports from this sink will fail. For more information, see Granting access for a resource. Consult the destination service's documentation to determine the appropriate IAM roles to assign to the identity.", + "type": "string" + } + }, + "id": "LogSink" + }, + "ListLogsResponse": { + "description": "Result returned from ListLogs.", + "type": "object", + "properties": { + "logNames": { + "description": "A list of log names. For example, \"projects/my-project/syslog\" or \"organizations/123/cloudresourcemanager.googleapis.com%2Factivity\".", + "type": "array", + "items": { + "type": "string" + } + }, + "nextPageToken": { + "description": "If there might be more results than those appearing in this response, then nextPageToken is included. To get the next set of results, call this method again using the value of nextPageToken as pageToken.", + "type": "string" + } + }, + "id": "ListLogsResponse" + }, + "LogMetric": { + "description": "Describes a logs-based metric. The value of the metric is the number of log entries that match a logs filter in a given time interval.", + "type": "object", + "properties": { + "description": { + "description": "Optional. A description of this metric, which is used in documentation.", + "type": "string" + }, + "filter": { + "description": "Required. An advanced logs filter which is used to match log entries. Example:\n\"resource.type=gae_app AND severity\u003e=ERROR\"\nThe maximum length of the filter is 20000 characters.", + "type": "string" + }, + "name": { + "description": "Required. The client-assigned metric identifier. Examples: \"error_count\", \"nginx/requests\".Metric identifiers are limited to 100 characters and can include only the following characters: A-Z, a-z, 0-9, and the special characters _-.,+!*',()%/. The forward-slash character (/) denotes a hierarchy of name pieces, and it cannot be the first character of the name.The metric identifier in this field must not be URL-encoded (https://en.wikipedia.org/wiki/Percent-encoding). However, when the metric identifier appears as the [METRIC_ID] part of a metric_name API parameter, then the metric identifier must be URL-encoded. Example: \"projects/my-project/metrics/nginx%2Frequests\".", + "type": "string" + }, + "version": { + "description": "Output only. The API version that created or updated this metric. The version also dictates the syntax of the filter expression. When a value for this field is missing, the default value of V2 should be assumed.", + "enum": [ + "V2", + "V1" + ], + "enumDescriptions": [ + "Stackdriver Logging API v2.", + "Stackdriver Logging API v1." + ], + "type": "string" + } + }, + "id": "LogMetric" + }, + "LogEntry": { + "description": "An individual entry in a log.", + "type": "object", + "properties": { + "textPayload": { + "description": "The log entry payload, represented as a Unicode string (UTF-8).", + "type": "string" + }, + "httpRequest": { + "description": "Optional. Information about the HTTP request associated with this log entry, if applicable.", + "$ref": "HttpRequest" + }, + "sourceLocation": { + "description": "Optional. Source code location information associated with the log entry, if any.", + "$ref": "LogEntrySourceLocation" + }, + "jsonPayload": { + "description": "The log entry payload, represented as a structure that is expressed as a JSON object.", + "additionalProperties": { + "description": "Properties of the object.", + "type": "any" + }, + "type": "object" + }, + "labels": { + "description": "Optional. A set of user-defined (key, value) data that provides additional information about the log entry.", + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + "trace": { + "description": "Optional. Resource name of the trace associated with the log entry, if any. If it contains a relative resource name, the name is assumed to be relative to //tracing.googleapis.com. Example: projects/my-projectid/traces/06796866738c859f2f19b7cfb3214824", + "type": "string" + }, + "logName": { + "description": "Required. The resource name of the log to which this log entry belongs:\n\"projects/[PROJECT_ID]/logs/[LOG_ID]\"\n\"organizations/[ORGANIZATION_ID]/logs/[LOG_ID]\"\n[LOG_ID] must be URL-encoded within log_name. Example: \"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity\". [LOG_ID] must be less than 512 characters long and can only include the following characters: upper and lower case alphanumeric characters, forward-slash, underscore, hyphen, and period.For backward compatibility, if log_name begins with a forward-slash, such as /projects/..., then the log entry is ingested as usual but the forward-slash is removed. Listing the log entry will not show the leading slash and filtering for a log name with a leading slash will never return any results.", + "type": "string" + }, + "severity": { + "description": "Optional. The severity of the log entry. The default value is LogSeverity.DEFAULT.", + "enum": [ + "DEFAULT", + "DEBUG", + "INFO", + "NOTICE", + "WARNING", + "ERROR", + "CRITICAL", + "ALERT", + "EMERGENCY" + ], + "enumDescriptions": [ + "(0) The log entry has no assigned severity level.", + "(100) Debug or trace information.", + "(200) Routine information, such as ongoing status or performance.", + "(300) Normal but significant events, such as start up, shut down, or a configuration change.", + "(400) Warning events might cause problems.", + "(500) Error events are likely to cause problems.", + "(600) Critical events cause more severe problems or outages.", + "(700) A person must take an action immediately.", + "(800) One or more systems are unusable." + ], + "type": "string" + }, + "resource": { + "description": "Required. The monitored resource associated with this log entry. Example: a log entry that reports a database error would be associated with the monitored resource designating the particular database that reported the error.", + "$ref": "MonitoredResource" + }, + "protoPayload": { + "description": "The log entry payload, represented as a protocol buffer. Some Google Cloud Platform services use this field for their log entry payloads.", + "additionalProperties": { + "description": "Properties of the object. Contains field @type with type URL.", + "type": "any" + }, + "type": "object" + }, + "timestamp": { + "description": "Optional. The time the event described by the log entry occurred. If omitted, Stackdriver Logging will use the time the log entry is received.", + "type": "string", + "format": "google-datetime" + }, + "insertId": { + "description": "Optional. A unique ID for the log entry. If you provide this field, the logging service considers other log entries in the same project with the same ID as duplicates which can be removed. If omitted, Stackdriver Logging will generate a unique ID for this log entry.", + "type": "string" + }, + "operation": { + "description": "Optional. Information about an operation associated with the log entry, if applicable.", + "$ref": "LogEntryOperation" + } + }, + "id": "LogEntry" + }, + "LogLine": { + "description": "Application log line emitted while processing a request.", + "type": "object", + "properties": { + "time": { + "description": "Approximate time when this log entry was made.", + "type": "string", + "format": "google-datetime" + }, + "severity": { + "description": "Severity of this log entry.", + "enum": [ + "DEFAULT", + "DEBUG", + "INFO", + "NOTICE", + "WARNING", + "ERROR", + "CRITICAL", + "ALERT", + "EMERGENCY" + ], + "enumDescriptions": [ + "(0) The log entry has no assigned severity level.", + "(100) Debug or trace information.", + "(200) Routine information, such as ongoing status or performance.", + "(300) Normal but significant events, such as start up, shut down, or a configuration change.", + "(400) Warning events might cause problems.", + "(500) Error events are likely to cause problems.", + "(600) Critical events cause more severe problems or outages.", + "(700) A person must take an action immediately.", + "(800) One or more systems are unusable." + ], + "type": "string" + }, + "sourceLocation": { + "description": "Where in the source code this log message was written.", + "$ref": "SourceLocation" + }, + "logMessage": { + "description": "App-provided log message.", + "type": "string" + } + }, + "id": "LogLine" + }, + "SourceReference": { + "description": "A reference to a particular snapshot of the source tree used to build and deploy an application.", + "type": "object", + "properties": { + "repository": { + "description": "Optional. A URI string identifying the repository. Example: \"https://github.com/GoogleCloudPlatform/kubernetes.git\"", + "type": "string" + }, + "revisionId": { + "description": "The canonical and persistent identifier of the deployed revision. Example (git): \"0035781c50ec7aa23385dc841529ce8a4b70db1b\"", + "type": "string" + } + }, + "id": "SourceReference" + }, + "MonitoredResource": { + "description": "An object representing a resource that can be used for monitoring, logging, billing, or other purposes. Examples include virtual machine instances, databases, and storage devices such as disks. The type field identifies a MonitoredResourceDescriptor object that describes the resource's schema. Information in the labels field identifies the actual resource and its attributes according to the schema. For example, a particular Compute Engine VM instance could be represented by the following object, because the MonitoredResourceDescriptor for \"gce_instance\" has labels \"instance_id\" and \"zone\":\n{ \"type\": \"gce_instance\",\n \"labels\": { \"instance_id\": \"12345678901234\",\n \"zone\": \"us-central1-a\" }}\n", + "type": "object", + "properties": { + "labels": { + "description": "Required. Values for all of the labels listed in the associated monitored resource descriptor. For example, Cloud SQL databases use the labels \"database_id\" and \"zone\".", + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + "type": { + "description": "Required. The monitored resource type. This field must match the type field of a MonitoredResourceDescriptor object. For example, the type of a Cloud SQL database is \"cloudsql_database\".", + "type": "string" + } + }, + "id": "MonitoredResource" + }, + "WriteLogEntriesRequest": { + "description": "The parameters to WriteLogEntries.", + "type": "object", + "properties": { + "labels": { + "description": "Optional. Default labels that are added to the labels field of all log entries in entries. If a log entry already has a label with the same key as a label in this parameter, then the log entry's label is not changed. See LogEntry.", + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + "entries": { + "description": "Required. The log entries to write. Values supplied for the fields log_name, resource, and labels in this entries.write request are added to those log entries that do not provide their own values for the fields.To improve throughput and to avoid exceeding the quota limit for calls to entries.write, you should write multiple log entries at once rather than calling this method for each individual log entry.", + "type": "array", + "items": { + "$ref": "LogEntry" + } + }, + "logName": { + "description": "Optional. A default log resource name that is assigned to all log entries in entries that do not specify a value for log_name:\n\"projects/[PROJECT_ID]/logs/[LOG_ID]\"\n\"organizations/[ORGANIZATION_ID]/logs/[LOG_ID]\"\n[LOG_ID] must be URL-encoded. For example, \"projects/my-project-id/logs/syslog\" or \"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity\". For more information about log names, see LogEntry.", + "type": "string" + }, + "partialSuccess": { + "description": "Optional. Whether valid entries should be written even if some other entries fail due to INVALID_ARGUMENT or PERMISSION_DENIED errors. If any entry is not written, the response status will be the error associated with one of the failed entries and include error details in the form of WriteLogEntriesPartialErrors.", + "type": "boolean" + }, + "resource": { + "description": "Optional. A default monitored resource object that is assigned to all log entries in entries that do not specify a value for resource. Example:\n{ \"type\": \"gce_instance\",\n \"labels\": {\n \"zone\": \"us-central1-a\", \"instance_id\": \"00000000000000000000\" }}\nSee LogEntry.", + "$ref": "MonitoredResource" + } + }, + "id": "WriteLogEntriesRequest" + }, + "LabelDescriptor": { + "description": "A description of a label.", + "type": "object", + "properties": { + "description": { + "description": "A human-readable description for the label.", + "type": "string" + }, + "valueType": { + "description": "The type of data that can be assigned to the label.", + "enum": [ + "STRING", + "BOOL", + "INT64" + ], + "enumDescriptions": [ + "A variable-length string. This is the default.", + "Boolean; true or false.", + "A 64-bit signed integer." + ], + "type": "string" + }, + "key": { + "description": "The label key.", + "type": "string" + } + }, + "id": "LabelDescriptor" + }, + "ListLogMetricsResponse": { + "description": "Result returned from ListLogMetrics.", + "type": "object", + "properties": { + "metrics": { + "description": "A list of logs-based metrics.", + "type": "array", + "items": { + "$ref": "LogMetric" + } + }, + "nextPageToken": { + "description": "If there might be more results than appear in this response, then nextPageToken is included. To get the next set of results, call this method again using the value of nextPageToken as pageToken.", + "type": "string" + } + }, + "id": "ListLogMetricsResponse" + }, + "MonitoredResourceDescriptor": { + "description": "An object that describes the schema of a MonitoredResource object using a type name and a set of labels. For example, the monitored resource descriptor for Google Compute Engine VM instances has a type of \"gce_instance\" and specifies the use of the labels \"instance_id\" and \"zone\" to identify particular VM instances.Different APIs can support different monitored resource types. APIs generally provide a list method that returns the monitored resource descriptors used by the API.", + "type": "object", + "properties": { + "displayName": { + "description": "Optional. A concise name for the monitored resource type that might be displayed in user interfaces. It should be a Title Cased Noun Phrase, without any article or other determiners. For example, \"Google Cloud SQL Database\".", + "type": "string" + }, + "description": { + "description": "Optional. A detailed description of the monitored resource type that might be used in documentation.", + "type": "string" + }, + "labels": { + "description": "Required. A set of labels used to describe instances of this monitored resource type. For example, an individual Google Cloud SQL database is identified by values for the labels \"database_id\" and \"zone\".", + "type": "array", + "items": { + "$ref": "LabelDescriptor" + } + }, + "type": { + "description": "Required. The monitored resource type. For example, the type \"cloudsql_database\" represents databases in Google Cloud SQL. The maximum length of this value is 256 characters.", + "type": "string" + }, + "name": { + "description": "Optional. The resource name of the monitored resource descriptor: \"projects/{project_id}/monitoredResourceDescriptors/{type}\" where {type} is the value of the type field in this object and {project_id} is a project ID that provides API-specific context for accessing the type. APIs that do not use project information can use the resource name format \"monitoredResourceDescriptors/{type}\".", + "type": "string" + } + }, + "id": "MonitoredResourceDescriptor" + }, + "ListMonitoredResourceDescriptorsResponse": { + "description": "Result returned from ListMonitoredResourceDescriptors.", + "type": "object", + "properties": { + "nextPageToken": { + "description": "If there might be more results than those appearing in this response, then nextPageToken is included. To get the next set of results, call this method again using the value of nextPageToken as pageToken.", + "type": "string" + }, + "resourceDescriptors": { + "description": "A list of resource descriptors.", + "type": "array", + "items": { + "$ref": "MonitoredResourceDescriptor" + } + } + }, + "id": "ListMonitoredResourceDescriptorsResponse" + }, + "LogEntryOperation": { + "description": "Additional information about a potentially long-running operation with which a log entry is associated.", + "type": "object", + "properties": { + "producer": { + "description": "Optional. An arbitrary producer identifier. The combination of id and producer must be globally unique. Examples for producer: \"MyDivision.MyBigCompany.com\", \"github.com/MyProject/MyApplication\".", + "type": "string" + }, + "last": { + "description": "Optional. Set this to True if this is the last log entry in the operation.", + "type": "boolean" + }, + "first": { + "description": "Optional. Set this to True if this is the first log entry in the operation.", + "type": "boolean" + }, + "id": { + "description": "Optional. An arbitrary operation identifier. Log entries with the same identifier are assumed to be part of the same operation.", + "type": "string" + } + }, + "id": "LogEntryOperation" + }, + "Empty": { + "description": "A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance:\nservice Foo {\n rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);\n}\nThe JSON representation for Empty is empty JSON object {}.", + "type": "object", + "properties": {}, + "id": "Empty" + }, + "HttpRequest": { + "description": "A common proto for logging HTTP requests. Only contains semantics defined by the HTTP specification. Product-specific logging information MUST be defined in a separate message.", + "type": "object", + "properties": { + "cacheLookup": { + "description": "Whether or not a cache lookup was attempted.", + "type": "boolean" + }, + "responseSize": { + "description": "The size of the HTTP response message sent back to the client, in bytes, including the response headers and the response body.", + "type": "string", + "format": "int64" + }, + "status": { + "description": "The response code indicating the status of response. Examples: 200, 404.", + "type": "integer", + "format": "int32" + }, + "cacheValidatedWithOriginServer": { + "description": "Whether or not the response was validated with the origin server before being served from cache. This field is only meaningful if cache_hit is True.", + "type": "boolean" + }, + "referer": { + "description": "The referer URL of the request, as defined in HTTP/1.1 Header Field Definitions (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html).", + "type": "string" + }, + "cacheHit": { + "description": "Whether or not an entity was served from cache (with or without validation).", + "type": "boolean" + }, + "requestUrl": { + "description": "The scheme (http, https), the host name, the path and the query portion of the URL that was requested. Example: \"http://example.com/some/info?color=red\".", + "type": "string" + }, + "latency": { + "description": "The request processing latency on the server, from the time the request was received until the response was sent.", + "type": "string", + "format": "google-duration" + }, + "cacheFillBytes": { + "description": "The number of HTTP response bytes inserted into cache. Set only when a cache fill was attempted.", + "type": "string", + "format": "int64" + }, + "requestMethod": { + "description": "The request method. Examples: \"GET\", \"HEAD\", \"PUT\", \"POST\".", + "type": "string" + }, + "remoteIp": { + "description": "The IP address (IPv4 or IPv6) of the client that issued the HTTP request. Examples: \"192.168.1.1\", \"FE80::0202:B3FF:FE1E:8329\".", + "type": "string" + }, + "serverIp": { + "description": "The IP address (IPv4 or IPv6) of the origin server that the request was sent to.", + "type": "string" + }, + "userAgent": { + "description": "The user agent sent by the client. Example: \"Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET CLR 1.0.3705)\".", + "type": "string" + }, + "requestSize": { + "description": "The size of the HTTP request message in bytes, including the request headers and the request body.", + "type": "string", + "format": "int64" + } + }, + "id": "HttpRequest" + }, + "LogEntrySourceLocation": { + "description": "Additional information about the source code location that produced the log entry.", + "type": "object", + "properties": { + "function": { + "description": "Optional. Human-readable name of the function or method being invoked, with optional context such as the class or package name. This information may be used in contexts such as the logs viewer, where a file and line number are less meaningful. The format can vary by language. For example: qual.if.ied.Class.method (Java), dir/package.func (Go), function (Python).", + "type": "string" + }, + "file": { + "description": "Optional. Source file name. Depending on the runtime environment, this might be a simple name or a fully-qualified name.", + "type": "string" + }, + "line": { + "description": "Optional. Line within the source file. 1-based; 0 indicates no line number available.", + "type": "string", + "format": "int64" + } + }, + "id": "LogEntrySourceLocation" + }, + "RequestLog": { + "description": "Complete log information about a single HTTP request to an App Engine application.", + "type": "object", + "properties": { + "responseSize": { + "description": "Size in bytes sent back to client by request.", + "type": "string", + "format": "int64" + }, + "requestId": { + "description": "Globally unique identifier for a request, which is based on the request start time. Request IDs for requests which started later will compare greater as strings than those for requests which started earlier.", + "type": "string" + }, + "first": { + "description": "Whether this is the first RequestLog entry for this request. If an active request has several RequestLog entries written to Stackdriver Logging, then this field will be set for one of them.", + "type": "boolean" + }, + "method": { + "description": "Request method. Example: \"GET\", \"HEAD\", \"PUT\", \"POST\", \"DELETE\".", + "type": "string" + }, + "versionId": { + "description": "Version of the application that handled this request.", + "type": "string" + }, + "status": { + "description": "HTTP response status code. Example: 200, 404.", + "type": "integer", + "format": "int32" + }, + "wasLoadingRequest": { + "description": "Whether this was a loading request for the instance.", + "type": "boolean" + }, + "ip": { + "description": "Origin IP address.", + "type": "string" + }, + "nickname": { + "description": "The logged-in user who made the request.Most likely, this is the part of the user's email before the @ sign. The field value is the same for different requests from the same user, but different users can have similar names. This information is also available to the application via the App Engine Users API.This field will be populated starting with App Engine 1.9.21.", + "type": "string" + }, + "taskQueueName": { + "description": "Queue name of the request, in the case of an offline request.", + "type": "string" + }, + "pendingTime": { + "description": "Time this request spent in the pending request queue.", + "type": "string", + "format": "google-duration" + }, + "instanceIndex": { + "description": "If the instance processing this request belongs to a manually scaled module, then this is the 0-based index of the instance. Otherwise, this value is -1.", + "type": "integer", + "format": "int32" + }, + "sourceReference": { + "description": "Source code for the application that handled this request. There can be more than one source reference per deployed application if source code is distributed among multiple repositories.", + "type": "array", + "items": { + "$ref": "SourceReference" + } + }, + "moduleId": { + "description": "Module of the application that handled this request.", + "type": "string" + }, + "host": { + "description": "Internet host and port number of the resource being requested.", + "type": "string" + }, + "latency": { + "description": "Latency of the request.", + "type": "string", + "format": "google-duration" + }, + "urlMapEntry": { + "description": "File or class that handled the request.", + "type": "string" + }, + "endTime": { + "description": "Time when the request finished.", + "type": "string", + "format": "google-datetime" + }, + "line": { + "description": "A list of log lines emitted by the application while serving this request.", + "type": "array", + "items": { + "$ref": "LogLine" + } + }, + "megaCycles": { + "description": "Number of CPU megacycles used to process request.", + "type": "string", + "format": "int64" + }, + "appId": { + "description": "Application that handled this request.", + "type": "string" + }, + "traceId": { + "description": "Stackdriver Trace identifier for this request.", + "type": "string" + }, + "taskName": { + "description": "Task name of the request, in the case of an offline request.", + "type": "string" + }, + "cost": { + "description": "An indication of the relative cost of serving this request.", + "type": "number", + "format": "double" + }, + "instanceId": { + "description": "An identifier for the instance that handled the request.", + "type": "string" + }, + "startTime": { + "description": "Time when the request started.", + "type": "string", + "format": "google-datetime" + }, + "appEngineRelease": { + "description": "App Engine release version.", + "type": "string" + }, + "resource": { + "description": "Contains the path and query portion of the URL that was requested. For example, if the URL was \"http://example.com/app?name=val\", the resource would be \"/app?name=val\". The fragment identifier, which is identified by the # character, is not included.", + "type": "string" + }, + "httpVersion": { + "description": "HTTP version of request. Example: \"HTTP/1.1\".", + "type": "string" + }, + "referrer": { + "description": "Referrer URL of request.", + "type": "string" + }, + "userAgent": { + "description": "User agent that made the request.", + "type": "string" + }, + "finished": { + "description": "Whether this request is finished or active.", + "type": "boolean" + } + }, + "id": "RequestLog" + }, + "WriteLogEntriesResponse": { + "description": "Result returned from WriteLogEntries. empty", + "type": "object", + "properties": {}, + "id": "WriteLogEntriesResponse" + }, + "ListLogEntriesRequest": { + "description": "The parameters to ListLogEntries.", + "type": "object", + "properties": { + "filter": { + "description": "Optional. A filter that chooses which log entries to return. See Advanced Logs Filters. Only log entries that match the filter are returned. An empty filter matches all log entries in the resources listed in resource_names. Referencing a parent resource that is not listed in resource_names will cause the filter to return no results. The maximum length of the filter is 20000 characters.", + "type": "string" + }, + "projectIds": { + "description": "Deprecated. Use resource_names instead. One or more project identifiers or project numbers from which to retrieve log entries. Example: \"my-project-1A\". If present, these project identifiers are converted to resource name format and added to the list of resources in resource_names.", + "type": "array", + "items": { + "type": "string" + } + }, + "resourceNames": { + "description": "Required. Names of one or more resources from which to retrieve log entries:\n\"projects/[PROJECT_ID]\"\n\"organizations/[ORGANIZATION_ID]\"\nProjects listed in the project_ids field are added to this list.", + "type": "array", + "items": { + "type": "string" + } + }, + "pageSize": { + "description": "Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available.", + "type": "integer", + "format": "int32" + }, + "orderBy": { + "description": "Optional. How the results should be sorted. Presently, the only permitted values are \"timestamp asc\" (default) and \"timestamp desc\". The first option returns entries in order of increasing values of LogEntry.timestamp (oldest first), and the second option returns entries in order of decreasing timestamps (newest first). Entries with equal timestamps are returned in order of LogEntry.insertId.", + "type": "string" + }, + "pageToken": { + "description": "Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call.", + "type": "string" + } + }, + "id": "ListLogEntriesRequest" + } + }, + "revision": "20161206", + "basePath": "", + "icons": { + "x32": "http://www.google.com/images/icons/product/search-32.gif", + "x16": "http://www.google.com/images/icons/product/search-16.gif" + }, + "version_module": "True", + "canonicalName": "Logging", + "discoveryVersion": "v1", + "baseUrl": "https://logging.googleapis.com/", + "name": "logging", + "parameters": { + "access_token": { + "description": "OAuth access token.", + "type": "string", + "location": "query" + }, + "prettyPrint": { + "description": "Returns response with indentations and line breaks.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "key": { + "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", + "type": "string", + "location": "query" + }, + "quotaUser": { + "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.", + "type": "string", + "location": "query" + }, + "pp": { + "description": "Pretty-print response.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "fields": { + "description": "Selector specifying which fields to include in a partial response.", + "type": "string", + "location": "query" + }, + "alt": { + "description": "Data format for response.", + "location": "query", + "enum": [ + "json", + "media", + "proto" + ], + "default": "json", + "enumDescriptions": [ + "Responses with Content-Type of application/json", + "Media download with context-dependent Content-Type", + "Responses with Content-Type of application/x-protobuf" + ], + "type": "string" + }, + "$.xgafv": { + "description": "V1 error format.", + "enum": [ + "1", + "2" + ], + "enumDescriptions": [ + "v1 error format", + "v2 error format" + ], + "type": "string", + "location": "query" + }, + "callback": { + "description": "JSONP", + "type": "string", + "location": "query" + }, + "oauth_token": { + "description": "OAuth 2.0 token for the current user.", + "type": "string", + "location": "query" + }, + "uploadType": { + "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").", + "type": "string", + "location": "query" + }, + "bearer_token": { + "description": "OAuth bearer token.", + "type": "string", + "location": "query" + }, + "upload_protocol": { + "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").", + "type": "string", + "location": "query" + } + }, + "documentationLink": "https://cloud.google.com/logging/docs/", + "ownerDomain": "google.com", + "batchPath": "batch", + "servicePath": "", + "ownerName": "Google", + "version": "v2", + "rootUrl": "https://logging.googleapis.com/", + "kind": "discovery#restDescription" +} diff --git a/etc/api/logging/v2beta1/logging-api.json b/etc/api/logging/v2beta1/logging-api.json index c3aa09f32a..d5926d31b5 100644 --- a/etc/api/logging/v2beta1/logging-api.json +++ b/etc/api/logging/v2beta1/logging-api.json @@ -1,1209 +1,1522 @@ { - "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/AGY2FGWaHRZwgyAazem2sSX20dM\"", - "discoveryVersion": "v1", - "id": "logging:v2beta1", - "name": "logging", - "version": "v2beta1", - "revision": "20160322", - "title": "Google Cloud Logging API", - "description": "Writes log entries and manages your logs, log sinks, and logs-based metrics.", - "ownerDomain": "google.com", - "ownerName": "Google", - "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" - }, - "documentationLink": "https://cloud.google.com/logging/docs/", - "protocol": "rest", - "baseUrl": "https://logging.googleapis.com/", - "basePath": "", - "rootUrl": "https://logging.googleapis.com/", - "servicePath": "", - "batchPath": "batch", - "version_module": true, - "parameters": { - "access_token": { - "type": "string", - "description": "OAuth access token.", - "location": "query" - }, - "alt": { - "type": "string", - "description": "Data format for response.", - "default": "json", - "enumDescriptions": [ - "Responses with Content-Type of application/json", - "Media download with context-dependent Content-Type", - "Responses with Content-Type of application/x-protobuf" - ], - "location": "query" - }, - "bearer_token": { - "type": "string", - "description": "OAuth bearer token.", - "location": "query" - }, - "callback": { - "type": "string", - "description": "JSONP", - "location": "query" - }, - "fields": { - "type": "string", - "description": "Selector specifying which fields to include in a partial response.", - "location": "query" - }, - "key": { - "type": "string", - "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", - "location": "query" - }, - "oauth_token": { - "type": "string", - "description": "OAuth 2.0 token for the current user.", - "location": "query" - }, - "pp": { - "type": "boolean", - "description": "Pretty-print response.", - "default": "true", - "location": "query" - }, - "prettyPrint": { - "type": "boolean", - "description": "Returns response with indentations and line breaks.", - "default": "true", - "location": "query" - }, - "quotaUser": { - "type": "string", - "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.", - "location": "query" - }, - "upload_protocol": { - "type": "string", - "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").", - "location": "query" - }, - "uploadType": { - "type": "string", - "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").", - "location": "query" - }, - "$.xgafv": { - "type": "string", - "description": "V1 error format.", - "enumDescriptions": [ - "v1 error format", - "v2 error format" - ], - "location": "query" - } - }, - "auth": { - "oauth2": { - "scopes": { - "https://www.googleapis.com/auth/cloud-platform": { - "description": "View and manage your data across Google Cloud Platform services" - }, - "https://www.googleapis.com/auth/cloud-platform.read-only": { - "description": "View your data across Google Cloud Platform services" - }, - "https://www.googleapis.com/auth/logging.admin": { - "description": "Administrate log data for your projects" - }, - "https://www.googleapis.com/auth/logging.read": { - "description": "View log data for your projects" - }, - "https://www.googleapis.com/auth/logging.write": { - "description": "Submit log data for your projects" + "id": "logging:v2beta1", + "auth": { + "oauth2": { + "scopes": { + "https://www.googleapis.com/auth/cloud-platform": { + "description": "View and manage your data across Google Cloud Platform services" + }, + "https://www.googleapis.com/auth/cloud-platform.read-only": { + "description": "View your data across Google Cloud Platform services" + }, + "https://www.googleapis.com/auth/logging.read": { + "description": "View log data for your projects" + }, + "https://www.googleapis.com/auth/logging.write": { + "description": "Submit log data for your projects" + }, + "https://www.googleapis.com/auth/logging.admin": { + "description": "Administrate log data for your projects" + } + } } - } - } - }, - "schemas": { - "Empty": { - "id": "Empty", - "type": "object", - "description": "A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON representation for `Empty` is empty JSON object `{}`." }, - "WriteLogEntriesRequest": { - "id": "WriteLogEntriesRequest", - "type": "object", - "description": "The parameters to WriteLogEntries.", - "properties": { - "logName": { - "type": "string", - "description": "Optional. A default log resource name for those log entries in `entries` that do not specify their own `logName`. Example: `\"projects/my-project/logs/syslog\"`. See LogEntry." + "description": "Writes log entries and manages your Stackdriver Logging configuration.", + "protocol": "rest", + "title": "Stackdriver Logging API", + "resources": { + "projects": { + "resources": { + "metrics": { + "methods": { + "update": { + "id": "logging.projects.metrics.update", + "response": { + "$ref": "LogMetric" + }, + "parameterOrder": [ + "metricName" + ], + "description": "Creates or updates a logs-based metric.", + "request": { + "$ref": "LogMetric" + }, + "flatPath": "v2beta1/projects/{projectsId}/metrics/{metricsId}", + "httpMethod": "PUT", + "parameters": { + "metricName": { + "description": "The resource name of the metric to update:\n\"projects/[PROJECT_ID]/metrics/[METRIC_ID]\"\nThe updated metric must be provided in the request and it's name field must be the same as [METRIC_ID] If the metric does not exist in [PROJECT_ID], then a new metric is created.", + "required": true, + "pattern": "^projects/[^/]+/metrics/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v2beta1/{+metricName}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/logging.admin", + "https://www.googleapis.com/auth/logging.write" + ] + }, + "get": { + "id": "logging.projects.metrics.get", + "response": { + "$ref": "LogMetric" + }, + "parameterOrder": [ + "metricName" + ], + "description": "Gets a logs-based metric.", + "flatPath": "v2beta1/projects/{projectsId}/metrics/{metricsId}", + "httpMethod": "GET", + "parameters": { + "metricName": { + "description": "The resource name of the desired metric:\n\"projects/[PROJECT_ID]/metrics/[METRIC_ID]\"\n", + "required": true, + "pattern": "^projects/[^/]+/metrics/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v2beta1/{+metricName}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + "https://www.googleapis.com/auth/logging.admin", + "https://www.googleapis.com/auth/logging.read" + ] + }, + "create": { + "id": "logging.projects.metrics.create", + "response": { + "$ref": "LogMetric" + }, + "parameterOrder": [ + "parent" + ], + "description": "Creates a logs-based metric.", + "request": { + "$ref": "LogMetric" + }, + "flatPath": "v2beta1/projects/{projectsId}/metrics", + "httpMethod": "POST", + "parameters": { + "parent": { + "description": "The resource name of the project in which to create the metric:\n\"projects/[PROJECT_ID]\"\nThe new metric must be provided in the request.", + "required": true, + "pattern": "^projects/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v2beta1/{+parent}/metrics", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/logging.admin", + "https://www.googleapis.com/auth/logging.write" + ] + }, + "list": { + "id": "logging.projects.metrics.list", + "response": { + "$ref": "ListLogMetricsResponse" + }, + "parameterOrder": [ + "parent" + ], + "description": "Lists logs-based metrics.", + "flatPath": "v2beta1/projects/{projectsId}/metrics", + "httpMethod": "GET", + "parameters": { + "pageSize": { + "description": "Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "parent": { + "description": "Required. The name of the project containing the metrics:\n\"projects/[PROJECT_ID]\"\n", + "required": true, + "pattern": "^projects/[^/]+$", + "location": "path", + "type": "string" + }, + "pageToken": { + "description": "Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call.", + "location": "query", + "type": "string" + } + }, + "path": "v2beta1/{+parent}/metrics", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + "https://www.googleapis.com/auth/logging.admin", + "https://www.googleapis.com/auth/logging.read" + ] + }, + "delete": { + "id": "logging.projects.metrics.delete", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "metricName" + ], + "description": "Deletes a logs-based metric.", + "flatPath": "v2beta1/projects/{projectsId}/metrics/{metricsId}", + "httpMethod": "DELETE", + "parameters": { + "metricName": { + "description": "The resource name of the metric to delete:\n\"projects/[PROJECT_ID]/metrics/[METRIC_ID]\"\n", + "required": true, + "pattern": "^projects/[^/]+/metrics/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v2beta1/{+metricName}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/logging.admin", + "https://www.googleapis.com/auth/logging.write" + ] + } + } + }, + "logs": { + "methods": { + "list": { + "id": "logging.projects.logs.list", + "response": { + "$ref": "ListLogsResponse" + }, + "parameterOrder": [ + "parent" + ], + "description": "Lists the logs in projects or organizations. Only logs that have entries are listed.", + "flatPath": "v2beta1/projects/{projectsId}/logs", + "httpMethod": "GET", + "parameters": { + "pageSize": { + "description": "Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "parent": { + "description": "Required. The resource name that owns the logs:\n\"projects/[PROJECT_ID]\"\n\"organizations/[ORGANIZATION_ID]\"\n", + "required": true, + "pattern": "^projects/[^/]+$", + "location": "path", + "type": "string" + }, + "pageToken": { + "description": "Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call.", + "location": "query", + "type": "string" + } + }, + "path": "v2beta1/{+parent}/logs", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + "https://www.googleapis.com/auth/logging.admin", + "https://www.googleapis.com/auth/logging.read" + ] + }, + "delete": { + "id": "logging.projects.logs.delete", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "logName" + ], + "description": "Deletes all the log entries in a log. The log reappears if it receives new entries.", + "flatPath": "v2beta1/projects/{projectsId}/logs/{logsId}", + "httpMethod": "DELETE", + "parameters": { + "logName": { + "description": "Required. The resource name of the log to delete:\n\"projects/[PROJECT_ID]/logs/[LOG_ID]\"\n\"organizations/[ORGANIZATION_ID]/logs/[LOG_ID]\"\n[LOG_ID] must be URL-encoded. For example, \"projects/my-project-id/logs/syslog\", \"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity\". For more information about log names, see LogEntry.", + "required": true, + "pattern": "^projects/[^/]+/logs/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v2beta1/{+logName}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/logging.admin" + ] + } + } + }, + "sinks": { + "methods": { + "update": { + "id": "logging.projects.sinks.update", + "response": { + "$ref": "LogSink" + }, + "parameterOrder": [ + "sinkName" + ], + "description": "Updates a sink. If the named sink doesn't exist, then this method is identical to sinks.create. If the named sink does exist, then this method replaces the following fields in the existing sink with values from the new sink: destination, filter, output_version_format, start_time, and end_time. The updated filter might also have a new writer_identity; see the unique_writer_identity field.", + "request": { + "$ref": "LogSink" + }, + "flatPath": "v2beta1/projects/{projectsId}/sinks/{sinksId}", + "httpMethod": "PUT", + "parameters": { + "sinkName": { + "description": "Required. The full resource name of the sink to update, including the parent resource and the sink identifier:\n\"projects/[PROJECT_ID]/sinks/[SINK_ID]\"\n\"organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]\"\nExample: \"projects/my-project-id/sinks/my-sink-id\".", + "required": true, + "pattern": "^projects/[^/]+/sinks/[^/]+$", + "location": "path", + "type": "string" + }, + "uniqueWriterIdentity": { + "description": "Optional. See sinks.create for a description of this field. When updating a sink, the effect of this field on the value of writer_identity in the updated sink depends on both the old and new values of this field:\nIf the old and new values of this field are both false or both true, then there is no change to the sink's writer_identity.\nIf the old value was false and the new value is true, then writer_identity is changed to a unique service account.\nIt is an error if the old value was true and the new value is false.", + "location": "query", + "type": "boolean" + } + }, + "path": "v2beta1/{+sinkName}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/logging.admin" + ] + }, + "get": { + "id": "logging.projects.sinks.get", + "response": { + "$ref": "LogSink" + }, + "parameterOrder": [ + "sinkName" + ], + "description": "Gets a sink.", + "flatPath": "v2beta1/projects/{projectsId}/sinks/{sinksId}", + "httpMethod": "GET", + "parameters": { + "sinkName": { + "description": "Required. The parent resource name of the sink:\n\"projects/[PROJECT_ID]/sinks/[SINK_ID]\"\n\"organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]\"\nExample: \"projects/my-project-id/sinks/my-sink-id\".", + "required": true, + "pattern": "^projects/[^/]+/sinks/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v2beta1/{+sinkName}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + "https://www.googleapis.com/auth/logging.admin", + "https://www.googleapis.com/auth/logging.read" + ] + }, + "create": { + "id": "logging.projects.sinks.create", + "response": { + "$ref": "LogSink" + }, + "parameterOrder": [ + "parent" + ], + "description": "Creates a sink that exports specified log entries to a destination. The export of newly-ingested log entries begins immediately, unless the current time is outside the sink's start and end times or the sink's writer_identity is not permitted to write to the destination. A sink can export log entries only from the resource owning the sink.", + "request": { + "$ref": "LogSink" + }, + "flatPath": "v2beta1/projects/{projectsId}/sinks", + "httpMethod": "POST", + "parameters": { + "uniqueWriterIdentity": { + "description": "Optional. Determines the kind of IAM identity returned as writer_identity in the new sink. If this value is omitted or set to false, and if the sink's parent is a project, then the value returned as writer_identity is cloud-logs@google.com, the same identity used before the addition of writer identities to this API. The sink's destination must be in the same project as the sink itself.If this field is set to true, or if the sink is owned by a non-project resource such as an organization, then the value of writer_identity will be a unique service account used only for exports from the new sink. For more information, see writer_identity in LogSink.", + "location": "query", + "type": "boolean" + }, + "parent": { + "description": "Required. The resource in which to create the sink:\n\"projects/[PROJECT_ID]\"\n\"organizations/[ORGANIZATION_ID]\"\nExamples: \"projects/my-logging-project\", \"organizations/123456789\".", + "required": true, + "pattern": "^projects/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v2beta1/{+parent}/sinks", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/logging.admin" + ] + }, + "list": { + "id": "logging.projects.sinks.list", + "response": { + "$ref": "ListSinksResponse" + }, + "parameterOrder": [ + "parent" + ], + "description": "Lists sinks.", + "flatPath": "v2beta1/projects/{projectsId}/sinks", + "httpMethod": "GET", + "parameters": { + "pageSize": { + "description": "Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "parent": { + "description": "Required. The parent resource whose sinks are to be listed. Examples: \"projects/my-logging-project\", \"organizations/123456789\".", + "required": true, + "pattern": "^projects/[^/]+$", + "location": "path", + "type": "string" + }, + "pageToken": { + "description": "Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call.", + "location": "query", + "type": "string" + } + }, + "path": "v2beta1/{+parent}/sinks", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + "https://www.googleapis.com/auth/logging.admin", + "https://www.googleapis.com/auth/logging.read" + ] + }, + "delete": { + "id": "logging.projects.sinks.delete", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "sinkName" + ], + "description": "Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted.", + "flatPath": "v2beta1/projects/{projectsId}/sinks/{sinksId}", + "httpMethod": "DELETE", + "parameters": { + "sinkName": { + "description": "Required. The full resource name of the sink to delete, including the parent resource and the sink identifier:\n\"projects/[PROJECT_ID]/sinks/[SINK_ID]\"\n\"organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]\"\nIt is an error if the sink does not exist. Example: \"projects/my-project-id/sinks/my-sink-id\". It is an error if the sink does not exist.", + "required": true, + "pattern": "^projects/[^/]+/sinks/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v2beta1/{+sinkName}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/logging.admin" + ] + } + } + } + } }, - "resource": { - "$ref": "MonitoredResource", - "description": "Optional. A default monitored resource for those log entries in `entries` that do not specify their own `resource`." - }, - "labels": { - "type": "object", - "description": "Optional. User-defined `key:value` items that are added to the `labels` field of each log entry in `entries`, except when a log entry specifies its own `key:value` item with the same key. Example: `{ \"size\": \"large\", \"color\":\"red\" }`", - "additionalProperties": { - "type": "string" - } + "organizations": { + "resources": { + "logs": { + "methods": { + "list": { + "id": "logging.organizations.logs.list", + "response": { + "$ref": "ListLogsResponse" + }, + "parameterOrder": [ + "parent" + ], + "description": "Lists the logs in projects or organizations. Only logs that have entries are listed.", + "flatPath": "v2beta1/organizations/{organizationsId}/logs", + "httpMethod": "GET", + "parameters": { + "pageSize": { + "description": "Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "parent": { + "description": "Required. The resource name that owns the logs:\n\"projects/[PROJECT_ID]\"\n\"organizations/[ORGANIZATION_ID]\"\n", + "required": true, + "pattern": "^organizations/[^/]+$", + "location": "path", + "type": "string" + }, + "pageToken": { + "description": "Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call.", + "location": "query", + "type": "string" + } + }, + "path": "v2beta1/{+parent}/logs", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + "https://www.googleapis.com/auth/logging.admin", + "https://www.googleapis.com/auth/logging.read" + ] + }, + "delete": { + "id": "logging.organizations.logs.delete", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "logName" + ], + "description": "Deletes all the log entries in a log. The log reappears if it receives new entries.", + "flatPath": "v2beta1/organizations/{organizationsId}/logs/{logsId}", + "httpMethod": "DELETE", + "parameters": { + "logName": { + "description": "Required. The resource name of the log to delete:\n\"projects/[PROJECT_ID]/logs/[LOG_ID]\"\n\"organizations/[ORGANIZATION_ID]/logs/[LOG_ID]\"\n[LOG_ID] must be URL-encoded. For example, \"projects/my-project-id/logs/syslog\", \"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity\". For more information about log names, see LogEntry.", + "required": true, + "pattern": "^organizations/[^/]+/logs/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v2beta1/{+logName}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/logging.admin" + ] + } + } + } + } }, "entries": { - "type": "array", - "description": "Required. The log entries to write. The log entries must have values for all required fields.", - "items": { - "$ref": "LogEntry" - } + "methods": { + "write": { + "id": "logging.entries.write", + "response": { + "$ref": "WriteLogEntriesResponse" + }, + "parameterOrder": [], + "description": "Writes log entries to Stackdriver Logging. All log entries are written by this method.", + "request": { + "$ref": "WriteLogEntriesRequest" + }, + "flatPath": "v2beta1/entries:write", + "httpMethod": "POST", + "parameters": {}, + "path": "v2beta1/entries:write", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/logging.admin", + "https://www.googleapis.com/auth/logging.write" + ] + }, + "list": { + "id": "logging.entries.list", + "response": { + "$ref": "ListLogEntriesResponse" + }, + "parameterOrder": [], + "description": "Lists log entries. Use this method to retrieve log entries from Stackdriver Logging. For ways to export log entries, see Exporting Logs.", + "request": { + "$ref": "ListLogEntriesRequest" + }, + "flatPath": "v2beta1/entries:list", + "httpMethod": "POST", + "parameters": {}, + "path": "v2beta1/entries:list", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + "https://www.googleapis.com/auth/logging.admin", + "https://www.googleapis.com/auth/logging.read" + ] + } + } }, - "partialSuccess": { - "type": "boolean", - "description": "Optional. Whether valid entries should be written even if some other entries fail due to INVALID_ARGUMENT or PERMISSION_DENIED errors. If any entry is not written, the response status will be the error associated with one of the failed entries and include error details in the form of WriteLogEntriesPartialErrors." + "monitoredResourceDescriptors": { + "methods": { + "list": { + "id": "logging.monitoredResourceDescriptors.list", + "response": { + "$ref": "ListMonitoredResourceDescriptorsResponse" + }, + "parameterOrder": [], + "description": "Lists the descriptors for monitored resource types used by Stackdriver Logging.", + "flatPath": "v2beta1/monitoredResourceDescriptors", + "httpMethod": "GET", + "parameters": { + "pageSize": { + "description": "Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "pageToken": { + "description": "Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call.", + "location": "query", + "type": "string" + } + }, + "path": "v2beta1/monitoredResourceDescriptors", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + "https://www.googleapis.com/auth/logging.admin", + "https://www.googleapis.com/auth/logging.read" + ] + } + } + }, + "billingAccounts": { + "resources": { + "logs": { + "methods": { + "list": { + "id": "logging.billingAccounts.logs.list", + "response": { + "$ref": "ListLogsResponse" + }, + "parameterOrder": [ + "parent" + ], + "description": "Lists the logs in projects or organizations. Only logs that have entries are listed.", + "flatPath": "v2beta1/billingAccounts/{billingAccountsId}/logs", + "httpMethod": "GET", + "parameters": { + "pageSize": { + "description": "Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "parent": { + "description": "Required. The resource name that owns the logs:\n\"projects/[PROJECT_ID]\"\n\"organizations/[ORGANIZATION_ID]\"\n", + "required": true, + "pattern": "^billingAccounts/[^/]+$", + "location": "path", + "type": "string" + }, + "pageToken": { + "description": "Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call.", + "location": "query", + "type": "string" + } + }, + "path": "v2beta1/{+parent}/logs", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + "https://www.googleapis.com/auth/logging.admin", + "https://www.googleapis.com/auth/logging.read" + ] + }, + "delete": { + "id": "logging.billingAccounts.logs.delete", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "logName" + ], + "description": "Deletes all the log entries in a log. The log reappears if it receives new entries.", + "flatPath": "v2beta1/billingAccounts/{billingAccountsId}/logs/{logsId}", + "httpMethod": "DELETE", + "parameters": { + "logName": { + "description": "Required. The resource name of the log to delete:\n\"projects/[PROJECT_ID]/logs/[LOG_ID]\"\n\"organizations/[ORGANIZATION_ID]/logs/[LOG_ID]\"\n[LOG_ID] must be URL-encoded. For example, \"projects/my-project-id/logs/syslog\", \"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity\". For more information about log names, see LogEntry.", + "required": true, + "pattern": "^billingAccounts/[^/]+/logs/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v2beta1/{+logName}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/logging.admin" + ] + } + } + } + } } - } }, - "MonitoredResource": { - "id": "MonitoredResource", - "type": "object", - "description": "An object representing a resource that can be used for monitoring, logging, billing, or other purposes. Examples include virtual machine instances, databases, and storage devices such as disks. The `type` field identifies a MonitoredResourceDescriptor object that describes the resource's schema. Information in the `labels` field identifies the actual resource and its attributes according to the schema. For example, a particular Compute Engine VM instance could be represented by the following object, because the MonitoredResourceDescriptor for `\"gce_instance\"` has labels `\"instance_id\"` and `\"zone\"`: { \"type\": \"gce_instance\", \"labels\": { \"instance_id\": \"my-instance\", \"zone\": \"us-central1-a\" }}", - "properties": { - "type": { - "type": "string", - "description": "Required. The monitored resource type. This field must match the `type` field of a MonitoredResourceDescriptor object. For example, the type of a Cloud SQL database is `\"cloudsql_database\"`." - }, - "labels": { - "type": "object", - "description": "Required. Values for all of the labels listed in the associated monitored resource descriptor. For example, Cloud SQL databases use the labels `\"database_id\"` and `\"zone\"`.", - "additionalProperties": { - "type": "string" - } - } - } - }, - "LogEntry": { - "id": "LogEntry", - "type": "object", - "description": "An individual entry in a log.", - "properties": { - "logName": { - "type": "string", - "description": "Required. The resource name of the log to which this log entry belongs. The format of the name is `\"projects/\n/logs/\"`. Examples: `\"projects/my-projectid/logs/syslog\"`, `\"projects/1234567890/logs/library.googleapis.com%2Fbook_log\"`. The log ID part of resource name must be less than 512 characters long and can only include the following characters: upper and lower case alphanumeric characters: [A-Za-z0-9]; and punctuation characters: forward-slash, underscore, hyphen, and period. Forward-slash (`/`) characters in the log ID must be URL-encoded." - }, - "resource": { - "$ref": "MonitoredResource", - "description": "Required. The monitored resource associated with this log entry. Example: a log entry that reports a database error would be associated with the monitored resource designating the particular database that reported the error." - }, - "protoPayload": { - "type": "object", - "description": "The log entry payload, represented as a protocol buffer. You can only use `protoPayload` values that belong to a set of approved types.", - "additionalProperties": { - "type": "any", - "description": "Properties of the object. Contains field @ype with type URL." - } - }, - "textPayload": { - "type": "string", - "description": "The log entry payload, represented as a Unicode string (UTF-8)." - }, - "jsonPayload": { - "type": "object", - "description": "The log entry payload, represented as a structure that is expressed as a JSON object.", - "additionalProperties": { - "type": "any", - "description": "Properties of the object." - } - }, - "timestamp": { - "type": "string", - "description": "Optional. The time the event described by the log entry occurred. If omitted, Cloud Logging will use the time the log entry is written." - }, - "severity": { - "type": "string", - "description": "Optional. The severity of the log entry. The default value is `LogSeverity.DEFAULT`.", - "enum": [ - "DEFAULT", - "DEBUG", - "INFO", - "NOTICE", - "WARNING", - "ERROR", - "CRITICAL", - "ALERT", - "EMERGENCY" - ] - }, - "insertId": { - "type": "string", - "description": "Optional. A unique ID for the log entry. If you provide this field, the logging service considers other log entries in the same log with the same ID as duplicates which can be removed. If omitted, Cloud Logging will generate a unique ID for this log entry." - }, - "httpRequest": { - "$ref": "HttpRequest", - "description": "Optional. Information about the HTTP request associated with this log entry, if applicable." - }, - "labels": { - "type": "object", - "description": "Optional. A set of user-defined (key, value) data that provides additional information about the log entry.", - "additionalProperties": { - "type": "string" - } - }, - "operation": { - "$ref": "LogEntryOperation", - "description": "Optional. Information about an operation associated with the log entry, if applicable." - } - } - }, - "HttpRequest": { - "id": "HttpRequest", - "type": "object", - "description": "A common proto for logging HTTP requests.", - "properties": { - "requestMethod": { - "type": "string", - "description": "The request method. Examples: `\"GET\"`, `\"HEAD\"`, `\"PUT\"`, `\"POST\"`." - }, - "requestUrl": { - "type": "string", - "description": "The scheme (http, https), the host name, the path and the query portion of the URL that was requested. Example: `\"http://example.com/some/info?color=red\"`." - }, - "requestSize": { - "type": "string", - "description": "The size of the HTTP request message in bytes, including the request headers and the request body.", - "format": "int64" - }, - "status": { - "type": "integer", - "description": "The response code indicating the status of response. Examples: 200, 404.", - "format": "int32" - }, - "responseSize": { - "type": "string", - "description": "The size of the HTTP response message sent back to the client, in bytes, including the response headers and the response body.", - "format": "int64" - }, - "userAgent": { - "type": "string", - "description": "The user agent sent by the client. Example: `\"Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET CLR 1.0.3705)\"`." - }, - "remoteIp": { - "type": "string", - "description": "The IP address (IPv4 or IPv6) of the client that issued the HTTP request. Examples: `\"192.168.1.1\"`, `\"FE80::0202:B3FF:FE1E:8329\"`." - }, - "referer": { - "type": "string", - "description": "The referer URL of the request, as defined in [HTTP/1.1 Header Field Definitions](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html)." - }, - "cacheLookup": { - "type": "boolean", - "description": "Whether or not a cache lookup was attempted." - }, - "cacheHit": { - "type": "boolean", - "description": "Whether or not an entity was served from cache (with or without validation)." - }, - "cacheValidatedWithOriginServer": { - "type": "boolean", - "description": "Whether or not the response was validated with the origin server before being served from cache. This field is only meaningful if `cache_hit` is True." - }, - "cacheFillBytes": { - "type": "string", - "description": "The number of HTTP response bytes inserted into cache. Set only when a cache fill was attempted.", - "format": "int64" - } - } - }, - "LogEntryOperation": { - "id": "LogEntryOperation", - "type": "object", - "description": "Additional information about a potentially long-running operation with which a log entry is associated.", - "properties": { - "id": { - "type": "string", - "description": "Required. An arbitrary operation identifier. Log entries with the same identifier are assumed to be part of the same operation." - }, - "producer": { - "type": "string", - "description": "Required. An arbitrary producer identifier. The combination of `id` and `producer` must be globally unique. Examples for `producer`: `\"MyDivision.MyBigCompany.com\"`, \"github.com/MyProject/MyApplication\"`." - }, - "first": { - "type": "boolean", - "description": "Optional. Set this to True if this is the first log entry in the operation." - }, - "last": { - "type": "boolean", - "description": "Optional. Set this to True if this is the last log entry in the operation." - } - } - }, - "WriteLogEntriesResponse": { - "id": "WriteLogEntriesResponse", - "type": "object", - "description": "Result returned from WriteLogEntries. empty" - }, - "ListLogEntriesRequest": { - "id": "ListLogEntriesRequest", - "type": "object", - "description": "The parameters to `ListLogEntries`.", - "properties": { - "projectIds": { - "type": "array", - "description": "Required. One or more project IDs or project numbers from which to retrieve log entries. Examples of a project ID: `\"my-project-1A\"`, `\"1234567890\"`.", - "items": { - "type": "string" - } - }, - "filter": { - "type": "string", - "description": "Optional. An [advanced logs filter](/logging/docs/view/advanced_filters). The filter is compared against all log entries in the projects specified by `projectIds`. Only entries that match the filter are retrieved. An empty filter matches all log entries." - }, - "orderBy": { - "type": "string", - "description": "Optional. How the results should be sorted. Presently, the only permitted values are `\"timestamp asc\"` (default) and `\"timestamp desc\"`. The first option returns entries in order of increasing values of `LogEntry.timestamp` (oldest first), and the second option returns entries in order of decreasing timestamps (newest first). Entries with equal timestamps are returned in order of `LogEntry.insertId`." - }, - "pageSize": { - "type": "integer", - "description": "Optional. The maximum number of results to return from this request. You must check for presence of `nextPageToken` to determine if additional results are available, which you can retrieve by passing the `nextPageToken` value as the `pageToken` parameter in the next request.", - "format": "int32" - }, - "pageToken": { - "type": "string", - "description": "Optional. If the `pageToken` parameter is supplied, then the next page of results is retrieved. The `pageToken` parameter must be set to the value of the `nextPageToken` from the previous response. The values of `projectIds`, `filter`, and `orderBy` must be the same as in the previous request." - }, - "partialSuccess": { - "type": "boolean", - "description": "Optional. If true, read access to all projects is not required and results will be returned for the subset of projects for which read access is permitted (empty subset is permitted)." - } - } - }, - "ListLogEntriesResponse": { - "id": "ListLogEntriesResponse", - "type": "object", - "description": "Result returned from `ListLogEntries`.", - "properties": { - "entries": { - "type": "array", - "description": "A list of log entries.", - "items": { - "$ref": "LogEntry" - } - }, - "nextPageToken": { - "type": "string", - "description": "If there are more results than were returned, then `nextPageToken` is included in the response. To get the next set of results, call this method again using the value of `nextPageToken` as `pageToken`." - }, - "projectIdErrors": { - "type": "object", - "description": "If partial_success is true, contains the project ids that had errors and the associated errors.", - "additionalProperties": { - "$ref": "Status" - } - } - } - }, - "Status": { - "id": "Status", - "type": "object", - "description": "The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). The error model is designed to be: - Simple to use and understand for most users - Flexible enough to meet unexpected needs # Overview The `Status` message contains three pieces of data: error code, error message, and error details. The error code should be an enum value of google.rpc.Code, but it may accept additional error codes if needed. The error message should be a developer-facing English message that helps developers *understand* and *resolve* the error. If a localized user-facing error message is needed, put the localized message in the error details or localize it in the client. The optional error details may contain arbitrary information about the error. There is a predefined set of error detail types in the package `google.rpc` which can be used for common error conditions. # Language mapping The `Status` message is the logical representation of the error model, but it is not necessarily the actual wire format. When the `Status` message is exposed in different client libraries and different wire protocols, it can be mapped differently. For example, it will likely be mapped to some exceptions in Java, but more likely mapped to some error codes in C. # Other uses The error model and the `Status` message can be used in a variety of environments, either with or without APIs, to provide a consistent developer experience across different environments. Example uses of this error model include: - Partial errors. If a service needs to return partial errors to the client, it may embed the `Status` in the normal response to indicate the partial errors. - Workflow errors. A typical workflow has multiple steps. Each step may have a `Status` message for error reporting purpose. - Batch operations. If a client uses batch request and batch response, the `Status` message should be used directly inside batch response, one for each error sub-response. - Asynchronous operations. If an API call embeds asynchronous operation results in its response, the status of those operations should be represented directly using the `Status` message. - Logging. If some API errors are stored in logs, the message `Status` could be used directly after any stripping needed for security/privacy reasons.", - "properties": { - "code": { - "type": "integer", - "description": "The status code, which should be an enum value of google.rpc.Code.", - "format": "int32" - }, - "message": { - "type": "string", - "description": "A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client." - }, - "details": { - "type": "array", - "description": "A list of messages that carry the error details. There will be a common set of message types for APIs to use.", - "items": { + "schemas": { + "ListLogEntriesResponse": { + "description": "Result returned from ListLogEntries.", "type": "object", - "additionalProperties": { - "type": "any", - "description": "Properties of the object. Contains field @ype with type URL." - } - } - } - } - }, - "ListMonitoredResourceDescriptorsResponse": { - "id": "ListMonitoredResourceDescriptorsResponse", - "type": "object", - "description": "Result returned from ListMonitoredResourceDescriptors.", - "properties": { - "resourceDescriptors": { - "type": "array", - "description": "A list of resource descriptors.", - "items": { - "$ref": "MonitoredResourceDescriptor" - } + "properties": { + "entries": { + "description": "A list of log entries.", + "type": "array", + "items": { + "$ref": "LogEntry" + } + }, + "nextPageToken": { + "description": "If there might be more results than those appearing in this response, then nextPageToken is included. To get the next set of results, call this method again using the value of nextPageToken as pageToken.If a value for next_page_token appears and the entries field is empty, it means that the search found no log entries so far but it did not have time to search all the possible log entries. Retry the method with this value for page_token to continue the search. Alternatively, consider speeding up the search by changing your filter to specify a single log name or resource type, or to narrow the time range of the search.", + "type": "string" + } + }, + "id": "ListLogEntriesResponse" }, - "nextPageToken": { - "type": "string", - "description": "If there are more results than were returned, then `nextPageToken` is included in the response. To get the next set of results, call this method again using the value of `nextPageToken` as `pageToken`." - } - } - }, - "MonitoredResourceDescriptor": { - "id": "MonitoredResourceDescriptor", - "type": "object", - "description": "An object that describes the schema of a MonitoredResource object using a type name and a set of labels. For example, the monitored resource descriptor for Google Compute Engine VM instances has a type of `\"gce_instance\"` and specifies the use of the labels `\"instance_id\"` and `\"zone\"` to identify particular VM instances. Different APIs can support different monitored resource types. APIs generally provide a `list` method that returns the monitored resource descriptors used by the API.", - "properties": { - "name": { - "type": "string", - "description": "Optional. The resource name of the monitored resource descriptor: `\"projects/{project_id}/monitoredResourceDescriptors/{type}\"` where {type} is the value of the `type` field in this object and {project_id} is a project ID that provides API-specific context for accessing the type. APIs that do not use project information can use the resource name format `\"monitoredResourceDescriptors/{type}\"`." + "ListSinksResponse": { + "description": "Result returned from ListSinks.", + "type": "object", + "properties": { + "nextPageToken": { + "description": "If there might be more results than appear in this response, then nextPageToken is included. To get the next set of results, call the same method again using the value of nextPageToken as pageToken.", + "type": "string" + }, + "sinks": { + "description": "A list of sinks.", + "type": "array", + "items": { + "$ref": "LogSink" + } + } + }, + "id": "ListSinksResponse" }, - "type": { - "type": "string", - "description": "Required. The monitored resource type. For example, the type `\"cloudsql_database\"` represents databases in Google Cloud SQL." + "SourceLocation": { + "description": "Specifies a location in a source code file.", + "type": "object", + "properties": { + "file": { + "description": "Source file name. Depending on the runtime environment, this might be a simple name or a fully-qualified name.", + "type": "string" + }, + "functionName": { + "description": "Human-readable name of the function or method being invoked, with optional context such as the class or package name. This information is used in contexts such as the logs viewer, where a file and line number are less meaningful. The format can vary by language. For example: qual.if.ied.Class.method (Java), dir/package.func (Go), function (Python).", + "type": "string" + }, + "line": { + "description": "Line within the source file.", + "type": "string", + "format": "int64" + } + }, + "id": "SourceLocation" }, - "displayName": { - "type": "string", - "description": "Optional. A concise name for the monitored resource type that might be displayed in user interfaces. For example, `\"Google Cloud SQL Database\"`." + "LogSink": { + "description": "Describes a sink used to export log entries to one of the following destinations in any project: a Cloud Storage bucket, a BigQuery dataset, or a Cloud Pub/Sub topic. A logs filter controls which log entries are exported. The sink must be created within a project or organization.", + "type": "object", + "properties": { + "destination": { + "description": "Required. The export destination:\n\"storage.googleapis.com/[GCS_BUCKET]\"\n\"bigquery.googleapis.com/projects/[PROJECT_ID]/datasets/[DATASET]\"\n\"pubsub.googleapis.com/projects/[PROJECT_ID]/topics/[TOPIC_ID]\"\nThe sink's writer_identity, set when the sink is created, must have permission to write to the destination or else the log entries are not exported. For more information, see Exporting Logs With Sinks.", + "type": "string" + }, + "filter": { + "description": "Optional. An advanced logs filter. The only exported log entries are those that are in the resource owning the sink and that match the filter. The filter must use the log entry format specified by the output_version_format parameter. For example, in the v2 format:\nlogName=\"projects/[PROJECT_ID]/logs/[LOG_ID]\" AND severity\u003e=ERROR\n", + "type": "string" + }, + "endTime": { + "description": "Optional. The time at which this sink will stop exporting log entries. Log entries are exported only if their timestamp is earlier than the end time. If this field is not supplied, there is no end time. If both a start time and an end time are provided, then the end time must be later than the start time.", + "type": "string", + "format": "google-datetime" + }, + "name": { + "description": "Required. The client-assigned sink identifier, unique within the project. Example: \"my-syslog-errors-to-pubsub\". Sink identifiers are limited to 100 characters and can include only the following characters: upper and lower-case alphanumeric characters, underscores, hyphens, and periods.", + "type": "string" + }, + "startTime": { + "description": "Optional. The time at which this sink will begin exporting log entries. Log entries are exported only if their timestamp is not earlier than the start time. The default value of this field is the time the sink is created or updated.", + "type": "string", + "format": "google-datetime" + }, + "outputVersionFormat": { + "description": "Optional. The log entry format to use for this sink's exported log entries. The v2 format is used by default. The v1 format is deprecated and should be used only as part of a migration effort to v2. See Migration to the v2 API.", + "enum": [ + "VERSION_FORMAT_UNSPECIFIED", + "V2", + "V1" + ], + "enumDescriptions": [ + "An unspecified format version that will default to V2.", + "LogEntry version 2 format.", + "LogEntry version 1 format." + ], + "type": "string" + }, + "writerIdentity": { + "description": "Output only. An IAM identity—a service account or group—under which Stackdriver Logging writes the exported log entries to the sink's destination. This field is set by sinks.create and sinks.update, based on the setting of unique_writer_identity in those methods.Until you grant this identity write-access to the destination, log entry exports from this sink will fail. For more information, see Granting access for a resource. Consult the destination service's documentation to determine the appropriate IAM roles to assign to the identity.", + "type": "string" + } + }, + "id": "LogSink" }, - "description": { - "type": "string", - "description": "Optional. A detailed description of the monitored resource type that might be used in documentation." + "ListLogsResponse": { + "description": "Result returned from ListLogs.", + "type": "object", + "properties": { + "logNames": { + "description": "A list of log names. For example, \"projects/my-project/syslog\" or \"organizations/123/cloudresourcemanager.googleapis.com%2Factivity\".", + "type": "array", + "items": { + "type": "string" + } + }, + "nextPageToken": { + "description": "If there might be more results than those appearing in this response, then nextPageToken is included. To get the next set of results, call this method again using the value of nextPageToken as pageToken.", + "type": "string" + } + }, + "id": "ListLogsResponse" }, - "labels": { - "type": "array", - "description": "Required. A set of labels used to describe instances of this monitored resource type. For example, an individual Google Cloud SQL database is identified by values for the labels `\"database_id\"` and `\"zone\"`.", - "items": { - "$ref": "LabelDescriptor" - } - } - } - }, - "LabelDescriptor": { - "id": "LabelDescriptor", - "type": "object", - "description": "A description of a label.", - "properties": { - "key": { - "type": "string", - "description": "The label key." + "LogMetric": { + "description": "Describes a logs-based metric. The value of the metric is the number of log entries that match a logs filter in a given time interval.", + "type": "object", + "properties": { + "description": { + "description": "Optional. A description of this metric, which is used in documentation.", + "type": "string" + }, + "filter": { + "description": "Required. An advanced logs filter which is used to match log entries. Example:\n\"resource.type=gae_app AND severity\u003e=ERROR\"\nThe maximum length of the filter is 20000 characters.", + "type": "string" + }, + "name": { + "description": "Required. The client-assigned metric identifier. Examples: \"error_count\", \"nginx/requests\".Metric identifiers are limited to 100 characters and can include only the following characters: A-Z, a-z, 0-9, and the special characters _-.,+!*',()%/. The forward-slash character (/) denotes a hierarchy of name pieces, and it cannot be the first character of the name.The metric identifier in this field must not be URL-encoded (https://en.wikipedia.org/wiki/Percent-encoding). However, when the metric identifier appears as the [METRIC_ID] part of a metric_name API parameter, then the metric identifier must be URL-encoded. Example: \"projects/my-project/metrics/nginx%2Frequests\".", + "type": "string" + }, + "version": { + "description": "Output only. The API version that created or updated this metric. The version also dictates the syntax of the filter expression. When a value for this field is missing, the default value of V2 should be assumed.", + "enum": [ + "V2", + "V1" + ], + "enumDescriptions": [ + "Stackdriver Logging API v2.", + "Stackdriver Logging API v1." + ], + "type": "string" + } + }, + "id": "LogMetric" }, - "valueType": { - "type": "string", - "description": "The type of data that can be assigned to the label.", - "enum": [ - "STRING", - "BOOL", - "INT64" - ] - }, - "description": { - "type": "string", - "description": "A human-readable description for the label." - } - } - }, - "ListSinksResponse": { - "id": "ListSinksResponse", - "type": "object", - "description": "Result returned from `ListSinks`.", - "properties": { - "sinks": { - "type": "array", - "description": "A list of sinks.", - "items": { - "$ref": "LogSink" - } - }, - "nextPageToken": { - "type": "string", - "description": "If there are more results than were returned, then `nextPageToken` is included in the response. To get the next set of results, call this method again using the value of `nextPageToken` as `pageToken`." - } - } - }, - "LogSink": { - "id": "LogSink", - "type": "object", - "description": "Describes a sink used to export log entries outside Cloud Logging.", - "properties": { - "name": { - "type": "string", - "description": "Required. The client-assigned sink identifier. Example: `\"my-severe-errors-to-pubsub\"`. Sink identifiers are limited to 1000 characters and can include only the following characters: `A-Z`, `a-z`, `0-9`, and the special characters `_-.`." - }, - "destination": { - "type": "string", - "description": "The export destination. See [Exporting Logs With Sinks](/logging/docs/api/tasks/exporting-logs). Examples: `\"storage.googleapis.com/a-bucket\"`, `\"bigquery.googleapis.com/projects/a-project-id/datasets/a-dataset\"`." - }, - "filter": { - "type": "string", - "description": "An [advanced logs filter](/logging/docs/view/advanced_filters). Only log entries matching that filter are exported. The filter must be consistent with the log entry format specified by the `outputVersionFormat` parameter, regardless of the format of the log entry that was originally written to Cloud Logging. Example (V2 format): `\"logName=projects/my-projectid/logs/syslog AND severity\u003e=ERROR\"`." - }, - "outputVersionFormat": { - "type": "string", - "description": "The log entry version to use for this sink's exported log entries. This version does not have to correspond to the version of the log entry when it was written to Cloud Logging.", - "enum": [ - "VERSION_FORMAT_UNSPECIFIED", - "V2", - "V1" - ] - } - } - }, - "ListLogMetricsResponse": { - "id": "ListLogMetricsResponse", - "type": "object", - "description": "Result returned from ListLogMetrics.", - "properties": { - "metrics": { - "type": "array", - "description": "A list of logs-based metrics.", - "items": { - "$ref": "LogMetric" - } - }, - "nextPageToken": { - "type": "string", - "description": "If there are more results than were returned, then `nextPageToken` is included in the response. To get the next set of results, call this method again using the value of `nextPageToken` as `pageToken`." - } - } - }, - "LogMetric": { - "id": "LogMetric", - "type": "object", - "description": "Describes a logs-based metric. The value of the metric is the number of log entries that match a logs filter.", - "properties": { - "name": { - "type": "string", - "description": "Required. The client-assigned metric identifier. Example: `\"severe_errors\"`. Metric identifiers are limited to 1000 characters and can include only the following characters: `A-Z`, `a-z`, `0-9`, and the special characters `_-.,+!*',()%/\\`. The forward-slash character (`/`) denotes a hierarchy of name pieces, and it cannot be the first character of the name." - }, - "description": { - "type": "string", - "description": "A description of this metric, which is used in documentation." - }, - "filter": { - "type": "string", - "description": "An [advanced logs filter](/logging/docs/view/advanced_filters). Example: `\"logName:syslog AND severity\u003e=ERROR\"`." - } - } - }, - "RequestLog": { - "id": "RequestLog", - "type": "object", - "description": "Complete log information about a single HTTP request to an App Engine application.", - "properties": { - "appId": { - "type": "string", - "description": "Application that handled this request." - }, - "moduleId": { - "type": "string", - "description": "Module of the application that handled this request." - }, - "versionId": { - "type": "string", - "description": "Version of the application that handled this request." - }, - "requestId": { - "type": "string", - "description": "Globally unique identifier for a request, which is based on the request start time. Request IDs for requests which started later will compare greater as strings than those for requests which started earlier." - }, - "ip": { - "type": "string", - "description": "Origin IP address." - }, - "startTime": { - "type": "string", - "description": "Time when the request started." - }, - "endTime": { - "type": "string", - "description": "Time when the request finished." - }, - "latency": { - "type": "string", - "description": "Latency of the request." - }, - "megaCycles": { - "type": "string", - "description": "Number of CPU megacycles used to process request.", - "format": "int64" - }, - "method": { - "type": "string", - "description": "Request method. Example: `\"GET\"`, `\"HEAD\"`, `\"PUT\"`, `\"POST\"`, `\"DELETE\"`." - }, - "resource": { - "type": "string", - "description": "Contains the path and query portion of the URL that was requested. For example, if the URL was \"http://example.com/app?name=val\", the resource would be \"/app?name=val\". The fragment identifier, which is identified by the `#` character, is not included." - }, - "httpVersion": { - "type": "string", - "description": "HTTP version of request. Example: `\"HTTP/1.1\"`." - }, - "status": { - "type": "integer", - "description": "HTTP response status code. Example: 200, 404.", - "format": "int32" - }, - "responseSize": { - "type": "string", - "description": "Size in bytes sent back to client by request.", - "format": "int64" - }, - "referrer": { - "type": "string", - "description": "Referrer URL of request." - }, - "userAgent": { - "type": "string", - "description": "User agent that made the request." - }, - "nickname": { - "type": "string", - "description": "The logged-in user who made the request. Most likely, this is the part of the user's email before the `@` sign. The field value is the same for different requests from the same user, but different users can have similar names. This information is also available to the application via the App Engine Users API. This field will be populated starting with App Engine 1.9.21." - }, - "urlMapEntry": { - "type": "string", - "description": "File or class that handled the request." - }, - "host": { - "type": "string", - "description": "Internet host and port number of the resource being requested." - }, - "cost": { - "type": "number", - "description": "An indication of the relative cost of serving this request.", - "format": "double" - }, - "taskQueueName": { - "type": "string", - "description": "Queue name of the request, in the case of an offline request." - }, - "taskName": { - "type": "string", - "description": "Task name of the request, in the case of an offline request." - }, - "wasLoadingRequest": { - "type": "boolean", - "description": "Whether this was a loading request for the instance." - }, - "pendingTime": { - "type": "string", - "description": "Time this request spent in the pending request queue." - }, - "instanceIndex": { - "type": "integer", - "description": "If the instance processing this request belongs to a manually scaled module, then this is the 0-based index of the instance. Otherwise, this value is -1.", - "format": "int32" - }, - "finished": { - "type": "boolean", - "description": "Whether this request is finished or active." - }, - "first": { - "type": "boolean", - "description": "Whether this is the first RequestLog entry for this request. If an active request has several RequestLog entries written to Cloud Logging, this field will be set for one of them." - }, - "instanceId": { - "type": "string", - "description": "An identifier for the instance that handled the request." - }, - "line": { - "type": "array", - "description": "A list of log lines emitted by the application while serving this request.", - "items": { - "$ref": "LogLine" - } - }, - "appEngineRelease": { - "type": "string", - "description": "App Engine release version." - }, - "traceId": { - "type": "string", - "description": "Cloud Trace identifier for this request." - }, - "sourceReference": { - "type": "array", - "description": "Source code for the application that handled this request. There can be more than one source reference per deployed application if source code is distributed among multiple repositories.", - "items": { - "$ref": "SourceReference" - } - } - } - }, - "LogLine": { - "id": "LogLine", - "type": "object", - "description": "Application log line emitted while processing a request.", - "properties": { - "time": { - "type": "string", - "description": "Approximate time when this log entry was made." - }, - "severity": { - "type": "string", - "description": "Severity of this log entry.", - "enum": [ - "DEFAULT", - "DEBUG", - "INFO", - "NOTICE", - "WARNING", - "ERROR", - "CRITICAL", - "ALERT", - "EMERGENCY" - ] - }, - "logMessage": { - "type": "string", - "description": "App-provided log message." - }, - "sourceLocation": { - "$ref": "SourceLocation", - "description": "Where in the source code this log message was written." - } - } - }, - "SourceLocation": { - "id": "SourceLocation", - "type": "object", - "description": "Specifies a location in a source code file.", - "properties": { - "file": { - "type": "string", - "description": "Source file name. Depending on the runtime environment, this might be a simple name or a fully-qualified name." - }, - "line": { - "type": "string", - "description": "Line within the source file.", - "format": "int64" - }, - "functionName": { - "type": "string", - "description": "Human-readable name of the function or method being invoked, with optional context such as the class or package name. This information is used in contexts such as the logs viewer, where a file and line number are less meaningful. The format can vary by language. For example: `qual.if.ied.Class.method` (Java), `dir/package.func` (Go), `function` (Python)." - } - } - }, - "SourceReference": { - "id": "SourceReference", - "type": "object", - "description": "A reference to a particular snapshot of the source tree used to build and deploy an application.", - "properties": { - "repository": { - "type": "string", - "description": "Optional. A URI string identifying the repository. Example: \"https://github.com/GoogleCloudPlatform/kubernetes.git\"" - }, - "revisionId": { - "type": "string", - "description": "The canonical and persistent identifier of the deployed revision. Example (git): \"0035781c50ec7aa23385dc841529ce8a4b70db1b\"" - } - } - } - }, - "resources": { - "projects": { - "resources": { - "logs": { - "methods": { - "delete": { - "id": "logging.projects.logs.delete", - "path": "v2beta1/{+logName}", - "httpMethod": "DELETE", - "description": "Deletes a log and all its log entries. The log will reappear if it receives new entries.", - "parameters": { + "LogEntry": { + "description": "An individual entry in a log.", + "type": "object", + "properties": { + "textPayload": { + "description": "The log entry payload, represented as a Unicode string (UTF-8).", + "type": "string" + }, + "httpRequest": { + "description": "Optional. Information about the HTTP request associated with this log entry, if applicable.", + "$ref": "HttpRequest" + }, + "sourceLocation": { + "description": "Optional. Source code location information associated with the log entry, if any.", + "$ref": "LogEntrySourceLocation" + }, + "jsonPayload": { + "description": "The log entry payload, represented as a structure that is expressed as a JSON object.", + "additionalProperties": { + "description": "Properties of the object.", + "type": "any" + }, + "type": "object" + }, + "labels": { + "description": "Optional. A set of user-defined (key, value) data that provides additional information about the log entry.", + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + "trace": { + "description": "Optional. Resource name of the trace associated with the log entry, if any. If it contains a relative resource name, the name is assumed to be relative to //tracing.googleapis.com. Example: projects/my-projectid/traces/06796866738c859f2f19b7cfb3214824", + "type": "string" + }, "logName": { - "type": "string", - "description": "Required. The resource name of the log to delete. Example: `\"projects/my-project/logs/syslog\"`.", - "required": true, - "pattern": "^projects/[^/]*/logs/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "logName" - ], - "response": { - "$ref": "Empty" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/logging.admin" - ] - } - } - }, - "sinks": { - "methods": { - "list": { - "id": "logging.projects.sinks.list", - "path": "v2beta1/{+projectName}/sinks", - "httpMethod": "GET", - "description": "Lists sinks.", - "parameters": { - "projectName": { - "type": "string", - "description": "Required. The resource name of the project containing the sinks. Example: `\"projects/my-logging-project\"`.", - "required": true, - "pattern": "^projects/[^/]*$", - "location": "path" + "description": "Required. The resource name of the log to which this log entry belongs:\n\"projects/[PROJECT_ID]/logs/[LOG_ID]\"\n\"organizations/[ORGANIZATION_ID]/logs/[LOG_ID]\"\n[LOG_ID] must be URL-encoded within log_name. Example: \"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity\". [LOG_ID] must be less than 512 characters long and can only include the following characters: upper and lower case alphanumeric characters, forward-slash, underscore, hyphen, and period.For backward compatibility, if log_name begins with a forward-slash, such as /projects/..., then the log entry is ingested as usual but the forward-slash is removed. Listing the log entry will not show the leading slash and filtering for a log name with a leading slash will never return any results.", + "type": "string" }, - "pageToken": { - "type": "string", - "description": "Optional. If the `pageToken` parameter is supplied, then the next page of results is retrieved. The `pageToken` parameter must be set to the value of the `nextPageToken` from the previous response. The value of `projectName` must be the same as in the previous request.", - "location": "query" + "severity": { + "description": "Optional. The severity of the log entry. The default value is LogSeverity.DEFAULT.", + "enum": [ + "DEFAULT", + "DEBUG", + "INFO", + "NOTICE", + "WARNING", + "ERROR", + "CRITICAL", + "ALERT", + "EMERGENCY" + ], + "enumDescriptions": [ + "(0) The log entry has no assigned severity level.", + "(100) Debug or trace information.", + "(200) Routine information, such as ongoing status or performance.", + "(300) Normal but significant events, such as start up, shut down, or a configuration change.", + "(400) Warning events might cause problems.", + "(500) Error events are likely to cause problems.", + "(600) Critical events cause more severe problems or outages.", + "(700) A person must take an action immediately.", + "(800) One or more systems are unusable." + ], + "type": "string" + }, + "resource": { + "description": "Required. The monitored resource associated with this log entry. Example: a log entry that reports a database error would be associated with the monitored resource designating the particular database that reported the error.", + "$ref": "MonitoredResource" + }, + "protoPayload": { + "description": "The log entry payload, represented as a protocol buffer. Some Google Cloud Platform services use this field for their log entry payloads.", + "additionalProperties": { + "description": "Properties of the object. Contains field @type with type URL.", + "type": "any" + }, + "type": "object" + }, + "timestamp": { + "description": "Optional. The time the event described by the log entry occurred. If omitted, Stackdriver Logging will use the time the log entry is received.", + "type": "string", + "format": "google-datetime" + }, + "insertId": { + "description": "Optional. A unique ID for the log entry. If you provide this field, the logging service considers other log entries in the same project with the same ID as duplicates which can be removed. If omitted, Stackdriver Logging will generate a unique ID for this log entry.", + "type": "string" + }, + "operation": { + "description": "Optional. Information about an operation associated with the log entry, if applicable.", + "$ref": "LogEntryOperation" + } + }, + "id": "LogEntry" + }, + "LogLine": { + "description": "Application log line emitted while processing a request.", + "type": "object", + "properties": { + "time": { + "description": "Approximate time when this log entry was made.", + "type": "string", + "format": "google-datetime" + }, + "severity": { + "description": "Severity of this log entry.", + "enum": [ + "DEFAULT", + "DEBUG", + "INFO", + "NOTICE", + "WARNING", + "ERROR", + "CRITICAL", + "ALERT", + "EMERGENCY" + ], + "enumDescriptions": [ + "(0) The log entry has no assigned severity level.", + "(100) Debug or trace information.", + "(200) Routine information, such as ongoing status or performance.", + "(300) Normal but significant events, such as start up, shut down, or a configuration change.", + "(400) Warning events might cause problems.", + "(500) Error events are likely to cause problems.", + "(600) Critical events cause more severe problems or outages.", + "(700) A person must take an action immediately.", + "(800) One or more systems are unusable." + ], + "type": "string" + }, + "sourceLocation": { + "description": "Where in the source code this log message was written.", + "$ref": "SourceLocation" + }, + "logMessage": { + "description": "App-provided log message.", + "type": "string" + } + }, + "id": "LogLine" + }, + "SourceReference": { + "description": "A reference to a particular snapshot of the source tree used to build and deploy an application.", + "type": "object", + "properties": { + "repository": { + "description": "Optional. A URI string identifying the repository. Example: \"https://github.com/GoogleCloudPlatform/kubernetes.git\"", + "type": "string" + }, + "revisionId": { + "description": "The canonical and persistent identifier of the deployed revision. Example (git): \"0035781c50ec7aa23385dc841529ce8a4b70db1b\"", + "type": "string" + } + }, + "id": "SourceReference" + }, + "MonitoredResource": { + "description": "An object representing a resource that can be used for monitoring, logging, billing, or other purposes. Examples include virtual machine instances, databases, and storage devices such as disks. The type field identifies a MonitoredResourceDescriptor object that describes the resource's schema. Information in the labels field identifies the actual resource and its attributes according to the schema. For example, a particular Compute Engine VM instance could be represented by the following object, because the MonitoredResourceDescriptor for \"gce_instance\" has labels \"instance_id\" and \"zone\":\n{ \"type\": \"gce_instance\",\n \"labels\": { \"instance_id\": \"12345678901234\",\n \"zone\": \"us-central1-a\" }}\n", + "type": "object", + "properties": { + "labels": { + "description": "Required. Values for all of the labels listed in the associated monitored resource descriptor. For example, Cloud SQL databases use the labels \"database_id\" and \"zone\".", + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + "type": { + "description": "Required. The monitored resource type. This field must match the type field of a MonitoredResourceDescriptor object. For example, the type of a Cloud SQL database is \"cloudsql_database\".", + "type": "string" + } + }, + "id": "MonitoredResource" + }, + "WriteLogEntriesRequest": { + "description": "The parameters to WriteLogEntries.", + "type": "object", + "properties": { + "labels": { + "description": "Optional. Default labels that are added to the labels field of all log entries in entries. If a log entry already has a label with the same key as a label in this parameter, then the log entry's label is not changed. See LogEntry.", + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + "entries": { + "description": "Required. The log entries to write. Values supplied for the fields log_name, resource, and labels in this entries.write request are added to those log entries that do not provide their own values for the fields.To improve throughput and to avoid exceeding the quota limit for calls to entries.write, you should write multiple log entries at once rather than calling this method for each individual log entry.", + "type": "array", + "items": { + "$ref": "LogEntry" + } + }, + "logName": { + "description": "Optional. A default log resource name that is assigned to all log entries in entries that do not specify a value for log_name:\n\"projects/[PROJECT_ID]/logs/[LOG_ID]\"\n\"organizations/[ORGANIZATION_ID]/logs/[LOG_ID]\"\n[LOG_ID] must be URL-encoded. For example, \"projects/my-project-id/logs/syslog\" or \"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity\". For more information about log names, see LogEntry.", + "type": "string" + }, + "partialSuccess": { + "description": "Optional. Whether valid entries should be written even if some other entries fail due to INVALID_ARGUMENT or PERMISSION_DENIED errors. If any entry is not written, the response status will be the error associated with one of the failed entries and include error details in the form of WriteLogEntriesPartialErrors.", + "type": "boolean" + }, + "resource": { + "description": "Optional. A default monitored resource object that is assigned to all log entries in entries that do not specify a value for resource. Example:\n{ \"type\": \"gce_instance\",\n \"labels\": {\n \"zone\": \"us-central1-a\", \"instance_id\": \"00000000000000000000\" }}\nSee LogEntry.", + "$ref": "MonitoredResource" + } + }, + "id": "WriteLogEntriesRequest" + }, + "LabelDescriptor": { + "description": "A description of a label.", + "type": "object", + "properties": { + "description": { + "description": "A human-readable description for the label.", + "type": "string" + }, + "valueType": { + "description": "The type of data that can be assigned to the label.", + "enum": [ + "STRING", + "BOOL", + "INT64" + ], + "enumDescriptions": [ + "A variable-length string. This is the default.", + "Boolean; true or false.", + "A 64-bit signed integer." + ], + "type": "string" + }, + "key": { + "description": "The label key.", + "type": "string" + } + }, + "id": "LabelDescriptor" + }, + "ListLogMetricsResponse": { + "description": "Result returned from ListLogMetrics.", + "type": "object", + "properties": { + "metrics": { + "description": "A list of logs-based metrics.", + "type": "array", + "items": { + "$ref": "LogMetric" + } + }, + "nextPageToken": { + "description": "If there might be more results than appear in this response, then nextPageToken is included. To get the next set of results, call this method again using the value of nextPageToken as pageToken.", + "type": "string" + } + }, + "id": "ListLogMetricsResponse" + }, + "MonitoredResourceDescriptor": { + "description": "An object that describes the schema of a MonitoredResource object using a type name and a set of labels. For example, the monitored resource descriptor for Google Compute Engine VM instances has a type of \"gce_instance\" and specifies the use of the labels \"instance_id\" and \"zone\" to identify particular VM instances.Different APIs can support different monitored resource types. APIs generally provide a list method that returns the monitored resource descriptors used by the API.", + "type": "object", + "properties": { + "displayName": { + "description": "Optional. A concise name for the monitored resource type that might be displayed in user interfaces. It should be a Title Cased Noun Phrase, without any article or other determiners. For example, \"Google Cloud SQL Database\".", + "type": "string" + }, + "description": { + "description": "Optional. A detailed description of the monitored resource type that might be used in documentation.", + "type": "string" + }, + "labels": { + "description": "Required. A set of labels used to describe instances of this monitored resource type. For example, an individual Google Cloud SQL database is identified by values for the labels \"database_id\" and \"zone\".", + "type": "array", + "items": { + "$ref": "LabelDescriptor" + } + }, + "type": { + "description": "Required. The monitored resource type. For example, the type \"cloudsql_database\" represents databases in Google Cloud SQL. The maximum length of this value is 256 characters.", + "type": "string" + }, + "name": { + "description": "Optional. The resource name of the monitored resource descriptor: \"projects/{project_id}/monitoredResourceDescriptors/{type}\" where {type} is the value of the type field in this object and {project_id} is a project ID that provides API-specific context for accessing the type. APIs that do not use project information can use the resource name format \"monitoredResourceDescriptors/{type}\".", + "type": "string" + } + }, + "id": "MonitoredResourceDescriptor" + }, + "ListMonitoredResourceDescriptorsResponse": { + "description": "Result returned from ListMonitoredResourceDescriptors.", + "type": "object", + "properties": { + "nextPageToken": { + "description": "If there might be more results than those appearing in this response, then nextPageToken is included. To get the next set of results, call this method again using the value of nextPageToken as pageToken.", + "type": "string" + }, + "resourceDescriptors": { + "description": "A list of resource descriptors.", + "type": "array", + "items": { + "$ref": "MonitoredResourceDescriptor" + } + } + }, + "id": "ListMonitoredResourceDescriptorsResponse" + }, + "LogEntryOperation": { + "description": "Additional information about a potentially long-running operation with which a log entry is associated.", + "type": "object", + "properties": { + "producer": { + "description": "Optional. An arbitrary producer identifier. The combination of id and producer must be globally unique. Examples for producer: \"MyDivision.MyBigCompany.com\", \"github.com/MyProject/MyApplication\".", + "type": "string" + }, + "last": { + "description": "Optional. Set this to True if this is the last log entry in the operation.", + "type": "boolean" + }, + "first": { + "description": "Optional. Set this to True if this is the first log entry in the operation.", + "type": "boolean" + }, + "id": { + "description": "Optional. An arbitrary operation identifier. Log entries with the same identifier are assumed to be part of the same operation.", + "type": "string" + } + }, + "id": "LogEntryOperation" + }, + "Empty": { + "description": "A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance:\nservice Foo {\n rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);\n}\nThe JSON representation for Empty is empty JSON object {}.", + "type": "object", + "properties": {}, + "id": "Empty" + }, + "HttpRequest": { + "description": "A common proto for logging HTTP requests. Only contains semantics defined by the HTTP specification. Product-specific logging information MUST be defined in a separate message.", + "type": "object", + "properties": { + "cacheLookup": { + "description": "Whether or not a cache lookup was attempted.", + "type": "boolean" + }, + "responseSize": { + "description": "The size of the HTTP response message sent back to the client, in bytes, including the response headers and the response body.", + "type": "string", + "format": "int64" + }, + "status": { + "description": "The response code indicating the status of response. Examples: 200, 404.", + "type": "integer", + "format": "int32" + }, + "cacheValidatedWithOriginServer": { + "description": "Whether or not the response was validated with the origin server before being served from cache. This field is only meaningful if cache_hit is True.", + "type": "boolean" + }, + "referer": { + "description": "The referer URL of the request, as defined in HTTP/1.1 Header Field Definitions (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html).", + "type": "string" + }, + "cacheHit": { + "description": "Whether or not an entity was served from cache (with or without validation).", + "type": "boolean" + }, + "requestUrl": { + "description": "The scheme (http, https), the host name, the path and the query portion of the URL that was requested. Example: \"http://example.com/some/info?color=red\".", + "type": "string" + }, + "latency": { + "description": "The request processing latency on the server, from the time the request was received until the response was sent.", + "type": "string", + "format": "google-duration" + }, + "cacheFillBytes": { + "description": "The number of HTTP response bytes inserted into cache. Set only when a cache fill was attempted.", + "type": "string", + "format": "int64" + }, + "requestMethod": { + "description": "The request method. Examples: \"GET\", \"HEAD\", \"PUT\", \"POST\".", + "type": "string" + }, + "remoteIp": { + "description": "The IP address (IPv4 or IPv6) of the client that issued the HTTP request. Examples: \"192.168.1.1\", \"FE80::0202:B3FF:FE1E:8329\".", + "type": "string" + }, + "serverIp": { + "description": "The IP address (IPv4 or IPv6) of the origin server that the request was sent to.", + "type": "string" + }, + "userAgent": { + "description": "The user agent sent by the client. Example: \"Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET CLR 1.0.3705)\".", + "type": "string" + }, + "requestSize": { + "description": "The size of the HTTP request message in bytes, including the request headers and the request body.", + "type": "string", + "format": "int64" + } + }, + "id": "HttpRequest" + }, + "LogEntrySourceLocation": { + "description": "Additional information about the source code location that produced the log entry.", + "type": "object", + "properties": { + "function": { + "description": "Optional. Human-readable name of the function or method being invoked, with optional context such as the class or package name. This information may be used in contexts such as the logs viewer, where a file and line number are less meaningful. The format can vary by language. For example: qual.if.ied.Class.method (Java), dir/package.func (Go), function (Python).", + "type": "string" + }, + "file": { + "description": "Optional. Source file name. Depending on the runtime environment, this might be a simple name or a fully-qualified name.", + "type": "string" + }, + "line": { + "description": "Optional. Line within the source file. 1-based; 0 indicates no line number available.", + "type": "string", + "format": "int64" + } + }, + "id": "LogEntrySourceLocation" + }, + "RequestLog": { + "description": "Complete log information about a single HTTP request to an App Engine application.", + "type": "object", + "properties": { + "responseSize": { + "description": "Size in bytes sent back to client by request.", + "type": "string", + "format": "int64" + }, + "requestId": { + "description": "Globally unique identifier for a request, which is based on the request start time. Request IDs for requests which started later will compare greater as strings than those for requests which started earlier.", + "type": "string" + }, + "first": { + "description": "Whether this is the first RequestLog entry for this request. If an active request has several RequestLog entries written to Stackdriver Logging, then this field will be set for one of them.", + "type": "boolean" + }, + "method": { + "description": "Request method. Example: \"GET\", \"HEAD\", \"PUT\", \"POST\", \"DELETE\".", + "type": "string" + }, + "versionId": { + "description": "Version of the application that handled this request.", + "type": "string" + }, + "status": { + "description": "HTTP response status code. Example: 200, 404.", + "type": "integer", + "format": "int32" + }, + "wasLoadingRequest": { + "description": "Whether this was a loading request for the instance.", + "type": "boolean" + }, + "ip": { + "description": "Origin IP address.", + "type": "string" + }, + "nickname": { + "description": "The logged-in user who made the request.Most likely, this is the part of the user's email before the @ sign. The field value is the same for different requests from the same user, but different users can have similar names. This information is also available to the application via the App Engine Users API.This field will be populated starting with App Engine 1.9.21.", + "type": "string" + }, + "taskQueueName": { + "description": "Queue name of the request, in the case of an offline request.", + "type": "string" + }, + "pendingTime": { + "description": "Time this request spent in the pending request queue.", + "type": "string", + "format": "google-duration" + }, + "instanceIndex": { + "description": "If the instance processing this request belongs to a manually scaled module, then this is the 0-based index of the instance. Otherwise, this value is -1.", + "type": "integer", + "format": "int32" + }, + "sourceReference": { + "description": "Source code for the application that handled this request. There can be more than one source reference per deployed application if source code is distributed among multiple repositories.", + "type": "array", + "items": { + "$ref": "SourceReference" + } + }, + "moduleId": { + "description": "Module of the application that handled this request.", + "type": "string" + }, + "host": { + "description": "Internet host and port number of the resource being requested.", + "type": "string" + }, + "latency": { + "description": "Latency of the request.", + "type": "string", + "format": "google-duration" + }, + "urlMapEntry": { + "description": "File or class that handled the request.", + "type": "string" + }, + "endTime": { + "description": "Time when the request finished.", + "type": "string", + "format": "google-datetime" + }, + "line": { + "description": "A list of log lines emitted by the application while serving this request.", + "type": "array", + "items": { + "$ref": "LogLine" + } + }, + "megaCycles": { + "description": "Number of CPU megacycles used to process request.", + "type": "string", + "format": "int64" + }, + "appId": { + "description": "Application that handled this request.", + "type": "string" + }, + "traceId": { + "description": "Stackdriver Trace identifier for this request.", + "type": "string" + }, + "taskName": { + "description": "Task name of the request, in the case of an offline request.", + "type": "string" + }, + "cost": { + "description": "An indication of the relative cost of serving this request.", + "type": "number", + "format": "double" + }, + "instanceId": { + "description": "An identifier for the instance that handled the request.", + "type": "string" + }, + "startTime": { + "description": "Time when the request started.", + "type": "string", + "format": "google-datetime" + }, + "appEngineRelease": { + "description": "App Engine release version.", + "type": "string" + }, + "resource": { + "description": "Contains the path and query portion of the URL that was requested. For example, if the URL was \"http://example.com/app?name=val\", the resource would be \"/app?name=val\". The fragment identifier, which is identified by the # character, is not included.", + "type": "string" + }, + "httpVersion": { + "description": "HTTP version of request. Example: \"HTTP/1.1\".", + "type": "string" + }, + "referrer": { + "description": "Referrer URL of request.", + "type": "string" + }, + "userAgent": { + "description": "User agent that made the request.", + "type": "string" + }, + "finished": { + "description": "Whether this request is finished or active.", + "type": "boolean" + } + }, + "id": "RequestLog" + }, + "WriteLogEntriesResponse": { + "description": "Result returned from WriteLogEntries. empty", + "type": "object", + "properties": {}, + "id": "WriteLogEntriesResponse" + }, + "ListLogEntriesRequest": { + "description": "The parameters to ListLogEntries.", + "type": "object", + "properties": { + "filter": { + "description": "Optional. A filter that chooses which log entries to return. See Advanced Logs Filters. Only log entries that match the filter are returned. An empty filter matches all log entries in the resources listed in resource_names. Referencing a parent resource that is not listed in resource_names will cause the filter to return no results. The maximum length of the filter is 20000 characters.", + "type": "string" + }, + "projectIds": { + "description": "Deprecated. Use resource_names instead. One or more project identifiers or project numbers from which to retrieve log entries. Example: \"my-project-1A\". If present, these project identifiers are converted to resource name format and added to the list of resources in resource_names.", + "type": "array", + "items": { + "type": "string" + } + }, + "resourceNames": { + "description": "Required. Names of one or more resources from which to retrieve log entries:\n\"projects/[PROJECT_ID]\"\n\"organizations/[ORGANIZATION_ID]\"\nProjects listed in the project_ids field are added to this list.", + "type": "array", + "items": { + "type": "string" + } }, "pageSize": { - "type": "integer", - "description": "Optional. The maximum number of results to return from this request. You must check for presence of `nextPageToken` to determine if additional results are available, which you can retrieve by passing the `nextPageToken` value as the `pageToken` parameter in the next request.", - "format": "int32", - "location": "query" - } - }, - "parameterOrder": [ - "projectName" - ], - "response": { - "$ref": "ListSinksResponse" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - "https://www.googleapis.com/auth/logging.admin", - "https://www.googleapis.com/auth/logging.read" - ] - }, - "get": { - "id": "logging.projects.sinks.get", - "path": "v2beta1/{+sinkName}", - "httpMethod": "GET", - "description": "Gets a sink.", - "parameters": { - "sinkName": { - "type": "string", - "description": "The resource name of the sink to return. Example: `\"projects/my-project-id/sinks/my-sink-id\"`.", - "required": true, - "pattern": "^projects/[^/]*/sinks/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "sinkName" - ], - "response": { - "$ref": "LogSink" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - "https://www.googleapis.com/auth/logging.admin", - "https://www.googleapis.com/auth/logging.read" - ] - }, - "create": { - "id": "logging.projects.sinks.create", - "path": "v2beta1/{+projectName}/sinks", - "httpMethod": "POST", - "description": "Creates a sink.", - "parameters": { - "projectName": { - "type": "string", - "description": "The resource name of the project in which to create the sink. Example: `\"projects/my-project-id\"`. The new sink must be provided in the request.", - "required": true, - "pattern": "^projects/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "projectName" - ], - "request": { - "$ref": "LogSink" - }, - "response": { - "$ref": "LogSink" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/logging.admin" - ] - }, - "update": { - "id": "logging.projects.sinks.update", - "path": "v2beta1/{+sinkName}", - "httpMethod": "PUT", - "description": "Creates or updates a sink.", - "parameters": { - "sinkName": { - "type": "string", - "description": "The resource name of the sink to update. Example: `\"projects/my-project-id/sinks/my-sink-id\"`. The updated sink must be provided in the request and have the same name that is specified in `sinkName`. If the sink does not exist, it is created.", - "required": true, - "pattern": "^projects/[^/]*/sinks/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "sinkName" - ], - "request": { - "$ref": "LogSink" - }, - "response": { - "$ref": "LogSink" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/logging.admin" - ] - }, - "delete": { - "id": "logging.projects.sinks.delete", - "path": "v2beta1/{+sinkName}", - "httpMethod": "DELETE", - "description": "Deletes a sink.", - "parameters": { - "sinkName": { - "type": "string", - "description": "The resource name of the sink to delete. Example: `\"projects/my-project-id/sinks/my-sink-id\"`.", - "required": true, - "pattern": "^projects/[^/]*/sinks/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "sinkName" - ], - "response": { - "$ref": "Empty" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/logging.admin" - ] - } - } - }, - "metrics": { - "methods": { - "list": { - "id": "logging.projects.metrics.list", - "path": "v2beta1/{+projectName}/metrics", - "httpMethod": "GET", - "description": "Lists logs-based metrics.", - "parameters": { - "projectName": { - "type": "string", - "description": "Required. The resource name of the project containing the metrics. Example: `\"projects/my-project-id\"`.", - "required": true, - "pattern": "^projects/[^/]*$", - "location": "path" + "description": "Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available.", + "type": "integer", + "format": "int32" + }, + "orderBy": { + "description": "Optional. How the results should be sorted. Presently, the only permitted values are \"timestamp asc\" (default) and \"timestamp desc\". The first option returns entries in order of increasing values of LogEntry.timestamp (oldest first), and the second option returns entries in order of decreasing timestamps (newest first). Entries with equal timestamps are returned in order of LogEntry.insertId.", + "type": "string" }, "pageToken": { - "type": "string", - "description": "Optional. If the `pageToken` parameter is supplied, then the next page of results is retrieved. The `pageToken` parameter must be set to the value of the `nextPageToken` from the previous response. The value of `projectName` must be the same as in the previous request.", - "location": "query" - }, - "pageSize": { - "type": "integer", - "description": "Optional. The maximum number of results to return from this request. You must check for presence of `nextPageToken` to determine if additional results are available, which you can retrieve by passing the `nextPageToken` value as the `pageToken` parameter in the next request.", - "format": "int32", - "location": "query" + "description": "Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call.", + "type": "string" } - }, - "parameterOrder": [ - "projectName" - ], - "response": { - "$ref": "ListLogMetricsResponse" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - "https://www.googleapis.com/auth/logging.admin", - "https://www.googleapis.com/auth/logging.read" - ] }, - "get": { - "id": "logging.projects.metrics.get", - "path": "v2beta1/{+metricName}", - "httpMethod": "GET", - "description": "Gets a logs-based metric.", - "parameters": { - "metricName": { - "type": "string", - "description": "The resource name of the desired metric. Example: `\"projects/my-project-id/metrics/my-metric-id\"`.", - "required": true, - "pattern": "^projects/[^/]*/metrics/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "metricName" - ], - "response": { - "$ref": "LogMetric" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - "https://www.googleapis.com/auth/logging.admin", - "https://www.googleapis.com/auth/logging.read" - ] - }, - "create": { - "id": "logging.projects.metrics.create", - "path": "v2beta1/{+projectName}/metrics", - "httpMethod": "POST", - "description": "Creates a logs-based metric.", - "parameters": { - "projectName": { - "type": "string", - "description": "The resource name of the project in which to create the metric. Example: `\"projects/my-project-id\"`. The new metric must be provided in the request.", - "required": true, - "pattern": "^projects/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "projectName" - ], - "request": { - "$ref": "LogMetric" - }, - "response": { - "$ref": "LogMetric" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/logging.admin", - "https://www.googleapis.com/auth/logging.write" - ] - }, - "update": { - "id": "logging.projects.metrics.update", - "path": "v2beta1/{+metricName}", - "httpMethod": "PUT", - "description": "Creates or updates a logs-based metric.", - "parameters": { - "metricName": { - "type": "string", - "description": "The resource name of the metric to update. Example: `\"projects/my-project-id/metrics/my-metric-id\"`. The updated metric must be provided in the request and have the same identifier that is specified in `metricName`. If the metric does not exist, it is created.", - "required": true, - "pattern": "^projects/[^/]*/metrics/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "metricName" - ], - "request": { - "$ref": "LogMetric" - }, - "response": { - "$ref": "LogMetric" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/logging.admin", - "https://www.googleapis.com/auth/logging.write" - ] - }, - "delete": { - "id": "logging.projects.metrics.delete", - "path": "v2beta1/{+metricName}", - "httpMethod": "DELETE", - "description": "Deletes a logs-based metric.", - "parameters": { - "metricName": { - "type": "string", - "description": "The resource name of the metric to delete. Example: `\"projects/my-project-id/metrics/my-metric-id\"`.", - "required": true, - "pattern": "^projects/[^/]*/metrics/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "metricName" - ], - "response": { - "$ref": "Empty" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/logging.admin", - "https://www.googleapis.com/auth/logging.write" - ] - } - } + "id": "ListLogEntriesRequest" } - } }, - "entries": { - "methods": { - "write": { - "id": "logging.entries.write", - "path": "v2beta1/entries:write", - "httpMethod": "POST", - "description": "Writes log entries to Cloud Logging. All log entries in Cloud Logging are written by this method.", - "request": { - "$ref": "WriteLogEntriesRequest" - }, - "response": { - "$ref": "WriteLogEntriesResponse" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/logging.admin", - "https://www.googleapis.com/auth/logging.write" - ] + "revision": "20161206", + "basePath": "", + "icons": { + "x32": "http://www.google.com/images/icons/product/search-32.gif", + "x16": "http://www.google.com/images/icons/product/search-16.gif" + }, + "version_module": "True", + "canonicalName": "Logging", + "discoveryVersion": "v1", + "baseUrl": "https://logging.googleapis.com/", + "name": "logging", + "parameters": { + "access_token": { + "description": "OAuth access token.", + "type": "string", + "location": "query" }, - "list": { - "id": "logging.entries.list", - "path": "v2beta1/entries:list", - "httpMethod": "POST", - "description": "Lists log entries. Use this method to retrieve log entries from Cloud Logging. For ways to export log entries, see [Exporting Logs](/logging/docs/export).", - "request": { - "$ref": "ListLogEntriesRequest" - }, - "response": { - "$ref": "ListLogEntriesResponse" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - "https://www.googleapis.com/auth/logging.admin", - "https://www.googleapis.com/auth/logging.read" - ] + "prettyPrint": { + "description": "Returns response with indentations and line breaks.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "key": { + "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", + "type": "string", + "location": "query" + }, + "quotaUser": { + "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.", + "type": "string", + "location": "query" + }, + "pp": { + "description": "Pretty-print response.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "fields": { + "description": "Selector specifying which fields to include in a partial response.", + "type": "string", + "location": "query" + }, + "alt": { + "description": "Data format for response.", + "location": "query", + "enum": [ + "json", + "media", + "proto" + ], + "default": "json", + "enumDescriptions": [ + "Responses with Content-Type of application/json", + "Media download with context-dependent Content-Type", + "Responses with Content-Type of application/x-protobuf" + ], + "type": "string" + }, + "$.xgafv": { + "description": "V1 error format.", + "enum": [ + "1", + "2" + ], + "enumDescriptions": [ + "v1 error format", + "v2 error format" + ], + "type": "string", + "location": "query" + }, + "callback": { + "description": "JSONP", + "type": "string", + "location": "query" + }, + "oauth_token": { + "description": "OAuth 2.0 token for the current user.", + "type": "string", + "location": "query" + }, + "uploadType": { + "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").", + "type": "string", + "location": "query" + }, + "bearer_token": { + "description": "OAuth bearer token.", + "type": "string", + "location": "query" + }, + "upload_protocol": { + "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").", + "type": "string", + "location": "query" } - } }, - "monitoredResourceDescriptors": { - "methods": { - "list": { - "id": "logging.monitoredResourceDescriptors.list", - "path": "v2beta1/monitoredResourceDescriptors", - "httpMethod": "GET", - "description": "Lists monitored resource descriptors that are used by Cloud Logging.", - "parameters": { - "pageSize": { - "type": "integer", - "description": "Optional. The maximum number of results to return from this request. You must check for presence of `nextPageToken` to determine if additional results are available, which you can retrieve by passing the `nextPageToken` value as the `pageToken` parameter in the next request.", - "format": "int32", - "location": "query" - }, - "pageToken": { - "type": "string", - "description": "Optional. If the `pageToken` parameter is supplied, then the next page of results is retrieved. The `pageToken` parameter must be set to the value of the `nextPageToken` from the previous response.", - "location": "query" - } - }, - "response": { - "$ref": "ListMonitoredResourceDescriptorsResponse" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - "https://www.googleapis.com/auth/logging.admin", - "https://www.googleapis.com/auth/logging.read" - ] - } - } - } - } + "documentationLink": "https://cloud.google.com/logging/docs/", + "ownerDomain": "google.com", + "batchPath": "batch", + "servicePath": "", + "ownerName": "Google", + "version": "v2beta1", + "rootUrl": "https://logging.googleapis.com/", + "kind": "discovery#restDescription" } diff --git a/etc/api/manufacturers/v1/manufacturers-api.json b/etc/api/manufacturers/v1/manufacturers-api.json new file mode 100644 index 0000000000..307547a6c4 --- /dev/null +++ b/etc/api/manufacturers/v1/manufacturers-api.json @@ -0,0 +1,353 @@ +{ + "id": "manufacturers:v1", + "auth": { + "oauth2": { + "scopes": { + "https://www.googleapis.com/auth/manufacturercenter": { + "description": "Manage your product listings for Google Manufacturer Center" + } + } + } + }, + "description": "Public API for managing Manufacturer Center related data.", + "protocol": "rest", + "title": "Manufacturer Center API", + "resources": { + "accounts": { + "resources": { + "products": { + "methods": { + "get": { + "id": "manufacturers.accounts.products.get", + "response": { + "$ref": "Product" + }, + "parameterOrder": [ + "parent", + "name" + ], + "description": "Gets the product from a Manufacturer Center account, including product\nissues.", + "flatPath": "v1/accounts/{accountsId}/products/{productsId}", + "httpMethod": "GET", + "parameters": { + "parent": { + "description": "Parent ID in the format `accounts/{account_id}`.\n\n`account_id` - The ID of the Manufacturer Center account.", + "required": true, + "pattern": "^accounts/[^/]+$", + "location": "path", + "type": "string" + }, + "name": { + "description": "Name in the format `{target_country}:{content_language}:{product_id}`.\n\n`target_country` - The target country of the product as a CLDR territory\n code (for example, US).\n\n`content_language` - The content language of the product as a two-letter\n ISO 639-1 language code (for example, en).\n\n`product_id` - The ID of the product. For more information, see\n https://support.google.com/manufacturers/answer/6124116#id.", + "required": true, + "pattern": "^[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1/{+parent}/products/{+name}", + "scopes": [ + "https://www.googleapis.com/auth/manufacturercenter" + ] + }, + "list": { + "id": "manufacturers.accounts.products.list", + "response": { + "$ref": "ListProductsResponse" + }, + "parameterOrder": [ + "parent" + ], + "description": "Lists all the products in a Manufacturer Center account.", + "flatPath": "v1/accounts/{accountsId}/products", + "httpMethod": "GET", + "parameters": { + "pageSize": { + "description": "Maximum number of product statuses to return in the response, used for\npaging.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "parent": { + "description": "Parent ID in the format `accounts/{account_id}`.\n\n`account_id` - The ID of the Manufacturer Center account.", + "required": true, + "pattern": "^accounts/[^/]+$", + "location": "path", + "type": "string" + }, + "pageToken": { + "description": "The token returned by the previous request.", + "location": "query", + "type": "string" + } + }, + "path": "v1/{+parent}/products", + "scopes": [ + "https://www.googleapis.com/auth/manufacturercenter" + ] + } + } + } + } + } + }, + "schemas": { + "ListProductsResponse": { + "type": "object", + "properties": { + "nextPageToken": { + "description": "The token for the retrieval of the next page of product statuses.", + "type": "string" + }, + "products": { + "description": "List of the products.", + "type": "array", + "items": { + "$ref": "Product" + } + } + }, + "id": "ListProductsResponse" + }, + "Issue": { + "description": "Product issue.", + "type": "object", + "properties": { + "severity": { + "description": "The severity of the issue.", + "enum": [ + "SEVERITY_UNSPECIFIED", + "ERROR", + "WARNING", + "INFO" + ], + "enumDescriptions": [ + "Unspecified severity, never used.", + "Error severity. The issue prevents the usage of the whole item.", + "Warning severity. The issue is either one that prevents the usage of the\nattribute that triggered it or one that will soon prevent the usage of\nthe whole item.", + "Info severity. The issue is one that doesn't require immediate attention.\nIt is, for example, used to communicate which attributes are still\npending review." + ], + "type": "string" + }, + "description": { + "description": "Description of the issue.", + "type": "string" + }, + "attribute": { + "description": "If present, the attribute that triggered the issue. For more information\nabout attributes, see\nhttps://support.google.com/manufacturers/answer/6124116.", + "type": "string" + }, + "type": { + "description": "The server-generated type of the issue, for example,\n“INCORRECT_TEXT_FORMATTING”, “IMAGE_NOT_SERVEABLE”, etc.", + "type": "string" + } + }, + "id": "Issue" + }, + "Attributes": { + "description": "Attributes of the product. For more information, see\nhttps://support.google.com/manufacturers/answer/6124116.", + "type": "object", + "properties": { + "productPageUrl": { + "description": "The URL of the manufacturer's detail page of the product. For more\ninformation, see\nhttps://support.google.com/manufacturers/answer/6124116#productpage.", + "type": "string" + }, + "mpn": { + "description": "The Manufacturer Part Number (MPN) of the product. For more information,\nsee https://support.google.com/manufacturers/answer/6124116#mpn.", + "type": "string" + }, + "title": { + "description": "The title of the product. For more information, see\nhttps://support.google.com/manufacturers/answer/6124116#title.", + "type": "string" + }, + "productLine": { + "description": "The name of the group of products related to the product. For more\ninformation, see\nhttps://support.google.com/manufacturers/answer/6124116#productline.", + "type": "string" + }, + "productName": { + "description": "The canonical name of the product. For more information, see\nhttps://support.google.com/manufacturers/answer/6124116#productname.", + "type": "string" + }, + "brand": { + "description": "The brand name of the product. For more information, see\nhttps://support.google.com/manufacturers/answer/6124116#brand.", + "type": "string" + }, + "productType": { + "description": "The manufacturer's category of the product. For more information, see\nhttps://support.google.com/manufacturers/answer/6124116#producttype.", + "type": "array", + "items": { + "type": "string" + } + }, + "gtin": { + "description": "The Global Trade Item Number (GTIN) of the product. For more information,\nsee https://support.google.com/manufacturers/answer/6124116#gtin.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "id": "Attributes" + }, + "Product": { + "description": "Product data.", + "type": "object", + "properties": { + "parent": { + "description": "Parent ID in the format `accounts/{account_id}`.\n\n`account_id` - The ID of the Manufacturer Center account.\n@OutputOnly", + "type": "string" + }, + "targetCountry": { + "description": "The target country of the product as a CLDR territory code (for example,\nUS).\n@OutputOnly", + "type": "string" + }, + "contentLanguage": { + "description": "The content language of the product as a two-letter ISO 639-1 language code\n(for example, en).\n@OutputOnly", + "type": "string" + }, + "manuallyDeletedAttributes": { + "description": "Names of the attributes of the product deleted manually via the\nManufacturer Center UI.\n@OutputOnly", + "type": "array", + "items": { + "type": "string" + } + }, + "productId": { + "description": "The ID of the product. For more information, see\nhttps://support.google.com/manufacturers/answer/6124116#id.\n@OutputOnly", + "type": "string" + }, + "finalAttributes": { + "description": "Final attributes of the product. The final attributes are obtained by\noverriding the uploaded attributes with the manually provided and deleted\nattributes. Google systems only process, evaluate, review, and/or use final\nattributes.\n@OutputOnly", + "$ref": "Attributes" + }, + "issues": { + "description": "A server-generated list of issues associated with the product.\n@OutputOnly", + "type": "array", + "items": { + "$ref": "Issue" + } + }, + "name": { + "description": "Name in the format `{target_country}:{content_language}:{product_id}`.\n\n`target_country` - The target country of the product as a CLDR territory\n code (for example, US).\n\n`content_language` - The content language of the product as a two-letter\n ISO 639-1 language code (for example, en).\n\n`product_id` - The ID of the product. For more information, see\n https://support.google.com/manufacturers/answer/6124116#id.\n@OutputOnly", + "type": "string" + }, + "uploadedAttributes": { + "description": "Attributes of the product uploaded via the Manufacturer Center API or via\nfeeds.", + "$ref": "Attributes" + }, + "manuallyProvidedAttributes": { + "description": "Attributes of the product provided manually via the Manufacturer Center UI.\n@OutputOnly", + "$ref": "Attributes" + } + }, + "id": "Product" + } + }, + "revision": "20161028", + "basePath": "", + "icons": { + "x32": "http://www.google.com/images/icons/product/search-32.gif", + "x16": "http://www.google.com/images/icons/product/search-16.gif" + }, + "version_module": "True", + "canonicalName": "Manufacturer Center", + "discoveryVersion": "v1", + "baseUrl": "https://manufacturers.googleapis.com/", + "name": "manufacturers", + "parameters": { + "access_token": { + "description": "OAuth access token.", + "type": "string", + "location": "query" + }, + "prettyPrint": { + "description": "Returns response with indentations and line breaks.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "key": { + "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", + "type": "string", + "location": "query" + }, + "quotaUser": { + "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.", + "type": "string", + "location": "query" + }, + "pp": { + "description": "Pretty-print response.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "fields": { + "description": "Selector specifying which fields to include in a partial response.", + "type": "string", + "location": "query" + }, + "alt": { + "description": "Data format for response.", + "location": "query", + "enum": [ + "json", + "media", + "proto" + ], + "default": "json", + "enumDescriptions": [ + "Responses with Content-Type of application/json", + "Media download with context-dependent Content-Type", + "Responses with Content-Type of application/x-protobuf" + ], + "type": "string" + }, + "$.xgafv": { + "description": "V1 error format.", + "enum": [ + "1", + "2" + ], + "enumDescriptions": [ + "v1 error format", + "v2 error format" + ], + "type": "string", + "location": "query" + }, + "callback": { + "description": "JSONP", + "type": "string", + "location": "query" + }, + "oauth_token": { + "description": "OAuth 2.0 token for the current user.", + "type": "string", + "location": "query" + }, + "uploadType": { + "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").", + "type": "string", + "location": "query" + }, + "bearer_token": { + "description": "OAuth bearer token.", + "type": "string", + "location": "query" + }, + "upload_protocol": { + "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").", + "type": "string", + "location": "query" + } + }, + "documentationLink": "https://developers.google.com/manufacturers/", + "ownerDomain": "google.com", + "batchPath": "batch", + "servicePath": "", + "ownerName": "Google", + "version": "v1", + "rootUrl": "https://manufacturers.googleapis.com/", + "kind": "discovery#restDescription" +} diff --git a/etc/api/mirror/v1/mirror-api.json b/etc/api/mirror/v1/mirror-api.json index fe5e78b653..4e86829c4f 100644 --- a/etc/api/mirror/v1/mirror-api.json +++ b/etc/api/mirror/v1/mirror-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/OwaGZAsygqh-DVZUGXJhzHuvoBQ\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/nxDdKsGKU-CGQ0rCYbUZuIhDXnY\"", "discoveryVersion": "v1", "id": "mirror:v1", "name": "mirror", @@ -11,8 +11,8 @@ "ownerDomain": "google.com", "ownerName": "Google", "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" }, "documentationLink": "https://developers.google.com/glass", "labels": [ diff --git a/etc/api/ml/v1beta1/ml-api.json b/etc/api/ml/v1beta1/ml-api.json new file mode 100644 index 0000000000..bd6464e192 --- /dev/null +++ b/etc/api/ml/v1beta1/ml-api.json @@ -0,0 +1,1385 @@ +{ + "id": "ml:v1beta1", + "auth": { + "oauth2": { + "scopes": { + "https://www.googleapis.com/auth/cloud-platform": { + "description": "View and manage your data across Google Cloud Platform services" + } + } + } + }, + "description": "An API to enable creating and using machine learning models.", + "protocol": "rest", + "title": "Google Cloud Machine Learning", + "resources": { + "projects": { + "resources": { + "models": { + "resources": { + "versions": { + "methods": { + "create": { + "id": "ml.projects.models.versions.create", + "response": { + "$ref": "GoogleLongrunning__Operation" + }, + "parameterOrder": [ + "parent" + ], + "description": "Creates a new version of a model from a trained TensorFlow model.\n\nIf the version created in the cloud by this call is the first deployed\nversion of the specified model, it will be made the default version of the\nmodel. When you add a version to a model that already has one or more\nversions, the default version does not automatically change. If you want a\nnew version to be the default, you must call\n[projects.models.versions.setDefault](/ml/reference/rest/v1beta1/projects.models.versions/setDefault).", + "request": { + "$ref": "GoogleCloudMlV1beta1__Version" + }, + "flatPath": "v1beta1/projects/{projectsId}/models/{modelsId}/versions", + "httpMethod": "POST", + "parameters": { + "parent": { + "description": "Required. The name of the model.\n\nAuthorization: requires `Editor` role on the parent project.", + "required": true, + "pattern": "^projects/[^/]+/models/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/{+parent}/versions", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "get": { + "id": "ml.projects.models.versions.get", + "response": { + "$ref": "GoogleCloudMlV1beta1__Version" + }, + "parameterOrder": [ + "name" + ], + "description": "Gets information about a model version.\n\nModels can have multiple versions. You can call\n[projects.models.versions.list](/ml/reference/rest/v1beta1/projects.models.versions/list)\nto get the same information that this method returns for all of the\nversions of a model.", + "flatPath": "v1beta1/projects/{projectsId}/models/{modelsId}/versions/{versionsId}", + "httpMethod": "GET", + "parameters": { + "name": { + "description": "Required. The name of the version.\n\nAuthorization: requires `Viewer` role on the parent project.", + "required": true, + "pattern": "^projects/[^/]+/models/[^/]+/versions/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/{+name}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "setDefault": { + "id": "ml.projects.models.versions.setDefault", + "response": { + "$ref": "GoogleCloudMlV1beta1__Version" + }, + "parameterOrder": [ + "name" + ], + "description": "Designates a version to be the default for the model.\n\nThe default version is used for prediction requests made against the model\nthat don't specify a version.\n\nThe first version to be created for a model is automatically set as the\ndefault. You must make any subsequent changes to the default version\nsetting manually using this method.", + "request": { + "$ref": "GoogleCloudMlV1beta1__SetDefaultVersionRequest" + }, + "flatPath": "v1beta1/projects/{projectsId}/models/{modelsId}/versions/{versionsId}:setDefault", + "httpMethod": "POST", + "parameters": { + "name": { + "description": "Required. The name of the version to make the default for the model. You\ncan get the names of all the versions of a model by calling\n[projects.models.versions.list](/ml/reference/rest/v1beta1/projects.models.versions/list).\n\nAuthorization: requires `Editor` role on the parent project.", + "required": true, + "pattern": "^projects/[^/]+/models/[^/]+/versions/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/{+name}:setDefault", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "list": { + "id": "ml.projects.models.versions.list", + "response": { + "$ref": "GoogleCloudMlV1beta1__ListVersionsResponse" + }, + "parameterOrder": [ + "parent" + ], + "description": "Gets basic information about all the versions of a model.\n\nIf you expect that a model has a lot of versions, or if you need to handle\nonly a limited number of results at a time, you can request that the list\nbe retrieved in batches (called pages):", + "flatPath": "v1beta1/projects/{projectsId}/models/{modelsId}/versions", + "httpMethod": "GET", + "parameters": { + "pageSize": { + "description": "Optional. The number of versions to retrieve per \"page\" of results. If\nthere are more remaining results than this number, the response message\nwill contain a valid value in the `next_page_token` field.\n\nThe default value is 20, and the maximum page size is 100.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "parent": { + "description": "Required. The name of the model for which to list the version.\n\nAuthorization: requires `Viewer` role on the parent project.", + "required": true, + "pattern": "^projects/[^/]+/models/[^/]+$", + "location": "path", + "type": "string" + }, + "pageToken": { + "description": "Optional. A page token to request the next page of results.\n\nYou get the token from the `next_page_token` field of the response from\nthe previous call.", + "location": "query", + "type": "string" + } + }, + "path": "v1beta1/{+parent}/versions", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "delete": { + "id": "ml.projects.models.versions.delete", + "response": { + "$ref": "GoogleLongrunning__Operation" + }, + "parameterOrder": [ + "name" + ], + "description": "Deletes a model version.\n\nEach model can have multiple versions deployed and in use at any given\ntime. Use this method to remove a single version.\n\nNote: You cannot delete the version that is set as the default version\nof the model unless it is the only remaining version.", + "flatPath": "v1beta1/projects/{projectsId}/models/{modelsId}/versions/{versionsId}", + "httpMethod": "DELETE", + "parameters": { + "name": { + "description": "Required. The name of the version. You can get the names of all the\nversions of a model by calling\n[projects.models.versions.list](/ml/reference/rest/v1beta1/projects.models.versions/list).\n\nAuthorization: requires `Editor` role on the parent project.", + "required": true, + "pattern": "^projects/[^/]+/models/[^/]+/versions/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/{+name}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + } + } + } + }, + "methods": { + "create": { + "id": "ml.projects.models.create", + "response": { + "$ref": "GoogleCloudMlV1beta1__Model" + }, + "parameterOrder": [ + "parent" + ], + "description": "Creates a model which will later contain one or more versions.\n\nYou must add at least one version before you can request predictions from\nthe model. Add versions by calling\n[projects.models.versions.create](/ml/reference/rest/v1beta1/projects.models.versions/create).", + "request": { + "$ref": "GoogleCloudMlV1beta1__Model" + }, + "flatPath": "v1beta1/projects/{projectsId}/models", + "httpMethod": "POST", + "parameters": { + "parent": { + "description": "Required. The project name.\n\nAuthorization: requires `Editor` role on the specified project.", + "required": true, + "pattern": "^projects/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/{+parent}/models", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "get": { + "id": "ml.projects.models.get", + "response": { + "$ref": "GoogleCloudMlV1beta1__Model" + }, + "parameterOrder": [ + "name" + ], + "description": "Gets information about a model, including its name, the description (if\nset), and the default version (if at least one version of the model has\nbeen deployed).", + "flatPath": "v1beta1/projects/{projectsId}/models/{modelsId}", + "httpMethod": "GET", + "parameters": { + "name": { + "description": "Required. The name of the model.\n\nAuthorization: requires `Viewer` role on the parent project.", + "required": true, + "pattern": "^projects/[^/]+/models/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/{+name}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "list": { + "id": "ml.projects.models.list", + "response": { + "$ref": "GoogleCloudMlV1beta1__ListModelsResponse" + }, + "parameterOrder": [ + "parent" + ], + "description": "Lists the models in a project.\n\nEach project can contain multiple models, and each model can have multiple\nversions.", + "flatPath": "v1beta1/projects/{projectsId}/models", + "httpMethod": "GET", + "parameters": { + "pageSize": { + "description": "Optional. The number of models to retrieve per \"page\" of results. If there\nare more remaining results than this number, the response message will\ncontain a valid value in the `next_page_token` field.\n\nThe default value is 20, and the maximum page size is 100.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "parent": { + "description": "Required. The name of the project whose models are to be listed.\n\nAuthorization: requires `Viewer` role on the specified project.", + "required": true, + "pattern": "^projects/[^/]+$", + "location": "path", + "type": "string" + }, + "pageToken": { + "description": "Optional. A page token to request the next page of results.\n\nYou get the token from the `next_page_token` field of the response from\nthe previous call.", + "location": "query", + "type": "string" + } + }, + "path": "v1beta1/{+parent}/models", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "delete": { + "id": "ml.projects.models.delete", + "response": { + "$ref": "GoogleLongrunning__Operation" + }, + "parameterOrder": [ + "name" + ], + "description": "Deletes a model.\n\nYou can only delete a model if there are no versions in it. You can delete\nversions by calling\n[projects.models.versions.delete](/ml/reference/rest/v1beta1/projects.models.versions/delete).", + "flatPath": "v1beta1/projects/{projectsId}/models/{modelsId}", + "httpMethod": "DELETE", + "parameters": { + "name": { + "description": "Required. The name of the model.\n\nAuthorization: requires `Editor` role on the parent project.", + "required": true, + "pattern": "^projects/[^/]+/models/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/{+name}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + } + } + }, + "jobs": { + "methods": { + "create": { + "id": "ml.projects.jobs.create", + "response": { + "$ref": "GoogleCloudMlV1beta1__Job" + }, + "parameterOrder": [ + "parent" + ], + "description": "Creates a training or a batch prediction job.", + "request": { + "$ref": "GoogleCloudMlV1beta1__Job" + }, + "flatPath": "v1beta1/projects/{projectsId}/jobs", + "httpMethod": "POST", + "parameters": { + "parent": { + "description": "Required. The project name.\n\nAuthorization: requires `Editor` role on the specified project.", + "required": true, + "pattern": "^projects/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/{+parent}/jobs", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "get": { + "id": "ml.projects.jobs.get", + "response": { + "$ref": "GoogleCloudMlV1beta1__Job" + }, + "parameterOrder": [ + "name" + ], + "description": "Describes a job.", + "flatPath": "v1beta1/projects/{projectsId}/jobs/{jobsId}", + "httpMethod": "GET", + "parameters": { + "name": { + "description": "Required. The name of the job to get the description of.\n\nAuthorization: requires `Viewer` role on the parent project.", + "required": true, + "pattern": "^projects/[^/]+/jobs/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/{+name}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "list": { + "id": "ml.projects.jobs.list", + "response": { + "$ref": "GoogleCloudMlV1beta1__ListJobsResponse" + }, + "parameterOrder": [ + "parent" + ], + "description": "Lists the jobs in the project.", + "flatPath": "v1beta1/projects/{projectsId}/jobs", + "httpMethod": "GET", + "parameters": { + "pageSize": { + "description": "Optional. The number of jobs to retrieve per \"page\" of results. If there\nare more remaining results than this number, the response message will\ncontain a valid value in the `next_page_token` field.\n\nThe default value is 20, and the maximum page size is 100.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "filter": { + "description": "Optional. Specifies the subset of jobs to retrieve.", + "location": "query", + "type": "string" + }, + "parent": { + "description": "Required. The name of the project for which to list jobs.\n\nAuthorization: requires `Viewer` role on the specified project.", + "required": true, + "pattern": "^projects/[^/]+$", + "location": "path", + "type": "string" + }, + "pageToken": { + "description": "Optional. A page token to request the next page of results.\n\nYou get the token from the `next_page_token` field of the response from\nthe previous call.", + "location": "query", + "type": "string" + } + }, + "path": "v1beta1/{+parent}/jobs", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "cancel": { + "id": "ml.projects.jobs.cancel", + "response": { + "$ref": "GoogleProtobuf__Empty" + }, + "parameterOrder": [ + "name" + ], + "description": "Cancels a running job.", + "request": { + "$ref": "GoogleCloudMlV1beta1__CancelJobRequest" + }, + "flatPath": "v1beta1/projects/{projectsId}/jobs/{jobsId}:cancel", + "httpMethod": "POST", + "parameters": { + "name": { + "description": "Required. The name of the job to cancel.\n\nAuthorization: requires `Editor` role on the parent project.", + "required": true, + "pattern": "^projects/[^/]+/jobs/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/{+name}:cancel", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + } + } + }, + "operations": { + "methods": { + "get": { + "id": "ml.projects.operations.get", + "response": { + "$ref": "GoogleLongrunning__Operation" + }, + "parameterOrder": [ + "name" + ], + "description": "Gets the latest state of a long-running operation. Clients can use this\nmethod to poll the operation result at intervals as recommended by the API\nservice.", + "flatPath": "v1beta1/projects/{projectsId}/operations/{operationsId}", + "httpMethod": "GET", + "parameters": { + "name": { + "description": "The name of the operation resource.", + "required": true, + "pattern": "^projects/[^/]+/operations/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/{+name}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "list": { + "id": "ml.projects.operations.list", + "response": { + "$ref": "GoogleLongrunning__ListOperationsResponse" + }, + "parameterOrder": [ + "name" + ], + "description": "Lists operations that match the specified filter in the request. If the\nserver doesn't support this method, it returns `UNIMPLEMENTED`.\n\nNOTE: the `name` binding below allows API services to override the binding\nto use different resource name schemes, such as `users/*/operations`.", + "flatPath": "v1beta1/projects/{projectsId}/operations", + "httpMethod": "GET", + "parameters": { + "pageSize": { + "description": "The standard list page size.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "filter": { + "description": "The standard list filter.", + "location": "query", + "type": "string" + }, + "name": { + "description": "The name of the operation collection.", + "required": true, + "pattern": "^projects/[^/]+$", + "location": "path", + "type": "string" + }, + "pageToken": { + "description": "The standard list page token.", + "location": "query", + "type": "string" + } + }, + "path": "v1beta1/{+name}/operations", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "delete": { + "id": "ml.projects.operations.delete", + "response": { + "$ref": "GoogleProtobuf__Empty" + }, + "parameterOrder": [ + "name" + ], + "description": "Deletes a long-running operation. This method indicates that the client is\nno longer interested in the operation result. It does not cancel the\noperation. If the server doesn't support this method, it returns\n`google.rpc.Code.UNIMPLEMENTED`.", + "flatPath": "v1beta1/projects/{projectsId}/operations/{operationsId}", + "httpMethod": "DELETE", + "parameters": { + "name": { + "description": "The name of the operation resource to be deleted.", + "required": true, + "pattern": "^projects/[^/]+/operations/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/{+name}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "cancel": { + "id": "ml.projects.operations.cancel", + "response": { + "$ref": "GoogleProtobuf__Empty" + }, + "parameterOrder": [ + "name" + ], + "description": "Starts asynchronous cancellation on a long-running operation. The server\nmakes a best effort to cancel the operation, but success is not\nguaranteed. If the server doesn't support this method, it returns\n`google.rpc.Code.UNIMPLEMENTED`. Clients can use\nOperations.GetOperation or\nother methods to check whether the cancellation succeeded or whether the\noperation completed despite cancellation. On successful cancellation,\nthe operation is not deleted; instead, it becomes an operation with\nan Operation.error value with a google.rpc.Status.code of 1,\ncorresponding to `Code.CANCELLED`.", + "flatPath": "v1beta1/projects/{projectsId}/operations/{operationsId}:cancel", + "httpMethod": "POST", + "parameters": { + "name": { + "description": "The name of the operation resource to be cancelled.", + "required": true, + "pattern": "^projects/[^/]+/operations/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/{+name}:cancel", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + } + } + } + }, + "methods": { + "predict": { + "id": "ml.projects.predict", + "response": { + "$ref": "GoogleApi__HttpBody" + }, + "parameterOrder": [ + "name" + ], + "description": "Performs prediction on the data in the request.\n\nResponses are very similar to requests. There are two top-level fields,\neach of which are JSON lists:\n\n\u003cdl\u003e\n \u003cdt\u003epredictions\u003c/dt\u003e\n \u003cdd\u003eThe list of predictions, one per instance in the request.\u003c/dd\u003e\n \u003cdt\u003eerror\u003c/dt\u003e\n \u003cdd\u003eAn error message returned instead of a prediction list if any\n instance produced an error.\u003c/dd\u003e\n\u003c/dl\u003e\n\nIf the call is successful, the response body will contain one prediction\nentry per instance in the request body. If prediction fails for any\ninstance, the response body will contain no predictions and will contian\na single error entry instead.\n\nEven though there is one prediction per instance, the format of a\nprediction is not directly related to the format of an instance.\nPredictions take whatever format is specified in the outputs collection\ndefined in the model. The collection of predictions is returned in a JSON\nlist. Each member of the list can be a simple value, a list, or a JSON\nobject of any complexity. If your model has more than one output tensor,\neach prediction will be a JSON object containing a name/value pair for each\noutput. The names identify the output aliases in the graph.\n\nThe following examples show some possible responses:\n\nA simple set of predictions for three input instances, where each\nprediction is an integer value:\n\u003cpre\u003e\n{\"predictions\": [5, 4, 3]}\n\u003c/pre\u003e\nA more complex set of predictions, each containing two named values that\ncorrespond to output tensors, named **label** and **scores** respectively.\nThe value of **label** is the predicted category (\"car\" or \"beach\") and\n**scores** contains a list of probabilities for that instance across the\npossible categories.\n\u003cpre\u003e\n{\"predictions\": [{\"label\": \"beach\", \"scores\": [0.1, 0.9]},\n {\"label\": \"car\", \"scores\": [0.75, 0.25]}]}\n\u003c/pre\u003e\nA response when there is an error processing an input instance:\n\u003cpre\u003e\n{\"error\": \"Divide by zero\"}\n\u003c/pre\u003e", + "request": { + "$ref": "GoogleCloudMlV1beta1__PredictRequest" + }, + "flatPath": "v1beta1/projects/{projectsId}:predict", + "httpMethod": "POST", + "parameters": { + "name": { + "description": "Required. The resource name of a model or a version.\n\nAuthorization: requires `Viewer` role on the parent project.", + "required": true, + "pattern": "^projects/.+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/{+name}:predict", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "getConfig": { + "id": "ml.projects.getConfig", + "response": { + "$ref": "GoogleCloudMlV1beta1__GetConfigResponse" + }, + "parameterOrder": [ + "name" + ], + "description": "Get the service account information associated with your project. You need\nthis information in order to grant the service account persmissions for\nthe Google Cloud Storage location where you put your model training code\nfor training the model with Google Cloud Machine Learning.", + "flatPath": "v1beta1/projects/{projectsId}:getConfig", + "httpMethod": "GET", + "parameters": { + "name": { + "description": "Required. The project name.\n\nAuthorization: requires `Viewer` role on the specified project.", + "required": true, + "pattern": "^projects/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/{+name}:getConfig", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + } + } + } + }, + "schemas": { + "GoogleCloudMlV1beta1__HyperparameterOutput": { + "description": "Represents the result of a single hyperparameter tuning trial from a\ntraining job. The TrainingOutput object that is returned on successful\ncompletion of a training job with hyperparameter tuning includes a list\nof HyperparameterOutput objects, one for each successful trial.", + "type": "object", + "properties": { + "finalMetric": { + "description": "The final objective metric seen for this trial.", + "$ref": "GoogleCloudMlV1beta1_HyperparameterOutput_HyperparameterMetric" + }, + "allMetrics": { + "description": "All recorded object metrics for this trial.", + "type": "array", + "items": { + "$ref": "GoogleCloudMlV1beta1_HyperparameterOutput_HyperparameterMetric" + } + }, + "trialId": { + "description": "The trial id for these results.", + "type": "string" + }, + "hyperparameters": { + "description": "The hyperparameters given to this trial.", + "additionalProperties": { + "type": "string" + }, + "type": "object" + } + }, + "id": "GoogleCloudMlV1beta1__HyperparameterOutput" + }, + "GoogleCloudMlV1beta1__GetConfigResponse": { + "description": "Returns service account information associated with a project.", + "type": "object", + "properties": { + "serviceAccount": { + "description": "The service account Cloud ML uses to access resources in the project.", + "type": "string" + }, + "serviceAccountProject": { + "description": "The project number for `service_account`.", + "type": "string", + "format": "int64" + } + }, + "id": "GoogleCloudMlV1beta1__GetConfigResponse" + }, + "GoogleCloudMlV1beta1__ListVersionsResponse": { + "description": "Response message for the ListVersions method.", + "type": "object", + "properties": { + "nextPageToken": { + "description": "Optional. Pass this token as the `page_token` field of the request for a\nsubsequent call.", + "type": "string" + }, + "versions": { + "description": "The list of versions.", + "type": "array", + "items": { + "$ref": "GoogleCloudMlV1beta1__Version" + } + } + }, + "id": "GoogleCloudMlV1beta1__ListVersionsResponse" + }, + "GoogleApi__HttpBody": { + "description": "Message that represents an arbitrary HTTP body. It should only be used for\npayload formats that can't be represented as JSON, such as raw binary or\nan HTML page.\n\n\nThis message can be used both in streaming and non-streaming API methods in\nthe request as well as the response.\n\nIt can be used as a top-level request field, which is convenient if one\nwants to extract parameters from either the URL or HTTP template into the\nrequest fields and also want access to the raw HTTP body.\n\nExample:\n\n message GetResourceRequest {\n // A unique request id.\n string request_id = 1;\n\n // The raw HTTP body is bound to this field.\n google.api.HttpBody http_body = 2;\n }\n\n service ResourceService {\n rpc GetResource(GetResourceRequest) returns (google.api.HttpBody);\n rpc UpdateResource(google.api.HttpBody) returns (google.protobuf.Empty);\n }\n\nExample with streaming methods:\n\n service CaldavService {\n rpc GetCalendar(stream google.api.HttpBody)\n returns (stream google.api.HttpBody);\n rpc UpdateCalendar(stream google.api.HttpBody)\n returns (stream google.api.HttpBody);\n }\n\nUse of this type only changes how the request and response bodies are\nhandled, all other features will continue to work unchanged.", + "type": "object", + "properties": { + "data": { + "description": "HTTP body binary data.", + "type": "string", + "format": "byte" + }, + "contentType": { + "description": "The HTTP Content-Type string representing the content type of the body.", + "type": "string" + } + }, + "id": "GoogleApi__HttpBody" + }, + "GoogleCloudMlV1beta1__Job": { + "description": "Represents a training or prediction job.", + "type": "object", + "properties": { + "predictionInput": { + "description": "Input parameters to create a prediction job.", + "$ref": "GoogleCloudMlV1beta1__PredictionInput" + }, + "state": { + "description": "Output only. The detailed state of a job.", + "enum": [ + "STATE_UNSPECIFIED", + "QUEUED", + "PREPARING", + "RUNNING", + "SUCCEEDED", + "FAILED", + "CANCELLING", + "CANCELLED" + ], + "enumDescriptions": [ + "The job state is unspecified.", + "The job has been just created and processing has not yet begun.", + "The service is preparing to run the job.", + "The job is in progress.", + "The job completed successfully.", + "The job failed.\n`error_message` should contain the details of the failure.", + "The job is being cancelled.\n`error_message` should describe the reason for the cancellation.", + "The job has been cancelled.\n`error_message` should describe the reason for the cancellation." + ], + "type": "string" + }, + "endTime": { + "description": "Output only. When the job processing was completed.", + "type": "string", + "format": "google-datetime" + }, + "createTime": { + "description": "Output only. When the job was created.", + "type": "string", + "format": "google-datetime" + }, + "errorMessage": { + "description": "Output only. The details of a failure or a cancellation.", + "type": "string" + }, + "trainingOutput": { + "description": "The current training job result.", + "$ref": "GoogleCloudMlV1beta1__TrainingOutput" + }, + "startTime": { + "description": "Output only. When the job processing was started.", + "type": "string", + "format": "google-datetime" + }, + "trainingInput": { + "description": "Input parameters to create a training job.", + "$ref": "GoogleCloudMlV1beta1__TrainingInput" + }, + "jobId": { + "description": "Required. The user-specified id of the job.", + "type": "string" + }, + "predictionOutput": { + "description": "The current prediction job result.", + "$ref": "GoogleCloudMlV1beta1__PredictionOutput" + } + }, + "id": "GoogleCloudMlV1beta1__Job" + }, + "GoogleCloudMlV1beta1_HyperparameterOutput_HyperparameterMetric": { + "description": "An observed value of a metric.", + "type": "object", + "properties": { + "objectiveValue": { + "description": "The objective value at this training step.", + "type": "number", + "format": "double" + }, + "trainingStep": { + "description": "The global training step for this metric.", + "type": "string", + "format": "int64" + } + }, + "id": "GoogleCloudMlV1beta1_HyperparameterOutput_HyperparameterMetric" + }, + "GoogleLongrunning__Operation": { + "description": "This resource represents a long-running operation that is the result of a\nnetwork API call.", + "type": "object", + "properties": { + "error": { + "description": "The error result of the operation in case of failure or cancellation.", + "$ref": "GoogleRpc__Status" + }, + "done": { + "description": "If the value is `false`, it means the operation is still in progress.\nIf true, the operation is completed, and either `error` or `response` is\navailable.", + "type": "boolean" + }, + "metadata": { + "description": "Service-specific metadata associated with the operation. It typically\ncontains progress information and common metadata such as create time.\nSome services might not provide such metadata. Any method that returns a\nlong-running operation should document the metadata type, if any.", + "additionalProperties": { + "description": "Properties of the object. Contains field @type with type URL.", + "type": "any" + }, + "type": "object" + }, + "response": { + "description": "The normal response of the operation in case of success. If the original\nmethod returns no data on success, such as `Delete`, the response is\n`google.protobuf.Empty`. If the original method is standard\n`Get`/`Create`/`Update`, the response should be the resource. For other\nmethods, the response should have the type `XxxResponse`, where `Xxx`\nis the original method name. For example, if the original method name\nis `TakeSnapshot()`, the inferred response type is\n`TakeSnapshotResponse`.", + "additionalProperties": { + "description": "Properties of the object. Contains field @type with type URL.", + "type": "any" + }, + "type": "object" + }, + "name": { + "description": "The server-assigned name, which is only unique within the same service that\noriginally returns it. If you use the default HTTP mapping, the\n`name` should have the format of `operations/some/unique/name`.", + "type": "string" + } + }, + "id": "GoogleLongrunning__Operation" + }, + "GoogleCloudMlV1beta1__PredictRequest": { + "description": "Request for predictions to be issued against a trained model.\n\nThe body of the request is a single JSON object with a single top-level\nfield:\n\n\u003cdl\u003e\n \u003cdt\u003einstances\u003c/dt\u003e\n \u003cdd\u003eA JSON array containing values representing the instances to use for\n prediction.\u003c/dd\u003e\n\u003c/dl\u003e\n\nThe structure of each element of the instances list is determined by your\nmodel's input definition. Instances can include named inputs or can contain\nonly unlabeled values.\n\nMost data does not include named inputs. Some instances will be simple\nJSON values (boolean, number, or string). However, instances are often lists\nof simple values, or complex nested lists. Here are some examples of request\nbodies:\n\nCSV data with each row encoded as a string value:\n\u003cpre\u003e\n{\"instances\": [\"1.0,true,\\\\\"x\\\\\"\", \"-2.0,false,\\\\\"y\\\\\"\"]}\n\u003c/pre\u003e\nPlain text:\n\u003cpre\u003e\n{\"instances\": [\"the quick brown fox\", \"la bruja le dio\"]}\n\u003c/pre\u003e\nSentences encoded as lists of words (vectors of strings):\n\u003cpre\u003e\n{\"instances\": [[\"the\",\"quick\",\"brown\"], [\"la\",\"bruja\",\"le\"]]}\n\u003c/pre\u003e\nFloating point scalar values:\n\u003cpre\u003e\n{\"instances\": [0.0, 1.1, 2.2]}\n\u003c/pre\u003e\nVectors of integers:\n\u003cpre\u003e\n{\"instances\": [[0, 1, 2], [3, 4, 5],...]}\n\u003c/pre\u003e\nTensors (in this case, two-dimensional tensors):\n\u003cpre\u003e\n{\"instances\": [[[0, 1, 2], [3, 4, 5]], ...]}\n\u003c/pre\u003e\nImages represented as a three-dimensional list. In this encoding scheme the\nfirst two dimensions represent the rows and columns of the image, and the\nthird contains the R, G, and B values for each pixel.\n\u003cpre\u003e\n{\"instances\": [[[[138, 30, 66], [130, 20, 56], ...]]]]}\n\u003c/pre\u003e\nData must be encoded as UTF-8. If your data uses another character encoding,\nyou must base64 encode the data and mark it as binary. To mark a JSON string\nas binary, replace it with an object with a single attribute named `b`:\n\u003cpre\u003e{\"b\": \"...\"} \u003c/pre\u003e\nFor example:\n\nTwo Serialized tf.Examples (fake data, for illustrative purposes only):\n\u003cpre\u003e\n{\"instances\": [{\"b64\": \"X5ad6u\"}, {\"b64\": \"IA9j4nx\"}]}\n\u003c/pre\u003e\nTwo JPEG image byte strings (fake data, for illustrative purposes only):\n\u003cpre\u003e\n{\"instances\": [{\"b64\": \"ASa8asdf\"}, {\"b64\": \"JLK7ljk3\"}]}\n\u003c/pre\u003e\nIf your data includes named references, format each instance as a JSON object\nwith the named references as the keys:\n\nJSON input data to be preprocessed:\n\u003cpre\u003e\n{\"instances\": [{\"a\": 1.0, \"b\": true, \"c\": \"x\"},\n {\"a\": -2.0, \"b\": false, \"c\": \"y\"}]}\n\u003c/pre\u003e\nSome models have an underlying TensorFlow graph that accepts multiple input\ntensors. In this case, you should use the names of JSON name/value pairs to\nidentify the input tensors, as shown in the following exmaples:\n\nFor a graph with input tensor aliases \"tag\" (string) and \"image\"\n(base64-encoded string):\n\u003cpre\u003e\n{\"instances\": [{\"tag\": \"beach\", \"image\": {\"b64\": \"ASa8asdf\"}},\n {\"tag\": \"car\", \"image\": {\"b64\": \"JLK7ljk3\"}}]}\n\u003c/pre\u003e\nFor a graph with input tensor aliases \"tag\" (string) and \"image\"\n(3-dimensional array of 8-bit ints):\n\u003cpre\u003e\n{\"instances\": [{\"tag\": \"beach\", \"image\": [[[263, 1, 10], [262, 2, 11], ...]]},\n {\"tag\": \"car\", \"image\": [[[10, 11, 24], [23, 10, 15], ...]]}]}\n\u003c/pre\u003e\nIf the call is successful, the response body will contain one prediction\nentry per instance in the request body. If prediction fails for any\ninstance, the response body will contain no predictions and will contian\na single error entry instead.", + "type": "object", + "properties": { + "httpBody": { + "description": "\nRequired. The prediction request body.", + "$ref": "GoogleApi__HttpBody" + } + }, + "id": "GoogleCloudMlV1beta1__PredictRequest" + }, + "GoogleRpc__Status": { + "description": "The `Status` type defines a logical error model that is suitable for different\nprogramming environments, including REST APIs and RPC APIs. It is used by\n[gRPC](https://github.com/grpc). The error model is designed to be:\n\n- Simple to use and understand for most users\n- Flexible enough to meet unexpected needs\n\n# Overview\n\nThe `Status` message contains three pieces of data: error code, error message,\nand error details. The error code should be an enum value of\ngoogle.rpc.Code, but it may accept additional error codes if needed. The\nerror message should be a developer-facing English message that helps\ndevelopers *understand* and *resolve* the error. If a localized user-facing\nerror message is needed, put the localized message in the error details or\nlocalize it in the client. The optional error details may contain arbitrary\ninformation about the error. There is a predefined set of error detail types\nin the package `google.rpc` which can be used for common error conditions.\n\n# Language mapping\n\nThe `Status` message is the logical representation of the error model, but it\nis not necessarily the actual wire format. When the `Status` message is\nexposed in different client libraries and different wire protocols, it can be\nmapped differently. For example, it will likely be mapped to some exceptions\nin Java, but more likely mapped to some error codes in C.\n\n# Other uses\n\nThe error model and the `Status` message can be used in a variety of\nenvironments, either with or without APIs, to provide a\nconsistent developer experience across different environments.\n\nExample uses of this error model include:\n\n- Partial errors. If a service needs to return partial errors to the client,\n it may embed the `Status` in the normal response to indicate the partial\n errors.\n\n- Workflow errors. A typical workflow has multiple steps. Each step may\n have a `Status` message for error reporting purpose.\n\n- Batch operations. If a client uses batch request and batch response, the\n `Status` message should be used directly inside batch response, one for\n each error sub-response.\n\n- Asynchronous operations. If an API call embeds asynchronous operation\n results in its response, the status of those operations should be\n represented directly using the `Status` message.\n\n- Logging. If some API errors are stored in logs, the message `Status` could\n be used directly after any stripping needed for security/privacy reasons.", + "type": "object", + "properties": { + "code": { + "description": "The status code, which should be an enum value of google.rpc.Code.", + "type": "integer", + "format": "int32" + }, + "details": { + "description": "A list of messages that carry the error details. There will be a\ncommon set of message types for APIs to use.", + "type": "array", + "items": { + "additionalProperties": { + "description": "Properties of the object. Contains field @type with type URL.", + "type": "any" + }, + "type": "object" + } + }, + "message": { + "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\ngoogle.rpc.Status.details field, or localized by the client.", + "type": "string" + } + }, + "id": "GoogleRpc__Status" + }, + "GoogleCloudMlV1beta1__CancelJobRequest": { + "description": "Request message for the CancelJob method.", + "type": "object", + "properties": {}, + "id": "GoogleCloudMlV1beta1__CancelJobRequest" + }, + "GoogleCloudMlV1beta1__TrainingOutput": { + "description": "Represents results of a training job.", + "type": "object", + "properties": { + "consumedMlUnits": { + "description": "The amount of ML units consumed by the job.", + "type": "number", + "format": "double" + }, + "completedTrialCount": { + "description": "The number of hyperparameter tuning trials that completed successfully.", + "type": "string", + "format": "int64" + }, + "trials": { + "description": "Results for individual Hyperparameter trials.", + "type": "array", + "items": { + "$ref": "GoogleCloudMlV1beta1__HyperparameterOutput" + } + } + }, + "id": "GoogleCloudMlV1beta1__TrainingOutput" + }, + "GoogleLongrunning__ListOperationsResponse": { + "description": "The response message for Operations.ListOperations.", + "type": "object", + "properties": { + "nextPageToken": { + "description": "The standard List next-page token.", + "type": "string" + }, + "operations": { + "description": "A list of operations that matches the specified filter in the request.", + "type": "array", + "items": { + "$ref": "GoogleLongrunning__Operation" + } + } + }, + "id": "GoogleLongrunning__ListOperationsResponse" + }, + "GoogleCloudMlV1beta1__PredictionOutput": { + "description": "Represents results of a prediction job.", + "type": "object", + "properties": { + "errorCount": { + "description": "The number of data instances which resulted in errors.", + "type": "string", + "format": "int64" + }, + "predictionCount": { + "description": "The number of generated predictions.", + "type": "string", + "format": "int64" + }, + "outputPath": { + "description": "The output Google Cloud Storage location provided at the job creation time.", + "type": "string" + } + }, + "id": "GoogleCloudMlV1beta1__PredictionOutput" + }, + "GoogleCloudMlV1beta1__HyperparameterSpec": { + "description": "Represents a set of hyperparameters to optimize.", + "type": "object", + "properties": { + "maxParallelTrials": { + "description": "Optional. The number of training trials to run concurrently.\nYou can reduce the time it takes to perform hyperparameter tuning by adding\ntrials in parallel. However, each trail only benefits from the information\ngained in completed trials. That means that a trial does not get access to\nthe results of trials running at the same time, which could reduce the\nquality of the overall optimization.\n\nEach trial will use the same scale tier and machine types.\n\nDefaults to one.", + "type": "integer", + "format": "int32" + }, + "maxTrials": { + "description": "Optional. How many training trials should be attempted to optimize\nthe specified hyperparameters.\n\nDefaults to one.", + "type": "integer", + "format": "int32" + }, + "goal": { + "description": "Required. The type of goal to use for tuning. Available types are\n`MAXIMIZE` and `MINIMIZE`.\n\nDefaults to `MAXIMIZE`.", + "enum": [ + "GOAL_TYPE_UNSPECIFIED", + "MAXIMIZE", + "MINIMIZE" + ], + "enumDescriptions": [ + "Goal Type will default to maximize.", + "Maximize the goal metric.", + "Minimize the goal metric." + ], + "type": "string" + }, + "params": { + "description": "Required. The set of parameters to tune.", + "type": "array", + "items": { + "$ref": "GoogleCloudMlV1beta1__ParameterSpec" + } + } + }, + "id": "GoogleCloudMlV1beta1__HyperparameterSpec" + }, + "GoogleProtobuf__Empty": { + "description": "A generic empty message that you can re-use to avoid defining duplicated\nempty messages in your APIs. A typical example is to use it as the request\nor the response type of an API method. For instance:\n\n service Foo {\n rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);\n }\n\nThe JSON representation for `Empty` is empty JSON object `{}`.", + "type": "object", + "properties": {}, + "id": "GoogleProtobuf__Empty" + }, + "GoogleCloudMlV1beta1__PredictionInput": { + "description": "Represents input parameters for a prediction job.", + "type": "object", + "properties": { + "modelName": { + "description": "Use this field if you want to use the default version for the specified\nmodel. The string must use the following format:\n\n`\"projects/\u003cvar\u003e[YOUR_PROJECT]\u003c/var\u003e/models/\u003cvar\u003e[YOUR_MODEL]\u003c/var\u003e\"`", + "type": "string" + }, + "outputPath": { + "description": "Required. The output Google Cloud Storage location.", + "type": "string" + }, + "inputPaths": { + "description": "Required. The Google Cloud Storage location of the input data files.\nMay contain wildcards.", + "type": "array", + "items": { + "type": "string" + } + }, + "dataFormat": { + "description": "Required. The format of the input data files.", + "enum": [ + "DATA_FORMAT_UNSPECIFIED", + "TEXT", + "TF_RECORD", + "TF_RECORD_GZIP" + ], + "enumDescriptions": [ + "Unspecified format.", + "The source file is a text file with instances separated by the\nnew-line character.", + "The source file is a TFRecord file.", + "The source file is a GZIP-compressed TFRecord file." + ], + "type": "string" + }, + "maxWorkerCount": { + "description": "Optional. The maximum number of workers to be used for parallel processing.\nDefaults to 10 if not specified.", + "type": "string", + "format": "int64" + }, + "versionName": { + "description": "Use this field if you want to specify a version of the model to use. The\nstring is formatted the same way as `model_version`, with the addition\nof the version information:\n\n`\"projects/\u003cvar\u003e[YOUR_PROJECT]\u003c/var\u003e/models/\u003cvar\u003eYOUR_MODEL/versions/\u003cvar\u003e[YOUR_VERSION]\u003c/var\u003e\"`", + "type": "string" + }, + "region": { + "description": "Required. The Google Compute Engine region to run the prediction job in.", + "type": "string" + } + }, + "id": "GoogleCloudMlV1beta1__PredictionInput" + }, + "GoogleCloudMlV1beta1__ListJobsResponse": { + "description": "Response message for the ListJobs method.", + "type": "object", + "properties": { + "nextPageToken": { + "description": "Optional. Pass this token as the `page_token` field of the request for a\nsubsequent call.", + "type": "string" + }, + "jobs": { + "description": "The list of jobs.", + "type": "array", + "items": { + "$ref": "GoogleCloudMlV1beta1__Job" + } + } + }, + "id": "GoogleCloudMlV1beta1__ListJobsResponse" + }, + "GoogleCloudMlV1beta1__SetDefaultVersionRequest": { + "description": "Request message for the SetDefaultVersion request.", + "type": "object", + "properties": {}, + "id": "GoogleCloudMlV1beta1__SetDefaultVersionRequest" + }, + "GoogleCloudMlV1beta1__TrainingInput": { + "description": "Represents input parameters for a training job.", + "type": "object", + "properties": { + "args": { + "description": "Optional. Command line arguments to pass to the program.", + "type": "array", + "items": { + "type": "string" + } + }, + "workerType": { + "description": "Optional. Specifies the type of virtual machine to use for your training\njob's worker nodes.\n\nThe supported values are the same as those described in the entry for\n`masterType`.\n\nThis value must be present when `scaleTier` is set to `CUSTOM` and\n`workerCount` is greater than zero.", + "type": "string" + }, + "workerCount": { + "description": "Optional. The number of worker replicas to use for the training job. Each\nreplica in the cluster will be of the type specified in `worker_type`.\n\nThis value can only be used when `scale_tier` is set to `CUSTOM`. If you\nset this value, you must also set `worker_type`.", + "type": "string", + "format": "int64" + }, + "packageUris": { + "description": "Required. The Google Cloud Storage location of the packages with\nthe training program and any additional dependencies.", + "type": "array", + "items": { + "type": "string" + } + }, + "hyperparameters": { + "description": "Optional. The set of Hyperparameters to tune.", + "$ref": "GoogleCloudMlV1beta1__HyperparameterSpec" + }, + "masterType": { + "description": "Optional. Specifies the type of virtual machine to use for your training\njob's master worker.\n\nThe following types are supported:\n\n\u003cdl\u003e\n \u003cdt\u003estandard\u003c/dt\u003e\n \u003cdd\u003e\n A basic machine configuration suitable for training simple models with\n small to moderate datasets.\n \u003c/dd\u003e\n \u003cdt\u003elarge_model\u003c/dt\u003e\n \u003cdd\u003e\n A machine with a lot of memory, specially suited for parameter servers\n when your model is large (having many hidden layers or layers with very\n large numbers of nodes).\n \u003c/dd\u003e\n \u003cdt\u003ecomplex_model_s\u003c/dt\u003e\n \u003cdd\u003e\n A machine suitable for the master and workers of the cluster when your\n model requires more computation than the standard machine can handle\n satisfactorily.\n \u003c/dd\u003e\n \u003cdt\u003ecomplex_model_m\u003c/dt\u003e\n \u003cdd\u003e\n A machine with roughly twice the number of cores and roughly double the\n memory of \u003ccode suppresswarning=\"true\"\u003ecomplex_model_s\u003c/code\u003e.\n \u003c/dd\u003e\n \u003cdt\u003ecomplex_model_l\u003c/dt\u003e\n \u003cdd\u003e\n A machine with roughly twice the number of cores and roughly double the\n memory of \u003ccode suppresswarning=\"true\"\u003ecomplex_model_m\u003c/code\u003e.\n \u003c/dd\u003e\n\u003c/dl\u003e\n\nYou must set this value when `scaleTier` is set to `CUSTOM`.", + "type": "string" + }, + "parameterServerCount": { + "description": "Optional. The number of parameter server replicas to use for the training\njob. Each replica in the cluster will be of the type specified in\n`parameter_server_type`.\n\nThis value can only be used when `scale_tier` is set to `CUSTOM`.If you\nset this value, you must also set `parameter_server_type`.", + "type": "string", + "format": "int64" + }, + "region": { + "description": "Required. The Google Compute Engine region to run the training job in.", + "type": "string" + }, + "parameterServerType": { + "description": "Optional. Specifies the type of virtual machine to use for your training\njob's parameter server.\n\nThe supported values are the same as those described in the entry for\n`master_type`.\n\nThis value must be present when `scaleTier` is set to `CUSTOM` and\n`parameter_server_count` is greater than zero.", + "type": "string" + }, + "scaleTier": { + "description": "Required. Specifies the machine types, the number of replicas for workers\nand parameter servers.", + "enum": [ + "BASIC", + "STANDARD_1", + "PREMIUM_1", + "CUSTOM" + ], + "enumDescriptions": [ + "A single worker instance. This tier is suitable for learning how to use\nCloud ML, and for experimenting with new models using small datasets.", + "Many workers and a few parameter servers.", + "A large number of workers with many parameter servers.", + "The CUSTOM tier is not a set tier, but rather enables you to use your\nown cluster specification. When you use this tier, set values to\nconfigure your processing cluster according to these guidelines:\n\n* You _must_ set `TrainingInput.masterType` to specify the type\n of machine to use for your master node. This is the only required\n setting.\n\n* You _may_ set `TrainingInput.workerCount` to specify the number of\n workers to use. If you specify one or more workers, you _must_ also\n set `TrainingInput.workerType` to specify the type of machine to use\n for your worker nodes.\n\n* You _may_ set `TrainingInput.parameterServerCount` to specify the\n number of parameter servers to use. If you specify one or more\n parameter servers, you _must_ also set\n `TrainingInput.parameterServerType` to specify the type of machine to\n use for your parameter servers.\n\nNote that all of your workers must use the same machine type, which can\nbe different from your parameter server type and master type. Your\nparameter servers must likewise use the same machine type, which can be\ndifferent from your worker type and master type." + ], + "type": "string" + }, + "pythonModule": { + "description": "Required. The Python module name to run after installing the packages.", + "type": "string" + } + }, + "id": "GoogleCloudMlV1beta1__TrainingInput" + }, + "GoogleCloudMlV1beta1__Version": { + "description": "Represents a version of the model.\n\nEach version is a trained model deployed in the cloud, ready to handle\nprediction requests. A model can have multiple versions. You can get\ninformation about all of the versions of a given model by calling\n[projects.models.versions.list](/ml/reference/rest/v1beta1/projects.models.versions/list).", + "type": "object", + "properties": { + "description": { + "description": "Optional. The description specified for the version when it was created.", + "type": "string" + }, + "deploymentUri": { + "description": "Required. The Google Cloud Storage location of the trained model used to\ncreate the version. See the\n[overview of model deployment](/ml/docs/concepts/deployment-overview) for\nmore informaiton.\n\nWhen passing Version to\n[projects.models.versions.create](/ml/reference/rest/v1beta1/projects.models.versions/create)\nthe model service uses the specified location as the source of the model.\nOnce deployed, the model version is hosted by the prediction service, so\nthis location is useful only as a historical record.", + "type": "string" + }, + "createTime": { + "description": "Output only. The time the version was created.", + "type": "string", + "format": "google-datetime" + }, + "lastUseTime": { + "description": "Output only. The time the version was last used for prediction.", + "type": "string", + "format": "google-datetime" + }, + "name": { + "description": "Required.The name specified for the version when it was created.\n\nThe version name must be unique within the model it is created in.", + "type": "string" + }, + "isDefault": { + "description": "Output only. If true, this version will be used to handle prediction\nrequests that do not specify a version.\n\nYou can change the default version by calling\n[projects.methods.versions.setDefault](/ml/reference/rest/v1beta1/projects.models.versions/setDefault).", + "type": "boolean" + } + }, + "id": "GoogleCloudMlV1beta1__Version" + }, + "GoogleCloudMlV1beta1__ListModelsResponse": { + "description": "Response message for the ListModels method.", + "type": "object", + "properties": { + "models": { + "description": "The list of models.", + "type": "array", + "items": { + "$ref": "GoogleCloudMlV1beta1__Model" + } + }, + "nextPageToken": { + "description": "Optional. Pass this token as the `page_token` field of the request for a\nsubsequent call.", + "type": "string" + } + }, + "id": "GoogleCloudMlV1beta1__ListModelsResponse" + }, + "GoogleCloudMlV1beta1__OperationMetadata": { + "description": "Represents the metadata of the long-running operation.", + "type": "object", + "properties": { + "modelName": { + "description": "Contains the name of the model associated with the operation.", + "type": "string" + }, + "isCancellationRequested": { + "description": "Indicates whether a request to cancel this operation has been made.", + "type": "boolean" + }, + "endTime": { + "description": "The time operation processing completed.", + "type": "string", + "format": "google-datetime" + }, + "createTime": { + "description": "The time the operation was submitted.", + "type": "string", + "format": "google-datetime" + }, + "startTime": { + "description": "The time operation processing started.", + "type": "string", + "format": "google-datetime" + }, + "version": { + "description": "Contains the version associated with the operation.", + "$ref": "GoogleCloudMlV1beta1__Version" + }, + "operationType": { + "description": "The operation type.", + "enum": [ + "OPERATION_TYPE_UNSPECIFIED", + "CREATE_VERSION", + "DELETE_VERSION", + "DELETE_MODEL" + ], + "enumDescriptions": [ + "Unspecified operation type.", + "An operation to create a new version.", + "An operation to delete an existing version.", + "An operation to delete an existing model." + ], + "type": "string" + } + }, + "id": "GoogleCloudMlV1beta1__OperationMetadata" + }, + "GoogleCloudMlV1beta1__ParameterSpec": { + "description": "Represents a single hyperparameter to optimize.", + "type": "object", + "properties": { + "parameterName": { + "description": "Required. The parameter name must be unique amongst all ParameterConfigs in\na HyperparameterSpec message. E.g., \"learning_rate\".", + "type": "string" + }, + "maxValue": { + "description": "Required if typeis `DOUBLE` or `INTEGER`. This field\nshould be unset if type is `CATEGORICAL`. This value should be integers if\ntype is `INTEGER`.", + "type": "number", + "format": "double" + }, + "categoricalValues": { + "description": "Required if type is `CATEGORICAL`. The list of possible categories.", + "type": "array", + "items": { + "type": "string" + } + }, + "minValue": { + "description": "Required if type is `DOUBLE` or `INTEGER`. This field\nshould be unset if type is `CATEGORICAL`. This value should be integers if\ntype is INTEGER.", + "type": "number", + "format": "double" + }, + "scaleType": { + "description": "Optional. How the parameter should be scaled to the hypercube.\nLeave unset for categorical parameters.\nSome kind of scaling is strongly recommended for real or integral\nparameters (e.g., `UNIT_LINEAR_SCALE`).", + "enum": [ + "NONE", + "UNIT_LINEAR_SCALE", + "UNIT_LOG_SCALE", + "UNIT_REVERSE_LOG_SCALE" + ], + "enumDescriptions": [ + "By default, no scaling is applied.", + "Scales the feasible space to (0, 1) linearly.", + "Scales the feasible space logarithmically to (0, 1). The entire feasible\nspace must be strictly positive.", + "Scales the feasible space \"reverse\" logarithmically to (0, 1). The result\nis that values close to the top of the feasible space are spread out more\nthan points near the bottom. The entire feasible space must be strictly\npositive." + ], + "type": "string" + }, + "discreteValues": { + "description": "Required if type is `DISCRETE`.\nA list of feasible points.\nThe list should be in strictly increasing order. For instance, this\nparameter might have possible settings of 1.5, 2.5, and 4.0. This list\nshould not contain more than 1,000 values.", + "type": "array", + "items": { + "type": "number", + "format": "double" + } + }, + "type": { + "description": "Required. The type of the parameter.", + "enum": [ + "PARAMETER_TYPE_UNSPECIFIED", + "DOUBLE", + "INTEGER", + "CATEGORICAL", + "DISCRETE" + ], + "enumDescriptions": [ + "You must specify a valid type. Using this unspecified type will result in\nan error.", + "Type for real-valued parameters.", + "Type for integral parameters.", + "The parameter is categorical, with a value chosen from the categories\nfield.", + "The parameter is real valued, with a fixed set of feasible points. If\n`type==DISCRETE`, feasible_points must be provided, and\n{`min_value`, `max_value`} will be ignored." + ], + "type": "string" + } + }, + "id": "GoogleCloudMlV1beta1__ParameterSpec" + }, + "GoogleCloudMlV1beta1__Model": { + "description": "Represents a machine learning solution.\n\nA model can have multiple versions, each of which is a deployed, trained\nmodel ready to receive prediction requests. The model itself is just a\ncontainer.", + "type": "object", + "properties": { + "description": { + "description": "Optional. The description specified for the model when it was created.", + "type": "string" + }, + "defaultVersion": { + "description": "Output only. The default version of the model. This version will be used to\nhandle prediction requests that do not specify a version.\n\nYou can change the default version by calling\n[projects.methods.versions.setDefault](/ml/reference/rest/v1beta1/projects.models.versions/setDefault).", + "$ref": "GoogleCloudMlV1beta1__Version" + }, + "name": { + "description": "Required. The name specified for the model when it was created.\n\nThe model name must be unique within the project it is created in.", + "type": "string" + } + }, + "id": "GoogleCloudMlV1beta1__Model" + } + }, + "revision": "20161212", + "basePath": "", + "icons": { + "x32": "http://www.google.com/images/icons/product/search-32.gif", + "x16": "http://www.google.com/images/icons/product/search-16.gif" + }, + "version_module": "True", + "canonicalName": "Cloud Machine Learning", + "discoveryVersion": "v1", + "baseUrl": "https://ml.googleapis.com/", + "name": "ml", + "parameters": { + "access_token": { + "description": "OAuth access token.", + "type": "string", + "location": "query" + }, + "prettyPrint": { + "description": "Returns response with indentations and line breaks.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "key": { + "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", + "type": "string", + "location": "query" + }, + "quotaUser": { + "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.", + "type": "string", + "location": "query" + }, + "pp": { + "description": "Pretty-print response.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "fields": { + "description": "Selector specifying which fields to include in a partial response.", + "type": "string", + "location": "query" + }, + "alt": { + "description": "Data format for response.", + "location": "query", + "enum": [ + "json", + "media", + "proto" + ], + "default": "json", + "enumDescriptions": [ + "Responses with Content-Type of application/json", + "Media download with context-dependent Content-Type", + "Responses with Content-Type of application/x-protobuf" + ], + "type": "string" + }, + "$.xgafv": { + "description": "V1 error format.", + "enum": [ + "1", + "2" + ], + "enumDescriptions": [ + "v1 error format", + "v2 error format" + ], + "type": "string", + "location": "query" + }, + "callback": { + "description": "JSONP", + "type": "string", + "location": "query" + }, + "oauth_token": { + "description": "OAuth 2.0 token for the current user.", + "type": "string", + "location": "query" + }, + "uploadType": { + "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").", + "type": "string", + "location": "query" + }, + "bearer_token": { + "description": "OAuth bearer token.", + "type": "string", + "location": "query" + }, + "upload_protocol": { + "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").", + "type": "string", + "location": "query" + } + }, + "documentationLink": "https://cloud.google.com/ml/", + "ownerDomain": "google.com", + "batchPath": "batch", + "servicePath": "", + "ownerName": "Google", + "version": "v1beta1", + "rootUrl": "https://ml.googleapis.com/", + "kind": "discovery#restDescription" +} diff --git a/etc/api/monitoring/v3/monitoring-api.json b/etc/api/monitoring/v3/monitoring-api.json index fcedabcb3d..fac3839593 100644 --- a/etc/api/monitoring/v3/monitoring-api.json +++ b/etc/api/monitoring/v3/monitoring-api.json @@ -1,1517 +1,1628 @@ { - "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/xW_CLgXez5AZDCw5fhxCvxKwgIc\"", - "discoveryVersion": "v1", - "id": "monitoring:v3", - "name": "monitoring", - "version": "v3", - "revision": "20160425", - "title": "Google Monitoring API", - "description": "Manages your Stackdriver monitoring data and configurations. Projects must be associated with a Stackdriver account, except for the following methods: [monitoredResourceDescriptors.list](v3/projects.monitoredResourceDescriptors/list), [monitoredResourceDescriptors.get](v3/projects.monitoredResourceDescriptors/get), [metricDescriptors.list](v3/projects.metricDescriptors/list), [metricDescriptors.get](v3/projects.metricDescriptors/get), and [timeSeries.list](v3/projects.timeSeries/list).", - "ownerDomain": "google.com", - "ownerName": "Google", - "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" - }, - "documentationLink": "https://cloud.google.com/monitoring/api/", - "protocol": "rest", - "baseUrl": "https://monitoring.googleapis.com/", - "basePath": "", - "rootUrl": "https://monitoring.googleapis.com/", - "servicePath": "", - "batchPath": "batch", - "version_module": true, - "parameters": { - "access_token": { - "type": "string", - "description": "OAuth access token.", - "location": "query" - }, - "alt": { - "type": "string", - "description": "Data format for response.", - "default": "json", - "enumDescriptions": [ - "Responses with Content-Type of application/json", - "Media download with context-dependent Content-Type", - "Responses with Content-Type of application/x-protobuf" - ], - "location": "query" - }, - "bearer_token": { - "type": "string", - "description": "OAuth bearer token.", - "location": "query" - }, - "callback": { - "type": "string", - "description": "JSONP", - "location": "query" - }, - "fields": { - "type": "string", - "description": "Selector specifying which fields to include in a partial response.", - "location": "query" - }, - "key": { - "type": "string", - "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", - "location": "query" - }, - "oauth_token": { - "type": "string", - "description": "OAuth 2.0 token for the current user.", - "location": "query" - }, - "pp": { - "type": "boolean", - "description": "Pretty-print response.", - "default": "true", - "location": "query" - }, - "prettyPrint": { - "type": "boolean", - "description": "Returns response with indentations and line breaks.", - "default": "true", - "location": "query" - }, - "quotaUser": { - "type": "string", - "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.", - "location": "query" - }, - "upload_protocol": { - "type": "string", - "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").", - "location": "query" - }, - "uploadType": { - "type": "string", - "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").", - "location": "query" - }, - "$.xgafv": { - "type": "string", - "description": "V1 error format.", - "enumDescriptions": [ - "v1 error format", - "v2 error format" - ], - "location": "query" - } - }, - "auth": { - "oauth2": { - "scopes": { - "https://www.googleapis.com/auth/cloud-platform": { - "description": "View and manage your data across Google Cloud Platform services" - }, - "https://www.googleapis.com/auth/monitoring": { - "description": "View and write monitoring data for all of your Google and third-party Cloud and API projects" - }, - "https://www.googleapis.com/auth/monitoring.read": { - "description": "View monitoring data for all of your Google Cloud and third-party projects" - }, - "https://www.googleapis.com/auth/monitoring.write": { - "description": "Publish metric data to your Google Cloud projects" + "id": "monitoring:v3", + "auth": { + "oauth2": { + "scopes": { + "https://www.googleapis.com/auth/cloud-platform": { + "description": "View and manage your data across Google Cloud Platform services" + }, + "https://www.googleapis.com/auth/monitoring.read": { + "description": "View monitoring data for all of your Google Cloud and third-party projects" + }, + "https://www.googleapis.com/auth/monitoring.write": { + "description": "Publish metric data to your Google Cloud projects" + }, + "https://www.googleapis.com/auth/monitoring": { + "description": "View and write monitoring data for all of your Google and third-party Cloud and API projects" + } + } } - } - } - }, - "schemas": { - "CreateCollectdTimeSeriesRequest": { - "id": "CreateCollectdTimeSeriesRequest", - "type": "object", - "description": "The `CreateCollectdTimeSeries` request.", - "properties": { - "resource": { - "$ref": "MonitoredResource", - "description": "The monitored resource associated with the time series." - }, - "collectdVersion": { - "type": "string", - "description": "The version of `collectd` that collected the data. Example: `\"5.3.0-192.el6\"`." - }, - "collectdPayloads": { - "type": "array", - "description": "The `collectd` payloads representing the time series data. You must not include more than a single point for each time series, so no two payloads can have the same values for all of the fields `plugin`, `plugin_instance`, `type`, and `type_instance`.", - "items": { - "$ref": "CollectdPayload" - } - } - } }, - "MonitoredResource": { - "id": "MonitoredResource", - "type": "object", - "description": "An object representing a resource that can be used for monitoring, logging, billing, or other purposes. Examples include virtual machine instances, databases, and storage devices such as disks. The `type` field identifies a MonitoredResourceDescriptor object that describes the resource's schema. Information in the `labels` field identifies the actual resource and its attributes according to the schema. For example, a particular Compute Engine VM instance could be represented by the following object, because the MonitoredResourceDescriptor for `\"gce_instance\"` has labels `\"instance_id\"` and `\"zone\"`: { \"type\": \"gce_instance\", \"labels\": { \"instance_id\": \"my-instance\", \"zone\": \"us-central1-a\" }}", - "properties": { - "type": { - "type": "string", - "description": "Required. The monitored resource type. This field must match the `type` field of a MonitoredResourceDescriptor object. For example, the type of a Cloud SQL database is `\"cloudsql_database\"`." - }, - "labels": { - "type": "object", - "description": "Required. Values for all of the labels listed in the associated monitored resource descriptor. For example, Cloud SQL databases use the labels `\"database_id\"` and `\"zone\"`.", - "additionalProperties": { - "type": "string" - } + "description": "Manages your Stackdriver Monitoring data and configurations. Most projects must be associated with a Stackdriver account, with a few exceptions as noted on the individual method pages.", + "protocol": "rest", + "title": "Stackdriver Monitoring API", + "resources": { + "projects": { + "resources": { + "collectdTimeSeries": { + "methods": { + "create": { + "id": "monitoring.projects.collectdTimeSeries.create", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "name" + ], + "description": "Stackdriver Monitoring Agent only: Creates a new time series.\u003caside class=\"caution\"\u003eThis method is only for use by the Stackdriver Monitoring Agent. Use projects.timeSeries.create instead.\u003c/aside\u003e", + "request": { + "$ref": "CreateCollectdTimeSeriesRequest" + }, + "flatPath": "v3/projects/{projectsId}/collectdTimeSeries", + "httpMethod": "POST", + "parameters": { + "name": { + "description": "The project in which to create the time series. The format is \"projects/PROJECT_ID_OR_NUMBER\".", + "required": true, + "pattern": "^projects/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v3/{+name}/collectdTimeSeries", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/monitoring", + "https://www.googleapis.com/auth/monitoring.write" + ] + } + } + }, + "groups": { + "resources": { + "members": { + "methods": { + "list": { + "id": "monitoring.projects.groups.members.list", + "response": { + "$ref": "ListGroupMembersResponse" + }, + "parameterOrder": [ + "name" + ], + "description": "Lists the monitored resources that are members of a group.", + "flatPath": "v3/projects/{projectsId}/groups/{groupsId}/members", + "httpMethod": "GET", + "parameters": { + "filter": { + "description": "An optional list filter describing the members to be returned. The filter may reference the type, labels, and metadata of monitored resources that comprise the group. For example, to return only resources representing Compute Engine VM instances, use this filter:\nresource.type = \"gce_instance\"\n", + "location": "query", + "type": "string" + }, + "interval.endTime": { + "description": "Required. The end of the time interval.", + "location": "query", + "type": "string", + "format": "google-datetime" + }, + "interval.startTime": { + "description": "Optional. The beginning of the time interval. The default value for the start time is the end time. The start time must not be later than the end time.", + "location": "query", + "type": "string", + "format": "google-datetime" + }, + "pageSize": { + "description": "A positive number that is the maximum number of results to return.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "name": { + "description": "The group whose members are listed. The format is \"projects/{project_id_or_number}/groups/{group_id}\".", + "required": true, + "pattern": "^projects/[^/]+/groups/[^/]+$", + "location": "path", + "type": "string" + }, + "pageToken": { + "description": "If this field is not empty then it must contain the nextPageToken value returned by a previous call to this method. Using this field causes the method to return additional results from the previous method call.", + "location": "query", + "type": "string" + } + }, + "path": "v3/{+name}/members", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/monitoring", + "https://www.googleapis.com/auth/monitoring.read" + ] + } + } + } + }, + "methods": { + "update": { + "id": "monitoring.projects.groups.update", + "response": { + "$ref": "Group" + }, + "parameterOrder": [ + "name" + ], + "description": "Updates an existing group. You can change any group attributes except name.", + "request": { + "$ref": "Group" + }, + "flatPath": "v3/projects/{projectsId}/groups/{groupsId}", + "httpMethod": "PUT", + "parameters": { + "validateOnly": { + "description": "If true, validate this request but do not update the existing group.", + "location": "query", + "type": "boolean" + }, + "name": { + "description": "Output only. The name of this group. The format is \"projects/{project_id_or_number}/groups/{group_id}\". When creating a group, this field is ignored and a new name is created consisting of the project specified in the call to CreateGroup and a unique {group_id} that is generated automatically.", + "required": true, + "pattern": "^projects/[^/]+/groups/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v3/{+name}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/monitoring" + ] + }, + "get": { + "id": "monitoring.projects.groups.get", + "response": { + "$ref": "Group" + }, + "parameterOrder": [ + "name" + ], + "description": "Gets a single group.", + "flatPath": "v3/projects/{projectsId}/groups/{groupsId}", + "httpMethod": "GET", + "parameters": { + "name": { + "description": "The group to retrieve. The format is \"projects/{project_id_or_number}/groups/{group_id}\".", + "required": true, + "pattern": "^projects/[^/]+/groups/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v3/{+name}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/monitoring", + "https://www.googleapis.com/auth/monitoring.read" + ] + }, + "create": { + "id": "monitoring.projects.groups.create", + "response": { + "$ref": "Group" + }, + "parameterOrder": [ + "name" + ], + "description": "Creates a new group.", + "request": { + "$ref": "Group" + }, + "flatPath": "v3/projects/{projectsId}/groups", + "httpMethod": "POST", + "parameters": { + "validateOnly": { + "description": "If true, validate this request but do not create the group.", + "location": "query", + "type": "boolean" + }, + "name": { + "description": "The project in which to create the group. The format is \"projects/{project_id_or_number}\".", + "required": true, + "pattern": "^projects/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v3/{+name}/groups", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/monitoring" + ] + }, + "list": { + "id": "monitoring.projects.groups.list", + "response": { + "$ref": "ListGroupsResponse" + }, + "parameterOrder": [ + "name" + ], + "description": "Lists the existing groups.", + "flatPath": "v3/projects/{projectsId}/groups", + "httpMethod": "GET", + "parameters": { + "descendantsOfGroup": { + "description": "A group name: \"projects/{project_id_or_number}/groups/{group_id}\". Returns the descendants of the specified group. This is a superset of the results returned by the childrenOfGroup filter, and includes children-of-children, and so forth.", + "location": "query", + "type": "string" + }, + "pageSize": { + "description": "A positive number that is the maximum number of results to return.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "childrenOfGroup": { + "description": "A group name: \"projects/{project_id_or_number}/groups/{group_id}\". Returns groups whose parentName field contains the group name. If no groups have this parent, the results are empty.", + "location": "query", + "type": "string" + }, + "name": { + "description": "The project whose groups are to be listed. The format is \"projects/{project_id_or_number}\".", + "required": true, + "pattern": "^projects/[^/]+$", + "location": "path", + "type": "string" + }, + "ancestorsOfGroup": { + "description": "A group name: \"projects/{project_id_or_number}/groups/{group_id}\". Returns groups that are ancestors of the specified group. The groups are returned in order, starting with the immediate parent and ending with the most distant ancestor. If the specified group has no immediate parent, the results are empty.", + "location": "query", + "type": "string" + }, + "pageToken": { + "description": "If this field is not empty then it must contain the nextPageToken value returned by a previous call to this method. Using this field causes the method to return additional results from the previous method call.", + "location": "query", + "type": "string" + } + }, + "path": "v3/{+name}/groups", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/monitoring", + "https://www.googleapis.com/auth/monitoring.read" + ] + }, + "delete": { + "id": "monitoring.projects.groups.delete", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "name" + ], + "description": "Deletes an existing group.", + "flatPath": "v3/projects/{projectsId}/groups/{groupsId}", + "httpMethod": "DELETE", + "parameters": { + "name": { + "description": "The group to delete. The format is \"projects/{project_id_or_number}/groups/{group_id}\".", + "required": true, + "pattern": "^projects/[^/]+/groups/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v3/{+name}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/monitoring" + ] + } + } + }, + "metricDescriptors": { + "methods": { + "get": { + "id": "monitoring.projects.metricDescriptors.get", + "response": { + "$ref": "MetricDescriptor" + }, + "parameterOrder": [ + "name" + ], + "description": "Gets a single metric descriptor. This method does not require a Stackdriver account.", + "flatPath": "v3/projects/{projectsId}/metricDescriptors/{metricDescriptorsId}", + "httpMethod": "GET", + "parameters": { + "name": { + "description": "The metric descriptor on which to execute the request. The format is \"projects/{project_id_or_number}/metricDescriptors/{metric_id}\". An example value of {metric_id} is \"compute.googleapis.com/instance/disk/read_bytes_count\".", + "required": true, + "pattern": "^projects/[^/]+/metricDescriptors/.+$", + "location": "path", + "type": "string" + } + }, + "path": "v3/{+name}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/monitoring", + "https://www.googleapis.com/auth/monitoring.read", + "https://www.googleapis.com/auth/monitoring.write" + ] + }, + "create": { + "id": "monitoring.projects.metricDescriptors.create", + "response": { + "$ref": "MetricDescriptor" + }, + "parameterOrder": [ + "name" + ], + "description": "Creates a new metric descriptor. User-created metric descriptors define custom metrics.", + "request": { + "$ref": "MetricDescriptor" + }, + "flatPath": "v3/projects/{projectsId}/metricDescriptors", + "httpMethod": "POST", + "parameters": { + "name": { + "description": "The project on which to execute the request. The format is \"projects/{project_id_or_number}\".", + "required": true, + "pattern": "^projects/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v3/{+name}/metricDescriptors", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/monitoring", + "https://www.googleapis.com/auth/monitoring.write" + ] + }, + "list": { + "id": "monitoring.projects.metricDescriptors.list", + "response": { + "$ref": "ListMetricDescriptorsResponse" + }, + "parameterOrder": [ + "name" + ], + "description": "Lists metric descriptors that match a filter. This method does not require a Stackdriver account.", + "flatPath": "v3/projects/{projectsId}/metricDescriptors", + "httpMethod": "GET", + "parameters": { + "pageSize": { + "description": "A positive number that is the maximum number of results to return.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "filter": { + "description": "If this field is empty, all custom and system-defined metric descriptors are returned. Otherwise, the filter specifies which metric descriptors are to be returned. For example, the following filter matches all custom metrics:\nmetric.type = starts_with(\"custom.googleapis.com/\")\n", + "location": "query", + "type": "string" + }, + "name": { + "description": "The project on which to execute the request. The format is \"projects/{project_id_or_number}\".", + "required": true, + "pattern": "^projects/[^/]+$", + "location": "path", + "type": "string" + }, + "pageToken": { + "description": "If this field is not empty then it must contain the nextPageToken value returned by a previous call to this method. Using this field causes the method to return additional results from the previous method call.", + "location": "query", + "type": "string" + } + }, + "path": "v3/{+name}/metricDescriptors", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/monitoring", + "https://www.googleapis.com/auth/monitoring.read", + "https://www.googleapis.com/auth/monitoring.write" + ] + }, + "delete": { + "id": "monitoring.projects.metricDescriptors.delete", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "name" + ], + "description": "Deletes a metric descriptor. Only user-created custom metrics can be deleted.", + "flatPath": "v3/projects/{projectsId}/metricDescriptors/{metricDescriptorsId}", + "httpMethod": "DELETE", + "parameters": { + "name": { + "description": "The metric descriptor on which to execute the request. The format is \"projects/{project_id_or_number}/metricDescriptors/{metric_id}\". An example of {metric_id} is: \"custom.googleapis.com/my_test_metric\".", + "required": true, + "pattern": "^projects/[^/]+/metricDescriptors/.+$", + "location": "path", + "type": "string" + } + }, + "path": "v3/{+name}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/monitoring" + ] + } + } + }, + "timeSeries": { + "methods": { + "create": { + "id": "monitoring.projects.timeSeries.create", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "name" + ], + "description": "Creates or adds data to one or more time series. The response is empty if all time series in the request were written. If any time series could not be written, a corresponding failure message is included in the error response.", + "request": { + "$ref": "CreateTimeSeriesRequest" + }, + "flatPath": "v3/projects/{projectsId}/timeSeries", + "httpMethod": "POST", + "parameters": { + "name": { + "description": "The project on which to execute the request. The format is \"projects/{project_id_or_number}\".", + "required": true, + "pattern": "^projects/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v3/{+name}/timeSeries", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/monitoring", + "https://www.googleapis.com/auth/monitoring.write" + ] + }, + "list": { + "id": "monitoring.projects.timeSeries.list", + "response": { + "$ref": "ListTimeSeriesResponse" + }, + "parameterOrder": [ + "name" + ], + "description": "Lists time series that match a filter. This method does not require a Stackdriver account.", + "flatPath": "v3/projects/{projectsId}/timeSeries", + "httpMethod": "GET", + "parameters": { + "filter": { + "description": "A monitoring filter that specifies which time series should be returned. The filter must specify a single metric type, and can additionally specify metric labels and other information. For example:\nmetric.type = \"compute.googleapis.com/instance/cpu/usage_time\" AND\n metric.label.instance_name = \"my-instance-name\"\n", + "location": "query", + "type": "string" + }, + "aggregation.groupByFields": { + "description": "The set of fields to preserve when crossSeriesReducer is specified. The groupByFields determine how the time series are partitioned into subsets prior to applying the aggregation function. Each subset contains time series that have the same value for each of the grouping fields. Each individual time series is a member of exactly one subset. The crossSeriesReducer is applied to each subset of time series. It is not possible to reduce across different resource types, so this field implicitly contains resource.type. Fields not specified in groupByFields are aggregated away. If groupByFields is not specified and all the time series have the same resource type, then the time series are aggregated into a single output time series. If crossSeriesReducer is not defined, this field is ignored.", + "repeated": true, + "location": "query", + "type": "string" + }, + "aggregation.crossSeriesReducer": { + "description": "The approach to be used to combine time series. Not all reducer functions may be applied to all time series, depending on the metric type and the value type of the original time series. Reduction may change the metric type of value type of the time series.Time series data must be aligned in order to perform cross-time series reduction. If crossSeriesReducer is specified, then perSeriesAligner must be specified and not equal ALIGN_NONE and alignmentPeriod must be specified; otherwise, an error is returned.", + "enum": [ + "REDUCE_NONE", + "REDUCE_MEAN", + "REDUCE_MIN", + "REDUCE_MAX", + "REDUCE_SUM", + "REDUCE_STDDEV", + "REDUCE_COUNT", + "REDUCE_COUNT_TRUE", + "REDUCE_FRACTION_TRUE", + "REDUCE_PERCENTILE_99", + "REDUCE_PERCENTILE_95", + "REDUCE_PERCENTILE_50", + "REDUCE_PERCENTILE_05" + ], + "location": "query", + "type": "string" + }, + "interval.endTime": { + "description": "Required. The end of the time interval.", + "location": "query", + "type": "string", + "format": "google-datetime" + }, + "interval.startTime": { + "description": "Optional. The beginning of the time interval. The default value for the start time is the end time. The start time must not be later than the end time.", + "location": "query", + "type": "string", + "format": "google-datetime" + }, + "pageSize": { + "description": "A positive number that is the maximum number of results to return. When view field sets to FULL, it limits the number of Points server will return; if view field is HEADERS, it limits the number of TimeSeries server will return.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "view": { + "description": "Specifies which information is returned about the time series.", + "enum": [ + "FULL", + "HEADERS" + ], + "location": "query", + "type": "string" + }, + "name": { + "description": "The project on which to execute the request. The format is \"projects/{project_id_or_number}\".", + "required": true, + "pattern": "^projects/[^/]+$", + "location": "path", + "type": "string" + }, + "aggregation.alignmentPeriod": { + "description": "The alignment period for per-time series alignment. If present, alignmentPeriod must be at least 60 seconds. After per-time series alignment, each time series will contain data points only on the period boundaries. If perSeriesAligner is not specified or equals ALIGN_NONE, then this field is ignored. If perSeriesAligner is specified and does not equal ALIGN_NONE, then this field must be defined; otherwise an error is returned.", + "location": "query", + "type": "string", + "format": "google-duration" + }, + "aggregation.perSeriesAligner": { + "description": "The approach to be used to align individual time series. Not all alignment functions may be applied to all time series, depending on the metric type and value type of the original time series. Alignment may change the metric type or the value type of the time series.Time series data must be aligned in order to perform cross-time series reduction. If crossSeriesReducer is specified, then perSeriesAligner must be specified and not equal ALIGN_NONE and alignmentPeriod must be specified; otherwise, an error is returned.", + "enum": [ + "ALIGN_NONE", + "ALIGN_DELTA", + "ALIGN_RATE", + "ALIGN_INTERPOLATE", + "ALIGN_NEXT_OLDER", + "ALIGN_MIN", + "ALIGN_MAX", + "ALIGN_MEAN", + "ALIGN_COUNT", + "ALIGN_SUM", + "ALIGN_STDDEV", + "ALIGN_COUNT_TRUE", + "ALIGN_FRACTION_TRUE", + "ALIGN_PERCENTILE_99", + "ALIGN_PERCENTILE_95", + "ALIGN_PERCENTILE_50", + "ALIGN_PERCENTILE_05" + ], + "location": "query", + "type": "string" + }, + "orderBy": { + "description": "Specifies the order in which the points of the time series should be returned. By default, results are not ordered. Currently, this field must be left blank.", + "location": "query", + "type": "string" + }, + "pageToken": { + "description": "If this field is not empty then it must contain the nextPageToken value returned by a previous call to this method. Using this field causes the method to return additional results from the previous method call.", + "location": "query", + "type": "string" + } + }, + "path": "v3/{+name}/timeSeries", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/monitoring", + "https://www.googleapis.com/auth/monitoring.read" + ] + } + } + }, + "monitoredResourceDescriptors": { + "methods": { + "get": { + "id": "monitoring.projects.monitoredResourceDescriptors.get", + "response": { + "$ref": "MonitoredResourceDescriptor" + }, + "parameterOrder": [ + "name" + ], + "description": "Gets a single monitored resource descriptor. This method does not require a Stackdriver account.", + "flatPath": "v3/projects/{projectsId}/monitoredResourceDescriptors/{monitoredResourceDescriptorsId}", + "httpMethod": "GET", + "parameters": { + "name": { + "description": "The monitored resource descriptor to get. The format is \"projects/{project_id_or_number}/monitoredResourceDescriptors/{resource_type}\". The {resource_type} is a predefined type, such as cloudsql_database.", + "required": true, + "pattern": "^projects/[^/]+/monitoredResourceDescriptors/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v3/{+name}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/monitoring", + "https://www.googleapis.com/auth/monitoring.read", + "https://www.googleapis.com/auth/monitoring.write" + ] + }, + "list": { + "id": "monitoring.projects.monitoredResourceDescriptors.list", + "response": { + "$ref": "ListMonitoredResourceDescriptorsResponse" + }, + "parameterOrder": [ + "name" + ], + "description": "Lists monitored resource descriptors that match a filter. This method does not require a Stackdriver account.", + "flatPath": "v3/projects/{projectsId}/monitoredResourceDescriptors", + "httpMethod": "GET", + "parameters": { + "pageSize": { + "description": "A positive number that is the maximum number of results to return.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "filter": { + "description": "An optional filter describing the descriptors to be returned. The filter can reference the descriptor's type and labels. For example, the following filter returns only Google Compute Engine descriptors that have an id label:\nresource.type = starts_with(\"gce_\") AND resource.label:id\n", + "location": "query", + "type": "string" + }, + "name": { + "description": "The project on which to execute the request. The format is \"projects/{project_id_or_number}\".", + "required": true, + "pattern": "^projects/[^/]+$", + "location": "path", + "type": "string" + }, + "pageToken": { + "description": "If this field is not empty then it must contain the nextPageToken value returned by a previous call to this method. Using this field causes the method to return additional results from the previous method call.", + "location": "query", + "type": "string" + } + }, + "path": "v3/{+name}/monitoredResourceDescriptors", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/monitoring", + "https://www.googleapis.com/auth/monitoring.read", + "https://www.googleapis.com/auth/monitoring.write" + ] + } + } + } + } } - } }, - "CollectdPayload": { - "id": "CollectdPayload", - "type": "object", - "description": "A collection of data points sent from a `collectd`-based plugin. See the `collectd` documentation for more information.", - "properties": { - "values": { - "type": "array", - "description": "The measured values during this time interval. Each value must have a different `dataSourceName`.", - "items": { - "$ref": "CollectdValue" - } + "schemas": { + "Metric": { + "description": "A specific metric, identified by specifying values for all of the labels of a MetricDescriptor.", + "type": "object", + "properties": { + "labels": { + "description": "The set of label values that uniquely identify this metric. All labels listed in the MetricDescriptor must be assigned values.", + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + "type": { + "description": "An existing metric type, see google.api.MetricDescriptor. For example, custom.googleapis.com/invoice/paid/amount.", + "type": "string" + } + }, + "id": "Metric" }, - "startTime": { - "type": "string", - "description": "The start time of the interval." + "ListGroupMembersResponse": { + "description": "The ListGroupMembers response.", + "type": "object", + "properties": { + "members": { + "description": "A set of monitored resources in the group.", + "type": "array", + "items": { + "$ref": "MonitoredResource" + } + }, + "nextPageToken": { + "description": "If there are more results than have been returned, then this field is set to a non-empty value. To see the additional results, use that value as pageToken in the next call to this method.", + "type": "string" + }, + "totalSize": { + "description": "The total number of elements matching this request.", + "type": "integer", + "format": "int32" + } + }, + "id": "ListGroupMembersResponse" }, - "endTime": { - "type": "string", - "description": "The end time of the interval." + "TimeInterval": { + "description": "A time interval extending just after a start time through an end time. If the start time is the same as the end time, then the interval represents a single point in time.", + "type": "object", + "properties": { + "endTime": { + "description": "Required. The end of the time interval.", + "type": "string", + "format": "google-datetime" + }, + "startTime": { + "description": "Optional. The beginning of the time interval. The default value for the start time is the end time. The start time must not be later than the end time.", + "type": "string", + "format": "google-datetime" + } + }, + "id": "TimeInterval" }, - "plugin": { - "type": "string", - "description": "The name of the plugin. Example: `\"disk\"`." + "Group": { + "description": "The description of a dynamic collection of monitored resources. Each group has a filter that is matched against monitored resources and their associated metadata. If a group's filter matches an available monitored resource, then that resource is a member of that group. Groups can contain any number of monitored resources, and each monitored resource can be a member of any number of groups.Groups can be nested in parent-child hierarchies. The parentName field identifies an optional parent for each group. If a group has a parent, then the only monitored resources available to be matched by the group's filter are the resources contained in the parent group. In other words, a group contains the monitored resources that match its filter and the filters of all the group's ancestors. A group without a parent can contain any monitored resource.For example, consider an infrastructure running a set of instances with two user-defined tags: \"environment\" and \"role\". A parent group has a filter, environment=\"production\". A child of that parent group has a filter, role=\"transcoder\". The parent group contains all instances in the production environment, regardless of their roles. The child group contains instances that have the transcoder role and are in the production environment.The monitored resources contained in a group can change at any moment, depending on what resources exist and what filters are associated with the group and its ancestors.", + "type": "object", + "properties": { + "displayName": { + "description": "A user-assigned name for this group, used only for display purposes.", + "type": "string" + }, + "parentName": { + "description": "The name of the group's parent, if it has one. The format is \"projects/{project_id_or_number}/groups/{group_id}\". For groups with no parent, parentName is the empty string, \"\".", + "type": "string" + }, + "isCluster": { + "description": "If true, the members of this group are considered to be a cluster. The system can perform additional analysis on groups that are clusters.", + "type": "boolean" + }, + "filter": { + "description": "The filter used to determine which monitored resources belong to this group.", + "type": "string" + }, + "name": { + "description": "Output only. The name of this group. The format is \"projects/{project_id_or_number}/groups/{group_id}\". When creating a group, this field is ignored and a new name is created consisting of the project specified in the call to CreateGroup and a unique {group_id} that is generated automatically.", + "type": "string" + } + }, + "id": "Group" }, - "pluginInstance": { - "type": "string", - "description": "The instance name of the plugin Example: `\"hdcl\"`." + "ListTimeSeriesResponse": { + "description": "The ListTimeSeries response.", + "type": "object", + "properties": { + "timeSeries": { + "description": "One or more time series that match the filter included in the request.", + "type": "array", + "items": { + "$ref": "TimeSeries" + } + }, + "nextPageToken": { + "description": "If there are more results than have been returned, then this field is set to a non-empty value. To see the additional results, use that value as pageToken in the next call to this method.", + "type": "string" + } + }, + "id": "ListTimeSeriesResponse" }, - "type": { - "type": "string", - "description": "The measurement type. Example: `\"memory\"`." + "Point": { + "description": "A single data point in a time series.", + "type": "object", + "properties": { + "value": { + "description": "The value of the data point.", + "$ref": "TypedValue" + }, + "interval": { + "description": "The time interval to which the data point applies. For GAUGE metrics, only the end time of the interval is used. For DELTA metrics, the start and end time should specify a non-zero interval, with subsequent points specifying contiguous and non-overlapping intervals. For CUMULATIVE metrics, the start and end time should specify a non-zero interval, with subsequent points specifying the same start time and increasing end times, until an event resets the cumulative value to zero and sets a new start time for the following points.", + "$ref": "TimeInterval" + } + }, + "id": "Point" }, - "typeInstance": { - "type": "string", - "description": "The measurement type instance. Example: `\"used\"`." + "CollectdValue": { + "description": "A single data point from a collectd-based plugin.", + "type": "object", + "properties": { + "value": { + "description": "The measurement value.", + "$ref": "TypedValue" + }, + "dataSourceName": { + "description": "The data source for the collectd value. For example there are two data sources for network measurements: \"rx\" and \"tx\".", + "type": "string" + }, + "dataSourceType": { + "description": "The type of measurement.", + "enum": [ + "UNSPECIFIED_DATA_SOURCE_TYPE", + "GAUGE", + "COUNTER", + "DERIVE", + "ABSOLUTE" + ], + "enumDescriptions": [ + "An unspecified data source type. This corresponds to google.api.MetricDescriptor.MetricKind.METRIC_KIND_UNSPECIFIED.", + "An instantaneous measurement of a varying quantity. This corresponds to google.api.MetricDescriptor.MetricKind.GAUGE.", + "A cumulative value over time. This corresponds to google.api.MetricDescriptor.MetricKind.CUMULATIVE.", + "A rate of change of the measurement.", + "An amount of change since the last measurement interval. This corresponds to google.api.MetricDescriptor.MetricKind.DELTA." + ], + "type": "string" + } + }, + "id": "CollectdValue" }, - "metadata": { - "type": "object", - "description": "The measurement metadata. Example: `\"process_id\" -\u003e 12345`", - "additionalProperties": { - "$ref": "TypedValue" - } + "TimeSeries": { + "description": "A collection of data points that describes the time-varying values of a metric. A time series is identified by a combination of a fully-specified monitored resource and a fully-specified metric. This type is used for both listing and creating time series.", + "type": "object", + "properties": { + "metric": { + "description": "The associated metric. A fully-specified metric used to identify the time series.", + "$ref": "Metric" + }, + "points": { + "description": "The data points of this time series. When listing time series, the order of the points is specified by the list method.When creating a time series, this field must contain exactly one point and the point's type must be the same as the value type of the associated metric. If the associated metric's descriptor must be auto-created, then the value type of the descriptor is determined by the point's type, which must be BOOL, INT64, DOUBLE, or DISTRIBUTION.", + "type": "array", + "items": { + "$ref": "Point" + } + }, + "valueType": { + "description": "The value type of the time series. When listing time series, this value type might be different from the value type of the associated metric if this time series is an alignment or reduction of other time series.When creating a time series, this field is optional. If present, it must be the same as the type of the data in the points field.", + "enum": [ + "VALUE_TYPE_UNSPECIFIED", + "BOOL", + "INT64", + "DOUBLE", + "STRING", + "DISTRIBUTION", + "MONEY" + ], + "enumDescriptions": [ + "Do not use this default value.", + "The value is a boolean. This value type can be used only if the metric kind is GAUGE.", + "The value is a signed 64-bit integer.", + "The value is a double precision floating point number.", + "The value is a text string. This value type can be used only if the metric kind is GAUGE.", + "The value is a Distribution.", + "The value is money." + ], + "type": "string" + }, + "resource": { + "description": "The associated resource. A fully-specified monitored resource used to identify the time series.", + "$ref": "MonitoredResource" + }, + "metricKind": { + "description": "The metric kind of the time series. When listing time series, this metric kind might be different from the metric kind of the associated metric if this time series is an alignment or reduction of other time series.When creating a time series, this field is optional. If present, it must be the same as the metric kind of the associated metric. If the associated metric's descriptor must be auto-created, then this field specifies the metric kind of the new descriptor and must be either GAUGE (the default) or CUMULATIVE.", + "enum": [ + "METRIC_KIND_UNSPECIFIED", + "GAUGE", + "DELTA", + "CUMULATIVE" + ], + "enumDescriptions": [ + "Do not use this default value.", + "An instantaneous measurement of a value.", + "The change in a value during a time interval.", + "A value accumulated over a time interval. Cumulative measurements in a time series should have the same start time and increasing end times, until an event resets the cumulative value to zero and sets a new start time for the following points." + ], + "type": "string" + } + }, + "id": "TimeSeries" + }, + "MetricDescriptor": { + "description": "Defines a metric type and its schema. Once a metric descriptor is created, deleting or altering it stops data collection and makes the metric type's existing data unusable.", + "type": "object", + "properties": { + "description": { + "description": "A detailed description of the metric, which can be used in documentation.", + "type": "string" + }, + "unit": { + "description": "The unit in which the metric value is reported. It is only applicable if the value_type is INT64, DOUBLE, or DISTRIBUTION. The supported units are a subset of The Unified Code for Units of Measure (http://unitsofmeasure.org/ucum.html) standard:Basic units (UNIT)\nbit bit\nBy byte\ns second\nmin minute\nh hour\nd dayPrefixes (PREFIX)\nk kilo (10**3)\nM mega (10**6)\nG giga (10**9)\nT tera (10**12)\nP peta (10**15)\nE exa (10**18)\nZ zetta (10**21)\nY yotta (10**24)\nm milli (10**-3)\nu micro (10**-6)\nn nano (10**-9)\np pico (10**-12)\nf femto (10**-15)\na atto (10**-18)\nz zepto (10**-21)\ny yocto (10**-24)\nKi kibi (2**10)\nMi mebi (2**20)\nGi gibi (2**30)\nTi tebi (2**40)GrammarThe grammar includes the dimensionless unit 1, such as 1/s.The grammar also includes these connectors:\n/ division (as an infix operator, e.g. 1/s).\n. multiplication (as an infix operator, e.g. GBy.d)The grammar for a unit is as follows:\nExpression = Component { \".\" Component } { \"/\" Component } ;\n\nComponent = [ PREFIX ] UNIT [ Annotation ]\n | Annotation\n | \"1\"\n ;\n\nAnnotation = \"{\" NAME \"}\" ;\nNotes:\nAnnotation is just a comment if it follows a UNIT and is equivalent to 1 if it is used alone. For examples, {requests}/s == 1/s, By{transmitted}/s == By/s.\nNAME is a sequence of non-blank printable ASCII characters not containing '{' or '}'.", + "type": "string" + }, + "labels": { + "description": "The set of labels that can be used to describe a specific instance of this metric type. For example, the appengine.googleapis.com/http/server/response_latencies metric type has a label for the HTTP response code, response_code, so you can look at latencies for successful responses or just for responses that failed.", + "type": "array", + "items": { + "$ref": "LabelDescriptor" + } + }, + "metricKind": { + "description": "Whether the metric records instantaneous values, changes to a value, etc. Some combinations of metric_kind and value_type might not be supported.", + "enum": [ + "METRIC_KIND_UNSPECIFIED", + "GAUGE", + "DELTA", + "CUMULATIVE" + ], + "enumDescriptions": [ + "Do not use this default value.", + "An instantaneous measurement of a value.", + "The change in a value during a time interval.", + "A value accumulated over a time interval. Cumulative measurements in a time series should have the same start time and increasing end times, until an event resets the cumulative value to zero and sets a new start time for the following points." + ], + "type": "string" + }, + "valueType": { + "description": "Whether the measurement is an integer, a floating-point number, etc. Some combinations of metric_kind and value_type might not be supported.", + "enum": [ + "VALUE_TYPE_UNSPECIFIED", + "BOOL", + "INT64", + "DOUBLE", + "STRING", + "DISTRIBUTION", + "MONEY" + ], + "enumDescriptions": [ + "Do not use this default value.", + "The value is a boolean. This value type can be used only if the metric kind is GAUGE.", + "The value is a signed 64-bit integer.", + "The value is a double precision floating point number.", + "The value is a text string. This value type can be used only if the metric kind is GAUGE.", + "The value is a Distribution.", + "The value is money." + ], + "type": "string" + }, + "displayName": { + "description": "A concise name for the metric, which can be displayed in user interfaces. Use sentence case without an ending period, for example \"Request count\".", + "type": "string" + }, + "name": { + "description": "The resource name of the metric descriptor. Depending on the implementation, the name typically includes: (1) the parent resource name that defines the scope of the metric type or of its data; and (2) the metric's URL-encoded type, which also appears in the type field of this descriptor. For example, following is the resource name of a custom metric within the GCP project 123456789:\n\"projects/123456789/metricDescriptors/custom.googleapis.com%2Finvoice%2Fpaid%2Famount\"\n", + "type": "string" + }, + "type": { + "description": "The metric type, including its DNS name prefix. The type is not URL-encoded. All user-defined metric types have the DNS name custom.googleapis.com. Metric types should use a natural hierarchical grouping. For example:\n\"custom.googleapis.com/invoice/paid/amount\"\n\"appengine.googleapis.com/http/server/response_latencies\"\n", + "type": "string" + } + }, + "id": "MetricDescriptor" + }, + "Exponential": { + "description": "Specify a sequence of buckets that have a width that is proportional to the value of the lower bound. Each bucket represents a constant relative uncertainty on a specific value in the bucket.Defines num_finite_buckets + 2 (= N) buckets with these boundaries for bucket i:Upper bound (0 \u003c= i \u003c N-1): scale * (growth_factor ^ i). Lower bound (1 \u003c= i \u003c N): scale * (growth_factor ^ (i - 1)).", + "type": "object", + "properties": { + "growthFactor": { + "description": "Must be greater than 1.", + "type": "number", + "format": "double" + }, + "scale": { + "description": "Must be greater than 0.", + "type": "number", + "format": "double" + }, + "numFiniteBuckets": { + "description": "Must be greater than 0.", + "type": "integer", + "format": "int32" + } + }, + "id": "Exponential" + }, + "Explicit": { + "description": "A set of buckets with arbitrary widths.Defines size(bounds) + 1 (= N) buckets with these boundaries for bucket i:Upper bound (0 \u003c= i \u003c N-1): boundsi Lower bound (1 \u003c= i \u003c N); boundsi - 1There must be at least one element in bounds. If bounds has only one element, there are no finite buckets, and that single element is the common boundary of the overflow and underflow buckets.", + "type": "object", + "properties": { + "bounds": { + "description": "The values must be monotonically increasing.", + "type": "array", + "items": { + "type": "number", + "format": "double" + } + } + }, + "id": "Explicit" + }, + "Linear": { + "description": "Specify a sequence of buckets that all have the same width (except overflow and underflow). Each bucket represents a constant absolute uncertainty on the specific value in the bucket.Defines num_finite_buckets + 2 (= N) buckets with these boundaries for bucket i:Upper bound (0 \u003c= i \u003c N-1): offset + (width * i). Lower bound (1 \u003c= i \u003c N): offset + (width * (i - 1)).", + "type": "object", + "properties": { + "width": { + "description": "Must be greater than 0.", + "type": "number", + "format": "double" + }, + "offset": { + "description": "Lower bound of the first bucket.", + "type": "number", + "format": "double" + }, + "numFiniteBuckets": { + "description": "Must be greater than 0.", + "type": "integer", + "format": "int32" + } + }, + "id": "Linear" + }, + "CollectdPayload": { + "description": "A collection of data points sent from a collectd-based plugin. See the collectd documentation for more information.", + "type": "object", + "properties": { + "endTime": { + "description": "The end time of the interval.", + "type": "string", + "format": "google-datetime" + }, + "metadata": { + "description": "The measurement metadata. Example: \"process_id\" -\u003e 12345", + "additionalProperties": { + "$ref": "TypedValue" + }, + "type": "object" + }, + "values": { + "description": "The measured values during this time interval. Each value must have a different dataSourceName.", + "type": "array", + "items": { + "$ref": "CollectdValue" + } + }, + "pluginInstance": { + "description": "The instance name of the plugin Example: \"hdcl\".", + "type": "string" + }, + "startTime": { + "description": "The start time of the interval.", + "type": "string", + "format": "google-datetime" + }, + "typeInstance": { + "description": "The measurement type instance. Example: \"used\".", + "type": "string" + }, + "type": { + "description": "The measurement type. Example: \"memory\".", + "type": "string" + }, + "plugin": { + "description": "The name of the plugin. Example: \"disk\".", + "type": "string" + } + }, + "id": "CollectdPayload" + }, + "ListMetricDescriptorsResponse": { + "description": "The ListMetricDescriptors response.", + "type": "object", + "properties": { + "metricDescriptors": { + "description": "The metric descriptors that are available to the project and that match the value of filter, if present.", + "type": "array", + "items": { + "$ref": "MetricDescriptor" + } + }, + "nextPageToken": { + "description": "If there are more results than have been returned, then this field is set to a non-empty value. To see the additional results, use that value as pageToken in the next call to this method.", + "type": "string" + } + }, + "id": "ListMetricDescriptorsResponse" + }, + "Distribution": { + "description": "Distribution contains summary statistics for a population of values and, optionally, a histogram representing the distribution of those values across a specified set of histogram buckets.The summary statistics are the count, mean, sum of the squared deviation from the mean, the minimum, and the maximum of the set of population of values.The histogram is based on a sequence of buckets and gives a count of values that fall into each bucket. The boundaries of the buckets are given either explicitly or by specifying parameters for a method of computing them (buckets of fixed width or buckets of exponentially increasing width).Although it is not forbidden, it is generally a bad idea to include non-finite values (infinities or NaNs) in the population of values, as this will render the mean and sum_of_squared_deviation fields meaningless.", + "type": "object", + "properties": { + "bucketCounts": { + "description": "If bucket_options is given, then the sum of the values in bucket_counts must equal the value in count. If bucket_options is not given, no bucket_counts fields may be given.Bucket counts are given in order under the numbering scheme described above (the underflow bucket has number 0; the finite buckets, if any, have numbers 1 through N-2; the overflow bucket has number N-1).The size of bucket_counts must be no greater than N as defined in bucket_options.Any suffix of trailing zero bucket_count fields may be omitted.", + "type": "array", + "items": { + "type": "string", + "format": "int64" + } + }, + "bucketOptions": { + "description": "Defines the histogram bucket boundaries.", + "$ref": "BucketOptions" + }, + "count": { + "description": "The number of values in the population. Must be non-negative.", + "type": "string", + "format": "int64" + }, + "sumOfSquaredDeviation": { + "description": "The sum of squared deviations from the mean of the values in the population. For values x_i this is:\nSum[i=1..n]((x_i - mean)^2)\nKnuth, \"The Art of Computer Programming\", Vol. 2, page 323, 3rd edition describes Welford's method for accumulating this sum in one pass.If count is zero then this field must be zero.", + "type": "number", + "format": "double" + }, + "mean": { + "description": "The arithmetic mean of the values in the population. If count is zero then this field must be zero.", + "type": "number", + "format": "double" + }, + "range": { + "description": "If specified, contains the range of the population values. The field must not be present if the count is zero. This field is presently ignored by the Stackdriver Monitoring API v3.", + "$ref": "Range" + } + }, + "id": "Distribution" + }, + "MonitoredResource": { + "description": "An object representing a resource that can be used for monitoring, logging, billing, or other purposes. Examples include virtual machine instances, databases, and storage devices such as disks. The type field identifies a MonitoredResourceDescriptor object that describes the resource's schema. Information in the labels field identifies the actual resource and its attributes according to the schema. For example, a particular Compute Engine VM instance could be represented by the following object, because the MonitoredResourceDescriptor for \"gce_instance\" has labels \"instance_id\" and \"zone\":\n{ \"type\": \"gce_instance\",\n \"labels\": { \"instance_id\": \"12345678901234\",\n \"zone\": \"us-central1-a\" }}\n", + "type": "object", + "properties": { + "labels": { + "description": "Required. Values for all of the labels listed in the associated monitored resource descriptor. For example, Cloud SQL databases use the labels \"database_id\" and \"zone\".", + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + "type": { + "description": "Required. The monitored resource type. This field must match the type field of a MonitoredResourceDescriptor object. For example, the type of a Cloud SQL database is \"cloudsql_database\".", + "type": "string" + } + }, + "id": "MonitoredResource" + }, + "LabelDescriptor": { + "description": "A description of a label.", + "type": "object", + "properties": { + "description": { + "description": "A human-readable description for the label.", + "type": "string" + }, + "valueType": { + "description": "The type of data that can be assigned to the label.", + "enum": [ + "STRING", + "BOOL", + "INT64" + ], + "enumDescriptions": [ + "A variable-length string. This is the default.", + "Boolean; true or false.", + "A 64-bit signed integer." + ], + "type": "string" + }, + "key": { + "description": "The label key.", + "type": "string" + } + }, + "id": "LabelDescriptor" + }, + "MonitoredResourceDescriptor": { + "description": "An object that describes the schema of a MonitoredResource object using a type name and a set of labels. For example, the monitored resource descriptor for Google Compute Engine VM instances has a type of \"gce_instance\" and specifies the use of the labels \"instance_id\" and \"zone\" to identify particular VM instances.Different APIs can support different monitored resource types. APIs generally provide a list method that returns the monitored resource descriptors used by the API.", + "type": "object", + "properties": { + "displayName": { + "description": "Optional. A concise name for the monitored resource type that might be displayed in user interfaces. It should be a Title Cased Noun Phrase, without any article or other determiners. For example, \"Google Cloud SQL Database\".", + "type": "string" + }, + "description": { + "description": "Optional. A detailed description of the monitored resource type that might be used in documentation.", + "type": "string" + }, + "labels": { + "description": "Required. A set of labels used to describe instances of this monitored resource type. For example, an individual Google Cloud SQL database is identified by values for the labels \"database_id\" and \"zone\".", + "type": "array", + "items": { + "$ref": "LabelDescriptor" + } + }, + "type": { + "description": "Required. The monitored resource type. For example, the type \"cloudsql_database\" represents databases in Google Cloud SQL. The maximum length of this value is 256 characters.", + "type": "string" + }, + "name": { + "description": "Optional. The resource name of the monitored resource descriptor: \"projects/{project_id}/monitoredResourceDescriptors/{type}\" where {type} is the value of the type field in this object and {project_id} is a project ID that provides API-specific context for accessing the type. APIs that do not use project information can use the resource name format \"monitoredResourceDescriptors/{type}\".", + "type": "string" + } + }, + "id": "MonitoredResourceDescriptor" + }, + "TypedValue": { + "description": "A single strongly-typed value.", + "type": "object", + "properties": { + "boolValue": { + "description": "A Boolean value: true or false.", + "type": "boolean" + }, + "stringValue": { + "description": "A variable-length string value.", + "type": "string" + }, + "int64Value": { + "description": "A 64-bit integer. Its range is approximately ±9.2x10\u003csup\u003e18\u003c/sup\u003e.", + "type": "string", + "format": "int64" + }, + "doubleValue": { + "description": "A 64-bit double-precision floating-point number. Its magnitude is approximately ±10\u003csup\u003e±300\u003c/sup\u003e and it has 16 significant digits of precision.", + "type": "number", + "format": "double" + }, + "distributionValue": { + "description": "A distribution value.", + "$ref": "Distribution" + } + }, + "id": "TypedValue" + }, + "ListMonitoredResourceDescriptorsResponse": { + "description": "The ListMonitoredResourcDescriptors response.", + "type": "object", + "properties": { + "nextPageToken": { + "description": "If there are more results than have been returned, then this field is set to a non-empty value. To see the additional results, use that value as pageToken in the next call to this method.", + "type": "string" + }, + "resourceDescriptors": { + "description": "The monitored resource descriptors that are available to this project and that match filter, if present.", + "type": "array", + "items": { + "$ref": "MonitoredResourceDescriptor" + } + } + }, + "id": "ListMonitoredResourceDescriptorsResponse" + }, + "Field": { + "description": "A single field of a message type.", + "type": "object", + "properties": { + "defaultValue": { + "description": "The string value of the default value of this field. Proto2 syntax only.", + "type": "string" + }, + "jsonName": { + "description": "The field JSON name.", + "type": "string" + }, + "options": { + "description": "The protocol buffer options.", + "type": "array", + "items": { + "$ref": "Option" + } + }, + "oneofIndex": { + "description": "The index of the field type in Type.oneofs, for message or enumeration types. The first type has index 1; zero means the type is not in the list.", + "type": "integer", + "format": "int32" + }, + "cardinality": { + "description": "The field cardinality.", + "enum": [ + "CARDINALITY_UNKNOWN", + "CARDINALITY_OPTIONAL", + "CARDINALITY_REQUIRED", + "CARDINALITY_REPEATED" + ], + "enumDescriptions": [ + "For fields with unknown cardinality.", + "For optional fields.", + "For required fields. Proto2 syntax only.", + "For repeated fields." + ], + "type": "string" + }, + "typeUrl": { + "description": "The field type URL, without the scheme, for message or enumeration types. Example: \"type.googleapis.com/google.protobuf.Timestamp\".", + "type": "string" + }, + "name": { + "description": "The field name.", + "type": "string" + }, + "packed": { + "description": "Whether to use alternative packed wire representation.", + "type": "boolean" + }, + "number": { + "description": "The field number.", + "type": "integer", + "format": "int32" + }, + "kind": { + "description": "The field type.", + "enum": [ + "TYPE_UNKNOWN", + "TYPE_DOUBLE", + "TYPE_FLOAT", + "TYPE_INT64", + "TYPE_UINT64", + "TYPE_INT32", + "TYPE_FIXED64", + "TYPE_FIXED32", + "TYPE_BOOL", + "TYPE_STRING", + "TYPE_GROUP", + "TYPE_MESSAGE", + "TYPE_BYTES", + "TYPE_UINT32", + "TYPE_ENUM", + "TYPE_SFIXED32", + "TYPE_SFIXED64", + "TYPE_SINT32", + "TYPE_SINT64" + ], + "enumDescriptions": [ + "Field type unknown.", + "Field type double.", + "Field type float.", + "Field type int64.", + "Field type uint64.", + "Field type int32.", + "Field type fixed64.", + "Field type fixed32.", + "Field type bool.", + "Field type string.", + "Field type group. Proto2 syntax only, and deprecated.", + "Field type message.", + "Field type bytes.", + "Field type uint32.", + "Field type enum.", + "Field type sfixed32.", + "Field type sfixed64.", + "Field type sint32.", + "Field type sint64." + ], + "type": "string" + } + }, + "id": "Field" + }, + "Option": { + "description": "A protocol buffer option, which can be attached to a message, field, enumeration, etc.", + "type": "object", + "properties": { + "value": { + "description": "The option's value packed in an Any message. If the value is a primitive, the corresponding wrapper type defined in google/protobuf/wrappers.proto should be used. If the value is an enum, it should be stored as an int32 value using the google.protobuf.Int32Value type.", + "additionalProperties": { + "description": "Properties of the object. Contains field @type with type URL.", + "type": "any" + }, + "type": "object" + }, + "name": { + "description": "The option's name. For protobuf built-in options (options defined in descriptor.proto), this is the short name. For example, \"map_entry\". For custom options, it should be the fully-qualified name. For example, \"google.api.http\".", + "type": "string" + } + }, + "id": "Option" + }, + "Empty": { + "description": "A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance:\nservice Foo {\n rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);\n}\nThe JSON representation for Empty is empty JSON object {}.", + "type": "object", + "properties": {}, + "id": "Empty" + }, + "SourceContext": { + "description": "SourceContext represents information about the source of a protobuf element, like the file in which it is defined.", + "type": "object", + "properties": { + "fileName": { + "description": "The path-qualified name of the .proto file that contained the associated protobuf element. For example: \"google/protobuf/source_context.proto\".", + "type": "string" + } + }, + "id": "SourceContext" + }, + "Range": { + "description": "The range of the population values.", + "type": "object", + "properties": { + "max": { + "description": "The maximum of the population values.", + "type": "number", + "format": "double" + }, + "min": { + "description": "The minimum of the population values.", + "type": "number", + "format": "double" + } + }, + "id": "Range" + }, + "CreateTimeSeriesRequest": { + "description": "The CreateTimeSeries request.", + "type": "object", + "properties": { + "timeSeries": { + "description": "The new data to be added to a list of time series. Adds at most one data point to each of several time series. The new data point must be more recent than any other point in its time series. Each TimeSeries value must fully specify a unique time series by supplying all label values for the metric and the monitored resource.", + "type": "array", + "items": { + "$ref": "TimeSeries" + } + } + }, + "id": "CreateTimeSeriesRequest" + }, + "BucketOptions": { + "description": "A Distribution may optionally contain a histogram of the values in the population. The histogram is given in bucket_counts as counts of values that fall into one of a sequence of non-overlapping buckets. The sequence of buckets is described by bucket_options.A bucket specifies an inclusive lower bound and exclusive upper bound for the values that are counted for that bucket. The upper bound of a bucket is strictly greater than the lower bound.The sequence of N buckets for a Distribution consists of an underflow bucket (number 0), zero or more finite buckets (number 1 through N - 2) and an overflow bucket (number N - 1). The buckets are contiguous: the lower bound of bucket i (i \u003e 0) is the same as the upper bound of bucket i - 1. The buckets span the whole range of finite values: lower bound of the underflow bucket is -infinity and the upper bound of the overflow bucket is +infinity. The finite buckets are so-called because both bounds are finite.BucketOptions describes bucket boundaries in one of three ways. Two describe the boundaries by giving parameters for a formula to generate boundaries and one gives the bucket boundaries explicitly.If bucket_options is not given, then no bucket_counts may be given.", + "type": "object", + "properties": { + "explicitBuckets": { + "description": "The explicit buckets.", + "$ref": "Explicit" + }, + "exponentialBuckets": { + "description": "The exponential buckets.", + "$ref": "Exponential" + }, + "linearBuckets": { + "description": "The linear bucket.", + "$ref": "Linear" + } + }, + "id": "BucketOptions" + }, + "CreateCollectdTimeSeriesRequest": { + "description": "The CreateCollectdTimeSeries request.", + "type": "object", + "properties": { + "collectdPayloads": { + "description": "The collectd payloads representing the time series data. You must not include more than a single point for each time series, so no two payloads can have the same values for all of the fields plugin, plugin_instance, type, and type_instance.", + "type": "array", + "items": { + "$ref": "CollectdPayload" + } + }, + "collectdVersion": { + "description": "The version of collectd that collected the data. Example: \"5.3.0-192.el6\".", + "type": "string" + }, + "resource": { + "description": "The monitored resource associated with the time series.", + "$ref": "MonitoredResource" + } + }, + "id": "CreateCollectdTimeSeriesRequest" + }, + "Type": { + "description": "A protocol buffer message type.", + "type": "object", + "properties": { + "oneofs": { + "description": "The list of types appearing in oneof definitions in this type.", + "type": "array", + "items": { + "type": "string" + } + }, + "options": { + "description": "The protocol buffer options.", + "type": "array", + "items": { + "$ref": "Option" + } + }, + "sourceContext": { + "description": "The source context.", + "$ref": "SourceContext" + }, + "fields": { + "description": "The list of fields.", + "type": "array", + "items": { + "$ref": "Field" + } + }, + "name": { + "description": "The fully qualified message name.", + "type": "string" + }, + "syntax": { + "description": "The source syntax.", + "enum": [ + "SYNTAX_PROTO2", + "SYNTAX_PROTO3" + ], + "enumDescriptions": [ + "Syntax proto2.", + "Syntax proto3." + ], + "type": "string" + } + }, + "id": "Type" + }, + "ListGroupsResponse": { + "description": "The ListGroups response.", + "type": "object", + "properties": { + "group": { + "description": "The groups that match the specified filters.", + "type": "array", + "items": { + "$ref": "Group" + } + }, + "nextPageToken": { + "description": "If there are more results than have been returned, then this field is set to a non-empty value. To see the additional results, use that value as pageToken in the next call to this method.", + "type": "string" + } + }, + "id": "ListGroupsResponse" } - } }, - "CollectdValue": { - "id": "CollectdValue", - "type": "object", - "description": "A single data point from a `collectd`-based plugin.", - "properties": { - "dataSourceName": { - "type": "string", - "description": "The data source for the `collectd` value. For example there are two data sources for network measurements: `\"rx\"` and `\"tx\"`." - }, - "dataSourceType": { - "type": "string", - "description": "The type of measurement.", - "enum": [ - "UNSPECIFIED_DATA_SOURCE_TYPE", - "GAUGE", - "COUNTER", - "DERIVE", - "ABSOLUTE" - ] - }, - "value": { - "$ref": "TypedValue", - "description": "The measurement value." - } - } + "revision": "20161212", + "basePath": "", + "icons": { + "x32": "http://www.google.com/images/icons/product/search-32.gif", + "x16": "http://www.google.com/images/icons/product/search-16.gif" }, - "TypedValue": { - "id": "TypedValue", - "type": "object", - "description": "A single strongly-typed value.", - "properties": { - "boolValue": { - "type": "boolean", - "description": "A Boolean value: `true` or `false`." - }, - "int64Value": { - "type": "string", - "description": "A 64-bit integer. Its range is approximately ±9.2x1018.", - "format": "int64" - }, - "doubleValue": { - "type": "number", - "description": "A 64-bit double-precision floating-point number. Its magnitude is approximately ±10±300 and it has 16 significant digits of precision.", - "format": "double" - }, - "stringValue": { - "type": "string", - "description": "A variable-length string value." - }, - "distributionValue": { - "$ref": "Distribution", - "description": "A distribution value." - } - } - }, - "Distribution": { - "id": "Distribution", - "type": "object", - "description": "Distribution contains summary statistics for a population of values and, optionally, a histogram representing the distribution of those values across a specified set of histogram buckets. The summary statistics are the count, mean, sum of the squared deviation from the mean, the minimum, and the maximum of the set of population of values. The histogram is based on a sequence of buckets and gives a count of values that fall into each bucket. The boundaries of the buckets are given either explicitly or by specifying parameters for a method of computing them (buckets of fixed width or buckets of exponentially increasing width). Although it is not forbidden, it is generally a bad idea to include non-finite values (infinities or NaNs) in the population of values, as this will render the `mean` and `sum_of_squared_deviation` fields meaningless.", - "properties": { - "count": { - "type": "string", - "description": "The number of values in the population. Must be non-negative.", - "format": "int64" - }, - "mean": { - "type": "number", - "description": "The arithmetic mean of the values in the population. If `count` is zero then this field must be zero.", - "format": "double" - }, - "sumOfSquaredDeviation": { - "type": "number", - "description": "The sum of squared deviations from the mean of the values in the population. For values x_i this is: Sum[i=1..n]((x_i - mean)^2) Knuth, \"The Art of Computer Programming\", Vol. 2, page 323, 3rd edition describes Welford's method for accumulating this sum in one pass. If `count` is zero then this field must be zero.", - "format": "double" - }, - "range": { - "$ref": "Range", - "description": "If specified, contains the range of the population values. The field must not be present if the `count` is zero." - }, - "bucketOptions": { - "$ref": "BucketOptions", - "description": "Defines the histogram bucket boundaries." - }, - "bucketCounts": { - "type": "array", - "description": "If `bucket_options` is given, then the sum of the values in `bucket_counts` must equal the value in `count`. If `bucket_options` is not given, no `bucket_counts` fields may be given. Bucket counts are given in order under the numbering scheme described above (the underflow bucket has number 0; the finite buckets, if any, have numbers 1 through N-2; the overflow bucket has number N-1). The size of `bucket_counts` must be no greater than N as defined in `bucket_options`. Any suffix of trailing zero bucket_count fields may be omitted.", - "items": { + "version_module": "True", + "canonicalName": "Monitoring", + "discoveryVersion": "v1", + "baseUrl": "https://monitoring.googleapis.com/", + "name": "monitoring", + "parameters": { + "access_token": { + "description": "OAuth access token.", "type": "string", - "format": "int64" - } - } - } - }, - "Range": { - "id": "Range", - "type": "object", - "description": "The range of the population values.", - "properties": { - "min": { - "type": "number", - "description": "The minimum of the population values.", - "format": "double" + "location": "query" }, - "max": { - "type": "number", - "description": "The maximum of the population values.", - "format": "double" - } - } - }, - "BucketOptions": { - "id": "BucketOptions", - "type": "object", - "description": "A Distribution may optionally contain a histogram of the values in the population. The histogram is given in `bucket_counts` as counts of values that fall into one of a sequence of non-overlapping buckets. The sequence of buckets is described by `bucket_options`. A bucket specifies an inclusive lower bound and exclusive upper bound for the values that are counted for that bucket. The upper bound of a bucket is strictly greater than the lower bound. The sequence of N buckets for a Distribution consists of an underflow bucket (number 0), zero or more finite buckets (number 1 through N - 2) and an overflow bucket (number N - 1). The buckets are contiguous: the lower bound of bucket i (i \u003e 0) is the same as the upper bound of bucket i - 1. The buckets span the whole range of finite values: lower bound of the underflow bucket is -infinity and the upper bound of the overflow bucket is +infinity. The finite buckets are so-called because both bounds are finite. `BucketOptions` describes bucket boundaries in one of three ways. Two describe the boundaries by giving parameters for a formula to generate boundaries and one gives the bucket boundaries explicitly. If `bucket_boundaries` is not given, then no `bucket_counts` may be given.", - "properties": { - "linearBuckets": { - "$ref": "Linear", - "description": "The linear bucket." + "prettyPrint": { + "description": "Returns response with indentations and line breaks.", + "default": "true", + "type": "boolean", + "location": "query" }, - "exponentialBuckets": { - "$ref": "Exponential", - "description": "The exponential buckets." - }, - "explicitBuckets": { - "$ref": "Explicit", - "description": "The explicit buckets." - } - } - }, - "Linear": { - "id": "Linear", - "type": "object", - "description": "Specify a sequence of buckets that all have the same width (except overflow and underflow). Each bucket represents a constant absolute uncertainty on the specific value in the bucket. Defines `num_finite_buckets + 2` (= N) buckets with these boundaries for bucket `i`: Upper bound (0 \u003c= i \u003c N-1): offset + (width * i). Lower bound (1 \u003c= i \u003c N): offset + (width * (i - 1)).", - "properties": { - "numFiniteBuckets": { - "type": "integer", - "description": "Must be greater than 0.", - "format": "int32" - }, - "width": { - "type": "number", - "description": "Must be greater than 0.", - "format": "double" - }, - "offset": { - "type": "number", - "description": "Lower bound of the first bucket.", - "format": "double" - } - } - }, - "Exponential": { - "id": "Exponential", - "type": "object", - "description": "Specify a sequence of buckets that have a width that is proportional to the value of the lower bound. Each bucket represents a constant relative uncertainty on a specific value in the bucket. Defines `num_finite_buckets + 2` (= N) buckets with these boundaries for bucket i: Upper bound (0 \u003c= i \u003c N-1): scale * (growth_factor ^ i). Lower bound (1 \u003c= i \u003c N): scale * (growth_factor ^ (i - 1)).", - "properties": { - "numFiniteBuckets": { - "type": "integer", - "description": "must be greater than 0", - "format": "int32" - }, - "growthFactor": { - "type": "number", - "description": "Must be greater than 1", - "format": "double" - }, - "scale": { - "type": "number", - "description": "Must be greater than 0", - "format": "double" - } - } - }, - "Explicit": { - "id": "Explicit", - "type": "object", - "description": "A set of buckets with arbitrary widths. Defines `size(bounds) + 1` (= N) buckets with these boundaries for bucket i: Upper bound (0 \u003c= i \u003c N-1): bounds[i] Lower bound (1 \u003c= i \u003c N); bounds[i - 1] There must be at least one element in `bounds`. If `bounds` has only one element, there are no finite buckets, and that single element is the common boundary of the overflow and underflow buckets.", - "properties": { - "bounds": { - "type": "array", - "description": "The values must be monotonically increasing.", - "items": { - "type": "number", - "format": "double" - } - } - } - }, - "Empty": { - "id": "Empty", - "type": "object", - "description": "A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON representation for `Empty` is empty JSON object `{}`." - }, - "ListGroupsResponse": { - "id": "ListGroupsResponse", - "type": "object", - "description": "The `ListGroups` response.", - "properties": { - "group": { - "type": "array", - "description": "The groups that match the specified filters.", - "items": { - "$ref": "Group" - } - }, - "nextPageToken": { - "type": "string", - "description": "If there are more results than have been returned, then this field is set to a non-empty value. To see the additional results, use that value as `pageToken` in the next call to this method." - } - } - }, - "Group": { - "id": "Group", - "type": "object", - "description": "The description of a dynamic collection of monitored resources. Each group has a filter that is matched against monitored resources and their associated metadata. If a group's filter matches an available monitored resource, then that resource is a member of that group. Groups can contain any number of monitored resources, and each monitored resource can be a member of any number of groups. Groups can be nested in parent-child hierarchies. The `parentName` field identifies an optional parent for each group. If a group has a parent, then the only monitored resources available to be matched by the group's filter are the resources contained in the parent group. In other words, a group contains the monitored resources that match its filter and the filters of all the group's ancestors. A group without a parent can contain any monitored resource. For example, consider an infrastructure running a set of instances with two user-defined tags: `\"environment\"` and `\"role\"`. A parent group has a filter, `environment=\"production\"`. A child of that parent group has a filter, `role=\"transcoder\"`. The parent group contains all instances in the production environment, regardless of their roles. The child group contains instances that have the transcoder role *and* are in the production environment. The monitored resources contained in a group can change at any moment, depending on what resources exist and what filters are associated with the group and its ancestors.", - "properties": { - "name": { - "type": "string", - "description": "The name of this group. The format is `\"projects/{project_id_or_number}/groups/{group_id}\"`. When creating a group, this field is ignored and a new name is created consisting of the project specified in the call to `CreateGroup` and a unique `{group_id}` that is generated automatically. @OutputOnly" - }, - "displayName": { - "type": "string", - "description": "A user-assigned name for this group, used only for display purposes." - }, - "parentName": { - "type": "string", - "description": "The name of the group's parent, if it has one. The format is `\"projects/{project_id_or_number}/groups/{group_id}\"`. For groups with no parent, `parentName` is the empty string, `\"\"`." - }, - "filter": { - "type": "string", - "description": "The filter used to determine which monitored resources belong to this group." - }, - "isCluster": { - "type": "boolean", - "description": "If true, the members of this group are considered to be a cluster. The system can perform additional analysis on groups that are clusters." - } - } - }, - "ListGroupMembersResponse": { - "id": "ListGroupMembersResponse", - "type": "object", - "description": "The `ListGroupMembers` response.", - "properties": { - "members": { - "type": "array", - "description": "A set of monitored resources in the group.", - "items": { - "$ref": "MonitoredResource" - } - }, - "nextPageToken": { - "type": "string", - "description": "If there are more results than have been returned, then this field is set to a non-empty value. To see the additional results, use that value as `pageToken` in the next call to this method." - }, - "totalSize": { - "type": "integer", - "description": "The total number of elements matching this request.", - "format": "int32" - } - } - }, - "ListMonitoredResourceDescriptorsResponse": { - "id": "ListMonitoredResourceDescriptorsResponse", - "type": "object", - "description": "The `ListMonitoredResourcDescriptors` response.", - "properties": { - "resourceDescriptors": { - "type": "array", - "description": "The monitored resource descriptors that are available to this project and that match `filter`, if present.", - "items": { - "$ref": "MonitoredResourceDescriptor" - } - }, - "nextPageToken": { - "type": "string", - "description": "If there are more results than have been returned, then this field is set to a non-empty value. To see the additional results, use that value as `pageToken` in the next call to this method." - } - } - }, - "MonitoredResourceDescriptor": { - "id": "MonitoredResourceDescriptor", - "type": "object", - "description": "An object that describes the schema of a MonitoredResource object using a type name and a set of labels. For example, the monitored resource descriptor for Google Compute Engine VM instances has a type of `\"gce_instance\"` and specifies the use of the labels `\"instance_id\"` and `\"zone\"` to identify particular VM instances. Different APIs can support different monitored resource types. APIs generally provide a `list` method that returns the monitored resource descriptors used by the API.", - "properties": { - "name": { - "type": "string", - "description": "Optional. The resource name of the monitored resource descriptor: `\"projects/{project_id}/monitoredResourceDescriptors/{type}\"` where {type} is the value of the `type` field in this object and {project_id} is a project ID that provides API-specific context for accessing the type. APIs that do not use project information can use the resource name format `\"monitoredResourceDescriptors/{type}\"`." - }, - "type": { - "type": "string", - "description": "Required. The monitored resource type. For example, the type `\"cloudsql_database\"` represents databases in Google Cloud SQL." - }, - "displayName": { - "type": "string", - "description": "Optional. A concise name for the monitored resource type that might be displayed in user interfaces. For example, `\"Google Cloud SQL Database\"`." - }, - "description": { - "type": "string", - "description": "Optional. A detailed description of the monitored resource type that might be used in documentation." - }, - "labels": { - "type": "array", - "description": "Required. A set of labels used to describe instances of this monitored resource type. For example, an individual Google Cloud SQL database is identified by values for the labels `\"database_id\"` and `\"zone\"`.", - "items": { - "$ref": "LabelDescriptor" - } - } - } - }, - "LabelDescriptor": { - "id": "LabelDescriptor", - "type": "object", - "description": "A description of a label.", - "properties": { "key": { - "type": "string", - "description": "The label key." + "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", + "type": "string", + "location": "query" }, - "valueType": { - "type": "string", - "description": "The type of data that can be assigned to the label.", - "enum": [ - "STRING", - "BOOL", - "INT64" - ] + "quotaUser": { + "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.", + "type": "string", + "location": "query" }, - "description": { - "type": "string", - "description": "A human-readable description for the label." - } - } - }, - "ListMetricDescriptorsResponse": { - "id": "ListMetricDescriptorsResponse", - "type": "object", - "description": "The `ListMetricDescriptors` response.", - "properties": { - "metricDescriptors": { - "type": "array", - "description": "The metric descriptors that are available to the project and that match the value of `filter`, if present.", - "items": { - "$ref": "MetricDescriptor" - } - }, - "nextPageToken": { - "type": "string", - "description": "If there are more results than have been returned, then this field is set to a non-empty value. To see the additional results, use that value as `pageToken` in the next call to this method." - } - } - }, - "MetricDescriptor": { - "id": "MetricDescriptor", - "type": "object", - "description": "Defines a metric type and its schema.", - "properties": { - "name": { - "type": "string", - "description": "Resource name. The format of the name may vary between different implementations. For examples: projects/{project_id}/metricDescriptors/{type=**} metricDescriptors/{type=**}" - }, - "type": { - "type": "string", - "description": "The metric type including a DNS name prefix, for example `\"compute.googleapis.com/instance/cpu/utilization\"`. Metric types should use a natural hierarchical grouping such as the following: compute.googleapis.com/instance/cpu/utilization compute.googleapis.com/instance/disk/read_ops_count compute.googleapis.com/instance/network/received_bytes_count Note that if the metric type changes, the monitoring data will be discontinued, and anything depends on it will break, such as monitoring dashboards, alerting rules and quota limits. Therefore, once a metric has been published, its type should be immutable." - }, - "labels": { - "type": "array", - "description": "The set of labels that can be used to describe a specific instance of this metric type. For example, the `compute.googleapis.com/instance/network/received_bytes_count` metric type has a label, `loadbalanced`, that specifies whether the traffic was received through a load balanced IP address.", - "items": { - "$ref": "LabelDescriptor" - } - }, - "metricKind": { - "type": "string", - "description": "Whether the metric records instantaneous values, changes to a value, etc.", - "enum": [ - "METRIC_KIND_UNSPECIFIED", - "GAUGE", - "DELTA", - "CUMULATIVE" - ] - }, - "valueType": { - "type": "string", - "description": "Whether the measurement is an integer, a floating-point number, etc.", - "enum": [ - "VALUE_TYPE_UNSPECIFIED", - "BOOL", - "INT64", - "DOUBLE", - "STRING", - "DISTRIBUTION", - "MONEY" - ] - }, - "unit": { - "type": "string", - "description": "The unit in which the metric value is reported. It is only applicable if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The supported units are a subset of [The Unified Code for Units of Measure](http://unitsofmeasure.org/ucum.html) standard: **Basic units (UNIT)** * `bit` bit * `By` byte * `s` second * `min` minute * `h` hour * `d` day **Prefixes (PREFIX)** * `k` kilo (10**3) * `M` mega (10**6) * `G` giga (10**9) * `T` tera (10**12) * `P` peta (10**15) * `E` exa (10**18) * `Z` zetta (10**21) * `Y` yotta (10**24) * `m` milli (10**-3) * `u` micro (10**-6) * `n` nano (10**-9) * `p` pico (10**-12) * `f` femto (10**-15) * `a` atto (10**-18) * `z` zepto (10**-21) * `y` yocto (10**-24) * `Ki` kibi (2**10) * `Mi` mebi (2**20) * `Gi` gibi (2**30) * `Ti` tebi (2**40) **Grammar** The grammar includes the dimensionless unit `1`, such as `1/s`. The grammar also includes these connectors: * `/` division (as an infix operator, e.g. `1/s`). * `.` multiplication (as an infix operator, e.g. `GBy.d`) The grammar for a unit is as follows: Expression = Component { \".\" Component } { \"/\" Component } ; Component = [ PREFIX ] UNIT [ Annotation ] | Annotation | \"1\" ; Annotation = \"{\" NAME \"}\" ; Notes: * `Annotation` is just a comment if it follows a `UNIT` and is equivalent to `1` if it is used alone. For examples, `{requests}/s == 1/s`, `By{transmitted}/s == By/s`. * `NAME` is a sequence of non-blank printable ASCII characters not containing '{' or '}'." - }, - "description": { - "type": "string", - "description": "A detailed description of the metric, which can be used in documentation." - }, - "displayName": { - "type": "string", - "description": "A concise name for the metric, which can be displayed in user interfaces. Use sentence case without an ending period, for example \"Request count\"." - } - } - }, - "ListTimeSeriesResponse": { - "id": "ListTimeSeriesResponse", - "type": "object", - "description": "The `ListTimeSeries` response.", - "properties": { - "timeSeries": { - "type": "array", - "description": "One or more time series that match the filter included in the request.", - "items": { - "$ref": "TimeSeries" - } - }, - "nextPageToken": { - "type": "string", - "description": "If there are more results than have been returned, then this field is set to a non-empty value. To see the additional results, use that value as `pageToken` in the next call to this method." - } - } - }, - "TimeSeries": { - "id": "TimeSeries", - "type": "object", - "description": "A collection of data points that describes the time-varying nature of a metric. A time series is identified by a combination of a fully-specified monitored resource and a fully-specified metric.", - "properties": { - "metric": { - "$ref": "Metric", - "description": "The fully-specified metric used to identify the time series." - }, - "resource": { - "$ref": "MonitoredResource", - "description": "The fully-specified monitored resource used to identify the time series." - }, - "metricKind": { - "type": "string", - "description": "The metric kind of the time series. This can be different than the metric kind specified in [google.api.MetricDescriptor] because of alignment and reduction operations on the data. This field is ignored when writing data; the value specified in the descriptor is used instead. @OutputOnly", - "enum": [ - "METRIC_KIND_UNSPECIFIED", - "GAUGE", - "DELTA", - "CUMULATIVE" - ] - }, - "valueType": { - "type": "string", - "description": "The value type of the time series. This can be different than the value type specified in [google.api.MetricDescriptor] because of alignment and reduction operations on the data. This field is ignored when writing data; the value specified in the descriptor is used instead. @OutputOnly", - "enum": [ - "VALUE_TYPE_UNSPECIFIED", - "BOOL", - "INT64", - "DOUBLE", - "STRING", - "DISTRIBUTION", - "MONEY" - ] - }, - "points": { - "type": "array", - "description": "The data points of this time series. When used as output, points will be sorted by decreasing time order. When used as input, points could be written in any orders.", - "items": { - "$ref": "Point" - } - } - } - }, - "Metric": { - "id": "Metric", - "type": "object", - "description": "A specific metric identified by specifying values for all of the labels of a `MetricDescriptor`.", - "properties": { - "type": { - "type": "string", - "description": "An existing metric type, see google.api.MetricDescriptor. For example, `compute.googleapis.com/instance/cpu/usage_time`." - }, - "labels": { - "type": "object", - "description": "The set of labels that uniquely identify a metric. To specify a metric, all labels enumerated in the `MetricDescriptor` must be assigned values.", - "additionalProperties": { - "type": "string" - } - } - } - }, - "Point": { - "id": "Point", - "type": "object", - "description": "A single data point in a time series.", - "properties": { - "interval": { - "$ref": "TimeInterval", - "description": "The time interval to which the value applies." - }, - "value": { - "$ref": "TypedValue", - "description": "The value of the data point." - } - } - }, - "TimeInterval": { - "id": "TimeInterval", - "type": "object", - "description": "A time interval extending from after `startTime` through `endTime`. If `startTime` is omitted, the interval is the single point in time, `endTime`.", - "properties": { - "endTime": { - "type": "string", - "description": "Required. The end of the interval. The interval includes this time." - }, - "startTime": { - "type": "string", - "description": "If this value is omitted, the interval is a point in time, `endTime`. If `startTime` is present, it must be earlier than (less than) `endTime`. The interval begins after `startTime`—it does not include `startTime`." - } - } - }, - "CreateTimeSeriesRequest": { - "id": "CreateTimeSeriesRequest", - "type": "object", - "description": "The `CreateTimeSeries` request.", - "properties": { - "timeSeries": { - "type": "array", - "description": "The new data to be added to a list of time series. Adds at most one data point to each of several time series. The new data point must be more recent than any other point in its time series. Each `TimeSeries` value must fully specify a unique time series by supplying all label values for the metric and the monitored resource.", - "items": { - "$ref": "TimeSeries" - } - } - } - }, - "Type": { - "id": "Type", - "type": "object", - "description": "A protocol buffer message type.", - "properties": { - "name": { - "type": "string", - "description": "The fully qualified message name." + "pp": { + "description": "Pretty-print response.", + "default": "true", + "type": "boolean", + "location": "query" }, "fields": { - "type": "array", - "description": "The list of fields.", - "items": { - "$ref": "Field" - } + "description": "Selector specifying which fields to include in a partial response.", + "type": "string", + "location": "query" }, - "oneofs": { - "type": "array", - "description": "The list of types appearing in `oneof` definitions in this type.", - "items": { + "alt": { + "description": "Data format for response.", + "location": "query", + "enum": [ + "json", + "media", + "proto" + ], + "default": "json", + "enumDescriptions": [ + "Responses with Content-Type of application/json", + "Media download with context-dependent Content-Type", + "Responses with Content-Type of application/x-protobuf" + ], "type": "string" - } }, - "options": { - "type": "array", - "description": "The protocol buffer options.", - "items": { - "$ref": "Option" - } + "$.xgafv": { + "description": "V1 error format.", + "enum": [ + "1", + "2" + ], + "enumDescriptions": [ + "v1 error format", + "v2 error format" + ], + "type": "string", + "location": "query" }, - "sourceContext": { - "$ref": "SourceContext", - "description": "The source context." + "callback": { + "description": "JSONP", + "type": "string", + "location": "query" }, - "syntax": { - "type": "string", - "description": "The source syntax.", - "enum": [ - "SYNTAX_PROTO2", - "SYNTAX_PROTO3" - ] + "oauth_token": { + "description": "OAuth 2.0 token for the current user.", + "type": "string", + "location": "query" + }, + "uploadType": { + "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").", + "type": "string", + "location": "query" + }, + "bearer_token": { + "description": "OAuth bearer token.", + "type": "string", + "location": "query" + }, + "upload_protocol": { + "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").", + "type": "string", + "location": "query" } - } }, - "Field": { - "id": "Field", - "type": "object", - "description": "A single field of a message type.", - "properties": { - "kind": { - "type": "string", - "description": "The field type.", - "enum": [ - "TYPE_UNKNOWN", - "TYPE_DOUBLE", - "TYPE_FLOAT", - "TYPE_INT64", - "TYPE_UINT64", - "TYPE_INT32", - "TYPE_FIXED64", - "TYPE_FIXED32", - "TYPE_BOOL", - "TYPE_STRING", - "TYPE_GROUP", - "TYPE_MESSAGE", - "TYPE_BYTES", - "TYPE_UINT32", - "TYPE_ENUM", - "TYPE_SFIXED32", - "TYPE_SFIXED64", - "TYPE_SINT32", - "TYPE_SINT64" - ] - }, - "cardinality": { - "type": "string", - "description": "The field cardinality.", - "enum": [ - "CARDINALITY_UNKNOWN", - "CARDINALITY_OPTIONAL", - "CARDINALITY_REQUIRED", - "CARDINALITY_REPEATED" - ] - }, - "number": { - "type": "integer", - "description": "The field number.", - "format": "int32" - }, - "name": { - "type": "string", - "description": "The field name." - }, - "typeUrl": { - "type": "string", - "description": "The field type URL, without the scheme, for message or enumeration types. Example: `\"type.googleapis.com/google.protobuf.Timestamp\"`." - }, - "oneofIndex": { - "type": "integer", - "description": "The index of the field type in `Type.oneofs`, for message or enumeration types. The first type has index 1; zero means the type is not in the list.", - "format": "int32" - }, - "packed": { - "type": "boolean", - "description": "Whether to use alternative packed wire representation." - }, - "options": { - "type": "array", - "description": "The protocol buffer options.", - "items": { - "$ref": "Option" - } - }, - "jsonName": { - "type": "string", - "description": "The field JSON name." - }, - "defaultValue": { - "type": "string", - "description": "The string value of the default value of this field. Proto2 syntax only." - } - } - }, - "Option": { - "id": "Option", - "type": "object", - "description": "A protocol buffer option, which can be attached to a message, field, enumeration, etc.", - "properties": { - "name": { - "type": "string", - "description": "The option's name. For example, `\"java_package\"`." - }, - "value": { - "type": "object", - "description": "The option's value. For example, `\"com.google.protobuf\"`.", - "additionalProperties": { - "type": "any", - "description": "Properties of the object. Contains field @ype with type URL." - } - } - } - }, - "SourceContext": { - "id": "SourceContext", - "type": "object", - "description": "`SourceContext` represents information about the source of a protobuf element, like the file in which it is defined.", - "properties": { - "fileName": { - "type": "string", - "description": "The path-qualified name of the .proto file that contained the associated protobuf element. For example: `\"google/protobuf/source.proto\"`." - } - } - } - }, - "resources": { - "projects": { - "resources": { - "collectdTimeSeries": { - "methods": { - "create": { - "id": "monitoring.projects.collectdTimeSeries.create", - "path": "v3/{+name}/collectdTimeSeries", - "httpMethod": "POST", - "description": "Creates a new time series with the given data points. This method is only for use in `collectd`-related code, including the Google Monitoring Agent. See [google.monitoring.v3.MetricService.CreateTimeSeries] instead.", - "parameters": { - "name": { - "type": "string", - "description": "The project in which to create the time series. The format is `\"projects/PROJECT_ID_OR_NUMBER\"`.", - "required": true, - "pattern": "^projects/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "name" - ], - "request": { - "$ref": "CreateCollectdTimeSeriesRequest" - }, - "response": { - "$ref": "Empty" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/monitoring", - "https://www.googleapis.com/auth/monitoring.write" - ] - } - } - }, - "groups": { - "methods": { - "list": { - "id": "monitoring.projects.groups.list", - "path": "v3/{+name}/groups", - "httpMethod": "GET", - "description": "Lists the existing groups.", - "parameters": { - "name": { - "type": "string", - "description": "The project whose groups are to be listed. The format is `\"projects/{project_id_or_number}\"`.", - "required": true, - "pattern": "^projects/[^/]*$", - "location": "path" - }, - "childrenOfGroup": { - "type": "string", - "description": "A group name: `\"projects/{project_id_or_number}/groups/{group_id}\"`. Returns groups whose `parentName` field contains the group name. If no groups have this parent, the results are empty.", - "location": "query" - }, - "ancestorsOfGroup": { - "type": "string", - "description": "A group name: `\"projects/{project_id_or_number}/groups/{group_id}\"`. Returns groups that are ancestors of the specified group. The groups are returned in order, starting with the immediate parent and ending with the most distant ancestor. If the specified group has no immediate parent, the results are empty.", - "location": "query" - }, - "descendantsOfGroup": { - "type": "string", - "description": "A group name: `\"projects/{project_id_or_number}/groups/{group_id}\"`. Returns the descendants of the specified group. This is a superset of the results returned by the `childrenOfGroup` filter, and includes children-of-children, and so forth.", - "location": "query" - }, - "pageSize": { - "type": "integer", - "description": "A positive number that is the maximum number of results to return.", - "format": "int32", - "location": "query" - }, - "pageToken": { - "type": "string", - "description": "If this field is not empty then it must contain the `nextPageToken` value returned by a previous call to this method. Using this field causes the method to return additional results from the previous method call.", - "location": "query" - } - }, - "parameterOrder": [ - "name" - ], - "response": { - "$ref": "ListGroupsResponse" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/monitoring", - "https://www.googleapis.com/auth/monitoring.read" - ] - }, - "get": { - "id": "monitoring.projects.groups.get", - "path": "v3/{+name}", - "httpMethod": "GET", - "description": "Gets a single group.", - "parameters": { - "name": { - "type": "string", - "description": "The group to retrieve. The format is `\"projects/{project_id_or_number}/groups/{group_id}\"`.", - "required": true, - "pattern": "^projects/[^/]*/groups/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "name" - ], - "response": { - "$ref": "Group" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/monitoring", - "https://www.googleapis.com/auth/monitoring.read" - ] - }, - "create": { - "id": "monitoring.projects.groups.create", - "path": "v3/{+name}/groups", - "httpMethod": "POST", - "description": "Creates a new group.", - "parameters": { - "name": { - "type": "string", - "description": "The project in which to create the group. The format is `\"projects/{project_id_or_number}\"`.", - "required": true, - "pattern": "^projects/[^/]*$", - "location": "path" - }, - "validateOnly": { - "type": "boolean", - "description": "If true, validate this request but do not create the group.", - "location": "query" - } - }, - "parameterOrder": [ - "name" - ], - "request": { - "$ref": "Group" - }, - "response": { - "$ref": "Group" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/monitoring" - ] - }, - "update": { - "id": "monitoring.projects.groups.update", - "path": "v3/{+name}", - "httpMethod": "PUT", - "description": "Updates an existing group. You can change any group attributes except `name`.", - "parameters": { - "name": { - "type": "string", - "description": "The name of this group. The format is `\"projects/{project_id_or_number}/groups/{group_id}\"`. When creating a group, this field is ignored and a new name is created consisting of the project specified in the call to `CreateGroup` and a unique `{group_id}` that is generated automatically. @OutputOnly", - "required": true, - "pattern": "^projects/[^/]*/groups/[^/]*$", - "location": "path" - }, - "validateOnly": { - "type": "boolean", - "description": "If true, validate this request but do not update the existing group.", - "location": "query" - } - }, - "parameterOrder": [ - "name" - ], - "request": { - "$ref": "Group" - }, - "response": { - "$ref": "Group" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/monitoring" - ] - }, - "delete": { - "id": "monitoring.projects.groups.delete", - "path": "v3/{+name}", - "httpMethod": "DELETE", - "description": "Deletes an existing group.", - "parameters": { - "name": { - "type": "string", - "description": "The group to delete. The format is `\"projects/{project_id_or_number}/groups/{group_id}\"`.", - "required": true, - "pattern": "^projects/[^/]*/groups/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "name" - ], - "response": { - "$ref": "Empty" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/monitoring" - ] - } - }, - "resources": { - "members": { - "methods": { - "list": { - "id": "monitoring.projects.groups.members.list", - "path": "v3/{+name}/members", - "httpMethod": "GET", - "description": "Lists the monitored resources that are members of a group.", - "parameters": { - "name": { - "type": "string", - "description": "The group whose members are listed. The format is `\"projects/{project_id_or_number}/groups/{group_id}\"`.", - "required": true, - "pattern": "^projects/[^/]*/groups/[^/]*$", - "location": "path" - }, - "pageSize": { - "type": "integer", - "description": "A positive number that is the maximum number of results to return.", - "format": "int32", - "location": "query" - }, - "pageToken": { - "type": "string", - "description": "If this field is not empty then it must contain the `nextPageToken` value returned by a previous call to this method. Using this field causes the method to return additional results from the previous method call.", - "location": "query" - }, - "filter": { - "type": "string", - "description": "An optional [list filter](/monitoring/api/learn_more#filtering) describing the members to be returned. The filter may reference the type, labels, and metadata of monitored resources that comprise the group. For example, to return only resources representing Compute Engine VM instances, use this filter: resource.type = \"gce_instance\"", - "location": "query" - }, - "interval.endTime": { - "type": "string", - "description": "Required. The end of the interval. The interval includes this time.", - "location": "query" - }, - "interval.startTime": { - "type": "string", - "description": "If this value is omitted, the interval is a point in time, `endTime`. If `startTime` is present, it must be earlier than (less than) `endTime`. The interval begins after `startTime`—it does not include `startTime`.", - "location": "query" - } - }, - "parameterOrder": [ - "name" - ], - "response": { - "$ref": "ListGroupMembersResponse" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/monitoring", - "https://www.googleapis.com/auth/monitoring.read" - ] - } - } - } - } - }, - "monitoredResourceDescriptors": { - "methods": { - "list": { - "id": "monitoring.projects.monitoredResourceDescriptors.list", - "path": "v3/{+name}/monitoredResourceDescriptors", - "httpMethod": "GET", - "description": "Lists monitored resource descriptors that match a filter. This method does not require a Stackdriver account.", - "parameters": { - "name": { - "type": "string", - "description": "The project on which to execute the request. The format is `\"projects/{project_id_or_number}\"`.", - "required": true, - "pattern": "^projects/[^/]*$", - "location": "path" - }, - "filter": { - "type": "string", - "description": "An optional [filter](/monitoring/api/v3/filters) describing the descriptors to be returned. The filter can reference the descriptor's type and labels. For example, the following filter returns only Google Compute Engine descriptors that have an `id` label: resource.type = starts_with(\"gce_\") AND resource.label:id", - "location": "query" - }, - "pageSize": { - "type": "integer", - "description": "A positive number that is the maximum number of results to return.", - "format": "int32", - "location": "query" - }, - "pageToken": { - "type": "string", - "description": "If this field is not empty then it must contain the `nextPageToken` value returned by a previous call to this method. Using this field causes the method to return additional results from the previous method call.", - "location": "query" - } - }, - "parameterOrder": [ - "name" - ], - "response": { - "$ref": "ListMonitoredResourceDescriptorsResponse" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/monitoring", - "https://www.googleapis.com/auth/monitoring.read", - "https://www.googleapis.com/auth/monitoring.write" - ] - }, - "get": { - "id": "monitoring.projects.monitoredResourceDescriptors.get", - "path": "v3/{+name}", - "httpMethod": "GET", - "description": "Gets a single monitored resource descriptor. This method does not require a Stackdriver account.", - "parameters": { - "name": { - "type": "string", - "description": "The monitored resource descriptor to get. The format is `\"projects/{project_id_or_number}/monitoredResourceDescriptors/{resource_type}\"`. The `{resource_type}` is a predefined type, such as `cloudsql_database`.", - "required": true, - "pattern": "^projects/[^/]*/monitoredResourceDescriptors/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "name" - ], - "response": { - "$ref": "MonitoredResourceDescriptor" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/monitoring", - "https://www.googleapis.com/auth/monitoring.read", - "https://www.googleapis.com/auth/monitoring.write" - ] - } - } - }, - "metricDescriptors": { - "methods": { - "list": { - "id": "monitoring.projects.metricDescriptors.list", - "path": "v3/{+name}/metricDescriptors", - "httpMethod": "GET", - "description": "Lists metric descriptors that match a filter. This method does not require a Stackdriver account.", - "parameters": { - "name": { - "type": "string", - "description": "The project on which to execute the request. The format is `\"projects/{project_id_or_number}\"`.", - "required": true, - "pattern": "^projects/[^/]*$", - "location": "path" - }, - "filter": { - "type": "string", - "description": "If this field is empty, all custom and system-defined metric descriptors are returned. Otherwise, the [filter](/monitoring/api/v3/filters) specifies which metric descriptors are to be returned. For example, the following filter matches all [custom metrics](/monitoring/custom-metrics): metric.type = starts_with(\"custom.googleapis.com/\")", - "location": "query" - }, - "pageSize": { - "type": "integer", - "description": "A positive number that is the maximum number of results to return.", - "format": "int32", - "location": "query" - }, - "pageToken": { - "type": "string", - "description": "If this field is not empty then it must contain the `nextPageToken` value returned by a previous call to this method. Using this field causes the method to return additional results from the previous method call.", - "location": "query" - } - }, - "parameterOrder": [ - "name" - ], - "response": { - "$ref": "ListMetricDescriptorsResponse" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/monitoring", - "https://www.googleapis.com/auth/monitoring.read", - "https://www.googleapis.com/auth/monitoring.write" - ] - }, - "get": { - "id": "monitoring.projects.metricDescriptors.get", - "path": "v3/{+name}", - "httpMethod": "GET", - "description": "Gets a single metric descriptor. This method does not require a Stackdriver account.", - "parameters": { - "name": { - "type": "string", - "description": "The metric descriptor on which to execute the request. The format is `\"projects/{project_id_or_number}/metricDescriptors/{metric_id}\"`. An example value of `{metric_id}` is `\"compute.googleapis.com/instance/disk/read_bytes_count\"`.", - "required": true, - "pattern": "^projects/[^/]*/metricDescriptors/.*$", - "location": "path" - } - }, - "parameterOrder": [ - "name" - ], - "response": { - "$ref": "MetricDescriptor" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/monitoring", - "https://www.googleapis.com/auth/monitoring.read", - "https://www.googleapis.com/auth/monitoring.write" - ] - }, - "create": { - "id": "monitoring.projects.metricDescriptors.create", - "path": "v3/{+name}/metricDescriptors", - "httpMethod": "POST", - "description": "Creates a new metric descriptor. User-created metric descriptors define [custom metrics](/monitoring/custom-metrics).", - "parameters": { - "name": { - "type": "string", - "description": "The project on which to execute the request. The format is `\"projects/{project_id_or_number}\"`.", - "required": true, - "pattern": "^projects/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "name" - ], - "request": { - "$ref": "MetricDescriptor" - }, - "response": { - "$ref": "MetricDescriptor" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/monitoring", - "https://www.googleapis.com/auth/monitoring.write" - ] - }, - "delete": { - "id": "monitoring.projects.metricDescriptors.delete", - "path": "v3/{+name}", - "httpMethod": "DELETE", - "description": "Deletes a metric descriptor. Only user-created [custom metrics](/monitoring/custom-metrics) can be deleted.", - "parameters": { - "name": { - "type": "string", - "description": "The metric descriptor on which to execute the request. The format is `\"projects/{project_id_or_number}/metricDescriptors/{metric_id}\"`. An example of `{metric_id}` is: `\"custom.googleapis.com/my_test_metric\"`.", - "required": true, - "pattern": "^projects/[^/]*/metricDescriptors/.*$", - "location": "path" - } - }, - "parameterOrder": [ - "name" - ], - "response": { - "$ref": "Empty" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/monitoring" - ] - } - } - }, - "timeSeries": { - "methods": { - "list": { - "id": "monitoring.projects.timeSeries.list", - "path": "v3/{+name}/timeSeries", - "httpMethod": "GET", - "description": "Lists time series that match a filter. This method does not require a Stackdriver account.", - "parameters": { - "name": { - "type": "string", - "description": "The project on which to execute the request. The format is \"projects/{project_id_or_number}\".", - "required": true, - "pattern": "^projects/[^/]*$", - "location": "path" - }, - "filter": { - "type": "string", - "description": "A [monitoring filter](/monitoring/api/v3/filters) that specifies which time series should be returned. The filter must specify a single metric type, and can additionally specify metric labels and other information. For example: metric.type = \"compute.googleapis.com/instance/cpu/usage_time\" AND metric.label.instance_name = \"my-instance-name\"", - "location": "query" - }, - "interval.endTime": { - "type": "string", - "description": "Required. The end of the interval. The interval includes this time.", - "location": "query" - }, - "interval.startTime": { - "type": "string", - "description": "If this value is omitted, the interval is a point in time, `endTime`. If `startTime` is present, it must be earlier than (less than) `endTime`. The interval begins after `startTime`—it does not include `startTime`.", - "location": "query" - }, - "aggregation.alignmentPeriod": { - "type": "string", - "description": "The alignment period for per-[time series](TimeSeries) alignment. If present, `alignmentPeriod` must be at least 60 seconds. After per-time series alignment, each time series will contain data points only on the period boundaries. If `perSeriesAligner` is not specified or equals `ALIGN_NONE`, then this field is ignored. If `perSeriesAligner` is specified and does not equal `ALIGN_NONE`, then this field must be defined; otherwise an error is returned.", - "location": "query" - }, - "aggregation.perSeriesAligner": { - "type": "string", - "description": "The approach to be used to align individual time series. Not all alignment functions may be applied to all time series, depending on the metric type and value type of the original time series. Alignment may change the metric type or the value type of the time series. Time series data must be aligned in order to perform cross-time series reduction. If `crossSeriesReducer` is specified, then `perSeriesAligner` must be specified and not equal `ALIGN_NONE` and `alignmentPeriod` must be specified; otherwise, an error is returned.", - "enum": [ - "ALIGN_NONE", - "ALIGN_DELTA", - "ALIGN_RATE", - "ALIGN_INTERPOLATE", - "ALIGN_NEXT_OLDER", - "ALIGN_MIN", - "ALIGN_MAX", - "ALIGN_MEAN", - "ALIGN_COUNT", - "ALIGN_SUM", - "ALIGN_STDDEV", - "ALIGN_COUNT_TRUE", - "ALIGN_FRACTION_TRUE" - ], - "location": "query" - }, - "aggregation.crossSeriesReducer": { - "type": "string", - "description": "The approach to be used to combine time series. Not all reducer functions may be applied to all time series, depending on the metric type and the value type of the original time series. Reduction may change the metric type of value type of the time series. Time series data must be aligned in order to perform cross-time series reduction. If `crossSeriesReducer` is specified, then `perSeriesAligner` must be specified and not equal `ALIGN_NONE` and `alignmentPeriod` must be specified; otherwise, an error is returned.", - "enum": [ - "REDUCE_NONE", - "REDUCE_MEAN", - "REDUCE_MIN", - "REDUCE_MAX", - "REDUCE_SUM", - "REDUCE_STDDEV", - "REDUCE_COUNT", - "REDUCE_COUNT_TRUE", - "REDUCE_FRACTION_TRUE", - "REDUCE_PERCENTILE_99", - "REDUCE_PERCENTILE_95", - "REDUCE_PERCENTILE_50", - "REDUCE_PERCENTILE_05" - ], - "location": "query" - }, - "aggregation.groupByFields": { - "type": "string", - "description": "The set of fields to preserve when `crossSeriesReducer` is specified. The `groupByFields` determine how the time series are partitioned into subsets prior to applying the aggregation function. Each subset contains time series that have the same value for each of the grouping fields. Each individual time series is a member of exactly one subset. The `crossSeriesReducer` is applied to each subset of time series. Fields not specified in `groupByFields` are aggregated away. If `groupByFields` is not specified, the time series are aggregated into a single output time series. If `crossSeriesReducer` is not defined, this field is ignored.", - "repeated": true, - "location": "query" - }, - "orderBy": { - "type": "string", - "description": "Specifies the order in which the points of the time series should be returned. By default, results are not ordered. Currently, this field must be left blank.", - "location": "query" - }, - "view": { - "type": "string", - "description": "Specifies which information is returned about the time series.", - "enum": [ - "FULL", - "HEADERS" - ], - "location": "query" - }, - "pageSize": { - "type": "integer", - "description": "A positive number that is the maximum number of results to return. When `view` field sets to `FULL`, it limits the number of `Points` server will return; if `view` field is `HEADERS`, it limits the number of `TimeSeries` server will return.", - "format": "int32", - "location": "query" - }, - "pageToken": { - "type": "string", - "description": "If this field is not empty then it must contain the `nextPageToken` value returned by a previous call to this method. Using this field causes the method to return additional results from the previous method call.", - "location": "query" - } - }, - "parameterOrder": [ - "name" - ], - "response": { - "$ref": "ListTimeSeriesResponse" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/monitoring", - "https://www.googleapis.com/auth/monitoring.read" - ] - }, - "create": { - "id": "monitoring.projects.timeSeries.create", - "path": "v3/{+name}/timeSeries", - "httpMethod": "POST", - "description": "Creates or adds data to one or more time series. The response is empty if all time series in the request were written. If any time series could not be written, a corresponding failure message is included in the error response.", - "parameters": { - "name": { - "type": "string", - "description": "The project on which to execute the request. The format is `\"projects/{project_id_or_number}\"`.", - "required": true, - "pattern": "^projects/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "name" - ], - "request": { - "$ref": "CreateTimeSeriesRequest" - }, - "response": { - "$ref": "Empty" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/monitoring", - "https://www.googleapis.com/auth/monitoring.write" - ] - } - } - } - } - } - } + "documentationLink": "https://cloud.google.com/monitoring/api/", + "ownerDomain": "google.com", + "batchPath": "batch", + "servicePath": "", + "ownerName": "Google", + "version": "v3", + "rootUrl": "https://monitoring.googleapis.com/", + "kind": "discovery#restDescription" } diff --git a/etc/api/oauth2/v1/oauth2-api.json b/etc/api/oauth2/v1/oauth2-api.json index 3e7b53d160..1adf77f089 100644 --- a/etc/api/oauth2/v1/oauth2-api.json +++ b/etc/api/oauth2/v1/oauth2-api.json @@ -1,18 +1,18 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/uXLS8z-zc-3mqba8ZhXP5-JJ2ag\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/ZNWWs55SDv_tc8yf5oM647SvRm8\"", "discoveryVersion": "v1", "id": "oauth2:v1", "name": "oauth2", "version": "v1", - "revision": "20160822", + "revision": "20161103", "title": "Google OAuth2 API", "description": "Obtains end-user authorization grants for use with other Google APIs.", "ownerDomain": "google.com", "ownerName": "Google", "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" }, "documentationLink": "https://developers.google.com/accounts/docs/OAuth2", "protocol": "rest", diff --git a/etc/api/oauth2/v2/oauth2-api.json b/etc/api/oauth2/v2/oauth2-api.json index 2c12575c43..f1f8bebe89 100644 --- a/etc/api/oauth2/v2/oauth2-api.json +++ b/etc/api/oauth2/v2/oauth2-api.json @@ -1,18 +1,18 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/jeziO2vCSIZL3x2MLvouc5ezDhQ\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/DLGEtypjIuIXh77Iqrmfcan50ew\"", "discoveryVersion": "v1", "id": "oauth2:v2", "name": "oauth2", "version": "v2", - "revision": "20160822", + "revision": "20161103", "title": "Google OAuth2 API", "description": "Obtains end-user authorization grants for use with other Google APIs.", "ownerDomain": "google.com", "ownerName": "Google", "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" }, "documentationLink": "https://developers.google.com/accounts/docs/OAuth2", "protocol": "rest", diff --git a/etc/api/pagespeedonline/v1/pagespeedonline-api.json b/etc/api/pagespeedonline/v1/pagespeedonline-api.json index 8e32fa16fc..4b3f08bf4b 100644 --- a/etc/api/pagespeedonline/v1/pagespeedonline-api.json +++ b/etc/api/pagespeedonline/v1/pagespeedonline-api.json @@ -1,11 +1,11 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/KODKRabYcLOfg1_fepQJ1JOlHnM\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/FkGdm1NgZtAvow-TudpcDpRNyE0\"", "discoveryVersion": "v1", "id": "pagespeedonline:v1", "name": "pagespeedonline", "version": "v1", - "revision": "20160811", + "revision": "20161204", "title": "PageSpeed Insights API", "description": "Analyzes the performance of a web page and provides tailored suggestions to make that page faster.", "ownerDomain": "google.com", @@ -398,7 +398,7 @@ "type": "string", "description": "The URL to fetch and analyze", "required": true, - "pattern": "http(s)?://.*", + "pattern": "(?i)http(s)?://.*", "location": "query" } }, diff --git a/etc/api/pagespeedonline/v2/pagespeedonline-api.json b/etc/api/pagespeedonline/v2/pagespeedonline-api.json index 8d4e16e669..ba342c8b1f 100644 --- a/etc/api/pagespeedonline/v2/pagespeedonline-api.json +++ b/etc/api/pagespeedonline/v2/pagespeedonline-api.json @@ -1,11 +1,11 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/r_eKVylBnS37WomzWJoiuxBk3nM\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/5bET14Wb_tD2YUoj5aAgBlN7I1k\"", "discoveryVersion": "v1", "id": "pagespeedonline:v2", "name": "pagespeedonline", "version": "v2", - "revision": "20160811", + "revision": "20161204", "title": "PageSpeed Insights API", "description": "Analyzes the performance of a web page and provides tailored suggestions to make that page faster.", "ownerDomain": "google.com", @@ -473,7 +473,7 @@ "type": "string", "description": "The URL to fetch and analyze", "required": true, - "pattern": "http(s)?://.*", + "pattern": "(?i)http(s)?://.*", "location": "query" } }, diff --git a/etc/api/partners/v2/partners-api.json b/etc/api/partners/v2/partners-api.json index 32767c8b53..b1d188790f 100644 --- a/etc/api/partners/v2/partners-api.json +++ b/etc/api/partners/v2/partners-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/IsLtDjyeCcVcrLheR4Lh75k5EO4\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/IsLtDjyeCcVcrLheR4Lh75k5EO4\"", "discoveryVersion": "v1", "id": "partners:v2", "name": "partners", diff --git a/etc/api/people/v1/people-api.json b/etc/api/people/v1/people-api.json index 24e6910b82..f0faac44dc 100644 --- a/etc/api/people/v1/people-api.json +++ b/etc/api/people/v1/people-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/tzwJjoO4XDFgwNQjmiM8lPsFMzA\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/tzwJjoO4XDFgwNQjmiM8lPsFMzA\"", "discoveryVersion": "v1", "id": "people:v1", "name": "people", diff --git a/etc/api/playmoviespartner/v1/playmoviespartner-api.json b/etc/api/playmoviespartner/v1/playmoviespartner-api.json index c5d956f4c2..9aa4eb53cc 100644 --- a/etc/api/playmoviespartner/v1/playmoviespartner-api.json +++ b/etc/api/playmoviespartner/v1/playmoviespartner-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/nOdrkDPVE_ecVVN74uINxtcznYM\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/nOdrkDPVE_ecVVN74uINxtcznYM\"", "discoveryVersion": "v1", "id": "playmoviespartner:v1", "name": "playmoviespartner", diff --git a/etc/api/plus/v1/plus-api.json b/etc/api/plus/v1/plus-api.json index 8429758bc6..3b3b1c1ee3 100644 --- a/etc/api/plus/v1/plus-api.json +++ b/etc/api/plus/v1/plus-api.json @@ -1,11 +1,11 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/TeeAgcE4J1LHdCvvLCSjSzS5m2Q\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/xaQr2pnQDxzH6xeIeMPv71BcAKc\"", "discoveryVersion": "v1", "id": "plus:v1", "name": "plus", "version": "v1", - "revision": "20160907", + "revision": "20161214", "title": "Google+ API", "description": "Builds on top of the Google+ platform.", "ownerDomain": "google.com", diff --git a/etc/api/plusdomains/v1/plusdomains-api.json b/etc/api/plusdomains/v1/plusdomains-api.json index 57904bb3dd..8e6df74c00 100644 --- a/etc/api/plusdomains/v1/plusdomains-api.json +++ b/etc/api/plusdomains/v1/plusdomains-api.json @@ -1,11 +1,11 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/7YJuYD52NlCzae2gKU4T04XG4FA\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/rwMKGZYRPxKqocmh79dh6HG7FrI\"", "discoveryVersion": "v1", "id": "plusDomains:v1", "name": "plusDomains", "version": "v1", - "revision": "20160907", + "revision": "20161214", "title": "Google+ Domains API", "description": "Builds on top of the Google+ platform for Google Apps Domains.", "ownerDomain": "google.com", diff --git a/etc/api/prediction/v1.2/prediction-api.json b/etc/api/prediction/v1.2/prediction-api.json index d799682776..d1242e63b9 100644 --- a/etc/api/prediction/v1.2/prediction-api.json +++ b/etc/api/prediction/v1.2/prediction-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/y6-9S-Lx_Izdv2KpEj-E5-XRo7s\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/y6-9S-Lx_Izdv2KpEj-E5-XRo7s\"", "discoveryVersion": "v1", "id": "prediction:v1.2", "name": "prediction", diff --git a/etc/api/prediction/v1.3/prediction-api.json b/etc/api/prediction/v1.3/prediction-api.json index 0b549e6ee8..d525e0a5c4 100644 --- a/etc/api/prediction/v1.3/prediction-api.json +++ b/etc/api/prediction/v1.3/prediction-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/cYlCW_mo2Sbrsx6lIgVnF3W-L9s\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/cYlCW_mo2Sbrsx6lIgVnF3W-L9s\"", "discoveryVersion": "v1", "id": "prediction:v1.3", "name": "prediction", diff --git a/etc/api/prediction/v1.4/prediction-api.json b/etc/api/prediction/v1.4/prediction-api.json index a18e0f7802..a9eed17307 100644 --- a/etc/api/prediction/v1.4/prediction-api.json +++ b/etc/api/prediction/v1.4/prediction-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/UWwWpdkeaK4ZVhf_4VB1iBPZ3Lo\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/UWwWpdkeaK4ZVhf_4VB1iBPZ3Lo\"", "discoveryVersion": "v1", "id": "prediction:v1.4", "name": "prediction", diff --git a/etc/api/prediction/v1.5/prediction-api.json b/etc/api/prediction/v1.5/prediction-api.json index c9b3e73f40..fcebc9f050 100644 --- a/etc/api/prediction/v1.5/prediction-api.json +++ b/etc/api/prediction/v1.5/prediction-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/B0qrlmHp5fl-zt3tPCgucMogpLQ\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/B0qrlmHp5fl-zt3tPCgucMogpLQ\"", "discoveryVersion": "v1", "id": "prediction:v1.5", "name": "prediction", diff --git a/etc/api/prediction/v1.6/prediction-api.json b/etc/api/prediction/v1.6/prediction-api.json index 544038b2c8..573dfb21bb 100644 --- a/etc/api/prediction/v1.6/prediction-api.json +++ b/etc/api/prediction/v1.6/prediction-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/YsFEJnq5UeoemkjE7DFhTi6r2Gw\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/YsFEJnq5UeoemkjE7DFhTi6r2Gw\"", "discoveryVersion": "v1", "id": "prediction:v1.6", "name": "prediction", diff --git a/etc/api/proximitybeacon/v1beta1/proximitybeacon-api.json b/etc/api/proximitybeacon/v1beta1/proximitybeacon-api.json index 83e9bd3a9d..f9591e2843 100644 --- a/etc/api/proximitybeacon/v1beta1/proximitybeacon-api.json +++ b/etc/api/proximitybeacon/v1beta1/proximitybeacon-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/InJfaYgEs4kvxVpfe1cZDPrjhv0\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/InJfaYgEs4kvxVpfe1cZDPrjhv0\"", "discoveryVersion": "v1", "id": "proximitybeacon:v1beta1", "name": "proximitybeacon", diff --git a/etc/api/pubsub/v1/pubsub-api.json b/etc/api/pubsub/v1/pubsub-api.json index 0168e6880c..e4c7b90d49 100644 --- a/etc/api/pubsub/v1/pubsub-api.json +++ b/etc/api/pubsub/v1/pubsub-api.json @@ -1,1040 +1,1158 @@ { - "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/liyzgLngirW3xU7Tt2Pd1AnSK1c\"", - "discoveryVersion": "v1", - "id": "pubsub:v1", - "name": "pubsub", - "version": "v1", - "revision": "20160317", - "title": "Google Cloud Pub/Sub API", - "description": "Provides reliable, many-to-many, asynchronous messaging between applications.", - "ownerDomain": "google.com", - "ownerName": "Google", - "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" - }, - "documentationLink": "https://cloud.google.com/pubsub/docs", - "protocol": "rest", - "baseUrl": "https://pubsub.googleapis.com/", - "basePath": "", - "rootUrl": "https://pubsub.googleapis.com/", - "servicePath": "", - "batchPath": "batch", - "parameters": { - "access_token": { - "type": "string", - "description": "OAuth access token.", - "location": "query" - }, - "alt": { - "type": "string", - "description": "Data format for response.", - "default": "json", - "enumDescriptions": [ - "Responses with Content-Type of application/json", - "Media download with context-dependent Content-Type", - "Responses with Content-Type of application/x-protobuf" - ], - "location": "query" - }, - "bearer_token": { - "type": "string", - "description": "OAuth bearer token.", - "location": "query" - }, - "callback": { - "type": "string", - "description": "JSONP", - "location": "query" - }, - "fields": { - "type": "string", - "description": "Selector specifying which fields to include in a partial response.", - "location": "query" - }, - "key": { - "type": "string", - "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", - "location": "query" - }, - "oauth_token": { - "type": "string", - "description": "OAuth 2.0 token for the current user.", - "location": "query" - }, - "pp": { - "type": "boolean", - "description": "Pretty-print response.", - "default": "true", - "location": "query" - }, - "prettyPrint": { - "type": "boolean", - "description": "Returns response with indentations and line breaks.", - "default": "true", - "location": "query" - }, - "quotaUser": { - "type": "string", - "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.", - "location": "query" - }, - "upload_protocol": { - "type": "string", - "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").", - "location": "query" - }, - "uploadType": { - "type": "string", - "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").", - "location": "query" - }, - "$.xgafv": { - "type": "string", - "description": "V1 error format.", - "enumDescriptions": [ - "v1 error format", - "v2 error format" - ], - "location": "query" - } - }, - "auth": { - "oauth2": { - "scopes": { - "https://www.googleapis.com/auth/cloud-platform": { - "description": "View and manage your data across Google Cloud Platform services" - }, - "https://www.googleapis.com/auth/pubsub": { - "description": "View and manage Pub/Sub topics and subscriptions" - } - } - } - }, - "schemas": { - "SetIamPolicyRequest": { - "id": "SetIamPolicyRequest", - "type": "object", - "description": "Request message for `SetIamPolicy` method.", - "properties": { - "policy": { - "$ref": "Policy", - "description": "REQUIRED: The complete policy to be applied to the `resource`. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them." - } - } - }, - "Policy": { - "id": "Policy", - "type": "object", - "description": "Defines an Identity and Access Management (IAM) policy. It is used to specify access control policies for Cloud Platform resources. A `Policy` consists of a list of `bindings`. A `Binding` binds a list of `members` to a `role`, where the members can be user accounts, Google groups, Google domains, and service accounts. A `role` is a named list of permissions defined by IAM. **Example** { \"bindings\": [ { \"role\": \"roles/owner\", \"members\": [ \"user:mike@example.com\", \"group:admins@example.com\", \"domain:google.com\", \"serviceAccount:my-other-app@appspot.gserviceaccount.com\", ] }, { \"role\": \"roles/viewer\", \"members\": [\"user:sean@example.com\"] } ] } For a description of IAM and its features, see the [IAM developer's guide](https://cloud.google.com/iam).", - "properties": { - "version": { - "type": "integer", - "description": "Version of the `Policy`. The default version is 0.", - "format": "int32" - }, - "bindings": { - "type": "array", - "description": "Associates a list of `members` to a `role`. Multiple `bindings` must not be specified for the same `role`. `bindings` with no members will result in an error.", - "items": { - "$ref": "Binding" - } - }, - "etag": { - "type": "string", - "description": "`etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other. It is strongly suggested that systems make use of the `etag` in the read-modify-write cycle to perform policy updates in order to avoid race conditions: An `etag` is returned in the response to `getIamPolicy`, and systems are expected to put that etag in the request to `setIamPolicy` to ensure that their change will be applied to the same version of the policy. If no `etag` is provided in the call to `setIamPolicy`, then the existing policy is overwritten blindly.", - "format": "byte" - } - } - }, - "Binding": { - "id": "Binding", - "type": "object", - "description": "Associates `members` with a `role`.", - "properties": { - "role": { - "type": "string", - "description": "Role that is assigned to `members`. For example, `roles/viewer`, `roles/editor`, or `roles/owner`. Required" - }, - "members": { - "type": "array", - "description": "Specifies the identities requesting access for a Cloud Platform resource. `members` can have the following values: * `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account. * `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account. * `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@gmail.com` or `joe@example.com`. * `serviceAccount:{emailid}`: An email address that represents a service account. For example, `my-other-app@appspot.gserviceaccount.com`. * `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`. * `domain:{domain}`: A Google Apps domain name that represents all the users of that domain. For example, `google.com` or `example.com`.", - "items": { - "type": "string" - } - } - } - }, - "TestIamPermissionsRequest": { - "id": "TestIamPermissionsRequest", - "type": "object", - "description": "Request message for `TestIamPermissions` method.", - "properties": { - "permissions": { - "type": "array", - "description": "The set of permissions to check for the `resource`. Permissions with wildcards (such as '*' or 'storage.*') are not allowed. For more information see IAM Overview.", - "items": { - "type": "string" - } - } - } - }, - "TestIamPermissionsResponse": { - "id": "TestIamPermissionsResponse", - "type": "object", - "description": "Response message for `TestIamPermissions` method.", - "properties": { - "permissions": { - "type": "array", - "description": "A subset of `TestPermissionsRequest.permissions` that the caller is allowed.", - "items": { - "type": "string" - } - } - } - }, - "Topic": { - "id": "Topic", - "type": "object", - "description": "A topic resource.", - "properties": { - "name": { - "type": "string", - "description": "The name of the topic. It must have the format `\"projects/{project}/topics/{topic}\"`. `{topic}` must start with a letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in length, and it must not start with `\"goog\"`." - } - } - }, - "PublishRequest": { - "id": "PublishRequest", - "type": "object", - "description": "Request for the Publish method.", - "properties": { - "messages": { - "type": "array", - "description": "The messages to publish.", - "items": { - "$ref": "PubsubMessage" - } - } - } - }, - "PubsubMessage": { - "id": "PubsubMessage", - "type": "object", - "description": "A message data and its attributes. The message payload must not be empty; it must contain either a non-empty data field, or at least one attribute.", - "properties": { - "data": { - "type": "string", - "description": "The message payload. For JSON requests, the value of this field must be base64-encoded.", - "format": "byte" - }, - "attributes": { - "type": "object", - "description": "Optional attributes for this message.", - "additionalProperties": { - "type": "string" - } - }, - "messageId": { - "type": "string", - "description": "ID of this message, assigned by the server when the message is published. Guaranteed to be unique within the topic. This value may be read by a subscriber that receives a `PubsubMessage` via a `Pull` call or a push delivery. It must not be populated by the publisher in a `Publish` call." - }, - "publishTime": { - "type": "string", - "description": "The time at which the message was published, populated by the server when it receives the `Publish` call. It must not be populated by the publisher in a `Publish` call." - } - } - }, - "PublishResponse": { - "id": "PublishResponse", - "type": "object", - "description": "Response for the `Publish` method.", - "properties": { - "messageIds": { - "type": "array", - "description": "The server-assigned ID of each published message, in the same order as the messages in the request. IDs are guaranteed to be unique within the topic.", - "items": { - "type": "string" - } - } - } - }, - "ListTopicsResponse": { - "id": "ListTopicsResponse", - "type": "object", - "description": "Response for the `ListTopics` method.", - "properties": { - "topics": { - "type": "array", - "description": "The resulting topics.", - "items": { - "$ref": "Topic" - } - }, - "nextPageToken": { - "type": "string", - "description": "If not empty, indicates that there may be more topics that match the request; this value should be passed in a new `ListTopicsRequest`." - } - } - }, - "ListTopicSubscriptionsResponse": { - "id": "ListTopicSubscriptionsResponse", - "type": "object", - "description": "Response for the `ListTopicSubscriptions` method.", - "properties": { - "subscriptions": { - "type": "array", - "description": "The names of the subscriptions that match the request.", - "items": { - "type": "string" - } - }, - "nextPageToken": { - "type": "string", - "description": "If not empty, indicates that there may be more subscriptions that match the request; this value should be passed in a new `ListTopicSubscriptionsRequest` to get more subscriptions." - } - } - }, - "Empty": { - "id": "Empty", - "type": "object", - "description": "A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON representation for `Empty` is empty JSON object `{}`." - }, - "Subscription": { - "id": "Subscription", - "type": "object", - "description": "A subscription resource.", - "properties": { - "name": { - "type": "string", - "description": "The name of the subscription. It must have the format `\"projects/{project}/subscriptions/{subscription}\"`. `{subscription}` must start with a letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in length, and it must not start with `\"goog\"`." - }, - "topic": { - "type": "string", - "description": "The name of the topic from which this subscription is receiving messages. The value of this field will be `_deleted-topic_` if the topic has been deleted." - }, - "pushConfig": { - "$ref": "PushConfig", - "description": "If push delivery is used with this subscription, this field is used to configure it. An empty `pushConfig` signifies that the subscriber will pull and ack messages using API methods." - }, - "ackDeadlineSeconds": { - "type": "integer", - "description": "This value is the maximum time after a subscriber receives a message before the subscriber should acknowledge the message. After message delivery but before the ack deadline expires and before the message is acknowledged, it is an outstanding message and will not be delivered again during that time (on a best-effort basis). For pull subscriptions, this value is used as the initial value for the ack deadline. To override this value for a given message, call `ModifyAckDeadline` with the corresponding `ack_id` if using pull. For push delivery, this value is also used to set the request timeout for the call to the push endpoint. If the subscriber never acknowledges the message, the Pub/Sub system will eventually redeliver the message. If this parameter is not set, the default value of 10 seconds is used.", - "format": "int32" - } - } - }, - "PushConfig": { - "id": "PushConfig", - "type": "object", - "description": "Configuration for a push delivery endpoint.", - "properties": { - "pushEndpoint": { - "type": "string", - "description": "A URL locating the endpoint to which messages should be pushed. For example, a Webhook endpoint might use \"https://example.com/push\"." - }, - "attributes": { - "type": "object", - "description": "Endpoint configuration attributes. Every endpoint has a set of API supported attributes that can be used to control different aspects of the message delivery. The currently supported attribute is `x-goog-version`, which you can use to change the format of the push message. This attribute indicates the version of the data expected by the endpoint. This controls the shape of the envelope (i.e. its fields and metadata). The endpoint version is based on the version of the Pub/Sub API. If not present during the `CreateSubscription` call, it will default to the version of the API used to make such call. If not present during a `ModifyPushConfig` call, its value will not be changed. `GetSubscription` calls will always return a valid version, even if the subscription was created without this attribute. The possible values for this attribute are: * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API. * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.", - "additionalProperties": { - "type": "string" - } - } - } - }, - "ListSubscriptionsResponse": { - "id": "ListSubscriptionsResponse", - "type": "object", - "description": "Response for the `ListSubscriptions` method.", - "properties": { - "subscriptions": { - "type": "array", - "description": "The subscriptions that match the request.", - "items": { - "$ref": "Subscription" - } - }, - "nextPageToken": { - "type": "string", - "description": "If not empty, indicates that there may be more subscriptions that match the request; this value should be passed in a new `ListSubscriptionsRequest` to get more subscriptions." - } - } - }, - "ModifyAckDeadlineRequest": { - "id": "ModifyAckDeadlineRequest", - "type": "object", - "description": "Request for the ModifyAckDeadline method.", - "properties": { - "ackIds": { - "type": "array", - "description": "List of acknowledgment IDs.", - "items": { - "type": "string" - } - }, - "ackDeadlineSeconds": { - "type": "integer", - "description": "The new ack deadline with respect to the time this request was sent to the Pub/Sub system. Must be \u003e= 0. For example, if the value is 10, the new ack deadline will expire 10 seconds after the `ModifyAckDeadline` call was made. Specifying zero may immediately make the message available for another pull request.", - "format": "int32" - } - } - }, - "AcknowledgeRequest": { - "id": "AcknowledgeRequest", - "type": "object", - "description": "Request for the Acknowledge method.", - "properties": { - "ackIds": { - "type": "array", - "description": "The acknowledgment ID for the messages being acknowledged that was returned by the Pub/Sub system in the `Pull` response. Must not be empty.", - "items": { - "type": "string" - } - } - } - }, - "PullRequest": { - "id": "PullRequest", - "type": "object", - "description": "Request for the `Pull` method.", - "properties": { - "returnImmediately": { - "type": "boolean", - "description": "If this is specified as true the system will respond immediately even if it is not able to return a message in the `Pull` response. Otherwise the system is allowed to wait until at least one message is available rather than returning no messages. The client may cancel the request if it does not wish to wait any longer for the response." - }, - "maxMessages": { - "type": "integer", - "description": "The maximum number of messages returned for this request. The Pub/Sub system may return fewer than the number specified.", - "format": "int32" - } - } - }, - "PullResponse": { - "id": "PullResponse", - "type": "object", - "description": "Response for the `Pull` method.", - "properties": { - "receivedMessages": { - "type": "array", - "description": "Received Pub/Sub messages. The Pub/Sub system will return zero messages if there are no more available in the backlog. The Pub/Sub system may return fewer than the `maxMessages` requested even if there are more messages available in the backlog.", - "items": { - "$ref": "ReceivedMessage" - } - } - } - }, - "ReceivedMessage": { - "id": "ReceivedMessage", - "type": "object", - "description": "A message and its corresponding acknowledgment ID.", - "properties": { - "ackId": { - "type": "string", - "description": "This ID can be used to acknowledge the received message." - }, - "message": { - "$ref": "PubsubMessage", - "description": "The message." - } - } - }, - "ModifyPushConfigRequest": { - "id": "ModifyPushConfigRequest", - "type": "object", - "description": "Request for the ModifyPushConfig method.", - "properties": { - "pushConfig": { - "$ref": "PushConfig", - "description": "The push configuration for future deliveries. An empty `pushConfig` indicates that the Pub/Sub system should stop pushing messages from the given subscription and allow messages to be pulled and acknowledged - effectively pausing the subscription if `Pull` is not called." - } - } - } - }, - "resources": { - "projects": { - "resources": { - "topics": { - "methods": { - "setIamPolicy": { - "id": "pubsub.projects.topics.setIamPolicy", - "path": "v1/{+resource}:setIamPolicy", - "httpMethod": "POST", - "description": "Sets the access control policy on the specified resource. Replaces any existing policy.", - "parameters": { - "resource": { - "type": "string", - "description": "REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `setIamPolicy` documentation.", - "required": true, - "pattern": "^projects/[^/]*/topics/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "resource" - ], - "request": { - "$ref": "SetIamPolicyRequest" - }, - "response": { - "$ref": "Policy" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "getIamPolicy": { - "id": "pubsub.projects.topics.getIamPolicy", - "path": "v1/{+resource}:getIamPolicy", - "httpMethod": "GET", - "description": "Gets the access control policy for a `resource`. Returns an empty policy if the resource exists and does not have a policy set.", - "parameters": { - "resource": { - "type": "string", - "description": "REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation.", - "required": true, - "pattern": "^projects/[^/]*/topics/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "resource" - ], - "response": { - "$ref": "Policy" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "testIamPermissions": { - "id": "pubsub.projects.topics.testIamPermissions", - "path": "v1/{+resource}:testIamPermissions", - "httpMethod": "POST", - "description": "Returns permissions that a caller has on the specified resource.", - "parameters": { - "resource": { - "type": "string", - "description": "REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `testIamPermissions` documentation.", - "required": true, - "pattern": "^projects/[^/]*/topics/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "resource" - ], - "request": { - "$ref": "TestIamPermissionsRequest" - }, - "response": { - "$ref": "TestIamPermissionsResponse" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "create": { - "id": "pubsub.projects.topics.create", - "path": "v1/{+name}", - "httpMethod": "PUT", - "description": "Creates the given topic with the given name.", - "parameters": { - "name": { - "type": "string", - "description": "The name of the topic. It must have the format `\"projects/{project}/topics/{topic}\"`. `{topic}` must start with a letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in length, and it must not start with `\"goog\"`.", - "required": true, - "pattern": "^projects/[^/]*/topics/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "name" - ], - "request": { - "$ref": "Topic" - }, - "response": { - "$ref": "Topic" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "publish": { - "id": "pubsub.projects.topics.publish", - "path": "v1/{+topic}:publish", - "httpMethod": "POST", - "description": "Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic does not exist. The message payload must not be empty; it must contain either a non-empty data field, or at least one attribute.", - "parameters": { - "topic": { - "type": "string", - "description": "The messages in the request will be published on this topic.", - "required": true, - "pattern": "^projects/[^/]*/topics/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "topic" - ], - "request": { - "$ref": "PublishRequest" - }, - "response": { - "$ref": "PublishResponse" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "get": { - "id": "pubsub.projects.topics.get", - "path": "v1/{+topic}", - "httpMethod": "GET", - "description": "Gets the configuration of a topic.", - "parameters": { - "topic": { - "type": "string", - "description": "The name of the topic to get.", - "required": true, - "pattern": "^projects/[^/]*/topics/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "topic" - ], - "response": { - "$ref": "Topic" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "list": { - "id": "pubsub.projects.topics.list", - "path": "v1/{+project}/topics", - "httpMethod": "GET", - "description": "Lists matching topics.", - "parameters": { - "project": { - "type": "string", - "description": "The name of the cloud project that topics belong to.", - "required": true, - "pattern": "^projects/[^/]*$", - "location": "path" + "id": "pubsub:v1", + "auth": { + "oauth2": { + "scopes": { + "https://www.googleapis.com/auth/cloud-platform": { + "description": "View and manage your data across Google Cloud Platform services" }, - "pageSize": { - "type": "integer", - "description": "Maximum number of topics to return.", - "format": "int32", - "location": "query" - }, - "pageToken": { - "type": "string", - "description": "The value returned by the last `ListTopicsResponse`; indicates that this is a continuation of a prior `ListTopics` call, and that the system should return the next page of data.", - "location": "query" + "https://www.googleapis.com/auth/pubsub": { + "description": "View and manage Pub/Sub topics and subscriptions" } - }, - "parameterOrder": [ - "project" - ], - "response": { - "$ref": "ListTopicsResponse" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "delete": { - "id": "pubsub.projects.topics.delete", - "path": "v1/{+topic}", - "httpMethod": "DELETE", - "description": "Deletes the topic with the given name. Returns `NOT_FOUND` if the topic does not exist. After a topic is deleted, a new topic may be created with the same name; this is an entirely new topic with none of the old configuration or subscriptions. Existing subscriptions to this topic are not deleted, but their `topic` field is set to `_deleted-topic_`.", - "parameters": { - "topic": { - "type": "string", - "description": "Name of the topic to delete.", - "required": true, - "pattern": "^projects/[^/]*/topics/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "topic" - ], - "response": { - "$ref": "Empty" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] } - }, - "resources": { - "subscriptions": { - "methods": { - "list": { - "id": "pubsub.projects.topics.subscriptions.list", - "path": "v1/{+topic}/subscriptions", - "httpMethod": "GET", - "description": "Lists the name of the subscriptions for this topic.", - "parameters": { - "topic": { - "type": "string", - "description": "The name of the topic that subscriptions are attached to.", - "required": true, - "pattern": "^projects/[^/]*/topics/[^/]*$", - "location": "path" - }, - "pageSize": { - "type": "integer", - "description": "Maximum number of subscription names to return.", - "format": "int32", - "location": "query" - }, - "pageToken": { - "type": "string", - "description": "The value returned by the last `ListTopicSubscriptionsResponse`; indicates that this is a continuation of a prior `ListTopicSubscriptions` call, and that the system should return the next page of data.", - "location": "query" + } + }, + "description": "Provides reliable, many-to-many, asynchronous messaging between applications.\n", + "protocol": "rest", + "title": "Google Cloud Pub/Sub API", + "resources": { + "projects": { + "resources": { + "subscriptions": { + "methods": { + "modifyPushConfig": { + "id": "pubsub.projects.subscriptions.modifyPushConfig", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "subscription" + ], + "description": "Modifies the `PushConfig` for a specified subscription.\n\nThis may be used to change a push subscription to a pull one (signified by\nan empty `PushConfig`) or vice versa, or change the endpoint URL and other\nattributes of a push subscription. Messages will accumulate for delivery\ncontinuously through the call regardless of changes to the `PushConfig`.", + "request": { + "$ref": "ModifyPushConfigRequest" + }, + "flatPath": "v1/projects/{projectsId}/subscriptions/{subscriptionsId}:modifyPushConfig", + "httpMethod": "POST", + "parameters": { + "subscription": { + "description": "The name of the subscription.\nFormat is `projects/{project}/subscriptions/{sub}`.", + "required": true, + "pattern": "^projects/[^/]+/subscriptions/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1/{+subscription}:modifyPushConfig", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "getIamPolicy": { + "id": "pubsub.projects.subscriptions.getIamPolicy", + "response": { + "$ref": "Policy" + }, + "parameterOrder": [ + "resource" + ], + "description": "Gets the access control policy for a resource.\nReturns an empty policy if the resource exists and does not have a policy\nset.", + "flatPath": "v1/projects/{projectsId}/subscriptions/{subscriptionsId}:getIamPolicy", + "httpMethod": "GET", + "parameters": { + "resource": { + "description": "REQUIRED: The resource for which the policy is being requested.\n`resource` is usually specified as a path. For example, a Project\nresource is specified as `projects/{project}`.", + "required": true, + "pattern": "^projects/[^/]+/subscriptions/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1/{+resource}:getIamPolicy", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "pull": { + "id": "pubsub.projects.subscriptions.pull", + "response": { + "$ref": "PullResponse" + }, + "parameterOrder": [ + "subscription" + ], + "description": "Pulls messages from the server. Returns an empty list if there are no\nmessages available in the backlog. The server may return `UNAVAILABLE` if\nthere are too many concurrent pull requests pending for the given\nsubscription.", + "request": { + "$ref": "PullRequest" + }, + "flatPath": "v1/projects/{projectsId}/subscriptions/{subscriptionsId}:pull", + "httpMethod": "POST", + "parameters": { + "subscription": { + "description": "The subscription from which messages should be pulled.\nFormat is `projects/{project}/subscriptions/{sub}`.", + "required": true, + "pattern": "^projects/[^/]+/subscriptions/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1/{+subscription}:pull", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "list": { + "id": "pubsub.projects.subscriptions.list", + "response": { + "$ref": "ListSubscriptionsResponse" + }, + "parameterOrder": [ + "project" + ], + "description": "Lists matching subscriptions.", + "flatPath": "v1/projects/{projectsId}/subscriptions", + "httpMethod": "GET", + "parameters": { + "pageSize": { + "description": "Maximum number of subscriptions to return.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "project": { + "description": "The name of the cloud project that subscriptions belong to.\nFormat is `projects/{project}`.", + "required": true, + "pattern": "^projects/[^/]+$", + "location": "path", + "type": "string" + }, + "pageToken": { + "description": "The value returned by the last `ListSubscriptionsResponse`; indicates that\nthis is a continuation of a prior `ListSubscriptions` call, and that the\nsystem should return the next page of data.", + "location": "query", + "type": "string" + } + }, + "path": "v1/{+project}/subscriptions", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "get": { + "id": "pubsub.projects.subscriptions.get", + "response": { + "$ref": "Subscription" + }, + "parameterOrder": [ + "subscription" + ], + "description": "Gets the configuration details of a subscription.", + "flatPath": "v1/projects/{projectsId}/subscriptions/{subscriptionsId}", + "httpMethod": "GET", + "parameters": { + "subscription": { + "description": "The name of the subscription to get.\nFormat is `projects/{project}/subscriptions/{sub}`.", + "required": true, + "pattern": "^projects/[^/]+/subscriptions/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1/{+subscription}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "create": { + "id": "pubsub.projects.subscriptions.create", + "response": { + "$ref": "Subscription" + }, + "parameterOrder": [ + "name" + ], + "description": "Creates a subscription to a given topic.\nIf the subscription already exists, returns `ALREADY_EXISTS`.\nIf the corresponding topic doesn't exist, returns `NOT_FOUND`.\n\nIf the name is not provided in the request, the server will assign a random\nname for this subscription on the same project as the topic, conforming\nto the\n[resource name format](https://cloud.google.com/pubsub/docs/overview#names).\nThe generated name is populated in the returned Subscription object.\nNote that for REST API requests, you must specify a name in the request.", + "request": { + "$ref": "Subscription" + }, + "flatPath": "v1/projects/{projectsId}/subscriptions/{subscriptionsId}", + "httpMethod": "PUT", + "parameters": { + "name": { + "description": "The name of the subscription. It must have the format\n`\"projects/{project}/subscriptions/{subscription}\"`. `{subscription}` must\nstart with a letter, and contain only letters (`[A-Za-z]`), numbers\n(`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),\nplus (`+`) or percent signs (`%`). It must be between 3 and 255 characters\nin length, and it must not start with `\"goog\"`.", + "required": true, + "pattern": "^projects/[^/]+/subscriptions/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1/{+name}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "modifyAckDeadline": { + "id": "pubsub.projects.subscriptions.modifyAckDeadline", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "subscription" + ], + "description": "Modifies the ack deadline for a specific message. This method is useful\nto indicate that more time is needed to process a message by the\nsubscriber, or to make the message available for redelivery if the\nprocessing was interrupted. Note that this does not modify the\nsubscription-level `ackDeadlineSeconds` used for subsequent messages.", + "request": { + "$ref": "ModifyAckDeadlineRequest" + }, + "flatPath": "v1/projects/{projectsId}/subscriptions/{subscriptionsId}:modifyAckDeadline", + "httpMethod": "POST", + "parameters": { + "subscription": { + "description": "The name of the subscription.\nFormat is `projects/{project}/subscriptions/{sub}`.", + "required": true, + "pattern": "^projects/[^/]+/subscriptions/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1/{+subscription}:modifyAckDeadline", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "setIamPolicy": { + "id": "pubsub.projects.subscriptions.setIamPolicy", + "response": { + "$ref": "Policy" + }, + "parameterOrder": [ + "resource" + ], + "description": "Sets the access control policy on the specified resource. Replaces any\nexisting policy.", + "request": { + "$ref": "SetIamPolicyRequest" + }, + "flatPath": "v1/projects/{projectsId}/subscriptions/{subscriptionsId}:setIamPolicy", + "httpMethod": "POST", + "parameters": { + "resource": { + "description": "REQUIRED: The resource for which the policy is being specified.\n`resource` is usually specified as a path. For example, a Project\nresource is specified as `projects/{project}`.", + "required": true, + "pattern": "^projects/[^/]+/subscriptions/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1/{+resource}:setIamPolicy", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "delete": { + "id": "pubsub.projects.subscriptions.delete", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "subscription" + ], + "description": "Deletes an existing subscription. All messages retained in the subscription\nare immediately dropped. Calls to `Pull` after deletion will return\n`NOT_FOUND`. After a subscription is deleted, a new one may be created with\nthe same name, but the new one has no association with the old\nsubscription or its topic unless the same topic is specified.", + "flatPath": "v1/projects/{projectsId}/subscriptions/{subscriptionsId}", + "httpMethod": "DELETE", + "parameters": { + "subscription": { + "description": "The subscription to delete.\nFormat is `projects/{project}/subscriptions/{sub}`.", + "required": true, + "pattern": "^projects/[^/]+/subscriptions/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1/{+subscription}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "testIamPermissions": { + "id": "pubsub.projects.subscriptions.testIamPermissions", + "response": { + "$ref": "TestIamPermissionsResponse" + }, + "parameterOrder": [ + "resource" + ], + "description": "Returns permissions that a caller has on the specified resource.", + "request": { + "$ref": "TestIamPermissionsRequest" + }, + "flatPath": "v1/projects/{projectsId}/subscriptions/{subscriptionsId}:testIamPermissions", + "httpMethod": "POST", + "parameters": { + "resource": { + "description": "REQUIRED: The resource for which the policy detail is being requested.\n`resource` is usually specified as a path. For example, a Project\nresource is specified as `projects/{project}`.", + "required": true, + "pattern": "^projects/[^/]+/subscriptions/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1/{+resource}:testIamPermissions", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "acknowledge": { + "id": "pubsub.projects.subscriptions.acknowledge", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "subscription" + ], + "description": "Acknowledges the messages associated with the `ack_ids` in the\n`AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages\nfrom the subscription.\n\nAcknowledging a message whose ack deadline has expired may succeed,\nbut such a message may be redelivered later. Acknowledging a message more\nthan once will not result in an error.", + "request": { + "$ref": "AcknowledgeRequest" + }, + "flatPath": "v1/projects/{projectsId}/subscriptions/{subscriptionsId}:acknowledge", + "httpMethod": "POST", + "parameters": { + "subscription": { + "description": "The subscription whose message is being acknowledged.\nFormat is `projects/{project}/subscriptions/{sub}`.", + "required": true, + "pattern": "^projects/[^/]+/subscriptions/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1/{+subscription}:acknowledge", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + } } - }, - "parameterOrder": [ - "topic" - ], - "response": { - "$ref": "ListTopicSubscriptionsResponse" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - } - } - } - } - }, - "subscriptions": { - "methods": { - "setIamPolicy": { - "id": "pubsub.projects.subscriptions.setIamPolicy", - "path": "v1/{+resource}:setIamPolicy", - "httpMethod": "POST", - "description": "Sets the access control policy on the specified resource. Replaces any existing policy.", - "parameters": { - "resource": { - "type": "string", - "description": "REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `setIamPolicy` documentation.", - "required": true, - "pattern": "^projects/[^/]*/subscriptions/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "resource" - ], - "request": { - "$ref": "SetIamPolicyRequest" - }, - "response": { - "$ref": "Policy" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "getIamPolicy": { - "id": "pubsub.projects.subscriptions.getIamPolicy", - "path": "v1/{+resource}:getIamPolicy", - "httpMethod": "GET", - "description": "Gets the access control policy for a `resource`. Returns an empty policy if the resource exists and does not have a policy set.", - "parameters": { - "resource": { - "type": "string", - "description": "REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation.", - "required": true, - "pattern": "^projects/[^/]*/subscriptions/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "resource" - ], - "response": { - "$ref": "Policy" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "testIamPermissions": { - "id": "pubsub.projects.subscriptions.testIamPermissions", - "path": "v1/{+resource}:testIamPermissions", - "httpMethod": "POST", - "description": "Returns permissions that a caller has on the specified resource.", - "parameters": { - "resource": { - "type": "string", - "description": "REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `testIamPermissions` documentation.", - "required": true, - "pattern": "^projects/[^/]*/subscriptions/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "resource" - ], - "request": { - "$ref": "TestIamPermissionsRequest" - }, - "response": { - "$ref": "TestIamPermissionsResponse" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "create": { - "id": "pubsub.projects.subscriptions.create", - "path": "v1/{+name}", - "httpMethod": "PUT", - "description": "Creates a subscription to a given topic. If the subscription already exists, returns `ALREADY_EXISTS`. If the corresponding topic doesn't exist, returns `NOT_FOUND`. If the name is not provided in the request, the server will assign a random name for this subscription on the same project as the topic.", - "parameters": { - "name": { - "type": "string", - "description": "The name of the subscription. It must have the format `\"projects/{project}/subscriptions/{subscription}\"`. `{subscription}` must start with a letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in length, and it must not start with `\"goog\"`.", - "required": true, - "pattern": "^projects/[^/]*/subscriptions/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "name" - ], - "request": { - "$ref": "Subscription" - }, - "response": { - "$ref": "Subscription" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "get": { - "id": "pubsub.projects.subscriptions.get", - "path": "v1/{+subscription}", - "httpMethod": "GET", - "description": "Gets the configuration details of a subscription.", - "parameters": { - "subscription": { - "type": "string", - "description": "The name of the subscription to get.", - "required": true, - "pattern": "^projects/[^/]*/subscriptions/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "subscription" - ], - "response": { - "$ref": "Subscription" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "list": { - "id": "pubsub.projects.subscriptions.list", - "path": "v1/{+project}/subscriptions", - "httpMethod": "GET", - "description": "Lists matching subscriptions.", - "parameters": { - "project": { - "type": "string", - "description": "The name of the cloud project that subscriptions belong to.", - "required": true, - "pattern": "^projects/[^/]*$", - "location": "path" }, - "pageSize": { - "type": "integer", - "description": "Maximum number of subscriptions to return.", - "format": "int32", - "location": "query" + "topics": { + "resources": { + "subscriptions": { + "methods": { + "list": { + "id": "pubsub.projects.topics.subscriptions.list", + "response": { + "$ref": "ListTopicSubscriptionsResponse" + }, + "parameterOrder": [ + "topic" + ], + "description": "Lists the name of the subscriptions for this topic.", + "flatPath": "v1/projects/{projectsId}/topics/{topicsId}/subscriptions", + "httpMethod": "GET", + "parameters": { + "topic": { + "description": "The name of the topic that subscriptions are attached to.\nFormat is `projects/{project}/topics/{topic}`.", + "required": true, + "pattern": "^projects/[^/]+/topics/[^/]+$", + "location": "path", + "type": "string" + }, + "pageSize": { + "description": "Maximum number of subscription names to return.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "pageToken": { + "description": "The value returned by the last `ListTopicSubscriptionsResponse`; indicates\nthat this is a continuation of a prior `ListTopicSubscriptions` call, and\nthat the system should return the next page of data.", + "location": "query", + "type": "string" + } + }, + "path": "v1/{+topic}/subscriptions", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + } + } + } + }, + "methods": { + "getIamPolicy": { + "id": "pubsub.projects.topics.getIamPolicy", + "response": { + "$ref": "Policy" + }, + "parameterOrder": [ + "resource" + ], + "description": "Gets the access control policy for a resource.\nReturns an empty policy if the resource exists and does not have a policy\nset.", + "flatPath": "v1/projects/{projectsId}/topics/{topicsId}:getIamPolicy", + "httpMethod": "GET", + "parameters": { + "resource": { + "description": "REQUIRED: The resource for which the policy is being requested.\n`resource` is usually specified as a path. For example, a Project\nresource is specified as `projects/{project}`.", + "required": true, + "pattern": "^projects/[^/]+/topics/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1/{+resource}:getIamPolicy", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "publish": { + "id": "pubsub.projects.topics.publish", + "response": { + "$ref": "PublishResponse" + }, + "parameterOrder": [ + "topic" + ], + "description": "Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic\ndoes not exist. The message payload must not be empty; it must contain\n either a non-empty data field, or at least one attribute.", + "request": { + "$ref": "PublishRequest" + }, + "flatPath": "v1/projects/{projectsId}/topics/{topicsId}:publish", + "httpMethod": "POST", + "parameters": { + "topic": { + "description": "The messages in the request will be published on this topic.\nFormat is `projects/{project}/topics/{topic}`.", + "required": true, + "pattern": "^projects/[^/]+/topics/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1/{+topic}:publish", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "list": { + "id": "pubsub.projects.topics.list", + "response": { + "$ref": "ListTopicsResponse" + }, + "parameterOrder": [ + "project" + ], + "description": "Lists matching topics.", + "flatPath": "v1/projects/{projectsId}/topics", + "httpMethod": "GET", + "parameters": { + "pageSize": { + "description": "Maximum number of topics to return.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "project": { + "description": "The name of the cloud project that topics belong to.\nFormat is `projects/{project}`.", + "required": true, + "pattern": "^projects/[^/]+$", + "location": "path", + "type": "string" + }, + "pageToken": { + "description": "The value returned by the last `ListTopicsResponse`; indicates that this is\na continuation of a prior `ListTopics` call, and that the system should\nreturn the next page of data.", + "location": "query", + "type": "string" + } + }, + "path": "v1/{+project}/topics", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "get": { + "id": "pubsub.projects.topics.get", + "response": { + "$ref": "Topic" + }, + "parameterOrder": [ + "topic" + ], + "description": "Gets the configuration of a topic.", + "flatPath": "v1/projects/{projectsId}/topics/{topicsId}", + "httpMethod": "GET", + "parameters": { + "topic": { + "description": "The name of the topic to get.\nFormat is `projects/{project}/topics/{topic}`.", + "required": true, + "pattern": "^projects/[^/]+/topics/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1/{+topic}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "create": { + "id": "pubsub.projects.topics.create", + "response": { + "$ref": "Topic" + }, + "parameterOrder": [ + "name" + ], + "description": "Creates the given topic with the given name.", + "request": { + "$ref": "Topic" + }, + "flatPath": "v1/projects/{projectsId}/topics/{topicsId}", + "httpMethod": "PUT", + "parameters": { + "name": { + "description": "The name of the topic. It must have the format\n`\"projects/{project}/topics/{topic}\"`. `{topic}` must start with a letter,\nand contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`),\nunderscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent\nsigns (`%`). It must be between 3 and 255 characters in length, and it\nmust not start with `\"goog\"`.", + "required": true, + "pattern": "^projects/[^/]+/topics/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1/{+name}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "setIamPolicy": { + "id": "pubsub.projects.topics.setIamPolicy", + "response": { + "$ref": "Policy" + }, + "parameterOrder": [ + "resource" + ], + "description": "Sets the access control policy on the specified resource. Replaces any\nexisting policy.", + "request": { + "$ref": "SetIamPolicyRequest" + }, + "flatPath": "v1/projects/{projectsId}/topics/{topicsId}:setIamPolicy", + "httpMethod": "POST", + "parameters": { + "resource": { + "description": "REQUIRED: The resource for which the policy is being specified.\n`resource` is usually specified as a path. For example, a Project\nresource is specified as `projects/{project}`.", + "required": true, + "pattern": "^projects/[^/]+/topics/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1/{+resource}:setIamPolicy", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "delete": { + "id": "pubsub.projects.topics.delete", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "topic" + ], + "description": "Deletes the topic with the given name. Returns `NOT_FOUND` if the topic\ndoes not exist. After a topic is deleted, a new topic may be created with\nthe same name; this is an entirely new topic with none of the old\nconfiguration or subscriptions. Existing subscriptions to this topic are\nnot deleted, but their `topic` field is set to `_deleted-topic_`.", + "flatPath": "v1/projects/{projectsId}/topics/{topicsId}", + "httpMethod": "DELETE", + "parameters": { + "topic": { + "description": "Name of the topic to delete.\nFormat is `projects/{project}/topics/{topic}`.", + "required": true, + "pattern": "^projects/[^/]+/topics/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1/{+topic}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "testIamPermissions": { + "id": "pubsub.projects.topics.testIamPermissions", + "response": { + "$ref": "TestIamPermissionsResponse" + }, + "parameterOrder": [ + "resource" + ], + "description": "Returns permissions that a caller has on the specified resource.", + "request": { + "$ref": "TestIamPermissionsRequest" + }, + "flatPath": "v1/projects/{projectsId}/topics/{topicsId}:testIamPermissions", + "httpMethod": "POST", + "parameters": { + "resource": { + "description": "REQUIRED: The resource for which the policy detail is being requested.\n`resource` is usually specified as a path. For example, a Project\nresource is specified as `projects/{project}`.", + "required": true, + "pattern": "^projects/[^/]+/topics/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1/{+resource}:testIamPermissions", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + } + } }, - "pageToken": { - "type": "string", - "description": "The value returned by the last `ListSubscriptionsResponse`; indicates that this is a continuation of a prior `ListSubscriptions` call, and that the system should return the next page of data.", - "location": "query" + "snapshots": { + "methods": { + "testIamPermissions": { + "id": "pubsub.projects.snapshots.testIamPermissions", + "response": { + "$ref": "TestIamPermissionsResponse" + }, + "parameterOrder": [ + "resource" + ], + "description": "Returns permissions that a caller has on the specified resource.", + "request": { + "$ref": "TestIamPermissionsRequest" + }, + "flatPath": "v1/projects/{projectsId}/snapshots/{snapshotsId}:testIamPermissions", + "httpMethod": "POST", + "parameters": { + "resource": { + "description": "REQUIRED: The resource for which the policy detail is being requested.\n`resource` is usually specified as a path. For example, a Project\nresource is specified as `projects/{project}`.", + "required": true, + "pattern": "^projects/[^/]+/snapshots/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1/{+resource}:testIamPermissions", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "setIamPolicy": { + "id": "pubsub.projects.snapshots.setIamPolicy", + "response": { + "$ref": "Policy" + }, + "parameterOrder": [ + "resource" + ], + "description": "Sets the access control policy on the specified resource. Replaces any\nexisting policy.", + "request": { + "$ref": "SetIamPolicyRequest" + }, + "flatPath": "v1/projects/{projectsId}/snapshots/{snapshotsId}:setIamPolicy", + "httpMethod": "POST", + "parameters": { + "resource": { + "description": "REQUIRED: The resource for which the policy is being specified.\n`resource` is usually specified as a path. For example, a Project\nresource is specified as `projects/{project}`.", + "required": true, + "pattern": "^projects/[^/]+/snapshots/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1/{+resource}:setIamPolicy", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "getIamPolicy": { + "id": "pubsub.projects.snapshots.getIamPolicy", + "response": { + "$ref": "Policy" + }, + "parameterOrder": [ + "resource" + ], + "description": "Gets the access control policy for a resource.\nReturns an empty policy if the resource exists and does not have a policy\nset.", + "flatPath": "v1/projects/{projectsId}/snapshots/{snapshotsId}:getIamPolicy", + "httpMethod": "GET", + "parameters": { + "resource": { + "description": "REQUIRED: The resource for which the policy is being requested.\n`resource` is usually specified as a path. For example, a Project\nresource is specified as `projects/{project}`.", + "required": true, + "pattern": "^projects/[^/]+/snapshots/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1/{+resource}:getIamPolicy", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + } + } } - }, - "parameterOrder": [ - "project" - ], - "response": { - "$ref": "ListSubscriptionsResponse" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "delete": { - "id": "pubsub.projects.subscriptions.delete", - "path": "v1/{+subscription}", - "httpMethod": "DELETE", - "description": "Deletes an existing subscription. All pending messages in the subscription are immediately dropped. Calls to `Pull` after deletion will return `NOT_FOUND`. After a subscription is deleted, a new one may be created with the same name, but the new one has no association with the old subscription, or its topic unless the same topic is specified.", - "parameters": { - "subscription": { - "type": "string", - "description": "The subscription to delete.", - "required": true, - "pattern": "^projects/[^/]*/subscriptions/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "subscription" - ], - "response": { - "$ref": "Empty" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "modifyAckDeadline": { - "id": "pubsub.projects.subscriptions.modifyAckDeadline", - "path": "v1/{+subscription}:modifyAckDeadline", - "httpMethod": "POST", - "description": "Modifies the ack deadline for a specific message. This method is useful to indicate that more time is needed to process a message by the subscriber, or to make the message available for redelivery if the processing was interrupted.", - "parameters": { - "subscription": { - "type": "string", - "description": "The name of the subscription.", - "required": true, - "pattern": "^projects/[^/]*/subscriptions/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "subscription" - ], - "request": { - "$ref": "ModifyAckDeadlineRequest" - }, - "response": { - "$ref": "Empty" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "acknowledge": { - "id": "pubsub.projects.subscriptions.acknowledge", - "path": "v1/{+subscription}:acknowledge", - "httpMethod": "POST", - "description": "Acknowledges the messages associated with the `ack_ids` in the `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages from the subscription. Acknowledging a message whose ack deadline has expired may succeed, but such a message may be redelivered later. Acknowledging a message more than once will not result in an error.", - "parameters": { - "subscription": { - "type": "string", - "description": "The subscription whose message is being acknowledged.", - "required": true, - "pattern": "^projects/[^/]*/subscriptions/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "subscription" - ], - "request": { - "$ref": "AcknowledgeRequest" - }, - "response": { - "$ref": "Empty" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "pull": { - "id": "pubsub.projects.subscriptions.pull", - "path": "v1/{+subscription}:pull", - "httpMethod": "POST", - "description": "Pulls messages from the server. Returns an empty list if there are no messages available in the backlog. The server may return `UNAVAILABLE` if there are too many concurrent pull requests pending for the given subscription.", - "parameters": { - "subscription": { - "type": "string", - "description": "The subscription from which messages should be pulled.", - "required": true, - "pattern": "^projects/[^/]*/subscriptions/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "subscription" - ], - "request": { - "$ref": "PullRequest" - }, - "response": { - "$ref": "PullResponse" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "modifyPushConfig": { - "id": "pubsub.projects.subscriptions.modifyPushConfig", - "path": "v1/{+subscription}:modifyPushConfig", - "httpMethod": "POST", - "description": "Modifies the `PushConfig` for a specified subscription. This may be used to change a push subscription to a pull one (signified by an empty `PushConfig`) or vice versa, or change the endpoint URL and other attributes of a push subscription. Messages will accumulate for delivery continuously through the call regardless of changes to the `PushConfig`.", - "parameters": { - "subscription": { - "type": "string", - "description": "The name of the subscription.", - "required": true, - "pattern": "^projects/[^/]*/subscriptions/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "subscription" - ], - "request": { - "$ref": "ModifyPushConfigRequest" - }, - "response": { - "$ref": "Empty" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] } - } } - } - } - } + }, + "schemas": { + "Topic": { + "description": "A topic resource.", + "type": "object", + "properties": { + "name": { + "description": "The name of the topic. It must have the format\n`\"projects/{project}/topics/{topic}\"`. `{topic}` must start with a letter,\nand contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`),\nunderscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent\nsigns (`%`). It must be between 3 and 255 characters in length, and it\nmust not start with `\"goog\"`.", + "type": "string" + } + }, + "id": "Topic" + }, + "SetIamPolicyRequest": { + "description": "Request message for `SetIamPolicy` method.", + "type": "object", + "properties": { + "policy": { + "description": "REQUIRED: The complete policy to be applied to the `resource`. The size of\nthe policy is limited to a few 10s of KB. An empty policy is a\nvalid policy but certain Cloud Platform services (such as Projects)\nmight reject them.", + "$ref": "Policy" + } + }, + "id": "SetIamPolicyRequest" + }, + "ReceivedMessage": { + "description": "A message and its corresponding acknowledgment ID.", + "type": "object", + "properties": { + "ackId": { + "description": "This ID can be used to acknowledge the received message.", + "type": "string" + }, + "message": { + "description": "The message.", + "$ref": "PubsubMessage" + } + }, + "id": "ReceivedMessage" + }, + "PublishRequest": { + "description": "Request for the Publish method.", + "type": "object", + "properties": { + "messages": { + "description": "The messages to publish.", + "type": "array", + "items": { + "$ref": "PubsubMessage" + } + } + }, + "id": "PublishRequest" + }, + "TestIamPermissionsResponse": { + "description": "Response message for `TestIamPermissions` method.", + "type": "object", + "properties": { + "permissions": { + "description": "A subset of `TestPermissionsRequest.permissions` that the caller is\nallowed.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "id": "TestIamPermissionsResponse" + }, + "PublishResponse": { + "description": "Response for the `Publish` method.", + "type": "object", + "properties": { + "messageIds": { + "description": "The server-assigned ID of each published message, in the same order as\nthe messages in the request. IDs are guaranteed to be unique within\nthe topic.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "id": "PublishResponse" + }, + "ListSubscriptionsResponse": { + "description": "Response for the `ListSubscriptions` method.", + "type": "object", + "properties": { + "subscriptions": { + "description": "The subscriptions that match the request.", + "type": "array", + "items": { + "$ref": "Subscription" + } + }, + "nextPageToken": { + "description": "If not empty, indicates that there may be more subscriptions that match\nthe request; this value should be passed in a new\n`ListSubscriptionsRequest` to get more subscriptions.", + "type": "string" + } + }, + "id": "ListSubscriptionsResponse" + }, + "Policy": { + "description": "Defines an Identity and Access Management (IAM) policy. It is used to\nspecify access control policies for Cloud Platform resources.\n\n\nA `Policy` consists of a list of `bindings`. A `Binding` binds a list of\n`members` to a `role`, where the members can be user accounts, Google groups,\nGoogle domains, and service accounts. A `role` is a named list of permissions\ndefined by IAM.\n\n**Example**\n\n {\n \"bindings\": [\n {\n \"role\": \"roles/owner\",\n \"members\": [\n \"user:mike@example.com\",\n \"group:admins@example.com\",\n \"domain:google.com\",\n \"serviceAccount:my-other-app@appspot.gserviceaccount.com\",\n ]\n },\n {\n \"role\": \"roles/viewer\",\n \"members\": [\"user:sean@example.com\"]\n }\n ]\n }\n\nFor a description of IAM and its features, see the\n[IAM developer's guide](https://cloud.google.com/iam).", + "type": "object", + "properties": { + "bindings": { + "description": "Associates a list of `members` to a `role`.\nMultiple `bindings` must not be specified for the same `role`.\n`bindings` with no members will result in an error.", + "type": "array", + "items": { + "$ref": "Binding" + } + }, + "etag": { + "description": "`etag` is used for optimistic concurrency control as a way to help\nprevent simultaneous updates of a policy from overwriting each other.\nIt is strongly suggested that systems make use of the `etag` in the\nread-modify-write cycle to perform policy updates in order to avoid race\nconditions: An `etag` is returned in the response to `getIamPolicy`, and\nsystems are expected to put that etag in the request to `setIamPolicy` to\nensure that their change will be applied to the same version of the policy.\n\nIf no `etag` is provided in the call to `setIamPolicy`, then the existing\npolicy is overwritten blindly.", + "type": "string", + "format": "byte" + }, + "version": { + "description": "Version of the `Policy`. The default version is 0.", + "type": "integer", + "format": "int32" + } + }, + "id": "Policy" + }, + "ListTopicSubscriptionsResponse": { + "description": "Response for the `ListTopicSubscriptions` method.", + "type": "object", + "properties": { + "subscriptions": { + "description": "The names of the subscriptions that match the request.", + "type": "array", + "items": { + "type": "string" + } + }, + "nextPageToken": { + "description": "If not empty, indicates that there may be more subscriptions that match\nthe request; this value should be passed in a new\n`ListTopicSubscriptionsRequest` to get more subscriptions.", + "type": "string" + } + }, + "id": "ListTopicSubscriptionsResponse" + }, + "Subscription": { + "description": "A subscription resource.", + "type": "object", + "properties": { + "pushConfig": { + "description": "If push delivery is used with this subscription, this field is\nused to configure it. An empty `pushConfig` signifies that the subscriber\nwill pull and ack messages using API methods.", + "$ref": "PushConfig" + }, + "topic": { + "description": "The name of the topic from which this subscription is receiving messages.\nFormat is `projects/{project}/topics/{topic}`.\nThe value of this field will be `_deleted-topic_` if the topic has been\ndeleted.", + "type": "string" + }, + "ackDeadlineSeconds": { + "description": "This value is the maximum time after a subscriber receives a message\nbefore the subscriber should acknowledge the message. After message\ndelivery but before the ack deadline expires and before the message is\nacknowledged, it is an outstanding message and will not be delivered\nagain during that time (on a best-effort basis).\n\nFor pull subscriptions, this value is used as the initial value for the ack\ndeadline. To override this value for a given message, call\n`ModifyAckDeadline` with the corresponding `ack_id` if using\npull.\nThe minimum custom deadline you can specify is 10 seconds.\nThe maximum custom deadline you can specify is 600 seconds (10 minutes).\nIf this parameter is 0, a default value of 10 seconds is used.\n\nFor push delivery, this value is also used to set the request timeout for\nthe call to the push endpoint.\n\nIf the subscriber never acknowledges the message, the Pub/Sub\nsystem will eventually redeliver the message.", + "type": "integer", + "format": "int32" + }, + "name": { + "description": "The name of the subscription. It must have the format\n`\"projects/{project}/subscriptions/{subscription}\"`. `{subscription}` must\nstart with a letter, and contain only letters (`[A-Za-z]`), numbers\n(`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),\nplus (`+`) or percent signs (`%`). It must be between 3 and 255 characters\nin length, and it must not start with `\"goog\"`.", + "type": "string" + } + }, + "id": "Subscription" + }, + "ModifyAckDeadlineRequest": { + "description": "Request for the ModifyAckDeadline method.", + "type": "object", + "properties": { + "ackDeadlineSeconds": { + "description": "The new ack deadline with respect to the time this request was sent to\nthe Pub/Sub system. Must be \u003e= 0. For example, if the value is 10, the new\nack deadline will expire 10 seconds after the `ModifyAckDeadline` call\nwas made. Specifying zero may immediately make the message available for\nanother pull request.", + "type": "integer", + "format": "int32" + }, + "ackIds": { + "description": "List of acknowledgment IDs.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "id": "ModifyAckDeadlineRequest" + }, + "TestIamPermissionsRequest": { + "description": "Request message for `TestIamPermissions` method.", + "type": "object", + "properties": { + "permissions": { + "description": "The set of permissions to check for the `resource`. Permissions with\nwildcards (such as '*' or 'storage.*') are not allowed. For more\ninformation see\n[IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).", + "type": "array", + "items": { + "type": "string" + } + } + }, + "id": "TestIamPermissionsRequest" + }, + "PushConfig": { + "description": "Configuration for a push delivery endpoint.", + "type": "object", + "properties": { + "attributes": { + "description": "Endpoint configuration attributes.\n\nEvery endpoint has a set of API supported attributes that can be used to\ncontrol different aspects of the message delivery.\n\nThe currently supported attribute is `x-goog-version`, which you can\nuse to change the format of the push message. This attribute\nindicates the version of the data expected by the endpoint. This\ncontrols the shape of the envelope (i.e. its fields and metadata).\nThe endpoint version is based on the version of the Pub/Sub\nAPI.\n\nIf not present during the `CreateSubscription` call, it will default to\nthe version of the API used to make such call. If not present during a\n`ModifyPushConfig` call, its value will not be changed. `GetSubscription`\ncalls will always return a valid version, even if the subscription was\ncreated without this attribute.\n\nThe possible values for this attribute are:\n\n* `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.\n* `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.", + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + "pushEndpoint": { + "description": "A URL locating the endpoint to which messages should be pushed.\nFor example, a Webhook endpoint might use \"https://example.com/push\".", + "type": "string" + } + }, + "id": "PushConfig" + }, + "PullRequest": { + "description": "Request for the `Pull` method.", + "type": "object", + "properties": { + "returnImmediately": { + "description": "If this is specified as true the system will respond immediately even if\nit is not able to return a message in the `Pull` response. Otherwise the\nsystem is allowed to wait until at least one message is available rather\nthan returning no messages. The client may cancel the request if it does\nnot wish to wait any longer for the response.", + "type": "boolean" + }, + "maxMessages": { + "description": "The maximum number of messages returned for this request. The Pub/Sub\nsystem may return fewer than the number specified.", + "type": "integer", + "format": "int32" + } + }, + "id": "PullRequest" + }, + "ModifyPushConfigRequest": { + "description": "Request for the ModifyPushConfig method.", + "type": "object", + "properties": { + "pushConfig": { + "description": "The push configuration for future deliveries.\n\nAn empty `pushConfig` indicates that the Pub/Sub system should\nstop pushing messages from the given subscription and allow\nmessages to be pulled and acknowledged - effectively pausing\nthe subscription if `Pull` is not called.", + "$ref": "PushConfig" + } + }, + "id": "ModifyPushConfigRequest" + }, + "PullResponse": { + "description": "Response for the `Pull` method.", + "type": "object", + "properties": { + "receivedMessages": { + "description": "Received Pub/Sub messages. The Pub/Sub system will return zero messages if\nthere are no more available in the backlog. The Pub/Sub system may return\nfewer than the `maxMessages` requested even if there are more messages\navailable in the backlog.", + "type": "array", + "items": { + "$ref": "ReceivedMessage" + } + } + }, + "id": "PullResponse" + }, + "PubsubMessage": { + "description": "A message data and its attributes. The message payload must not be empty;\nit must contain either a non-empty data field, or at least one attribute.", + "type": "object", + "properties": { + "data": { + "description": "The message payload.", + "type": "string", + "format": "byte" + }, + "attributes": { + "description": "Optional attributes for this message.", + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + "messageId": { + "description": "ID of this message, assigned by the server when the message is published.\nGuaranteed to be unique within the topic. This value may be read by a\nsubscriber that receives a `PubsubMessage` via a `Pull` call or a push\ndelivery. It must not be populated by the publisher in a `Publish` call.", + "type": "string" + }, + "publishTime": { + "description": "The time at which the message was published, populated by the server when\nit receives the `Publish` call. It must not be populated by the\npublisher in a `Publish` call.", + "type": "string", + "format": "google-datetime" + } + }, + "id": "PubsubMessage" + }, + "AcknowledgeRequest": { + "description": "Request for the Acknowledge method.", + "type": "object", + "properties": { + "ackIds": { + "description": "The acknowledgment ID for the messages being acknowledged that was returned\nby the Pub/Sub system in the `Pull` response. Must not be empty.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "id": "AcknowledgeRequest" + }, + "Empty": { + "description": "A generic empty message that you can re-use to avoid defining duplicated\nempty messages in your APIs. A typical example is to use it as the request\nor the response type of an API method. For instance:\n\n service Foo {\n rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);\n }\n\nThe JSON representation for `Empty` is empty JSON object `{}`.", + "type": "object", + "properties": {}, + "id": "Empty" + }, + "ListTopicsResponse": { + "description": "Response for the `ListTopics` method.", + "type": "object", + "properties": { + "nextPageToken": { + "description": "If not empty, indicates that there may be more topics that match the\nrequest; this value should be passed in a new `ListTopicsRequest`.", + "type": "string" + }, + "topics": { + "description": "The resulting topics.", + "type": "array", + "items": { + "$ref": "Topic" + } + } + }, + "id": "ListTopicsResponse" + }, + "Binding": { + "description": "Associates `members` with a `role`.", + "type": "object", + "properties": { + "members": { + "description": "Specifies the identities requesting access for a Cloud Platform resource.\n`members` can have the following values:\n\n* `allUsers`: A special identifier that represents anyone who is\n on the internet; with or without a Google account.\n\n* `allAuthenticatedUsers`: A special identifier that represents anyone\n who is authenticated with a Google account or a service account.\n\n* `user:{emailid}`: An email address that represents a specific Google\n account. For example, `alice@gmail.com` or `joe@example.com`.\n\n\n* `serviceAccount:{emailid}`: An email address that represents a service\n account. For example, `my-other-app@appspot.gserviceaccount.com`.\n\n* `group:{emailid}`: An email address that represents a Google group.\n For example, `admins@example.com`.\n\n* `domain:{domain}`: A Google Apps domain name that represents all the\n users of that domain. For example, `google.com` or `example.com`.\n\n", + "type": "array", + "items": { + "type": "string" + } + }, + "role": { + "description": "Role that is assigned to `members`.\nFor example, `roles/viewer`, `roles/editor`, or `roles/owner`.\nRequired", + "type": "string" + } + }, + "id": "Binding" + } + }, + "revision": "20161122", + "basePath": "", + "icons": { + "x32": "http://www.google.com/images/icons/product/search-32.gif", + "x16": "http://www.google.com/images/icons/product/search-16.gif" + }, + "discoveryVersion": "v1", + "baseUrl": "https://pubsub.googleapis.com/", + "name": "pubsub", + "parameters": { + "access_token": { + "description": "OAuth access token.", + "type": "string", + "location": "query" + }, + "prettyPrint": { + "description": "Returns response with indentations and line breaks.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "key": { + "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", + "type": "string", + "location": "query" + }, + "quotaUser": { + "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.", + "type": "string", + "location": "query" + }, + "pp": { + "description": "Pretty-print response.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "fields": { + "description": "Selector specifying which fields to include in a partial response.", + "type": "string", + "location": "query" + }, + "alt": { + "description": "Data format for response.", + "location": "query", + "enum": [ + "json", + "media", + "proto" + ], + "default": "json", + "enumDescriptions": [ + "Responses with Content-Type of application/json", + "Media download with context-dependent Content-Type", + "Responses with Content-Type of application/x-protobuf" + ], + "type": "string" + }, + "$.xgafv": { + "description": "V1 error format.", + "enum": [ + "1", + "2" + ], + "enumDescriptions": [ + "v1 error format", + "v2 error format" + ], + "type": "string", + "location": "query" + }, + "callback": { + "description": "JSONP", + "type": "string", + "location": "query" + }, + "oauth_token": { + "description": "OAuth 2.0 token for the current user.", + "type": "string", + "location": "query" + }, + "uploadType": { + "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").", + "type": "string", + "location": "query" + }, + "bearer_token": { + "description": "OAuth bearer token.", + "type": "string", + "location": "query" + }, + "upload_protocol": { + "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").", + "type": "string", + "location": "query" + } + }, + "documentationLink": "https://cloud.google.com/pubsub/docs", + "ownerDomain": "google.com", + "batchPath": "batch", + "servicePath": "", + "ownerName": "Google", + "version": "v1", + "rootUrl": "https://pubsub.googleapis.com/", + "kind": "discovery#restDescription" } diff --git a/etc/api/pubsub/v1beta1a/pubsub-api.json b/etc/api/pubsub/v1beta1a/pubsub-api.json index 727a8d6b89..0bfed50829 100644 --- a/etc/api/pubsub/v1beta1a/pubsub-api.json +++ b/etc/api/pubsub/v1beta1a/pubsub-api.json @@ -1,762 +1,806 @@ { - "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/3hphN7YPNWxdqtNsR-OsHOV5JBk\"", - "discoveryVersion": "v1", - "id": "pubsub:v1beta1a", - "name": "pubsub", - "version": "v1beta1a", - "revision": "20160317", - "title": "Google Cloud Pub/Sub API", - "description": "Provides reliable, many-to-many, asynchronous messaging between applications.", - "ownerDomain": "google.com", - "ownerName": "Google", - "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" - }, - "documentationLink": "https://cloud.google.com/pubsub/docs", - "protocol": "rest", - "baseUrl": "https://pubsub.googleapis.com/", - "basePath": "", - "rootUrl": "https://pubsub.googleapis.com/", - "servicePath": "", - "batchPath": "batch", - "parameters": { - "access_token": { - "type": "string", - "description": "OAuth access token.", - "location": "query" - }, - "alt": { - "type": "string", - "description": "Data format for response.", - "default": "json", - "enumDescriptions": [ - "Responses with Content-Type of application/json", - "Media download with context-dependent Content-Type", - "Responses with Content-Type of application/x-protobuf" - ], - "location": "query" - }, - "bearer_token": { - "type": "string", - "description": "OAuth bearer token.", - "location": "query" - }, - "callback": { - "type": "string", - "description": "JSONP", - "location": "query" - }, - "fields": { - "type": "string", - "description": "Selector specifying which fields to include in a partial response.", - "location": "query" - }, - "key": { - "type": "string", - "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", - "location": "query" - }, - "oauth_token": { - "type": "string", - "description": "OAuth 2.0 token for the current user.", - "location": "query" - }, - "pp": { - "type": "boolean", - "description": "Pretty-print response.", - "default": "true", - "location": "query" - }, - "prettyPrint": { - "type": "boolean", - "description": "Returns response with indentations and line breaks.", - "default": "true", - "location": "query" - }, - "quotaUser": { - "type": "string", - "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.", - "location": "query" - }, - "upload_protocol": { - "type": "string", - "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").", - "location": "query" - }, - "uploadType": { - "type": "string", - "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").", - "location": "query" - }, - "$.xgafv": { - "type": "string", - "description": "V1 error format.", - "enumDescriptions": [ - "v1 error format", - "v2 error format" - ], - "location": "query" - } - }, - "auth": { - "oauth2": { - "scopes": { - "https://www.googleapis.com/auth/cloud-platform": { - "description": "View and manage your data across Google Cloud Platform services" - }, - "https://www.googleapis.com/auth/pubsub": { - "description": "View and manage Pub/Sub topics and subscriptions" + "id": "pubsub:v1beta1a", + "auth": { + "oauth2": { + "scopes": { + "https://www.googleapis.com/auth/cloud-platform": { + "description": "View and manage your data across Google Cloud Platform services" + }, + "https://www.googleapis.com/auth/pubsub": { + "description": "View and manage Pub/Sub topics and subscriptions" + } + } } - } - } - }, - "schemas": { - "Topic": { - "id": "Topic", - "type": "object", - "description": "A topic resource.", - "properties": { - "name": { - "type": "string", - "description": "Name of the topic." - } - } }, - "PublishRequest": { - "id": "PublishRequest", - "type": "object", - "description": "Request for the Publish method.", - "properties": { - "topic": { - "type": "string", - "description": "The message in the request will be published on this topic." + "description": "Provides reliable, many-to-many, asynchronous messaging between applications.\n", + "protocol": "rest", + "title": "Google Cloud Pub/Sub API", + "resources": { + "subscriptions": { + "methods": { + "modifyPushConfig": { + "id": "pubsub.subscriptions.modifyPushConfig", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [], + "description": "Modifies the \u003ccode\u003ePushConfig\u003c/code\u003e for a specified subscription.\nThis method can be used to suspend the flow of messages to an endpoint\nby clearing the \u003ccode\u003ePushConfig\u003c/code\u003e field in the request. Messages\nwill be accumulated for delivery even if no push configuration is\ndefined or while the configuration is modified.", + "request": { + "$ref": "ModifyPushConfigRequest" + }, + "flatPath": "v1beta1a/subscriptions/modifyPushConfig", + "httpMethod": "POST", + "parameters": {}, + "path": "v1beta1a/subscriptions/modifyPushConfig", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "pull": { + "id": "pubsub.subscriptions.pull", + "response": { + "$ref": "PullResponse" + }, + "parameterOrder": [], + "description": "Pulls a single message from the server.\nIf return_immediately is true, and no messages are available in the\nsubscription, this method returns FAILED_PRECONDITION. The system is free\nto return an UNAVAILABLE error if no messages are available in a\nreasonable amount of time (to reduce system load).", + "request": { + "$ref": "PullRequest" + }, + "flatPath": "v1beta1a/subscriptions/pull", + "httpMethod": "POST", + "parameters": {}, + "path": "v1beta1a/subscriptions/pull", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "list": { + "id": "pubsub.subscriptions.list", + "response": { + "$ref": "ListSubscriptionsResponse" + }, + "parameterOrder": [], + "description": "Lists matching subscriptions.", + "flatPath": "v1beta1a/subscriptions", + "httpMethod": "GET", + "parameters": { + "query": { + "description": "A valid label query expression.", + "location": "query", + "type": "string" + }, + "maxResults": { + "description": "Maximum number of subscriptions to return.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "pageToken": { + "description": "The value obtained in the last \u003ccode\u003eListSubscriptionsResponse\u003c/code\u003e\nfor continuation.", + "location": "query", + "type": "string" + } + }, + "path": "v1beta1a/subscriptions", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "get": { + "id": "pubsub.subscriptions.get", + "response": { + "$ref": "Subscription" + }, + "parameterOrder": [ + "subscription" + ], + "description": "Gets the configuration details of a subscription.", + "flatPath": "v1beta1a/subscriptions/{subscriptionsId}", + "httpMethod": "GET", + "parameters": { + "subscription": { + "description": "The name of the subscription to get.", + "required": true, + "pattern": "^.+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1a/subscriptions/{+subscription}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "pullBatch": { + "id": "pubsub.subscriptions.pullBatch", + "response": { + "$ref": "PullBatchResponse" + }, + "parameterOrder": [], + "description": "Pulls messages from the server. Returns an empty list if there are no\nmessages available in the backlog. The system is free to return UNAVAILABLE\nif there are too many pull requests outstanding for the given subscription.", + "request": { + "$ref": "PullBatchRequest" + }, + "flatPath": "v1beta1a/subscriptions/pullBatch", + "httpMethod": "POST", + "parameters": {}, + "path": "v1beta1a/subscriptions/pullBatch", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "create": { + "id": "pubsub.subscriptions.create", + "response": { + "$ref": "Subscription" + }, + "parameterOrder": [], + "description": "Creates a subscription on a given topic for a given subscriber.\nIf the subscription already exists, returns ALREADY_EXISTS.\nIf the corresponding topic doesn't exist, returns NOT_FOUND.\n\nIf the name is not provided in the request, the server will assign a random\nname for this subscription on the same project as the topic.", + "request": { + "$ref": "Subscription" + }, + "flatPath": "v1beta1a/subscriptions", + "httpMethod": "POST", + "parameters": {}, + "path": "v1beta1a/subscriptions", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "modifyAckDeadline": { + "id": "pubsub.subscriptions.modifyAckDeadline", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [], + "description": "Modifies the Ack deadline for a message received from a pull request.", + "request": { + "$ref": "ModifyAckDeadlineRequest" + }, + "flatPath": "v1beta1a/subscriptions/modifyAckDeadline", + "httpMethod": "POST", + "parameters": {}, + "path": "v1beta1a/subscriptions/modifyAckDeadline", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "delete": { + "id": "pubsub.subscriptions.delete", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "subscription" + ], + "description": "Deletes an existing subscription. All pending messages in the subscription\nare immediately dropped. Calls to Pull after deletion will return\nNOT_FOUND.", + "flatPath": "v1beta1a/subscriptions/{subscriptionsId}", + "httpMethod": "DELETE", + "parameters": { + "subscription": { + "description": "The subscription to delete.", + "required": true, + "pattern": "^.+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1a/subscriptions/{+subscription}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "acknowledge": { + "id": "pubsub.subscriptions.acknowledge", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [], + "description": "Acknowledges a particular received message: the Pub/Sub system can remove\nthe given message from the subscription. Acknowledging a message whose\nAck deadline has expired may succeed, but the message could have been\nalready redelivered. Acknowledging a message more than once will not\nresult in an error. This is only used for messages received via pull.", + "request": { + "$ref": "AcknowledgeRequest" + }, + "flatPath": "v1beta1a/subscriptions/acknowledge", + "httpMethod": "POST", + "parameters": {}, + "path": "v1beta1a/subscriptions/acknowledge", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + } + } }, - "message": { - "$ref": "PubsubMessage", - "description": "The message to publish." + "topics": { + "methods": { + "publish": { + "id": "pubsub.topics.publish", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [], + "description": "Adds a message to the topic. Returns NOT_FOUND if the topic does not\nexist.", + "request": { + "$ref": "PublishRequest" + }, + "flatPath": "v1beta1a/topics/publish", + "httpMethod": "POST", + "parameters": {}, + "path": "v1beta1a/topics/publish", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "list": { + "id": "pubsub.topics.list", + "response": { + "$ref": "ListTopicsResponse" + }, + "parameterOrder": [], + "description": "Lists matching topics.", + "flatPath": "v1beta1a/topics", + "httpMethod": "GET", + "parameters": { + "query": { + "description": "A valid label query expression.", + "location": "query", + "type": "string" + }, + "maxResults": { + "description": "Maximum number of topics to return.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "pageToken": { + "description": "The value obtained in the last \u003ccode\u003eListTopicsResponse\u003c/code\u003e\nfor continuation.", + "location": "query", + "type": "string" + } + }, + "path": "v1beta1a/topics", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "get": { + "id": "pubsub.topics.get", + "response": { + "$ref": "Topic" + }, + "parameterOrder": [ + "topic" + ], + "description": "Gets the configuration of a topic. Since the topic only has the name\nattribute, this method is only useful to check the existence of a topic.\nIf other attributes are added in the future, they will be returned here.", + "flatPath": "v1beta1a/topics/{topicsId}", + "httpMethod": "GET", + "parameters": { + "topic": { + "description": "The name of the topic to get.", + "required": true, + "pattern": "^.+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1a/topics/{+topic}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "publishBatch": { + "id": "pubsub.topics.publishBatch", + "response": { + "$ref": "PublishBatchResponse" + }, + "parameterOrder": [], + "description": "Adds one or more messages to the topic. Returns NOT_FOUND if the topic does\nnot exist.", + "request": { + "$ref": "PublishBatchRequest" + }, + "flatPath": "v1beta1a/topics/publishBatch", + "httpMethod": "POST", + "parameters": {}, + "path": "v1beta1a/topics/publishBatch", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "create": { + "id": "pubsub.topics.create", + "response": { + "$ref": "Topic" + }, + "parameterOrder": [], + "description": "Creates the given topic with the given name.", + "request": { + "$ref": "Topic" + }, + "flatPath": "v1beta1a/topics", + "httpMethod": "POST", + "parameters": {}, + "path": "v1beta1a/topics", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "delete": { + "id": "pubsub.topics.delete", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "topic" + ], + "description": "Deletes the topic with the given name. Returns NOT_FOUND if the topic does\nnot exist. After a topic is deleted, a new topic may be created with the\nsame name.", + "flatPath": "v1beta1a/topics/{topicsId}", + "httpMethod": "DELETE", + "parameters": { + "topic": { + "description": "Name of the topic to delete.", + "required": true, + "pattern": "^.+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1a/topics/{+topic}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + } + } } - } }, - "PubsubMessage": { - "id": "PubsubMessage", - "type": "object", - "description": "A message data and its labels.", - "properties": { - "data": { - "type": "string", - "description": "The message payload.", - "format": "byte" + "schemas": { + "PullBatchResponse": { + "description": "Response for the PullBatch method.", + "type": "object", + "properties": { + "pullResponses": { + "description": "Received Pub/Sub messages or status events. The Pub/Sub system will return\nzero messages if there are no more messages available in the backlog. The\nPub/Sub system may return fewer than the max_events requested even if\nthere are more messages available in the backlog.", + "type": "array", + "items": { + "$ref": "PullResponse" + } + } + }, + "id": "PullBatchResponse" }, - "label": { - "type": "array", - "description": "Optional list of labels for this message. Keys in this collection must be unique.", - "items": { - "$ref": "Label" - } + "Topic": { + "description": "A topic resource.", + "type": "object", + "properties": { + "name": { + "description": "Name of the topic.", + "type": "string" + } + }, + "id": "Topic" }, - "messageId": { - "type": "string", - "description": "ID of this message assigned by the server at publication time. Guaranteed to be unique within the topic. This value may be read by a subscriber that receives a PubsubMessage via a Pull call or a push delivery. It must not be populated by a publisher in a Publish call." + "PublishBatchResponse": { + "description": "Response for the PublishBatch method.", + "type": "object", + "properties": { + "messageIds": { + "description": "The server-assigned ID of each published message, in the same order as\nthe messages in the request. IDs are guaranteed to be unique within\nthe topic.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "id": "PublishBatchResponse" }, - "publishTime": { - "type": "string", - "description": "The time at which the message was published. The time is milliseconds since the UNIX epoch.", - "format": "int64" + "PublishRequest": { + "description": "Request for the Publish method.", + "type": "object", + "properties": { + "topic": { + "description": "The message in the request will be published on this topic.", + "type": "string" + }, + "message": { + "description": "The message to publish.", + "$ref": "PubsubMessage" + } + }, + "id": "PublishRequest" + }, + "ListSubscriptionsResponse": { + "description": "Response for the ListSubscriptions method.", + "type": "object", + "properties": { + "nextPageToken": { + "description": "If not empty, indicates that there are more subscriptions that match the\nrequest and this value should be passed to the next\n\u003ccode\u003eListSubscriptionsRequest\u003c/code\u003e to continue.", + "type": "string" + }, + "subscription": { + "description": "The subscriptions that match the request.", + "type": "array", + "items": { + "$ref": "Subscription" + } + } + }, + "id": "ListSubscriptionsResponse" + }, + "Subscription": { + "description": "A subscription resource.", + "type": "object", + "properties": { + "pushConfig": { + "description": "If push delivery is used with this subscription, this field is\nused to configure it.", + "$ref": "PushConfig" + }, + "topic": { + "description": "The name of the topic from which this subscription is receiving messages.", + "type": "string" + }, + "ackDeadlineSeconds": { + "description": "For either push or pull delivery, the value is the maximum time after a\nsubscriber receives a message before the subscriber should acknowledge or\nNack the message. If the Ack deadline for a message passes without an\nAck or a Nack, the Pub/Sub system will eventually redeliver the message.\nIf a subscriber acknowledges after the deadline, the Pub/Sub system may\naccept the Ack, but it is possible that the message has been already\ndelivered again. Multiple Acks to the message are allowed and will\nsucceed.\n\nFor push delivery, this value is used to set the request timeout for\nthe call to the push endpoint.\n\nFor pull delivery, this value is used as the initial value for the Ack\ndeadline. It may be overridden for each message using its corresponding\nack_id with \u003ccode\u003eModifyAckDeadline\u003c/code\u003e.\nWhile a message is outstanding (i.e. it has been delivered to a pull\nsubscriber and the subscriber has not yet Acked or Nacked), the Pub/Sub\nsystem will not deliver that message to another pull subscriber\n(on a best-effort basis).", + "type": "integer", + "format": "int32" + }, + "name": { + "description": "Name of the subscription.", + "type": "string" + } + }, + "id": "Subscription" + }, + "Label": { + "description": "A key-value pair applied to a given object.", + "type": "object", + "properties": { + "strValue": { + "description": "A string value.", + "type": "string" + }, + "key": { + "description": "The key of a label is a syntactically valid URL (as per RFC 1738) with\nthe \"scheme\" and initial slashes omitted and with the additional\nrestrictions noted below. Each key should be globally unique. The\n\"host\" portion is called the \"namespace\" and is not necessarily\nresolvable to a network endpoint. Instead, the namespace indicates what\nsystem or entity defines the semantics of the label. Namespaces do not\nrestrict the set of objects to which a label may be associated.\n\nKeys are defined by the following grammar:\n\n key = hostname \"/\" kpath\n kpath = ksegment *[ \"/\" ksegment ]\n ksegment = alphadigit | *[ alphadigit | \"-\" | \"_\" | \".\" ]\n\nwhere \"hostname\" and \"alphadigit\" are defined as in RFC 1738.\n\nExample key:\n spanner.google.com/universe", + "type": "string" + }, + "numValue": { + "description": "An integer value.", + "type": "string", + "format": "int64" + } + }, + "id": "Label" + }, + "ModifyAckDeadlineRequest": { + "description": "Request for the ModifyAckDeadline method.", + "type": "object", + "properties": { + "ackDeadlineSeconds": { + "description": "The new ack deadline with respect to the time this request was sent to the\nPub/Sub system. Must be \u003e= 0. For example, if the value is 10, the new ack\ndeadline will expire 10 seconds after the ModifyAckDeadline call was made.\nSpecifying zero may immediately make the message available for another pull\nrequest.", + "type": "integer", + "format": "int32" + }, + "ackId": { + "description": "The acknowledgment ID. Either this or ack_ids must be populated,\nnot both.", + "type": "string" + }, + "subscription": { + "description": "Next Index: 5\nThe name of the subscription from which messages are being pulled.", + "type": "string" + }, + "ackIds": { + "description": "List of acknowledgment IDs. Either this field or ack_id\nshould be populated, not both.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "id": "ModifyAckDeadlineRequest" + }, + "PushConfig": { + "description": "Configuration for a push delivery endpoint.", + "type": "object", + "properties": { + "pushEndpoint": { + "description": "A URL locating the endpoint to which messages should be pushed.\nFor example, a Webhook endpoint might use \"https://example.com/push\".", + "type": "string" + } + }, + "id": "PushConfig" + }, + "PullRequest": { + "description": "Request for the Pull method.", + "type": "object", + "properties": { + "returnImmediately": { + "description": "If this is specified as true the system will respond immediately even if\nit is not able to return a message in the Pull response. Otherwise the\nsystem is allowed to wait until at least one message is available rather\nthan returning FAILED_PRECONDITION. The client may cancel the request if\nit does not wish to wait any longer for the response.", + "type": "boolean" + }, + "subscription": { + "description": "The subscription from which a message should be pulled.", + "type": "string" + } + }, + "id": "PullRequest" + }, + "ModifyPushConfigRequest": { + "description": "Request for the ModifyPushConfig method.", + "type": "object", + "properties": { + "pushConfig": { + "description": "An empty \u003ccode\u003epush_config\u003c/code\u003e indicates that the Pub/Sub system should\npause pushing messages from the given subscription.", + "$ref": "PushConfig" + }, + "subscription": { + "description": "The name of the subscription.", + "type": "string" + } + }, + "id": "ModifyPushConfigRequest" + }, + "PullResponse": { + "description": "Either a \u003ccode\u003ePubsubMessage\u003c/code\u003e or a truncation event. One of these two\nmust be populated.", + "type": "object", + "properties": { + "pubsubEvent": { + "description": "A pubsub message or truncation event.", + "$ref": "PubsubEvent" + }, + "ackId": { + "description": "This ID must be used to acknowledge the received event or message.", + "type": "string" + } + }, + "id": "PullResponse" + }, + "PubsubMessage": { + "description": "A message data and its labels.", + "type": "object", + "properties": { + "data": { + "description": "The message payload.", + "type": "string", + "format": "byte" + }, + "messageId": { + "description": "ID of this message assigned by the server at publication time. Guaranteed\nto be unique within the topic. This value may be read by a subscriber\nthat receives a PubsubMessage via a Pull call or a push delivery. It must\nnot be populated by a publisher in a Publish call.", + "type": "string" + }, + "publishTime": { + "description": "The time at which the message was published.\nThe time is milliseconds since the UNIX epoch.", + "type": "string", + "format": "int64" + }, + "label": { + "description": "Optional list of labels for this message. Keys in this collection must\nbe unique.", + "type": "array", + "items": { + "$ref": "Label" + } + } + }, + "id": "PubsubMessage" + }, + "PublishBatchRequest": { + "description": "Request for the PublishBatch method.", + "type": "object", + "properties": { + "topic": { + "description": "The messages in the request will be published on this topic.", + "type": "string" + }, + "messages": { + "description": "The messages to publish.", + "type": "array", + "items": { + "$ref": "PubsubMessage" + } + } + }, + "id": "PublishBatchRequest" + }, + "AcknowledgeRequest": { + "description": "Request for the Acknowledge method.", + "type": "object", + "properties": { + "ackId": { + "description": "The acknowledgment ID for the message being acknowledged. This was\nreturned by the Pub/Sub system in the Pull response.", + "type": "array", + "items": { + "type": "string" + } + }, + "subscription": { + "description": "The subscription whose message is being acknowledged.", + "type": "string" + } + }, + "id": "AcknowledgeRequest" + }, + "Empty": { + "description": "An empty message that you can re-use to avoid defining duplicated empty\nmessages in your project. A typical example is to use it as argument or the\nreturn value of a service API. For instance:\n\n service Foo {\n rpc Bar (proto2.Empty) returns (proto2.Empty) { };\n };\n\nBEGIN GOOGLE-INTERNAL\nThe difference between this one and net/rpc/empty-message.proto is that\n1) The generated message here is in proto2 C++ API.\n2) The proto2.Empty has minimum dependencies\n (no message_set or net/rpc dependencies)\nEND GOOGLE-INTERNAL", + "type": "object", + "properties": {}, + "id": "Empty" + }, + "ListTopicsResponse": { + "description": "Response for the ListTopics method.", + "type": "object", + "properties": { + "topic": { + "description": "The resulting topics.", + "type": "array", + "items": { + "$ref": "Topic" + } + }, + "nextPageToken": { + "description": "If not empty, indicates that there are more topics that match the request,\nand this value should be passed to the next \u003ccode\u003eListTopicsRequest\u003c/code\u003e\nto continue.", + "type": "string" + } + }, + "id": "ListTopicsResponse" + }, + "PubsubEvent": { + "description": "An event indicating a received message or truncation event.", + "type": "object", + "properties": { + "truncated": { + "description": "Indicates that this subscription has been truncated.", + "type": "boolean" + }, + "deleted": { + "description": "Indicates that this subscription has been deleted. (Note that pull\nsubscribers will always receive NOT_FOUND in response in their pull\nrequest on the subscription, rather than seeing this boolean.)", + "type": "boolean" + }, + "subscription": { + "description": "The subscription that received the event.", + "type": "string" + }, + "message": { + "description": "A received message.", + "$ref": "PubsubMessage" + } + }, + "id": "PubsubEvent" + }, + "PullBatchRequest": { + "description": "Request for the PullBatch method.", + "type": "object", + "properties": { + "maxEvents": { + "description": "The maximum number of PubsubEvents returned for this request. The Pub/Sub\nsystem may return fewer than the number of events specified.", + "type": "integer", + "format": "int32" + }, + "returnImmediately": { + "description": "If this is specified as true the system will respond immediately even if\nit is not able to return a message in the Pull response. Otherwise the\nsystem is allowed to wait until at least one message is available rather\nthan returning no messages. The client may cancel the request if it does\nnot wish to wait any longer for the response.", + "type": "boolean" + }, + "subscription": { + "description": "The subscription from which messages should be pulled.", + "type": "string" + } + }, + "id": "PullBatchRequest" } - } }, - "Label": { - "id": "Label", - "type": "object", - "description": "A key-value pair applied to a given object.", - "properties": { + "revision": "20161122", + "basePath": "", + "icons": { + "x32": "http://www.google.com/images/icons/product/search-32.gif", + "x16": "http://www.google.com/images/icons/product/search-16.gif" + }, + "discoveryVersion": "v1", + "baseUrl": "https://pubsub.googleapis.com/", + "name": "pubsub", + "parameters": { + "access_token": { + "description": "OAuth access token.", + "type": "string", + "location": "query" + }, + "prettyPrint": { + "description": "Returns response with indentations and line breaks.", + "default": "true", + "type": "boolean", + "location": "query" + }, "key": { - "type": "string", - "description": "The key of a label is a syntactically valid URL (as per RFC 1738) with the \"scheme\" and initial slashes omitted and with the additional restrictions noted below. Each key should be globally unique. The \"host\" portion is called the \"namespace\" and is not necessarily resolvable to a network endpoint. Instead, the namespace indicates what system or entity defines the semantics of the label. Namespaces do not restrict the set of objects to which a label may be associated. Keys are defined by the following grammar: key = hostname \"/\" kpath kpath = ksegment *[ \"/\" ksegment ] ksegment = alphadigit | *[ alphadigit | \"-\" | \"_\" | \".\" ] where \"hostname\" and \"alphadigit\" are defined as in RFC 1738. Example key: spanner.google.com/universe" + "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", + "type": "string", + "location": "query" }, - "strValue": { - "type": "string", - "description": "A string value." + "quotaUser": { + "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.", + "type": "string", + "location": "query" }, - "numValue": { - "type": "string", - "description": "An integer value.", - "format": "int64" - } - } - }, - "Empty": { - "id": "Empty", - "type": "object", - "description": "An empty message that you can re-use to avoid defining duplicated empty messages in your project. A typical example is to use it as argument or the return value of a service API. For instance: service Foo { rpc Bar (proto2.Empty) returns (proto2.Empty) { }; }; BEGIN GOOGLE-INTERNAL The difference between this one and net/rpc/empty-message.proto is that 1) The generated message here is in proto2 C++ API. 2) The proto2.Empty has minimum dependencies (no message_set or net/rpc dependencies) END GOOGLE-INTERNAL" - }, - "PublishBatchRequest": { - "id": "PublishBatchRequest", - "type": "object", - "description": "Request for the PublishBatch method.", - "properties": { - "topic": { - "type": "string", - "description": "The messages in the request will be published on this topic." + "pp": { + "description": "Pretty-print response.", + "default": "true", + "type": "boolean", + "location": "query" }, - "messages": { - "type": "array", - "description": "The messages to publish.", - "items": { - "$ref": "PubsubMessage" - } - } - } - }, - "PublishBatchResponse": { - "id": "PublishBatchResponse", - "type": "object", - "description": "Response for the PublishBatch method.", - "properties": { - "messageIds": { - "type": "array", - "description": "The server-assigned ID of each published message, in the same order as the messages in the request. IDs are guaranteed to be unique within the topic.", - "items": { + "fields": { + "description": "Selector specifying which fields to include in a partial response.", + "type": "string", + "location": "query" + }, + "alt": { + "description": "Data format for response.", + "location": "query", + "enum": [ + "json", + "media", + "proto" + ], + "default": "json", + "enumDescriptions": [ + "Responses with Content-Type of application/json", + "Media download with context-dependent Content-Type", + "Responses with Content-Type of application/x-protobuf" + ], "type": "string" - } + }, + "$.xgafv": { + "description": "V1 error format.", + "enum": [ + "1", + "2" + ], + "enumDescriptions": [ + "v1 error format", + "v2 error format" + ], + "type": "string", + "location": "query" + }, + "callback": { + "description": "JSONP", + "type": "string", + "location": "query" + }, + "oauth_token": { + "description": "OAuth 2.0 token for the current user.", + "type": "string", + "location": "query" + }, + "uploadType": { + "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").", + "type": "string", + "location": "query" + }, + "bearer_token": { + "description": "OAuth bearer token.", + "type": "string", + "location": "query" + }, + "upload_protocol": { + "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").", + "type": "string", + "location": "query" } - } }, - "ListTopicsResponse": { - "id": "ListTopicsResponse", - "type": "object", - "description": "Response for the ListTopics method.", - "properties": { - "topic": { - "type": "array", - "description": "The resulting topics.", - "items": { - "$ref": "Topic" - } - }, - "nextPageToken": { - "type": "string", - "description": "If not empty, indicates that there are more topics that match the request, and this value should be passed to the next ListTopicsRequest to continue." - } - } - }, - "Subscription": { - "id": "Subscription", - "type": "object", - "description": "A subscription resource.", - "properties": { - "name": { - "type": "string", - "description": "Name of the subscription." - }, - "topic": { - "type": "string", - "description": "The name of the topic from which this subscription is receiving messages." - }, - "pushConfig": { - "$ref": "PushConfig", - "description": "If push delivery is used with this subscription, this field is used to configure it." - }, - "ackDeadlineSeconds": { - "type": "integer", - "description": "For either push or pull delivery, the value is the maximum time after a subscriber receives a message before the subscriber should acknowledge or Nack the message. If the Ack deadline for a message passes without an Ack or a Nack, the Pub/Sub system will eventually redeliver the message. If a subscriber acknowledges after the deadline, the Pub/Sub system may accept the Ack, but it is possible that the message has been already delivered again. Multiple Acks to the message are allowed and will succeed. For push delivery, this value is used to set the request timeout for the call to the push endpoint. For pull delivery, this value is used as the initial value for the Ack deadline. It may be overridden for each message using its corresponding ack_id with ModifyAckDeadline. While a message is outstanding (i.e. it has been delivered to a pull subscriber and the subscriber has not yet Acked or Nacked), the Pub/Sub system will not deliver that message to another pull subscriber (on a best-effort basis).", - "format": "int32" - } - } - }, - "PushConfig": { - "id": "PushConfig", - "type": "object", - "description": "Configuration for a push delivery endpoint.", - "properties": { - "pushEndpoint": { - "type": "string", - "description": "A URL locating the endpoint to which messages should be pushed. For example, a Webhook endpoint might use \"https://example.com/push\"." - } - } - }, - "ListSubscriptionsResponse": { - "id": "ListSubscriptionsResponse", - "type": "object", - "description": "Response for the ListSubscriptions method.", - "properties": { - "subscription": { - "type": "array", - "description": "The subscriptions that match the request.", - "items": { - "$ref": "Subscription" - } - }, - "nextPageToken": { - "type": "string", - "description": "If not empty, indicates that there are more subscriptions that match the request and this value should be passed to the next ListSubscriptionsRequest to continue." - } - } - }, - "ModifyPushConfigRequest": { - "id": "ModifyPushConfigRequest", - "type": "object", - "description": "Request for the ModifyPushConfig method.", - "properties": { - "subscription": { - "type": "string", - "description": "The name of the subscription." - }, - "pushConfig": { - "$ref": "PushConfig", - "description": "An empty push_config indicates that the Pub/Sub system should pause pushing messages from the given subscription." - } - } - }, - "PullRequest": { - "id": "PullRequest", - "type": "object", - "description": "Request for the Pull method.", - "properties": { - "subscription": { - "type": "string", - "description": "The subscription from which a message should be pulled." - }, - "returnImmediately": { - "type": "boolean", - "description": "If this is specified as true the system will respond immediately even if it is not able to return a message in the Pull response. Otherwise the system is allowed to wait until at least one message is available rather than returning FAILED_PRECONDITION. The client may cancel the request if it does not wish to wait any longer for the response." - } - } - }, - "PullResponse": { - "id": "PullResponse", - "type": "object", - "description": "Either a PubsubMessage or a truncation event. One of these two must be populated.", - "properties": { - "ackId": { - "type": "string", - "description": "This ID must be used to acknowledge the received event or message." - }, - "pubsubEvent": { - "$ref": "PubsubEvent", - "description": "A pubsub message or truncation event." - } - } - }, - "PubsubEvent": { - "id": "PubsubEvent", - "type": "object", - "description": "An event indicating a received message or truncation event.", - "properties": { - "subscription": { - "type": "string", - "description": "The subscription that received the event." - }, - "message": { - "$ref": "PubsubMessage", - "description": "A received message." - }, - "truncated": { - "type": "boolean", - "description": "Indicates that this subscription has been truncated." - }, - "deleted": { - "type": "boolean", - "description": "Indicates that this subscription has been deleted. (Note that pull subscribers will always receive NOT_FOUND in response in their pull request on the subscription, rather than seeing this boolean.)" - } - } - }, - "PullBatchRequest": { - "id": "PullBatchRequest", - "type": "object", - "description": "Request for the PullBatch method.", - "properties": { - "subscription": { - "type": "string", - "description": "The subscription from which messages should be pulled." - }, - "returnImmediately": { - "type": "boolean", - "description": "If this is specified as true the system will respond immediately even if it is not able to return a message in the Pull response. Otherwise the system is allowed to wait until at least one message is available rather than returning no messages. The client may cancel the request if it does not wish to wait any longer for the response." - }, - "maxEvents": { - "type": "integer", - "description": "The maximum number of PubsubEvents returned for this request. The Pub/Sub system may return fewer than the number of events specified.", - "format": "int32" - } - } - }, - "PullBatchResponse": { - "id": "PullBatchResponse", - "type": "object", - "description": "Response for the PullBatch method.", - "properties": { - "pullResponses": { - "type": "array", - "description": "Received Pub/Sub messages or status events. The Pub/Sub system will return zero messages if there are no more messages available in the backlog. The Pub/Sub system may return fewer than the max_events requested even if there are more messages available in the backlog.", - "items": { - "$ref": "PullResponse" - } - } - } - }, - "ModifyAckDeadlineRequest": { - "id": "ModifyAckDeadlineRequest", - "type": "object", - "description": "Request for the ModifyAckDeadline method.", - "properties": { - "subscription": { - "type": "string", - "description": "Next Index: 5 The name of the subscription from which messages are being pulled." - }, - "ackId": { - "type": "string", - "description": "The acknowledgment ID. Either this or ack_ids must be populated, not both." - }, - "ackIds": { - "type": "array", - "description": "List of acknowledgment IDs. Either this field or ack_id should be populated, not both.", - "items": { - "type": "string" - } - }, - "ackDeadlineSeconds": { - "type": "integer", - "description": "The new ack deadline with respect to the time this request was sent to the Pub/Sub system. Must be \u003e= 0. For example, if the value is 10, the new ack deadline will expire 10 seconds after the ModifyAckDeadline call was made. Specifying zero may immediately make the message available for another pull request.", - "format": "int32" - } - } - }, - "AcknowledgeRequest": { - "id": "AcknowledgeRequest", - "type": "object", - "description": "Request for the Acknowledge method.", - "properties": { - "subscription": { - "type": "string", - "description": "The subscription whose message is being acknowledged." - }, - "ackId": { - "type": "array", - "description": "The acknowledgment ID for the message being acknowledged. This was returned by the Pub/Sub system in the Pull response.", - "items": { - "type": "string" - } - } - } - } - }, - "resources": { - "topics": { - "methods": { - "create": { - "id": "pubsub.topics.create", - "path": "v1beta1a/topics", - "httpMethod": "POST", - "description": "Creates the given topic with the given name.", - "request": { - "$ref": "Topic" - }, - "response": { - "$ref": "Topic" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "publish": { - "id": "pubsub.topics.publish", - "path": "v1beta1a/topics/publish", - "httpMethod": "POST", - "description": "Adds a message to the topic. Returns NOT_FOUND if the topic does not exist.", - "request": { - "$ref": "PublishRequest" - }, - "response": { - "$ref": "Empty" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "publishBatch": { - "id": "pubsub.topics.publishBatch", - "path": "v1beta1a/topics/publishBatch", - "httpMethod": "POST", - "description": "Adds one or more messages to the topic. Returns NOT_FOUND if the topic does not exist.", - "request": { - "$ref": "PublishBatchRequest" - }, - "response": { - "$ref": "PublishBatchResponse" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "get": { - "id": "pubsub.topics.get", - "path": "v1beta1a/topics/{+topic}", - "httpMethod": "GET", - "description": "Gets the configuration of a topic. Since the topic only has the name attribute, this method is only useful to check the existence of a topic. If other attributes are added in the future, they will be returned here.", - "parameters": { - "topic": { - "type": "string", - "description": "The name of the topic to get.", - "required": true, - "pattern": "^.*$", - "location": "path" - } - }, - "parameterOrder": [ - "topic" - ], - "response": { - "$ref": "Topic" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "list": { - "id": "pubsub.topics.list", - "path": "v1beta1a/topics", - "httpMethod": "GET", - "description": "Lists matching topics.", - "parameters": { - "query": { - "type": "string", - "description": "A valid label query expression.", - "location": "query" - }, - "maxResults": { - "type": "integer", - "description": "Maximum number of topics to return.", - "format": "int32", - "location": "query" - }, - "pageToken": { - "type": "string", - "description": "The value obtained in the last ListTopicsResponse for continuation.", - "location": "query" - } - }, - "response": { - "$ref": "ListTopicsResponse" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "delete": { - "id": "pubsub.topics.delete", - "path": "v1beta1a/topics/{+topic}", - "httpMethod": "DELETE", - "description": "Deletes the topic with the given name. Returns NOT_FOUND if the topic does not exist. After a topic is deleted, a new topic may be created with the same name.", - "parameters": { - "topic": { - "type": "string", - "description": "Name of the topic to delete.", - "required": true, - "pattern": "^.*$", - "location": "path" - } - }, - "parameterOrder": [ - "topic" - ], - "response": { - "$ref": "Empty" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - } - } - }, - "subscriptions": { - "methods": { - "create": { - "id": "pubsub.subscriptions.create", - "path": "v1beta1a/subscriptions", - "httpMethod": "POST", - "description": "Creates a subscription on a given topic for a given subscriber. If the subscription already exists, returns ALREADY_EXISTS. If the corresponding topic doesn't exist, returns NOT_FOUND. If the name is not provided in the request, the server will assign a random name for this subscription on the same project as the topic.", - "request": { - "$ref": "Subscription" - }, - "response": { - "$ref": "Subscription" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "get": { - "id": "pubsub.subscriptions.get", - "path": "v1beta1a/subscriptions/{+subscription}", - "httpMethod": "GET", - "description": "Gets the configuration details of a subscription.", - "parameters": { - "subscription": { - "type": "string", - "description": "The name of the subscription to get.", - "required": true, - "pattern": "^.*$", - "location": "path" - } - }, - "parameterOrder": [ - "subscription" - ], - "response": { - "$ref": "Subscription" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "list": { - "id": "pubsub.subscriptions.list", - "path": "v1beta1a/subscriptions", - "httpMethod": "GET", - "description": "Lists matching subscriptions.", - "parameters": { - "query": { - "type": "string", - "description": "A valid label query expression.", - "location": "query" - }, - "maxResults": { - "type": "integer", - "description": "Maximum number of subscriptions to return.", - "format": "int32", - "location": "query" - }, - "pageToken": { - "type": "string", - "description": "The value obtained in the last ListSubscriptionsResponse for continuation.", - "location": "query" - } - }, - "response": { - "$ref": "ListSubscriptionsResponse" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "delete": { - "id": "pubsub.subscriptions.delete", - "path": "v1beta1a/subscriptions/{+subscription}", - "httpMethod": "DELETE", - "description": "Deletes an existing subscription. All pending messages in the subscription are immediately dropped. Calls to Pull after deletion will return NOT_FOUND.", - "parameters": { - "subscription": { - "type": "string", - "description": "The subscription to delete.", - "required": true, - "pattern": "^.*$", - "location": "path" - } - }, - "parameterOrder": [ - "subscription" - ], - "response": { - "$ref": "Empty" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "modifyPushConfig": { - "id": "pubsub.subscriptions.modifyPushConfig", - "path": "v1beta1a/subscriptions/modifyPushConfig", - "httpMethod": "POST", - "description": "Modifies the PushConfig for a specified subscription. This method can be used to suspend the flow of messages to an endpoint by clearing the PushConfig field in the request. Messages will be accumulated for delivery even if no push configuration is defined or while the configuration is modified.", - "request": { - "$ref": "ModifyPushConfigRequest" - }, - "response": { - "$ref": "Empty" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "pull": { - "id": "pubsub.subscriptions.pull", - "path": "v1beta1a/subscriptions/pull", - "httpMethod": "POST", - "description": "Pulls a single message from the server. If return_immediately is true, and no messages are available in the subscription, this method returns FAILED_PRECONDITION. The system is free to return an UNAVAILABLE error if no messages are available in a reasonable amount of time (to reduce system load).", - "request": { - "$ref": "PullRequest" - }, - "response": { - "$ref": "PullResponse" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "pullBatch": { - "id": "pubsub.subscriptions.pullBatch", - "path": "v1beta1a/subscriptions/pullBatch", - "httpMethod": "POST", - "description": "Pulls messages from the server. Returns an empty list if there are no messages available in the backlog. The system is free to return UNAVAILABLE if there are too many pull requests outstanding for the given subscription.", - "request": { - "$ref": "PullBatchRequest" - }, - "response": { - "$ref": "PullBatchResponse" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "modifyAckDeadline": { - "id": "pubsub.subscriptions.modifyAckDeadline", - "path": "v1beta1a/subscriptions/modifyAckDeadline", - "httpMethod": "POST", - "description": "Modifies the Ack deadline for a message received from a pull request.", - "request": { - "$ref": "ModifyAckDeadlineRequest" - }, - "response": { - "$ref": "Empty" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "acknowledge": { - "id": "pubsub.subscriptions.acknowledge", - "path": "v1beta1a/subscriptions/acknowledge", - "httpMethod": "POST", - "description": "Acknowledges a particular received message: the Pub/Sub system can remove the given message from the subscription. Acknowledging a message whose Ack deadline has expired may succeed, but the message could have been already redelivered. Acknowledging a message more than once will not result in an error. This is only used for messages received via pull.", - "request": { - "$ref": "AcknowledgeRequest" - }, - "response": { - "$ref": "Empty" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - } - } - } - } + "documentationLink": "https://cloud.google.com/pubsub/docs", + "ownerDomain": "google.com", + "batchPath": "batch", + "servicePath": "", + "ownerName": "Google", + "version": "v1beta1a", + "rootUrl": "https://pubsub.googleapis.com/", + "kind": "discovery#restDescription" } diff --git a/etc/api/pubsub/v1beta2/pubsub-api.json b/etc/api/pubsub/v1beta2/pubsub-api.json index dff01f26ae..57bdbff6c0 100644 --- a/etc/api/pubsub/v1beta2/pubsub-api.json +++ b/etc/api/pubsub/v1beta2/pubsub-api.json @@ -1,1044 +1,1074 @@ { - "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/bCHPJ2BvROiKtNiRgnXJErIP0lU\"", - "discoveryVersion": "v1", - "id": "pubsub:v1beta2", - "name": "pubsub", - "version": "v1beta2", - "revision": "20160317", - "title": "Google Cloud Pub/Sub API", - "description": "Provides reliable, many-to-many, asynchronous messaging between applications.", - "ownerDomain": "google.com", - "ownerName": "Google", - "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" - }, - "documentationLink": "https://cloud.google.com/pubsub/docs", - "protocol": "rest", - "baseUrl": "https://pubsub.googleapis.com/", - "basePath": "", - "rootUrl": "https://pubsub.googleapis.com/", - "servicePath": "", - "batchPath": "batch", - "parameters": { - "access_token": { - "type": "string", - "description": "OAuth access token.", - "location": "query" - }, - "alt": { - "type": "string", - "description": "Data format for response.", - "default": "json", - "enumDescriptions": [ - "Responses with Content-Type of application/json", - "Media download with context-dependent Content-Type", - "Responses with Content-Type of application/x-protobuf" - ], - "location": "query" - }, - "bearer_token": { - "type": "string", - "description": "OAuth bearer token.", - "location": "query" - }, - "callback": { - "type": "string", - "description": "JSONP", - "location": "query" - }, - "fields": { - "type": "string", - "description": "Selector specifying which fields to include in a partial response.", - "location": "query" - }, - "key": { - "type": "string", - "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", - "location": "query" - }, - "oauth_token": { - "type": "string", - "description": "OAuth 2.0 token for the current user.", - "location": "query" - }, - "pp": { - "type": "boolean", - "description": "Pretty-print response.", - "default": "true", - "location": "query" - }, - "prettyPrint": { - "type": "boolean", - "description": "Returns response with indentations and line breaks.", - "default": "true", - "location": "query" - }, - "quotaUser": { - "type": "string", - "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.", - "location": "query" - }, - "upload_protocol": { - "type": "string", - "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").", - "location": "query" - }, - "uploadType": { - "type": "string", - "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").", - "location": "query" - }, - "$.xgafv": { - "type": "string", - "description": "V1 error format.", - "enumDescriptions": [ - "v1 error format", - "v2 error format" - ], - "location": "query" - } - }, - "auth": { - "oauth2": { - "scopes": { - "https://www.googleapis.com/auth/cloud-platform": { - "description": "View and manage your data across Google Cloud Platform services" - }, - "https://www.googleapis.com/auth/pubsub": { - "description": "View and manage Pub/Sub topics and subscriptions" - } - } - } - }, - "schemas": { - "SetIamPolicyRequest": { - "id": "SetIamPolicyRequest", - "type": "object", - "description": "Request message for `SetIamPolicy` method.", - "properties": { - "policy": { - "$ref": "Policy", - "description": "REQUIRED: The complete policy to be applied to the `resource`. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them." - } - } - }, - "Policy": { - "id": "Policy", - "type": "object", - "description": "Defines an Identity and Access Management (IAM) policy. It is used to specify access control policies for Cloud Platform resources. A `Policy` consists of a list of `bindings`. A `Binding` binds a list of `members` to a `role`, where the members can be user accounts, Google groups, Google domains, and service accounts. A `role` is a named list of permissions defined by IAM. **Example** { \"bindings\": [ { \"role\": \"roles/owner\", \"members\": [ \"user:mike@example.com\", \"group:admins@example.com\", \"domain:google.com\", \"serviceAccount:my-other-app@appspot.gserviceaccount.com\", ] }, { \"role\": \"roles/viewer\", \"members\": [\"user:sean@example.com\"] } ] } For a description of IAM and its features, see the [IAM developer's guide](https://cloud.google.com/iam).", - "properties": { - "version": { - "type": "integer", - "description": "Version of the `Policy`. The default version is 0.", - "format": "int32" - }, - "bindings": { - "type": "array", - "description": "Associates a list of `members` to a `role`. Multiple `bindings` must not be specified for the same `role`. `bindings` with no members will result in an error.", - "items": { - "$ref": "Binding" - } - }, - "etag": { - "type": "string", - "description": "`etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other. It is strongly suggested that systems make use of the `etag` in the read-modify-write cycle to perform policy updates in order to avoid race conditions: An `etag` is returned in the response to `getIamPolicy`, and systems are expected to put that etag in the request to `setIamPolicy` to ensure that their change will be applied to the same version of the policy. If no `etag` is provided in the call to `setIamPolicy`, then the existing policy is overwritten blindly.", - "format": "byte" - } - } - }, - "Binding": { - "id": "Binding", - "type": "object", - "description": "Associates `members` with a `role`.", - "properties": { - "role": { - "type": "string", - "description": "Role that is assigned to `members`. For example, `roles/viewer`, `roles/editor`, or `roles/owner`. Required" - }, - "members": { - "type": "array", - "description": "Specifies the identities requesting access for a Cloud Platform resource. `members` can have the following values: * `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account. * `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account. * `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@gmail.com` or `joe@example.com`. * `serviceAccount:{emailid}`: An email address that represents a service account. For example, `my-other-app@appspot.gserviceaccount.com`. * `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`. * `domain:{domain}`: A Google Apps domain name that represents all the users of that domain. For example, `google.com` or `example.com`.", - "items": { - "type": "string" - } - } - } - }, - "TestIamPermissionsRequest": { - "id": "TestIamPermissionsRequest", - "type": "object", - "description": "Request message for `TestIamPermissions` method.", - "properties": { - "permissions": { - "type": "array", - "description": "The set of permissions to check for the `resource`. Permissions with wildcards (such as '*' or 'storage.*') are not allowed. For more information see IAM Overview.", - "items": { - "type": "string" - } - } - } - }, - "TestIamPermissionsResponse": { - "id": "TestIamPermissionsResponse", - "type": "object", - "description": "Response message for `TestIamPermissions` method.", - "properties": { - "permissions": { - "type": "array", - "description": "A subset of `TestPermissionsRequest.permissions` that the caller is allowed.", - "items": { - "type": "string" - } - } - } - }, - "Topic": { - "id": "Topic", - "type": "object", - "description": "A topic resource.", - "properties": { - "name": { - "type": "string", - "description": "The name of the topic. It must have the format `\"projects/{project}/topics/{topic}\"`. `{topic}` must start with a letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in length, and it must not start with `\"goog\"`." - } - } - }, - "PublishRequest": { - "id": "PublishRequest", - "type": "object", - "description": "Request for the Publish method.", - "properties": { - "messages": { - "type": "array", - "description": "The messages to publish.", - "items": { - "$ref": "PubsubMessage" - } - } - } - }, - "PubsubMessage": { - "id": "PubsubMessage", - "type": "object", - "description": "A message data and its attributes. The message payload must not be empty; it must contain either a non-empty data field, or at least one attribute.", - "properties": { - "data": { - "type": "string", - "description": "The message payload. For JSON requests, the value of this field must be base64-encoded.", - "format": "byte" - }, - "attributes": { - "type": "object", - "description": "Optional attributes for this message.", - "additionalProperties": { - "type": "string" - } - }, - "messageId": { - "type": "string", - "description": "ID of this message, assigned by the server when the message is published. Guaranteed to be unique within the topic. This value may be read by a subscriber that receives a `PubsubMessage` via a `Pull` call or a push delivery. It must not be populated by the publisher in a `Publish` call." - }, - "publishTime": { - "type": "string", - "description": "The time at which the message was published, populated by the server when it receives the `Publish` call. It must not be populated by the publisher in a `Publish` call." - } - } - }, - "PublishResponse": { - "id": "PublishResponse", - "type": "object", - "description": "Response for the `Publish` method.", - "properties": { - "messageIds": { - "type": "array", - "description": "The server-assigned ID of each published message, in the same order as the messages in the request. IDs are guaranteed to be unique within the topic.", - "items": { - "type": "string" - } - } - } - }, - "ListTopicsResponse": { - "id": "ListTopicsResponse", - "type": "object", - "description": "Response for the `ListTopics` method.", - "properties": { - "topics": { - "type": "array", - "description": "The resulting topics.", - "items": { - "$ref": "Topic" - } - }, - "nextPageToken": { - "type": "string", - "description": "If not empty, indicates that there may be more topics that match the request; this value should be passed in a new `ListTopicsRequest`." - } - } - }, - "ListTopicSubscriptionsResponse": { - "id": "ListTopicSubscriptionsResponse", - "type": "object", - "description": "Response for the `ListTopicSubscriptions` method.", - "properties": { - "subscriptions": { - "type": "array", - "description": "The names of the subscriptions that match the request.", - "items": { - "type": "string" - } - }, - "nextPageToken": { - "type": "string", - "description": "If not empty, indicates that there may be more subscriptions that match the request; this value should be passed in a new `ListTopicSubscriptionsRequest` to get more subscriptions." - } - } - }, - "Empty": { - "id": "Empty", - "type": "object", - "description": "A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON representation for `Empty` is empty JSON object `{}`." - }, - "Subscription": { - "id": "Subscription", - "type": "object", - "description": "A subscription resource.", - "properties": { - "name": { - "type": "string", - "description": "The name of the subscription. It must have the format `\"projects/{project}/subscriptions/{subscription}\"`. `{subscription}` must start with a letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in length, and it must not start with `\"goog\"`." - }, - "topic": { - "type": "string", - "description": "The name of the topic from which this subscription is receiving messages. The value of this field will be `_deleted-topic_` if the topic has been deleted." - }, - "pushConfig": { - "$ref": "PushConfig", - "description": "If push delivery is used with this subscription, this field is used to configure it. An empty `pushConfig` signifies that the subscriber will pull and ack messages using API methods." - }, - "ackDeadlineSeconds": { - "type": "integer", - "description": "This value is the maximum time after a subscriber receives a message before the subscriber should acknowledge the message. After message delivery but before the ack deadline expires and before the message is acknowledged, it is an outstanding message and will not be delivered again during that time (on a best-effort basis). For pull subscriptions, this value is used as the initial value for the ack deadline. To override this value for a given message, call `ModifyAckDeadline` with the corresponding `ack_id` if using pull. For push delivery, this value is also used to set the request timeout for the call to the push endpoint. If the subscriber never acknowledges the message, the Pub/Sub system will eventually redeliver the message. If this parameter is not set, the default value of 10 seconds is used.", - "format": "int32" - } - } - }, - "PushConfig": { - "id": "PushConfig", - "type": "object", - "description": "Configuration for a push delivery endpoint.", - "properties": { - "pushEndpoint": { - "type": "string", - "description": "A URL locating the endpoint to which messages should be pushed. For example, a Webhook endpoint might use \"https://example.com/push\"." - }, - "attributes": { - "type": "object", - "description": "Endpoint configuration attributes. Every endpoint has a set of API supported attributes that can be used to control different aspects of the message delivery. The currently supported attribute is `x-goog-version`, which you can use to change the format of the push message. This attribute indicates the version of the data expected by the endpoint. This controls the shape of the envelope (i.e. its fields and metadata). The endpoint version is based on the version of the Pub/Sub API. If not present during the `CreateSubscription` call, it will default to the version of the API used to make such call. If not present during a `ModifyPushConfig` call, its value will not be changed. `GetSubscription` calls will always return a valid version, even if the subscription was created without this attribute. The possible values for this attribute are: * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API. * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.", - "additionalProperties": { - "type": "string" - } - } - } - }, - "ListSubscriptionsResponse": { - "id": "ListSubscriptionsResponse", - "type": "object", - "description": "Response for the `ListSubscriptions` method.", - "properties": { - "subscriptions": { - "type": "array", - "description": "The subscriptions that match the request.", - "items": { - "$ref": "Subscription" - } - }, - "nextPageToken": { - "type": "string", - "description": "If not empty, indicates that there may be more subscriptions that match the request; this value should be passed in a new `ListSubscriptionsRequest` to get more subscriptions." - } - } - }, - "ModifyAckDeadlineRequest": { - "id": "ModifyAckDeadlineRequest", - "type": "object", - "description": "Request for the ModifyAckDeadline method.", - "properties": { - "ackId": { - "type": "string", - "description": "The acknowledgment ID. Either this or ack_ids must be populated, but not both." - }, - "ackIds": { - "type": "array", - "description": "List of acknowledgment IDs.", - "items": { - "type": "string" - } - }, - "ackDeadlineSeconds": { - "type": "integer", - "description": "The new ack deadline with respect to the time this request was sent to the Pub/Sub system. Must be \u003e= 0. For example, if the value is 10, the new ack deadline will expire 10 seconds after the `ModifyAckDeadline` call was made. Specifying zero may immediately make the message available for another pull request.", - "format": "int32" - } - } - }, - "AcknowledgeRequest": { - "id": "AcknowledgeRequest", - "type": "object", - "description": "Request for the Acknowledge method.", - "properties": { - "ackIds": { - "type": "array", - "description": "The acknowledgment ID for the messages being acknowledged that was returned by the Pub/Sub system in the `Pull` response. Must not be empty.", - "items": { - "type": "string" - } - } - } - }, - "PullRequest": { - "id": "PullRequest", - "type": "object", - "description": "Request for the `Pull` method.", - "properties": { - "returnImmediately": { - "type": "boolean", - "description": "If this is specified as true the system will respond immediately even if it is not able to return a message in the `Pull` response. Otherwise the system is allowed to wait until at least one message is available rather than returning no messages. The client may cancel the request if it does not wish to wait any longer for the response." - }, - "maxMessages": { - "type": "integer", - "description": "The maximum number of messages returned for this request. The Pub/Sub system may return fewer than the number specified.", - "format": "int32" - } - } - }, - "PullResponse": { - "id": "PullResponse", - "type": "object", - "description": "Response for the `Pull` method.", - "properties": { - "receivedMessages": { - "type": "array", - "description": "Received Pub/Sub messages. The Pub/Sub system will return zero messages if there are no more available in the backlog. The Pub/Sub system may return fewer than the `maxMessages` requested even if there are more messages available in the backlog.", - "items": { - "$ref": "ReceivedMessage" - } - } - } - }, - "ReceivedMessage": { - "id": "ReceivedMessage", - "type": "object", - "description": "A message and its corresponding acknowledgment ID.", - "properties": { - "ackId": { - "type": "string", - "description": "This ID can be used to acknowledge the received message." - }, - "message": { - "$ref": "PubsubMessage", - "description": "The message." - } - } - }, - "ModifyPushConfigRequest": { - "id": "ModifyPushConfigRequest", - "type": "object", - "description": "Request for the ModifyPushConfig method.", - "properties": { - "pushConfig": { - "$ref": "PushConfig", - "description": "The push configuration for future deliveries. An empty `pushConfig` indicates that the Pub/Sub system should stop pushing messages from the given subscription and allow messages to be pulled and acknowledged - effectively pausing the subscription if `Pull` is not called." - } - } - } - }, - "resources": { - "projects": { - "resources": { - "topics": { - "methods": { - "setIamPolicy": { - "id": "pubsub.projects.topics.setIamPolicy", - "path": "v1beta2/{+resource}:setIamPolicy", - "httpMethod": "POST", - "description": "Sets the access control policy on the specified resource. Replaces any existing policy.", - "parameters": { - "resource": { - "type": "string", - "description": "REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `setIamPolicy` documentation.", - "required": true, - "pattern": "^projects/[^/]*/topics/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "resource" - ], - "request": { - "$ref": "SetIamPolicyRequest" - }, - "response": { - "$ref": "Policy" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "getIamPolicy": { - "id": "pubsub.projects.topics.getIamPolicy", - "path": "v1beta2/{+resource}:getIamPolicy", - "httpMethod": "GET", - "description": "Gets the access control policy for a `resource`. Returns an empty policy if the resource exists and does not have a policy set.", - "parameters": { - "resource": { - "type": "string", - "description": "REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation.", - "required": true, - "pattern": "^projects/[^/]*/topics/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "resource" - ], - "response": { - "$ref": "Policy" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "testIamPermissions": { - "id": "pubsub.projects.topics.testIamPermissions", - "path": "v1beta2/{+resource}:testIamPermissions", - "httpMethod": "POST", - "description": "Returns permissions that a caller has on the specified resource.", - "parameters": { - "resource": { - "type": "string", - "description": "REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `testIamPermissions` documentation.", - "required": true, - "pattern": "^projects/[^/]*/topics/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "resource" - ], - "request": { - "$ref": "TestIamPermissionsRequest" - }, - "response": { - "$ref": "TestIamPermissionsResponse" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "create": { - "id": "pubsub.projects.topics.create", - "path": "v1beta2/{+name}", - "httpMethod": "PUT", - "description": "Creates the given topic with the given name.", - "parameters": { - "name": { - "type": "string", - "description": "The name of the topic. It must have the format `\"projects/{project}/topics/{topic}\"`. `{topic}` must start with a letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in length, and it must not start with `\"goog\"`.", - "required": true, - "pattern": "^projects/[^/]*/topics/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "name" - ], - "request": { - "$ref": "Topic" - }, - "response": { - "$ref": "Topic" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "publish": { - "id": "pubsub.projects.topics.publish", - "path": "v1beta2/{+topic}:publish", - "httpMethod": "POST", - "description": "Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic does not exist. The message payload must not be empty; it must contain either a non-empty data field, or at least one attribute.", - "parameters": { - "topic": { - "type": "string", - "description": "The messages in the request will be published on this topic.", - "required": true, - "pattern": "^projects/[^/]*/topics/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "topic" - ], - "request": { - "$ref": "PublishRequest" - }, - "response": { - "$ref": "PublishResponse" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "get": { - "id": "pubsub.projects.topics.get", - "path": "v1beta2/{+topic}", - "httpMethod": "GET", - "description": "Gets the configuration of a topic.", - "parameters": { - "topic": { - "type": "string", - "description": "The name of the topic to get.", - "required": true, - "pattern": "^projects/[^/]*/topics/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "topic" - ], - "response": { - "$ref": "Topic" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "list": { - "id": "pubsub.projects.topics.list", - "path": "v1beta2/{+project}/topics", - "httpMethod": "GET", - "description": "Lists matching topics.", - "parameters": { - "project": { - "type": "string", - "description": "The name of the cloud project that topics belong to.", - "required": true, - "pattern": "^projects/[^/]*$", - "location": "path" + "id": "pubsub:v1beta2", + "auth": { + "oauth2": { + "scopes": { + "https://www.googleapis.com/auth/cloud-platform": { + "description": "View and manage your data across Google Cloud Platform services" }, - "pageSize": { - "type": "integer", - "description": "Maximum number of topics to return.", - "format": "int32", - "location": "query" - }, - "pageToken": { - "type": "string", - "description": "The value returned by the last `ListTopicsResponse`; indicates that this is a continuation of a prior `ListTopics` call, and that the system should return the next page of data.", - "location": "query" + "https://www.googleapis.com/auth/pubsub": { + "description": "View and manage Pub/Sub topics and subscriptions" } - }, - "parameterOrder": [ - "project" - ], - "response": { - "$ref": "ListTopicsResponse" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "delete": { - "id": "pubsub.projects.topics.delete", - "path": "v1beta2/{+topic}", - "httpMethod": "DELETE", - "description": "Deletes the topic with the given name. Returns `NOT_FOUND` if the topic does not exist. After a topic is deleted, a new topic may be created with the same name; this is an entirely new topic with none of the old configuration or subscriptions. Existing subscriptions to this topic are not deleted, but their `topic` field is set to `_deleted-topic_`.", - "parameters": { - "topic": { - "type": "string", - "description": "Name of the topic to delete.", - "required": true, - "pattern": "^projects/[^/]*/topics/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "topic" - ], - "response": { - "$ref": "Empty" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] } - }, - "resources": { - "subscriptions": { - "methods": { - "list": { - "id": "pubsub.projects.topics.subscriptions.list", - "path": "v1beta2/{+topic}/subscriptions", - "httpMethod": "GET", - "description": "Lists the name of the subscriptions for this topic.", - "parameters": { - "topic": { - "type": "string", - "description": "The name of the topic that subscriptions are attached to.", - "required": true, - "pattern": "^projects/[^/]*/topics/[^/]*$", - "location": "path" - }, - "pageSize": { - "type": "integer", - "description": "Maximum number of subscription names to return.", - "format": "int32", - "location": "query" - }, - "pageToken": { - "type": "string", - "description": "The value returned by the last `ListTopicSubscriptionsResponse`; indicates that this is a continuation of a prior `ListTopicSubscriptions` call, and that the system should return the next page of data.", - "location": "query" + } + }, + "description": "Provides reliable, many-to-many, asynchronous messaging between applications.\n", + "protocol": "rest", + "title": "Google Cloud Pub/Sub API", + "resources": { + "projects": { + "resources": { + "subscriptions": { + "methods": { + "modifyPushConfig": { + "id": "pubsub.projects.subscriptions.modifyPushConfig", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "subscription" + ], + "description": "Modifies the `PushConfig` for a specified subscription.\n\nThis may be used to change a push subscription to a pull one (signified by\nan empty `PushConfig`) or vice versa, or change the endpoint URL and other\nattributes of a push subscription. Messages will accumulate for delivery\ncontinuously through the call regardless of changes to the `PushConfig`.", + "request": { + "$ref": "ModifyPushConfigRequest" + }, + "flatPath": "v1beta2/projects/{projectsId}/subscriptions/{subscriptionsId}:modifyPushConfig", + "httpMethod": "POST", + "parameters": { + "subscription": { + "description": "The name of the subscription.", + "required": true, + "pattern": "^projects/[^/]+/subscriptions/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta2/{+subscription}:modifyPushConfig", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "getIamPolicy": { + "id": "pubsub.projects.subscriptions.getIamPolicy", + "response": { + "$ref": "Policy" + }, + "parameterOrder": [ + "resource" + ], + "description": "Gets the access control policy for a resource.\nReturns an empty policy if the resource exists and does not have a policy\nset.", + "flatPath": "v1beta2/projects/{projectsId}/subscriptions/{subscriptionsId}:getIamPolicy", + "httpMethod": "GET", + "parameters": { + "resource": { + "description": "REQUIRED: The resource for which the policy is being requested.\n`resource` is usually specified as a path. For example, a Project\nresource is specified as `projects/{project}`.", + "required": true, + "pattern": "^projects/[^/]+/subscriptions/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta2/{+resource}:getIamPolicy", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "pull": { + "id": "pubsub.projects.subscriptions.pull", + "response": { + "$ref": "PullResponse" + }, + "parameterOrder": [ + "subscription" + ], + "description": "Pulls messages from the server. Returns an empty list if there are no\nmessages available in the backlog. The server may return `UNAVAILABLE` if\nthere are too many concurrent pull requests pending for the given\nsubscription.", + "request": { + "$ref": "PullRequest" + }, + "flatPath": "v1beta2/projects/{projectsId}/subscriptions/{subscriptionsId}:pull", + "httpMethod": "POST", + "parameters": { + "subscription": { + "description": "The subscription from which messages should be pulled.", + "required": true, + "pattern": "^projects/[^/]+/subscriptions/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta2/{+subscription}:pull", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "list": { + "id": "pubsub.projects.subscriptions.list", + "response": { + "$ref": "ListSubscriptionsResponse" + }, + "parameterOrder": [ + "project" + ], + "description": "Lists matching subscriptions.", + "flatPath": "v1beta2/projects/{projectsId}/subscriptions", + "httpMethod": "GET", + "parameters": { + "pageSize": { + "description": "Maximum number of subscriptions to return.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "project": { + "description": "The name of the cloud project that subscriptions belong to.", + "required": true, + "pattern": "^projects/[^/]+$", + "location": "path", + "type": "string" + }, + "pageToken": { + "description": "The value returned by the last `ListSubscriptionsResponse`; indicates that\nthis is a continuation of a prior `ListSubscriptions` call, and that the\nsystem should return the next page of data.", + "location": "query", + "type": "string" + } + }, + "path": "v1beta2/{+project}/subscriptions", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "get": { + "id": "pubsub.projects.subscriptions.get", + "response": { + "$ref": "Subscription" + }, + "parameterOrder": [ + "subscription" + ], + "description": "Gets the configuration details of a subscription.", + "flatPath": "v1beta2/projects/{projectsId}/subscriptions/{subscriptionsId}", + "httpMethod": "GET", + "parameters": { + "subscription": { + "description": "The name of the subscription to get.", + "required": true, + "pattern": "^projects/[^/]+/subscriptions/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta2/{+subscription}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "create": { + "id": "pubsub.projects.subscriptions.create", + "response": { + "$ref": "Subscription" + }, + "parameterOrder": [ + "name" + ], + "description": "Creates a subscription to a given topic.\nIf the subscription already exists, returns `ALREADY_EXISTS`.\nIf the corresponding topic doesn't exist, returns `NOT_FOUND`.\n\nIf the name is not provided in the request, the server will assign a random\nname for this subscription on the same project as the topic. Note that\nfor REST API requests, you must specify a name.", + "request": { + "$ref": "Subscription" + }, + "flatPath": "v1beta2/projects/{projectsId}/subscriptions/{subscriptionsId}", + "httpMethod": "PUT", + "parameters": { + "name": { + "description": "The name of the subscription. It must have the format\n`\"projects/{project}/subscriptions/{subscription}\"`. `{subscription}` must\nstart with a letter, and contain only letters (`[A-Za-z]`), numbers\n(`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),\nplus (`+`) or percent signs (`%`). It must be between 3 and 255 characters\nin length, and it must not start with `\"goog\"`.", + "required": true, + "pattern": "^projects/[^/]+/subscriptions/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta2/{+name}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "modifyAckDeadline": { + "id": "pubsub.projects.subscriptions.modifyAckDeadline", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "subscription" + ], + "description": "Modifies the ack deadline for a specific message. This method is useful\nto indicate that more time is needed to process a message by the\nsubscriber, or to make the message available for redelivery if the\nprocessing was interrupted. Note that this does not modify the\nsubscription-level `ackDeadlineSeconds` used for subsequent messages.", + "request": { + "$ref": "ModifyAckDeadlineRequest" + }, + "flatPath": "v1beta2/projects/{projectsId}/subscriptions/{subscriptionsId}:modifyAckDeadline", + "httpMethod": "POST", + "parameters": { + "subscription": { + "description": "The name of the subscription.", + "required": true, + "pattern": "^projects/[^/]+/subscriptions/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta2/{+subscription}:modifyAckDeadline", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "setIamPolicy": { + "id": "pubsub.projects.subscriptions.setIamPolicy", + "response": { + "$ref": "Policy" + }, + "parameterOrder": [ + "resource" + ], + "description": "Sets the access control policy on the specified resource. Replaces any\nexisting policy.", + "request": { + "$ref": "SetIamPolicyRequest" + }, + "flatPath": "v1beta2/projects/{projectsId}/subscriptions/{subscriptionsId}:setIamPolicy", + "httpMethod": "POST", + "parameters": { + "resource": { + "description": "REQUIRED: The resource for which the policy is being specified.\n`resource` is usually specified as a path. For example, a Project\nresource is specified as `projects/{project}`.", + "required": true, + "pattern": "^projects/[^/]+/subscriptions/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta2/{+resource}:setIamPolicy", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "delete": { + "id": "pubsub.projects.subscriptions.delete", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "subscription" + ], + "description": "Deletes an existing subscription. All pending messages in the subscription\nare immediately dropped. Calls to `Pull` after deletion will return\n`NOT_FOUND`. After a subscription is deleted, a new one may be created with\nthe same name, but the new one has no association with the old\nsubscription, or its topic unless the same topic is specified.", + "flatPath": "v1beta2/projects/{projectsId}/subscriptions/{subscriptionsId}", + "httpMethod": "DELETE", + "parameters": { + "subscription": { + "description": "The subscription to delete.", + "required": true, + "pattern": "^projects/[^/]+/subscriptions/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta2/{+subscription}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "testIamPermissions": { + "id": "pubsub.projects.subscriptions.testIamPermissions", + "response": { + "$ref": "TestIamPermissionsResponse" + }, + "parameterOrder": [ + "resource" + ], + "description": "Returns permissions that a caller has on the specified resource.", + "request": { + "$ref": "TestIamPermissionsRequest" + }, + "flatPath": "v1beta2/projects/{projectsId}/subscriptions/{subscriptionsId}:testIamPermissions", + "httpMethod": "POST", + "parameters": { + "resource": { + "description": "REQUIRED: The resource for which the policy detail is being requested.\n`resource` is usually specified as a path. For example, a Project\nresource is specified as `projects/{project}`.", + "required": true, + "pattern": "^projects/[^/]+/subscriptions/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta2/{+resource}:testIamPermissions", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "acknowledge": { + "id": "pubsub.projects.subscriptions.acknowledge", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "subscription" + ], + "description": "Acknowledges the messages associated with the `ack_ids` in the\n`AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages\nfrom the subscription.\n\nAcknowledging a message whose ack deadline has expired may succeed,\nbut such a message may be redelivered later. Acknowledging a message more\nthan once will not result in an error.", + "request": { + "$ref": "AcknowledgeRequest" + }, + "flatPath": "v1beta2/projects/{projectsId}/subscriptions/{subscriptionsId}:acknowledge", + "httpMethod": "POST", + "parameters": { + "subscription": { + "description": "The subscription whose message is being acknowledged.", + "required": true, + "pattern": "^projects/[^/]+/subscriptions/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta2/{+subscription}:acknowledge", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + } } - }, - "parameterOrder": [ - "topic" - ], - "response": { - "$ref": "ListTopicSubscriptionsResponse" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - } - } - } - } - }, - "subscriptions": { - "methods": { - "setIamPolicy": { - "id": "pubsub.projects.subscriptions.setIamPolicy", - "path": "v1beta2/{+resource}:setIamPolicy", - "httpMethod": "POST", - "description": "Sets the access control policy on the specified resource. Replaces any existing policy.", - "parameters": { - "resource": { - "type": "string", - "description": "REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `setIamPolicy` documentation.", - "required": true, - "pattern": "^projects/[^/]*/subscriptions/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "resource" - ], - "request": { - "$ref": "SetIamPolicyRequest" - }, - "response": { - "$ref": "Policy" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "getIamPolicy": { - "id": "pubsub.projects.subscriptions.getIamPolicy", - "path": "v1beta2/{+resource}:getIamPolicy", - "httpMethod": "GET", - "description": "Gets the access control policy for a `resource`. Returns an empty policy if the resource exists and does not have a policy set.", - "parameters": { - "resource": { - "type": "string", - "description": "REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation.", - "required": true, - "pattern": "^projects/[^/]*/subscriptions/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "resource" - ], - "response": { - "$ref": "Policy" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "testIamPermissions": { - "id": "pubsub.projects.subscriptions.testIamPermissions", - "path": "v1beta2/{+resource}:testIamPermissions", - "httpMethod": "POST", - "description": "Returns permissions that a caller has on the specified resource.", - "parameters": { - "resource": { - "type": "string", - "description": "REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `testIamPermissions` documentation.", - "required": true, - "pattern": "^projects/[^/]*/subscriptions/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "resource" - ], - "request": { - "$ref": "TestIamPermissionsRequest" - }, - "response": { - "$ref": "TestIamPermissionsResponse" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "create": { - "id": "pubsub.projects.subscriptions.create", - "path": "v1beta2/{+name}", - "httpMethod": "PUT", - "description": "Creates a subscription to a given topic. If the subscription already exists, returns `ALREADY_EXISTS`. If the corresponding topic doesn't exist, returns `NOT_FOUND`. If the name is not provided in the request, the server will assign a random name for this subscription on the same project as the topic.", - "parameters": { - "name": { - "type": "string", - "description": "The name of the subscription. It must have the format `\"projects/{project}/subscriptions/{subscription}\"`. `{subscription}` must start with a letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in length, and it must not start with `\"goog\"`.", - "required": true, - "pattern": "^projects/[^/]*/subscriptions/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "name" - ], - "request": { - "$ref": "Subscription" - }, - "response": { - "$ref": "Subscription" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "get": { - "id": "pubsub.projects.subscriptions.get", - "path": "v1beta2/{+subscription}", - "httpMethod": "GET", - "description": "Gets the configuration details of a subscription.", - "parameters": { - "subscription": { - "type": "string", - "description": "The name of the subscription to get.", - "required": true, - "pattern": "^projects/[^/]*/subscriptions/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "subscription" - ], - "response": { - "$ref": "Subscription" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "list": { - "id": "pubsub.projects.subscriptions.list", - "path": "v1beta2/{+project}/subscriptions", - "httpMethod": "GET", - "description": "Lists matching subscriptions.", - "parameters": { - "project": { - "type": "string", - "description": "The name of the cloud project that subscriptions belong to.", - "required": true, - "pattern": "^projects/[^/]*$", - "location": "path" }, - "pageSize": { - "type": "integer", - "description": "Maximum number of subscriptions to return.", - "format": "int32", - "location": "query" - }, - "pageToken": { - "type": "string", - "description": "The value returned by the last `ListSubscriptionsResponse`; indicates that this is a continuation of a prior `ListSubscriptions` call, and that the system should return the next page of data.", - "location": "query" + "topics": { + "resources": { + "subscriptions": { + "methods": { + "list": { + "id": "pubsub.projects.topics.subscriptions.list", + "response": { + "$ref": "ListTopicSubscriptionsResponse" + }, + "parameterOrder": [ + "topic" + ], + "description": "Lists the name of the subscriptions for this topic.", + "flatPath": "v1beta2/projects/{projectsId}/topics/{topicsId}/subscriptions", + "httpMethod": "GET", + "parameters": { + "topic": { + "description": "The name of the topic that subscriptions are attached to.", + "required": true, + "pattern": "^projects/[^/]+/topics/[^/]+$", + "location": "path", + "type": "string" + }, + "pageSize": { + "description": "Maximum number of subscription names to return.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "pageToken": { + "description": "The value returned by the last `ListTopicSubscriptionsResponse`; indicates\nthat this is a continuation of a prior `ListTopicSubscriptions` call, and\nthat the system should return the next page of data.", + "location": "query", + "type": "string" + } + }, + "path": "v1beta2/{+topic}/subscriptions", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + } + } + } + }, + "methods": { + "getIamPolicy": { + "id": "pubsub.projects.topics.getIamPolicy", + "response": { + "$ref": "Policy" + }, + "parameterOrder": [ + "resource" + ], + "description": "Gets the access control policy for a resource.\nReturns an empty policy if the resource exists and does not have a policy\nset.", + "flatPath": "v1beta2/projects/{projectsId}/topics/{topicsId}:getIamPolicy", + "httpMethod": "GET", + "parameters": { + "resource": { + "description": "REQUIRED: The resource for which the policy is being requested.\n`resource` is usually specified as a path. For example, a Project\nresource is specified as `projects/{project}`.", + "required": true, + "pattern": "^projects/[^/]+/topics/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta2/{+resource}:getIamPolicy", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "publish": { + "id": "pubsub.projects.topics.publish", + "response": { + "$ref": "PublishResponse" + }, + "parameterOrder": [ + "topic" + ], + "description": "Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic\ndoes not exist. The message payload must not be empty; it must contain\n either a non-empty data field, or at least one attribute.", + "request": { + "$ref": "PublishRequest" + }, + "flatPath": "v1beta2/projects/{projectsId}/topics/{topicsId}:publish", + "httpMethod": "POST", + "parameters": { + "topic": { + "description": "The messages in the request will be published on this topic.", + "required": true, + "pattern": "^projects/[^/]+/topics/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta2/{+topic}:publish", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "list": { + "id": "pubsub.projects.topics.list", + "response": { + "$ref": "ListTopicsResponse" + }, + "parameterOrder": [ + "project" + ], + "description": "Lists matching topics.", + "flatPath": "v1beta2/projects/{projectsId}/topics", + "httpMethod": "GET", + "parameters": { + "pageSize": { + "description": "Maximum number of topics to return.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "project": { + "description": "The name of the cloud project that topics belong to.", + "required": true, + "pattern": "^projects/[^/]+$", + "location": "path", + "type": "string" + }, + "pageToken": { + "description": "The value returned by the last `ListTopicsResponse`; indicates that this is\na continuation of a prior `ListTopics` call, and that the system should\nreturn the next page of data.", + "location": "query", + "type": "string" + } + }, + "path": "v1beta2/{+project}/topics", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "get": { + "id": "pubsub.projects.topics.get", + "response": { + "$ref": "Topic" + }, + "parameterOrder": [ + "topic" + ], + "description": "Gets the configuration of a topic.", + "flatPath": "v1beta2/projects/{projectsId}/topics/{topicsId}", + "httpMethod": "GET", + "parameters": { + "topic": { + "description": "The name of the topic to get.", + "required": true, + "pattern": "^projects/[^/]+/topics/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta2/{+topic}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "create": { + "id": "pubsub.projects.topics.create", + "response": { + "$ref": "Topic" + }, + "parameterOrder": [ + "name" + ], + "description": "Creates the given topic with the given name.", + "request": { + "$ref": "Topic" + }, + "flatPath": "v1beta2/projects/{projectsId}/topics/{topicsId}", + "httpMethod": "PUT", + "parameters": { + "name": { + "description": "The name of the topic. It must have the format\n`\"projects/{project}/topics/{topic}\"`. `{topic}` must start with a letter,\nand contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`),\nunderscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent\nsigns (`%`). It must be between 3 and 255 characters in length, and it\nmust not start with `\"goog\"`.", + "required": true, + "pattern": "^projects/[^/]+/topics/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta2/{+name}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "setIamPolicy": { + "id": "pubsub.projects.topics.setIamPolicy", + "response": { + "$ref": "Policy" + }, + "parameterOrder": [ + "resource" + ], + "description": "Sets the access control policy on the specified resource. Replaces any\nexisting policy.", + "request": { + "$ref": "SetIamPolicyRequest" + }, + "flatPath": "v1beta2/projects/{projectsId}/topics/{topicsId}:setIamPolicy", + "httpMethod": "POST", + "parameters": { + "resource": { + "description": "REQUIRED: The resource for which the policy is being specified.\n`resource` is usually specified as a path. For example, a Project\nresource is specified as `projects/{project}`.", + "required": true, + "pattern": "^projects/[^/]+/topics/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta2/{+resource}:setIamPolicy", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "delete": { + "id": "pubsub.projects.topics.delete", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "topic" + ], + "description": "Deletes the topic with the given name. Returns `NOT_FOUND` if the topic\ndoes not exist. After a topic is deleted, a new topic may be created with\nthe same name; this is an entirely new topic with none of the old\nconfiguration or subscriptions. Existing subscriptions to this topic are\nnot deleted, but their `topic` field is set to `_deleted-topic_`.", + "flatPath": "v1beta2/projects/{projectsId}/topics/{topicsId}", + "httpMethod": "DELETE", + "parameters": { + "topic": { + "description": "Name of the topic to delete.", + "required": true, + "pattern": "^projects/[^/]+/topics/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta2/{+topic}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + }, + "testIamPermissions": { + "id": "pubsub.projects.topics.testIamPermissions", + "response": { + "$ref": "TestIamPermissionsResponse" + }, + "parameterOrder": [ + "resource" + ], + "description": "Returns permissions that a caller has on the specified resource.", + "request": { + "$ref": "TestIamPermissionsRequest" + }, + "flatPath": "v1beta2/projects/{projectsId}/topics/{topicsId}:testIamPermissions", + "httpMethod": "POST", + "parameters": { + "resource": { + "description": "REQUIRED: The resource for which the policy detail is being requested.\n`resource` is usually specified as a path. For example, a Project\nresource is specified as `projects/{project}`.", + "required": true, + "pattern": "^projects/[^/]+/topics/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta2/{+resource}:testIamPermissions", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub" + ] + } + } } - }, - "parameterOrder": [ - "project" - ], - "response": { - "$ref": "ListSubscriptionsResponse" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "delete": { - "id": "pubsub.projects.subscriptions.delete", - "path": "v1beta2/{+subscription}", - "httpMethod": "DELETE", - "description": "Deletes an existing subscription. All pending messages in the subscription are immediately dropped. Calls to `Pull` after deletion will return `NOT_FOUND`. After a subscription is deleted, a new one may be created with the same name, but the new one has no association with the old subscription, or its topic unless the same topic is specified.", - "parameters": { - "subscription": { - "type": "string", - "description": "The subscription to delete.", - "required": true, - "pattern": "^projects/[^/]*/subscriptions/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "subscription" - ], - "response": { - "$ref": "Empty" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "modifyAckDeadline": { - "id": "pubsub.projects.subscriptions.modifyAckDeadline", - "path": "v1beta2/{+subscription}:modifyAckDeadline", - "httpMethod": "POST", - "description": "Modifies the ack deadline for a specific message. This method is useful to indicate that more time is needed to process a message by the subscriber, or to make the message available for redelivery if the processing was interrupted.", - "parameters": { - "subscription": { - "type": "string", - "description": "The name of the subscription.", - "required": true, - "pattern": "^projects/[^/]*/subscriptions/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "subscription" - ], - "request": { - "$ref": "ModifyAckDeadlineRequest" - }, - "response": { - "$ref": "Empty" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "acknowledge": { - "id": "pubsub.projects.subscriptions.acknowledge", - "path": "v1beta2/{+subscription}:acknowledge", - "httpMethod": "POST", - "description": "Acknowledges the messages associated with the `ack_ids` in the `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages from the subscription. Acknowledging a message whose ack deadline has expired may succeed, but such a message may be redelivered later. Acknowledging a message more than once will not result in an error.", - "parameters": { - "subscription": { - "type": "string", - "description": "The subscription whose message is being acknowledged.", - "required": true, - "pattern": "^projects/[^/]*/subscriptions/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "subscription" - ], - "request": { - "$ref": "AcknowledgeRequest" - }, - "response": { - "$ref": "Empty" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "pull": { - "id": "pubsub.projects.subscriptions.pull", - "path": "v1beta2/{+subscription}:pull", - "httpMethod": "POST", - "description": "Pulls messages from the server. Returns an empty list if there are no messages available in the backlog. The server may return `UNAVAILABLE` if there are too many concurrent pull requests pending for the given subscription.", - "parameters": { - "subscription": { - "type": "string", - "description": "The subscription from which messages should be pulled.", - "required": true, - "pattern": "^projects/[^/]*/subscriptions/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "subscription" - ], - "request": { - "$ref": "PullRequest" - }, - "response": { - "$ref": "PullResponse" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] - }, - "modifyPushConfig": { - "id": "pubsub.projects.subscriptions.modifyPushConfig", - "path": "v1beta2/{+subscription}:modifyPushConfig", - "httpMethod": "POST", - "description": "Modifies the `PushConfig` for a specified subscription. This may be used to change a push subscription to a pull one (signified by an empty `PushConfig`) or vice versa, or change the endpoint URL and other attributes of a push subscription. Messages will accumulate for delivery continuously through the call regardless of changes to the `PushConfig`.", - "parameters": { - "subscription": { - "type": "string", - "description": "The name of the subscription.", - "required": true, - "pattern": "^projects/[^/]*/subscriptions/[^/]*$", - "location": "path" - } - }, - "parameterOrder": [ - "subscription" - ], - "request": { - "$ref": "ModifyPushConfigRequest" - }, - "response": { - "$ref": "Empty" - }, - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ] } - } } - } - } - } + }, + "schemas": { + "Topic": { + "description": "A topic resource.", + "type": "object", + "properties": { + "name": { + "description": "The name of the topic. It must have the format\n`\"projects/{project}/topics/{topic}\"`. `{topic}` must start with a letter,\nand contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`),\nunderscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent\nsigns (`%`). It must be between 3 and 255 characters in length, and it\nmust not start with `\"goog\"`.", + "type": "string" + } + }, + "id": "Topic" + }, + "SetIamPolicyRequest": { + "description": "Request message for `SetIamPolicy` method.", + "type": "object", + "properties": { + "policy": { + "description": "REQUIRED: The complete policy to be applied to the `resource`. The size of\nthe policy is limited to a few 10s of KB. An empty policy is a\nvalid policy but certain Cloud Platform services (such as Projects)\nmight reject them.", + "$ref": "Policy" + } + }, + "id": "SetIamPolicyRequest" + }, + "ReceivedMessage": { + "description": "A message and its corresponding acknowledgment ID.", + "type": "object", + "properties": { + "ackId": { + "description": "This ID can be used to acknowledge the received message.", + "type": "string" + }, + "message": { + "description": "The message.", + "$ref": "PubsubMessage" + } + }, + "id": "ReceivedMessage" + }, + "PublishRequest": { + "description": "Request for the Publish method.", + "type": "object", + "properties": { + "messages": { + "description": "The messages to publish.", + "type": "array", + "items": { + "$ref": "PubsubMessage" + } + } + }, + "id": "PublishRequest" + }, + "TestIamPermissionsResponse": { + "description": "Response message for `TestIamPermissions` method.", + "type": "object", + "properties": { + "permissions": { + "description": "A subset of `TestPermissionsRequest.permissions` that the caller is\nallowed.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "id": "TestIamPermissionsResponse" + }, + "PublishResponse": { + "description": "Response for the `Publish` method.", + "type": "object", + "properties": { + "messageIds": { + "description": "The server-assigned ID of each published message, in the same order as\nthe messages in the request. IDs are guaranteed to be unique within\nthe topic.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "id": "PublishResponse" + }, + "ListSubscriptionsResponse": { + "description": "Response for the `ListSubscriptions` method.", + "type": "object", + "properties": { + "subscriptions": { + "description": "The subscriptions that match the request.", + "type": "array", + "items": { + "$ref": "Subscription" + } + }, + "nextPageToken": { + "description": "If not empty, indicates that there may be more subscriptions that match\nthe request; this value should be passed in a new\n`ListSubscriptionsRequest` to get more subscriptions.", + "type": "string" + } + }, + "id": "ListSubscriptionsResponse" + }, + "Policy": { + "description": "Defines an Identity and Access Management (IAM) policy. It is used to\nspecify access control policies for Cloud Platform resources.\n\n\nA `Policy` consists of a list of `bindings`. A `Binding` binds a list of\n`members` to a `role`, where the members can be user accounts, Google groups,\nGoogle domains, and service accounts. A `role` is a named list of permissions\ndefined by IAM.\n\n**Example**\n\n {\n \"bindings\": [\n {\n \"role\": \"roles/owner\",\n \"members\": [\n \"user:mike@example.com\",\n \"group:admins@example.com\",\n \"domain:google.com\",\n \"serviceAccount:my-other-app@appspot.gserviceaccount.com\",\n ]\n },\n {\n \"role\": \"roles/viewer\",\n \"members\": [\"user:sean@example.com\"]\n }\n ]\n }\n\nFor a description of IAM and its features, see the\n[IAM developer's guide](https://cloud.google.com/iam).", + "type": "object", + "properties": { + "bindings": { + "description": "Associates a list of `members` to a `role`.\nMultiple `bindings` must not be specified for the same `role`.\n`bindings` with no members will result in an error.", + "type": "array", + "items": { + "$ref": "Binding" + } + }, + "etag": { + "description": "`etag` is used for optimistic concurrency control as a way to help\nprevent simultaneous updates of a policy from overwriting each other.\nIt is strongly suggested that systems make use of the `etag` in the\nread-modify-write cycle to perform policy updates in order to avoid race\nconditions: An `etag` is returned in the response to `getIamPolicy`, and\nsystems are expected to put that etag in the request to `setIamPolicy` to\nensure that their change will be applied to the same version of the policy.\n\nIf no `etag` is provided in the call to `setIamPolicy`, then the existing\npolicy is overwritten blindly.", + "type": "string", + "format": "byte" + }, + "version": { + "description": "Version of the `Policy`. The default version is 0.", + "type": "integer", + "format": "int32" + } + }, + "id": "Policy" + }, + "ListTopicSubscriptionsResponse": { + "description": "Response for the `ListTopicSubscriptions` method.", + "type": "object", + "properties": { + "subscriptions": { + "description": "The names of the subscriptions that match the request.", + "type": "array", + "items": { + "type": "string" + } + }, + "nextPageToken": { + "description": "If not empty, indicates that there may be more subscriptions that match\nthe request; this value should be passed in a new\n`ListTopicSubscriptionsRequest` to get more subscriptions.", + "type": "string" + } + }, + "id": "ListTopicSubscriptionsResponse" + }, + "Subscription": { + "description": "A subscription resource.", + "type": "object", + "properties": { + "pushConfig": { + "description": "If push delivery is used with this subscription, this field is\nused to configure it. An empty `pushConfig` signifies that the subscriber\nwill pull and ack messages using API methods.", + "$ref": "PushConfig" + }, + "topic": { + "description": "The name of the topic from which this subscription is receiving messages.\nThe value of this field will be `_deleted-topic_` if the topic has been\ndeleted.", + "type": "string" + }, + "ackDeadlineSeconds": { + "description": "This value is the maximum time after a subscriber receives a message\nbefore the subscriber should acknowledge the message. After message\ndelivery but before the ack deadline expires and before the message is\nacknowledged, it is an outstanding message and will not be delivered\nagain during that time (on a best-effort basis).\n\nFor pull subscriptions, this value is used as the initial value for the ack\ndeadline. To override this value for a given message, call\n`ModifyAckDeadline` with the corresponding `ack_id` if using pull.\nThe maximum custom deadline you can specify is 600 seconds (10 minutes).\n\nFor push delivery, this value is also used to set the request timeout for\nthe call to the push endpoint.\n\nIf the subscriber never acknowledges the message, the Pub/Sub\nsystem will eventually redeliver the message.\n\nIf this parameter is 0, a default value of 10 seconds is used.", + "type": "integer", + "format": "int32" + }, + "name": { + "description": "The name of the subscription. It must have the format\n`\"projects/{project}/subscriptions/{subscription}\"`. `{subscription}` must\nstart with a letter, and contain only letters (`[A-Za-z]`), numbers\n(`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),\nplus (`+`) or percent signs (`%`). It must be between 3 and 255 characters\nin length, and it must not start with `\"goog\"`.", + "type": "string" + } + }, + "id": "Subscription" + }, + "ModifyAckDeadlineRequest": { + "description": "Request for the ModifyAckDeadline method.", + "type": "object", + "properties": { + "ackDeadlineSeconds": { + "description": "The new ack deadline with respect to the time this request was sent to\nthe Pub/Sub system. Must be \u003e= 0. For example, if the value is 10, the new\nack deadline will expire 10 seconds after the `ModifyAckDeadline` call\nwas made. Specifying zero may immediately make the message available for\nanother pull request.", + "type": "integer", + "format": "int32" + }, + "ackId": { + "description": "The acknowledgment ID. Either this or ack_ids must be populated, but not\nboth.", + "type": "string" + }, + "ackIds": { + "description": "List of acknowledgment IDs.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "id": "ModifyAckDeadlineRequest" + }, + "TestIamPermissionsRequest": { + "description": "Request message for `TestIamPermissions` method.", + "type": "object", + "properties": { + "permissions": { + "description": "The set of permissions to check for the `resource`. Permissions with\nwildcards (such as '*' or 'storage.*') are not allowed. For more\ninformation see\n[IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).", + "type": "array", + "items": { + "type": "string" + } + } + }, + "id": "TestIamPermissionsRequest" + }, + "PushConfig": { + "description": "Configuration for a push delivery endpoint.", + "type": "object", + "properties": { + "attributes": { + "description": "Endpoint configuration attributes.\n\nEvery endpoint has a set of API supported attributes that can be used to\ncontrol different aspects of the message delivery.\n\nThe currently supported attribute is `x-goog-version`, which you can\nuse to change the format of the push message. This attribute\nindicates the version of the data expected by the endpoint. This\ncontrols the shape of the envelope (i.e. its fields and metadata).\nThe endpoint version is based on the version of the Pub/Sub\nAPI.\n\nIf not present during the `CreateSubscription` call, it will default to\nthe version of the API used to make such call. If not present during a\n`ModifyPushConfig` call, its value will not be changed. `GetSubscription`\ncalls will always return a valid version, even if the subscription was\ncreated without this attribute.\n\nThe possible values for this attribute are:\n\n* `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.\n* `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.", + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + "pushEndpoint": { + "description": "A URL locating the endpoint to which messages should be pushed.\nFor example, a Webhook endpoint might use \"https://example.com/push\".", + "type": "string" + } + }, + "id": "PushConfig" + }, + "PullRequest": { + "description": "Request for the `Pull` method.", + "type": "object", + "properties": { + "returnImmediately": { + "description": "If this is specified as true the system will respond immediately even if\nit is not able to return a message in the `Pull` response. Otherwise the\nsystem is allowed to wait until at least one message is available rather\nthan returning no messages. The client may cancel the request if it does\nnot wish to wait any longer for the response.", + "type": "boolean" + }, + "maxMessages": { + "description": "The maximum number of messages returned for this request. The Pub/Sub\nsystem may return fewer than the number specified.", + "type": "integer", + "format": "int32" + } + }, + "id": "PullRequest" + }, + "ModifyPushConfigRequest": { + "description": "Request for the ModifyPushConfig method.", + "type": "object", + "properties": { + "pushConfig": { + "description": "The push configuration for future deliveries.\n\nAn empty `pushConfig` indicates that the Pub/Sub system should\nstop pushing messages from the given subscription and allow\nmessages to be pulled and acknowledged - effectively pausing\nthe subscription if `Pull` is not called.", + "$ref": "PushConfig" + } + }, + "id": "ModifyPushConfigRequest" + }, + "PullResponse": { + "description": "Response for the `Pull` method.", + "type": "object", + "properties": { + "receivedMessages": { + "description": "Received Pub/Sub messages. The Pub/Sub system will return zero messages if\nthere are no more available in the backlog. The Pub/Sub system may return\nfewer than the `maxMessages` requested even if there are more messages\navailable in the backlog.", + "type": "array", + "items": { + "$ref": "ReceivedMessage" + } + } + }, + "id": "PullResponse" + }, + "PubsubMessage": { + "description": "A message data and its attributes. The message payload must not be empty;\nit must contain either a non-empty data field, or at least one attribute.", + "type": "object", + "properties": { + "data": { + "description": "The message payload. For JSON requests, the value of this field must be\n[base64-encoded](https://tools.ietf.org/html/rfc4648).", + "type": "string", + "format": "byte" + }, + "attributes": { + "description": "Optional attributes for this message.", + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + "messageId": { + "description": "ID of this message, assigned by the server when the message is published.\nGuaranteed to be unique within the topic. This value may be read by a\nsubscriber that receives a `PubsubMessage` via a `Pull` call or a push\ndelivery. It must not be populated by the publisher in a `Publish` call.", + "type": "string" + }, + "publishTime": { + "description": "The time at which the message was published, populated by the server when\nit receives the `Publish` call. It must not be populated by the\npublisher in a `Publish` call.", + "type": "string", + "format": "google-datetime" + } + }, + "id": "PubsubMessage" + }, + "AcknowledgeRequest": { + "description": "Request for the Acknowledge method.", + "type": "object", + "properties": { + "ackIds": { + "description": "The acknowledgment ID for the messages being acknowledged that was returned\nby the Pub/Sub system in the `Pull` response. Must not be empty.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "id": "AcknowledgeRequest" + }, + "Empty": { + "description": "A generic empty message that you can re-use to avoid defining duplicated\nempty messages in your APIs. A typical example is to use it as the request\nor the response type of an API method. For instance:\n\n service Foo {\n rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);\n }\n\nThe JSON representation for `Empty` is empty JSON object `{}`.", + "type": "object", + "properties": {}, + "id": "Empty" + }, + "ListTopicsResponse": { + "description": "Response for the `ListTopics` method.", + "type": "object", + "properties": { + "nextPageToken": { + "description": "If not empty, indicates that there may be more topics that match the\nrequest; this value should be passed in a new `ListTopicsRequest`.", + "type": "string" + }, + "topics": { + "description": "The resulting topics.", + "type": "array", + "items": { + "$ref": "Topic" + } + } + }, + "id": "ListTopicsResponse" + }, + "Binding": { + "description": "Associates `members` with a `role`.", + "type": "object", + "properties": { + "members": { + "description": "Specifies the identities requesting access for a Cloud Platform resource.\n`members` can have the following values:\n\n* `allUsers`: A special identifier that represents anyone who is\n on the internet; with or without a Google account.\n\n* `allAuthenticatedUsers`: A special identifier that represents anyone\n who is authenticated with a Google account or a service account.\n\n* `user:{emailid}`: An email address that represents a specific Google\n account. For example, `alice@gmail.com` or `joe@example.com`.\n\n\n* `serviceAccount:{emailid}`: An email address that represents a service\n account. For example, `my-other-app@appspot.gserviceaccount.com`.\n\n* `group:{emailid}`: An email address that represents a Google group.\n For example, `admins@example.com`.\n\n* `domain:{domain}`: A Google Apps domain name that represents all the\n users of that domain. For example, `google.com` or `example.com`.\n\n", + "type": "array", + "items": { + "type": "string" + } + }, + "role": { + "description": "Role that is assigned to `members`.\nFor example, `roles/viewer`, `roles/editor`, or `roles/owner`.\nRequired", + "type": "string" + } + }, + "id": "Binding" + } + }, + "revision": "20161122", + "basePath": "", + "icons": { + "x32": "http://www.google.com/images/icons/product/search-32.gif", + "x16": "http://www.google.com/images/icons/product/search-16.gif" + }, + "discoveryVersion": "v1", + "baseUrl": "https://pubsub.googleapis.com/", + "name": "pubsub", + "parameters": { + "access_token": { + "description": "OAuth access token.", + "type": "string", + "location": "query" + }, + "prettyPrint": { + "description": "Returns response with indentations and line breaks.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "key": { + "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", + "type": "string", + "location": "query" + }, + "quotaUser": { + "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.", + "type": "string", + "location": "query" + }, + "pp": { + "description": "Pretty-print response.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "fields": { + "description": "Selector specifying which fields to include in a partial response.", + "type": "string", + "location": "query" + }, + "alt": { + "description": "Data format for response.", + "location": "query", + "enum": [ + "json", + "media", + "proto" + ], + "default": "json", + "enumDescriptions": [ + "Responses with Content-Type of application/json", + "Media download with context-dependent Content-Type", + "Responses with Content-Type of application/x-protobuf" + ], + "type": "string" + }, + "$.xgafv": { + "description": "V1 error format.", + "enum": [ + "1", + "2" + ], + "enumDescriptions": [ + "v1 error format", + "v2 error format" + ], + "type": "string", + "location": "query" + }, + "callback": { + "description": "JSONP", + "type": "string", + "location": "query" + }, + "oauth_token": { + "description": "OAuth 2.0 token for the current user.", + "type": "string", + "location": "query" + }, + "uploadType": { + "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").", + "type": "string", + "location": "query" + }, + "bearer_token": { + "description": "OAuth bearer token.", + "type": "string", + "location": "query" + }, + "upload_protocol": { + "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").", + "type": "string", + "location": "query" + } + }, + "documentationLink": "https://cloud.google.com/pubsub/docs", + "ownerDomain": "google.com", + "batchPath": "batch", + "servicePath": "", + "ownerName": "Google", + "version": "v1beta2", + "rootUrl": "https://pubsub.googleapis.com/", + "kind": "discovery#restDescription" } diff --git a/etc/api/qpxexpress/v1/qpxexpress-api.json b/etc/api/qpxexpress/v1/qpxexpress-api.json index 33f90e31e8..075e71efa0 100644 --- a/etc/api/qpxexpress/v1/qpxexpress-api.json +++ b/etc/api/qpxexpress/v1/qpxexpress-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/ijp44wmwc3ANNTETi-Hxe_Mf9S0\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/2IuExnuYIfWTklADntnFv6u9T0g\"", "discoveryVersion": "v1", "id": "qpxExpress:v1", "name": "qpxExpress", @@ -12,8 +12,8 @@ "ownerDomain": "google.com", "ownerName": "Google", "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" }, "documentationLink": "http://developers.google.com/qpx-express", "protocol": "rest", diff --git a/etc/api/replicapool/v1beta1/replicapool-api.json b/etc/api/replicapool/v1beta1/replicapool-api.json index 7ca65a9b72..6ec1fc44db 100644 --- a/etc/api/replicapool/v1beta1/replicapool-api.json +++ b/etc/api/replicapool/v1beta1/replicapool-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/02c3brt5wR0JN0c2o9m2_Ei9JvA\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/jlteK0NbZ8atlXF9lM-OU-ZamcA\"", "discoveryVersion": "v1", "id": "replicapool:v1beta1", "name": "replicapool", @@ -11,8 +11,8 @@ "ownerDomain": "google.com", "ownerName": "Google", "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" }, "documentationLink": "https://developers.google.com/compute/docs/replica-pool/", "labels": [ diff --git a/etc/api/replicapool/v1beta2/replicapool-api.json b/etc/api/replicapool/v1beta2/replicapool-api.json index 1b0a0ff03a..19a1ee5f62 100644 --- a/etc/api/replicapool/v1beta2/replicapool-api.json +++ b/etc/api/replicapool/v1beta2/replicapool-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/TpUz2pYaIGRouf7x77PYtXiOnk4\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/TeJ87k5AaNhxSfkpXHKHkISW9Dw\"", "discoveryVersion": "v1", "id": "replicapool:v1beta2", "name": "replicapool", @@ -11,8 +11,8 @@ "ownerDomain": "google.com", "ownerName": "Google", "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" }, "documentationLink": "https://developers.google.com/compute/docs/instance-groups/manager/v1beta2", "labels": [ diff --git a/etc/api/replicapoolupdater/v1beta1/replicapoolupdater-api.json b/etc/api/replicapoolupdater/v1beta1/replicapoolupdater-api.json index 3000a78652..63a099ac1d 100644 --- a/etc/api/replicapoolupdater/v1beta1/replicapoolupdater-api.json +++ b/etc/api/replicapoolupdater/v1beta1/replicapoolupdater-api.json @@ -1,18 +1,18 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/Qa39yJM3yH1r8biVjTDz07Q6Imo\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/UEKDxDt-gBRW5wBq_kkcVGVpuQc\"", "discoveryVersion": "v1", "id": "replicapoolupdater:v1beta1", "name": "replicapoolupdater", "version": "v1beta1", - "revision": "20160229", + "revision": "20161003", "title": "Google Compute Engine Instance Group Updater API", - "description": "Updates groups of Compute Engine instances.", + "description": "[Deprecated. Please use compute.instanceGroupManagers.update method. replicapoolupdater API will be disabled after December 30th, 2016] Updates groups of Compute Engine instances.", "ownerDomain": "google.com", "ownerName": "Google", "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" }, "documentationLink": "https://cloud.google.com/compute/docs/instance-groups/manager/#applying_rolling_updates_using_the_updater_service", "labels": [ diff --git a/etc/api/reseller/v1/reseller-api.json b/etc/api/reseller/v1/reseller-api.json index d70797812a..d97ad040f0 100644 --- a/etc/api/reseller/v1/reseller-api.json +++ b/etc/api/reseller/v1/reseller-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/YYt2cLTkBPBrBPF_Oe4KxSogSAI\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/n63v3jbq0NMxEV0nJ3he6mTRpog\"", "discoveryVersion": "v1", "id": "reseller:v1", "name": "reseller", @@ -11,8 +11,8 @@ "ownerDomain": "google.com", "ownerName": "Google", "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" }, "documentationLink": "https://developers.google.com/google-apps/reseller/", "labels": [ diff --git a/etc/api/resourceviews/v1beta1/resourceviews-api.json b/etc/api/resourceviews/v1beta1/resourceviews-api.json index 051f4c4989..2c53f99e43 100644 --- a/etc/api/resourceviews/v1beta1/resourceviews-api.json +++ b/etc/api/resourceviews/v1beta1/resourceviews-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/NU3_Tlv6JnVBus3nYOmc2eYKXAs\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/HxZRDFK7f86Z7kwjlvcp4S6C4Oc\"", "discoveryVersion": "v1", "id": "resourceviews:v1beta1", "name": "resourceviews", @@ -11,8 +11,8 @@ "ownerDomain": "google.com", "ownerName": "Google", "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" }, "documentationLink": "https://developers.google.com/compute/", "labels": [ diff --git a/etc/api/resourceviews/v1beta2/resourceviews-api.json b/etc/api/resourceviews/v1beta2/resourceviews-api.json index 83499195dd..863f48530c 100644 --- a/etc/api/resourceviews/v1beta2/resourceviews-api.json +++ b/etc/api/resourceviews/v1beta2/resourceviews-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/fUFoXO3TEWpyAX5ITesLbqEiy3A\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/lDspG_RuIpldIEGq_lxUn6PFZOk\"", "discoveryVersion": "v1", "id": "resourceviews:v1beta2", "name": "resourceviews", @@ -11,8 +11,8 @@ "ownerDomain": "google.com", "ownerName": "Google", "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" }, "documentationLink": "https://developers.google.com/compute/", "labels": [ diff --git a/etc/api/runtimeconfig/v1/runtimeconfig-api.json b/etc/api/runtimeconfig/v1/runtimeconfig-api.json new file mode 100644 index 0000000000..eb858f7e6e --- /dev/null +++ b/etc/api/runtimeconfig/v1/runtimeconfig-api.json @@ -0,0 +1,322 @@ +{ + "id": "runtimeconfig:v1", + "auth": { + "oauth2": { + "scopes": { + "https://www.googleapis.com/auth/cloud-platform": { + "description": "View and manage your data across Google Cloud Platform services" + }, + "https://www.googleapis.com/auth/cloudruntimeconfig": { + "description": "Manage your Google Cloud Platform services' runtime configuration" + } + } + } + }, + "description": "Provides capabilities for dynamic configuration and coordination for applications running on Google Cloud Platform.\n", + "protocol": "rest", + "title": "Google Cloud RuntimeConfig API", + "resources": { + "operations": { + "methods": { + "list": { + "id": "runtimeconfig.operations.list", + "response": { + "$ref": "ListOperationsResponse" + }, + "parameterOrder": [ + "name" + ], + "description": "Lists operations that match the specified filter in the request. If the\nserver doesn't support this method, it returns `UNIMPLEMENTED`.\n\nNOTE: the `name` binding below allows API services to override the binding\nto use different resource name schemes, such as `users/*/operations`.", + "flatPath": "v1/operations", + "httpMethod": "GET", + "parameters": { + "pageSize": { + "description": "The standard list page size.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "filter": { + "description": "The standard list filter.", + "location": "query", + "type": "string" + }, + "name": { + "description": "The name of the operation collection.", + "required": true, + "pattern": "^operations$", + "location": "path", + "type": "string" + }, + "pageToken": { + "description": "The standard list page token.", + "location": "query", + "type": "string" + } + }, + "path": "v1/{+name}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloudruntimeconfig" + ] + }, + "delete": { + "id": "runtimeconfig.operations.delete", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "name" + ], + "description": "Deletes a long-running operation. This method indicates that the client is\nno longer interested in the operation result. It does not cancel the\noperation. If the server doesn't support this method, it returns\n`google.rpc.Code.UNIMPLEMENTED`.", + "flatPath": "v1/operations/{operationsId}", + "httpMethod": "DELETE", + "parameters": { + "name": { + "description": "The name of the operation resource to be deleted.", + "required": true, + "pattern": "^operations/.+$", + "location": "path", + "type": "string" + } + }, + "path": "v1/{+name}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloudruntimeconfig" + ] + }, + "cancel": { + "id": "runtimeconfig.operations.cancel", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "name" + ], + "description": "Starts asynchronous cancellation on a long-running operation. The server\nmakes a best effort to cancel the operation, but success is not\nguaranteed. If the server doesn't support this method, it returns\n`google.rpc.Code.UNIMPLEMENTED`. Clients can use\nOperations.GetOperation or\nother methods to check whether the cancellation succeeded or whether the\noperation completed despite cancellation. On successful cancellation,\nthe operation is not deleted; instead, it becomes an operation with\nan Operation.error value with a google.rpc.Status.code of 1,\ncorresponding to `Code.CANCELLED`.", + "request": { + "$ref": "CancelOperationRequest" + }, + "flatPath": "v1/operations/{operationsId}:cancel", + "httpMethod": "POST", + "parameters": { + "name": { + "description": "The name of the operation resource to be cancelled.", + "required": true, + "pattern": "^operations/.+$", + "location": "path", + "type": "string" + } + }, + "path": "v1/{+name}:cancel", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloudruntimeconfig" + ] + } + } + } + }, + "schemas": { + "ListOperationsResponse": { + "description": "The response message for Operations.ListOperations.", + "type": "object", + "properties": { + "nextPageToken": { + "description": "The standard List next-page token.", + "type": "string" + }, + "operations": { + "description": "A list of operations that matches the specified filter in the request.", + "type": "array", + "items": { + "$ref": "Operation" + } + } + }, + "id": "ListOperationsResponse" + }, + "Empty": { + "description": "A generic empty message that you can re-use to avoid defining duplicated\nempty messages in your APIs. A typical example is to use it as the request\nor the response type of an API method. For instance:\n\n service Foo {\n rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);\n }\n\nThe JSON representation for `Empty` is empty JSON object `{}`.", + "type": "object", + "properties": {}, + "id": "Empty" + }, + "Status": { + "description": "The `Status` type defines a logical error model that is suitable for different\nprogramming environments, including REST APIs and RPC APIs. It is used by\n[gRPC](https://github.com/grpc). The error model is designed to be:\n\n- Simple to use and understand for most users\n- Flexible enough to meet unexpected needs\n\n# Overview\n\nThe `Status` message contains three pieces of data: error code, error message,\nand error details. The error code should be an enum value of\ngoogle.rpc.Code, but it may accept additional error codes if needed. The\nerror message should be a developer-facing English message that helps\ndevelopers *understand* and *resolve* the error. If a localized user-facing\nerror message is needed, put the localized message in the error details or\nlocalize it in the client. The optional error details may contain arbitrary\ninformation about the error. There is a predefined set of error detail types\nin the package `google.rpc` which can be used for common error conditions.\n\n# Language mapping\n\nThe `Status` message is the logical representation of the error model, but it\nis not necessarily the actual wire format. When the `Status` message is\nexposed in different client libraries and different wire protocols, it can be\nmapped differently. For example, it will likely be mapped to some exceptions\nin Java, but more likely mapped to some error codes in C.\n\n# Other uses\n\nThe error model and the `Status` message can be used in a variety of\nenvironments, either with or without APIs, to provide a\nconsistent developer experience across different environments.\n\nExample uses of this error model include:\n\n- Partial errors. If a service needs to return partial errors to the client,\n it may embed the `Status` in the normal response to indicate the partial\n errors.\n\n- Workflow errors. A typical workflow has multiple steps. Each step may\n have a `Status` message for error reporting purpose.\n\n- Batch operations. If a client uses batch request and batch response, the\n `Status` message should be used directly inside batch response, one for\n each error sub-response.\n\n- Asynchronous operations. If an API call embeds asynchronous operation\n results in its response, the status of those operations should be\n represented directly using the `Status` message.\n\n- Logging. If some API errors are stored in logs, the message `Status` could\n be used directly after any stripping needed for security/privacy reasons.", + "type": "object", + "properties": { + "code": { + "description": "The status code, which should be an enum value of google.rpc.Code.", + "type": "integer", + "format": "int32" + }, + "details": { + "description": "A list of messages that carry the error details. There will be a\ncommon set of message types for APIs to use.", + "type": "array", + "items": { + "additionalProperties": { + "description": "Properties of the object. Contains field @type with type URL.", + "type": "any" + }, + "type": "object" + } + }, + "message": { + "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\ngoogle.rpc.Status.details field, or localized by the client.", + "type": "string" + } + }, + "id": "Status" + }, + "Operation": { + "description": "This resource represents a long-running operation that is the result of a\nnetwork API call.", + "type": "object", + "properties": { + "error": { + "description": "The error result of the operation in case of failure or cancellation.", + "$ref": "Status" + }, + "done": { + "description": "If the value is `false`, it means the operation is still in progress.\nIf true, the operation is completed, and either `error` or `response` is\navailable.", + "type": "boolean" + }, + "metadata": { + "description": "Service-specific metadata associated with the operation. It typically\ncontains progress information and common metadata such as create time.\nSome services might not provide such metadata. Any method that returns a\nlong-running operation should document the metadata type, if any.", + "additionalProperties": { + "description": "Properties of the object. Contains field @type with type URL.", + "type": "any" + }, + "type": "object" + }, + "response": { + "description": "The normal response of the operation in case of success. If the original\nmethod returns no data on success, such as `Delete`, the response is\n`google.protobuf.Empty`. If the original method is standard\n`Get`/`Create`/`Update`, the response should be the resource. For other\nmethods, the response should have the type `XxxResponse`, where `Xxx`\nis the original method name. For example, if the original method name\nis `TakeSnapshot()`, the inferred response type is\n`TakeSnapshotResponse`.", + "additionalProperties": { + "description": "Properties of the object. Contains field @type with type URL.", + "type": "any" + }, + "type": "object" + }, + "name": { + "description": "The server-assigned name, which is only unique within the same service that\noriginally returns it. If you use the default HTTP mapping, the\n`name` should have the format of `operations/some/unique/name`.", + "type": "string" + } + }, + "id": "Operation" + }, + "CancelOperationRequest": { + "description": "The request message for Operations.CancelOperation.", + "type": "object", + "properties": {}, + "id": "CancelOperationRequest" + } + }, + "revision": "20161213", + "basePath": "", + "icons": { + "x32": "http://www.google.com/images/icons/product/search-32.gif", + "x16": "http://www.google.com/images/icons/product/search-16.gif" + }, + "version_module": "True", + "canonicalName": "Cloud RuntimeConfig", + "discoveryVersion": "v1", + "baseUrl": "https://runtimeconfig.googleapis.com/", + "name": "runtimeconfig", + "parameters": { + "access_token": { + "description": "OAuth access token.", + "type": "string", + "location": "query" + }, + "prettyPrint": { + "description": "Returns response with indentations and line breaks.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "key": { + "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", + "type": "string", + "location": "query" + }, + "quotaUser": { + "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.", + "type": "string", + "location": "query" + }, + "pp": { + "description": "Pretty-print response.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "fields": { + "description": "Selector specifying which fields to include in a partial response.", + "type": "string", + "location": "query" + }, + "alt": { + "description": "Data format for response.", + "location": "query", + "enum": [ + "json", + "media", + "proto" + ], + "default": "json", + "enumDescriptions": [ + "Responses with Content-Type of application/json", + "Media download with context-dependent Content-Type", + "Responses with Content-Type of application/x-protobuf" + ], + "type": "string" + }, + "$.xgafv": { + "description": "V1 error format.", + "enum": [ + "1", + "2" + ], + "enumDescriptions": [ + "v1 error format", + "v2 error format" + ], + "type": "string", + "location": "query" + }, + "callback": { + "description": "JSONP", + "type": "string", + "location": "query" + }, + "oauth_token": { + "description": "OAuth 2.0 token for the current user.", + "type": "string", + "location": "query" + }, + "uploadType": { + "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").", + "type": "string", + "location": "query" + }, + "bearer_token": { + "description": "OAuth bearer token.", + "type": "string", + "location": "query" + }, + "upload_protocol": { + "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").", + "type": "string", + "location": "query" + } + }, + "documentationLink": "https://cloud.google.com/deployment-manager/runtime-configurator/", + "ownerDomain": "google.com", + "batchPath": "batch", + "servicePath": "", + "ownerName": "Google", + "version": "v1", + "rootUrl": "https://runtimeconfig.googleapis.com/", + "kind": "discovery#restDescription" +} diff --git a/etc/api/runtimeconfig/v1beta1/runtimeconfig-api.json b/etc/api/runtimeconfig/v1beta1/runtimeconfig-api.json index e69de29bb2..688bd6ba0f 100644 --- a/etc/api/runtimeconfig/v1beta1/runtimeconfig-api.json +++ b/etc/api/runtimeconfig/v1beta1/runtimeconfig-api.json @@ -0,0 +1,1156 @@ +{ + "id": "runtimeconfig:v1beta1", + "auth": { + "oauth2": { + "scopes": { + "https://www.googleapis.com/auth/cloud-platform": { + "description": "View and manage your data across Google Cloud Platform services" + }, + "https://www.googleapis.com/auth/cloudruntimeconfig": { + "description": "Manage your Google Cloud Platform services' runtime configuration" + } + } + } + }, + "description": "Provides capabilities for dynamic configuration and coordination for applications running on Google Cloud Platform.\n", + "protocol": "rest", + "title": "Google Cloud RuntimeConfig API", + "resources": { + "projects": { + "resources": { + "configs": { + "resources": { + "variables": { + "methods": { + "watch": { + "id": "runtimeconfig.projects.configs.variables.watch", + "response": { + "$ref": "Variable" + }, + "parameterOrder": [ + "name" + ], + "description": "Watches a specific variable and waits for a change in the variable's value.\nWhen there is a change, this method returns the new value or times out.\n\nIf a variable is deleted while being watched, the `variableState` state is\nset to `DELETED` and the method returns the last known variable `value`.\n\nIf you set the deadline for watching to a larger value than internal timeout\n(60 seconds), the current variable value is returned and the `variableState`\nwill be `VARIABLE_STATE_UNSPECIFIED`.\n\nTo learn more about creating a watcher, read the\n[Watching a Variable for Changes](/deployment-manager/runtime-configurator/watching-a-variable)\ndocumentation.", + "request": { + "$ref": "WatchVariableRequest" + }, + "flatPath": "v1beta1/projects/{projectsId}/configs/{configsId}/variables/{variablesId}:watch", + "httpMethod": "POST", + "parameters": { + "name": { + "description": "The name of the variable to watch, in the format:\n\n`projects/[PROJECT_ID]/configs/[CONFIG_NAME]`", + "required": true, + "pattern": "^projects/[^/]+/configs/[^/]+/variables/.+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/{+name}:watch", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloudruntimeconfig" + ] + }, + "list": { + "id": "runtimeconfig.projects.configs.variables.list", + "response": { + "$ref": "ListVariablesResponse" + }, + "parameterOrder": [ + "parent" + ], + "description": "Lists variables within given a configuration, matching any provided filters.\nThis only lists variable names, not the values.", + "flatPath": "v1beta1/projects/{projectsId}/configs/{configsId}/variables", + "httpMethod": "GET", + "parameters": { + "pageSize": { + "description": "Specifies the number of results to return per page. If there are fewer\nelements than the specified number, returns all elements.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "filter": { + "description": "Filters variables by matching the specified filter. For example:\n\n`projects/example-project/config/[CONFIG_NAME]/variables/example-variable`.", + "location": "query", + "type": "string" + }, + "parent": { + "description": "The path to the RuntimeConfig resource for which you want to list variables.\nThe configuration must exist beforehand; the path must by in the format:\n\n`projects/[PROJECT_ID]/configs/[CONFIG_NAME]`", + "required": true, + "pattern": "^projects/[^/]+/configs/[^/]+$", + "location": "path", + "type": "string" + }, + "pageToken": { + "description": "Specifies a page token to use. Set `pageToken` to a `nextPageToken`\nreturned by a previous list request to get the next page of results.", + "location": "query", + "type": "string" + } + }, + "path": "v1beta1/{+parent}/variables", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloudruntimeconfig" + ] + }, + "get": { + "id": "runtimeconfig.projects.configs.variables.get", + "response": { + "$ref": "Variable" + }, + "parameterOrder": [ + "name" + ], + "description": "Gets information about a single variable.", + "flatPath": "v1beta1/projects/{projectsId}/configs/{configsId}/variables/{variablesId}", + "httpMethod": "GET", + "parameters": { + "name": { + "description": "The name of the variable to return, in the format:\n\n`projects/[PROJECT_ID]/configs/[CONFIG_NAME]/variables/[VARIBLE_NAME]`", + "required": true, + "pattern": "^projects/[^/]+/configs/[^/]+/variables/.+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/{+name}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloudruntimeconfig" + ] + }, + "create": { + "id": "runtimeconfig.projects.configs.variables.create", + "response": { + "$ref": "Variable" + }, + "parameterOrder": [ + "parent" + ], + "description": "Creates a variable within the given configuration. You cannot create\na variable with a name that is a prefix of an existing variable name, or a\nname that has an existing variable name as a prefix.\n\nTo learn more about creating a variable, read the\n[Setting and Getting Data](/deployment-manager/runtime-configurator/set-and-get-variables)\ndocumentation.", + "request": { + "$ref": "Variable" + }, + "flatPath": "v1beta1/projects/{projectsId}/configs/{configsId}/variables", + "httpMethod": "POST", + "parameters": { + "requestId": { + "description": "An optional but recommended unique \u003ccode\u003erequest_id\u003c/code\u003e. If the server\nreceives two \u003ccode\u003ecreate()\u003c/code\u003e requests with the same\n\u003ccode\u003erequest_id\u003c/code\u003e, then the second request will be ignored and the\nfirst resource created and stored in the backend is returned.\nEmpty \u003ccode\u003erequest_id\u003c/code\u003e fields are ignored.\n\nIt is responsibility of the client to ensure uniqueness of the\n\u003ccode\u003erequest_id\u003c/code\u003e strings.\n\n\u003ccode\u003erequest_id\u003c/code\u003e strings are limited to 64 characters.", + "location": "query", + "type": "string" + }, + "parent": { + "description": "The path to the RutimeConfig resource that this variable should belong to.\nThe configuration must exist beforehand; the path must by in the format:\n\n`projects/[PROJECT_ID]/configs/[CONFIG_NAME]`", + "required": true, + "pattern": "^projects/[^/]+/configs/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/{+parent}/variables", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloudruntimeconfig" + ] + }, + "update": { + "id": "runtimeconfig.projects.configs.variables.update", + "response": { + "$ref": "Variable" + }, + "parameterOrder": [ + "name" + ], + "description": "Updates an existing variable with a new value.", + "request": { + "$ref": "Variable" + }, + "flatPath": "v1beta1/projects/{projectsId}/configs/{configsId}/variables/{variablesId}", + "httpMethod": "PUT", + "parameters": { + "name": { + "description": "The name of the variable to update, in the format:\n\n`projects/[PROJECT_ID]/configs/[CONFIG_NAME]/variables/[VARIABLE_NAME]`", + "required": true, + "pattern": "^projects/[^/]+/configs/[^/]+/variables/.+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/{+name}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloudruntimeconfig" + ] + }, + "delete": { + "id": "runtimeconfig.projects.configs.variables.delete", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "name" + ], + "description": "Deletes a variable or multiple variables.\n\nIf you specify a variable name, then that variable is deleted. If you\nspecify a prefix and `recursive` is true, then all variables with that\nprefix are deleted. You must set a `recursive` to true if you delete\nvariables by prefix.", + "flatPath": "v1beta1/projects/{projectsId}/configs/{configsId}/variables/{variablesId}", + "httpMethod": "DELETE", + "parameters": { + "recursive": { + "description": "Set to `true` to recursively delete multiple variables with the same\nprefix.", + "location": "query", + "type": "boolean" + }, + "name": { + "description": "The name of the variable to delete, in the format:\n\n`projects/[PROJECT_ID]/configs/[CONFIG_NAME]/variables/[VARIABLE_NAME]`", + "required": true, + "pattern": "^projects/[^/]+/configs/[^/]+/variables/.+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/{+name}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloudruntimeconfig" + ] + }, + "testIamPermissions": { + "id": "runtimeconfig.projects.configs.variables.testIamPermissions", + "response": { + "$ref": "TestIamPermissionsResponse" + }, + "parameterOrder": [ + "resource" + ], + "description": "Returns permissions that a caller has on the specified resource.\nIf the resource does not exist, this will return an empty set of\npermissions, not a NOT_FOUND error.", + "flatPath": "v1beta1/projects/{projectsId}/configs/{configsId}/variables/{variablesId}:testIamPermissions", + "httpMethod": "GET", + "parameters": { + "permissions": { + "description": "The set of permissions to check for the `resource`. Permissions with\nwildcards (such as '*' or 'storage.*') are not allowed. For more\ninformation see\n[IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).", + "repeated": true, + "location": "query", + "type": "string" + }, + "resource": { + "description": "REQUIRED: The resource for which the policy detail is being requested.\n`resource` is usually specified as a path. For example, a Project\nresource is specified as `projects/{project}`.", + "required": true, + "pattern": "^projects/[^/]+/configs/[^/]+/variables/.+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/{+resource}:testIamPermissions", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloudruntimeconfig" + ] + } + } + }, + "waiters": { + "methods": { + "get": { + "id": "runtimeconfig.projects.configs.waiters.get", + "response": { + "$ref": "Waiter" + }, + "parameterOrder": [ + "name" + ], + "description": "Gets information about a single waiter.", + "flatPath": "v1beta1/projects/{projectsId}/configs/{configsId}/waiters/{waitersId}", + "httpMethod": "GET", + "parameters": { + "name": { + "description": "The fully-qualified name of the Waiter resource object to retrieve, in the\nformat:\n\n`projects/[PROJECT_ID]/configs/[CONFIG_NAME]/waiters/[WAITER_NAME]`", + "required": true, + "pattern": "^projects/[^/]+/configs/[^/]+/waiters/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/{+name}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloudruntimeconfig" + ] + }, + "create": { + "id": "runtimeconfig.projects.configs.waiters.create", + "response": { + "$ref": "Operation" + }, + "parameterOrder": [ + "parent" + ], + "description": "Creates a Waiter resource. This operation returns a long-running Operation\nresource which can be polled for completion. However, a waiter with the\ngiven name will exist (and can be retrieved) prior to the operation\ncompleting. If the operation fails, the failed Waiter resource will\nstill exist and must be deleted prior to subsequent creation attempts.", + "request": { + "$ref": "Waiter" + }, + "flatPath": "v1beta1/projects/{projectsId}/configs/{configsId}/waiters", + "httpMethod": "POST", + "parameters": { + "requestId": { + "description": "An optional but recommended unique \u003ccode\u003erequest_id\u003c/code\u003e. If the server\nreceives two \u003ccode\u003ecreate()\u003c/code\u003e requests with the same\n\u003ccode\u003erequest_id\u003c/code\u003e, then the second request will be ignored and the\nfirst resource created and stored in the backend is returned.\nEmpty \u003ccode\u003erequest_id\u003c/code\u003e fields are ignored.\n\nIt is responsibility of the client to ensure uniqueness of the\n\u003ccode\u003erequest_id\u003c/code\u003e strings.\n\n\u003ccode\u003erequest_id\u003c/code\u003e strings are limited to 64 characters.", + "location": "query", + "type": "string" + }, + "parent": { + "description": "The path to the configuration that will own the waiter.\nThe configuration must exist beforehand; the path must by in the format:\n\n`projects/[PROJECT_ID]/configs/[CONFIG_NAME]`.", + "required": true, + "pattern": "^projects/[^/]+/configs/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/{+parent}/waiters", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloudruntimeconfig" + ] + }, + "testIamPermissions": { + "id": "runtimeconfig.projects.configs.waiters.testIamPermissions", + "response": { + "$ref": "TestIamPermissionsResponse" + }, + "parameterOrder": [ + "resource" + ], + "description": "Returns permissions that a caller has on the specified resource.\nIf the resource does not exist, this will return an empty set of\npermissions, not a NOT_FOUND error.", + "flatPath": "v1beta1/projects/{projectsId}/configs/{configsId}/waiters/{waitersId}:testIamPermissions", + "httpMethod": "GET", + "parameters": { + "permissions": { + "description": "The set of permissions to check for the `resource`. Permissions with\nwildcards (such as '*' or 'storage.*') are not allowed. For more\ninformation see\n[IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).", + "repeated": true, + "location": "query", + "type": "string" + }, + "resource": { + "description": "REQUIRED: The resource for which the policy detail is being requested.\n`resource` is usually specified as a path. For example, a Project\nresource is specified as `projects/{project}`.", + "required": true, + "pattern": "^projects/[^/]+/configs/[^/]+/waiters/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/{+resource}:testIamPermissions", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloudruntimeconfig" + ] + }, + "list": { + "id": "runtimeconfig.projects.configs.waiters.list", + "response": { + "$ref": "ListWaitersResponse" + }, + "parameterOrder": [ + "parent" + ], + "description": "List waiters within the given configuration.", + "flatPath": "v1beta1/projects/{projectsId}/configs/{configsId}/waiters", + "httpMethod": "GET", + "parameters": { + "pageSize": { + "description": "Specifies the number of results to return per page. If there are fewer\nelements than the specified number, returns all elements.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "parent": { + "description": "The path to the configuration for which you want to get a list of waiters.\nThe configuration must exist beforehand; the path must by in the format:\n\n`projects/[PROJECT_ID]/configs/[CONFIG_NAME]`", + "required": true, + "pattern": "^projects/[^/]+/configs/[^/]+$", + "location": "path", + "type": "string" + }, + "pageToken": { + "description": "Specifies a page token to use. Set `pageToken` to a `nextPageToken`\nreturned by a previous list request to get the next page of results.", + "location": "query", + "type": "string" + } + }, + "path": "v1beta1/{+parent}/waiters", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloudruntimeconfig" + ] + }, + "delete": { + "id": "runtimeconfig.projects.configs.waiters.delete", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "name" + ], + "description": "Deletes the waiter with the specified name.", + "flatPath": "v1beta1/projects/{projectsId}/configs/{configsId}/waiters/{waitersId}", + "httpMethod": "DELETE", + "parameters": { + "name": { + "description": "The Waiter resource to delete, in the format:\n\n `projects/[PROJECT_ID]/configs/[CONFIG_NAME]/waiters/[WAITER_NAME]`", + "required": true, + "pattern": "^projects/[^/]+/configs/[^/]+/waiters/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/{+name}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloudruntimeconfig" + ] + } + } + }, + "operations": { + "methods": { + "get": { + "id": "runtimeconfig.projects.configs.operations.get", + "response": { + "$ref": "Operation" + }, + "parameterOrder": [ + "name" + ], + "description": "Gets the latest state of a long-running operation. Clients can use this\nmethod to poll the operation result at intervals as recommended by the API\nservice.", + "flatPath": "v1beta1/projects/{projectsId}/configs/{configsId}/operations/{operationsId}", + "httpMethod": "GET", + "parameters": { + "name": { + "description": "The name of the operation resource.", + "required": true, + "pattern": "^projects/[^/]+/configs/[^/]+/operations/.+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/{+name}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloudruntimeconfig" + ] + }, + "testIamPermissions": { + "id": "runtimeconfig.projects.configs.operations.testIamPermissions", + "response": { + "$ref": "TestIamPermissionsResponse" + }, + "parameterOrder": [ + "resource" + ], + "description": "Returns permissions that a caller has on the specified resource.\nIf the resource does not exist, this will return an empty set of\npermissions, not a NOT_FOUND error.", + "flatPath": "v1beta1/projects/{projectsId}/configs/{configsId}/operations/{operationsId}:testIamPermissions", + "httpMethod": "GET", + "parameters": { + "permissions": { + "description": "The set of permissions to check for the `resource`. Permissions with\nwildcards (such as '*' or 'storage.*') are not allowed. For more\ninformation see\n[IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).", + "repeated": true, + "location": "query", + "type": "string" + }, + "resource": { + "description": "REQUIRED: The resource for which the policy detail is being requested.\n`resource` is usually specified as a path. For example, a Project\nresource is specified as `projects/{project}`.", + "required": true, + "pattern": "^projects/[^/]+/configs/[^/]+/operations/.+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/{+resource}:testIamPermissions", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloudruntimeconfig" + ] + } + } + } + }, + "methods": { + "getIamPolicy": { + "id": "runtimeconfig.projects.configs.getIamPolicy", + "response": { + "$ref": "Policy" + }, + "parameterOrder": [ + "resource" + ], + "description": "Gets the access control policy for a resource.\nReturns an empty policy if the resource exists and does not have a policy\nset.", + "flatPath": "v1beta1/projects/{projectsId}/configs/{configsId}:getIamPolicy", + "httpMethod": "GET", + "parameters": { + "resource": { + "description": "REQUIRED: The resource for which the policy is being requested.\n`resource` is usually specified as a path. For example, a Project\nresource is specified as `projects/{project}`.", + "required": true, + "pattern": "^projects/[^/]+/configs/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/{+resource}:getIamPolicy", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloudruntimeconfig" + ] + }, + "list": { + "id": "runtimeconfig.projects.configs.list", + "response": { + "$ref": "ListConfigsResponse" + }, + "parameterOrder": [ + "parent" + ], + "description": "Lists all the RuntimeConfig resources within project.", + "flatPath": "v1beta1/projects/{projectsId}/configs", + "httpMethod": "GET", + "parameters": { + "pageSize": { + "description": "Specifies the number of results to return per page. If there are fewer\nelements than the specified number, returns all elements.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "parent": { + "description": "The [project ID](https://support.google.com/cloud/answer/6158840?hl=en&ref_topic=6158848)\nfor this request, in the format `projects/[PROJECT_ID]`.", + "required": true, + "pattern": "^projects/[^/]+$", + "location": "path", + "type": "string" + }, + "pageToken": { + "description": "Specifies a page token to use. Set `pageToken` to a `nextPageToken`\nreturned by a previous list request to get the next page of results.", + "location": "query", + "type": "string" + } + }, + "path": "v1beta1/{+parent}/configs", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloudruntimeconfig" + ] + }, + "get": { + "id": "runtimeconfig.projects.configs.get", + "response": { + "$ref": "RuntimeConfig" + }, + "parameterOrder": [ + "name" + ], + "description": "Gets information about a RuntimeConfig resource.", + "flatPath": "v1beta1/projects/{projectsId}/configs/{configsId}", + "httpMethod": "GET", + "parameters": { + "name": { + "description": "The name of the RuntimeConfig resource to retrieve, in the format:\n\n`projects/[PROJECT_ID]/configs/[CONFIG_NAME]`", + "required": true, + "pattern": "^projects/[^/]+/configs/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/{+name}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloudruntimeconfig" + ] + }, + "create": { + "id": "runtimeconfig.projects.configs.create", + "response": { + "$ref": "RuntimeConfig" + }, + "parameterOrder": [ + "parent" + ], + "description": "Creates a new RuntimeConfig resource. The configuration name must be\nunique within project.", + "request": { + "$ref": "RuntimeConfig" + }, + "flatPath": "v1beta1/projects/{projectsId}/configs", + "httpMethod": "POST", + "parameters": { + "requestId": { + "description": "An optional but recommended unique \u003ccode\u003erequest_id\u003c/code\u003e. If the server\nreceives two \u003ccode\u003ecreate()\u003c/code\u003e requests with the same\n\u003ccode\u003erequest_id\u003c/code\u003e, then the second request will be ignored and the\nfirst resource created and stored in the backend is returned.\nEmpty \u003ccode\u003erequest_id\u003c/code\u003e fields are ignored.\n\nIt is responsibility of the client to ensure uniqueness of the\n\u003ccode\u003erequest_id\u003c/code\u003e strings.\n\n\u003ccode\u003erequest_id\u003c/code\u003e strings are limited to 64 characters.", + "location": "query", + "type": "string" + }, + "parent": { + "description": "The [project ID](https://support.google.com/cloud/answer/6158840?hl=en&ref_topic=6158848)\nfor this request, in the format `projects/[PROJECT_ID]`.", + "required": true, + "pattern": "^projects/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/{+parent}/configs", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloudruntimeconfig" + ] + }, + "update": { + "id": "runtimeconfig.projects.configs.update", + "response": { + "$ref": "RuntimeConfig" + }, + "parameterOrder": [ + "name" + ], + "description": "Updates a RuntimeConfig resource. The configuration must exist beforehand.", + "request": { + "$ref": "RuntimeConfig" + }, + "flatPath": "v1beta1/projects/{projectsId}/configs/{configsId}", + "httpMethod": "PUT", + "parameters": { + "name": { + "description": "The name of the RuntimeConfig resource to update, in the format:\n\n`projects/[PROJECT_ID]/configs/[CONFIG_NAME]`", + "required": true, + "pattern": "^projects/[^/]+/configs/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/{+name}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloudruntimeconfig" + ] + }, + "setIamPolicy": { + "id": "runtimeconfig.projects.configs.setIamPolicy", + "response": { + "$ref": "Policy" + }, + "parameterOrder": [ + "resource" + ], + "description": "Sets the access control policy on the specified resource. Replaces any\nexisting policy.", + "request": { + "$ref": "SetIamPolicyRequest" + }, + "flatPath": "v1beta1/projects/{projectsId}/configs/{configsId}:setIamPolicy", + "httpMethod": "POST", + "parameters": { + "resource": { + "description": "REQUIRED: The resource for which the policy is being specified.\n`resource` is usually specified as a path. For example, a Project\nresource is specified as `projects/{project}`.", + "required": true, + "pattern": "^projects/[^/]+/configs/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/{+resource}:setIamPolicy", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloudruntimeconfig" + ] + }, + "delete": { + "id": "runtimeconfig.projects.configs.delete", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "name" + ], + "description": "Deletes a RuntimeConfig resource.", + "flatPath": "v1beta1/projects/{projectsId}/configs/{configsId}", + "httpMethod": "DELETE", + "parameters": { + "name": { + "description": "The RuntimeConfig resource to delete, in the format:\n\n`projects/[PROJECT_ID]/configs/[CONFIG_NAME]`", + "required": true, + "pattern": "^projects/[^/]+/configs/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/{+name}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloudruntimeconfig" + ] + }, + "testIamPermissions": { + "id": "runtimeconfig.projects.configs.testIamPermissions", + "response": { + "$ref": "TestIamPermissionsResponse" + }, + "parameterOrder": [ + "resource" + ], + "description": "Returns permissions that a caller has on the specified resource.\nIf the resource does not exist, this will return an empty set of\npermissions, not a NOT_FOUND error.", + "request": { + "$ref": "TestIamPermissionsRequest" + }, + "flatPath": "v1beta1/projects/{projectsId}/configs/{configsId}:testIamPermissions", + "httpMethod": "POST", + "parameters": { + "resource": { + "description": "REQUIRED: The resource for which the policy detail is being requested.\n`resource` is usually specified as a path. For example, a Project\nresource is specified as `projects/{project}`.", + "required": true, + "pattern": "^projects/[^/]+/configs/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/{+resource}:testIamPermissions", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloudruntimeconfig" + ] + } + } + } + } + } + }, + "schemas": { + "Status": { + "description": "The `Status` type defines a logical error model that is suitable for different\nprogramming environments, including REST APIs and RPC APIs. It is used by\n[gRPC](https://github.com/grpc). The error model is designed to be:\n\n- Simple to use and understand for most users\n- Flexible enough to meet unexpected needs\n\n# Overview\n\nThe `Status` message contains three pieces of data: error code, error message,\nand error details. The error code should be an enum value of\ngoogle.rpc.Code, but it may accept additional error codes if needed. The\nerror message should be a developer-facing English message that helps\ndevelopers *understand* and *resolve* the error. If a localized user-facing\nerror message is needed, put the localized message in the error details or\nlocalize it in the client. The optional error details may contain arbitrary\ninformation about the error. There is a predefined set of error detail types\nin the package `google.rpc` which can be used for common error conditions.\n\n# Language mapping\n\nThe `Status` message is the logical representation of the error model, but it\nis not necessarily the actual wire format. When the `Status` message is\nexposed in different client libraries and different wire protocols, it can be\nmapped differently. For example, it will likely be mapped to some exceptions\nin Java, but more likely mapped to some error codes in C.\n\n# Other uses\n\nThe error model and the `Status` message can be used in a variety of\nenvironments, either with or without APIs, to provide a\nconsistent developer experience across different environments.\n\nExample uses of this error model include:\n\n- Partial errors. If a service needs to return partial errors to the client,\n it may embed the `Status` in the normal response to indicate the partial\n errors.\n\n- Workflow errors. A typical workflow has multiple steps. Each step may\n have a `Status` message for error reporting purpose.\n\n- Batch operations. If a client uses batch request and batch response, the\n `Status` message should be used directly inside batch response, one for\n each error sub-response.\n\n- Asynchronous operations. If an API call embeds asynchronous operation\n results in its response, the status of those operations should be\n represented directly using the `Status` message.\n\n- Logging. If some API errors are stored in logs, the message `Status` could\n be used directly after any stripping needed for security/privacy reasons.", + "type": "object", + "properties": { + "code": { + "description": "The status code, which should be an enum value of google.rpc.Code.", + "type": "integer", + "format": "int32" + }, + "details": { + "description": "A list of messages that carry the error details. There will be a\ncommon set of message types for APIs to use.", + "type": "array", + "items": { + "additionalProperties": { + "description": "Properties of the object. Contains field @type with type URL.", + "type": "any" + }, + "type": "object" + } + }, + "message": { + "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\ngoogle.rpc.Status.details field, or localized by the client.", + "type": "string" + } + }, + "id": "Status" + }, + "Variable": { + "description": "Describes a single variable within a RuntimeConfig resource.\nThe name denotes the hierarchical variable name. For example,\n`ports/serving_port` is a valid variable name. The variable value is an\nopaque string and only leaf variables can have values (that is, variables\nthat do not have any child variables).", + "type": "object", + "properties": { + "value": { + "description": "The binary value of the variable. The length of the value must be less\nthan 4096 bytes. Empty values are also accepted. The value must be\nbase64 encoded. Only one of `value` or `text` can be set.", + "type": "string", + "format": "byte" + }, + "text": { + "description": "The string value of the variable. The length of the value must be less\nthan 4096 bytes. Empty values are also accepted. For example,\n\u003ccode\u003etext: \"my text value\"\u003c/code\u003e.", + "type": "string" + }, + "updateTime": { + "description": "[Output Only] The time of the last variable update.", + "type": "string", + "format": "google-datetime" + }, + "state": { + "description": "[Ouput only] The current state of the variable. The variable state indicates\nthe outcome of the `variables().watch` call and is visible through the\n`get` and `list` calls.", + "enum": [ + "VARIABLE_STATE_UNSPECIFIED", + "UPDATED", + "DELETED" + ], + "enumDescriptions": [ + "Default variable state.", + "The variable was updated, while `variables().watch` was executing.", + "The variable was deleted, while `variables().watch` was executing." + ], + "type": "string" + }, + "name": { + "description": "The name of the variable resource, in the format:\n\n projects/[PROJECT_ID]/configs/[CONFIG_NAME]/variables/[VARIABLE_NAME]\n\nThe `[PROJECT_ID]` must be a valid project ID, `[CONFIG_NAME]` must be a\nvalid RuntimeConfig reource and `[VARIABLE_NAME]` follows Unix file system\nfile path naming.\n\nThe `[VARIABLE_NAME]` can contain ASCII letters, numbers, slashes and\ndashes. Slashes are used as path element separators and are not part of the\n`[VARIABLE_NAME]` itself, so `[VARIABLE_NAME]` must contain at least one\nnon-slash character. Multiple slashes are coalesced into single slash\ncharacter. Each path segment should follow RFC 1035 segment specification.\nThe length of a `[VARIABLE_NAME]` must be less than 256 bytes.\n\nOnce you create a variable, you cannot change the variable name.", + "type": "string" + } + }, + "id": "Variable" + }, + "ListConfigsResponse": { + "description": "`ListConfigs()` returns the following response. The order of returned\nobjects is arbitrary; that is, it is not ordered in any particular way.", + "type": "object", + "properties": { + "nextPageToken": { + "description": "This token allows you to get the next page of results for list requests.\nIf the number of results is larger than `pageSize`, use the `nextPageToken`\nas a value for the query parameter `pageToken` in the next list request.\nSubsequent list requests will have their own `nextPageToken` to continue\npaging through the results", + "type": "string" + }, + "configs": { + "description": "A list of the configurations in the project. The order of returned\nobjects is arbitrary; that is, it is not ordered in any particular way.", + "type": "array", + "items": { + "$ref": "RuntimeConfig" + } + } + }, + "id": "ListConfigsResponse" + }, + "Operation": { + "description": "This resource represents a long-running operation that is the result of a\nnetwork API call.", + "type": "object", + "properties": { + "error": { + "description": "The error result of the operation in case of failure or cancellation.", + "$ref": "Status" + }, + "done": { + "description": "If the value is `false`, it means the operation is still in progress.\nIf true, the operation is completed, and either `error` or `response` is\navailable.", + "type": "boolean" + }, + "metadata": { + "description": "Service-specific metadata associated with the operation. It typically\ncontains progress information and common metadata such as create time.\nSome services might not provide such metadata. Any method that returns a\nlong-running operation should document the metadata type, if any.", + "additionalProperties": { + "description": "Properties of the object. Contains field @type with type URL.", + "type": "any" + }, + "type": "object" + }, + "response": { + "description": "The normal response of the operation in case of success. If the original\nmethod returns no data on success, such as `Delete`, the response is\n`google.protobuf.Empty`. If the original method is standard\n`Get`/`Create`/`Update`, the response should be the resource. For other\nmethods, the response should have the type `XxxResponse`, where `Xxx`\nis the original method name. For example, if the original method name\nis `TakeSnapshot()`, the inferred response type is\n`TakeSnapshotResponse`.", + "additionalProperties": { + "description": "Properties of the object. Contains field @type with type URL.", + "type": "any" + }, + "type": "object" + }, + "name": { + "description": "The server-assigned name, which is only unique within the same service that\noriginally returns it. If you use the default HTTP mapping, the\n`name` should have the format of `operations/some/unique/name`.", + "type": "string" + } + }, + "id": "Operation" + }, + "SetIamPolicyRequest": { + "description": "Request message for `SetIamPolicy` method.", + "type": "object", + "properties": { + "policy": { + "description": "REQUIRED: The complete policy to be applied to the `resource`. The size of\nthe policy is limited to a few 10s of KB. An empty policy is a\nvalid policy but certain Cloud Platform services (such as Projects)\nmight reject them.", + "$ref": "Policy" + } + }, + "id": "SetIamPolicyRequest" + }, + "TestIamPermissionsResponse": { + "description": "Response message for `TestIamPermissions` method.", + "type": "object", + "properties": { + "permissions": { + "description": "A subset of `TestPermissionsRequest.permissions` that the caller is\nallowed.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "id": "TestIamPermissionsResponse" + }, + "Waiter": { + "description": "A Waiter resource waits for some end condition within a RuntimeConfig resource\nto be met before it returns. For example, assume you have a distributed\nsystem where each node writes to a Variable resource indidicating the node's\nreadiness as part of the startup process.\n\nYou then configure a Waiter resource with the success condition set to wait\nuntil some number of nodes have checked in. Afterwards, your application\nruns some arbitrary code after the condition has been met and the waiter\nreturns successfully.\n\nOnce created, a Waiter resource is immutable.\n\nTo learn more about using waiters, read the\n[Creating a Waiter](/deployment-manager/runtime-configurator/creating-a-waiter)\ndocumentation.", + "type": "object", + "properties": { + "timeout": { + "description": "[Required] Specifies the timeout of the waiter in seconds, beginning from\nthe instant that `waiters().create` method is called. If this time elapses\nbefore the success or failure conditions are met, the waiter fails and sets\nthe `error` code to `DEADLINE_EXCEEDED`.", + "type": "string", + "format": "google-duration" + }, + "success": { + "description": "[Required] The success condition. If this condition is met, `done` will be\nset to `true` and the `error` value will remain unset. The failure condition\ntakes precedence over the success condition. If both conditions are met, a\nfailure will be indicated.", + "$ref": "EndCondition" + }, + "failure": { + "description": "[Optional] The failure condition of this waiter. If this condition is met,\n`done` will be set to `true` and the `error` code will be set to `ABORTED`.\nThe failure condition takes precedence over the success condition. If both\nconditions are met, a failure will be indicated. This value is optional; if\nno failure condition is set, the only failure scenario will be a timeout.", + "$ref": "EndCondition" + }, + "createTime": { + "description": "[Output Only] The instant at which this Waiter resource was created. Adding\nthe value of `timeout` to this instant yields the timeout deadline for the\nwaiter.", + "type": "string", + "format": "google-datetime" + }, + "name": { + "description": "The name of the Waiter resource, in the format:\n\n projects/[PROJECT_ID]/configs/[CONFIG_NAME]/waiters/[WAITER_NAME]\n\nThe `[PROJECT_ID]` must be a valid Google Cloud project ID,\nthe `[CONFIG_NAME]` must be a valid RuntimeConfig resource, the\n`[WAITER_NAME]` must match RFC 1035 segment specification, and the length\nof `[WAITER_NAME]` must be less than 64 bytes.\n\nAfter you create a Waiter resource, you cannot change the resource name.", + "type": "string" + }, + "error": { + "description": "[Output Only] If the waiter ended due to a failure or timeout, this value\nwill be set.", + "$ref": "Status" + }, + "done": { + "description": "[Output Only] If the value is `false`, it means the waiter is still waiting\nfor one of its conditions to be met.\n\nIf true, the waiter has finished. If the waiter finished due to a timeout\nor failure, `error` will be set.", + "type": "boolean" + } + }, + "id": "Waiter" + }, + "Policy": { + "description": "Defines an Identity and Access Management (IAM) policy. It is used to\nspecify access control policies for Cloud Platform resources.\n\n\nA `Policy` consists of a list of `bindings`. A `Binding` binds a list of\n`members` to a `role`, where the members can be user accounts, Google groups,\nGoogle domains, and service accounts. A `role` is a named list of permissions\ndefined by IAM.\n\n**Example**\n\n {\n \"bindings\": [\n {\n \"role\": \"roles/owner\",\n \"members\": [\n \"user:mike@example.com\",\n \"group:admins@example.com\",\n \"domain:google.com\",\n \"serviceAccount:my-other-app@appspot.gserviceaccount.com\",\n ]\n },\n {\n \"role\": \"roles/viewer\",\n \"members\": [\"user:sean@example.com\"]\n }\n ]\n }\n\nFor a description of IAM and its features, see the\n[IAM developer's guide](https://cloud.google.com/iam).", + "type": "object", + "properties": { + "bindings": { + "description": "Associates a list of `members` to a `role`.\nMultiple `bindings` must not be specified for the same `role`.\n`bindings` with no members will result in an error.", + "type": "array", + "items": { + "$ref": "Binding" + } + }, + "etag": { + "description": "`etag` is used for optimistic concurrency control as a way to help\nprevent simultaneous updates of a policy from overwriting each other.\nIt is strongly suggested that systems make use of the `etag` in the\nread-modify-write cycle to perform policy updates in order to avoid race\nconditions: An `etag` is returned in the response to `getIamPolicy`, and\nsystems are expected to put that etag in the request to `setIamPolicy` to\nensure that their change will be applied to the same version of the policy.\n\nIf no `etag` is provided in the call to `setIamPolicy`, then the existing\npolicy is overwritten blindly.", + "type": "string", + "format": "byte" + }, + "version": { + "description": "Version of the `Policy`. The default version is 0.", + "type": "integer", + "format": "int32" + } + }, + "id": "Policy" + }, + "RuntimeConfig": { + "description": "A RuntimeConfig resource is the primary resource in the Cloud RuntimeConfig\nservice. A RuntimeConfig resource consists of metadata and a hierarchy of\nvariables.", + "type": "object", + "properties": { + "description": { + "description": "An optional description of the RuntimeConfig object.", + "type": "string" + }, + "name": { + "description": "The resource name of a runtime config. The name must have the format:\n\n projects/[PROJECT_ID]/configs/[CONFIG_NAME]\n\nThe `[PROJECT_ID]` must be a valid project ID, and `[CONFIG_NAME]` is an\narbitrary name that matches RFC 1035 segment specification. The length of\n`[CONFIG_NAME]` must be less than 64 bytes.\n\nYou pick the RuntimeConfig resource name, but the server will validate that\nthe name adheres to this format. After you create the resource, you cannot\nchange the resource's name.", + "type": "string" + } + }, + "id": "RuntimeConfig" + }, + "TestIamPermissionsRequest": { + "description": "Request message for `TestIamPermissions` method.", + "type": "object", + "properties": { + "permissions": { + "description": "The set of permissions to check for the `resource`. Permissions with\nwildcards (such as '*' or 'storage.*') are not allowed. For more\ninformation see\n[IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).", + "type": "array", + "items": { + "type": "string" + } + } + }, + "id": "TestIamPermissionsRequest" + }, + "ListWaitersResponse": { + "description": "Response for the `ListWaiters()` method.\nOrder of returned waiter objects is arbitrary.", + "type": "object", + "properties": { + "nextPageToken": { + "description": "This token allows you to get the next page of results for list requests.\nIf the number of results is larger than `pageSize`, use the `nextPageToken`\nas a value for the query parameter `pageToken` in the next list request.\nSubsequent list requests will have their own `nextPageToken` to continue\npaging through the results", + "type": "string" + }, + "waiters": { + "description": "Found waiters in the project.", + "type": "array", + "items": { + "$ref": "Waiter" + } + } + }, + "id": "ListWaitersResponse" + }, + "EndCondition": { + "description": "The condition that a Waiter resource is waiting for.", + "type": "object", + "properties": { + "cardinality": { + "description": "The cardinality of the `EndCondition`.", + "$ref": "Cardinality" + } + }, + "id": "EndCondition" + }, + "Cardinality": { + "description": "A Cardinality condition for the Waiter resource. A cardinality condition is\nmet when the number of variables under a specified path prefix reaches a\npredefined number. For example, if you set a Cardinality condition where\nthe `path` is set to `/foo` and the number of paths is set to 2, the\nfollowing variables would meet the condition in a RuntimeConfig resource:\n\n+ `/foo/variable1 = \"value1\"`\n+ `/foo/variable2 = \"value2\"`\n+ `/bar/variable3 = \"value3\"`\n\nIt would not would not satisify the same condition with the `number` set to\n3, however, because there is only 2 paths that start with `/foo`.\nCardinality conditions are recursive; all subtrees under the specific\npath prefix are counted.", + "type": "object", + "properties": { + "path": { + "description": "The root of the variable subtree to monitor. For example, `/foo`.", + "type": "string" + }, + "number": { + "description": "The number variables under the `path` that must exist to meet this\ncondition. Defaults to 1 if not specified.", + "type": "integer", + "format": "int32" + } + }, + "id": "Cardinality" + }, + "Empty": { + "description": "A generic empty message that you can re-use to avoid defining duplicated\nempty messages in your APIs. A typical example is to use it as the request\nor the response type of an API method. For instance:\n\n service Foo {\n rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);\n }\n\nThe JSON representation for `Empty` is empty JSON object `{}`.", + "type": "object", + "properties": {}, + "id": "Empty" + }, + "WatchVariableRequest": { + "description": "Request for the `WatchVariable()` method.", + "type": "object", + "properties": { + "newerThan": { + "description": "If specified, checks the current timestamp of the variable and if the\ncurrent timestamp is newer than `newerThan` timestamp, the method returns\nimmediately.\n\nIf not specified or the variable has an older timestamp, the watcher waits\nfor a the value to change before returning.", + "type": "string", + "format": "google-datetime" + } + }, + "id": "WatchVariableRequest" + }, + "Binding": { + "description": "Associates `members` with a `role`.", + "type": "object", + "properties": { + "members": { + "description": "Specifies the identities requesting access for a Cloud Platform resource.\n`members` can have the following values:\n\n* `allUsers`: A special identifier that represents anyone who is\n on the internet; with or without a Google account.\n\n* `allAuthenticatedUsers`: A special identifier that represents anyone\n who is authenticated with a Google account or a service account.\n\n* `user:{emailid}`: An email address that represents a specific Google\n account. For example, `alice@gmail.com` or `joe@example.com`.\n\n\n* `serviceAccount:{emailid}`: An email address that represents a service\n account. For example, `my-other-app@appspot.gserviceaccount.com`.\n\n* `group:{emailid}`: An email address that represents a Google group.\n For example, `admins@example.com`.\n\n* `domain:{domain}`: A Google Apps domain name that represents all the\n users of that domain. For example, `google.com` or `example.com`.\n\n", + "type": "array", + "items": { + "type": "string" + } + }, + "role": { + "description": "Role that is assigned to `members`.\nFor example, `roles/viewer`, `roles/editor`, or `roles/owner`.\nRequired", + "type": "string" + } + }, + "id": "Binding" + }, + "ListVariablesResponse": { + "description": "Response for the `ListVariables()` method.", + "type": "object", + "properties": { + "variables": { + "description": "A list of variables and their values. The order of returned variable\nobjects is arbitrary.", + "type": "array", + "items": { + "$ref": "Variable" + } + }, + "nextPageToken": { + "description": "This token allows you to get the next page of results for list requests.\nIf the number of results is larger than `pageSize`, use the `nextPageToken`\nas a value for the query parameter `pageToken` in the next list request.\nSubsequent list requests will have their own `nextPageToken` to continue\npaging through the results", + "type": "string" + } + }, + "id": "ListVariablesResponse" + } + }, + "revision": "20161213", + "basePath": "", + "icons": { + "x32": "http://www.google.com/images/icons/product/search-32.gif", + "x16": "http://www.google.com/images/icons/product/search-16.gif" + }, + "version_module": "True", + "canonicalName": "Cloud RuntimeConfig", + "discoveryVersion": "v1", + "baseUrl": "https://runtimeconfig.googleapis.com/", + "name": "runtimeconfig", + "parameters": { + "access_token": { + "description": "OAuth access token.", + "type": "string", + "location": "query" + }, + "prettyPrint": { + "description": "Returns response with indentations and line breaks.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "key": { + "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", + "type": "string", + "location": "query" + }, + "quotaUser": { + "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.", + "type": "string", + "location": "query" + }, + "pp": { + "description": "Pretty-print response.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "fields": { + "description": "Selector specifying which fields to include in a partial response.", + "type": "string", + "location": "query" + }, + "alt": { + "description": "Data format for response.", + "location": "query", + "enum": [ + "json", + "media", + "proto" + ], + "default": "json", + "enumDescriptions": [ + "Responses with Content-Type of application/json", + "Media download with context-dependent Content-Type", + "Responses with Content-Type of application/x-protobuf" + ], + "type": "string" + }, + "$.xgafv": { + "description": "V1 error format.", + "enum": [ + "1", + "2" + ], + "enumDescriptions": [ + "v1 error format", + "v2 error format" + ], + "type": "string", + "location": "query" + }, + "callback": { + "description": "JSONP", + "type": "string", + "location": "query" + }, + "oauth_token": { + "description": "OAuth 2.0 token for the current user.", + "type": "string", + "location": "query" + }, + "uploadType": { + "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").", + "type": "string", + "location": "query" + }, + "bearer_token": { + "description": "OAuth bearer token.", + "type": "string", + "location": "query" + }, + "upload_protocol": { + "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").", + "type": "string", + "location": "query" + } + }, + "documentationLink": "https://cloud.google.com/deployment-manager/runtime-configurator/", + "ownerDomain": "google.com", + "batchPath": "batch", + "servicePath": "", + "ownerName": "Google", + "version": "v1beta1", + "rootUrl": "https://runtimeconfig.googleapis.com/", + "kind": "discovery#restDescription" +} diff --git a/etc/api/safebrowsing/v4/safebrowsing-api.json b/etc/api/safebrowsing/v4/safebrowsing-api.json index f130ffeb21..630df9ce58 100644 --- a/etc/api/safebrowsing/v4/safebrowsing-api.json +++ b/etc/api/safebrowsing/v4/safebrowsing-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/Yoew02BLq1-_QyzwsVjtSdddocY\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/Yoew02BLq1-_QyzwsVjtSdddocY\"", "discoveryVersion": "v1", "id": "safebrowsing:v4", "name": "safebrowsing", diff --git a/etc/api/script/v1/script-api.json b/etc/api/script/v1/script-api.json index 48eb38cf55..721262d461 100644 --- a/etc/api/script/v1/script-api.json +++ b/etc/api/script/v1/script-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/FcNWZezE05ypidUunx03uCyJR70\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/FcNWZezE05ypidUunx03uCyJR70\"", "discoveryVersion": "v1", "id": "script:v1", "name": "script", diff --git a/etc/api/servicecontrol/v1/servicecontrol-api.json b/etc/api/servicecontrol/v1/servicecontrol-api.json index e69de29bb2..52ba9942c6 100644 --- a/etc/api/servicecontrol/v1/servicecontrol-api.json +++ b/etc/api/servicecontrol/v1/servicecontrol-api.json @@ -0,0 +1,667 @@ +{ + "id": "servicecontrol:v1", + "auth": { + "oauth2": { + "scopes": { + "https://www.googleapis.com/auth/cloud-platform": { + "description": "View and manage your data across Google Cloud Platform services" + }, + "https://www.googleapis.com/auth/servicecontrol": { + "description": "Manage your Google Service Control data" + } + } + } + }, + "description": "Google Service Control provides control plane functionality to managed services, such as logging, monitoring, and status checks.", + "protocol": "rest", + "title": "Google Service Control API", + "resources": { + "services": { + "methods": { + "check": { + "id": "servicecontrol.services.check", + "response": { + "$ref": "CheckResponse" + }, + "parameterOrder": [ + "serviceName" + ], + "description": "Checks an operation with Google Service Control to decide whether\nthe given operation should proceed. It should be called before the\noperation is executed.\n\nIf feasible, the client should cache the check results and reuse them for\n60 seconds. In case of server errors, the client can rely on the cached\nresults for longer time.\n\nNOTE: the `CheckRequest` has the size limit of 1MB.\n\nThis method requires the `servicemanagement.services.check` permission\non the specified service. For more information, see\n[Google Cloud IAM](https://cloud.google.com/iam).", + "request": { + "$ref": "CheckRequest" + }, + "flatPath": "v1/services/{serviceName}:check", + "httpMethod": "POST", + "parameters": { + "serviceName": { + "description": "The service name as specified in its service configuration. For example,\n`\"pubsub.googleapis.com\"`.\n\nSee google.api.Service for the definition of a service name.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1/services/{serviceName}:check", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/servicecontrol" + ] + }, + "report": { + "id": "servicecontrol.services.report", + "response": { + "$ref": "ReportResponse" + }, + "parameterOrder": [ + "serviceName" + ], + "description": "Reports operation results to Google Service Control, such as logs and\nmetrics. It should be called after an operation is completed.\n\nIf feasible, the client should aggregate reporting data for up to 5\nseconds to reduce API traffic. Limiting aggregation to 5 seconds is to\nreduce data loss during client crashes. Clients should carefully choose\nthe aggregation time window to avoid data loss risk more than 0.01%\nfor business and compliance reasons.\n\nNOTE: the `ReportRequest` has the size limit of 1MB.\n\nThis method requires the `servicemanagement.services.report` permission\non the specified service. For more information, see\n[Google Cloud IAM](https://cloud.google.com/iam).", + "request": { + "$ref": "ReportRequest" + }, + "flatPath": "v1/services/{serviceName}:report", + "httpMethod": "POST", + "parameters": { + "serviceName": { + "description": "The service name as specified in its service configuration. For example,\n`\"pubsub.googleapis.com\"`.\n\nSee google.api.Service for the definition of a service name.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1/services/{serviceName}:report", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/servicecontrol" + ] + } + } + } + }, + "schemas": { + "CheckError": { + "description": "Defines the errors to be returned in\ngoogle.api.servicecontrol.v1.CheckResponse.check_errors.", + "type": "object", + "properties": { + "code": { + "description": "The error code.", + "enum": [ + "ERROR_CODE_UNSPECIFIED", + "NOT_FOUND", + "PERMISSION_DENIED", + "RESOURCE_EXHAUSTED", + "SERVICE_NOT_ACTIVATED", + "BILLING_DISABLED", + "PROJECT_DELETED", + "PROJECT_INVALID", + "IP_ADDRESS_BLOCKED", + "REFERER_BLOCKED", + "CLIENT_APP_BLOCKED", + "API_KEY_INVALID", + "API_KEY_EXPIRED", + "API_KEY_NOT_FOUND", + "NAMESPACE_LOOKUP_UNAVAILABLE", + "SERVICE_STATUS_UNAVAILABLE", + "BILLING_STATUS_UNAVAILABLE" + ], + "enumDescriptions": [ + "This is never used in `CheckResponse`.", + "The consumer's project id was not found.\nSame as google.rpc.Code.NOT_FOUND.", + "The consumer doesn't have access to the specified resource.\nSame as google.rpc.Code.PERMISSION_DENIED.", + "Quota check failed. Same as google.rpc.Code.RESOURCE_EXHAUSTED.", + "The consumer hasn't activated the service.", + "The consumer cannot access the service because billing is disabled.", + "The consumer's project has been marked as deleted (soft deletion).", + "The consumer's project number or id does not represent a valid project.", + "The IP address of the consumer is invalid for the specific consumer\nproject.", + "The referer address of the consumer request is invalid for the specific\nconsumer project.", + "The client application of the consumer request is invalid for the\nspecific consumer project.", + "The consumer's API key is invalid.", + "The consumer's API Key has expired.", + "The consumer's API Key was not found in config record.", + "The backend server for looking up project id/number is unavailable.", + "The backend server for checking service status is unavailable.", + "The backend server for checking billing status is unavailable." + ], + "type": "string" + }, + "detail": { + "description": "Free-form text providing details on the error cause of the error.", + "type": "string" + } + }, + "id": "CheckError" + }, + "Status": { + "description": "The `Status` type defines a logical error model that is suitable for different\nprogramming environments, including REST APIs and RPC APIs. It is used by\n[gRPC](https://github.com/grpc). The error model is designed to be:\n\n- Simple to use and understand for most users\n- Flexible enough to meet unexpected needs\n\n# Overview\n\nThe `Status` message contains three pieces of data: error code, error message,\nand error details. The error code should be an enum value of\ngoogle.rpc.Code, but it may accept additional error codes if needed. The\nerror message should be a developer-facing English message that helps\ndevelopers *understand* and *resolve* the error. If a localized user-facing\nerror message is needed, put the localized message in the error details or\nlocalize it in the client. The optional error details may contain arbitrary\ninformation about the error. There is a predefined set of error detail types\nin the package `google.rpc` which can be used for common error conditions.\n\n# Language mapping\n\nThe `Status` message is the logical representation of the error model, but it\nis not necessarily the actual wire format. When the `Status` message is\nexposed in different client libraries and different wire protocols, it can be\nmapped differently. For example, it will likely be mapped to some exceptions\nin Java, but more likely mapped to some error codes in C.\n\n# Other uses\n\nThe error model and the `Status` message can be used in a variety of\nenvironments, either with or without APIs, to provide a\nconsistent developer experience across different environments.\n\nExample uses of this error model include:\n\n- Partial errors. If a service needs to return partial errors to the client,\n it may embed the `Status` in the normal response to indicate the partial\n errors.\n\n- Workflow errors. A typical workflow has multiple steps. Each step may\n have a `Status` message for error reporting purpose.\n\n- Batch operations. If a client uses batch request and batch response, the\n `Status` message should be used directly inside batch response, one for\n each error sub-response.\n\n- Asynchronous operations. If an API call embeds asynchronous operation\n results in its response, the status of those operations should be\n represented directly using the `Status` message.\n\n- Logging. If some API errors are stored in logs, the message `Status` could\n be used directly after any stripping needed for security/privacy reasons.", + "type": "object", + "properties": { + "code": { + "description": "The status code, which should be an enum value of google.rpc.Code.", + "type": "integer", + "format": "int32" + }, + "details": { + "description": "A list of messages that carry the error details. There will be a\ncommon set of message types for APIs to use.", + "type": "array", + "items": { + "additionalProperties": { + "description": "Properties of the object. Contains field @type with type URL.", + "type": "any" + }, + "type": "object" + } + }, + "message": { + "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\ngoogle.rpc.Status.details field, or localized by the client.", + "type": "string" + } + }, + "id": "Status" + }, + "ReportError": { + "description": "Represents the processing error of one `Operation` in the request.", + "type": "object", + "properties": { + "operationId": { + "description": "The Operation.operation_id value from the request.", + "type": "string" + }, + "status": { + "description": "Details of the error when processing the `Operation`.", + "$ref": "Status" + } + }, + "id": "ReportError" + }, + "ExponentialBuckets": { + "description": "Describing buckets with exponentially growing width.", + "type": "object", + "properties": { + "growthFactor": { + "description": "The i'th exponential bucket covers the interval\n [scale * growth_factor^(i-1), scale * growth_factor^i)\nwhere i ranges from 1 to num_finite_buckets inclusive.\nMust be larger than 1.0.", + "type": "number", + "format": "double" + }, + "scale": { + "description": "The i'th exponential bucket covers the interval\n [scale * growth_factor^(i-1), scale * growth_factor^i)\nwhere i ranges from 1 to num_finite_buckets inclusive.\nMust be \u003e 0.", + "type": "number", + "format": "double" + }, + "numFiniteBuckets": { + "description": "The number of finite buckets. With the underflow and overflow buckets,\nthe total number of buckets is `num_finite_buckets` + 2.\nSee comments on `bucket_options` for details.", + "type": "integer", + "format": "int32" + } + }, + "id": "ExponentialBuckets" + }, + "Operation": { + "description": "Represents information regarding an operation.", + "type": "object", + "properties": { + "operationName": { + "description": "Fully qualified name of the operation. Reserved for future use.", + "type": "string" + }, + "operationId": { + "description": "Identity of the operation. This must be unique within the scope of the\nservice that generated the operation. If the service calls\nCheck() and Report() on the same operation, the two calls should carry\nthe same id.\n\nUUID version 4 is recommended, though not required.\nIn scenarios where an operation is computed from existing information\nand an idempotent id is desirable for deduplication purpose, UUID version 5\nis recommended. See RFC 4122 for details.", + "type": "string" + }, + "endTime": { + "description": "End time of the operation.\nRequired when the operation is used in ServiceController.Report,\nbut optional when the operation is used in ServiceController.Check.", + "type": "string", + "format": "google-datetime" + }, + "labels": { + "description": "Labels describing the operation. Only the following labels are allowed:\n\n- Labels describing monitored resources as defined in\n the service configuration.\n- Default labels of metric values. When specified, labels defined in the\n metric value override these default.\n- The following labels defined by Google Cloud Platform:\n - `cloud.googleapis.com/location` describing the location where the\n operation happened,\n - `servicecontrol.googleapis.com/user_agent` describing the user agent\n of the API request,\n - `servicecontrol.googleapis.com/service_agent` describing the service\n used to handle the API request (e.g. ESP),\n - `servicecontrol.googleapis.com/platform` describing the platform\n where the API is served (e.g. GAE, GCE, GKE).", + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + "importance": { + "description": "DO NOT USE. This is an experimental field.", + "enum": [ + "LOW", + "HIGH" + ], + "enumDescriptions": [ + "The API implementation may cache and aggregate the data.\nThe data may be lost when rare and unexpected system failures occur.", + "The API implementation doesn't cache and aggregate the data.\nIf the method returns successfully, it's guaranteed that the data has\nbeen persisted in durable storage." + ], + "type": "string" + }, + "consumerId": { + "description": "Identity of the consumer who is using the service.\nThis field should be filled in for the operations initiated by a\nconsumer, but not for service-initiated operations that are\nnot related to a specific consumer.\n\nThis can be in one of the following formats:\n project:\u003cproject_id\u003e,\n project_number:\u003cproject_number\u003e,\n api_key:\u003capi_key\u003e.", + "type": "string" + }, + "startTime": { + "description": "Required. Start time of the operation.", + "type": "string", + "format": "google-datetime" + }, + "logEntries": { + "description": "Represents information to be logged.", + "type": "array", + "items": { + "$ref": "LogEntry" + } + }, + "metricValueSets": { + "description": "Represents information about this operation. Each MetricValueSet\ncorresponds to a metric defined in the service configuration.\nThe data type used in the MetricValueSet must agree with\nthe data type specified in the metric definition.\n\nWithin a single operation, it is not allowed to have more than one\nMetricValue instances that have the same metric names and identical\nlabel value combinations. If a request has such duplicated MetricValue\ninstances, the entire request is rejected with\nan invalid argument error.", + "type": "array", + "items": { + "$ref": "MetricValueSet" + } + } + }, + "id": "Operation" + }, + "CheckRequest": { + "description": "Request message for the Check method.", + "type": "object", + "properties": { + "operation": { + "description": "The operation to be checked.", + "$ref": "Operation" + }, + "serviceConfigId": { + "description": "Specifies which version of service configuration should be used to process\nthe request.\n\nIf unspecified or no matching version can be found, the\nlatest one will be used.", + "type": "string" + } + }, + "id": "CheckRequest" + }, + "LogEntry": { + "description": "An individual log entry.", + "type": "object", + "properties": { + "textPayload": { + "description": "The log entry payload, represented as a Unicode string (UTF-8).", + "type": "string" + }, + "structPayload": { + "description": "The log entry payload, represented as a structure that\nis expressed as a JSON object.", + "additionalProperties": { + "description": "Properties of the object.", + "type": "any" + }, + "type": "object" + }, + "labels": { + "description": "A set of user-defined (key, value) data that provides additional\ninformation about the log entry.", + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + "severity": { + "description": "The severity of the log entry. The default value is\n`LogSeverity.DEFAULT`.", + "enum": [ + "DEFAULT", + "DEBUG", + "INFO", + "NOTICE", + "WARNING", + "ERROR", + "CRITICAL", + "ALERT", + "EMERGENCY" + ], + "enumDescriptions": [ + "(0) The log entry has no assigned severity level.", + "(100) Debug or trace information.", + "(200) Routine information, such as ongoing status or performance.", + "(300) Normal but significant events, such as start up, shut down, or\na configuration change.", + "(400) Warning events might cause problems.", + "(500) Error events are likely to cause problems.", + "(600) Critical events cause more severe problems or outages.", + "(700) A person must take an action immediately.", + "(800) One or more systems are unusable." + ], + "type": "string" + }, + "name": { + "description": "Required. The log to which this log entry belongs. Examples: `\"syslog\"`,\n`\"book_log\"`.", + "type": "string" + }, + "protoPayload": { + "description": "The log entry payload, represented as a protocol buffer that is\nexpressed as a JSON object. You can only pass `protoPayload`\nvalues that belong to a set of approved types.", + "additionalProperties": { + "description": "Properties of the object. Contains field @type with type URL.", + "type": "any" + }, + "type": "object" + }, + "timestamp": { + "description": "The time the event described by the log entry occurred. If\nomitted, defaults to operation start time.", + "type": "string", + "format": "google-datetime" + }, + "insertId": { + "description": "A unique ID for the log entry used for deduplication. If omitted,\nthe implementation will generate one based on operation_id.", + "type": "string" + } + }, + "id": "LogEntry" + }, + "ReportRequest": { + "description": "Request message for the Report method.", + "type": "object", + "properties": { + "operations": { + "description": "Operations to be reported.\n\nTypically the service should report one operation per request.\nPutting multiple operations into a single request is allowed, but should\nbe used only when multiple operations are natually available at the time\nof the report.\n\nIf multiple operations are in a single request, the total request size\nshould be no larger than 1MB. See ReportResponse.report_errors for\npartial failure behavior.", + "type": "array", + "items": { + "$ref": "Operation" + } + }, + "serviceConfigId": { + "description": "Specifies which version of service config should be used to process the\nrequest.\n\nIf unspecified or no matching version can be found, the\nlatest one will be used.", + "type": "string" + } + }, + "id": "ReportRequest" + }, + "MetricValueSet": { + "description": "Represents a set of metric values in the same metric.\nEach metric value in the set should have a unique combination of start time,\nend time, and label values.", + "type": "object", + "properties": { + "metricName": { + "description": "The metric name defined in the service configuration.", + "type": "string" + }, + "metricValues": { + "description": "The values in this metric.", + "type": "array", + "items": { + "$ref": "MetricValue" + } + } + }, + "id": "MetricValueSet" + }, + "LinearBuckets": { + "description": "Describing buckets with constant width.", + "type": "object", + "properties": { + "width": { + "description": "The i'th linear bucket covers the interval\n [offset + (i-1) * width, offset + i * width)\nwhere i ranges from 1 to num_finite_buckets, inclusive.\nMust be strictly positive.", + "type": "number", + "format": "double" + }, + "offset": { + "description": "The i'th linear bucket covers the interval\n [offset + (i-1) * width, offset + i * width)\nwhere i ranges from 1 to num_finite_buckets, inclusive.", + "type": "number", + "format": "double" + }, + "numFiniteBuckets": { + "description": "The number of finite buckets. With the underflow and overflow buckets,\nthe total number of buckets is `num_finite_buckets` + 2.\nSee comments on `bucket_options` for details.", + "type": "integer", + "format": "int32" + } + }, + "id": "LinearBuckets" + }, + "CheckResponse": { + "description": "Response message for the Check method.", + "type": "object", + "properties": { + "checkErrors": { + "description": "Indicate the decision of the check.\n\nIf no check errors are present, the service should process the operation.\nOtherwise the service should use the list of errors to determine the\nappropriate action.", + "type": "array", + "items": { + "$ref": "CheckError" + } + }, + "operationId": { + "description": "The same operation_id value used in the CheckRequest.\nUsed for logging and diagnostics purposes.", + "type": "string" + }, + "serviceConfigId": { + "description": "The actual config id used to process the request.", + "type": "string" + } + }, + "id": "CheckResponse" + }, + "ReportResponse": { + "description": "Response message for the Report method.", + "type": "object", + "properties": { + "reportErrors": { + "description": "Partial failures, one for each `Operation` in the request that failed\nprocessing. There are three possible combinations of the RPC status:\n\n1. The combination of a successful RPC status and an empty `report_errors`\n list indicates a complete success where all `Operations` in the\n request are processed successfully.\n2. The combination of a successful RPC status and a non-empty\n `report_errors` list indicates a partial success where some\n `Operations` in the request succeeded. Each\n `Operation` that failed processing has a corresponding item\n in this list.\n3. A failed RPC status indicates a general non-deterministic failure.\n When this happens, it's impossible to know which of the\n 'Operations' in the request succeeded or failed.", + "type": "array", + "items": { + "$ref": "ReportError" + } + }, + "serviceConfigId": { + "description": "The actual config id used to process the request.", + "type": "string" + } + }, + "id": "ReportResponse" + }, + "Distribution": { + "description": "Distribution represents a frequency distribution of double-valued sample\npoints. It contains the size of the population of sample points plus\nadditional optional information:\n\n - the arithmetic mean of the samples\n - the minimum and maximum of the samples\n - the sum-squared-deviation of the samples, used to compute variance\n - a histogram of the values of the sample points", + "type": "object", + "properties": { + "bucketCounts": { + "description": "The number of samples in each histogram bucket. `bucket_counts` are\noptional. If present, they must sum to the `count` value.\n\nThe buckets are defined below in `bucket_option`. There are N buckets.\n`bucket_counts[0]` is the number of samples in the underflow bucket.\n`bucket_counts[1]` to `bucket_counts[N-1]` are the numbers of samples\nin each of the finite buckets. And `bucket_counts[N] is the number\nof samples in the overflow bucket. See the comments of `bucket_option`\nbelow for more details.\n\nAny suffix of trailing zeros may be omitted.", + "type": "array", + "items": { + "type": "string", + "format": "int64" + } + }, + "exponentialBuckets": { + "description": "Buckets with exponentially growing width.", + "$ref": "ExponentialBuckets" + }, + "explicitBuckets": { + "description": "Buckets with arbitrary user-provided width.", + "$ref": "ExplicitBuckets" + }, + "maximum": { + "description": "The maximum of the population of values. Ignored if `count` is zero.", + "type": "number", + "format": "double" + }, + "count": { + "description": "The total number of samples in the distribution. Must be \u003e= 0.", + "type": "string", + "format": "int64" + }, + "linearBuckets": { + "description": "Buckets with constant width.", + "$ref": "LinearBuckets" + }, + "sumOfSquaredDeviation": { + "description": "The sum of squared deviations from the mean:\n Sum[i=1..count]((x_i - mean)^2)\nwhere each x_i is a sample values. If `count` is zero then this field\nmust be zero, otherwise validation of the request fails.", + "type": "number", + "format": "double" + }, + "minimum": { + "description": "The minimum of the population of values. Ignored if `count` is zero.", + "type": "number", + "format": "double" + }, + "mean": { + "description": "The arithmetic mean of the samples in the distribution. If `count` is\nzero then this field must be zero.", + "type": "number", + "format": "double" + } + }, + "id": "Distribution" + }, + "ExplicitBuckets": { + "description": "Describing buckets with arbitrary user-provided width.", + "type": "object", + "properties": { + "bounds": { + "description": "'bound' is a list of strictly increasing boundaries between\nbuckets. Note that a list of length N-1 defines N buckets because\nof fenceposting. See comments on `bucket_options` for details.\n\nThe i'th finite bucket covers the interval\n [bound[i-1], bound[i])\nwhere i ranges from 1 to bound_size() - 1. Note that there are no\nfinite buckets at all if 'bound' only contains a single element; in\nthat special case the single bound defines the boundary between the\nunderflow and overflow buckets.\n\nbucket number lower bound upper bound\n i == 0 (underflow) -inf bound[i]\n 0 \u003c i \u003c bound_size() bound[i-1] bound[i]\n i == bound_size() (overflow) bound[i-1] +inf", + "type": "array", + "items": { + "type": "number", + "format": "double" + } + } + }, + "id": "ExplicitBuckets" + }, + "MetricValue": { + "description": "Represents a single metric value.", + "type": "object", + "properties": { + "stringValue": { + "description": "A text string value.", + "type": "string" + }, + "doubleValue": { + "description": "A double precision floating point value.", + "type": "number", + "format": "double" + }, + "boolValue": { + "description": "A boolean value.", + "type": "boolean" + }, + "endTime": { + "description": "The end of the time period over which this metric value's measurement\napplies.", + "type": "string", + "format": "google-datetime" + }, + "labels": { + "description": "The labels describing the metric value.\nSee comments on google.api.servicecontrol.v1.Operation.labels for\nthe overriding relationship.", + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + "distributionValue": { + "description": "A distribution value.", + "$ref": "Distribution" + }, + "startTime": { + "description": "The start of the time period over which this metric value's measurement\napplies. The time period has different semantics for different metric\ntypes (cumulative, delta, and gauge). See the metric definition\ndocumentation in the service configuration for details.", + "type": "string", + "format": "google-datetime" + }, + "int64Value": { + "description": "A signed 64-bit integer value.", + "type": "string", + "format": "int64" + } + }, + "id": "MetricValue" + } + }, + "revision": "20161212", + "basePath": "", + "icons": { + "x32": "http://www.google.com/images/icons/product/search-32.gif", + "x16": "http://www.google.com/images/icons/product/search-16.gif" + }, + "version_module": "True", + "canonicalName": "Service Control", + "discoveryVersion": "v1", + "baseUrl": "https://servicecontrol.googleapis.com/", + "name": "servicecontrol", + "parameters": { + "access_token": { + "description": "OAuth access token.", + "type": "string", + "location": "query" + }, + "prettyPrint": { + "description": "Returns response with indentations and line breaks.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "key": { + "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", + "type": "string", + "location": "query" + }, + "quotaUser": { + "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.", + "type": "string", + "location": "query" + }, + "pp": { + "description": "Pretty-print response.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "fields": { + "description": "Selector specifying which fields to include in a partial response.", + "type": "string", + "location": "query" + }, + "alt": { + "description": "Data format for response.", + "location": "query", + "enum": [ + "json", + "media", + "proto" + ], + "default": "json", + "enumDescriptions": [ + "Responses with Content-Type of application/json", + "Media download with context-dependent Content-Type", + "Responses with Content-Type of application/x-protobuf" + ], + "type": "string" + }, + "$.xgafv": { + "description": "V1 error format.", + "enum": [ + "1", + "2" + ], + "enumDescriptions": [ + "v1 error format", + "v2 error format" + ], + "type": "string", + "location": "query" + }, + "callback": { + "description": "JSONP", + "type": "string", + "location": "query" + }, + "oauth_token": { + "description": "OAuth 2.0 token for the current user.", + "type": "string", + "location": "query" + }, + "uploadType": { + "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").", + "type": "string", + "location": "query" + }, + "bearer_token": { + "description": "OAuth bearer token.", + "type": "string", + "location": "query" + }, + "upload_protocol": { + "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").", + "type": "string", + "location": "query" + } + }, + "documentationLink": "https://cloud.google.com/service-control/", + "ownerDomain": "google.com", + "batchPath": "batch", + "servicePath": "", + "ownerName": "Google", + "version": "v1", + "rootUrl": "https://servicecontrol.googleapis.com/", + "kind": "discovery#restDescription" +} diff --git a/etc/api/servicemanagement/v1/servicemanagement-api.json b/etc/api/servicemanagement/v1/servicemanagement-api.json index e69de29bb2..0d4c820833 100644 --- a/etc/api/servicemanagement/v1/servicemanagement-api.json +++ b/etc/api/servicemanagement/v1/servicemanagement-api.json @@ -0,0 +1,2898 @@ +{ + "id": "servicemanagement:v1", + "auth": { + "oauth2": { + "scopes": { + "https://www.googleapis.com/auth/cloud-platform": { + "description": "View and manage your data across Google Cloud Platform services" + }, + "https://www.googleapis.com/auth/cloud-platform.read-only": { + "description": "View your data across Google Cloud Platform services" + }, + "https://www.googleapis.com/auth/service.management": { + "description": "Manage your Google API service configuration" + }, + "https://www.googleapis.com/auth/service.management.readonly": { + "description": "View your Google API service configuration" + } + } + } + }, + "description": "Google Service Management allows service producers to publish their services on Google Cloud Platform so that they can be discovered and used by service consumers.", + "protocol": "rest", + "title": "Google Service Management API", + "resources": { + "operations": { + "methods": { + "get": { + "id": "servicemanagement.operations.get", + "response": { + "$ref": "Operation" + }, + "parameterOrder": [ + "name" + ], + "description": "Gets the latest state of a long-running operation. Clients can use this\nmethod to poll the operation result at intervals as recommended by the API\nservice.", + "flatPath": "v1/operations/{operationsId}", + "httpMethod": "GET", + "parameters": { + "name": { + "description": "The name of the operation resource.", + "required": true, + "pattern": "^operations/.+$", + "location": "path", + "type": "string" + } + }, + "path": "v1/{+name}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/service.management" + ] + } + } + }, + "services": { + "resources": { + "rollouts": { + "methods": { + "get": { + "id": "servicemanagement.services.rollouts.get", + "response": { + "$ref": "Rollout" + }, + "parameterOrder": [ + "serviceName", + "rolloutId" + ], + "description": "Gets a service configuration rollout.", + "flatPath": "v1/services/{serviceName}/rollouts/{rolloutId}", + "httpMethod": "GET", + "parameters": { + "rolloutId": { + "description": "The id of the rollout resource.", + "required": true, + "location": "path", + "type": "string" + }, + "serviceName": { + "description": "The name of the service. See the [overview](/service-management/overview)\nfor naming requirements. For example: `example.googleapis.com`.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1/services/{serviceName}/rollouts/{rolloutId}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + "https://www.googleapis.com/auth/service.management", + "https://www.googleapis.com/auth/service.management.readonly" + ] + }, + "create": { + "id": "servicemanagement.services.rollouts.create", + "response": { + "$ref": "Operation" + }, + "parameterOrder": [ + "serviceName" + ], + "description": "Creates a new service configuration rollout. Based on rollout, the\nGoogle Service Management will roll out the service configurations to\ndifferent backend services. For example, the logging configuration will be\npushed to Google Cloud Logging.\n\nPlease note that any previous pending and running Rollouts and associated\nOperations will be automatically cancelled so that the latest Rollout will\nnot be blocked by previous Rollouts.\n\nOperation\u003cresponse: Rollout\u003e", + "request": { + "$ref": "Rollout" + }, + "flatPath": "v1/services/{serviceName}/rollouts", + "httpMethod": "POST", + "parameters": { + "serviceName": { + "description": "The name of the service. See the [overview](/service-management/overview)\nfor naming requirements. For example: `example.googleapis.com`.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1/services/{serviceName}/rollouts", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/service.management" + ] + }, + "list": { + "id": "servicemanagement.services.rollouts.list", + "response": { + "$ref": "ListServiceRolloutsResponse" + }, + "parameterOrder": [ + "serviceName" + ], + "description": "Lists the history of the service configuration rollouts for a managed\nservice, from the newest to the oldest.", + "flatPath": "v1/services/{serviceName}/rollouts", + "httpMethod": "GET", + "parameters": { + "pageSize": { + "description": "The max number of items to include in the response list.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "serviceName": { + "description": "The name of the service. See the [overview](/service-management/overview)\nfor naming requirements. For example: `example.googleapis.com`.", + "required": true, + "location": "path", + "type": "string" + }, + "pageToken": { + "description": "The token of the page to retrieve.", + "location": "query", + "type": "string" + } + }, + "path": "v1/services/{serviceName}/rollouts", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + "https://www.googleapis.com/auth/service.management", + "https://www.googleapis.com/auth/service.management.readonly" + ] + } + } + }, + "configs": { + "methods": { + "submit": { + "id": "servicemanagement.services.configs.submit", + "response": { + "$ref": "Operation" + }, + "parameterOrder": [ + "serviceName" + ], + "description": "Creates a new service configuration (version) for a managed service based\non\nuser-supplied configuration source files (for example: OpenAPI\nSpecification). This method stores the source configurations as well as the\ngenerated service configuration. To rollout the service configuration to\nother services,\nplease call CreateServiceRollout.\n\nOperation\u003cresponse: SubmitConfigSourceResponse\u003e", + "request": { + "$ref": "SubmitConfigSourceRequest" + }, + "flatPath": "v1/services/{serviceName}/configs:submit", + "httpMethod": "POST", + "parameters": { + "serviceName": { + "description": "The name of the service. See the [overview](/service-management/overview)\nfor naming requirements. For example: `example.googleapis.com`.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1/services/{serviceName}/configs:submit", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/service.management" + ] + }, + "get": { + "id": "servicemanagement.services.configs.get", + "response": { + "$ref": "Service" + }, + "parameterOrder": [ + "serviceName", + "configId" + ], + "description": "Gets a service configuration (version) for a managed service.", + "flatPath": "v1/services/{serviceName}/configs/{configId}", + "httpMethod": "GET", + "parameters": { + "configId": { + "description": "The id of the service configuration resource.", + "required": true, + "location": "path", + "type": "string" + }, + "serviceName": { + "description": "The name of the service. See the [overview](/service-management/overview)\nfor naming requirements. For example: `example.googleapis.com`.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1/services/{serviceName}/configs/{configId}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + "https://www.googleapis.com/auth/service.management", + "https://www.googleapis.com/auth/service.management.readonly" + ] + }, + "create": { + "id": "servicemanagement.services.configs.create", + "response": { + "$ref": "Service" + }, + "parameterOrder": [ + "serviceName" + ], + "description": "Creates a new service configuration (version) for a managed service.\nThis method only stores the service configuration. To roll out the service\nconfiguration to backend systems please call\nCreateServiceRollout.", + "request": { + "$ref": "Service" + }, + "flatPath": "v1/services/{serviceName}/configs", + "httpMethod": "POST", + "parameters": { + "serviceName": { + "description": "The name of the service. See the [overview](/service-management/overview)\nfor naming requirements. For example: `example.googleapis.com`.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1/services/{serviceName}/configs", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/service.management" + ] + }, + "list": { + "id": "servicemanagement.services.configs.list", + "response": { + "$ref": "ListServiceConfigsResponse" + }, + "parameterOrder": [ + "serviceName" + ], + "description": "Lists the history of the service configuration for a managed service,\nfrom the newest to the oldest.", + "flatPath": "v1/services/{serviceName}/configs", + "httpMethod": "GET", + "parameters": { + "pageSize": { + "description": "The max number of items to include in the response list.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "serviceName": { + "description": "The name of the service. See the [overview](/service-management/overview)\nfor naming requirements. For example: `example.googleapis.com`.", + "required": true, + "location": "path", + "type": "string" + }, + "pageToken": { + "description": "The token of the page to retrieve.", + "location": "query", + "type": "string" + } + }, + "path": "v1/services/{serviceName}/configs", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + "https://www.googleapis.com/auth/service.management", + "https://www.googleapis.com/auth/service.management.readonly" + ] + } + } + } + }, + "methods": { + "getIamPolicy": { + "id": "servicemanagement.services.getIamPolicy", + "response": { + "$ref": "Policy" + }, + "parameterOrder": [ + "resource" + ], + "description": "Gets the access control policy for a resource.\nReturns an empty policy if the resource exists and does not have a policy\nset.", + "request": { + "$ref": "GetIamPolicyRequest" + }, + "flatPath": "v1/services/{servicesId}:getIamPolicy", + "httpMethod": "POST", + "parameters": { + "resource": { + "description": "REQUIRED: The resource for which the policy is being requested.\n`resource` is usually specified as a path. For example, a Project\nresource is specified as `projects/{project}`.", + "required": true, + "pattern": "^services/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1/{+resource}:getIamPolicy", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/service.management" + ] + }, + "disable": { + "id": "servicemanagement.services.disable", + "response": { + "$ref": "Operation" + }, + "parameterOrder": [ + "serviceName" + ], + "description": "Disable a managed service for a project.\n\nOperation\u003cresponse: DisableServiceResponse\u003e", + "request": { + "$ref": "DisableServiceRequest" + }, + "flatPath": "v1/services/{serviceName}:disable", + "httpMethod": "POST", + "parameters": { + "serviceName": { + "description": "Name of the service to disable. Specifying an unknown service name\nwill cause the request to fail.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1/services/{serviceName}:disable", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/service.management" + ] + }, + "generateConfigReport": { + "id": "servicemanagement.services.generateConfigReport", + "response": { + "$ref": "GenerateConfigReportResponse" + }, + "parameterOrder": [], + "description": "Generates and returns a report (errors, warnings and changes from\nexisting configurations) associated with\nGenerateConfigReportRequest.new_value\n\nIf GenerateConfigReportRequest.old_value is specified,\nGenerateConfigReportRequest will contain a single ChangeReport based on the\ncomparison between GenerateConfigReportRequest.new_value and\nGenerateConfigReportRequest.old_value.\nIf GenerateConfigReportRequest.old_value is not specified, this method\nwill compare GenerateConfigReportRequest.new_value with the last pushed\nservice configuration.", + "request": { + "$ref": "GenerateConfigReportRequest" + }, + "flatPath": "v1/services:generateConfigReport", + "httpMethod": "POST", + "parameters": {}, + "path": "v1/services:generateConfigReport", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/service.management" + ] + }, + "getConfig": { + "id": "servicemanagement.services.getConfig", + "response": { + "$ref": "Service" + }, + "parameterOrder": [ + "serviceName" + ], + "description": "Gets a service configuration (version) for a managed service.", + "flatPath": "v1/services/{serviceName}/config", + "httpMethod": "GET", + "parameters": { + "configId": { + "description": "The id of the service configuration resource.", + "location": "query", + "type": "string" + }, + "serviceName": { + "description": "The name of the service. See the [overview](/service-management/overview)\nfor naming requirements. For example: `example.googleapis.com`.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1/services/{serviceName}/config", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + "https://www.googleapis.com/auth/service.management", + "https://www.googleapis.com/auth/service.management.readonly" + ] + }, + "undelete": { + "id": "servicemanagement.services.undelete", + "response": { + "$ref": "Operation" + }, + "parameterOrder": [ + "serviceName" + ], + "description": "Revives a previously deleted managed service. The method restores the\nservice using the configuration at the time the service was deleted.\nThe target service must exist and must have been deleted within the\nlast 30 days.\n\nOperation\u003cresponse: UndeleteServiceResponse\u003e", + "flatPath": "v1/services/{serviceName}:undelete", + "httpMethod": "POST", + "parameters": { + "serviceName": { + "description": "The name of the service. See the [overview](/service-management/overview)\nfor naming requirements. For example: `example.googleapis.com`.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1/services/{serviceName}:undelete", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/service.management" + ] + }, + "get": { + "id": "servicemanagement.services.get", + "response": { + "$ref": "ManagedService" + }, + "parameterOrder": [ + "serviceName" + ], + "description": "Gets a managed service. Authentication is required unless the service is\npublic.", + "flatPath": "v1/services/{serviceName}", + "httpMethod": "GET", + "parameters": { + "serviceName": { + "description": "The name of the service. See the `ServiceManager` overview for naming\nrequirements. For example: `example.googleapis.com`.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1/services/{serviceName}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + "https://www.googleapis.com/auth/service.management", + "https://www.googleapis.com/auth/service.management.readonly" + ] + }, + "list": { + "id": "servicemanagement.services.list", + "response": { + "$ref": "ListServicesResponse" + }, + "parameterOrder": [], + "description": "Lists all managed services. The result is limited to services that the\ncaller has \"servicemanagement.services.get\" permission for. If the request\nis made without authentication, it returns only public services that are\navailable to everyone.", + "flatPath": "v1/services", + "httpMethod": "GET", + "parameters": { + "pageSize": { + "description": "Requested size of the next page of data.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "producerProjectId": { + "description": "Include services produced by the specified project.", + "location": "query", + "type": "string" + }, + "pageToken": { + "description": "Token identifying which result to start with; returned by a previous list\ncall.", + "location": "query", + "type": "string" + }, + "consumerId": { + "description": "Include services consumed by the specified consumer.\n\nThe Google Service Management implementation accepts the following\nforms:\n- project:\u003cproject_id\u003e", + "location": "query", + "type": "string" + } + }, + "path": "v1/services", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + "https://www.googleapis.com/auth/service.management", + "https://www.googleapis.com/auth/service.management.readonly" + ] + }, + "create": { + "id": "servicemanagement.services.create", + "response": { + "$ref": "Operation" + }, + "parameterOrder": [], + "description": "Creates a new managed service.\nPlease note one producer project can own no more than 20 services.\n\nOperation\u003cresponse: ManagedService\u003e", + "request": { + "$ref": "ManagedService" + }, + "flatPath": "v1/services", + "httpMethod": "POST", + "parameters": {}, + "path": "v1/services", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/service.management" + ] + }, + "enable": { + "id": "servicemanagement.services.enable", + "response": { + "$ref": "Operation" + }, + "parameterOrder": [ + "serviceName" + ], + "description": "Enable a managed service for a project with default setting.\n\nOperation\u003cresponse: EnableServiceResponse\u003e\n\ngoogle.rpc.Status errors may contain a\ngoogle.rpc.PreconditionFailure error detail.", + "request": { + "$ref": "EnableServiceRequest" + }, + "flatPath": "v1/services/{serviceName}:enable", + "httpMethod": "POST", + "parameters": { + "serviceName": { + "description": "Name of the service to enable. Specifying an unknown service name will\ncause the request to fail.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1/services/{serviceName}:enable", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/service.management" + ] + }, + "setIamPolicy": { + "id": "servicemanagement.services.setIamPolicy", + "response": { + "$ref": "Policy" + }, + "parameterOrder": [ + "resource" + ], + "description": "Sets the access control policy on the specified resource. Replaces any\nexisting policy.", + "request": { + "$ref": "SetIamPolicyRequest" + }, + "flatPath": "v1/services/{servicesId}:setIamPolicy", + "httpMethod": "POST", + "parameters": { + "resource": { + "description": "REQUIRED: The resource for which the policy is being specified.\n`resource` is usually specified as a path. For example, a Project\nresource is specified as `projects/{project}`.", + "required": true, + "pattern": "^services/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1/{+resource}:setIamPolicy", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/service.management" + ] + }, + "delete": { + "id": "servicemanagement.services.delete", + "response": { + "$ref": "Operation" + }, + "parameterOrder": [ + "serviceName" + ], + "description": "Deletes a managed service. This method will change the service to the\n`Soft-Delete` state for 30 days. Within this period, service producers may\ncall UndeleteService to restore the service.\nAfter 30 days, the service will be permanently deleted.\n\nOperation\u003cresponse: google.protobuf.Empty\u003e", + "flatPath": "v1/services/{serviceName}", + "httpMethod": "DELETE", + "parameters": { + "serviceName": { + "description": "The name of the service. See the [overview](/service-management/overview)\nfor naming requirements. For example: `example.googleapis.com`.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1/services/{serviceName}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/service.management" + ] + }, + "testIamPermissions": { + "id": "servicemanagement.services.testIamPermissions", + "response": { + "$ref": "TestIamPermissionsResponse" + }, + "parameterOrder": [ + "resource" + ], + "description": "Returns permissions that a caller has on the specified resource.\nIf the resource does not exist, this will return an empty set of\npermissions, not a NOT_FOUND error.", + "request": { + "$ref": "TestIamPermissionsRequest" + }, + "flatPath": "v1/services/{servicesId}:testIamPermissions", + "httpMethod": "POST", + "parameters": { + "resource": { + "description": "REQUIRED: The resource for which the policy detail is being requested.\n`resource` is usually specified as a path. For example, a Project\nresource is specified as `projects/{project}`.", + "required": true, + "pattern": "^services/[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1/{+resource}:testIamPermissions", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/service.management" + ] + } + } + } + }, + "schemas": { + "Api": { + "description": "Api is a light-weight descriptor for a protocol buffer service.", + "type": "object", + "properties": { + "methods": { + "description": "The methods of this api, in unspecified order.", + "type": "array", + "items": { + "$ref": "Method" + } + }, + "options": { + "description": "Any metadata attached to the API.", + "type": "array", + "items": { + "$ref": "Option" + } + }, + "sourceContext": { + "description": "Source context for the protocol buffer service represented by this\nmessage.", + "$ref": "SourceContext" + }, + "name": { + "description": "The fully qualified name of this api, including package name\nfollowed by the api's simple name.", + "type": "string" + }, + "syntax": { + "description": "The source syntax of the service.", + "enum": [ + "SYNTAX_PROTO2", + "SYNTAX_PROTO3" + ], + "enumDescriptions": [ + "Syntax `proto2`.", + "Syntax `proto3`." + ], + "type": "string" + }, + "version": { + "description": "A version string for this api. If specified, must have the form\n`major-version.minor-version`, as in `1.10`. If the minor version\nis omitted, it defaults to zero. If the entire version field is\nempty, the major version is derived from the package name, as\noutlined below. If the field is not empty, the version in the\npackage name will be verified to be consistent with what is\nprovided here.\n\nThe versioning schema uses [semantic\nversioning](http://semver.org) where the major version number\nindicates a breaking change and the minor version an additive,\nnon-breaking change. Both version numbers are signals to users\nwhat to expect from different versions, and should be carefully\nchosen based on the product plan.\n\nThe major version is also reflected in the package name of the\nAPI, which must end in `v\u003cmajor-version\u003e`, as in\n`google.feature.v1`. For major versions 0 and 1, the suffix can\nbe omitted. Zero major versions must only be used for\nexperimental, none-GA apis.\n", + "type": "string" + }, + "mixins": { + "description": "Included APIs. See Mixin.", + "type": "array", + "items": { + "$ref": "Mixin" + } + } + }, + "id": "Api" + }, + "SystemParameterRule": { + "description": "Define a system parameter rule mapping system parameter definitions to\nmethods.", + "type": "object", + "properties": { + "parameters": { + "description": "Define parameters. Multiple names may be defined for a parameter.\nFor a given method call, only one of them should be used. If multiple\nnames are used the behavior is implementation-dependent.\nIf none of the specified names are present the behavior is\nparameter-dependent.", + "type": "array", + "items": { + "$ref": "SystemParameter" + } + }, + "selector": { + "description": "Selects the methods to which this rule applies. Use '*' to indicate all\nmethods in all APIs.\n\nRefer to selector for syntax details.", + "type": "string" + } + }, + "id": "SystemParameterRule" + }, + "Diagnostic": { + "description": "Represents a diagnostic message (error or warning)", + "type": "object", + "properties": { + "location": { + "description": "File name and line number of the error or warning.", + "type": "string" + }, + "kind": { + "description": "The kind of diagnostic information provided.", + "enum": [ + "WARNING", + "ERROR" + ], + "enumDescriptions": [ + "Warnings and errors", + "Only errors" + ], + "type": "string" + }, + "message": { + "description": "Message describing the error or warning.", + "type": "string" + } + }, + "id": "Diagnostic" + }, + "ChangeReport": { + "description": "Change report associated with a particular service configuration.\n\nIt contains a list of ConfigChanges based on the comparison between\ntwo service configurations.", + "type": "object", + "properties": { + "configChanges": { + "description": "List of changes between two service configurations.\nThe changes will be alphabetically sorted based on the identifier\nof each change.\nA ConfigChange identifier is a dot separated path to the configuration.\nExample: visibility.rules[selector='LibraryService.CreateBook'].restriction", + "type": "array", + "items": { + "$ref": "ConfigChange" + } + } + }, + "id": "ChangeReport" + }, + "MonitoredResourceDescriptor": { + "description": "An object that describes the schema of a MonitoredResource object using a\ntype name and a set of labels. For example, the monitored resource\ndescriptor for Google Compute Engine VM instances has a type of\n`\"gce_instance\"` and specifies the use of the labels `\"instance_id\"` and\n`\"zone\"` to identify particular VM instances.\n\nDifferent APIs can support different monitored resource types. APIs generally\nprovide a `list` method that returns the monitored resource descriptors used\nby the API.", + "type": "object", + "properties": { + "displayName": { + "description": "Optional. A concise name for the monitored resource type that might be\ndisplayed in user interfaces. It should be a Title Cased Noun Phrase,\nwithout any article or other determiners. For example,\n`\"Google Cloud SQL Database\"`.", + "type": "string" + }, + "description": { + "description": "Optional. A detailed description of the monitored resource type that might\nbe used in documentation.", + "type": "string" + }, + "labels": { + "description": "Required. A set of labels used to describe instances of this monitored\nresource type. For example, an individual Google Cloud SQL database is\nidentified by values for the labels `\"database_id\"` and `\"zone\"`.", + "type": "array", + "items": { + "$ref": "LabelDescriptor" + } + }, + "type": { + "description": "Required. The monitored resource type. For example, the type\n`\"cloudsql_database\"` represents databases in Google Cloud SQL.\nThe maximum length of this value is 256 characters.", + "type": "string" + }, + "name": { + "description": "Optional. The resource name of the monitored resource descriptor:\n`\"projects/{project_id}/monitoredResourceDescriptors/{type}\"` where\n{type} is the value of the `type` field in this object and\n{project_id} is a project ID that provides API-specific context for\naccessing the type. APIs that do not use project information can use the\nresource name format `\"monitoredResourceDescriptors/{type}\"`.", + "type": "string" + } + }, + "id": "MonitoredResourceDescriptor" + }, + "LogConfig": { + "description": "Specifies what kind of log the caller must write\nIncrement a streamz counter with the specified metric and field names.\n\nMetric names should start with a '/', generally be lowercase-only,\nand end in \"_count\". Field names should not contain an initial slash.\nThe actual exported metric names will have \"/iam/policy\" prepended.\n\nField names correspond to IAM request parameters and field values are\ntheir respective values.\n\nAt present the only supported field names are\n - \"iam_principal\", corresponding to IAMContext.principal;\n - \"\" (empty string), resulting in one aggretated counter with no field.\n\nExamples:\n counter { metric: \"/debug_access_count\" field: \"iam_principal\" }\n ==\u003e increment counter /iam/policy/backend_debug_access_count\n {iam_principal=[value of IAMContext.principal]}\n\nAt this time we do not support:\n* multiple field names (though this may be supported in the future)\n* decrementing the counter\n* incrementing it by anything other than 1", + "type": "object", + "properties": { + "dataAccess": { + "description": "Data access options.", + "$ref": "DataAccessOptions" + }, + "counter": { + "description": "Counter options.", + "$ref": "CounterOptions" + }, + "cloudAudit": { + "description": "Cloud audit options.", + "$ref": "CloudAuditOptions" + } + }, + "id": "LogConfig" + }, + "Mixin": { + "description": "Declares an API to be included in this API. The including API must\nredeclare all the methods from the included API, but documentation\nand options are inherited as follows:\n\n- If after comment and whitespace stripping, the documentation\n string of the redeclared method is empty, it will be inherited\n from the original method.\n\n- Each annotation belonging to the service config (http,\n visibility) which is not set in the redeclared method will be\n inherited.\n\n- If an http annotation is inherited, the path pattern will be\n modified as follows. Any version prefix will be replaced by the\n version of the including API plus the root path if specified.\n\nExample of a simple mixin:\n\n package google.acl.v1;\n service AccessControl {\n // Get the underlying ACL object.\n rpc GetAcl(GetAclRequest) returns (Acl) {\n option (google.api.http).get = \"/v1/{resource=**}:getAcl\";\n }\n }\n\n package google.storage.v2;\n service Storage {\n // rpc GetAcl(GetAclRequest) returns (Acl);\n\n // Get a data record.\n rpc GetData(GetDataRequest) returns (Data) {\n option (google.api.http).get = \"/v2/{resource=**}\";\n }\n }\n\nExample of a mixin configuration:\n\n apis:\n - name: google.storage.v2.Storage\n mixins:\n - name: google.acl.v1.AccessControl\n\nThe mixin construct implies that all methods in `AccessControl` are\nalso declared with same name and request/response types in\n`Storage`. A documentation generator or annotation processor will\nsee the effective `Storage.GetAcl` method after inherting\ndocumentation and annotations as follows:\n\n service Storage {\n // Get the underlying ACL object.\n rpc GetAcl(GetAclRequest) returns (Acl) {\n option (google.api.http).get = \"/v2/{resource=**}:getAcl\";\n }\n ...\n }\n\nNote how the version in the path pattern changed from `v1` to `v2`.\n\nIf the `root` field in the mixin is specified, it should be a\nrelative path under which inherited HTTP paths are placed. Example:\n\n apis:\n - name: google.storage.v2.Storage\n mixins:\n - name: google.acl.v1.AccessControl\n root: acls\n\nThis implies the following inherited HTTP annotation:\n\n service Storage {\n // Get the underlying ACL object.\n rpc GetAcl(GetAclRequest) returns (Acl) {\n option (google.api.http).get = \"/v2/acls/{resource=**}:getAcl\";\n }\n ...\n }", + "type": "object", + "properties": { + "root": { + "description": "If non-empty specifies a path under which inherited HTTP paths\nare rooted.", + "type": "string" + }, + "name": { + "description": "The fully qualified name of the API which is included.", + "type": "string" + } + }, + "id": "Mixin" + }, + "Service": { + "description": "`Service` is the root object of Google service configuration schema. It\ndescribes basic information about a service, such as the name and the\ntitle, and delegates other aspects to sub-sections. Each sub-section is\neither a proto message or a repeated proto message that configures a\nspecific aspect, such as auth. See each proto message definition for details.\n\nExample:\n\n type: google.api.Service\n config_version: 3\n name: calendar.googleapis.com\n title: Google Calendar API\n apis:\n - name: google.calendar.v3.Calendar\n authentication:\n providers:\n - id: google_calendar_auth\n jwks_uri: https://www.googleapis.com/oauth2/v1/certs\n issuer: https://securetoken.google.com\n rules:\n - selector: \"*\"\n requirements:\n provider_id: google_calendar_auth", + "type": "object", + "properties": { + "id": { + "description": "A unique ID for a specific instance of this message, typically assigned\nby the client for tracking purpose. If empty, the server may choose to\ngenerate one instead.", + "type": "string" + }, + "enums": { + "description": "A list of all enum types included in this API service. Enums\nreferenced directly or indirectly by the `apis` are automatically\nincluded. Enums which are not referenced but shall be included\nshould be listed here by name. Example:\n\n enums:\n - name: google.someapi.v1.SomeEnum", + "type": "array", + "items": { + "$ref": "Enum" + } + }, + "usage": { + "description": "Configuration controlling usage of this service.", + "$ref": "Usage" + }, + "control": { + "description": "Configuration for the service control plane.", + "$ref": "Control" + }, + "title": { + "description": "The product title associated with this service.", + "type": "string" + }, + "http": { + "description": "HTTP configuration.", + "$ref": "Http" + }, + "systemTypes": { + "description": "A list of all proto message types included in this API service.\nIt serves similar purpose as [google.api.Service.types], except that\nthese types are not needed by user-defined APIs. Therefore, they will not\nshow up in the generated discovery doc. This field should only be used\nto define system APIs in ESF.", + "type": "array", + "items": { + "$ref": "Type" + } + }, + "configVersion": { + "description": "The version of the service configuration. The config version may\ninfluence interpretation of the configuration, for example, to\ndetermine defaults. This is documented together with applicable\noptions. The current default for the config version itself is `3`.", + "type": "integer", + "format": "uint32" + }, + "backend": { + "description": "API backend configuration.", + "$ref": "Backend" + }, + "monitoring": { + "description": "Monitoring configuration.", + "$ref": "Monitoring" + }, + "visibility": { + "description": "API visibility configuration.", + "$ref": "Visibility" + }, + "logging": { + "description": "Logging configuration.", + "$ref": "Logging" + }, + "customError": { + "description": "Custom error configuration.", + "$ref": "CustomError" + }, + "context": { + "description": "Context configuration.", + "$ref": "Context" + }, + "apis": { + "description": "A list of API interfaces exported by this service. Only the `name` field\nof the google.protobuf.Api needs to be provided by the configuration\nauthor, as the remaining fields will be derived from the IDL during the\nnormalization process. It is an error to specify an API interface here\nwhich cannot be resolved against the associated IDL files.", + "type": "array", + "items": { + "$ref": "Api" + } + }, + "metrics": { + "description": "Defines the metrics used by this service.", + "type": "array", + "items": { + "$ref": "MetricDescriptor" + } + }, + "systemParameters": { + "description": "System parameter configuration.", + "$ref": "SystemParameters" + }, + "endpoints": { + "description": "Configuration for network endpoints. If this is empty, then an endpoint\nwith the same name as the service is automatically generated to service all\ndefined APIs.", + "type": "array", + "items": { + "$ref": "Endpoint" + } + }, + "name": { + "description": "The DNS address at which this service is available,\ne.g. `calendar.googleapis.com`.", + "type": "string" + }, + "producerProjectId": { + "description": "The id of the Google developer project that owns the service.\nMembers of this project can manage the service configuration,\nmanage consumption of the service, etc.", + "type": "string" + }, + "documentation": { + "description": "Additional API documentation.", + "$ref": "Documentation" + }, + "monitoredResources": { + "description": "Defines the monitored resources used by this service. This is required\nby the Service.monitoring and Service.logging configurations.", + "type": "array", + "items": { + "$ref": "MonitoredResourceDescriptor" + } + }, + "types": { + "description": "A list of all proto message types included in this API service.\nTypes referenced directly or indirectly by the `apis` are\nautomatically included. Messages which are not referenced but\nshall be included, such as types used by the `google.protobuf.Any` type,\nshould be listed here by name. Example:\n\n types:\n - name: google.protobuf.Int32", + "type": "array", + "items": { + "$ref": "Type" + } + }, + "logs": { + "description": "Defines the logs used by this service.", + "type": "array", + "items": { + "$ref": "LogDescriptor" + } + }, + "authentication": { + "description": "Auth configuration.", + "$ref": "Authentication" + } + }, + "id": "Service" + }, + "SubmitConfigSourceResponse": { + "description": "Response message for SubmitConfigSource method.", + "type": "object", + "properties": { + "serviceConfig": { + "description": "The generated service configuration.", + "$ref": "Service" + } + }, + "id": "SubmitConfigSourceResponse" + }, + "Documentation": { + "description": "`Documentation` provides the information for describing a service.\n\nExample:\n\u003cpre\u003e\u003ccode\u003edocumentation:\n summary: \u003e\n The Google Calendar API gives access\n to most calendar features.\n pages:\n - name: Overview\n content: (== include google/foo/overview.md ==)\n - name: Tutorial\n content: (== include google/foo/tutorial.md ==)\n subpages;\n - name: Java\n content: (== include google/foo/tutorial_java.md ==)\n rules:\n - selector: google.calendar.Calendar.Get\n description: \u003e\n ...\n - selector: google.calendar.Calendar.Put\n description: \u003e\n ...\n\u003c/code\u003e\u003c/pre\u003e\nDocumentation is provided in markdown syntax. In addition to\nstandard markdown features, definition lists, tables and fenced\ncode blocks are supported. Section headers can be provided and are\ninterpreted relative to the section nesting of the context where\na documentation fragment is embedded.\n\nDocumentation from the IDL is merged with documentation defined\nvia the config at normalization time, where documentation provided\nby config rules overrides IDL provided.\n\nA number of constructs specific to the API platform are supported\nin documentation text.\n\nIn order to reference a proto element, the following\nnotation can be used:\n\u003cpre\u003e\u003ccode\u003e[fully.qualified.proto.name][]\u003c/code\u003e\u003c/pre\u003e\nTo override the display text used for the link, this can be used:\n\u003cpre\u003e\u003ccode\u003e[display text][fully.qualified.proto.name]\u003c/code\u003e\u003c/pre\u003e\nText can be excluded from doc using the following notation:\n\u003cpre\u003e\u003ccode\u003e(-- internal comment --)\u003c/code\u003e\u003c/pre\u003e\nComments can be made conditional using a visibility label. The below\ntext will be only rendered if the `BETA` label is available:\n\u003cpre\u003e\u003ccode\u003e(--BETA: comment for BETA users --)\u003c/code\u003e\u003c/pre\u003e\nA few directives are available in documentation. Note that\ndirectives must appear on a single line to be properly\nidentified. The `include` directive includes a markdown file from\nan external source:\n\u003cpre\u003e\u003ccode\u003e(== include path/to/file ==)\u003c/code\u003e\u003c/pre\u003e\nThe `resource_for` directive marks a message to be the resource of\na collection in REST view. If it is not specified, tools attempt\nto infer the resource from the operations in a collection:\n\u003cpre\u003e\u003ccode\u003e(== resource_for v1.shelves.books ==)\u003c/code\u003e\u003c/pre\u003e\nThe directive `suppress_warning` does not directly affect documentation\nand is documented together with service config validation.", + "type": "object", + "properties": { + "overview": { + "description": "Declares a single overview page. For example:\n\u003cpre\u003e\u003ccode\u003edocumentation:\n summary: ...\n overview: (== include overview.md ==)\n\u003c/code\u003e\u003c/pre\u003e\nThis is a shortcut for the following declaration (using pages style):\n\u003cpre\u003e\u003ccode\u003edocumentation:\n summary: ...\n pages:\n - name: Overview\n content: (== include overview.md ==)\n\u003c/code\u003e\u003c/pre\u003e\nNote: you cannot specify both `overview` field and `pages` field.", + "type": "string" + }, + "documentationRootUrl": { + "description": "The URL to the root of documentation.", + "type": "string" + }, + "pages": { + "description": "The top level pages for the documentation set.", + "type": "array", + "items": { + "$ref": "Page" + } + }, + "summary": { + "description": "A short summary of what the service does. Can only be provided by\nplain text.", + "type": "string" + }, + "rules": { + "description": "A list of documentation rules that apply to individual API elements.\n\n**NOTE:** All service configuration rules follow \"last one wins\" order.", + "type": "array", + "items": { + "$ref": "DocumentationRule" + } + } + }, + "id": "Documentation" + }, + "Policy": { + "description": "Defines an Identity and Access Management (IAM) policy. It is used to\nspecify access control policies for Cloud Platform resources.\n\n\nA `Policy` consists of a list of `bindings`. A `Binding` binds a list of\n`members` to a `role`, where the members can be user accounts, Google groups,\nGoogle domains, and service accounts. A `role` is a named list of permissions\ndefined by IAM.\n\n**Example**\n\n {\n \"bindings\": [\n {\n \"role\": \"roles/owner\",\n \"members\": [\n \"user:mike@example.com\",\n \"group:admins@example.com\",\n \"domain:google.com\",\n \"serviceAccount:my-other-app@appspot.gserviceaccount.com\",\n ]\n },\n {\n \"role\": \"roles/viewer\",\n \"members\": [\"user:sean@example.com\"]\n }\n ]\n }\n\nFor a description of IAM and its features, see the\n[IAM developer's guide](https://cloud.google.com/iam).", + "type": "object", + "properties": { + "auditConfigs": { + "description": "Specifies audit logging configs for \"data access\".\n\"data access\": generally refers to data reads/writes and admin reads.\n\"admin activity\": generally refers to admin writes.\n\nNote: `AuditConfig` doesn't apply to \"admin activity\", which always\nenables audit logging.", + "type": "array", + "items": { + "$ref": "AuditConfig" + } + }, + "rules": { + "description": "If more than one rule is specified, the rules are applied in the following\nmanner:\n- All matching LOG rules are always applied.\n- If any DENY/DENY_WITH_LOG rule matches, permission is denied.\n Logging will be applied if one or more matching rule requires logging.\n- Otherwise, if any ALLOW/ALLOW_WITH_LOG rule matches, permission is\n granted.\n Logging will be applied if one or more matching rule requires logging.\n- Otherwise, if no rule applies, permission is denied.", + "type": "array", + "items": { + "$ref": "Rule" + } + }, + "bindings": { + "description": "Associates a list of `members` to a `role`.\nMultiple `bindings` must not be specified for the same `role`.\n`bindings` with no members will result in an error.", + "type": "array", + "items": { + "$ref": "Binding" + } + }, + "etag": { + "description": "`etag` is used for optimistic concurrency control as a way to help\nprevent simultaneous updates of a policy from overwriting each other.\nIt is strongly suggested that systems make use of the `etag` in the\nread-modify-write cycle to perform policy updates in order to avoid race\nconditions: An `etag` is returned in the response to `getIamPolicy`, and\nsystems are expected to put that etag in the request to `setIamPolicy` to\nensure that their change will be applied to the same version of the policy.\n\nIf no `etag` is provided in the call to `setIamPolicy`, then the existing\npolicy is overwritten blindly.", + "type": "string", + "format": "byte" + }, + "iamOwned": { + "type": "boolean" + }, + "version": { + "description": "Version of the `Policy`. The default version is 0.", + "type": "integer", + "format": "int32" + } + }, + "id": "Policy" + }, + "OAuthRequirements": { + "description": "OAuth scopes are a way to define data and permissions on data. For example,\nthere are scopes defined for \"Read-only access to Google Calendar\" and\n\"Access to Cloud Platform\". Users can consent to a scope for an application,\ngiving it permission to access that data on their behalf.\n\nOAuth scope specifications should be fairly coarse grained; a user will need\nto see and understand the text description of what your scope means.\n\nIn most cases: use one or at most two OAuth scopes for an entire family of\nproducts. If your product has multiple APIs, you should probably be sharing\nthe OAuth scope across all of those APIs.\n\nWhen you need finer grained OAuth consent screens: talk with your product\nmanagement about how developers will use them in practice.\n\nPlease note that even though each of the canonical scopes is enough for a\nrequest to be accepted and passed to the backend, a request can still fail\ndue to the backend requiring additional scopes or permissions.", + "type": "object", + "properties": { + "canonicalScopes": { + "description": "The list of publicly documented OAuth scopes that are allowed access. An\nOAuth token containing any of these scopes will be accepted.\n\nExample:\n\n canonical_scopes: https://www.googleapis.com/auth/calendar,\n https://www.googleapis.com/auth/calendar.read", + "type": "string" + } + }, + "id": "OAuthRequirements" + }, + "ListServicesResponse": { + "description": "Response message for `ListServices` method.", + "type": "object", + "properties": { + "nextPageToken": { + "description": "Token that can be passed to `ListServices` to resume a paginated query.", + "type": "string" + }, + "services": { + "description": "The returned services will only have the name field set.", + "type": "array", + "items": { + "$ref": "ManagedService" + } + } + }, + "id": "ListServicesResponse" + }, + "Step": { + "description": "Represents the status of one operation step.", + "type": "object", + "properties": { + "description": { + "description": "The short description of the step.", + "type": "string" + }, + "status": { + "description": "The status code.", + "enum": [ + "STATUS_UNSPECIFIED", + "DONE", + "NOT_STARTED", + "IN_PROGRESS", + "FAILED", + "CANCELLED" + ], + "enumDescriptions": [ + "Unspecifed code.", + "The step has completed without errors.", + "The step has not started yet.", + "The step is in progress.", + "The step has completed with errors.", + "The step has completed with cancellation." + ], + "type": "string" + } + }, + "id": "Step" + }, + "Context": { + "description": "`Context` defines which contexts an API requests.\n\nExample:\n\n context:\n rules:\n - selector: \"*\"\n requested:\n - google.rpc.context.ProjectContext\n - google.rpc.context.OriginContext\n\nThe above specifies that all methods in the API request\n`google.rpc.context.ProjectContext` and\n`google.rpc.context.OriginContext`.\n\nAvailable context types are defined in package\n`google.rpc.context`.", + "type": "object", + "properties": { + "rules": { + "description": "A list of RPC context rules that apply to individual API methods.\n\n**NOTE:** All service configuration rules follow \"last one wins\" order.", + "type": "array", + "items": { + "$ref": "ContextRule" + } + } + }, + "id": "Context" + }, + "Monitoring": { + "description": "Monitoring configuration of the service.\n\nThe example below shows how to configure monitored resources and metrics\nfor monitoring. In the example, a monitored resource and two metrics are\ndefined. The `library.googleapis.com/book/returned_count` metric is sent\nto both producer and consumer projects, whereas the\n`library.googleapis.com/book/overdue_count` metric is only sent to the\nconsumer project.\n\n monitored_resources:\n - type: library.googleapis.com/branch\n labels:\n - key: /city\n description: The city where the library branch is located in.\n - key: /name\n description: The name of the branch.\n metrics:\n - name: library.googleapis.com/book/returned_count\n metric_kind: DELTA\n value_type: INT64\n labels:\n - key: /customer_id\n - name: library.googleapis.com/book/overdue_count\n metric_kind: GAUGE\n value_type: INT64\n labels:\n - key: /customer_id\n monitoring:\n producer_destinations:\n - monitored_resource: library.googleapis.com/branch\n metrics:\n - library.googleapis.com/book/returned_count\n consumer_destinations:\n - monitored_resource: library.googleapis.com/branch\n metrics:\n - library.googleapis.com/book/returned_count\n - library.googleapis.com/book/overdue_count", + "type": "object", + "properties": { + "producerDestinations": { + "description": "Monitoring configurations for sending metrics to the producer project.\nThere can be multiple producer destinations, each one must have a\ndifferent monitored resource type. A metric can be used in at most\none producer destination.", + "type": "array", + "items": { + "$ref": "MonitoringDestination" + } + }, + "consumerDestinations": { + "description": "Monitoring configurations for sending metrics to the consumer project.\nThere can be multiple consumer destinations, each one must have a\ndifferent monitored resource type. A metric can be used in at most\none consumer destination.", + "type": "array", + "items": { + "$ref": "MonitoringDestination" + } + } + }, + "id": "Monitoring" + }, + "ManagedService": { + "description": "The full representation of a Service that is managed by\nGoogle Service Management.", + "type": "object", + "properties": { + "producerProjectId": { + "description": "ID of the project that produces and owns this service.", + "type": "string" + }, + "serviceName": { + "description": "The name of the service. See the [overview](/service-management/overview)\nfor naming requirements.", + "type": "string" + } + }, + "id": "ManagedService" + }, + "ConfigFile": { + "description": "Generic specification of a source configuration file", + "type": "object", + "properties": { + "filePath": { + "description": "The file name of the configuration file (full or relative path).", + "type": "string" + }, + "fileType": { + "description": "The type of configuration file this represents.", + "enum": [ + "FILE_TYPE_UNSPECIFIED", + "SERVICE_CONFIG_YAML", + "OPEN_API_JSON", + "OPEN_API_YAML", + "FILE_DESCRIPTOR_SET_PROTO" + ], + "enumDescriptions": [ + "Unknown file type.", + "YAML-specification of service.", + "OpenAPI specification, serialized in JSON.", + "OpenAPI specification, serialized in YAML.", + "FileDescriptorSet, generated by protoc.\n\nTo generate, use protoc with imports and source info included.\nFor an example test.proto file, the following command would put the value\nin a new file named out.pb.\n\n$protoc --include_imports --include_source_info test.proto -o out.pb" + ], + "type": "string" + }, + "fileContents": { + "description": "The bytes that constitute the file.", + "type": "string", + "format": "byte" + } + }, + "id": "ConfigFile" + }, + "ListServiceConfigsResponse": { + "description": "Response message for ListServiceConfigs method.", + "type": "object", + "properties": { + "nextPageToken": { + "description": "The token of the next page of results.", + "type": "string" + }, + "serviceConfigs": { + "description": "The list of service configuration resources.", + "type": "array", + "items": { + "$ref": "Service" + } + } + }, + "id": "ListServiceConfigsResponse" + }, + "TrafficPercentStrategy": { + "description": "Strategy that specifies how Google Service Control should select\ndifferent\nversions of service configurations based on traffic percentage.\n\nOne example of how to gradually rollout a new service configuration using\nthis\nstrategy:\nDay 1\n\n Rollout {\n id: \"example.googleapis.com/rollout_20160206\"\n traffic_percent_strategy {\n percentages: {\n \"example.googleapis.com/20160201\": 70.00\n \"example.googleapis.com/20160206\": 30.00\n }\n }\n }\n\nDay 2\n\n Rollout {\n id: \"example.googleapis.com/rollout_20160207\"\n traffic_percent_strategy: {\n percentages: {\n \"example.googleapis.com/20160206\": 100.00\n }\n }\n }", + "type": "object", + "properties": { + "percentages": { + "description": "Maps service configuration IDs to their corresponding traffic percentage.\nKey is the service configuration ID, Value is the traffic percentage\nwhich must be greater than 0.0 and the sum must equal to 100.0.", + "additionalProperties": { + "type": "number", + "format": "double" + }, + "type": "object" + } + }, + "id": "TrafficPercentStrategy" + }, + "GenerateConfigReportRequest": { + "description": "Request message for GenerateConfigReport method.", + "type": "object", + "properties": { + "oldConfig": { + "description": "Service configuration against which the comparison will be done.\nFor this version of API, the supported types are\ngoogle.api.servicemanagement.v1.ConfigRef,\ngoogle.api.servicemanagement.v1.ConfigSource,\nand google.api.Service", + "additionalProperties": { + "description": "Properties of the object. Contains field @type with type URL.", + "type": "any" + }, + "type": "object" + }, + "newConfig": { + "description": "Service configuration for which we want to generate the report.\nFor this version of API, the supported types are\ngoogle.api.servicemanagement.v1.ConfigRef,\ngoogle.api.servicemanagement.v1.ConfigSource,\nand google.api.Service", + "additionalProperties": { + "description": "Properties of the object. Contains field @type with type URL.", + "type": "any" + }, + "type": "object" + } + }, + "id": "GenerateConfigReportRequest" + }, + "GetIamPolicyRequest": { + "description": "Request message for `GetIamPolicy` method.", + "type": "object", + "properties": {}, + "id": "GetIamPolicyRequest" + }, + "LoggingDestination": { + "description": "Configuration of a specific logging destination (the producer project\nor the consumer project).", + "type": "object", + "properties": { + "monitoredResource": { + "description": "The monitored resource type. The type must be defined in the\nService.monitored_resources section.", + "type": "string" + }, + "logs": { + "description": "Names of the logs to be sent to this destination. Each name must\nbe defined in the Service.logs section. If the log name is\nnot a domain scoped name, it will be automatically prefixed with\nthe service name followed by \"/\".", + "type": "array", + "items": { + "type": "string" + } + } + }, + "id": "LoggingDestination" + }, + "Authentication": { + "description": "`Authentication` defines the authentication configuration for an API.\n\nExample for an API targeted for external use:\n\n name: calendar.googleapis.com\n authentication:\n providers:\n - id: google_calendar_auth\n jwks_uri: https://www.googleapis.com/oauth2/v1/certs\n issuer: https://securetoken.google.com\n rules:\n - selector: \"*\"\n requirements:\n provider_id: google_calendar_auth", + "type": "object", + "properties": { + "providers": { + "description": "Defines a set of authentication providers that a service supports.", + "type": "array", + "items": { + "$ref": "AuthProvider" + } + }, + "rules": { + "description": "A list of authentication rules that apply to individual API methods.\n\n**NOTE:** All service configuration rules follow \"last one wins\" order.", + "type": "array", + "items": { + "$ref": "AuthenticationRule" + } + } + }, + "id": "Authentication" + }, + "Type": { + "description": "A protocol buffer message type.", + "type": "object", + "properties": { + "oneofs": { + "description": "The list of types appearing in `oneof` definitions in this type.", + "type": "array", + "items": { + "type": "string" + } + }, + "options": { + "description": "The protocol buffer options.", + "type": "array", + "items": { + "$ref": "Option" + } + }, + "sourceContext": { + "description": "The source context.", + "$ref": "SourceContext" + }, + "fields": { + "description": "The list of fields.", + "type": "array", + "items": { + "$ref": "Field" + } + }, + "name": { + "description": "The fully qualified message name.", + "type": "string" + }, + "syntax": { + "description": "The source syntax.", + "enum": [ + "SYNTAX_PROTO2", + "SYNTAX_PROTO3" + ], + "enumDescriptions": [ + "Syntax `proto2`.", + "Syntax `proto3`." + ], + "type": "string" + } + }, + "id": "Type" + }, + "Backend": { + "description": "`Backend` defines the backend configuration for a service.", + "type": "object", + "properties": { + "rules": { + "description": "A list of API backend rules that apply to individual API methods.\n\n**NOTE:** All service configuration rules follow \"last one wins\" order.", + "type": "array", + "items": { + "$ref": "BackendRule" + } + } + }, + "id": "Backend" + }, + "AuditConfig": { + "description": "Provides the configuration for non-admin_activity logging for a service.\nControls exemptions and specific log sub-types.", + "type": "object", + "properties": { + "service": { + "description": "Specifies a service that will be enabled for audit logging.\nFor example, `resourcemanager`, `storage`, `compute`.\n`allServices` is a special value that covers all services.", + "type": "string" + }, + "auditLogConfigs": { + "description": "The configuration for each type of logging\nNext ID: 4", + "type": "array", + "items": { + "$ref": "AuditLogConfig" + } + }, + "exemptedMembers": { + "description": "Specifies the identities that are exempted from \"data access\" audit\nlogging for the `service` specified above.\nFollows the same format of Binding.members.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "id": "AuditConfig" + }, + "ListServiceRolloutsResponse": { + "description": "Response message for ListServiceRollouts method.", + "type": "object", + "properties": { + "rollouts": { + "description": "The list of rollout resources.", + "type": "array", + "items": { + "$ref": "Rollout" + } + }, + "nextPageToken": { + "description": "The token of the next page of results.", + "type": "string" + } + }, + "id": "ListServiceRolloutsResponse" + }, + "Rollout": { + "description": "A rollout resource that defines how service configuration versions are pushed\nto control plane systems. Typically, you create a new version of the\nservice config, and then create a Rollout to push the service config.", + "type": "object", + "properties": { + "createdBy": { + "description": "The user who created the Rollout. Readonly.", + "type": "string" + }, + "trafficPercentStrategy": { + "description": "Google Service Control selects service configurations based on\ntraffic percentage.", + "$ref": "TrafficPercentStrategy" + }, + "status": { + "description": "The status of this rollout. Readonly. In case of a failed rollout,\nthe system will automatically rollback to the current Rollout\nversion. Readonly.", + "enum": [ + "ROLLOUT_STATUS_UNSPECIFIED", + "IN_PROGRESS", + "SUCCESS", + "CANCELLED", + "FAILED", + "PENDING" + ], + "enumDescriptions": [ + "No status specified.", + "The Rollout is in progress.", + "The Rollout has completed successfully.", + "The Rollout has been cancelled. This can happen if you have overlapping\nRollout pushes, and the previous ones will be cancelled.", + "The Rollout has failed. It is typically caused by configuration errors.", + "The Rollout has not started yet and is pending for execution." + ], + "type": "string" + }, + "deleteServiceStrategy": { + "description": "The strategy associated with a rollout to delete a `ManagedService`.\nReadonly.", + "$ref": "DeleteServiceStrategy" + }, + "createTime": { + "description": "Creation time of the rollout. Readonly.", + "type": "string", + "format": "google-datetime" + }, + "serviceName": { + "description": "The name of the service associated with this Rollout.", + "type": "string" + }, + "rolloutId": { + "description": "Optional unique identifier of this Rollout. Only lower case letters, digits\n and '-' are allowed.\n\nIf not specified by client, the server will generate one. The generated id\nwill have the form of \u003cdate\u003e\u003crevision number\u003e, where \"date\" is the create\ndate in ISO 8601 format. \"revision number\" is a monotonically increasing\npositive number that is reset every day for each service.\nAn example of the generated rollout_id is '2016-02-16r1'", + "type": "string" + } + }, + "id": "Rollout" + }, + "ConfigSource": { + "description": "Represents a source file which is used to generate the service configuration\ndefined by `google.api.Service`.", + "type": "object", + "properties": { + "files": { + "description": "Set of source configuration files that are used to generate a service\nconfiguration (`google.api.Service`).", + "type": "array", + "items": { + "$ref": "ConfigFile" + } + }, + "id": { + "description": "A unique ID for a specific instance of this message, typically assigned\nby the client for tracking purpose. If empty, the server may choose to\ngenerate one instead.", + "type": "string" + } + }, + "id": "ConfigSource" + }, + "Method": { + "description": "Method represents a method of an api.", + "type": "object", + "properties": { + "requestStreaming": { + "description": "If true, the request is streamed.", + "type": "boolean" + }, + "options": { + "description": "Any metadata attached to the method.", + "type": "array", + "items": { + "$ref": "Option" + } + }, + "requestTypeUrl": { + "description": "A URL of the input message type.", + "type": "string" + }, + "name": { + "description": "The simple name of this method.", + "type": "string" + }, + "syntax": { + "description": "The source syntax of this method.", + "enum": [ + "SYNTAX_PROTO2", + "SYNTAX_PROTO3" + ], + "enumDescriptions": [ + "Syntax `proto2`.", + "Syntax `proto3`." + ], + "type": "string" + }, + "responseTypeUrl": { + "description": "The URL of the output message type.", + "type": "string" + }, + "responseStreaming": { + "description": "If true, the response is streamed.", + "type": "boolean" + } + }, + "id": "Method" + }, + "Operation": { + "description": "This resource represents a long-running operation that is the result of a\nnetwork API call.", + "type": "object", + "properties": { + "error": { + "description": "The error result of the operation in case of failure or cancellation.", + "$ref": "Status" + }, + "done": { + "description": "If the value is `false`, it means the operation is still in progress.\nIf true, the operation is completed, and either `error` or `response` is\navailable.", + "type": "boolean" + }, + "metadata": { + "description": "Service-specific metadata associated with the operation. It typically\ncontains progress information and common metadata such as create time.\nSome services might not provide such metadata. Any method that returns a\nlong-running operation should document the metadata type, if any.", + "additionalProperties": { + "description": "Properties of the object. Contains field @type with type URL.", + "type": "any" + }, + "type": "object" + }, + "response": { + "description": "The normal response of the operation in case of success. If the original\nmethod returns no data on success, such as `Delete`, the response is\n`google.protobuf.Empty`. If the original method is standard\n`Get`/`Create`/`Update`, the response should be the resource. For other\nmethods, the response should have the type `XxxResponse`, where `Xxx`\nis the original method name. For example, if the original method name\nis `TakeSnapshot()`, the inferred response type is\n`TakeSnapshotResponse`.", + "additionalProperties": { + "description": "Properties of the object. Contains field @type with type URL.", + "type": "any" + }, + "type": "object" + }, + "name": { + "description": "The server-assigned name, which is only unique within the same service that\noriginally returns it. If you use the default HTTP mapping, the\n`name` should have the format of `operations/some/unique/name`.", + "type": "string" + } + }, + "id": "Operation" + }, + "Rule": { + "description": "A rule to be applied in a Policy.", + "type": "object", + "properties": { + "description": { + "description": "Human-readable description of the rule.", + "type": "string" + }, + "in": { + "description": "If one or more 'in' clauses are specified, the rule matches if\nthe PRINCIPAL/AUTHORITY_SELECTOR is in at least one of these entries.", + "type": "array", + "items": { + "type": "string" + } + }, + "action": { + "description": "Required", + "enum": [ + "NO_ACTION", + "ALLOW", + "ALLOW_WITH_LOG", + "DENY", + "DENY_WITH_LOG", + "LOG" + ], + "enumDescriptions": [ + "Default no action.", + "Matching 'Entries' grant access.", + "Matching 'Entries' grant access and the caller promises to log\nthe request per the returned log_configs.", + "Matching 'Entries' deny access.", + "Matching 'Entries' deny access and the caller promises to log\nthe request per the returned log_configs.", + "Matching 'Entries' tell IAM.Check callers to generate logs." + ], + "type": "string" + }, + "conditions": { + "description": "Additional restrictions that must be met", + "type": "array", + "items": { + "$ref": "Condition" + } + }, + "notIn": { + "description": "If one or more 'not_in' clauses are specified, the rule matches\nif the PRINCIPAL/AUTHORITY_SELECTOR is in none of the entries.\nThe format for in and not_in entries is the same as for members in a\nBinding (see google/iam/v1/policy.proto).", + "type": "array", + "items": { + "type": "string" + } + }, + "logConfig": { + "description": "The config returned to callers of tech.iam.IAM.CheckPolicy for any entries\nthat match the LOG action.", + "type": "array", + "items": { + "$ref": "LogConfig" + } + }, + "permissions": { + "description": "A permission is a string of form '\u003cservice\u003e.\u003cresource type\u003e.\u003cverb\u003e'\n(e.g., 'storage.buckets.list'). A value of '*' matches all permissions,\nand a verb part of '*' (e.g., 'storage.buckets.*') matches all verbs.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "id": "Rule" + }, + "MetricDescriptor": { + "description": "Defines a metric type and its schema. Once a metric descriptor is created,\ndeleting or altering it stops data collection and makes the metric type's\nexisting data unusable.", + "type": "object", + "properties": { + "description": { + "description": "A detailed description of the metric, which can be used in documentation.", + "type": "string" + }, + "unit": { + "description": "The unit in which the metric value is reported. It is only applicable\nif the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The\nsupported units are a subset of [The Unified Code for Units of\nMeasure](http://unitsofmeasure.org/ucum.html) standard:\n\n**Basic units (UNIT)**\n\n* `bit` bit\n* `By` byte\n* `s` second\n* `min` minute\n* `h` hour\n* `d` day\n\n**Prefixes (PREFIX)**\n\n* `k` kilo (10**3)\n* `M` mega (10**6)\n* `G` giga (10**9)\n* `T` tera (10**12)\n* `P` peta (10**15)\n* `E` exa (10**18)\n* `Z` zetta (10**21)\n* `Y` yotta (10**24)\n* `m` milli (10**-3)\n* `u` micro (10**-6)\n* `n` nano (10**-9)\n* `p` pico (10**-12)\n* `f` femto (10**-15)\n* `a` atto (10**-18)\n* `z` zepto (10**-21)\n* `y` yocto (10**-24)\n* `Ki` kibi (2**10)\n* `Mi` mebi (2**20)\n* `Gi` gibi (2**30)\n* `Ti` tebi (2**40)\n\n**Grammar**\n\nThe grammar includes the dimensionless unit `1`, such as `1/s`.\n\nThe grammar also includes these connectors:\n\n* `/` division (as an infix operator, e.g. `1/s`).\n* `.` multiplication (as an infix operator, e.g. `GBy.d`)\n\nThe grammar for a unit is as follows:\n\n Expression = Component { \".\" Component } { \"/\" Component } ;\n\n Component = [ PREFIX ] UNIT [ Annotation ]\n | Annotation\n | \"1\"\n ;\n\n Annotation = \"{\" NAME \"}\" ;\n\nNotes:\n\n* `Annotation` is just a comment if it follows a `UNIT` and is\n equivalent to `1` if it is used alone. For examples,\n `{requests}/s == 1/s`, `By{transmitted}/s == By/s`.\n* `NAME` is a sequence of non-blank printable ASCII characters not\n containing '{' or '}'.", + "type": "string" + }, + "labels": { + "description": "The set of labels that can be used to describe a specific\ninstance of this metric type. For example, the\n`appengine.googleapis.com/http/server/response_latencies` metric\ntype has a label for the HTTP response code, `response_code`, so\nyou can look at latencies for successful responses or just\nfor responses that failed.", + "type": "array", + "items": { + "$ref": "LabelDescriptor" + } + }, + "metricKind": { + "description": "Whether the metric records instantaneous values, changes to a value, etc.\nSome combinations of `metric_kind` and `value_type` might not be supported.", + "enum": [ + "METRIC_KIND_UNSPECIFIED", + "GAUGE", + "DELTA", + "CUMULATIVE" + ], + "enumDescriptions": [ + "Do not use this default value.", + "An instantaneous measurement of a value.", + "The change in a value during a time interval.", + "A value accumulated over a time interval. Cumulative\nmeasurements in a time series should have the same start time\nand increasing end times, until an event resets the cumulative\nvalue to zero and sets a new start time for the following\npoints." + ], + "type": "string" + }, + "valueType": { + "description": "Whether the measurement is an integer, a floating-point number, etc.\nSome combinations of `metric_kind` and `value_type` might not be supported.", + "enum": [ + "VALUE_TYPE_UNSPECIFIED", + "BOOL", + "INT64", + "DOUBLE", + "STRING", + "DISTRIBUTION", + "MONEY" + ], + "enumDescriptions": [ + "Do not use this default value.", + "The value is a boolean.\nThis value type can be used only if the metric kind is `GAUGE`.", + "The value is a signed 64-bit integer.", + "The value is a double precision floating point number.", + "The value is a text string.\nThis value type can be used only if the metric kind is `GAUGE`.", + "The value is a `Distribution`.", + "The value is money." + ], + "type": "string" + }, + "displayName": { + "description": "A concise name for the metric, which can be displayed in user interfaces.\nUse sentence case without an ending period, for example \"Request count\".", + "type": "string" + }, + "name": { + "description": "The resource name of the metric descriptor. Depending on the\nimplementation, the name typically includes: (1) the parent resource name\nthat defines the scope of the metric type or of its data; and (2) the\nmetric's URL-encoded type, which also appears in the `type` field of this\ndescriptor. For example, following is the resource name of a custom\nmetric within the GCP project 123456789:\n\n \"projects/123456789/metricDescriptors/custom.googleapis.com%2Finvoice%2Fpaid%2Famount\"", + "type": "string" + }, + "type": { + "description": "The metric type, including its DNS name prefix. The type is not\nURL-encoded. All user-defined metric types have the DNS name\n`custom.googleapis.com`. Metric types should use a natural hierarchical\ngrouping. For example:\n\n \"custom.googleapis.com/invoice/paid/amount\"\n \"appengine.googleapis.com/http/server/response_latencies\"", + "type": "string" + } + }, + "id": "MetricDescriptor" + }, + "EnableServiceRequest": { + "description": "Request message for EnableService method.", + "type": "object", + "properties": { + "consumerId": { + "description": "The identity of consumer resource which service enablement will be\napplied to.\n\nThe Google Service Management implementation accepts the following\nforms:\n- \"project:\u003cproject_id\u003e\"\n\nNote: this is made compatible with\ngoogle.api.servicecontrol.v1.Operation.consumer_id.", + "type": "string" + } + }, + "id": "EnableServiceRequest" + }, + "DocumentationRule": { + "description": "A documentation rule provides information about individual API elements.", + "type": "object", + "properties": { + "description": { + "description": "Description of the selected API(s).", + "type": "string" + }, + "deprecationDescription": { + "description": "Deprecation description of the selected element(s). It can be provided if an\nelement is marked as `deprecated`.", + "type": "string" + }, + "selector": { + "description": "The selector is a comma-separated list of patterns. Each pattern is a\nqualified name of the element which may end in \"*\", indicating a wildcard.\nWildcards are only allowed at the end and for a whole component of the\nqualified name, i.e. \"foo.*\" is ok, but not \"foo.b*\" or \"foo.*.bar\". To\nspecify a default for all applicable elements, the whole pattern \"*\"\nis used.", + "type": "string" + } + }, + "id": "DocumentationRule" + }, + "SetIamPolicyRequest": { + "description": "Request message for `SetIamPolicy` method.", + "type": "object", + "properties": { + "policy": { + "description": "REQUIRED: The complete policy to be applied to the `resource`. The size of\nthe policy is limited to a few 10s of KB. An empty policy is a\nvalid policy but certain Cloud Platform services (such as Projects)\nmight reject them.", + "$ref": "Policy" + } + }, + "id": "SetIamPolicyRequest" + }, + "CounterOptions": { + "description": "Options for counters", + "type": "object", + "properties": { + "metric": { + "description": "The metric to update.", + "type": "string" + }, + "field": { + "description": "The field value to attribute.", + "type": "string" + } + }, + "id": "CounterOptions" + }, + "Condition": { + "description": "A condition to be met.", + "type": "object", + "properties": { + "sys": { + "description": "Trusted attributes supplied by any service that owns resources and uses\nthe IAM system for access control.", + "enum": [ + "NO_ATTR", + "REGION", + "SERVICE", + "NAME", + "IP" + ], + "enumDescriptions": [ + "Default non-attribute type", + "Region of the resource", + "Service name", + "Resource name", + "IP address of the caller" + ], + "type": "string" + }, + "values": { + "description": "The objects of the condition. This is mutually exclusive with 'value'.", + "type": "array", + "items": { + "type": "string" + } + }, + "iam": { + "description": "Trusted attributes supplied by the IAM system.", + "enum": [ + "NO_ATTR", + "AUTHORITY", + "ATTRIBUTION" + ], + "enumDescriptions": [ + "Default non-attribute.", + "Either principal or (if present) authority selector.", + "The principal (even if an authority selector is present), which\nmust only be used for attribution, not authorization." + ], + "type": "string" + }, + "op": { + "description": "An operator to apply the subject with.", + "enum": [ + "NO_OP", + "EQUALS", + "NOT_EQUALS", + "IN", + "NOT_IN", + "DISCHARGED" + ], + "enumDescriptions": [ + "Default no-op.", + "DEPRECATED. Use IN instead.", + "DEPRECATED. Use NOT_IN instead.", + "Set-inclusion check.", + "Set-exclusion check.", + "Subject is discharged" + ], + "type": "string" + }, + "value": { + "description": "DEPRECATED. Use 'values' instead.", + "type": "string" + }, + "svc": { + "description": "Trusted attributes discharged by the service.", + "type": "string" + } + }, + "id": "Condition" + }, + "Status": { + "description": "The `Status` type defines a logical error model that is suitable for different\nprogramming environments, including REST APIs and RPC APIs. It is used by\n[gRPC](https://github.com/grpc). The error model is designed to be:\n\n- Simple to use and understand for most users\n- Flexible enough to meet unexpected needs\n\n# Overview\n\nThe `Status` message contains three pieces of data: error code, error message,\nand error details. The error code should be an enum value of\ngoogle.rpc.Code, but it may accept additional error codes if needed. The\nerror message should be a developer-facing English message that helps\ndevelopers *understand* and *resolve* the error. If a localized user-facing\nerror message is needed, put the localized message in the error details or\nlocalize it in the client. The optional error details may contain arbitrary\ninformation about the error. There is a predefined set of error detail types\nin the package `google.rpc` which can be used for common error conditions.\n\n# Language mapping\n\nThe `Status` message is the logical representation of the error model, but it\nis not necessarily the actual wire format. When the `Status` message is\nexposed in different client libraries and different wire protocols, it can be\nmapped differently. For example, it will likely be mapped to some exceptions\nin Java, but more likely mapped to some error codes in C.\n\n# Other uses\n\nThe error model and the `Status` message can be used in a variety of\nenvironments, either with or without APIs, to provide a\nconsistent developer experience across different environments.\n\nExample uses of this error model include:\n\n- Partial errors. If a service needs to return partial errors to the client,\n it may embed the `Status` in the normal response to indicate the partial\n errors.\n\n- Workflow errors. A typical workflow has multiple steps. Each step may\n have a `Status` message for error reporting purpose.\n\n- Batch operations. If a client uses batch request and batch response, the\n `Status` message should be used directly inside batch response, one for\n each error sub-response.\n\n- Asynchronous operations. If an API call embeds asynchronous operation\n results in its response, the status of those operations should be\n represented directly using the `Status` message.\n\n- Logging. If some API errors are stored in logs, the message `Status` could\n be used directly after any stripping needed for security/privacy reasons.", + "type": "object", + "properties": { + "code": { + "description": "The status code, which should be an enum value of google.rpc.Code.", + "type": "integer", + "format": "int32" + }, + "details": { + "description": "A list of messages that carry the error details. There will be a\ncommon set of message types for APIs to use.", + "type": "array", + "items": { + "additionalProperties": { + "description": "Properties of the object. Contains field @type with type URL.", + "type": "any" + }, + "type": "object" + } + }, + "message": { + "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\ngoogle.rpc.Status.details field, or localized by the client.", + "type": "string" + } + }, + "id": "Status" + }, + "Endpoint": { + "description": "`Endpoint` describes a network endpoint that serves a set of APIs.\nA service may expose any number of endpoints, and all endpoints share the\nsame service configuration, such as quota configuration and monitoring\nconfiguration.\n\nExample service configuration:\n\n name: library-example.googleapis.com\n endpoints:\n # Below entry makes 'google.example.library.v1.Library'\n # API be served from endpoint address library-example.googleapis.com.\n # It also allows HTTP OPTIONS calls to be passed to the backend, for\n # it to decide whether the subsequent cross-origin request is\n # allowed to proceed.\n - name: library-example.googleapis.com\n allow_cors: true", + "type": "object", + "properties": { + "apis": { + "description": "The list of APIs served by this endpoint.", + "type": "array", + "items": { + "type": "string" + } + }, + "allowCors": { + "description": "Allowing\n[CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing), aka\ncross-domain traffic, would allow the backends served from this endpoint to\nreceive and respond to HTTP OPTIONS requests. The response will be used by\nthe browser to determine whether the subsequent cross-origin request is\nallowed to proceed.", + "type": "boolean" + }, + "name": { + "description": "The canonical name of this endpoint.", + "type": "string" + }, + "aliases": { + "description": "DEPRECATED: This field is no longer supported. Instead of using aliases,\nplease specify multiple google.api.Endpoint for each of the intented\nalias.\n\nAdditional names that this endpoint will be hosted on.", + "type": "array", + "items": { + "type": "string" + } + }, + "features": { + "description": "The list of features enabled on this endpoint.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "id": "Endpoint" + }, + "Page": { + "description": "Represents a documentation page. A page can contain subpages to represent\nnested documentation set structure.", + "type": "object", + "properties": { + "subpages": { + "description": "Subpages of this page. The order of subpages specified here will be\nhonored in the generated docset.", + "type": "array", + "items": { + "$ref": "Page" + } + }, + "content": { + "description": "The Markdown content of the page. You can use \u003ccode\u003e(== include {path} ==)\u003c/code\u003e\nto include content from a Markdown file.", + "type": "string" + }, + "name": { + "description": "The name of the page. It will be used as an identity of the page to\ngenerate URI of the page, text of the link to this page in navigation,\netc. The full page name (start from the root page name to this page\nconcatenated with `.`) can be used as reference to the page in your\ndocumentation. For example:\n\u003cpre\u003e\u003ccode\u003epages:\n- name: Tutorial\n content: (== include tutorial.md ==)\n subpages:\n - name: Java\n content: (== include tutorial_java.md ==)\n\u003c/code\u003e\u003c/pre\u003e\nYou can reference `Java` page using Markdown reference link syntax:\n`Java`.", + "type": "string" + } + }, + "id": "Page" + }, + "CustomErrorRule": { + "description": "A custom error rule.", + "type": "object", + "properties": { + "isErrorType": { + "description": "Mark this message as possible payload in error response. Otherwise,\nobjects of this type will be filtered when they appear in error payload.", + "type": "boolean" + }, + "selector": { + "description": "Selects messages to which this rule applies.\n\nRefer to selector for syntax details.", + "type": "string" + } + }, + "id": "CustomErrorRule" + }, + "Option": { + "description": "A protocol buffer option, which can be attached to a message, field,\nenumeration, etc.", + "type": "object", + "properties": { + "value": { + "description": "The option's value packed in an Any message. If the value is a primitive,\nthe corresponding wrapper type defined in google/protobuf/wrappers.proto\nshould be used. If the value is an enum, it should be stored as an int32\nvalue using the google.protobuf.Int32Value type.", + "additionalProperties": { + "description": "Properties of the object. Contains field @type with type URL.", + "type": "any" + }, + "type": "object" + }, + "name": { + "description": "The option's name. For protobuf built-in options (options defined in\ndescriptor.proto), this is the short name. For example, `\"map_entry\"`.\nFor custom options, it should be the fully-qualified name. For example,\n`\"google.api.http\"`.", + "type": "string" + } + }, + "id": "Option" + }, + "HttpRule": { + "description": "`HttpRule` defines the mapping of an RPC method to one or more HTTP\nREST APIs. The mapping determines what portions of the request\nmessage are populated from the path, query parameters, or body of\nthe HTTP request. The mapping is typically specified as an\n`google.api.http` annotation, see \"google/api/annotations.proto\"\nfor details.\n\nThe mapping consists of a field specifying the path template and\nmethod kind. The path template can refer to fields in the request\nmessage, as in the example below which describes a REST GET\noperation on a resource collection of messages:\n\n\n service Messaging {\n rpc GetMessage(GetMessageRequest) returns (Message) {\n option (google.api.http).get = \"/v1/messages/{message_id}/{sub.subfield}\";\n }\n }\n message GetMessageRequest {\n message SubMessage {\n string subfield = 1;\n }\n string message_id = 1; // mapped to the URL\n SubMessage sub = 2; // `sub.subfield` is url-mapped\n }\n message Message {\n string text = 1; // content of the resource\n }\n\nThe same http annotation can alternatively be expressed inside the\n`GRPC API Configuration` YAML file.\n\n http:\n rules:\n - selector: \u003cproto_package_name\u003e.Messaging.GetMessage\n get: /v1/messages/{message_id}/{sub.subfield}\n\nThis definition enables an automatic, bidrectional mapping of HTTP\nJSON to RPC. Example:\n\nHTTP | RPC\n-----|-----\n`GET /v1/messages/123456/foo` | `GetMessage(message_id: \"123456\" sub: SubMessage(subfield: \"foo\"))`\n\nIn general, not only fields but also field paths can be referenced\nfrom a path pattern. Fields mapped to the path pattern cannot be\nrepeated and must have a primitive (non-message) type.\n\nAny fields in the request message which are not bound by the path\npattern automatically become (optional) HTTP query\nparameters. Assume the following definition of the request message:\n\n\n message GetMessageRequest {\n message SubMessage {\n string subfield = 1;\n }\n string message_id = 1; // mapped to the URL\n int64 revision = 2; // becomes a parameter\n SubMessage sub = 3; // `sub.subfield` becomes a parameter\n }\n\n\nThis enables a HTTP JSON to RPC mapping as below:\n\nHTTP | RPC\n-----|-----\n`GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: \"123456\" revision: 2 sub: SubMessage(subfield: \"foo\"))`\n\nNote that fields which are mapped to HTTP parameters must have a\nprimitive type or a repeated primitive type. Message types are not\nallowed. In the case of a repeated type, the parameter can be\nrepeated in the URL, as in `...?param=A¶m=B`.\n\nFor HTTP method kinds which allow a request body, the `body` field\nspecifies the mapping. Consider a REST update method on the\nmessage resource collection:\n\n\n service Messaging {\n rpc UpdateMessage(UpdateMessageRequest) returns (Message) {\n option (google.api.http) = {\n put: \"/v1/messages/{message_id}\"\n body: \"message\"\n };\n }\n }\n message UpdateMessageRequest {\n string message_id = 1; // mapped to the URL\n Message message = 2; // mapped to the body\n }\n\n\nThe following HTTP JSON to RPC mapping is enabled, where the\nrepresentation of the JSON in the request body is determined by\nprotos JSON encoding:\n\nHTTP | RPC\n-----|-----\n`PUT /v1/messages/123456 { \"text\": \"Hi!\" }` | `UpdateMessage(message_id: \"123456\" message { text: \"Hi!\" })`\n\nThe special name `*` can be used in the body mapping to define that\nevery field not bound by the path template should be mapped to the\nrequest body. This enables the following alternative definition of\nthe update method:\n\n service Messaging {\n rpc UpdateMessage(Message) returns (Message) {\n option (google.api.http) = {\n put: \"/v1/messages/{message_id}\"\n body: \"*\"\n };\n }\n }\n message Message {\n string message_id = 1;\n string text = 2;\n }\n\n\nThe following HTTP JSON to RPC mapping is enabled:\n\nHTTP | RPC\n-----|-----\n`PUT /v1/messages/123456 { \"text\": \"Hi!\" }` | `UpdateMessage(message_id: \"123456\" text: \"Hi!\")`\n\nNote that when using `*` in the body mapping, it is not possible to\nhave HTTP parameters, as all fields not bound by the path end in\nthe body. This makes this option more rarely used in practice of\ndefining REST APIs. The common usage of `*` is in custom methods\nwhich don't use the URL at all for transferring data.\n\nIt is possible to define multiple HTTP methods for one RPC by using\nthe `additional_bindings` option. Example:\n\n service Messaging {\n rpc GetMessage(GetMessageRequest) returns (Message) {\n option (google.api.http) = {\n get: \"/v1/messages/{message_id}\"\n additional_bindings {\n get: \"/v1/users/{user_id}/messages/{message_id}\"\n }\n };\n }\n }\n message GetMessageRequest {\n string message_id = 1;\n string user_id = 2;\n }\n\n\nThis enables the following two alternative HTTP JSON to RPC\nmappings:\n\nHTTP | RPC\n-----|-----\n`GET /v1/messages/123456` | `GetMessage(message_id: \"123456\")`\n`GET /v1/users/me/messages/123456` | `GetMessage(user_id: \"me\" message_id: \"123456\")`\n\n# Rules for HTTP mapping\n\nThe rules for mapping HTTP path, query parameters, and body fields\nto the request message are as follows:\n\n1. The `body` field specifies either `*` or a field path, or is\n omitted. If omitted, it assumes there is no HTTP body.\n2. Leaf fields (recursive expansion of nested messages in the\n request) can be classified into three types:\n (a) Matched in the URL template.\n (b) Covered by body (if body is `*`, everything except (a) fields;\n else everything under the body field)\n (c) All other fields.\n3. URL query parameters found in the HTTP request are mapped to (c) fields.\n4. Any body sent with an HTTP request can contain only (b) fields.\n\nThe syntax of the path template is as follows:\n\n Template = \"/\" Segments [ Verb ] ;\n Segments = Segment { \"/\" Segment } ;\n Segment = \"*\" | \"**\" | LITERAL | Variable ;\n Variable = \"{\" FieldPath [ \"=\" Segments ] \"}\" ;\n FieldPath = IDENT { \".\" IDENT } ;\n Verb = \":\" LITERAL ;\n\nThe syntax `*` matches a single path segment. It follows the semantics of\n[RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String\nExpansion.\n\nThe syntax `**` matches zero or more path segments. It follows the semantics\nof [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.3 Reserved\nExpansion. NOTE: it must be the last segment in the path except the Verb.\n\nThe syntax `LITERAL` matches literal text in the URL path.\n\nThe syntax `Variable` matches the entire path as specified by its template;\nthis nested template must not contain further variables. If a variable\nmatches a single path segment, its template may be omitted, e.g. `{var}`\nis equivalent to `{var=*}`.\n\nNOTE: the field paths in variables and in the `body` must not refer to\nrepeated fields or map fields.\n\nUse CustomHttpPattern to specify any HTTP method that is not included in the\n`pattern` field, such as HEAD, or \"*\" to leave the HTTP method unspecified for\na given URL path rule. The wild-card rule is useful for services that provide\ncontent to Web (HTML) clients.", + "type": "object", + "properties": { + "custom": { + "description": "Custom pattern is used for defining custom verbs.", + "$ref": "CustomHttpPattern" + }, + "responseBody": { + "description": "The name of the response field whose value is mapped to the HTTP body of\nresponse. Other response fields are ignored. This field is optional. When\nnot set, the response message will be used as HTTP body of response.\nNOTE: the referred field must be not a repeated field and must be present\nat the top-level of response message type.", + "type": "string" + }, + "additionalBindings": { + "description": "Additional HTTP bindings for the selector. Nested bindings must\nnot contain an `additional_bindings` field themselves (that is,\nthe nesting may only be one level deep).", + "type": "array", + "items": { + "$ref": "HttpRule" + } + }, + "mediaDownload": { + "description": "Do not use this. For media support, add instead\n[][google.bytestream.RestByteStream] as an API to your\nconfiguration.", + "$ref": "MediaDownload" + }, + "body": { + "description": "The name of the request field whose value is mapped to the HTTP body, or\n`*` for mapping all fields not captured by the path pattern to the HTTP\nbody. NOTE: the referred field must not be a repeated field and must be\npresent at the top-level of request message type.", + "type": "string" + }, + "put": { + "description": "Used for updating a resource.", + "type": "string" + }, + "get": { + "description": "Used for listing and getting information about resources.", + "type": "string" + }, + "selector": { + "description": "Selects methods to which this rule applies.\n\nRefer to selector for syntax details.", + "type": "string" + }, + "post": { + "description": "Used for creating a resource.", + "type": "string" + }, + "patch": { + "description": "Used for updating a resource.", + "type": "string" + }, + "delete": { + "description": "Used for deleting a resource.", + "type": "string" + }, + "mediaUpload": { + "description": "Do not use this. For media support, add instead\n[][google.bytestream.RestByteStream] as an API to your\nconfiguration.", + "$ref": "MediaUpload" + } + }, + "id": "HttpRule" + }, + "TestIamPermissionsRequest": { + "description": "Request message for `TestIamPermissions` method.", + "type": "object", + "properties": { + "permissions": { + "description": "The set of permissions to check for the `resource`. Permissions with\nwildcards (such as '*' or 'storage.*') are not allowed. For more\ninformation see\n[IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).", + "type": "array", + "items": { + "type": "string" + } + } + }, + "id": "TestIamPermissionsRequest" + }, + "TestIamPermissionsResponse": { + "description": "Response message for `TestIamPermissions` method.", + "type": "object", + "properties": { + "permissions": { + "description": "A subset of `TestPermissionsRequest.permissions` that the caller is\nallowed.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "id": "TestIamPermissionsResponse" + }, + "CustomError": { + "description": "Customize service error responses. For example, list any service\nspecific protobuf types that can appear in error detail lists of\nerror responses.\n\nExample:\n\n custom_error:\n types:\n - google.foo.v1.CustomError\n - google.foo.v1.AnotherError", + "type": "object", + "properties": { + "types": { + "description": "The list of custom error detail types, e.g. 'google.foo.v1.CustomError'.", + "type": "array", + "items": { + "type": "string" + } + }, + "rules": { + "description": "The list of custom error rules that apply to individual API messages.\n\n**NOTE:** All service configuration rules follow \"last one wins\" order.", + "type": "array", + "items": { + "$ref": "CustomErrorRule" + } + } + }, + "id": "CustomError" + }, + "MediaDownload": { + "description": "Do not use this. For media support, add instead\n[][google.bytestream.RestByteStream] as an API to your\nconfiguration.", + "type": "object", + "properties": { + "enabled": { + "description": "Whether download is enabled.", + "type": "boolean" + } + }, + "id": "MediaDownload" + }, + "SubmitConfigSourceRequest": { + "description": "Request message for SubmitConfigSource method.", + "type": "object", + "properties": { + "configSource": { + "description": "The source configuration for the service.", + "$ref": "ConfigSource" + }, + "validateOnly": { + "description": "Optional. If set, this will result in the generation of a\n`google.api.Service` configuration based on the `ConfigSource` provided,\nbut the generated config and the sources will NOT be persisted.", + "type": "boolean" + } + }, + "id": "SubmitConfigSourceRequest" + }, + "AuthenticationRule": { + "description": "Authentication rules for the service.\n\nBy default, if a method has any authentication requirements, every request\nmust include a valid credential matching one of the requirements.\nIt's an error to include more than one kind of credential in a single\nrequest.\n\nIf a method doesn't have any auth requirements, request credentials will be\nignored.", + "type": "object", + "properties": { + "oauth": { + "description": "The requirements for OAuth credentials.", + "$ref": "OAuthRequirements" + }, + "allowWithoutCredential": { + "description": "Whether to allow requests without a credential. The credential can be\nan OAuth token, Google cookies (first-party auth) or EndUserCreds.\n\nFor requests without credentials, if the service control environment is\nspecified, each incoming request **must** be associated with a service\nconsumer. This can be done by passing an API key that belongs to a consumer\nproject.", + "type": "boolean" + }, + "requirements": { + "description": "Requirements for additional authentication providers.", + "type": "array", + "items": { + "$ref": "AuthRequirement" + } + }, + "selector": { + "description": "Selects the methods to which this rule applies.\n\nRefer to selector for syntax details.", + "type": "string" + } + }, + "id": "AuthenticationRule" + }, + "Logging": { + "description": "Logging configuration of the service.\n\nThe following example shows how to configure logs to be sent to the\nproducer and consumer projects. In the example, the `activity_history`\nlog is sent to both the producer and consumer projects, whereas the\n`purchase_history` log is only sent to the producer project.\n\n monitored_resources:\n - type: library.googleapis.com/branch\n labels:\n - key: /city\n description: The city where the library branch is located in.\n - key: /name\n description: The name of the branch.\n logs:\n - name: activity_history\n labels:\n - key: /customer_id\n - name: purchase_history\n logging:\n producer_destinations:\n - monitored_resource: library.googleapis.com/branch\n logs:\n - activity_history\n - purchase_history\n consumer_destinations:\n - monitored_resource: library.googleapis.com/branch\n logs:\n - activity_history", + "type": "object", + "properties": { + "producerDestinations": { + "description": "Logging configurations for sending logs to the producer project.\nThere can be multiple producer destinations, each one must have a\ndifferent monitored resource type. A log can be used in at most\none producer destination.", + "type": "array", + "items": { + "$ref": "LoggingDestination" + } + }, + "consumerDestinations": { + "description": "Logging configurations for sending logs to the consumer project.\nThere can be multiple consumer destinations, each one must have a\ndifferent monitored resource type. A log can be used in at most\none consumer destination.", + "type": "array", + "items": { + "$ref": "LoggingDestination" + } + } + }, + "id": "Logging" + }, + "SystemParameter": { + "description": "Define a parameter's name and location. The parameter may be passed as either\nan HTTP header or a URL query parameter, and if both are passed the behavior\nis implementation-dependent.", + "type": "object", + "properties": { + "urlQueryParameter": { + "description": "Define the URL query parameter name to use for the parameter. It is case\nsensitive.", + "type": "string" + }, + "name": { + "description": "Define the name of the parameter, such as \"api_key\" . It is case sensitive.", + "type": "string" + }, + "httpHeader": { + "description": "Define the HTTP header name to use for the parameter. It is case\ninsensitive.", + "type": "string" + } + }, + "id": "SystemParameter" + }, + "Enum": { + "description": "Enum type definition.", + "type": "object", + "properties": { + "syntax": { + "description": "The source syntax.", + "enum": [ + "SYNTAX_PROTO2", + "SYNTAX_PROTO3" + ], + "enumDescriptions": [ + "Syntax `proto2`.", + "Syntax `proto3`." + ], + "type": "string" + }, + "enumvalue": { + "description": "Enum value definitions.", + "type": "array", + "items": { + "$ref": "EnumValue" + } + }, + "options": { + "description": "Protocol buffer options.", + "type": "array", + "items": { + "$ref": "Option" + } + }, + "sourceContext": { + "description": "The source context.", + "$ref": "SourceContext" + }, + "name": { + "description": "Enum type name.", + "type": "string" + } + }, + "id": "Enum" + }, + "GenerateConfigReportResponse": { + "description": "Response message for GenerateConfigReport method.", + "type": "object", + "properties": { + "serviceName": { + "description": "Name of the service this report belongs to.", + "type": "string" + }, + "id": { + "description": "ID of the service configuration this report belongs to.", + "type": "string" + }, + "changeReports": { + "description": "list of ChangeReport, each corresponding to comparison between two\nservice configurations.", + "type": "array", + "items": { + "$ref": "ChangeReport" + } + }, + "diagnostics": { + "description": "Errors / Linter warnings associated with the service definition this\nreport\nbelongs to.", + "type": "array", + "items": { + "$ref": "Diagnostic" + } + } + }, + "id": "GenerateConfigReportResponse" + }, + "DeleteServiceStrategy": { + "description": "Strategy used to delete a service. This strategy is a placeholder only\nused by the system generated rollout to delete a service.", + "type": "object", + "properties": {}, + "id": "DeleteServiceStrategy" + }, + "OperationMetadata": { + "description": "The metadata associated with a long running operation resource.", + "type": "object", + "properties": { + "steps": { + "description": "Detailed status information for each step. The order is undetermined.", + "type": "array", + "items": { + "$ref": "Step" + } + }, + "startTime": { + "description": "The start time of the operation.", + "type": "string", + "format": "google-datetime" + }, + "resourceNames": { + "description": "The full name of the resources that this operation is directly\nassociated with.", + "type": "array", + "items": { + "type": "string" + } + }, + "progressPercentage": { + "description": "Percentage of completion of this operation, ranging from 0 to 100.", + "type": "integer", + "format": "int32" + } + }, + "id": "OperationMetadata" + }, + "DisableServiceRequest": { + "description": "Request message for DisableService method.", + "type": "object", + "properties": { + "consumerId": { + "description": "The identity of consumer resource which service disablement will be\napplied to.\n\nThe Google Service Management implementation accepts the following\nforms:\n- \"project:\u003cproject_id\u003e\"\n\nNote: this is made compatible with\ngoogle.api.servicecontrol.v1.Operation.consumer_id.", + "type": "string" + } + }, + "id": "DisableServiceRequest" + }, + "CustomHttpPattern": { + "description": "A custom pattern is used for defining custom HTTP verb.", + "type": "object", + "properties": { + "path": { + "description": "The path matched by this custom verb.", + "type": "string" + }, + "kind": { + "description": "The name of this custom HTTP verb.", + "type": "string" + } + }, + "id": "CustomHttpPattern" + }, + "LogDescriptor": { + "description": "A description of a log type. Example in YAML format:\n\n - name: library.googleapis.com/activity_history\n description: The history of borrowing and returning library items.\n display_name: Activity\n labels:\n - key: /customer_id\n description: Identifier of a library customer", + "type": "object", + "properties": { + "labels": { + "description": "The set of labels that are available to describe a specific log entry.\nRuntime requests that contain labels not specified here are\nconsidered invalid.", + "type": "array", + "items": { + "$ref": "LabelDescriptor" + } + }, + "description": { + "description": "A human-readable description of this log. This information appears in\nthe documentation and can contain details.", + "type": "string" + }, + "displayName": { + "description": "The human-readable name for this log. This information appears on\nthe user interface and should be concise.", + "type": "string" + }, + "name": { + "description": "The name of the log. It must be less than 512 characters long and can\ninclude the following characters: upper- and lower-case alphanumeric\ncharacters [A-Za-z0-9], and punctuation characters including\nslash, underscore, hyphen, period [/_-.].", + "type": "string" + } + }, + "id": "LogDescriptor" + }, + "MonitoringDestination": { + "description": "Configuration of a specific monitoring destination (the producer project\nor the consumer project).", + "type": "object", + "properties": { + "monitoredResource": { + "description": "The monitored resource type. The type must be defined in\nService.monitored_resources section.", + "type": "string" + }, + "metrics": { + "description": "Names of the metrics to report to this monitoring destination.\nEach name must be defined in Service.metrics section.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "id": "MonitoringDestination" + }, + "Field": { + "description": "A single field of a message type.", + "type": "object", + "properties": { + "defaultValue": { + "description": "The string value of the default value of this field. Proto2 syntax only.", + "type": "string" + }, + "jsonName": { + "description": "The field JSON name.", + "type": "string" + }, + "options": { + "description": "The protocol buffer options.", + "type": "array", + "items": { + "$ref": "Option" + } + }, + "oneofIndex": { + "description": "The index of the field type in `Type.oneofs`, for message or enumeration\ntypes. The first type has index 1; zero means the type is not in the list.", + "type": "integer", + "format": "int32" + }, + "cardinality": { + "description": "The field cardinality.", + "enum": [ + "CARDINALITY_UNKNOWN", + "CARDINALITY_OPTIONAL", + "CARDINALITY_REQUIRED", + "CARDINALITY_REPEATED" + ], + "enumDescriptions": [ + "For fields with unknown cardinality.", + "For optional fields.", + "For required fields. Proto2 syntax only.", + "For repeated fields." + ], + "type": "string" + }, + "typeUrl": { + "description": "The field type URL, without the scheme, for message or enumeration\ntypes. Example: `\"type.googleapis.com/google.protobuf.Timestamp\"`.", + "type": "string" + }, + "name": { + "description": "The field name.", + "type": "string" + }, + "packed": { + "description": "Whether to use alternative packed wire representation.", + "type": "boolean" + }, + "number": { + "description": "The field number.", + "type": "integer", + "format": "int32" + }, + "kind": { + "description": "The field type.", + "enum": [ + "TYPE_UNKNOWN", + "TYPE_DOUBLE", + "TYPE_FLOAT", + "TYPE_INT64", + "TYPE_UINT64", + "TYPE_INT32", + "TYPE_FIXED64", + "TYPE_FIXED32", + "TYPE_BOOL", + "TYPE_STRING", + "TYPE_GROUP", + "TYPE_MESSAGE", + "TYPE_BYTES", + "TYPE_UINT32", + "TYPE_ENUM", + "TYPE_SFIXED32", + "TYPE_SFIXED64", + "TYPE_SINT32", + "TYPE_SINT64" + ], + "enumDescriptions": [ + "Field type unknown.", + "Field type double.", + "Field type float.", + "Field type int64.", + "Field type uint64.", + "Field type int32.", + "Field type fixed64.", + "Field type fixed32.", + "Field type bool.", + "Field type string.", + "Field type group. Proto2 syntax only, and deprecated.", + "Field type message.", + "Field type bytes.", + "Field type uint32.", + "Field type enum.", + "Field type sfixed32.", + "Field type sfixed64.", + "Field type sint32.", + "Field type sint64." + ], + "type": "string" + } + }, + "id": "Field" + }, + "Binding": { + "description": "Associates `members` with a `role`.", + "type": "object", + "properties": { + "members": { + "description": "Specifies the identities requesting access for a Cloud Platform resource.\n`members` can have the following values:\n\n* `allUsers`: A special identifier that represents anyone who is\n on the internet; with or without a Google account.\n\n* `allAuthenticatedUsers`: A special identifier that represents anyone\n who is authenticated with a Google account or a service account.\n\n* `user:{emailid}`: An email address that represents a specific Google\n account. For example, `alice@gmail.com` or `joe@example.com`.\n\n\n* `serviceAccount:{emailid}`: An email address that represents a service\n account. For example, `my-other-app@appspot.gserviceaccount.com`.\n\n* `group:{emailid}`: An email address that represents a Google group.\n For example, `admins@example.com`.\n\n* `domain:{domain}`: A Google Apps domain name that represents all the\n users of that domain. For example, `google.com` or `example.com`.\n\n", + "type": "array", + "items": { + "type": "string" + } + }, + "role": { + "description": "Role that is assigned to `members`.\nFor example, `roles/viewer`, `roles/editor`, or `roles/owner`.\nRequired", + "type": "string" + } + }, + "id": "Binding" + }, + "ConfigRef": { + "description": "Represents a service configuration with its name and id.", + "type": "object", + "properties": { + "name": { + "description": "Resource name of a service config. It must have the following\nformat: \"services/{service name}/configs/{config id}\".", + "type": "string" + } + }, + "id": "ConfigRef" + }, + "DataAccessOptions": { + "description": "Write a Data Access (Gin) log", + "type": "object", + "properties": {}, + "id": "DataAccessOptions" + }, + "AuthProvider": { + "description": "Configuration for an anthentication provider, including support for\n[JSON Web Token (JWT)](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32).", + "type": "object", + "properties": { + "audiences": { + "description": "The list of JWT\n[audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3).\nthat are allowed to access. A JWT containing any of these audiences will\nbe accepted. When this setting is absent, only JWTs with audience\n\"https://Service_name/API_name\"\nwill be accepted. For example, if no audiences are in the setting,\nLibraryService API will only accept JWTs with the following audience\n\"https://library-example.googleapis.com/google.example.library.v1.LibraryService\".\n\nExample:\n\n audiences: bookstore_android.apps.googleusercontent.com,\n bookstore_web.apps.googleusercontent.com", + "type": "string" + }, + "jwksUri": { + "description": "URL of the provider's public key set to validate signature of the JWT. See\n[OpenID Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata).\nOptional if the key set document:\n - can be retrieved from\n [OpenID Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html\n of the issuer.\n - can be inferred from the email domain of the issuer (e.g. a Google service account).\n\nExample: https://www.googleapis.com/oauth2/v1/certs", + "type": "string" + }, + "id": { + "description": "The unique identifier of the auth provider. It will be referred to by\n`AuthRequirement.provider_id`.\n\nExample: \"bookstore_auth\".", + "type": "string" + }, + "issuer": { + "description": "Identifies the principal that issued the JWT. See\nhttps://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.1\nUsually a URL or an email address.\n\nExample: https://securetoken.google.com\nExample: 1234567-compute@developer.gserviceaccount.com", + "type": "string" + } + }, + "id": "AuthProvider" + }, + "VisibilityRule": { + "description": "A visibility rule provides visibility configuration for an individual API\nelement.", + "type": "object", + "properties": { + "restriction": { + "description": "A comma-separated list of visibility labels that apply to the `selector`.\nAny of the listed labels can be used to grant the visibility.\n\nIf a rule has multiple labels, removing one of the labels but not all of\nthem can break clients.\n\nExample:\n\n visibility:\n rules:\n - selector: google.calendar.Calendar.EnhancedSearch\n restriction: GOOGLE_INTERNAL, TRUSTED_TESTER\n\nRemoving GOOGLE_INTERNAL from this restriction will break clients that\nrely on this method and only had access to it through GOOGLE_INTERNAL.", + "type": "string" + }, + "selector": { + "description": "Selects methods, messages, fields, enums, etc. to which this rule applies.\n\nRefer to selector for syntax details.", + "type": "string" + } + }, + "id": "VisibilityRule" + }, + "AuditLogConfig": { + "description": "Provides the configuration for a sub-type of logging.", + "type": "object", + "properties": { + "logType": { + "description": "The log type that this config enables.", + "enum": [ + "LOG_TYPE_UNSPECIFIED", + "ADMIN_READ", + "DATA_WRITE", + "DATA_READ" + ], + "enumDescriptions": [ + "Default case. Should never be this.", + "Log admin reads", + "Log data writes", + "Log data reads" + ], + "type": "string" + }, + "exemptedMembers": { + "description": "Specifies the identities that are exempted from this type of logging\nFollows the same format of Binding.members.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "id": "AuditLogConfig" + }, + "UndeleteServiceResponse": { + "description": "Response message for UndeleteService method.", + "type": "object", + "properties": { + "service": { + "description": "Revived service resource.", + "$ref": "ManagedService" + } + }, + "id": "UndeleteServiceResponse" + }, + "UsageRule": { + "description": "Usage configuration rules for the service.\n\nNOTE: Under development.\n\n\nUse this rule to configure unregistered calls for the service. Unregistered\ncalls are calls that do not contain consumer project identity.\n(Example: calls that do not contain an API key).\nBy default, API methods do not allow unregistered calls, and each method call\nmust be identified by a consumer project identity. Use this rule to\nallow/disallow unregistered calls.\n\nExample of an API that wants to allow unregistered calls for entire service.\n\n usage:\n rules:\n - selector: \"*\"\n allow_unregistered_calls: true\n\nExample of a method that wants to allow unregistered calls.\n\n usage:\n rules:\n - selector: \"google.example.library.v1.LibraryService.CreateBook\"\n allow_unregistered_calls: true", + "type": "object", + "properties": { + "allowUnregisteredCalls": { + "description": "True, if the method allows unregistered calls; false otherwise.", + "type": "boolean" + }, + "selector": { + "description": "Selects the methods to which this rule applies. Use '*' to indicate all\nmethods in all APIs.\n\nRefer to selector for syntax details.", + "type": "string" + } + }, + "id": "UsageRule" + }, + "EnumValue": { + "description": "Enum value definition.", + "type": "object", + "properties": { + "options": { + "description": "Protocol buffer options.", + "type": "array", + "items": { + "$ref": "Option" + } + }, + "name": { + "description": "Enum value name.", + "type": "string" + }, + "number": { + "description": "Enum value number.", + "type": "integer", + "format": "int32" + } + }, + "id": "EnumValue" + }, + "MediaUpload": { + "description": "Do not use this. For media support, add instead\n[][google.bytestream.RestByteStream] as an API to your\nconfiguration.", + "type": "object", + "properties": { + "enabled": { + "description": "Whether upload is enabled.", + "type": "boolean" + } + }, + "id": "MediaUpload" + }, + "BackendRule": { + "description": "A backend rule provides configuration for an individual API element.", + "type": "object", + "properties": { + "address": { + "description": "The address of the API backend.", + "type": "string" + }, + "deadline": { + "description": "The number of seconds to wait for a response from a request. The\ndefault depends on the deployment context.", + "type": "number", + "format": "double" + }, + "selector": { + "description": "Selects the methods to which this rule applies.\n\nRefer to selector for syntax details.", + "type": "string" + } + }, + "id": "BackendRule" + }, + "ContextRule": { + "description": "A context rule provides information about the context for an individual API\nelement.", + "type": "object", + "properties": { + "provided": { + "description": "A list of full type names of provided contexts.", + "type": "array", + "items": { + "type": "string" + } + }, + "selector": { + "description": "Selects the methods to which this rule applies.\n\nRefer to selector for syntax details.", + "type": "string" + }, + "requested": { + "description": "A list of full type names of requested contexts.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "id": "ContextRule" + }, + "Http": { + "description": "Defines the HTTP configuration for a service. It contains a list of\nHttpRule, each specifying the mapping of an RPC method\nto one or more HTTP REST API methods.", + "type": "object", + "properties": { + "rules": { + "description": "A list of HTTP configuration rules that apply to individual API methods.\n\n**NOTE:** All service configuration rules follow \"last one wins\" order.", + "type": "array", + "items": { + "$ref": "HttpRule" + } + } + }, + "id": "Http" + }, + "Visibility": { + "description": "`Visibility` defines restrictions for the visibility of service\nelements. Restrictions are specified using visibility labels\n(e.g., TRUSTED_TESTER) that are elsewhere linked to users and projects.\n\nUsers and projects can have access to more than one visibility label. The\neffective visibility for multiple labels is the union of each label's\nelements, plus any unrestricted elements.\n\nIf an element and its parents have no restrictions, visibility is\nunconditionally granted.\n\nExample:\n\n visibility:\n rules:\n - selector: google.calendar.Calendar.EnhancedSearch\n restriction: TRUSTED_TESTER\n - selector: google.calendar.Calendar.Delegate\n restriction: GOOGLE_INTERNAL\n\nHere, all methods are publicly visible except for the restricted methods\nEnhancedSearch and Delegate.", + "type": "object", + "properties": { + "rules": { + "description": "A list of visibility rules that apply to individual API elements.\n\n**NOTE:** All service configuration rules follow \"last one wins\" order.", + "type": "array", + "items": { + "$ref": "VisibilityRule" + } + } + }, + "id": "Visibility" + }, + "ConfigChange": { + "description": "Output generated from semantically comparing two versions of a service\nconfiguration.\n\nIncludes detailed information about a field that have changed with\napplicable advice about potential consequences for the change, such as\nbackwards-incompatibility.", + "type": "object", + "properties": { + "newValue": { + "description": "Value of the changed object in the new Service configuration,\nin JSON format. This field will not be populated if ChangeType == REMOVED.", + "type": "string" + }, + "oldValue": { + "description": "Value of the changed object in the old Service configuration,\nin JSON format. This field will not be populated if ChangeType == ADDED.", + "type": "string" + }, + "element": { + "description": "Object hierarchy path to the change, with levels separated by a '.'\ncharacter. For repeated fields, an applicable unique identifier field is\nused for the index (usually selector, name, or id). For maps, the term\n'key' is used. If the field has no unique identifier, the numeric index\nis used.\nExamples:\n- visibility.rules[selector==\"google.LibraryService.CreateBook\"].restriction\n- quota.metric_rules[selector==\"google\"].metric_costs[key==\"reads\"].value\n- logging.producer_destinations[0]", + "type": "string" + }, + "changeType": { + "description": "The type for this change, either ADDED, REMOVED, or MODIFIED.", + "enum": [ + "CHANGE_TYPE_UNSPECIFIED", + "ADDED", + "REMOVED", + "MODIFIED" + ], + "enumDescriptions": [ + "No value was provided.", + "The changed object exists in the 'new' service configuration, but not\nin the 'old' service configuration.", + "The changed object exists in the 'old' service configuration, but not\nin the 'new' service configuration.", + "The changed object exists in both service configurations, but its value\nis different." + ], + "type": "string" + }, + "advices": { + "description": "Collection of advice provided for this change, useful for determining the\npossible impact of this change.", + "type": "array", + "items": { + "$ref": "Advice" + } + } + }, + "id": "ConfigChange" + }, + "SystemParameters": { + "description": "### System parameter configuration\n\nA system parameter is a special kind of parameter defined by the API\nsystem, not by an individual API. It is typically mapped to an HTTP header\nand/or a URL query parameter. This configuration specifies which methods\nchange the names of the system parameters.", + "type": "object", + "properties": { + "rules": { + "description": "Define system parameters.\n\nThe parameters defined here will override the default parameters\nimplemented by the system. If this field is missing from the service\nconfig, default system parameters will be used. Default system parameters\nand names is implementation-dependent.\n\nExample: define api key for all methods\n\n system_parameters\n rules:\n - selector: \"*\"\n parameters:\n - name: api_key\n url_query_parameter: api_key\n\n\nExample: define 2 api key names for a specific method.\n\n system_parameters\n rules:\n - selector: \"/ListShelves\"\n parameters:\n - name: api_key\n http_header: Api-Key1\n - name: api_key\n http_header: Api-Key2\n\n**NOTE:** All service configuration rules follow \"last one wins\" order.", + "type": "array", + "items": { + "$ref": "SystemParameterRule" + } + } + }, + "id": "SystemParameters" + }, + "LabelDescriptor": { + "description": "A description of a label.", + "type": "object", + "properties": { + "description": { + "description": "A human-readable description for the label.", + "type": "string" + }, + "valueType": { + "description": "The type of data that can be assigned to the label.", + "enum": [ + "STRING", + "BOOL", + "INT64" + ], + "enumDescriptions": [ + "A variable-length string. This is the default.", + "Boolean; true or false.", + "A 64-bit signed integer." + ], + "type": "string" + }, + "key": { + "description": "The label key.", + "type": "string" + } + }, + "id": "LabelDescriptor" + }, + "Usage": { + "description": "Configuration controlling usage of a service.", + "type": "object", + "properties": { + "producerNotificationChannel": { + "description": "The full resource name of a channel used for sending notifications to the\nservice producer.\n\nGoogle Service Management currently only supports\n[Google Cloud Pub/Sub](https://cloud.google.com/pubsub) as a notification\nchannel. To use Google Cloud Pub/Sub as the channel, this must be the name\nof a Cloud Pub/Sub topic that uses the Cloud Pub/Sub topic name format\ndocumented in https://cloud.google.com/pubsub/docs/overview.", + "type": "string" + }, + "requirements": { + "description": "Requirements that must be satisfied before a consumer project can use the\nservice. Each requirement is of the form \u003cservice.name\u003e/\u003crequirement-id\u003e;\nfor example 'serviceusage.googleapis.com/billing-enabled'.", + "type": "array", + "items": { + "type": "string" + } + }, + "rules": { + "description": "A list of usage rules that apply to individual API methods.\n\n**NOTE:** All service configuration rules follow \"last one wins\" order.", + "type": "array", + "items": { + "$ref": "UsageRule" + } + } + }, + "id": "Usage" + }, + "Advice": { + "description": "Generated advice about this change, used for providing more\ninformation about how a change will affect the existing service.", + "type": "object", + "properties": { + "description": { + "description": "Useful description for why this advice was applied and what actions should\nbe taken to mitigate any implied risks.", + "type": "string" + } + }, + "id": "Advice" + }, + "CloudAuditOptions": { + "description": "Write a Cloud Audit log", + "type": "object", + "properties": {}, + "id": "CloudAuditOptions" + }, + "AuthRequirement": { + "description": "User-defined authentication requirements, including support for\n[JSON Web Token (JWT)](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32).", + "type": "object", + "properties": { + "audiences": { + "description": "NOTE: This will be deprecated soon, once AuthProvider.audiences is\nimplemented and accepted in all the runtime components.\n\nThe list of JWT\n[audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3).\nthat are allowed to access. A JWT containing any of these audiences will\nbe accepted. When this setting is absent, only JWTs with audience\n\"https://Service_name/API_name\"\nwill be accepted. For example, if no audiences are in the setting,\nLibraryService API will only accept JWTs with the following audience\n\"https://library-example.googleapis.com/google.example.library.v1.LibraryService\".\n\nExample:\n\n audiences: bookstore_android.apps.googleusercontent.com,\n bookstore_web.apps.googleusercontent.com", + "type": "string" + }, + "providerId": { + "description": "id from authentication provider.\n\nExample:\n\n provider_id: bookstore_auth", + "type": "string" + } + }, + "id": "AuthRequirement" + }, + "Control": { + "description": "Selects and configures the service controller used by the service. The\nservice controller handles features like abuse, quota, billing, logging,\nmonitoring, etc.", + "type": "object", + "properties": { + "environment": { + "description": "The service control environment to use. If empty, no control plane\nfeature (like quota and billing) will be enabled.", + "type": "string" + } + }, + "id": "Control" + }, + "SourceContext": { + "description": "`SourceContext` represents information about the source of a\nprotobuf element, like the file in which it is defined.", + "type": "object", + "properties": { + "fileName": { + "description": "The path-qualified name of the .proto file that contained the associated\nprotobuf element. For example: `\"google/protobuf/source_context.proto\"`.", + "type": "string" + } + }, + "id": "SourceContext" + } + }, + "revision": "20161205", + "basePath": "", + "icons": { + "x32": "http://www.google.com/images/icons/product/search-32.gif", + "x16": "http://www.google.com/images/icons/product/search-16.gif" + }, + "canonicalName": "Service Management", + "discoveryVersion": "v1", + "baseUrl": "https://servicemanagement.googleapis.com/", + "name": "servicemanagement", + "parameters": { + "access_token": { + "description": "OAuth access token.", + "type": "string", + "location": "query" + }, + "prettyPrint": { + "description": "Returns response with indentations and line breaks.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "key": { + "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", + "type": "string", + "location": "query" + }, + "quotaUser": { + "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.", + "type": "string", + "location": "query" + }, + "pp": { + "description": "Pretty-print response.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "fields": { + "description": "Selector specifying which fields to include in a partial response.", + "type": "string", + "location": "query" + }, + "alt": { + "description": "Data format for response.", + "location": "query", + "enum": [ + "json", + "media", + "proto" + ], + "default": "json", + "enumDescriptions": [ + "Responses with Content-Type of application/json", + "Media download with context-dependent Content-Type", + "Responses with Content-Type of application/x-protobuf" + ], + "type": "string" + }, + "$.xgafv": { + "description": "V1 error format.", + "enum": [ + "1", + "2" + ], + "enumDescriptions": [ + "v1 error format", + "v2 error format" + ], + "type": "string", + "location": "query" + }, + "callback": { + "description": "JSONP", + "type": "string", + "location": "query" + }, + "oauth_token": { + "description": "OAuth 2.0 token for the current user.", + "type": "string", + "location": "query" + }, + "uploadType": { + "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").", + "type": "string", + "location": "query" + }, + "bearer_token": { + "description": "OAuth bearer token.", + "type": "string", + "location": "query" + }, + "upload_protocol": { + "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").", + "type": "string", + "location": "query" + } + }, + "documentationLink": "https://cloud.google.com/service-management/", + "ownerDomain": "google.com", + "batchPath": "batch", + "servicePath": "", + "ownerName": "Google", + "version": "v1", + "rootUrl": "https://servicemanagement.googleapis.com/", + "kind": "discovery#restDescription" +} diff --git a/etc/api/shared.yaml b/etc/api/shared.yaml index 21a66cc678..f8840ab0b4 100644 --- a/etc/api/shared.yaml +++ b/etc/api/shared.yaml @@ -5,6 +5,9 @@ api: # to allow looking at it at a later point. # in beta, there is not a single method ! - dataflow + # It doesn't generate due to a recursive data structure, that we currently don't handle it seems + # Alternatively, it's too deep for our stack ;). + - civicinfo - mapsengine - firebaserules - runtimeconfig diff --git a/etc/api/sheets/v4/sheets-api.json b/etc/api/sheets/v4/sheets-api.json index e69de29bb2..cb6acb68c8 100644 --- a/etc/api/sheets/v4/sheets-api.json +++ b/etc/api/sheets/v4/sheets-api.json @@ -0,0 +1,4114 @@ +{ + "id": "sheets:v4", + "auth": { + "oauth2": { + "scopes": { + "https://www.googleapis.com/auth/drive.readonly": { + "description": "View the files in your Google Drive" + }, + "https://www.googleapis.com/auth/spreadsheets.readonly": { + "description": "View your Google Spreadsheets" + }, + "https://www.googleapis.com/auth/drive": { + "description": "View and manage the files in your Google Drive" + }, + "https://www.googleapis.com/auth/spreadsheets": { + "description": "View and manage your spreadsheets in Google Drive" + } + } + } + }, + "description": "Reads and writes Google Sheets.", + "protocol": "rest", + "title": "Google Sheets API", + "resources": { + "spreadsheets": { + "resources": { + "values": { + "methods": { + "clear": { + "id": "sheets.spreadsheets.values.clear", + "response": { + "$ref": "ClearValuesResponse" + }, + "parameterOrder": [ + "spreadsheetId", + "range" + ], + "description": "Clears values from a spreadsheet.\nThe caller must specify the spreadsheet ID and range.\nOnly values are cleared -- all other properties of the cell (such as\nformatting, data validation, etc..) are kept.", + "request": { + "$ref": "ClearValuesRequest" + }, + "flatPath": "v4/spreadsheets/{spreadsheetId}/values/{range}:clear", + "httpMethod": "POST", + "parameters": { + "spreadsheetId": { + "description": "The ID of the spreadsheet to update.", + "required": true, + "location": "path", + "type": "string" + }, + "range": { + "description": "The A1 notation of the values to clear.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v4/spreadsheets/{spreadsheetId}/values/{range}:clear", + "scopes": [ + "https://www.googleapis.com/auth/drive", + "https://www.googleapis.com/auth/spreadsheets" + ] + }, + "batchGet": { + "id": "sheets.spreadsheets.values.batchGet", + "response": { + "$ref": "BatchGetValuesResponse" + }, + "parameterOrder": [ + "spreadsheetId" + ], + "description": "Returns one or more ranges of values from a spreadsheet.\nThe caller must specify the spreadsheet ID and one or more ranges.", + "flatPath": "v4/spreadsheets/{spreadsheetId}/values:batchGet", + "httpMethod": "GET", + "parameters": { + "spreadsheetId": { + "description": "The ID of the spreadsheet to retrieve data from.", + "required": true, + "location": "path", + "type": "string" + }, + "ranges": { + "description": "The A1 notation of the values to retrieve.", + "repeated": true, + "location": "query", + "type": "string" + }, + "valueRenderOption": { + "description": "How values should be represented in the output.\nThe default render option is ValueRenderOption.FORMATTED_VALUE.", + "enum": [ + "FORMATTED_VALUE", + "UNFORMATTED_VALUE", + "FORMULA" + ], + "location": "query", + "type": "string" + }, + "dateTimeRenderOption": { + "description": "How dates, times, and durations should be represented in the output.\nThis is ignored if value_render_option is\nFORMATTED_VALUE.\nThe default dateTime render option is [DateTimeRenderOption.SERIAL_NUMBER].", + "enum": [ + "SERIAL_NUMBER", + "FORMATTED_STRING" + ], + "location": "query", + "type": "string" + }, + "majorDimension": { + "description": "The major dimension that results should use.\n\nFor example, if the spreadsheet data is: `A1=1,B1=2,A2=3,B2=4`,\nthen requesting `range=A1:B2,majorDimension=ROWS` will return\n`[[1,2],[3,4]]`,\nwhereas requesting `range=A1:B2,majorDimension=COLUMNS` will return\n`[[1,3],[2,4]]`.", + "enum": [ + "DIMENSION_UNSPECIFIED", + "ROWS", + "COLUMNS" + ], + "location": "query", + "type": "string" + } + }, + "path": "v4/spreadsheets/{spreadsheetId}/values:batchGet", + "scopes": [ + "https://www.googleapis.com/auth/drive", + "https://www.googleapis.com/auth/drive.readonly", + "https://www.googleapis.com/auth/spreadsheets", + "https://www.googleapis.com/auth/spreadsheets.readonly" + ] + }, + "batchUpdate": { + "id": "sheets.spreadsheets.values.batchUpdate", + "response": { + "$ref": "BatchUpdateValuesResponse" + }, + "parameterOrder": [ + "spreadsheetId" + ], + "description": "Sets values in one or more ranges of a spreadsheet.\nThe caller must specify the spreadsheet ID,\na valueInputOption, and one or more\nValueRanges.", + "request": { + "$ref": "BatchUpdateValuesRequest" + }, + "flatPath": "v4/spreadsheets/{spreadsheetId}/values:batchUpdate", + "httpMethod": "POST", + "parameters": { + "spreadsheetId": { + "description": "The ID of the spreadsheet to update.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v4/spreadsheets/{spreadsheetId}/values:batchUpdate", + "scopes": [ + "https://www.googleapis.com/auth/drive", + "https://www.googleapis.com/auth/spreadsheets" + ] + }, + "get": { + "id": "sheets.spreadsheets.values.get", + "response": { + "$ref": "ValueRange" + }, + "parameterOrder": [ + "spreadsheetId", + "range" + ], + "description": "Returns a range of values from a spreadsheet.\nThe caller must specify the spreadsheet ID and a range.", + "flatPath": "v4/spreadsheets/{spreadsheetId}/values/{range}", + "httpMethod": "GET", + "parameters": { + "spreadsheetId": { + "description": "The ID of the spreadsheet to retrieve data from.", + "required": true, + "location": "path", + "type": "string" + }, + "valueRenderOption": { + "description": "How values should be represented in the output.\nThe default render option is ValueRenderOption.FORMATTED_VALUE.", + "enum": [ + "FORMATTED_VALUE", + "UNFORMATTED_VALUE", + "FORMULA" + ], + "location": "query", + "type": "string" + }, + "dateTimeRenderOption": { + "description": "How dates, times, and durations should be represented in the output.\nThis is ignored if value_render_option is\nFORMATTED_VALUE.\nThe default dateTime render option is [DateTimeRenderOption.SERIAL_NUMBER].", + "enum": [ + "SERIAL_NUMBER", + "FORMATTED_STRING" + ], + "location": "query", + "type": "string" + }, + "range": { + "description": "The A1 notation of the values to retrieve.", + "required": true, + "location": "path", + "type": "string" + }, + "majorDimension": { + "description": "The major dimension that results should use.\n\nFor example, if the spreadsheet data is: `A1=1,B1=2,A2=3,B2=4`,\nthen requesting `range=A1:B2,majorDimension=ROWS` will return\n`[[1,2],[3,4]]`,\nwhereas requesting `range=A1:B2,majorDimension=COLUMNS` will return\n`[[1,3],[2,4]]`.", + "enum": [ + "DIMENSION_UNSPECIFIED", + "ROWS", + "COLUMNS" + ], + "location": "query", + "type": "string" + } + }, + "path": "v4/spreadsheets/{spreadsheetId}/values/{range}", + "scopes": [ + "https://www.googleapis.com/auth/drive", + "https://www.googleapis.com/auth/drive.readonly", + "https://www.googleapis.com/auth/spreadsheets", + "https://www.googleapis.com/auth/spreadsheets.readonly" + ] + }, + "append": { + "id": "sheets.spreadsheets.values.append", + "response": { + "$ref": "AppendValuesResponse" + }, + "parameterOrder": [ + "spreadsheetId", + "range" + ], + "description": "Appends values to a spreadsheet. The input range is used to search for\nexisting data and find a \"table\" within that range. Values will be\nappended to the next row of the table, starting with the first column of\nthe table. See the\n[guide](/sheets/guides/values#appending_values)\nand\n[sample code](/sheets/samples/writing#append_values)\nfor specific details of how tables are detected and data is appended.\n\nThe caller must specify the spreadsheet ID, range, and\na valueInputOption. The `valueInputOption` only\ncontrols how the input data will be added to the sheet (column-wise or\nrow-wise), it does not influence what cell the data starts being written\nto.", + "request": { + "$ref": "ValueRange" + }, + "flatPath": "v4/spreadsheets/{spreadsheetId}/values/{range}:append", + "httpMethod": "POST", + "parameters": { + "responseValueRenderOption": { + "description": "Determines how values in the response should be rendered.\nThe default render option is ValueRenderOption.FORMATTED_VALUE.", + "enum": [ + "FORMATTED_VALUE", + "UNFORMATTED_VALUE", + "FORMULA" + ], + "location": "query", + "type": "string" + }, + "valueInputOption": { + "description": "How the input data should be interpreted.", + "enum": [ + "INPUT_VALUE_OPTION_UNSPECIFIED", + "RAW", + "USER_ENTERED" + ], + "location": "query", + "type": "string" + }, + "responseDateTimeRenderOption": { + "description": "Determines how dates, times, and durations in the response should be\nrendered. This is ignored if response_value_render_option is\nFORMATTED_VALUE.\nThe default dateTime render option is [DateTimeRenderOption.SERIAL_NUMBER].", + "enum": [ + "SERIAL_NUMBER", + "FORMATTED_STRING" + ], + "location": "query", + "type": "string" + }, + "includeValuesInResponse": { + "description": "Determines if the update response should include the values\nof the cells that were appended. By default, responses\ndo not include the updated values.", + "location": "query", + "type": "boolean" + }, + "spreadsheetId": { + "description": "The ID of the spreadsheet to update.", + "required": true, + "location": "path", + "type": "string" + }, + "range": { + "description": "The A1 notation of a range to search for a logical table of data.\nValues will be appended after the last row of the table.", + "required": true, + "location": "path", + "type": "string" + }, + "insertDataOption": { + "description": "How the input data should be inserted.", + "enum": [ + "OVERWRITE", + "INSERT_ROWS" + ], + "location": "query", + "type": "string" + } + }, + "path": "v4/spreadsheets/{spreadsheetId}/values/{range}:append", + "scopes": [ + "https://www.googleapis.com/auth/drive", + "https://www.googleapis.com/auth/spreadsheets" + ] + }, + "update": { + "id": "sheets.spreadsheets.values.update", + "response": { + "$ref": "UpdateValuesResponse" + }, + "parameterOrder": [ + "spreadsheetId", + "range" + ], + "description": "Sets values in a range of a spreadsheet.\nThe caller must specify the spreadsheet ID, range, and\na valueInputOption.", + "request": { + "$ref": "ValueRange" + }, + "flatPath": "v4/spreadsheets/{spreadsheetId}/values/{range}", + "httpMethod": "PUT", + "parameters": { + "responseValueRenderOption": { + "description": "Determines how values in the response should be rendered.\nThe default render option is ValueRenderOption.FORMATTED_VALUE.", + "enum": [ + "FORMATTED_VALUE", + "UNFORMATTED_VALUE", + "FORMULA" + ], + "location": "query", + "type": "string" + }, + "valueInputOption": { + "description": "How the input data should be interpreted.", + "enum": [ + "INPUT_VALUE_OPTION_UNSPECIFIED", + "RAW", + "USER_ENTERED" + ], + "location": "query", + "type": "string" + }, + "responseDateTimeRenderOption": { + "description": "Determines how dates, times, and durations in the response should be\nrendered. This is ignored if response_value_render_option is\nFORMATTED_VALUE.\nThe default dateTime render option is [DateTimeRenderOption.SERIAL_NUMBER].", + "enum": [ + "SERIAL_NUMBER", + "FORMATTED_STRING" + ], + "location": "query", + "type": "string" + }, + "includeValuesInResponse": { + "description": "Determines if the update response should include the values\nof the cells that were updated. By default, responses\ndo not include the updated values.\nIf the range to write was larger than than the range actually written,\nthe response will include all values in the requested range (excluding\ntrailing empty rows and columns).", + "location": "query", + "type": "boolean" + }, + "spreadsheetId": { + "description": "The ID of the spreadsheet to update.", + "required": true, + "location": "path", + "type": "string" + }, + "range": { + "description": "The A1 notation of the values to update.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v4/spreadsheets/{spreadsheetId}/values/{range}", + "scopes": [ + "https://www.googleapis.com/auth/drive", + "https://www.googleapis.com/auth/spreadsheets" + ] + }, + "batchClear": { + "id": "sheets.spreadsheets.values.batchClear", + "response": { + "$ref": "BatchClearValuesResponse" + }, + "parameterOrder": [ + "spreadsheetId" + ], + "description": "Clears one or more ranges of values from a spreadsheet.\nThe caller must specify the spreadsheet ID and one or more ranges.\nOnly values are cleared -- all other properties of the cell (such as\nformatting, data validation, etc..) are kept.", + "request": { + "$ref": "BatchClearValuesRequest" + }, + "flatPath": "v4/spreadsheets/{spreadsheetId}/values:batchClear", + "httpMethod": "POST", + "parameters": { + "spreadsheetId": { + "description": "The ID of the spreadsheet to update.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v4/spreadsheets/{spreadsheetId}/values:batchClear", + "scopes": [ + "https://www.googleapis.com/auth/drive", + "https://www.googleapis.com/auth/spreadsheets" + ] + } + } + }, + "sheets": { + "methods": { + "copyTo": { + "id": "sheets.spreadsheets.sheets.copyTo", + "response": { + "$ref": "SheetProperties" + }, + "parameterOrder": [ + "spreadsheetId", + "sheetId" + ], + "description": "Copies a single sheet from a spreadsheet to another spreadsheet.\nReturns the properties of the newly created sheet.", + "request": { + "$ref": "CopySheetToAnotherSpreadsheetRequest" + }, + "flatPath": "v4/spreadsheets/{spreadsheetId}/sheets/{sheetId}:copyTo", + "httpMethod": "POST", + "parameters": { + "sheetId": { + "description": "The ID of the sheet to copy.", + "required": true, + "location": "path", + "type": "integer", + "format": "int32" + }, + "spreadsheetId": { + "description": "The ID of the spreadsheet containing the sheet to copy.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v4/spreadsheets/{spreadsheetId}/sheets/{sheetId}:copyTo", + "scopes": [ + "https://www.googleapis.com/auth/drive", + "https://www.googleapis.com/auth/spreadsheets" + ] + } + } + } + }, + "methods": { + "create": { + "id": "sheets.spreadsheets.create", + "response": { + "$ref": "Spreadsheet" + }, + "parameterOrder": [], + "description": "Creates a spreadsheet, returning the newly created spreadsheet.", + "request": { + "$ref": "Spreadsheet" + }, + "flatPath": "v4/spreadsheets", + "httpMethod": "POST", + "parameters": {}, + "path": "v4/spreadsheets", + "scopes": [ + "https://www.googleapis.com/auth/drive", + "https://www.googleapis.com/auth/spreadsheets" + ] + }, + "get": { + "id": "sheets.spreadsheets.get", + "response": { + "$ref": "Spreadsheet" + }, + "parameterOrder": [ + "spreadsheetId" + ], + "description": "Returns the spreadsheet at the given ID.\nThe caller must specify the spreadsheet ID.\n\nBy default, data within grids will not be returned.\nYou can include grid data one of two ways:\n\n* Specify a field mask listing your desired fields using the `fields` URL\nparameter in HTTP\n\n* Set the includeGridData\nURL parameter to true. If a field mask is set, the `includeGridData`\nparameter is ignored\n\nFor large spreadsheets, it is recommended to retrieve only the specific\nfields of the spreadsheet that you want.\n\nTo retrieve only subsets of the spreadsheet, use the\nranges URL parameter.\nMultiple ranges can be specified. Limiting the range will\nreturn only the portions of the spreadsheet that intersect the requested\nranges. Ranges are specified using A1 notation.", + "flatPath": "v4/spreadsheets/{spreadsheetId}", + "httpMethod": "GET", + "parameters": { + "spreadsheetId": { + "description": "The spreadsheet to request.", + "required": true, + "location": "path", + "type": "string" + }, + "ranges": { + "description": "The ranges to retrieve from the spreadsheet.", + "repeated": true, + "location": "query", + "type": "string" + }, + "includeGridData": { + "description": "True if grid data should be returned.\nThis parameter is ignored if a field mask was set in the request.", + "location": "query", + "type": "boolean" + } + }, + "path": "v4/spreadsheets/{spreadsheetId}", + "scopes": [ + "https://www.googleapis.com/auth/drive", + "https://www.googleapis.com/auth/drive.readonly", + "https://www.googleapis.com/auth/spreadsheets", + "https://www.googleapis.com/auth/spreadsheets.readonly" + ] + }, + "batchUpdate": { + "id": "sheets.spreadsheets.batchUpdate", + "response": { + "$ref": "BatchUpdateSpreadsheetResponse" + }, + "parameterOrder": [ + "spreadsheetId" + ], + "description": "Applies one or more updates to the spreadsheet.\n\nEach request is validated before\nbeing applied. If any request is not valid then the entire request will\nfail and nothing will be applied.\n\nSome requests have replies to\ngive you some information about how\nthey are applied. The replies will mirror the requests. For example,\nif you applied 4 updates and the 3rd one had a reply, then the\nresponse will have 2 empty replies, the actual reply, and another empty\nreply, in that order.\n\nDue to the collaborative nature of spreadsheets, it is not guaranteed that\nthe spreadsheet will reflect exactly your changes after this completes,\nhowever it is guaranteed that the updates in the request will be\napplied together atomically. Your changes may be altered with respect to\ncollaborator changes. If there are no collaborators, the spreadsheet\nshould reflect your changes.", + "request": { + "$ref": "BatchUpdateSpreadsheetRequest" + }, + "flatPath": "v4/spreadsheets/{spreadsheetId}:batchUpdate", + "httpMethod": "POST", + "parameters": { + "spreadsheetId": { + "description": "The spreadsheet to apply the updates to.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v4/spreadsheets/{spreadsheetId}:batchUpdate", + "scopes": [ + "https://www.googleapis.com/auth/drive", + "https://www.googleapis.com/auth/spreadsheets" + ] + } + } + } + }, + "schemas": { + "AddNamedRangeResponse": { + "description": "The result of adding a named range.", + "type": "object", + "properties": { + "namedRange": { + "description": "The named range to add.", + "$ref": "NamedRange" + } + }, + "id": "AddNamedRangeResponse" + }, + "UpdateProtectedRangeRequest": { + "description": "Updates an existing protected range with the specified\nprotectedRangeId.", + "type": "object", + "properties": { + "protectedRange": { + "description": "The protected range to update with the new properties.", + "$ref": "ProtectedRange" + }, + "fields": { + "description": "The fields that should be updated. At least one field must be specified.\nThe root `protectedRange` is implied and should not be specified.\nA single `\"*\"` can be used as short-hand for listing every field.", + "type": "string", + "format": "google-fieldmask" + } + }, + "id": "UpdateProtectedRangeRequest" + }, + "Padding": { + "description": "The amount of padding around the cell, in pixels.\nWhen updating padding, every field must be specified.", + "type": "object", + "properties": { + "right": { + "description": "The right padding of the cell.", + "type": "integer", + "format": "int32" + }, + "left": { + "description": "The left padding of the cell.", + "type": "integer", + "format": "int32" + }, + "top": { + "description": "The top padding of the cell.", + "type": "integer", + "format": "int32" + }, + "bottom": { + "description": "The bottom padding of the cell.", + "type": "integer", + "format": "int32" + } + }, + "id": "Padding" + }, + "MergeCellsRequest": { + "description": "Merges all cells in the range.", + "type": "object", + "properties": { + "mergeType": { + "description": "How the cells should be merged.", + "enum": [ + "MERGE_ALL", + "MERGE_COLUMNS", + "MERGE_ROWS" + ], + "enumDescriptions": [ + "Create a single merge from the range", + "Create a merge for each column in the range", + "Create a merge for each row in the range" + ], + "type": "string" + }, + "range": { + "description": "The range of cells to merge.", + "$ref": "GridRange" + } + }, + "id": "MergeCellsRequest" + }, + "AddSheetResponse": { + "description": "The result of adding a sheet.", + "type": "object", + "properties": { + "properties": { + "description": "The properties of the newly added sheet.", + "$ref": "SheetProperties" + } + }, + "id": "AddSheetResponse" + }, + "PivotGroupValueMetadata": { + "description": "Metadata about a value in a pivot grouping.", + "type": "object", + "properties": { + "value": { + "description": "The calculated value the metadata corresponds to.\n(Note that formulaValue is not valid,\n because the values will be calculated.)", + "$ref": "ExtendedValue" + }, + "collapsed": { + "description": "True if the data corresponding to the value is collapsed.", + "type": "boolean" + } + }, + "id": "PivotGroupValueMetadata" + }, + "UpdateEmbeddedObjectPositionResponse": { + "description": "The result of updating an embedded object's position.", + "type": "object", + "properties": { + "position": { + "description": "The new position of the embedded object.", + "$ref": "EmbeddedObjectPosition" + } + }, + "id": "UpdateEmbeddedObjectPositionResponse" + }, + "ClearValuesResponse": { + "description": "The response when clearing a range of values in a spreadsheet.", + "type": "object", + "properties": { + "spreadsheetId": { + "description": "The spreadsheet the updates were applied to.", + "type": "string" + }, + "clearedRange": { + "description": "The range (in A1 notation) that was cleared.\n(If the request was for an unbounded range or a ranger larger\n than the bounds of the sheet, this will be the actual range\n that was cleared, bounded to the sheet's limits.)", + "type": "string" + } + }, + "id": "ClearValuesResponse" + }, + "UpdateConditionalFormatRuleRequest": { + "description": "Updates a conditional format rule at the given index,\nor moves a conditional format rule to another index.", + "type": "object", + "properties": { + "sheetId": { + "description": "The sheet of the rule to move. Required if new_index is set,\nunused otherwise.", + "type": "integer", + "format": "int32" + }, + "rule": { + "description": "The rule that should replace the rule at the given index.", + "$ref": "ConditionalFormatRule" + }, + "index": { + "description": "The zero-based index of the rule that should be replaced or moved.", + "type": "integer", + "format": "int32" + }, + "newIndex": { + "description": "The zero-based new index the rule should end up at.", + "type": "integer", + "format": "int32" + } + }, + "id": "UpdateConditionalFormatRuleRequest" + }, + "TextFormat": { + "description": "The format of a run of text in a cell.\nAbsent values indicate that the field isn't specified.", + "type": "object", + "properties": { + "bold": { + "description": "True if the text is bold.", + "type": "boolean" + }, + "italic": { + "description": "True if the text is italicized.", + "type": "boolean" + }, + "foregroundColor": { + "description": "The foreground color of the text.", + "$ref": "Color" + }, + "fontFamily": { + "description": "The font family.", + "type": "string" + }, + "strikethrough": { + "description": "True if the text has a strikethrough.", + "type": "boolean" + }, + "fontSize": { + "description": "The size of the font.", + "type": "integer", + "format": "int32" + }, + "underline": { + "description": "True if the text is underlined.", + "type": "boolean" + } + }, + "id": "TextFormat" + }, + "UpdateChartSpecRequest": { + "description": "Updates a chart's specifications.\n(This does not move or resize a chart. To move or resize a chart, use\n UpdateEmbeddedObjectPositionRequest.)", + "type": "object", + "properties": { + "chartId": { + "description": "The ID of the chart to update.", + "type": "integer", + "format": "int32" + }, + "spec": { + "description": "The specification to apply to the chart.", + "$ref": "ChartSpec" + } + }, + "id": "UpdateChartSpecRequest" + }, + "GridCoordinate": { + "description": "A coordinate in a sheet.\nAll indexes are zero-based.", + "type": "object", + "properties": { + "sheetId": { + "description": "The sheet this coordinate is on.", + "type": "integer", + "format": "int32" + }, + "rowIndex": { + "description": "The row index of the coordinate.", + "type": "integer", + "format": "int32" + }, + "columnIndex": { + "description": "The column index of the coordinate.", + "type": "integer", + "format": "int32" + } + }, + "id": "GridCoordinate" + }, + "DeleteFilterViewRequest": { + "description": "Deletes a particular filter view.", + "type": "object", + "properties": { + "filterId": { + "description": "The ID of the filter to delete.", + "type": "integer", + "format": "int32" + } + }, + "id": "DeleteFilterViewRequest" + }, + "BatchUpdateValuesResponse": { + "description": "The response when updating a range of values in a spreadsheet.", + "type": "object", + "properties": { + "totalUpdatedSheets": { + "description": "The total number of sheets where at least one cell in the sheet was\nupdated.", + "type": "integer", + "format": "int32" + }, + "totalUpdatedColumns": { + "description": "The total number of columns where at least one cell in the column was\nupdated.", + "type": "integer", + "format": "int32" + }, + "responses": { + "description": "One UpdateValuesResponse per requested range, in the same order as\nthe requests appeared.", + "type": "array", + "items": { + "$ref": "UpdateValuesResponse" + } + }, + "totalUpdatedCells": { + "description": "The total number of cells updated.", + "type": "integer", + "format": "int32" + }, + "spreadsheetId": { + "description": "The spreadsheet the updates were applied to.", + "type": "string" + }, + "totalUpdatedRows": { + "description": "The total number of rows where at least one cell in the row was updated.", + "type": "integer", + "format": "int32" + } + }, + "id": "BatchUpdateValuesResponse" + }, + "UpdateNamedRangeRequest": { + "description": "Updates properties of the named range with the specified\nnamedRangeId.", + "type": "object", + "properties": { + "fields": { + "description": "The fields that should be updated. At least one field must be specified.\nThe root `namedRange` is implied and should not be specified.\nA single `\"*\"` can be used as short-hand for listing every field.", + "type": "string", + "format": "google-fieldmask" + }, + "namedRange": { + "description": "The named range to update with the new properties.", + "$ref": "NamedRange" + } + }, + "id": "UpdateNamedRangeRequest" + }, + "UpdateValuesResponse": { + "description": "The response when updating a range of values in a spreadsheet.", + "type": "object", + "properties": { + "updatedColumns": { + "description": "The number of columns where at least one cell in the column was updated.", + "type": "integer", + "format": "int32" + }, + "updatedCells": { + "description": "The number of cells updated.", + "type": "integer", + "format": "int32" + }, + "updatedData": { + "description": "The values of the cells after updates were applied.\nThis is only included if the request's `includeValuesInResponse` field\nwas `true`.", + "$ref": "ValueRange" + }, + "updatedRange": { + "description": "The range (in A1 notation) that updates were applied to.", + "type": "string" + }, + "spreadsheetId": { + "description": "The spreadsheet the updates were applied to.", + "type": "string" + }, + "updatedRows": { + "description": "The number of rows where at least one cell in the row was updated.", + "type": "integer", + "format": "int32" + } + }, + "id": "UpdateValuesResponse" + }, + "SpreadsheetProperties": { + "description": "Properties of a spreadsheet.", + "type": "object", + "properties": { + "timeZone": { + "description": "The time zone of the spreadsheet, in CLDR format such as\n`America/New_York`. If the time zone isn't recognized, this may\nbe a custom time zone such as `GMT-07:00`.", + "type": "string" + }, + "autoRecalc": { + "description": "The amount of time to wait before volatile functions are recalculated.", + "enum": [ + "RECALCULATION_INTERVAL_UNSPECIFIED", + "ON_CHANGE", + "MINUTE", + "HOUR" + ], + "enumDescriptions": [ + "Default value. This value must not be used.", + "Volatile functions are updated on every change.", + "Volatile functions are updated on every change and every minute.", + "Volatile functions are updated on every change and hourly." + ], + "type": "string" + }, + "locale": { + "description": "The locale of the spreadsheet in one of the following formats:\n\n* an ISO 639-1 language code such as `en`\n\n* an ISO 639-2 language code such as `fil`, if no 639-1 code exists\n\n* a combination of the ISO language code and country code, such as `en_US`\n\nNote: when updating this field, not all locales/languages are supported.", + "type": "string" + }, + "title": { + "description": "The title of the spreadsheet.", + "type": "string" + }, + "defaultFormat": { + "description": "The default format of all cells in the spreadsheet.\nCellData.effectiveFormat will not be set if the\ncell's format is equal to this default format.\nThis field is read-only.", + "$ref": "CellFormat" + } + }, + "id": "SpreadsheetProperties" + }, + "CellData": { + "description": "Data about a specific cell.", + "type": "object", + "properties": { + "hyperlink": { + "description": "A hyperlink this cell points to, if any.\nThis field is read-only. (To set it, use a `=HYPERLINK` formula.)", + "type": "string" + }, + "effectiveFormat": { + "description": "The effective format being used by the cell.\nThis includes the results of applying any conditional formatting and,\nif the cell contains a formula, the computed number format.\nIf the effective format is the default format, effective format will\nnot be written.\nThis field is read-only.", + "$ref": "CellFormat" + }, + "note": { + "description": "Any note on the cell.", + "type": "string" + }, + "formattedValue": { + "description": "The formatted value of the cell.\nThis is the value as it's shown to the user.\nThis field is read-only.", + "type": "string" + }, + "userEnteredValue": { + "description": "The value the user entered in the cell. e.g, `1234`, `'Hello'`, or `=NOW()`\nNote: Dates, Times and DateTimes are represented as doubles in\nserial number format.", + "$ref": "ExtendedValue" + }, + "dataValidation": { + "description": "A data validation rule on the cell, if any.\n\nWhen writing, the new data validation rule will overwrite any prior rule.", + "$ref": "DataValidationRule" + }, + "userEnteredFormat": { + "description": "The format the user entered for the cell.\n\nWhen writing, the new format will be merged with the existing format.", + "$ref": "CellFormat" + }, + "pivotTable": { + "description": "A pivot table anchored at this cell. The size of pivot table itself\nis computed dynamically based on its data, grouping, filters, values,\netc. Only the top-left cell of the pivot table contains the pivot table\ndefinition. The other cells will contain the calculated values of the\nresults of the pivot in their effective_value fields.", + "$ref": "PivotTable" + }, + "textFormatRuns": { + "description": "Runs of rich text applied to subsections of the cell. Runs are only valid\non user entered strings, not formulas, bools, or numbers.\nRuns start at specific indexes in the text and continue until the next\nrun. Properties of a run will continue unless explicitly changed\nin a subsequent run (and properties of the first run will continue\nthe properties of the cell unless explicitly changed).\n\nWhen writing, the new runs will overwrite any prior runs. When writing a\nnew user_entered_value, previous runs will be erased.", + "type": "array", + "items": { + "$ref": "TextFormatRun" + } + }, + "effectiveValue": { + "description": "The effective value of the cell. For cells with formulas, this will be\nthe calculated value. For cells with literals, this will be\nthe same as the user_entered_value.\nThis field is read-only.", + "$ref": "ExtendedValue" + } + }, + "id": "CellData" + }, + "UnmergeCellsRequest": { + "description": "Unmerges cells in the given range.", + "type": "object", + "properties": { + "range": { + "description": "The range within which all cells should be unmerged.\nIf the range spans multiple merges, all will be unmerged.\nThe range must not partially span any merge.", + "$ref": "GridRange" + } + }, + "id": "UnmergeCellsRequest" + }, + "TextToColumnsRequest": { + "description": "Splits a column of text into multiple columns,\nbased on a delimiter in each cell.", + "type": "object", + "properties": { + "source": { + "description": "The source data range. This must span exactly one column.", + "$ref": "GridRange" + }, + "delimiter": { + "description": "The delimiter to use. Used only if delimiterType is\nCUSTOM.", + "type": "string" + }, + "delimiterType": { + "description": "The delimiter type to use.", + "enum": [ + "DELIMITER_TYPE_UNSPECIFIED", + "COMMA", + "SEMICOLON", + "PERIOD", + "SPACE", + "CUSTOM" + ], + "enumDescriptions": [ + "Default value. This value must not be used.", + "\",\"", + "\";\"", + "\".\"", + "\" \"", + "A custom value as defined in delimiter." + ], + "type": "string" + } + }, + "id": "TextToColumnsRequest" + }, + "AddProtectedRangeResponse": { + "description": "The result of adding a new protected range.", + "type": "object", + "properties": { + "protectedRange": { + "description": "The newly added protected range.", + "$ref": "ProtectedRange" + } + }, + "id": "AddProtectedRangeResponse" + }, + "BooleanCondition": { + "description": "A condition that can evaluate to true or false.\nBooleanConditions are used by conditional formatting,\ndata validation, and the criteria in filters.", + "type": "object", + "properties": { + "values": { + "description": "The values of the condition. The number of supported values depends\non the condition type. Some support zero values,\nothers one or two values,\nand ConditionType.ONE_OF_LIST supports an arbitrary number of values.", + "type": "array", + "items": { + "$ref": "ConditionValue" + } + }, + "type": { + "description": "The type of condition.", + "enum": [ + "CONDITION_TYPE_UNSPECIFIED", + "NUMBER_GREATER", + "NUMBER_GREATER_THAN_EQ", + "NUMBER_LESS", + "NUMBER_LESS_THAN_EQ", + "NUMBER_EQ", + "NUMBER_NOT_EQ", + "NUMBER_BETWEEN", + "NUMBER_NOT_BETWEEN", + "TEXT_CONTAINS", + "TEXT_NOT_CONTAINS", + "TEXT_STARTS_WITH", + "TEXT_ENDS_WITH", + "TEXT_EQ", + "TEXT_IS_EMAIL", + "TEXT_IS_URL", + "DATE_EQ", + "DATE_BEFORE", + "DATE_AFTER", + "DATE_ON_OR_BEFORE", + "DATE_ON_OR_AFTER", + "DATE_BETWEEN", + "DATE_NOT_BETWEEN", + "DATE_IS_VALID", + "ONE_OF_RANGE", + "ONE_OF_LIST", + "BLANK", + "NOT_BLANK", + "CUSTOM_FORMULA" + ], + "enumDescriptions": [ + "The default value, do not use.", + "The cell's value must be greater than the condition's value.\nSupported by data validation, conditional formatting and filters.\nRequires a single ConditionValue.", + "The cell's value must be greater than or equal to the condition's value.\nSupported by data validation, conditional formatting and filters.\nRequires a single ConditionValue.", + "The cell's value must be less than the condition's value.\nSupported by data validation, conditional formatting and filters.\nRequires a single ConditionValue.", + "The cell's value must be less than or equal to the condition's value.\nSupported by data validation, conditional formatting and filters.\nRequires a single ConditionValue.", + "The cell's value must be equal to the condition's value.\nSupported by data validation, conditional formatting and filters.\nRequires a single ConditionValue.", + "The cell's value must be not equal to the condition's value.\nSupported by data validation, conditional formatting and filters.\nRequires a single ConditionValue.", + "The cell's value must be between the two condition values.\nSupported by data validation, conditional formatting and filters.\nRequires exactly two ConditionValues.", + "The cell's value must not be between the two condition values.\nSupported by data validation, conditional formatting and filters.\nRequires exactly two ConditionValues.", + "The cell's value must contain the condition's value.\nSupported by data validation, conditional formatting and filters.\nRequires a single ConditionValue.", + "The cell's value must not contain the condition's value.\nSupported by data validation, conditional formatting and filters.\nRequires a single ConditionValue.", + "The cell's value must start with the condition's value.\nSupported by conditional formatting and filters.\nRequires a single ConditionValue.", + "The cell's value must end with the condition's value.\nSupported by conditional formatting and filters.\nRequires a single ConditionValue.", + "The cell's value must be exactly the condition's value.\nSupported by data validation, conditional formatting and filters.\nRequires a single ConditionValue.", + "The cell's value must be a valid email address.\nSupported by data validation.\nRequires no ConditionValues.", + "The cell's value must be a valid URL.\nSupported by data validation.\nRequires no ConditionValues.", + "The cell's value must be the same date as the condition's value.\nSupported by data validation, conditional formatting and filters.\nRequires a single ConditionValue.", + "The cell's value must be before the date of the condition's value.\nSupported by data validation, conditional formatting and filters.\nRequires a single ConditionValue\nthat may be a relative date.", + "The cell's value must be after the date of the condition's value.\nSupported by data validation, conditional formatting and filters.\nRequires a single ConditionValue\nthat may be a relative date.", + "The cell's value must be on or before the date of the condition's value.\nSupported by data validation.\nRequires a single ConditionValue\nthat may be a relative date.", + "The cell's value must be on or after the date of the condition's value.\nSupported by data validation.\nRequires a single ConditionValue\nthat may be a relative date.", + "The cell's value must be between the dates of the two condition values.\nSupported by data validation.\nRequires exactly two ConditionValues.", + "The cell's value must be outside the dates of the two condition values.\nSupported by data validation.\nRequires exactly two ConditionValues.", + "The cell's value must be a date.\nSupported by data validation.\nRequires no ConditionValues.", + "The cell's value must be listed in the grid in condition value's range.\nSupported by data validation.\nRequires a single ConditionValue,\nand the value must be a valid range in A1 notation.", + "The cell's value must in the list of condition values.\nSupported by data validation.\nSupports any number of condition values,\none per item in the list.\nFormulas are not supported in the values.", + "The cell's value must be empty.\nSupported by conditional formatting and filters.\nRequires no ConditionValues.", + "The cell's value must not be empty.\nSupported by conditional formatting and filters.\nRequires no ConditionValues.", + "The condition's formula must evaluate to true.\nSupported by data validation, conditional formatting and filters.\nRequires a single ConditionValue." + ], + "type": "string" + } + }, + "id": "BooleanCondition" + }, + "DeleteProtectedRangeRequest": { + "description": "Deletes the protected range with the given ID.", + "type": "object", + "properties": { + "protectedRangeId": { + "description": "The ID of the protected range to delete.", + "type": "integer", + "format": "int32" + } + }, + "id": "DeleteProtectedRangeRequest" + }, + "BasicChartDomain": { + "description": "The domain of a chart.\nFor example, if charting stock prices over time, this would be the date.", + "type": "object", + "properties": { + "domain": { + "description": "The data of the domain. For example, if charting stock prices over time,\nthis is the data representing the dates.", + "$ref": "ChartData" + } + }, + "id": "BasicChartDomain" + }, + "DimensionRange": { + "description": "A range along a single dimension on a sheet.\nAll indexes are zero-based.\nIndexes are half open: the start index is inclusive\nand the end index is exclusive.\nMissing indexes indicate the range is unbounded on that side.", + "type": "object", + "properties": { + "sheetId": { + "description": "The sheet this span is on.", + "type": "integer", + "format": "int32" + }, + "endIndex": { + "description": "The end (exclusive) of the span, or not set if unbounded.", + "type": "integer", + "format": "int32" + }, + "startIndex": { + "description": "The start (inclusive) of the span, or not set if unbounded.", + "type": "integer", + "format": "int32" + }, + "dimension": { + "description": "The dimension of the span.", + "enum": [ + "DIMENSION_UNSPECIFIED", + "ROWS", + "COLUMNS" + ], + "enumDescriptions": [ + "The default value, do not use.", + "Operates on the rows of a sheet.", + "Operates on the columns of a sheet." + ], + "type": "string" + } + }, + "id": "DimensionRange" + }, + "Response": { + "description": "A single response from an update.", + "type": "object", + "properties": { + "updateEmbeddedObjectPosition": { + "description": "A reply from updating an embedded object's position.", + "$ref": "UpdateEmbeddedObjectPositionResponse" + }, + "addFilterView": { + "description": "A reply from adding a filter view.", + "$ref": "AddFilterViewResponse" + }, + "addSheet": { + "description": "A reply from adding a sheet.", + "$ref": "AddSheetResponse" + }, + "findReplace": { + "description": "A reply from doing a find/replace.", + "$ref": "FindReplaceResponse" + }, + "addProtectedRange": { + "description": "A reply from adding a protected range.", + "$ref": "AddProtectedRangeResponse" + }, + "updateConditionalFormatRule": { + "description": "A reply from updating a conditional format rule.", + "$ref": "UpdateConditionalFormatRuleResponse" + }, + "addChart": { + "description": "A reply from adding a chart.", + "$ref": "AddChartResponse" + }, + "deleteConditionalFormatRule": { + "description": "A reply from deleting a conditional format rule.", + "$ref": "DeleteConditionalFormatRuleResponse" + }, + "addBanding": { + "description": "A reply from adding a banded range.", + "$ref": "AddBandingResponse" + }, + "duplicateSheet": { + "description": "A reply from duplicating a sheet.", + "$ref": "DuplicateSheetResponse" + }, + "duplicateFilterView": { + "description": "A reply from duplicating a filter view.", + "$ref": "DuplicateFilterViewResponse" + }, + "addNamedRange": { + "description": "A reply from adding a named range.", + "$ref": "AddNamedRangeResponse" + } + }, + "id": "Response" + }, + "AddConditionalFormatRuleRequest": { + "description": "Adds a new conditional format rule at the given index.\nAll subsequent rules' indexes are incremented.", + "type": "object", + "properties": { + "rule": { + "description": "The rule to add.", + "$ref": "ConditionalFormatRule" + }, + "index": { + "description": "The zero-based index where the rule should be inserted.", + "type": "integer", + "format": "int32" + } + }, + "id": "AddConditionalFormatRuleRequest" + }, + "FilterView": { + "description": "A filter view.", + "type": "object", + "properties": { + "title": { + "description": "The name of the filter view.", + "type": "string" + }, + "namedRangeId": { + "description": "The named range this filter view is backed by, if any.\n\nWhen writing, only one of range or named_range_id\nmay be set.", + "type": "string" + }, + "sortSpecs": { + "description": "The sort order per column. Later specifications are used when values\nare equal in the earlier specifications.", + "type": "array", + "items": { + "$ref": "SortSpec" + } + }, + "range": { + "description": "The range this filter view covers.\n\nWhen writing, only one of range or named_range_id\nmay be set.", + "$ref": "GridRange" + }, + "criteria": { + "description": "The criteria for showing/hiding values per column.\nThe map's key is the column index, and the value is the criteria for\nthat column.", + "additionalProperties": { + "$ref": "FilterCriteria" + }, + "type": "object" + }, + "filterViewId": { + "description": "The ID of the filter view.", + "type": "integer", + "format": "int32" + } + }, + "id": "FilterView" + }, + "SortRangeRequest": { + "description": "Sorts data in rows based on a sort order per column.", + "type": "object", + "properties": { + "range": { + "description": "The range to sort.", + "$ref": "GridRange" + }, + "sortSpecs": { + "description": "The sort order per column. Later specifications are used when values\nare equal in the earlier specifications.", + "type": "array", + "items": { + "$ref": "SortSpec" + } + } + }, + "id": "SortRangeRequest" + }, + "AddBandingResponse": { + "description": "The result of adding a banded range.", + "type": "object", + "properties": { + "bandedRange": { + "description": "The banded range that was added.", + "$ref": "BandedRange" + } + }, + "id": "AddBandingResponse" + }, + "TextFormatRun": { + "description": "A run of a text format. The format of this run continues until the start\nindex of the next run.\nWhen updating, all fields must be set.", + "type": "object", + "properties": { + "startIndex": { + "description": "The character index where this run starts.", + "type": "integer", + "format": "int32" + }, + "format": { + "description": "The format of this run. Absent values inherit the cell's format.", + "$ref": "TextFormat" + } + }, + "id": "TextFormatRun" + }, + "UpdateFilterViewRequest": { + "description": "Updates properties of the filter view.", + "type": "object", + "properties": { + "filter": { + "description": "The new properties of the filter view.", + "$ref": "FilterView" + }, + "fields": { + "description": "The fields that should be updated. At least one field must be specified.\nThe root `filter` is implied and should not be specified.\nA single `\"*\"` can be used as short-hand for listing every field.", + "type": "string", + "format": "google-fieldmask" + } + }, + "id": "UpdateFilterViewRequest" + }, + "UpdateConditionalFormatRuleResponse": { + "description": "The result of updating a conditional format rule.", + "type": "object", + "properties": { + "oldIndex": { + "description": "The old index of the rule. Not set if a rule was replaced\n(because it is the same as new_index).", + "type": "integer", + "format": "int32" + }, + "newRule": { + "description": "The new rule that replaced the old rule (if replacing),\nor the rule that was moved (if moved)", + "$ref": "ConditionalFormatRule" + }, + "oldRule": { + "description": "The old (deleted) rule. Not set if a rule was moved\n(because it is the same as new_rule).", + "$ref": "ConditionalFormatRule" + }, + "newIndex": { + "description": "The index of the new rule.", + "type": "integer", + "format": "int32" + } + }, + "id": "UpdateConditionalFormatRuleResponse" + }, + "FilterCriteria": { + "description": "Criteria for showing/hiding rows in a filter or filter view.", + "type": "object", + "properties": { + "condition": { + "description": "A condition that must be true for values to be shown.\n(This does not override hiddenValues -- if a value is listed there,\n it will still be hidden.)", + "$ref": "BooleanCondition" + }, + "hiddenValues": { + "description": "Values that should be hidden.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "id": "FilterCriteria" + }, + "DeleteDimensionRequest": { + "description": "Deletes the dimensions from the sheet.", + "type": "object", + "properties": { + "range": { + "description": "The dimensions to delete from the sheet.", + "$ref": "DimensionRange" + } + }, + "id": "DeleteDimensionRequest" + }, + "PivotTable": { + "description": "A pivot table.", + "type": "object", + "properties": { + "valueLayout": { + "description": "Whether values should be listed horizontally (as columns)\nor vertically (as rows).", + "enum": [ + "HORIZONTAL", + "VERTICAL" + ], + "enumDescriptions": [ + "Values are laid out horizontally (as columns).", + "Values are laid out vertically (as rows)." + ], + "type": "string" + }, + "columns": { + "description": "Each column grouping in the pivot table.", + "type": "array", + "items": { + "$ref": "PivotGroup" + } + }, + "source": { + "description": "The range the pivot table is reading data from.", + "$ref": "GridRange" + }, + "rows": { + "description": "Each row grouping in the pivot table.", + "type": "array", + "items": { + "$ref": "PivotGroup" + } + }, + "values": { + "description": "A list of values to include in the pivot table.", + "type": "array", + "items": { + "$ref": "PivotValue" + } + }, + "criteria": { + "description": "An optional mapping of filters per source column offset.\n\nThe filters will be applied before aggregating data into the pivot table.\nThe map's key is the column offset of the source range that you want to\nfilter, and the value is the criteria for that column.\n\nFor example, if the source was `C10:E15`, a key of `0` will have the filter\nfor column `C`, whereas the key `1` is for column `D`.", + "additionalProperties": { + "$ref": "PivotFilterCriteria" + }, + "type": "object" + } + }, + "id": "PivotTable" + }, + "DataValidationRule": { + "description": "A data validation rule.", + "type": "object", + "properties": { + "condition": { + "description": "The condition that data in the cell must match.", + "$ref": "BooleanCondition" + }, + "inputMessage": { + "description": "A message to show the user when adding data to the cell.", + "type": "string" + }, + "showCustomUi": { + "description": "True if the UI should be customized based on the kind of condition.\nIf true, \"List\" conditions will show a dropdown.", + "type": "boolean" + }, + "strict": { + "description": "True if invalid data should be rejected.", + "type": "boolean" + } + }, + "id": "DataValidationRule" + }, + "UpdateSpreadsheetPropertiesRequest": { + "description": "Updates properties of a spreadsheet.", + "type": "object", + "properties": { + "fields": { + "description": "The fields that should be updated. At least one field must be specified.\nThe root 'properties' is implied and should not be specified.\nA single `\"*\"` can be used as short-hand for listing every field.", + "type": "string", + "format": "google-fieldmask" + }, + "properties": { + "description": "The properties to update.", + "$ref": "SpreadsheetProperties" + } + }, + "id": "UpdateSpreadsheetPropertiesRequest" + }, + "ChartSourceRange": { + "description": "Source ranges for a chart.", + "type": "object", + "properties": { + "sources": { + "description": "The ranges of data for a series or domain.\nExactly one dimension must have a length of 1,\nand all sources in the list must have the same dimension\nwith length 1.\nThe domain (if it exists) & all series must have the same number\nof source ranges. If using more than one source range, then the source\nrange at a given offset must be contiguous across the domain and series.\n\nFor example, these are valid configurations:\n\n domain sources: A1:A5\n series1 sources: B1:B5\n series2 sources: D6:D10\n\n domain sources: A1:A5, C10:C12\n series1 sources: B1:B5, D10:D12\n series2 sources: C1:C5, E10:E12", + "type": "array", + "items": { + "$ref": "GridRange" + } + } + }, + "id": "ChartSourceRange" + }, + "BatchUpdateValuesRequest": { + "description": "The request for updating more than one range of values in a spreadsheet.", + "type": "object", + "properties": { + "valueInputOption": { + "description": "How the input data should be interpreted.", + "enum": [ + "INPUT_VALUE_OPTION_UNSPECIFIED", + "RAW", + "USER_ENTERED" + ], + "enumDescriptions": [ + "Default input value. This value must not be used.", + "The values the user has entered will not be parsed and will be stored\nas-is.", + "The values will be parsed as if the user typed them into the UI.\nNumbers will stay as numbers, but strings may be converted to numbers,\ndates, etc. following the same rules that are applied when entering\ntext into a cell via the Google Sheets UI." + ], + "type": "string" + }, + "data": { + "description": "The new values to apply to the spreadsheet.", + "type": "array", + "items": { + "$ref": "ValueRange" + } + }, + "responseValueRenderOption": { + "description": "Determines how values in the response should be rendered.\nThe default render option is ValueRenderOption.FORMATTED_VALUE.", + "enum": [ + "FORMATTED_VALUE", + "UNFORMATTED_VALUE", + "FORMULA" + ], + "enumDescriptions": [ + "Values will be calculated & formatted in the reply according to the\ncell's formatting. Formatting is based on the spreadsheet's locale,\nnot the requesting user's locale.\nFor example, if `A1` is `1.23` and `A2` is `=A1` and formatted as currency,\nthen `A2` would return `\"$1.23\"`.", + "Values will be calculated, but not formatted in the reply.\nFor example, if `A1` is `1.23` and `A2` is `=A1` and formatted as currency,\nthen `A2` would return the number `1.23`.", + "Values will not be calculated. The reply will include the formulas.\nFor example, if `A1` is `1.23` and `A2` is `=A1` and formatted as currency,\nthen A2 would return `\"=A1\"`." + ], + "type": "string" + }, + "responseDateTimeRenderOption": { + "description": "Determines how dates, times, and durations in the response should be\nrendered. This is ignored if response_value_render_option is\nFORMATTED_VALUE.\nThe default dateTime render option is [DateTimeRenderOption.SERIAL_NUMBER].", + "enum": [ + "SERIAL_NUMBER", + "FORMATTED_STRING" + ], + "enumDescriptions": [ + "Instructs date, time, datetime, and duration fields to be output\nas doubles in \"serial number\" format, as popularized by Lotus 1-2-3.\nDays are counted from December 31st 1899 and are incremented by 1,\nand times are fractions of a day. For example, January 1st 1900 at noon\nwould be 1.5, 1 because it's 1 day offset from December 31st 1899,\nand .5 because noon is half a day. February 1st 1900 at 3pm would\nbe 32.625. This correctly treats the year 1900 as not a leap year.", + "Instructs date, time, datetime, and duration fields to be output\nas strings in their given number format (which is dependent\non the spreadsheet locale)." + ], + "type": "string" + }, + "includeValuesInResponse": { + "description": "Determines if the update response should include the values\nof the cells that were updated. By default, responses\ndo not include the updated values. The `updatedData` field within\neach of the BatchUpdateValuesResponse.responses will contain\nthe updated values. If the range to write was larger than than the range\nactually written, the response will include all values in the requested\nrange (excluding trailing empty rows and columns).", + "type": "boolean" + } + }, + "id": "BatchUpdateValuesRequest" + }, + "ClearBasicFilterRequest": { + "description": "Clears the basic filter, if any exists on the sheet.", + "type": "object", + "properties": { + "sheetId": { + "description": "The sheet ID on which the basic filter should be cleared.", + "type": "integer", + "format": "int32" + } + }, + "id": "ClearBasicFilterRequest" + }, + "BatchClearValuesResponse": { + "description": "The response when updating a range of values in a spreadsheet.", + "type": "object", + "properties": { + "spreadsheetId": { + "description": "The spreadsheet the updates were applied to.", + "type": "string" + }, + "clearedRanges": { + "description": "The ranges that were cleared, in A1 notation.\n(If the requests were for an unbounded range or a ranger larger\n than the bounds of the sheet, this will be the actual ranges\n that were cleared, bounded to the sheet's limits.)", + "type": "array", + "items": { + "type": "string" + } + } + }, + "id": "BatchClearValuesResponse" + }, + "ConditionalFormatRule": { + "description": "A rule describing a conditional format.", + "type": "object", + "properties": { + "gradientRule": { + "description": "The formatting will vary based on the gradients in the rule.", + "$ref": "GradientRule" + }, + "booleanRule": { + "description": "The formatting is either \"on\" or \"off\" according to the rule.", + "$ref": "BooleanRule" + }, + "ranges": { + "description": "The ranges that will be formatted if the condition is true.\nAll the ranges must be on the same grid.", + "type": "array", + "items": { + "$ref": "GridRange" + } + } + }, + "id": "ConditionalFormatRule" + }, + "UpdateBordersRequest": { + "description": "Updates the borders of a range.\nIf a field is not set in the request, that means the border remains as-is.\nFor example, with two subsequent UpdateBordersRequest:\n\n 1. range: A1:A5 `{ top: RED, bottom: WHITE }`\n 2. range: A1:A5 `{ left: BLUE }`\n\nThat would result in A1:A5 having a borders of\n`{ top: RED, bottom: WHITE, left: BLUE }`.\nIf you want to clear a border, explicitly set the style to\nNONE.", + "type": "object", + "properties": { + "right": { + "description": "The border to put at the right of the range.", + "$ref": "Border" + }, + "innerVertical": { + "description": "The vertical border to put within the range.", + "$ref": "Border" + }, + "top": { + "description": "The border to put at the top of the range.", + "$ref": "Border" + }, + "innerHorizontal": { + "description": "The horizontal border to put within the range.", + "$ref": "Border" + }, + "range": { + "description": "The range whose borders should be updated.", + "$ref": "GridRange" + }, + "bottom": { + "description": "The border to put at the bottom of the range.", + "$ref": "Border" + }, + "left": { + "description": "The border to put at the left of the range.", + "$ref": "Border" + } + }, + "id": "UpdateBordersRequest" + }, + "PivotFilterCriteria": { + "description": "Criteria for showing/hiding rows in a pivot table.", + "type": "object", + "properties": { + "visibleValues": { + "description": "Values that should be included. Values not listed here are excluded.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "id": "PivotFilterCriteria" + }, + "Borders": { + "description": "The borders of the cell.", + "type": "object", + "properties": { + "left": { + "description": "The left border of the cell.", + "$ref": "Border" + }, + "right": { + "description": "The right border of the cell.", + "$ref": "Border" + }, + "top": { + "description": "The top border of the cell.", + "$ref": "Border" + }, + "bottom": { + "description": "The bottom border of the cell.", + "$ref": "Border" + } + }, + "id": "Borders" + }, + "EmbeddedChart": { + "description": "A chart embedded in a sheet.", + "type": "object", + "properties": { + "chartId": { + "description": "The ID of the chart.", + "type": "integer", + "format": "int32" + }, + "position": { + "description": "The position of the chart.", + "$ref": "EmbeddedObjectPosition" + }, + "spec": { + "description": "The specification of the chart.", + "$ref": "ChartSpec" + } + }, + "id": "EmbeddedChart" + }, + "Color": { + "description": "Represents a color in the RGBA color space. This representation is designed\nfor simplicity of conversion to/from color representations in various\nlanguages over compactness; for example, the fields of this representation\ncan be trivially provided to the constructor of \"java.awt.Color\" in Java; it\ncan also be trivially provided to UIColor's \"+colorWithRed:green:blue:alpha\"\nmethod in iOS; and, with just a little work, it can be easily formatted into\na CSS \"rgba()\" string in JavaScript, as well. Here are some examples:\n\nExample (Java):\n\n import com.google.type.Color;\n\n // ...\n public static java.awt.Color fromProto(Color protocolor) {\n float alpha = protocolor.hasAlpha()\n ? protocolor.getAlpha().getValue()\n : 1.0;\n\n return new java.awt.Color(\n protocolor.getRed(),\n protocolor.getGreen(),\n protocolor.getBlue(),\n alpha);\n }\n\n public static Color toProto(java.awt.Color color) {\n float red = (float) color.getRed();\n float green = (float) color.getGreen();\n float blue = (float) color.getBlue();\n float denominator = 255.0;\n Color.Builder resultBuilder =\n Color\n .newBuilder()\n .setRed(red / denominator)\n .setGreen(green / denominator)\n .setBlue(blue / denominator);\n int alpha = color.getAlpha();\n if (alpha != 255) {\n result.setAlpha(\n FloatValue\n .newBuilder()\n .setValue(((float) alpha) / denominator)\n .build());\n }\n return resultBuilder.build();\n }\n // ...\n\nExample (iOS / Obj-C):\n\n // ...\n static UIColor* fromProto(Color* protocolor) {\n float red = [protocolor red];\n float green = [protocolor green];\n float blue = [protocolor blue];\n FloatValue* alpha_wrapper = [protocolor alpha];\n float alpha = 1.0;\n if (alpha_wrapper != nil) {\n alpha = [alpha_wrapper value];\n }\n return [UIColor colorWithRed:red green:green blue:blue alpha:alpha];\n }\n\n static Color* toProto(UIColor* color) {\n CGFloat red, green, blue, alpha;\n if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) {\n return nil;\n }\n Color* result = [Color alloc] init];\n [result setRed:red];\n [result setGreen:green];\n [result setBlue:blue];\n if (alpha \u003c= 0.9999) {\n [result setAlpha:floatWrapperWithValue(alpha)];\n }\n [result autorelease];\n return result;\n }\n // ...\n\n Example (JavaScript):\n\n // ...\n\n var protoToCssColor = function(rgb_color) {\n var redFrac = rgb_color.red || 0.0;\n var greenFrac = rgb_color.green || 0.0;\n var blueFrac = rgb_color.blue || 0.0;\n var red = Math.floor(redFrac * 255);\n var green = Math.floor(greenFrac * 255);\n var blue = Math.floor(blueFrac * 255);\n\n if (!('alpha' in rgb_color)) {\n return rgbToCssColor_(red, green, blue);\n }\n\n var alphaFrac = rgb_color.alpha.value || 0.0;\n var rgbParams = [red, green, blue].join(',');\n return ['rgba(', rgbParams, ',', alphaFrac, ')'].join('');\n };\n\n var rgbToCssColor_ = function(red, green, blue) {\n var rgbNumber = new Number((red \u003c\u003c 16) | (green \u003c\u003c 8) | blue);\n var hexString = rgbNumber.toString(16);\n var missingZeros = 6 - hexString.length;\n var resultBuilder = ['#'];\n for (var i = 0; i \u003c missingZeros; i++) {\n resultBuilder.push('0');\n }\n resultBuilder.push(hexString);\n return resultBuilder.join('');\n };\n\n // ...", + "type": "object", + "properties": { + "green": { + "description": "The amount of green in the color as a value in the interval [0, 1].", + "type": "number", + "format": "float" + }, + "blue": { + "description": "The amount of blue in the color as a value in the interval [0, 1].", + "type": "number", + "format": "float" + }, + "red": { + "description": "The amount of red in the color as a value in the interval [0, 1].", + "type": "number", + "format": "float" + }, + "alpha": { + "description": "The fraction of this color that should be applied to the pixel. That is,\nthe final pixel color is defined by the equation:\n\n pixel color = alpha * (this color) + (1.0 - alpha) * (background color)\n\nThis means that a value of 1.0 corresponds to a solid color, whereas\na value of 0.0 corresponds to a completely transparent color. This\nuses a wrapper message rather than a simple float scalar so that it is\npossible to distinguish between a default value and the value being unset.\nIf omitted, this color object is to be rendered as a solid color\n(as if the alpha value had been explicitly given with a value of 1.0).", + "type": "number", + "format": "float" + } + }, + "id": "Color" + }, + "AddSheetRequest": { + "description": "Adds a new sheet.\nWhen a sheet is added at a given index,\nall subsequent sheets' indexes are incremented.\nTo add an object sheet, use AddChartRequest instead and specify\nEmbeddedObjectPosition.sheetId or\nEmbeddedObjectPosition.newSheet.", + "type": "object", + "properties": { + "properties": { + "description": "The properties the new sheet should have.\nAll properties are optional.\nThe sheetId field is optional; if one is not\nset, an id will be randomly generated. (It is an error to specify the ID\nof a sheet that already exists.)", + "$ref": "SheetProperties" + } + }, + "id": "AddSheetRequest" + }, + "AddProtectedRangeRequest": { + "description": "Adds a new protected range.", + "type": "object", + "properties": { + "protectedRange": { + "description": "The protected range to be added. The\nprotectedRangeId field is optional; if\none is not set, an id will be randomly generated. (It is an error to\nspecify the ID of a range that already exists.)", + "$ref": "ProtectedRange" + } + }, + "id": "AddProtectedRangeRequest" + }, + "ValueRange": { + "description": "Data within a range of the spreadsheet.", + "type": "object", + "properties": { + "values": { + "description": "The data that was read or to be written. This is an array of arrays,\nthe outer array representing all the data and each inner array\nrepresenting a major dimension. Each item in the inner array\ncorresponds with one cell.\n\nFor output, empty trailing rows and columns will not be included.\n\nFor input, supported value types are: bool, string, and double.\nNull values will be skipped.\nTo set a cell to an empty value, set the string value to an empty string.", + "type": "array", + "items": { + "type": "array", + "items": { + "type": "any" + } + } + }, + "range": { + "description": "The range the values cover, in A1 notation.\nFor output, this range indicates the entire requested range,\neven though the values will exclude trailing rows and columns.\nWhen appending values, this field represents the range to search for a\ntable, after which values will be appended.", + "type": "string" + }, + "majorDimension": { + "description": "The major dimension of the values.\n\nFor output, if the spreadsheet data is: `A1=1,B1=2,A2=3,B2=4`,\nthen requesting `range=A1:B2,majorDimension=ROWS` will return\n`[[1,2],[3,4]]`,\nwhereas requesting `range=A1:B2,majorDimension=COLUMNS` will return\n`[[1,3],[2,4]]`.\n\nFor input, with `range=A1:B2,majorDimension=ROWS` then `[[1,2],[3,4]]`\nwill set `A1=1,B1=2,A2=3,B2=4`. With `range=A1:B2,majorDimension=COLUMNS`\nthen `[[1,2],[3,4]]` will set `A1=1,B1=3,A2=2,B2=4`.\n\nWhen writing, if this field is not set, it defaults to ROWS.", + "enum": [ + "DIMENSION_UNSPECIFIED", + "ROWS", + "COLUMNS" + ], + "enumDescriptions": [ + "The default value, do not use.", + "Operates on the rows of a sheet.", + "Operates on the columns of a sheet." + ], + "type": "string" + } + }, + "id": "ValueRange" + }, + "FindReplaceResponse": { + "description": "The result of the find/replace.", + "type": "object", + "properties": { + "valuesChanged": { + "description": "The number of non-formula cells changed.", + "type": "integer", + "format": "int32" + }, + "rowsChanged": { + "description": "The number of rows changed.", + "type": "integer", + "format": "int32" + }, + "occurrencesChanged": { + "description": "The number of occurrences (possibly multiple within a cell) changed.\nFor example, if replacing `\"e\"` with `\"o\"` in `\"Google Sheets\"`, this would\nbe `\"3\"` because `\"Google Sheets\"` -\u003e `\"Googlo Shoots\"`.", + "type": "integer", + "format": "int32" + }, + "formulasChanged": { + "description": "The number of formula cells changed.", + "type": "integer", + "format": "int32" + }, + "sheetsChanged": { + "description": "The number of sheets changed.", + "type": "integer", + "format": "int32" + } + }, + "id": "FindReplaceResponse" + }, + "AppendValuesResponse": { + "description": "The response when updating a range of values in a spreadsheet.", + "type": "object", + "properties": { + "spreadsheetId": { + "description": "The spreadsheet the updates were applied to.", + "type": "string" + }, + "tableRange": { + "description": "The range (in A1 notation) of the table that values are being appended to\n(before the values were appended).\nEmpty if no table was found.", + "type": "string" + }, + "updates": { + "description": "Information about the updates that were applied.", + "$ref": "UpdateValuesResponse" + } + }, + "id": "AppendValuesResponse" + }, + "CellFormat": { + "description": "The format of a cell.", + "type": "object", + "properties": { + "horizontalAlignment": { + "description": "The horizontal alignment of the value in the cell.", + "enum": [ + "HORIZONTAL_ALIGN_UNSPECIFIED", + "LEFT", + "CENTER", + "RIGHT" + ], + "enumDescriptions": [ + "The horizontal alignment is not specified. Do not use this.", + "The text is explicitly aligned to the left of the cell.", + "The text is explicitly aligned to the center of the cell.", + "The text is explicitly aligned to the right of the cell." + ], + "type": "string" + }, + "hyperlinkDisplayType": { + "description": "How a hyperlink, if it exists, should be displayed in the cell.", + "enum": [ + "HYPERLINK_DISPLAY_TYPE_UNSPECIFIED", + "LINKED", + "PLAIN_TEXT" + ], + "enumDescriptions": [ + "The default value: the hyperlink is rendered. Do not use this.", + "A hyperlink should be explicitly rendered.", + "A hyperlink should not be rendered." + ], + "type": "string" + }, + "borders": { + "description": "The borders of the cell.", + "$ref": "Borders" + }, + "textDirection": { + "description": "The direction of the text in the cell.", + "enum": [ + "TEXT_DIRECTION_UNSPECIFIED", + "LEFT_TO_RIGHT", + "RIGHT_TO_LEFT" + ], + "enumDescriptions": [ + "The text direction is not specified. Do not use this.", + "The text direction of left-to-right was set by the user.", + "The text direction of right-to-left was set by the user." + ], + "type": "string" + }, + "textFormat": { + "description": "The format of the text in the cell (unless overridden by a format run).", + "$ref": "TextFormat" + }, + "padding": { + "description": "The padding of the cell.", + "$ref": "Padding" + }, + "numberFormat": { + "description": "A format describing how number values should be represented to the user.", + "$ref": "NumberFormat" + }, + "wrapStrategy": { + "description": "The wrap strategy for the value in the cell.", + "enum": [ + "WRAP_STRATEGY_UNSPECIFIED", + "OVERFLOW_CELL", + "LEGACY_WRAP", + "CLIP", + "WRAP" + ], + "enumDescriptions": [ + "The default value, do not use.", + "Lines that are longer than the cell width will be written in the next\ncell over, so long as that cell is empty. If the next cell over is\nnon-empty, this behaves the same as CLIP. The text will never wrap\nto the next line unless the user manually inserts a new line.\nExample:\n\n | First sentence. |\n | Manual newline that is very long. \u003c- Text continues into next cell\n | Next newline. |", + "This wrap strategy represents the old Google Sheets wrap strategy where\nwords that are longer than a line are clipped rather than broken. This\nstrategy is not supported on all platforms and is being phased out.\nExample:\n\n | Cell has a |\n | loooooooooo| \u003c- Word is clipped.\n | word. |", + "Lines that are longer than the cell width will be clipped.\nThe text will never wrap to the next line unless the user manually\ninserts a new line.\nExample:\n\n | First sentence. |\n | Manual newline t| \u003c- Text is clipped\n | Next newline. |", + "Words that are longer than a line are wrapped at the character level\nrather than clipped.\nExample:\n\n | Cell has a |\n | loooooooooo| \u003c- Word is broken.\n | ong word. |" + ], + "type": "string" + }, + "backgroundColor": { + "description": "The background color of the cell.", + "$ref": "Color" + }, + "verticalAlignment": { + "description": "The vertical alignment of the value in the cell.", + "enum": [ + "VERTICAL_ALIGN_UNSPECIFIED", + "TOP", + "MIDDLE", + "BOTTOM" + ], + "enumDescriptions": [ + "The vertical alignment is not specified. Do not use this.", + "The text is explicitly aligned to the top of the cell.", + "The text is explicitly aligned to the middle of the cell.", + "The text is explicitly aligned to the bottom of the cell." + ], + "type": "string" + } + }, + "id": "CellFormat" + }, + "MoveDimensionRequest": { + "description": "Moves one or more rows or columns.", + "type": "object", + "properties": { + "source": { + "description": "The source dimensions to move.", + "$ref": "DimensionRange" + }, + "destinationIndex": { + "description": "The zero-based start index of where to move the source data to,\nbased on the coordinates *before* the source data is removed\nfrom the grid. Existing data will be shifted down or right\n(depending on the dimension) to make room for the moved dimensions.\nThe source dimensions are removed from the grid, so the\nthe data may end up in a different index than specified.\n\nFor example, given `A1..A5` of `0, 1, 2, 3, 4` and wanting to move\n`\"1\"` and `\"2\"` to between `\"3\"` and `\"4\"`, the source would be\n`ROWS [1..3)`,and the destination index would be `\"4\"`\n(the zero-based index of row 5).\nThe end result would be `A1..A5` of `0, 3, 1, 2, 4`.", + "type": "integer", + "format": "int32" + } + }, + "id": "MoveDimensionRequest" + }, + "BasicChartAxis": { + "description": "An axis of the chart.\nA chart may not have more than one axis per\naxis position.", + "type": "object", + "properties": { + "position": { + "description": "The position of this axis.", + "enum": [ + "BASIC_CHART_AXIS_POSITION_UNSPECIFIED", + "BOTTOM_AXIS", + "LEFT_AXIS", + "RIGHT_AXIS" + ], + "enumDescriptions": [ + "Default value, do not use.", + "The axis rendered at the bottom of a chart.\nFor most charts, this is the standard major axis.\nFor bar charts, this is a minor axis.", + "The axis rendered at the left of a chart.\nFor most charts, this is a minor axis.\nFor bar charts, this is the standard major axis.", + "The axis rendered at the right of a chart.\nFor most charts, this is a minor axis.\nFor bar charts, this is an unusual major axis." + ], + "type": "string" + }, + "title": { + "description": "The title of this axis. If set, this overrides any title inferred\nfrom headers of the data.", + "type": "string" + }, + "format": { + "description": "The format of the title.\nOnly valid if the axis is not associated with the domain.", + "$ref": "TextFormat" + } + }, + "id": "BasicChartAxis" + }, + "PivotGroupSortValueBucket": { + "description": "Information about which values in a pivot group should be used for sorting.", + "type": "object", + "properties": { + "buckets": { + "description": "Determines the bucket from which values are chosen to sort.\n\nFor example, in a pivot table with one row group & two column groups,\nthe row group can list up to two values. The first value corresponds\nto a value within the first column group, and the second value\ncorresponds to a value in the second column group. If no values\nare listed, this would indicate that the row should be sorted according\nto the \"Grand Total\" over the column groups. If a single value is listed,\nthis would correspond to using the \"Total\" of that bucket.", + "type": "array", + "items": { + "$ref": "ExtendedValue" + } + }, + "valuesIndex": { + "description": "The offset in the PivotTable.values list which the values in this\ngrouping should be sorted by.", + "type": "integer", + "format": "int32" + } + }, + "id": "PivotGroupSortValueBucket" + }, + "DimensionProperties": { + "description": "Properties about a dimension.", + "type": "object", + "properties": { + "hiddenByUser": { + "description": "True if this dimension is explicitly hidden.", + "type": "boolean" + }, + "pixelSize": { + "description": "The height (if a row) or width (if a column) of the dimension in pixels.", + "type": "integer", + "format": "int32" + }, + "hiddenByFilter": { + "description": "True if this dimension is being filtered.\nThis field is read-only.", + "type": "boolean" + } + }, + "id": "DimensionProperties" + }, + "EmbeddedObjectPosition": { + "description": "The position of an embedded object such as a chart.", + "type": "object", + "properties": { + "sheetId": { + "description": "The sheet this is on. Set only if the embedded object\nis on its own sheet. Must be non-negative.", + "type": "integer", + "format": "int32" + }, + "overlayPosition": { + "description": "The position at which the object is overlaid on top of a grid.", + "$ref": "OverlayPosition" + }, + "newSheet": { + "description": "If true, the embedded object will be put on a new sheet whose ID\nis chosen for you. Used only when writing.", + "type": "boolean" + } + }, + "id": "EmbeddedObjectPosition" + }, + "InterpolationPoint": { + "description": "A single interpolation point on a gradient conditional format.\nThese pin the gradient color scale according to the color,\ntype and value chosen.", + "type": "object", + "properties": { + "value": { + "description": "The value this interpolation point uses. May be a formula.\nUnused if type is MIN or\nMAX.", + "type": "string" + }, + "color": { + "description": "The color this interpolation point should use.", + "$ref": "Color" + }, + "type": { + "description": "How the value should be interpreted.", + "enum": [ + "INTERPOLATION_POINT_TYPE_UNSPECIFIED", + "MIN", + "MAX", + "NUMBER", + "PERCENT", + "PERCENTILE" + ], + "enumDescriptions": [ + "The default value, do not use.", + "The interpolation point will use the minimum value in the\ncells over the range of the conditional format.", + "The interpolation point will use the maximum value in the\ncells over the range of the conditional format.", + "The interpolation point will use exactly the value in\nInterpolationPoint.value.", + "The interpolation point will be the given percentage over\nall the cells in the range of the conditional format.\nThis is equivalent to NUMBER if the value was:\n`=(MAX(FLATTEN(range)) * (value / 100))\n + (MIN(FLATTEN(range)) * (1 - (value / 100)))`\n(where errors in the range are ignored when flattening).", + "The interpolation point will be the given percentile\nover all the cells in the range of the conditional format.\nThis is equivalent to NUMBER if the value was:\n`=PERCENTILE(FLATTEN(range), value / 100)`\n(where errors in the range are ignored when flattening)." + ], + "type": "string" + } + }, + "id": "InterpolationPoint" + }, + "ErrorValue": { + "description": "An error in a cell.", + "type": "object", + "properties": { + "type": { + "description": "The type of error.", + "enum": [ + "ERROR_TYPE_UNSPECIFIED", + "ERROR", + "NULL_VALUE", + "DIVIDE_BY_ZERO", + "VALUE", + "REF", + "NAME", + "NUM", + "N_A", + "LOADING" + ], + "enumDescriptions": [ + "The default error type, do not use this.", + "Corresponds to the `#ERROR!` error.", + "Corresponds to the `#NULL!` error.", + "Corresponds to the `#DIV/0` error.", + "Corresponds to the `#VALUE!` error.", + "Corresponds to the `#REF!` error.", + "Corresponds to the `#NAME?` error.", + "Corresponds to the `#NUM`! error.", + "Corresponds to the `#N/A` error.", + "Corresponds to the `Loading...` state." + ], + "type": "string" + }, + "message": { + "description": "A message with more information about the error\n(in the spreadsheet's locale).", + "type": "string" + } + }, + "id": "ErrorValue" + }, + "DuplicateFilterViewRequest": { + "description": "Duplicates a particular filter view.", + "type": "object", + "properties": { + "filterId": { + "description": "The ID of the filter being duplicated.", + "type": "integer", + "format": "int32" + } + }, + "id": "DuplicateFilterViewRequest" + }, + "BatchUpdateSpreadsheetRequest": { + "description": "The request for updating any aspect of a spreadsheet.", + "type": "object", + "properties": { + "includeSpreadsheetInResponse": { + "description": "Determines if the update response should include the spreadsheet\nresource.", + "type": "boolean" + }, + "requests": { + "description": "A list of updates to apply to the spreadsheet.", + "type": "array", + "items": { + "$ref": "Request" + } + }, + "responseRanges": { + "description": "Limits the ranges included in the response spreadsheet.\nMeaningful only if include_spreadsheet_response is 'true'.", + "type": "array", + "items": { + "type": "string" + } + }, + "responseIncludeGridData": { + "description": "True if grid data should be returned. Meaningful only if\nif include_spreadsheet_response is 'true'.\nThis parameter is ignored if a field mask was set in the request.", + "type": "boolean" + } + }, + "id": "BatchUpdateSpreadsheetRequest" + }, + "SheetProperties": { + "description": "Properties of a sheet.", + "type": "object", + "properties": { + "title": { + "description": "The name of the sheet.", + "type": "string" + }, + "index": { + "description": "The index of the sheet within the spreadsheet.\nWhen adding or updating sheet properties, if this field\nis excluded then the sheet will be added or moved to the end\nof the sheet list. When updating sheet indices or inserting\nsheets, movement is considered in \"before the move\" indexes.\nFor example, if there were 3 sheets (S1, S2, S3) in order to\nmove S1 ahead of S2 the index would have to be set to 2. A sheet\nindex update request will be ignored if the requested index is\nidentical to the sheets current index or if the requested new\nindex is equal to the current sheet index + 1.", + "type": "integer", + "format": "int32" + }, + "hidden": { + "description": "True if the sheet is hidden in the UI, false if it's visible.", + "type": "boolean" + }, + "gridProperties": { + "description": "Additional properties of the sheet if this sheet is a grid.\n(If the sheet is an object sheet, containing a chart or image, then\nthis field will be absent.)\nWhen writing it is an error to set any grid properties on non-grid sheets.", + "$ref": "GridProperties" + }, + "sheetId": { + "description": "The ID of the sheet. Must be non-negative.\nThis field cannot be changed once set.", + "type": "integer", + "format": "int32" + }, + "rightToLeft": { + "description": "True if the sheet is an RTL sheet instead of an LTR sheet.", + "type": "boolean" + }, + "tabColor": { + "description": "The color of the tab in the UI.", + "$ref": "Color" + }, + "sheetType": { + "description": "The type of sheet. Defaults to GRID.\nThis field cannot be changed once set.", + "enum": [ + "SHEET_TYPE_UNSPECIFIED", + "GRID", + "OBJECT" + ], + "enumDescriptions": [ + "Default value, do not use.", + "The sheet is a grid.", + "The sheet has no grid and instead has an object like a chart or image." + ], + "type": "string" + } + }, + "id": "SheetProperties" + }, + "ClearValuesRequest": { + "description": "The request for clearing a range of values in a spreadsheet.", + "type": "object", + "properties": {}, + "id": "ClearValuesRequest" + }, + "ProtectedRange": { + "description": "A protected range.", + "type": "object", + "properties": { + "unprotectedRanges": { + "description": "The list of unprotected ranges within a protected sheet.\nUnprotected ranges are only supported on protected sheets.", + "type": "array", + "items": { + "$ref": "GridRange" + } + }, + "description": { + "description": "The description of this protected range.", + "type": "string" + }, + "namedRangeId": { + "description": "The named range this protected range is backed by, if any.\n\nWhen writing, only one of range or named_range_id\nmay be set.", + "type": "string" + }, + "requestingUserCanEdit": { + "description": "True if the user who requested this protected range can edit the\nprotected area.\nThis field is read-only.", + "type": "boolean" + }, + "editors": { + "description": "The users and groups with edit access to the protected range.\nThis field is only visible to users with edit access to the protected\nrange and the document.\nEditors are not supported with warning_only protection.", + "$ref": "Editors" + }, + "protectedRangeId": { + "description": "The ID of the protected range.\nThis field is read-only.", + "type": "integer", + "format": "int32" + }, + "warningOnly": { + "description": "True if this protected range will show a warning when editing.\nWarning-based protection means that every user can edit data in the\nprotected range, except editing will prompt a warning asking the user\nto confirm the edit.\n\nWhen writing: if this field is true, then editors is ignored.\nAdditionally, if this field is changed from true to false and the\n`editors` field is not set (nor included in the field mask), then\nthe editors will be set to all the editors in the document.", + "type": "boolean" + }, + "range": { + "description": "The range that is being protected.\nThe range may be fully unbounded, in which case this is considered\na protected sheet.\n\nWhen writing, only one of range or named_range_id\nmay be set.", + "$ref": "GridRange" + } + }, + "id": "ProtectedRange" + }, + "DeleteConditionalFormatRuleRequest": { + "description": "Deletes a conditional format rule at the given index.\nAll subsequent rules' indexes are decremented.", + "type": "object", + "properties": { + "sheetId": { + "description": "The sheet the rule is being deleted from.", + "type": "integer", + "format": "int32" + }, + "index": { + "description": "The zero-based index of the rule to be deleted.", + "type": "integer", + "format": "int32" + } + }, + "id": "DeleteConditionalFormatRuleRequest" + }, + "ChartSpec": { + "description": "The specifications of a chart.", + "type": "object", + "properties": { + "hiddenDimensionStrategy": { + "description": "Determines how the charts will use hidden rows or columns.", + "enum": [ + "CHART_HIDDEN_DIMENSION_STRATEGY_UNSPECIFIED", + "SKIP_HIDDEN_ROWS_AND_COLUMNS", + "SKIP_HIDDEN_ROWS", + "SKIP_HIDDEN_COLUMNS", + "SHOW_ALL" + ], + "enumDescriptions": [ + "Default value, do not use.", + "Charts will skip hidden rows and columns.", + "Charts will skip hidden rows only.", + "Charts will skip hidden columns only.", + "Charts will not skip any hidden rows or columns." + ], + "type": "string" + }, + "basicChart": { + "description": "A basic chart specification, can be one of many kinds of charts.\nSee BasicChartType for the list of all\ncharts this supports.", + "$ref": "BasicChartSpec" + }, + "title": { + "description": "The title of the chart.", + "type": "string" + }, + "pieChart": { + "description": "A pie chart specification.", + "$ref": "PieChartSpec" + } + }, + "id": "ChartSpec" + }, + "SourceAndDestination": { + "description": "A combination of a source range and how to extend that source.", + "type": "object", + "properties": { + "source": { + "description": "The location of the data to use as the source of the autofill.", + "$ref": "GridRange" + }, + "fillLength": { + "description": "The number of rows or columns that data should be filled into.\nPositive numbers expand beyond the last row or last column\nof the source. Negative numbers expand before the first row\nor first column of the source.", + "type": "integer", + "format": "int32" + }, + "dimension": { + "description": "The dimension that data should be filled into.", + "enum": [ + "DIMENSION_UNSPECIFIED", + "ROWS", + "COLUMNS" + ], + "enumDescriptions": [ + "The default value, do not use.", + "Operates on the rows of a sheet.", + "Operates on the columns of a sheet." + ], + "type": "string" + } + }, + "id": "SourceAndDestination" + }, + "ConditionValue": { + "description": "The value of the condition.", + "type": "object", + "properties": { + "relativeDate": { + "description": "A relative date (based on the current date).\nValid only if the type is\nDATE_BEFORE,\nDATE_AFTER,\nDATE_ON_OR_BEFORE or\nDATE_ON_OR_AFTER.\n\nRelative dates are not supported in data validation.\nThey are supported only in conditional formatting and\nconditional filters.", + "enum": [ + "RELATIVE_DATE_UNSPECIFIED", + "PAST_YEAR", + "PAST_MONTH", + "PAST_WEEK", + "YESTERDAY", + "TODAY", + "TOMORROW" + ], + "enumDescriptions": [ + "Default value, do not use.", + "The value is one year before today.", + "The value is one month before today.", + "The value is one week before today.", + "The value is yesterday.", + "The value is today.", + "The value is tomorrow." + ], + "type": "string" + }, + "userEnteredValue": { + "description": "A value the condition is based on.\nThe value will be parsed as if the user typed into a cell.\nFormulas are supported (and must begin with an `=`).", + "type": "string" + } + }, + "id": "ConditionValue" + }, + "PasteDataRequest": { + "description": "Inserts data into the spreadsheet starting at the specified coordinate.", + "type": "object", + "properties": { + "data": { + "description": "The data to insert.", + "type": "string" + }, + "coordinate": { + "description": "The coordinate at which the data should start being inserted.", + "$ref": "GridCoordinate" + }, + "delimiter": { + "description": "The delimiter in the data.", + "type": "string" + }, + "type": { + "description": "How the data should be pasted.", + "enum": [ + "PASTE_NORMAL", + "PASTE_VALUES", + "PASTE_FORMAT", + "PASTE_NO_BORDERS", + "PASTE_FORMULA", + "PASTE_DATA_VALIDATION", + "PASTE_CONDITIONAL_FORMATTING" + ], + "enumDescriptions": [ + "Paste values, formulas, formats, and merges.", + "Paste the values ONLY without formats, formulas, or merges.", + "Paste the format and data validation only.", + "Like PASTE_NORMAL but without borders.", + "Paste the formulas only.", + "Paste the data validation only.", + "Paste the conditional formatting rules only." + ], + "type": "string" + }, + "html": { + "description": "True if the data is HTML.", + "type": "boolean" + } + }, + "id": "PasteDataRequest" + }, + "FindReplaceRequest": { + "description": "Finds and replaces data in cells over a range, sheet, or all sheets.", + "type": "object", + "properties": { + "find": { + "description": "The value to search.", + "type": "string" + }, + "replacement": { + "description": "The value to use as the replacement.", + "type": "string" + }, + "searchByRegex": { + "description": "True if the find value is a regex.\nThe regular expression and replacement should follow Java regex rules\nat https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html.\nThe replacement string is allowed to refer to capturing groups.\nFor example, if one cell has the contents `\"Google Sheets\"` and another\nhas `\"Google Docs\"`, then searching for `\"o.* (.*)\"` with a replacement of\n`\"$1 Rocks\"` would change the contents of the cells to\n`\"GSheets Rocks\"` and `\"GDocs Rocks\"` respectively.", + "type": "boolean" + }, + "sheetId": { + "description": "The sheet to find/replace over.", + "type": "integer", + "format": "int32" + }, + "allSheets": { + "description": "True to find/replace over all sheets.", + "type": "boolean" + }, + "matchCase": { + "description": "True if the search is case sensitive.", + "type": "boolean" + }, + "includeFormulas": { + "description": "True if the search should include cells with formulas.\nFalse to skip cells with formulas.", + "type": "boolean" + }, + "range": { + "description": "The range to find/replace over.", + "$ref": "GridRange" + }, + "matchEntireCell": { + "description": "True if the find value should match the entire cell.", + "type": "boolean" + } + }, + "id": "FindReplaceRequest" + }, + "SortSpec": { + "description": "A sort order associated with a specific column or row.", + "type": "object", + "properties": { + "sortOrder": { + "description": "The order data should be sorted.", + "enum": [ + "SORT_ORDER_UNSPECIFIED", + "ASCENDING", + "DESCENDING" + ], + "enumDescriptions": [ + "Default value, do not use this.", + "Sort ascending.", + "Sort descending." + ], + "type": "string" + }, + "dimensionIndex": { + "description": "The dimension the sort should be applied to.", + "type": "integer", + "format": "int32" + } + }, + "id": "SortSpec" + }, + "CopySheetToAnotherSpreadsheetRequest": { + "description": "The request to copy a sheet across spreadsheets.", + "type": "object", + "properties": { + "destinationSpreadsheetId": { + "description": "The ID of the spreadsheet to copy the sheet to.", + "type": "string" + } + }, + "id": "CopySheetToAnotherSpreadsheetRequest" + }, + "NumberFormat": { + "description": "The number format of a cell.", + "type": "object", + "properties": { + "pattern": { + "description": "Pattern string used for formatting. If not set, a default pattern based on\nthe user's locale will be used if necessary for the given type.\nSee the [Date and Number Formats guide](/sheets/guides/formats) for more\ninformation about the supported patterns.", + "type": "string" + }, + "type": { + "description": "The type of the number format.\nWhen writing, this field must be set.", + "enum": [ + "NUMBER_FORMAT_TYPE_UNSPECIFIED", + "TEXT", + "NUMBER", + "PERCENT", + "CURRENCY", + "DATE", + "TIME", + "DATE_TIME", + "SCIENTIFIC" + ], + "enumDescriptions": [ + "The number format is not specified\nand is based on the contents of the cell.\nDo not explicitly use this.", + "Text formatting, e.g `1000.12`", + "Number formatting, e.g, `1,000.12`", + "Percent formatting, e.g `10.12%`", + "Currency formatting, e.g `$1,000.12`", + "Date formatting, e.g `9/26/2008`", + "Time formatting, e.g `3:59:00 PM`", + "Date+Time formatting, e.g `9/26/08 15:59:00`", + "Scientific number formatting, e.g `1.01E+03`" + ], + "type": "string" + } + }, + "id": "NumberFormat" + }, + "BatchClearValuesRequest": { + "description": "The request for clearing more than one range of values in a spreadsheet.", + "type": "object", + "properties": { + "ranges": { + "description": "The ranges to clear, in A1 notation.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "id": "BatchClearValuesRequest" + }, + "UpdateDimensionPropertiesRequest": { + "description": "Updates properties of dimensions within the specified range.", + "type": "object", + "properties": { + "fields": { + "description": "The fields that should be updated. At least one field must be specified.\nThe root `properties` is implied and should not be specified.\nA single `\"*\"` can be used as short-hand for listing every field.", + "type": "string", + "format": "google-fieldmask" + }, + "range": { + "description": "The rows or columns to update.", + "$ref": "DimensionRange" + }, + "properties": { + "description": "Properties to update.", + "$ref": "DimensionProperties" + } + }, + "id": "UpdateDimensionPropertiesRequest" + }, + "Editors": { + "description": "The editors of a protected range.", + "type": "object", + "properties": { + "users": { + "description": "The email addresses of users with edit access to the protected range.", + "type": "array", + "items": { + "type": "string" + } + }, + "groups": { + "description": "The email addresses of groups with edit access to the protected range.", + "type": "array", + "items": { + "type": "string" + } + }, + "domainUsersCanEdit": { + "description": "True if anyone in the document's domain has edit access to the protected\nrange. Domain protection is only supported on documents within a domain.", + "type": "boolean" + } + }, + "id": "Editors" + }, + "Spreadsheet": { + "description": "Resource that represents a spreadsheet.", + "type": "object", + "properties": { + "spreadsheetId": { + "description": "The ID of the spreadsheet.\nThis field is read-only.", + "type": "string" + }, + "properties": { + "description": "Overall properties of a spreadsheet.", + "$ref": "SpreadsheetProperties" + }, + "spreadsheetUrl": { + "description": "The url of the spreadsheet.\nThis field is read-only.", + "type": "string" + }, + "sheets": { + "description": "The sheets that are part of a spreadsheet.", + "type": "array", + "items": { + "$ref": "Sheet" + } + }, + "namedRanges": { + "description": "The named ranges defined in a spreadsheet.", + "type": "array", + "items": { + "$ref": "NamedRange" + } + } + }, + "id": "Spreadsheet" + }, + "GridData": { + "description": "Data in the grid, as well as metadata about the dimensions.", + "type": "object", + "properties": { + "columnMetadata": { + "description": "Metadata about the requested columns in the grid, starting with the column\nin start_column.", + "type": "array", + "items": { + "$ref": "DimensionProperties" + } + }, + "rowData": { + "description": "The data in the grid, one entry per row,\nstarting with the row in startRow.\nThe values in RowData will correspond to columns starting\nat start_column.", + "type": "array", + "items": { + "$ref": "RowData" + } + }, + "startRow": { + "description": "The first row this GridData refers to, zero-based.", + "type": "integer", + "format": "int32" + }, + "rowMetadata": { + "description": "Metadata about the requested rows in the grid, starting with the row\nin start_row.", + "type": "array", + "items": { + "$ref": "DimensionProperties" + } + }, + "startColumn": { + "description": "The first column this GridData refers to, zero-based.", + "type": "integer", + "format": "int32" + } + }, + "id": "GridData" + }, + "PivotValue": { + "description": "The definition of how a value in a pivot table should be calculated.", + "type": "object", + "properties": { + "formula": { + "description": "A custom formula to calculate the value. The formula must start\nwith an `=` character.", + "type": "string" + }, + "sourceColumnOffset": { + "description": "The column offset of the source range that this value reads from.\n\nFor example, if the source was `C10:E15`, a `sourceColumnOffset` of `0`\nmeans this value refers to column `C`, whereas the offset `1` would\nrefer to column `D`.", + "type": "integer", + "format": "int32" + }, + "summarizeFunction": { + "description": "A function to summarize the value.\nIf formula is set, the only supported values are\nSUM and\nCUSTOM.\nIf sourceColumnOffset is set, then `CUSTOM`\nis not supported.", + "enum": [ + "PIVOT_STANDARD_VALUE_FUNCTION_UNSPECIFIED", + "SUM", + "COUNTA", + "COUNT", + "COUNTUNIQUE", + "AVERAGE", + "MAX", + "MIN", + "MEDIAN", + "PRODUCT", + "STDEV", + "STDEVP", + "VAR", + "VARP", + "CUSTOM" + ], + "enumDescriptions": [ + "The default, do not use.", + "Corresponds to the `SUM` function.", + "Corresponds to the `COUNTA` function.", + "Corresponds to the `COUNT` function.", + "Corresponds to the `COUNTUNIQUE` function.", + "Corresponds to the `AVERAGE` function.", + "Corresponds to the `MAX` function.", + "Corresponds to the `MIN` function.", + "Corresponds to the `MEDIAN` function.", + "Corresponds to the `PRODUCT` function.", + "Corresponds to the `STDEV` function.", + "Corresponds to the `STDEVP` function.", + "Corresponds to the `VAR` function.", + "Corresponds to the `VARP` function.", + "Indicates the formula should be used as-is.\nOnly valid if PivotValue.formula was set." + ], + "type": "string" + }, + "name": { + "description": "A name to use for the value. This is only used if formula was set.\nOtherwise, the column name is used.", + "type": "string" + } + }, + "id": "PivotValue" + }, + "DeleteBandingRequest": { + "description": "Removes the banded range with the given ID from the spreadsheet.", + "type": "object", + "properties": { + "bandedRangeId": { + "description": "The ID of the banded range to delete.", + "type": "integer", + "format": "int32" + } + }, + "id": "DeleteBandingRequest" + }, + "BasicFilter": { + "description": "The default filter associated with a sheet.", + "type": "object", + "properties": { + "criteria": { + "description": "The criteria for showing/hiding values per column.\nThe map's key is the column index, and the value is the criteria for\nthat column.", + "additionalProperties": { + "$ref": "FilterCriteria" + }, + "type": "object" + }, + "range": { + "description": "The range the filter covers.", + "$ref": "GridRange" + }, + "sortSpecs": { + "description": "The sort order per column. Later specifications are used when values\nare equal in the earlier specifications.", + "type": "array", + "items": { + "$ref": "SortSpec" + } + } + }, + "id": "BasicFilter" + }, + "DuplicateSheetRequest": { + "description": "Duplicates the contents of a sheet.", + "type": "object", + "properties": { + "sourceSheetId": { + "description": "The sheet to duplicate.", + "type": "integer", + "format": "int32" + }, + "newSheetId": { + "description": "If set, the ID of the new sheet. If not set, an ID is chosen.\nIf set, the ID must not conflict with any existing sheet ID.\nIf set, it must be non-negative.", + "type": "integer", + "format": "int32" + }, + "insertSheetIndex": { + "description": "The zero-based index where the new sheet should be inserted.\nThe index of all sheets after this are incremented.", + "type": "integer", + "format": "int32" + }, + "newSheetName": { + "description": "The name of the new sheet. If empty, a new name is chosen for you.", + "type": "string" + } + }, + "id": "DuplicateSheetRequest" + }, + "AddFilterViewResponse": { + "description": "The result of adding a filter view.", + "type": "object", + "properties": { + "filter": { + "description": "The newly added filter view.", + "$ref": "FilterView" + } + }, + "id": "AddFilterViewResponse" + }, + "DuplicateSheetResponse": { + "description": "The result of duplicating a sheet.", + "type": "object", + "properties": { + "properties": { + "description": "The properties of the duplicate sheet.", + "$ref": "SheetProperties" + } + }, + "id": "DuplicateSheetResponse" + }, + "Border": { + "description": "A border along a cell.", + "type": "object", + "properties": { + "style": { + "description": "The style of the border.", + "enum": [ + "STYLE_UNSPECIFIED", + "DOTTED", + "DASHED", + "SOLID", + "SOLID_MEDIUM", + "SOLID_THICK", + "NONE", + "DOUBLE" + ], + "enumDescriptions": [ + "The style is not specified. Do not use this.", + "The border is dotted.", + "The border is dashed.", + "The border is a thin solid line.", + "The border is a medium solid line.", + "The border is a thick solid line.", + "No border.\nUsed only when updating a border in order to erase it.", + "The border is two solid lines." + ], + "type": "string" + }, + "width": { + "description": "The width of the border, in pixels.\nDeprecated; the width is determined by the \"style\" field.", + "type": "integer", + "format": "int32" + }, + "color": { + "description": "The color of the border.", + "$ref": "Color" + } + }, + "id": "Border" + }, + "AddNamedRangeRequest": { + "description": "Adds a named range to the spreadsheet.", + "type": "object", + "properties": { + "namedRange": { + "description": "The named range to add. The namedRangeId\nfield is optional; if one is not set, an id will be randomly generated. (It\nis an error to specify the ID of a range that already exists.)", + "$ref": "NamedRange" + } + }, + "id": "AddNamedRangeRequest" + }, + "AddChartResponse": { + "description": "The result of adding a chart to a spreadsheet.", + "type": "object", + "properties": { + "chart": { + "description": "The newly added chart.", + "$ref": "EmbeddedChart" + } + }, + "id": "AddChartResponse" + }, + "AddBandingRequest": { + "description": "Adds a new banded range to the spreadsheet.", + "type": "object", + "properties": { + "bandedRange": { + "description": "The banded range to add. The bandedRangeId\nfield is optional; if one is not set, an id will be randomly generated. (It\nis an error to specify the ID of a range that already exists.)", + "$ref": "BandedRange" + } + }, + "id": "AddBandingRequest" + }, + "AppendCellsRequest": { + "description": "Adds new cells after the last row with data in a sheet,\ninserting new rows into the sheet if necessary.", + "type": "object", + "properties": { + "sheetId": { + "description": "The sheet ID to append the data to.", + "type": "integer", + "format": "int32" + }, + "rows": { + "description": "The data to append.", + "type": "array", + "items": { + "$ref": "RowData" + } + }, + "fields": { + "description": "The fields of CellData that should be updated.\nAt least one field must be specified.\nThe root is the CellData; 'row.values.' should not be specified.\nA single `\"*\"` can be used as short-hand for listing every field.", + "type": "string", + "format": "google-fieldmask" + } + }, + "id": "AppendCellsRequest" + }, + "RowData": { + "description": "Data about each cell in a row.", + "type": "object", + "properties": { + "values": { + "description": "The values in the row, one per column.", + "type": "array", + "items": { + "$ref": "CellData" + } + } + }, + "id": "RowData" + }, + "BasicChartSeries": { + "description": "A single series of data in a chart.\nFor example, if charting stock prices over time, multiple series may exist,\none for the \"Open Price\", \"High Price\", \"Low Price\" and \"Close Price\".", + "type": "object", + "properties": { + "series": { + "description": "The data being visualized in this chart series.", + "$ref": "ChartData" + }, + "targetAxis": { + "description": "The minor axis that will specify the range of values for this series.\nFor example, if charting stocks over time, the \"Volume\" series\nmay want to be pinned to the right with the prices pinned to the left,\nbecause the scale of trading volume is different than the scale of\nprices.\nIt is an error to specify an axis that isn't a valid minor axis\nfor the chart's type.", + "enum": [ + "BASIC_CHART_AXIS_POSITION_UNSPECIFIED", + "BOTTOM_AXIS", + "LEFT_AXIS", + "RIGHT_AXIS" + ], + "enumDescriptions": [ + "Default value, do not use.", + "The axis rendered at the bottom of a chart.\nFor most charts, this is the standard major axis.\nFor bar charts, this is a minor axis.", + "The axis rendered at the left of a chart.\nFor most charts, this is a minor axis.\nFor bar charts, this is the standard major axis.", + "The axis rendered at the right of a chart.\nFor most charts, this is a minor axis.\nFor bar charts, this is an unusual major axis." + ], + "type": "string" + }, + "type": { + "description": "The type of this series. Valid only if the\nchartType is\nCOMBO.\nDifferent types will change the way the series is visualized.\nOnly LINE, AREA,\nand COLUMN are supported.", + "enum": [ + "BASIC_CHART_TYPE_UNSPECIFIED", + "BAR", + "LINE", + "AREA", + "COLUMN", + "SCATTER", + "COMBO" + ], + "enumDescriptions": [ + "Default value, do not use.", + "A \u003ca href=\"/chart/interactive/docs/gallery/barchart\"\u003ebar chart\u003c/a\u003e.", + "A \u003ca href=\"/chart/interactive/docs/gallery/linechart\"\u003eline chart\u003c/a\u003e.", + "An \u003ca href=\"/chart/interactive/docs/gallery/areachart\"\u003earea chart\u003c/a\u003e.", + "A \u003ca href=\"/chart/interactive/docs/gallery/columnchart\"\u003ecolumn chart\u003c/a\u003e.", + "A \u003ca href=\"/chart/interactive/docs/gallery/scatterchart\"\u003escatter chart\u003c/a\u003e.", + "A \u003ca href=\"/chart/interactive/docs/gallery/combochart\"\u003ecombo chart\u003c/a\u003e." + ], + "type": "string" + } + }, + "id": "BasicChartSeries" + }, + "RepeatCellRequest": { + "description": "Updates all cells in the range to the values in the given Cell object.\nOnly the fields listed in the fields field are updated; others are\nunchanged.\n\nIf writing a cell with a formula, the formula's ranges will automatically\nincrement for each field in the range.\nFor example, if writing a cell with formula `=A1` into range B2:C4,\nB2 would be `=A1`, B3 would be `=A2`, B4 would be `=A3`,\nC2 would be `=B1`, C3 would be `=B2`, C4 would be `=B3`.\n\nTo keep the formula's ranges static, use the `$` indicator.\nFor example, use the formula `=$A$1` to prevent both the row and the\ncolumn from incrementing.", + "type": "object", + "properties": { + "cell": { + "description": "The data to write.", + "$ref": "CellData" + }, + "fields": { + "description": "The fields that should be updated. At least one field must be specified.\nThe root `cell` is implied and should not be specified.\nA single `\"*\"` can be used as short-hand for listing every field.", + "type": "string", + "format": "google-fieldmask" + }, + "range": { + "description": "The range to repeat the cell in.", + "$ref": "GridRange" + } + }, + "id": "RepeatCellRequest" + }, + "BasicChartSpec": { + "description": "The specification for a basic chart. See BasicChartType for the list\nof charts this supports.", + "type": "object", + "properties": { + "chartType": { + "description": "The type of the chart.", + "enum": [ + "BASIC_CHART_TYPE_UNSPECIFIED", + "BAR", + "LINE", + "AREA", + "COLUMN", + "SCATTER", + "COMBO" + ], + "enumDescriptions": [ + "Default value, do not use.", + "A \u003ca href=\"/chart/interactive/docs/gallery/barchart\"\u003ebar chart\u003c/a\u003e.", + "A \u003ca href=\"/chart/interactive/docs/gallery/linechart\"\u003eline chart\u003c/a\u003e.", + "An \u003ca href=\"/chart/interactive/docs/gallery/areachart\"\u003earea chart\u003c/a\u003e.", + "A \u003ca href=\"/chart/interactive/docs/gallery/columnchart\"\u003ecolumn chart\u003c/a\u003e.", + "A \u003ca href=\"/chart/interactive/docs/gallery/scatterchart\"\u003escatter chart\u003c/a\u003e.", + "A \u003ca href=\"/chart/interactive/docs/gallery/combochart\"\u003ecombo chart\u003c/a\u003e." + ], + "type": "string" + }, + "domains": { + "description": "The domain of data this is charting.\nOnly a single domain is currently supported.", + "type": "array", + "items": { + "$ref": "BasicChartDomain" + } + }, + "headerCount": { + "description": "The number of rows or columns in the data that are \"headers\".\nIf not set, Google Sheets will guess how many rows are headers based\non the data.\n\n(Note that BasicChartAxis.title may override the axis title\n inferred from the header values.)", + "type": "integer", + "format": "int32" + }, + "series": { + "description": "The data this chart is visualizing.", + "type": "array", + "items": { + "$ref": "BasicChartSeries" + } + }, + "legendPosition": { + "description": "The position of the chart legend.", + "enum": [ + "BASIC_CHART_LEGEND_POSITION_UNSPECIFIED", + "BOTTOM_LEGEND", + "LEFT_LEGEND", + "RIGHT_LEGEND", + "TOP_LEGEND", + "NO_LEGEND" + ], + "enumDescriptions": [ + "Default value, do not use.", + "The legend is rendered on the bottom of the chart.", + "The legend is rendered on the left of the chart.", + "The legend is rendered on the right of the chart.", + "The legend is rendered on the top of the chart.", + "No legend is rendered." + ], + "type": "string" + }, + "axis": { + "description": "The axis on the chart.", + "type": "array", + "items": { + "$ref": "BasicChartAxis" + } + } + }, + "id": "BasicChartSpec" + }, + "NamedRange": { + "description": "A named range.", + "type": "object", + "properties": { + "namedRangeId": { + "description": "The ID of the named range.", + "type": "string" + }, + "range": { + "description": "The range this represents.", + "$ref": "GridRange" + }, + "name": { + "description": "The name of the named range.", + "type": "string" + } + }, + "id": "NamedRange" + }, + "UpdateEmbeddedObjectPositionRequest": { + "description": "Update an embedded object's position (such as a moving or resizing a\nchart or image).", + "type": "object", + "properties": { + "newPosition": { + "description": "An explicit position to move the embedded object to.\nIf newPosition.sheetId is set,\na new sheet with that ID will be created.\nIf newPosition.newSheet is set to true,\na new sheet will be created with an ID that will be chosen for you.", + "$ref": "EmbeddedObjectPosition" + }, + "objectId": { + "description": "The ID of the object to moved.", + "type": "integer", + "format": "int32" + }, + "fields": { + "description": "The fields of OverlayPosition\nthat should be updated when setting a new position. Used only if\nnewPosition.overlayPosition\nis set, in which case at least one field must\nbe specified. The root `newPosition.overlayPosition` is implied and\nshould not be specified.\nA single `\"*\"` can be used as short-hand for listing every field.", + "type": "string", + "format": "google-fieldmask" + } + }, + "id": "UpdateEmbeddedObjectPositionRequest" + }, + "SetBasicFilterRequest": { + "description": "Sets the basic filter associated with a sheet.", + "type": "object", + "properties": { + "filter": { + "description": "The filter to set.", + "$ref": "BasicFilter" + } + }, + "id": "SetBasicFilterRequest" + }, + "AutoResizeDimensionsRequest": { + "description": "Automatically resizes one or more dimensions based on the contents\nof the cells in that dimension.", + "type": "object", + "properties": { + "dimensions": { + "description": "The dimensions to automatically resize.\nOnly COLUMNS are supported.", + "$ref": "DimensionRange" + } + }, + "id": "AutoResizeDimensionsRequest" + }, + "DuplicateFilterViewResponse": { + "description": "The result of a filter view being duplicated.", + "type": "object", + "properties": { + "filter": { + "description": "The newly created filter.", + "$ref": "FilterView" + } + }, + "id": "DuplicateFilterViewResponse" + }, + "BandingProperties": { + "description": "Properties referring a single dimension (either row or column). If both\nBandedRange.row_properties and BandedRange.column_properties are\nset, the fill colors are applied to cells according to the following rules:\n\n* header_color and footer_color take priority over band colors.\n* first_band_color takes priority over second_band_color.\n* row_properties takes priority over column_properties.\n\nFor example, the first row color takes priority over the first column\ncolor, but the first column color takes priority over the second row color.\nSimilarly, the row header takes priority over the column header in the\ntop left cell, but the column header takes priority over the first row\ncolor if the row header is not set.", + "type": "object", + "properties": { + "footerColor": { + "description": "The color of the last row or column. If this field is not set, the last\nrow or column will be filled with either first_row_color or\nsecond_row_color, depending on the color of the previous row or\ncolumn.", + "$ref": "Color" + }, + "headerColor": { + "description": "The color of the first row or column. If this field is set, the first\nrow or column will be filled with this color and the colors will\nalternate between first_band_color and [second_band_color[] starting\nfrom the second row or column. Otherwise, the first row or column will be\nfilled with first_band_color and the colors will proceed to alternate\nas they normally would.", + "$ref": "Color" + }, + "secondBandColor": { + "description": "The second color that is alternating. (Required)", + "$ref": "Color" + }, + "firstBandColor": { + "description": "The first color that is alternating. (Required)", + "$ref": "Color" + } + }, + "id": "BandingProperties" + }, + "PivotGroup": { + "description": "A single grouping (either row or column) in a pivot table.", + "type": "object", + "properties": { + "sortOrder": { + "description": "The order the values in this group should be sorted.", + "enum": [ + "SORT_ORDER_UNSPECIFIED", + "ASCENDING", + "DESCENDING" + ], + "enumDescriptions": [ + "Default value, do not use this.", + "Sort ascending.", + "Sort descending." + ], + "type": "string" + }, + "sourceColumnOffset": { + "description": "The column offset of the source range that this grouping is based on.\n\nFor example, if the source was `C10:E15`, a `sourceColumnOffset` of `0`\nmeans this group refers to column `C`, whereas the offset `1` would refer\nto column `D`.", + "type": "integer", + "format": "int32" + }, + "showTotals": { + "description": "True if the pivot table should include the totals for this grouping.", + "type": "boolean" + }, + "valueBucket": { + "description": "The bucket of the opposite pivot group to sort by.\nIf not specified, sorting is alphabetical by this group's values.", + "$ref": "PivotGroupSortValueBucket" + }, + "valueMetadata": { + "description": "Metadata about values in the grouping.", + "type": "array", + "items": { + "$ref": "PivotGroupValueMetadata" + } + } + }, + "id": "PivotGroup" + }, + "GridRange": { + "description": "A range on a sheet.\nAll indexes are zero-based.\nIndexes are half open, e.g the start index is inclusive\nand the end index is exclusive -- [start_index, end_index).\nMissing indexes indicate the range is unbounded on that side.\n\nFor example, if `\"Sheet1\"` is sheet ID 0, then:\n\n `Sheet1!A1:A1 == sheet_id: 0,\n start_row_index: 0, end_row_index: 1,\n start_column_index: 0, end_column_index: 1`\n\n `Sheet1!A3:B4 == sheet_id: 0,\n start_row_index: 2, end_row_index: 4,\n start_column_index: 0, end_column_index: 2`\n\n `Sheet1!A:B == sheet_id: 0,\n start_column_index: 0, end_column_index: 2`\n\n `Sheet1!A5:B == sheet_id: 0,\n start_row_index: 4,\n start_column_index: 0, end_column_index: 2`\n\n `Sheet1 == sheet_id:0`\n\nThe start index must always be less than or equal to the end index.\nIf the start index equals the end index, then the range is empty.\nEmpty ranges are typically not meaningful and are usually rendered in the\nUI as `#REF!`.", + "type": "object", + "properties": { + "sheetId": { + "description": "The sheet this range is on.", + "type": "integer", + "format": "int32" + }, + "startColumnIndex": { + "description": "The start column (inclusive) of the range, or not set if unbounded.", + "type": "integer", + "format": "int32" + }, + "startRowIndex": { + "description": "The start row (inclusive) of the range, or not set if unbounded.", + "type": "integer", + "format": "int32" + }, + "endRowIndex": { + "description": "The end row (exclusive) of the range, or not set if unbounded.", + "type": "integer", + "format": "int32" + }, + "endColumnIndex": { + "description": "The end column (exclusive) of the range, or not set if unbounded.", + "type": "integer", + "format": "int32" + } + }, + "id": "GridRange" + }, + "DeleteSheetRequest": { + "description": "Deletes the requested sheet.", + "type": "object", + "properties": { + "sheetId": { + "description": "The ID of the sheet to delete.", + "type": "integer", + "format": "int32" + } + }, + "id": "DeleteSheetRequest" + }, + "UpdateBandingRequest": { + "description": "Updates properties of the supplied banded range.", + "type": "object", + "properties": { + "bandedRange": { + "description": "The banded range to update with the new properties.", + "$ref": "BandedRange" + }, + "fields": { + "description": "The fields that should be updated. At least one field must be specified.\nThe root `bandedRange` is implied and should not be specified.\nA single `\"*\"` can be used as short-hand for listing every field.", + "type": "string", + "format": "google-fieldmask" + } + }, + "id": "UpdateBandingRequest" + }, + "ChartData": { + "description": "The data included in a domain or series.", + "type": "object", + "properties": { + "sourceRange": { + "description": "The source ranges of the data.", + "$ref": "ChartSourceRange" + } + }, + "id": "ChartData" + }, + "Sheet": { + "description": "A sheet in a spreadsheet.", + "type": "object", + "properties": { + "properties": { + "description": "The properties of the sheet.", + "$ref": "SheetProperties" + }, + "charts": { + "description": "The specifications of every chart on this sheet.", + "type": "array", + "items": { + "$ref": "EmbeddedChart" + } + }, + "filterViews": { + "description": "The filter views in this sheet.", + "type": "array", + "items": { + "$ref": "FilterView" + } + }, + "conditionalFormats": { + "description": "The conditional format rules in this sheet.", + "type": "array", + "items": { + "$ref": "ConditionalFormatRule" + } + }, + "protectedRanges": { + "description": "The protected ranges in this sheet.", + "type": "array", + "items": { + "$ref": "ProtectedRange" + } + }, + "basicFilter": { + "description": "The filter on this sheet, if any.", + "$ref": "BasicFilter" + }, + "merges": { + "description": "The ranges that are merged together.", + "type": "array", + "items": { + "$ref": "GridRange" + } + }, + "data": { + "description": "Data in the grid, if this is a grid sheet.\nThe number of GridData objects returned is dependent on the number of\nranges requested on this sheet. For example, if this is representing\n`Sheet1`, and the spreadsheet was requested with ranges\n`Sheet1!A1:C10` and `Sheet1!D15:E20`, then the first GridData will have a\nstartRow/startColumn of `0`,\nwhile the second one will have `startRow 14` (zero-based row 15),\nand `startColumn 3` (zero-based column D).", + "type": "array", + "items": { + "$ref": "GridData" + } + }, + "bandedRanges": { + "description": "The banded (i.e. alternating colors) ranges on this sheet.", + "type": "array", + "items": { + "$ref": "BandedRange" + } + } + }, + "id": "Sheet" + }, + "CopyPasteRequest": { + "description": "Copies data from the source to the destination.", + "type": "object", + "properties": { + "pasteType": { + "description": "What kind of data to paste.", + "enum": [ + "PASTE_NORMAL", + "PASTE_VALUES", + "PASTE_FORMAT", + "PASTE_NO_BORDERS", + "PASTE_FORMULA", + "PASTE_DATA_VALIDATION", + "PASTE_CONDITIONAL_FORMATTING" + ], + "enumDescriptions": [ + "Paste values, formulas, formats, and merges.", + "Paste the values ONLY without formats, formulas, or merges.", + "Paste the format and data validation only.", + "Like PASTE_NORMAL but without borders.", + "Paste the formulas only.", + "Paste the data validation only.", + "Paste the conditional formatting rules only." + ], + "type": "string" + }, + "pasteOrientation": { + "description": "How that data should be oriented when pasting.", + "enum": [ + "NORMAL", + "TRANSPOSE" + ], + "enumDescriptions": [ + "Paste normally.", + "Paste transposed, where all rows become columns and vice versa." + ], + "type": "string" + }, + "source": { + "description": "The source range to copy.", + "$ref": "GridRange" + }, + "destination": { + "description": "The location to paste to. If the range covers a span that's\na multiple of the source's height or width, then the\ndata will be repeated to fill in the destination range.\nIf the range is smaller than the source range, the entire\nsource data will still be copied (beyond the end of the destination range).", + "$ref": "GridRange" + } + }, + "id": "CopyPasteRequest" + }, + "UpdateCellsRequest": { + "description": "Updates all cells in a range with new data.", + "type": "object", + "properties": { + "rows": { + "description": "The data to write.", + "type": "array", + "items": { + "$ref": "RowData" + } + }, + "fields": { + "description": "The fields of CellData that should be updated.\nAt least one field must be specified.\nThe root is the CellData; 'row.values.' should not be specified.\nA single `\"*\"` can be used as short-hand for listing every field.", + "type": "string", + "format": "google-fieldmask" + }, + "start": { + "description": "The coordinate to start writing data at.\nAny number of rows and columns (including a different number of\ncolumns per row) may be written.", + "$ref": "GridCoordinate" + }, + "range": { + "description": "The range to write data to.\n\nIf the data in rows does not cover the entire requested range,\nthe fields matching those set in fields will be cleared.", + "$ref": "GridRange" + } + }, + "id": "UpdateCellsRequest" + }, + "ExtendedValue": { + "description": "The kinds of value that a cell in a spreadsheet can have.", + "type": "object", + "properties": { + "formulaValue": { + "description": "Represents a formula.", + "type": "string" + }, + "errorValue": { + "description": "Represents an error.\nThis field is read-only.", + "$ref": "ErrorValue" + }, + "boolValue": { + "description": "Represents a boolean value.", + "type": "boolean" + }, + "numberValue": { + "description": "Represents a double value.\nNote: Dates, Times and DateTimes are represented as doubles in\n\"serial number\" format.", + "type": "number", + "format": "double" + }, + "stringValue": { + "description": "Represents a string value.\nLeading single quotes are not included. For example, if the user typed\n`'123` into the UI, this would be represented as a `stringValue` of\n`\"123\"`.", + "type": "string" + } + }, + "id": "ExtendedValue" + }, + "BatchUpdateSpreadsheetResponse": { + "description": "The reply for batch updating a spreadsheet.", + "type": "object", + "properties": { + "spreadsheetId": { + "description": "The spreadsheet the updates were applied to.", + "type": "string" + }, + "updatedSpreadsheet": { + "description": "The spreadsheet after updates were applied. This is only set if\n[BatchUpdateSpreadsheetRequest.include_spreadsheet_in_response] is `true`.", + "$ref": "Spreadsheet" + }, + "replies": { + "description": "The reply of the updates. This maps 1:1 with the updates, although\nreplies to some requests may be empty.", + "type": "array", + "items": { + "$ref": "Response" + } + } + }, + "id": "BatchUpdateSpreadsheetResponse" + }, + "GradientRule": { + "description": "A rule that applies a gradient color scale format, based on\nthe interpolation points listed. The format of a cell will vary\nbased on its contents as compared to the values of the interpolation\npoints.", + "type": "object", + "properties": { + "maxpoint": { + "description": "The final interpolation point.", + "$ref": "InterpolationPoint" + }, + "midpoint": { + "description": "An optional midway interpolation point.", + "$ref": "InterpolationPoint" + }, + "minpoint": { + "description": "The starting interpolation point.", + "$ref": "InterpolationPoint" + } + }, + "id": "GradientRule" + }, + "CutPasteRequest": { + "description": "Moves data from the source to the destination.", + "type": "object", + "properties": { + "pasteType": { + "description": "What kind of data to paste. All the source data will be cut, regardless\nof what is pasted.", + "enum": [ + "PASTE_NORMAL", + "PASTE_VALUES", + "PASTE_FORMAT", + "PASTE_NO_BORDERS", + "PASTE_FORMULA", + "PASTE_DATA_VALIDATION", + "PASTE_CONDITIONAL_FORMATTING" + ], + "enumDescriptions": [ + "Paste values, formulas, formats, and merges.", + "Paste the values ONLY without formats, formulas, or merges.", + "Paste the format and data validation only.", + "Like PASTE_NORMAL but without borders.", + "Paste the formulas only.", + "Paste the data validation only.", + "Paste the conditional formatting rules only." + ], + "type": "string" + }, + "source": { + "description": "The source data to cut.", + "$ref": "GridRange" + }, + "destination": { + "description": "The top-left coordinate where the data should be pasted.", + "$ref": "GridCoordinate" + } + }, + "id": "CutPasteRequest" + }, + "OverlayPosition": { + "description": "The location an object is overlaid on top of a grid.", + "type": "object", + "properties": { + "widthPixels": { + "description": "The width of the object, in pixels. Defaults to 600.", + "type": "integer", + "format": "int32" + }, + "anchorCell": { + "description": "The cell the object is anchored to.", + "$ref": "GridCoordinate" + }, + "offsetXPixels": { + "description": "The horizontal offset, in pixels, that the object is offset\nfrom the anchor cell.", + "type": "integer", + "format": "int32" + }, + "heightPixels": { + "description": "The height of the object, in pixels. Defaults to 371.", + "type": "integer", + "format": "int32" + }, + "offsetYPixels": { + "description": "The vertical offset, in pixels, that the object is offset\nfrom the anchor cell.", + "type": "integer", + "format": "int32" + } + }, + "id": "OverlayPosition" + }, + "AutoFillRequest": { + "description": "Fills in more data based on existing data.", + "type": "object", + "properties": { + "useAlternateSeries": { + "description": "True if we should generate data with the \"alternate\" series.\nThis differs based on the type and amount of source data.", + "type": "boolean" + }, + "range": { + "description": "The range to autofill. This will examine the range and detect\nthe location that has data and automatically fill that data\nin to the rest of the range.", + "$ref": "GridRange" + }, + "sourceAndDestination": { + "description": "The source and destination areas to autofill.\nThis explicitly lists the source of the autofill and where to\nextend that data.", + "$ref": "SourceAndDestination" + } + }, + "id": "AutoFillRequest" + }, + "PieChartSpec": { + "description": "A \u003ca href=\"/chart/interactive/docs/gallery/piechart\"\u003epie chart\u003c/a\u003e.", + "type": "object", + "properties": { + "legendPosition": { + "description": "Where the legend of the pie chart should be drawn.", + "enum": [ + "PIE_CHART_LEGEND_POSITION_UNSPECIFIED", + "BOTTOM_LEGEND", + "LEFT_LEGEND", + "RIGHT_LEGEND", + "TOP_LEGEND", + "NO_LEGEND", + "LABELED_LEGEND" + ], + "enumDescriptions": [ + "Default value, do not use.", + "The legend is rendered on the bottom of the chart.", + "The legend is rendered on the left of the chart.", + "The legend is rendered on the right of the chart.", + "The legend is rendered on the top of the chart.", + "No legend is rendered.", + "Each pie slice has a label attached to it." + ], + "type": "string" + }, + "series": { + "description": "The data that covers the one and only series of the pie chart.", + "$ref": "ChartData" + }, + "pieHole": { + "description": "The size of the hole in the pie chart.", + "type": "number", + "format": "double" + }, + "threeDimensional": { + "description": "True if the pie is three dimensional.", + "type": "boolean" + }, + "domain": { + "description": "The data that covers the domain of the pie chart.", + "$ref": "ChartData" + } + }, + "id": "PieChartSpec" + }, + "UpdateSheetPropertiesRequest": { + "description": "Updates properties of the sheet with the specified\nsheetId.", + "type": "object", + "properties": { + "fields": { + "description": "The fields that should be updated. At least one field must be specified.\nThe root `properties` is implied and should not be specified.\nA single `\"*\"` can be used as short-hand for listing every field.", + "type": "string", + "format": "google-fieldmask" + }, + "properties": { + "description": "The properties to update.", + "$ref": "SheetProperties" + } + }, + "id": "UpdateSheetPropertiesRequest" + }, + "BooleanRule": { + "description": "A rule that may or may not match, depending on the condition.", + "type": "object", + "properties": { + "condition": { + "description": "The condition of the rule. If the condition evaluates to true,\nthe format will be applied.", + "$ref": "BooleanCondition" + }, + "format": { + "description": "The format to apply.\nConditional formatting can only apply a subset of formatting:\nbold, italic,\nstrikethrough,\nforeground color &\nbackground color.", + "$ref": "CellFormat" + } + }, + "id": "BooleanRule" + }, + "AppendDimensionRequest": { + "description": "Appends rows or columns to the end of a sheet.", + "type": "object", + "properties": { + "sheetId": { + "description": "The sheet to append rows or columns to.", + "type": "integer", + "format": "int32" + }, + "length": { + "description": "The number of rows or columns to append.", + "type": "integer", + "format": "int32" + }, + "dimension": { + "description": "Whether rows or columns should be appended.", + "enum": [ + "DIMENSION_UNSPECIFIED", + "ROWS", + "COLUMNS" + ], + "enumDescriptions": [ + "The default value, do not use.", + "Operates on the rows of a sheet.", + "Operates on the columns of a sheet." + ], + "type": "string" + } + }, + "id": "AppendDimensionRequest" + }, + "AddFilterViewRequest": { + "description": "Adds a filter view.", + "type": "object", + "properties": { + "filter": { + "description": "The filter to add. The filterViewId\nfield is optional; if one is not set, an id will be randomly generated. (It\nis an error to specify the ID of a filter that already exists.)", + "$ref": "FilterView" + } + }, + "id": "AddFilterViewRequest" + }, + "GridProperties": { + "description": "Properties of a grid.", + "type": "object", + "properties": { + "rowCount": { + "description": "The number of rows in the grid.", + "type": "integer", + "format": "int32" + }, + "columnCount": { + "description": "The number of columns in the grid.", + "type": "integer", + "format": "int32" + }, + "frozenRowCount": { + "description": "The number of rows that are frozen in the grid.", + "type": "integer", + "format": "int32" + }, + "frozenColumnCount": { + "description": "The number of columns that are frozen in the grid.", + "type": "integer", + "format": "int32" + }, + "hideGridlines": { + "description": "True if the grid isn't showing gridlines in the UI.", + "type": "boolean" + } + }, + "id": "GridProperties" + }, + "DeleteNamedRangeRequest": { + "description": "Removes the named range with the given ID from the spreadsheet.", + "type": "object", + "properties": { + "namedRangeId": { + "description": "The ID of the named range to delete.", + "type": "string" + } + }, + "id": "DeleteNamedRangeRequest" + }, + "AddChartRequest": { + "description": "Adds a chart to a sheet in the spreadsheet.", + "type": "object", + "properties": { + "chart": { + "description": "The chart that should be added to the spreadsheet, including the position\nwhere it should be placed. The chartId\nfield is optional; if one is not set, an id will be randomly generated. (It\nis an error to specify the ID of a chart that already exists.)", + "$ref": "EmbeddedChart" + } + }, + "id": "AddChartRequest" + }, + "SetDataValidationRequest": { + "description": "Sets a data validation rule to every cell in the range.\nTo clear validation in a range, call this with no rule specified.", + "type": "object", + "properties": { + "rule": { + "description": "The data validation rule to set on each cell in the range,\nor empty to clear the data validation in the range.", + "$ref": "DataValidationRule" + }, + "range": { + "description": "The range the data validation rule should apply to.", + "$ref": "GridRange" + } + }, + "id": "SetDataValidationRequest" + }, + "Request": { + "description": "A single kind of update to apply to a spreadsheet.", + "type": "object", + "properties": { + "updateEmbeddedObjectPosition": { + "description": "Updates an embedded object's (e.g. chart, image) position.", + "$ref": "UpdateEmbeddedObjectPositionRequest" + }, + "deleteNamedRange": { + "description": "Deletes a named range.", + "$ref": "DeleteNamedRangeRequest" + }, + "updateNamedRange": { + "description": "Updates a named range.", + "$ref": "UpdateNamedRangeRequest" + }, + "addFilterView": { + "description": "Adds a filter view.", + "$ref": "AddFilterViewRequest" + }, + "updateSpreadsheetProperties": { + "description": "Updates the spreadsheet's properties.", + "$ref": "UpdateSpreadsheetPropertiesRequest" + }, + "appendDimension": { + "description": "Appends dimensions to the end of a sheet.", + "$ref": "AppendDimensionRequest" + }, + "unmergeCells": { + "description": "Unmerges merged cells.", + "$ref": "UnmergeCellsRequest" + }, + "updateProtectedRange": { + "description": "Updates a protected range.", + "$ref": "UpdateProtectedRangeRequest" + }, + "deleteFilterView": { + "description": "Deletes a filter view from a sheet.", + "$ref": "DeleteFilterViewRequest" + }, + "clearBasicFilter": { + "description": "Clears the basic filter on a sheet.", + "$ref": "ClearBasicFilterRequest" + }, + "sortRange": { + "description": "Sorts data in a range.", + "$ref": "SortRangeRequest" + }, + "repeatCell": { + "description": "Repeats a single cell across a range.", + "$ref": "RepeatCellRequest" + }, + "setDataValidation": { + "description": "Sets data validation for one or more cells.", + "$ref": "SetDataValidationRequest" + }, + "updateCells": { + "description": "Updates many cells at once.", + "$ref": "UpdateCellsRequest" + }, + "addSheet": { + "description": "Adds a sheet.", + "$ref": "AddSheetRequest" + }, + "updateFilterView": { + "description": "Updates the properties of a filter view.", + "$ref": "UpdateFilterViewRequest" + }, + "updateSheetProperties": { + "description": "Updates a sheet's properties.", + "$ref": "UpdateSheetPropertiesRequest" + }, + "updateDimensionProperties": { + "description": "Updates dimensions' properties.", + "$ref": "UpdateDimensionPropertiesRequest" + }, + "deleteSheet": { + "description": "Deletes a sheet.", + "$ref": "DeleteSheetRequest" + }, + "findReplace": { + "description": "Finds and replaces occurrences of some text with other text.", + "$ref": "FindReplaceRequest" + }, + "addProtectedRange": { + "description": "Adds a protected range.", + "$ref": "AddProtectedRangeRequest" + }, + "deleteProtectedRange": { + "description": "Deletes a protected range.", + "$ref": "DeleteProtectedRangeRequest" + }, + "updateConditionalFormatRule": { + "description": "Updates an existing conditional format rule.", + "$ref": "UpdateConditionalFormatRuleRequest" + }, + "setBasicFilter": { + "description": "Sets the basic filter on a sheet.", + "$ref": "SetBasicFilterRequest" + }, + "mergeCells": { + "description": "Merges cells together.", + "$ref": "MergeCellsRequest" + }, + "updateBanding": { + "description": "Updates a banded range", + "$ref": "UpdateBandingRequest" + }, + "addChart": { + "description": "Adds a chart.", + "$ref": "AddChartRequest" + }, + "deleteConditionalFormatRule": { + "description": "Deletes an existing conditional format rule.", + "$ref": "DeleteConditionalFormatRuleRequest" + }, + "addBanding": { + "description": "Adds a new banded range", + "$ref": "AddBandingRequest" + }, + "deleteBanding": { + "description": "Removes a banded range", + "$ref": "DeleteBandingRequest" + }, + "updateChartSpec": { + "description": "Updates a chart's specifications.", + "$ref": "UpdateChartSpecRequest" + }, + "deleteDimension": { + "description": "Deletes rows or columns in a sheet.", + "$ref": "DeleteDimensionRequest" + }, + "deleteEmbeddedObject": { + "description": "Deletes an embedded object (e.g, chart, image) in a sheet.", + "$ref": "DeleteEmbeddedObjectRequest" + }, + "pasteData": { + "description": "Pastes data (HTML or delimited) into a sheet.", + "$ref": "PasteDataRequest" + }, + "addConditionalFormatRule": { + "description": "Adds a new conditional format rule.", + "$ref": "AddConditionalFormatRuleRequest" + }, + "updateBorders": { + "description": "Updates the borders in a range of cells.", + "$ref": "UpdateBordersRequest" + }, + "autoResizeDimensions": { + "description": "Automatically resizes one or more dimensions based on the contents\nof the cells in that dimension.", + "$ref": "AutoResizeDimensionsRequest" + }, + "duplicateSheet": { + "description": "Duplicates a sheet.", + "$ref": "DuplicateSheetRequest" + }, + "duplicateFilterView": { + "description": "Duplicates a filter view.", + "$ref": "DuplicateFilterViewRequest" + }, + "cutPaste": { + "description": "Cuts data from one area and pastes it to another.", + "$ref": "CutPasteRequest" + }, + "appendCells": { + "description": "Appends cells after the last row with data in a sheet.", + "$ref": "AppendCellsRequest" + }, + "addNamedRange": { + "description": "Adds a named range.", + "$ref": "AddNamedRangeRequest" + }, + "autoFill": { + "description": "Automatically fills in more data based on existing data.", + "$ref": "AutoFillRequest" + }, + "moveDimension": { + "description": "Moves rows or columns to another location in a sheet.", + "$ref": "MoveDimensionRequest" + }, + "textToColumns": { + "description": "Converts a column of text into many columns of text.", + "$ref": "TextToColumnsRequest" + }, + "insertDimension": { + "description": "Inserts new rows or columns in a sheet.", + "$ref": "InsertDimensionRequest" + }, + "copyPaste": { + "description": "Copies data from one area and pastes it to another.", + "$ref": "CopyPasteRequest" + } + }, + "id": "Request" + }, + "BatchGetValuesResponse": { + "description": "The response when retrieving more than one range of values in a spreadsheet.", + "type": "object", + "properties": { + "valueRanges": { + "description": "The requested values. The order of the ValueRanges is the same as the\norder of the requested ranges.", + "type": "array", + "items": { + "$ref": "ValueRange" + } + }, + "spreadsheetId": { + "description": "The ID of the spreadsheet the data was retrieved from.", + "type": "string" + } + }, + "id": "BatchGetValuesResponse" + }, + "InsertDimensionRequest": { + "description": "Inserts rows or columns in a sheet at a particular index.", + "type": "object", + "properties": { + "inheritFromBefore": { + "description": "Whether dimension properties should be extended from the dimensions\nbefore or after the newly inserted dimensions.\nTrue to inherit from the dimensions before (in which case the start\nindex must be greater than 0), and false to inherit from the dimensions\nafter.\n\nFor example, if row index 0 has red background and row index 1\nhas a green background, then inserting 2 rows at index 1 can inherit\neither the green or red background. If `inheritFromBefore` is true,\nthe two new rows will be red (because the row before the insertion point\nwas red), whereas if `inheritFromBefore` is false, the two new rows will\nbe green (because the row after the insertion point was green).", + "type": "boolean" + }, + "range": { + "description": "The dimensions to insert. Both the start and end indexes must be bounded.", + "$ref": "DimensionRange" + } + }, + "id": "InsertDimensionRequest" + }, + "DeleteEmbeddedObjectRequest": { + "description": "Deletes the embedded object with the given ID.", + "type": "object", + "properties": { + "objectId": { + "description": "The ID of the embedded object to delete.", + "type": "integer", + "format": "int32" + } + }, + "id": "DeleteEmbeddedObjectRequest" + }, + "BandedRange": { + "description": "A banded (alternating colors) range in a sheet.", + "type": "object", + "properties": { + "bandedRangeId": { + "description": "The id of the banded range.", + "type": "integer", + "format": "int32" + }, + "rowProperties": { + "description": "Properties for row bands. These properties will be applied on a row-by-row\nbasis throughout all the rows in the range. At least one of\nrow_properties or column_properties must be specified.", + "$ref": "BandingProperties" + }, + "columnProperties": { + "description": "Properties for column bands. These properties will be applied on a column-\nby-column basis throughout all the columns in the range. At least one of\nrow_properties or column_properties must be specified.", + "$ref": "BandingProperties" + }, + "range": { + "description": "The range over which these properties are applied.", + "$ref": "GridRange" + } + }, + "id": "BandedRange" + }, + "DeleteConditionalFormatRuleResponse": { + "description": "The result of deleting a conditional format rule.", + "type": "object", + "properties": { + "rule": { + "description": "The rule that was deleted.", + "$ref": "ConditionalFormatRule" + } + }, + "id": "DeleteConditionalFormatRuleResponse" + } + }, + "revision": "20161209", + "basePath": "", + "icons": { + "x32": "http://www.google.com/images/icons/product/search-32.gif", + "x16": "http://www.google.com/images/icons/product/search-16.gif" + }, + "version_module": "True", + "canonicalName": "Sheets", + "discoveryVersion": "v1", + "baseUrl": "https://sheets.googleapis.com/", + "name": "sheets", + "parameters": { + "access_token": { + "description": "OAuth access token.", + "type": "string", + "location": "query" + }, + "prettyPrint": { + "description": "Returns response with indentations and line breaks.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "key": { + "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", + "type": "string", + "location": "query" + }, + "quotaUser": { + "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.", + "type": "string", + "location": "query" + }, + "pp": { + "description": "Pretty-print response.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "fields": { + "description": "Selector specifying which fields to include in a partial response.", + "type": "string", + "location": "query" + }, + "alt": { + "description": "Data format for response.", + "location": "query", + "enum": [ + "json", + "media", + "proto" + ], + "default": "json", + "enumDescriptions": [ + "Responses with Content-Type of application/json", + "Media download with context-dependent Content-Type", + "Responses with Content-Type of application/x-protobuf" + ], + "type": "string" + }, + "$.xgafv": { + "description": "V1 error format.", + "enum": [ + "1", + "2" + ], + "enumDescriptions": [ + "v1 error format", + "v2 error format" + ], + "type": "string", + "location": "query" + }, + "callback": { + "description": "JSONP", + "type": "string", + "location": "query" + }, + "oauth_token": { + "description": "OAuth 2.0 token for the current user.", + "type": "string", + "location": "query" + }, + "uploadType": { + "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").", + "type": "string", + "location": "query" + }, + "bearer_token": { + "description": "OAuth bearer token.", + "type": "string", + "location": "query" + }, + "upload_protocol": { + "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").", + "type": "string", + "location": "query" + } + }, + "documentationLink": "https://developers.google.com/sheets/", + "ownerDomain": "google.com", + "batchPath": "batch", + "servicePath": "", + "ownerName": "Google", + "version": "v4", + "rootUrl": "https://sheets.googleapis.com/", + "kind": "discovery#restDescription" +} diff --git a/etc/api/siteverification/v1/siteverification-api.json b/etc/api/siteverification/v1/siteverification-api.json index a65873d092..a4a22a9fa0 100644 --- a/etc/api/siteverification/v1/siteverification-api.json +++ b/etc/api/siteverification/v1/siteverification-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/7Wh2BL46-ycQBGZrIfJ_r7nrkOo\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/i7yRN5hkF8eVOTb2OSGCp8ZAiJE\"", "discoveryVersion": "v1", "id": "siteVerification:v1", "name": "siteVerification", @@ -11,8 +11,8 @@ "ownerDomain": "google.com", "ownerName": "Google", "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" }, "documentationLink": "https://developers.google.com/site-verification/", "protocol": "rest", diff --git a/etc/api/slides/v1/slides-api.json b/etc/api/slides/v1/slides-api.json new file mode 100644 index 0000000000..3a313483c7 --- /dev/null +++ b/etc/api/slides/v1/slides-api.json @@ -0,0 +1,3555 @@ +{ + "id": "slides:v1", + "auth": { + "oauth2": { + "scopes": { + "https://www.googleapis.com/auth/drive": { + "description": "View and manage the files in your Google Drive" + }, + "https://www.googleapis.com/auth/spreadsheets.readonly": { + "description": "View your Google Spreadsheets" + }, + "https://www.googleapis.com/auth/presentations": { + "description": "View and manage your Google Slides presentations" + }, + "https://www.googleapis.com/auth/presentations.readonly": { + "description": "View your Google Slides presentations" + }, + "https://www.googleapis.com/auth/drive.readonly": { + "description": "View the files in your Google Drive" + }, + "https://www.googleapis.com/auth/spreadsheets": { + "description": "View and manage your spreadsheets in Google Drive" + } + } + } + }, + "description": "An API for creating and editing Google Slides presentations.", + "protocol": "rest", + "title": "Google Slides API", + "resources": { + "presentations": { + "resources": { + "pages": { + "methods": { + "get": { + "id": "slides.presentations.pages.get", + "response": { + "$ref": "Page" + }, + "parameterOrder": [ + "presentationId", + "pageObjectId" + ], + "description": "Gets the latest version of the specified page in the presentation.", + "flatPath": "v1/presentations/{presentationId}/pages/{pageObjectId}", + "httpMethod": "GET", + "parameters": { + "presentationId": { + "description": "The ID of the presentation to retrieve.", + "required": true, + "location": "path", + "type": "string" + }, + "pageObjectId": { + "description": "The object ID of the page to retrieve.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1/presentations/{presentationId}/pages/{pageObjectId}", + "scopes": [ + "https://www.googleapis.com/auth/drive", + "https://www.googleapis.com/auth/drive.readonly", + "https://www.googleapis.com/auth/presentations", + "https://www.googleapis.com/auth/presentations.readonly" + ] + } + } + } + }, + "methods": { + "get": { + "id": "slides.presentations.get", + "response": { + "$ref": "Presentation" + }, + "parameterOrder": [ + "presentationId" + ], + "description": "Gets the latest version of the specified presentation.", + "flatPath": "v1/presentations/{presentationsId}", + "httpMethod": "GET", + "parameters": { + "presentationId": { + "description": "The ID of the presentation to retrieve.", + "required": true, + "pattern": "^[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1/presentations/{+presentationId}", + "scopes": [ + "https://www.googleapis.com/auth/drive", + "https://www.googleapis.com/auth/drive.readonly", + "https://www.googleapis.com/auth/presentations", + "https://www.googleapis.com/auth/presentations.readonly" + ] + }, + "create": { + "id": "slides.presentations.create", + "response": { + "$ref": "Presentation" + }, + "parameterOrder": [], + "description": "Creates a new presentation using the title given in the request. Other\nfields in the request are ignored.\nReturns the created presentation.", + "request": { + "$ref": "Presentation" + }, + "flatPath": "v1/presentations", + "httpMethod": "POST", + "parameters": {}, + "path": "v1/presentations", + "scopes": [ + "https://www.googleapis.com/auth/drive", + "https://www.googleapis.com/auth/presentations" + ] + }, + "batchUpdate": { + "id": "slides.presentations.batchUpdate", + "response": { + "$ref": "BatchUpdatePresentationResponse" + }, + "parameterOrder": [ + "presentationId" + ], + "description": "Applies one or more updates to the presentation.\n\nEach request is validated before\nbeing applied. If any request is not valid, then the entire request will\nfail and nothing will be applied.\n\nSome requests have replies to\ngive you some information about how they are applied. Other requests do\nnot need to return information; these each return an empty reply.\nThe order of replies matches that of the requests.\n\nFor example, suppose you call batchUpdate with four updates, and only the\nthird one returns information. The response would have two empty replies:\nthe reply to the third request, and another empty reply, in that order.\n\nBecause other users may be editing the presentation, the presentation\nmight not exactly reflect your changes: your changes may\nbe altered with respect to collaborator changes. If there are no\ncollaborators, the presentation should reflect your changes. In any case,\nthe updates in your request are guaranteed to be applied together\natomically.", + "request": { + "$ref": "BatchUpdatePresentationRequest" + }, + "flatPath": "v1/presentations/{presentationId}:batchUpdate", + "httpMethod": "POST", + "parameters": { + "presentationId": { + "description": "The presentation to apply the updates to.", + "required": true, + "location": "path", + "type": "string" + } + }, + "path": "v1/presentations/{presentationId}:batchUpdate", + "scopes": [ + "https://www.googleapis.com/auth/drive", + "https://www.googleapis.com/auth/drive.readonly", + "https://www.googleapis.com/auth/presentations", + "https://www.googleapis.com/auth/spreadsheets", + "https://www.googleapis.com/auth/spreadsheets.readonly" + ] + } + } + } + }, + "schemas": { + "StretchedPictureFill": { + "description": "The stretched picture fill. The page or page element is filled entirely with\nthe specified picture. The picture is stretched to fit its container.", + "type": "object", + "properties": { + "contentUrl": { + "description": "Reading the content_url:\n\nAn URL to a picture with a default lifetime of 30 minutes.\nThis URL is tagged with the account of the requester. Anyone with the URL\neffectively accesses the picture as the original requester. Access to the\npicture may be lost if the presentation's sharing settings change.\n\nWriting the content_url:\n\nThe picture is fetched once at insertion time and a copy is stored for\ndisplay inside the presentation. Pictures must be less than 50MB in size,\ncannot exceed 25 megapixels, and must be in either in PNG, JPEG, or GIF\nformat.", + "type": "string" + }, + "size": { + "description": "The original size of the picture fill. This field is read-only.", + "$ref": "Size" + } + }, + "id": "StretchedPictureFill" + }, + "Image": { + "description": "A PageElement kind representing an\nimage.", + "type": "object", + "properties": { + "contentUrl": { + "description": "An URL to an image with a default lifetime of 30 minutes.\nThis URL is tagged with the account of the requester. Anyone with the URL\neffectively accesses the image as the original requester. Access to the\nimage may be lost if the presentation's sharing settings change.", + "type": "string" + }, + "imageProperties": { + "description": "The properties of the image.", + "$ref": "ImageProperties" + } + }, + "id": "Image" + }, + "VideoProperties": { + "description": "The properties of the Video.", + "type": "object", + "properties": { + "outline": { + "description": "The outline of the video. The default outline matches the defaults for new\nvideos created in the Slides editor.", + "$ref": "Outline" + } + }, + "id": "VideoProperties" + }, + "CropProperties": { + "description": "The crop properties of an object enclosed in a container. For example, an\nImage.\n\nThe crop properties is represented by the offsets of four edges which define\na crop rectangle. The offsets are measured in percentage from the\ncorresponding edges of the object's original bounding rectangle towards\ninside, relative to the object's original dimensions.\n\n- If the offset is in the interval (0, 1), the corresponding edge of crop\nrectangle is positioned inside of the object's original bounding rectangle.\n- If the offset is negative or greater than 1, the corresponding edge of crop\nrectangle is positioned outside of the object's original bounding rectangle.\n- If the left edge of the crop rectangle is on the right side of its right\nedge, the object will be flipped horizontally.\n- If the top edge of the crop rectangle is below its bottom edge, the object\nwill be flipped vertically.\n- If all offsets and rotation angle is 0, the object is not cropped.\n\nAfter cropping, the content in the crop rectangle will be stretched to fit\nits container.", + "type": "object", + "properties": { + "rightOffset": { + "description": "The offset specifies the right edge of the crop rectangle that is located\nto the left of the original bounding rectangle right edge, relative to the\nobject's original width.", + "type": "number", + "format": "float" + }, + "angle": { + "description": "The rotation angle of the crop window around its center, in radians.\nRotation angle is applied after the offset.", + "type": "number", + "format": "float" + }, + "leftOffset": { + "description": "The offset specifies the left edge of the crop rectangle that is located to\nthe right of the original bounding rectangle left edge, relative to the\nobject's original width.", + "type": "number", + "format": "float" + }, + "topOffset": { + "description": "The offset specifies the top edge of the crop rectangle that is located\nbelow the original bounding rectangle top edge, relative to the object's\noriginal height.", + "type": "number", + "format": "float" + }, + "bottomOffset": { + "description": "The offset specifies the bottom edge of the crop rectangle that is located\nabove the original bounding rectangle bottom edge, relative to the object's\noriginal height.", + "type": "number", + "format": "float" + } + }, + "id": "CropProperties" + }, + "TableRange": { + "description": "A table range represents a reference to a subset of a table.\n\nIt's important to note that the cells specified by a table range do not\nnecessarily form a rectangle. For example, let's say we have a 3 x 3 table\nwhere all the cells of the last row are merged together. The table looks\nlike this:\n\n \n [ ]\n\nA table range with location = (0, 0), row span = 3 and column span = 2\nspecifies the following cells:\n\n x x \n [ x ]", + "type": "object", + "properties": { + "location": { + "description": "The starting location of the table range.", + "$ref": "TableCellLocation" + }, + "rowSpan": { + "description": "The row span of the table range.", + "type": "integer", + "format": "int32" + }, + "columnSpan": { + "description": "The column span of the table range.", + "type": "integer", + "format": "int32" + } + }, + "id": "TableRange" + }, + "UpdateTextStyleRequest": { + "description": "Update the styling of text in a Shape or\nTable.", + "type": "object", + "properties": { + "style": { + "description": "The style(s) to set on the text.\n\nIf the value for a particular style matches that of the parent, that style\nwill be set to inherit.\n\nCertain text style changes may cause other changes meant to mirror the\nbehavior of the Slides editor. See the documentation of\nTextStyle for more information.", + "$ref": "TextStyle" + }, + "objectId": { + "description": "The object ID of the shape or table with the text to be styled.", + "type": "string" + }, + "fields": { + "description": "The fields that should be updated.\n\nAt least one field must be specified. The root `style` is implied and\nshould not be specified. A single `\"*\"` can be used as short-hand for\nlisting every field.\n\nFor example to update the text style to bold, set `fields` to `\"bold\"`.\n\nTo reset a property to its default value,\ninclude its field name in the field mask but leave the field itself unset.", + "type": "string", + "format": "google-fieldmask" + }, + "textRange": { + "description": "The range of text to style.\n\nThe range may be extended to include adjacent newlines.\n\nIf the range fully contains a paragraph belonging to a list, the\nparagraph's bullet is also updated with the matching text style.", + "$ref": "Range" + }, + "cellLocation": { + "description": "The optional table cell location if the text to be styled is in a table\ncell. If present, the object_id must refer to a table.", + "$ref": "TableCellLocation" + } + }, + "id": "UpdateTextStyleRequest" + }, + "InsertTextRequest": { + "description": "Inserts text into a shape or a table cell.", + "type": "object", + "properties": { + "text": { + "description": "The text to be inserted.\n\nInserting a newline character will implicitly create a new\nParagraphMarker at that index.\nThe paragraph style of the new paragraph will be copied from the paragraph\nat the current insertion index, including lists and bullets.\n\nText styles for inserted text will be determined automatically, generally\npreserving the styling of neighboring text. In most cases, the text will be\nadded to the TextRun that exists at the\ninsertion index.\n\nSome control characters (U+0000-U+0008, U+000C-U+001F) and characters\nfrom the Unicode Basic Multilingual Plane Private Use Area (U+E000-U+F8FF)\nwill be stripped out of the inserted text.", + "type": "string" + }, + "objectId": { + "description": "The object ID of the shape or table where the text will be inserted.", + "type": "string" + }, + "insertionIndex": { + "description": "The index where the text will be inserted, in Unicode code units, based\non TextElement indexes.\n\nThe index is zero-based and is computed from the start of the string.\nThe index may be adjusted to prevent insertions inside Unicode grapheme\nclusters. In these cases, the text will be inserted immediately after the\ngrapheme cluster.", + "type": "integer", + "format": "int32" + }, + "cellLocation": { + "description": "The optional table cell location if the text is to be inserted into a table\ncell. If present, the object_id must refer to a table.", + "$ref": "TableCellLocation" + } + }, + "id": "InsertTextRequest" + }, + "RgbColor": { + "description": "An RGB color.", + "type": "object", + "properties": { + "green": { + "description": "The green component of the color, from 0.0 to 1.0.", + "type": "number", + "format": "float" + }, + "blue": { + "description": "The blue component of the color, from 0.0 to 1.0.", + "type": "number", + "format": "float" + }, + "red": { + "description": "The red component of the color, from 0.0 to 1.0.", + "type": "number", + "format": "float" + } + }, + "id": "RgbColor" + }, + "PageElementProperties": { + "description": "Common properties for a page element.\n\nNote: When you initially create a\nPageElement, the API may modify\nthe values of both `size` and `transform`, but the\nvisual size will be unchanged.", + "type": "object", + "properties": { + "size": { + "description": "The size of the element.", + "$ref": "Size" + }, + "pageObjectId": { + "description": "The object ID of the page where the element is located.", + "type": "string" + }, + "transform": { + "description": "The transform for the element.", + "$ref": "AffineTransform" + } + }, + "id": "PageElementProperties" + }, + "DeleteTextRequest": { + "description": "Deletes text from a shape or a table cell.", + "type": "object", + "properties": { + "objectId": { + "description": "The object ID of the shape or table from which the text will be deleted.", + "type": "string" + }, + "textRange": { + "description": "The range of text to delete, based on TextElement indexes.\n\nThere is always an implicit newline character at the end of a shape's or\ntable cell's text that cannot be deleted. `Range.Type.ALL` will use the\ncorrect bounds, but care must be taken when specifying explicit bounds for\nrange types `FROM_START_INDEX` and `FIXED_RANGE`. For example, if the text\nis \"ABC\", followed by an implicit newline, then the maximum value is 2 for\n`text_range.start_index` and 3 for `text_range.end_index`.\n\nDeleting text that crosses a paragraph boundary may result in changes\nto paragraph styles and lists as the two paragraphs are merged.\n\nRanges that include only one code unit of a surrogate pair are expanded to\ninclude both code units.", + "$ref": "Range" + }, + "cellLocation": { + "description": "The optional table cell location if the text is to be deleted from a table\ncell. If present, the object_id must refer to a table.", + "$ref": "TableCellLocation" + } + }, + "id": "DeleteTextRequest" + }, + "ParagraphStyle": { + "description": "Styles that apply to a whole paragraph.\n\nIf this text is contained in a shape with a parent placeholder, then these paragraph styles may be\ninherited from the parent. Which paragraph styles are inherited depend on the\nnesting level of lists:\n\n* A paragraph not in a list will inherit its paragraph style from the\n paragraph at the 0 nesting level of the list inside the parent placeholder.\n* A paragraph in a list will inherit its paragraph style from the paragraph\n at its corresponding nesting level of the list inside the parent\n placeholder.\n\nInherited paragraph styles are represented as unset fields in this message.", + "type": "object", + "properties": { + "lineSpacing": { + "description": "The amount of space between lines, as a percentage of normal, where normal\nis represented as 100.0. If unset, the value is inherited from the parent.\nThis property is read-only.", + "type": "number", + "format": "float" + }, + "spacingMode": { + "description": "The spacing mode for the paragraph. This property is read-only.", + "enum": [ + "SPACING_MODE_UNSPECIFIED", + "NEVER_COLLAPSE", + "COLLAPSE_LISTS" + ], + "enumDescriptions": [ + "The spacing mode is inherited from the parent.", + "Paragraph spacing is always rendered.", + "Paragraph spacing is skipped between list elements." + ], + "type": "string" + }, + "alignment": { + "description": "The text alignment for this paragraph. This property is read-only.", + "enum": [ + "ALIGNMENT_UNSPECIFIED", + "START", + "CENTER", + "END", + "JUSTIFIED" + ], + "enumDescriptions": [ + "The paragraph alignment is inherited from the parent.", + "The paragraph is aligned to the start of the line. Left-aligned for\nLTR text, right-aligned otherwise.", + "The paragraph is centered.", + "The paragraph is aligned to the end of the line. Right-aligned for\nLTR text, left-aligned otherwise.", + "The paragraph is justified." + ], + "type": "string" + }, + "spaceAbove": { + "description": "The amount of extra space above the paragraph. If unset, the value is\ninherited from the parent. This property is read-only.", + "$ref": "Dimension" + }, + "direction": { + "description": "The text direction of this paragraph. This property is read-only.", + "enum": [ + "TEXT_DIRECTION_UNSPECIFIED", + "LEFT_TO_RIGHT", + "RIGHT_TO_LEFT" + ], + "enumDescriptions": [ + "The text direction is inherited from the parent.", + "The text goes from left to right.", + "The text goes from right to left." + ], + "type": "string" + }, + "indentEnd": { + "description": "The amount indentation for the paragraph on the side that corresponds to\nthe end of the text, based on the current text direction. If unset, the\nvalue is inherited from the parent. This property is read-only.", + "$ref": "Dimension" + }, + "indentFirstLine": { + "description": "The amount of indentation for the start of the first line of the paragraph.\nIf unset, the value is inherited from the parent. This property is\nread-only.", + "$ref": "Dimension" + }, + "indentStart": { + "description": "The amount indentation for the paragraph on the side that corresponds to\nthe start of the text, based on the current text direction. If unset, the\nvalue is inherited from the parent. This property is read-only.", + "$ref": "Dimension" + }, + "spaceBelow": { + "description": "The amount of extra space above the paragraph. If unset, the value is\ninherited from the parent. This property is read-only.", + "$ref": "Dimension" + } + }, + "id": "ParagraphStyle" + }, + "Page": { + "description": "A page in a presentation.", + "type": "object", + "properties": { + "slideProperties": { + "description": "Slide specific properties. Only set if page_type = SLIDE.", + "$ref": "SlideProperties" + }, + "pageType": { + "description": "The type of the page.", + "enum": [ + "SLIDE", + "MASTER", + "LAYOUT" + ], + "enumDescriptions": [ + "A slide page.", + "A master slide page.", + "A layout page." + ], + "type": "string" + }, + "pageElements": { + "description": "The page elements rendered on the page.", + "type": "array", + "items": { + "$ref": "PageElement" + } + }, + "pageProperties": { + "description": "The properties of the page.", + "$ref": "PageProperties" + }, + "layoutProperties": { + "description": "Layout specific properties. Only set if page_type = LAYOUT.", + "$ref": "LayoutProperties" + }, + "objectId": { + "description": "The object ID for this page. Object IDs used by\nPage and\nPageElement share the same namespace.", + "type": "string" + } + }, + "id": "Page" + }, + "UpdateShapePropertiesRequest": { + "description": "Update the properties of a Shape.", + "type": "object", + "properties": { + "shapeProperties": { + "description": "The shape properties to update.", + "$ref": "ShapeProperties" + }, + "objectId": { + "description": "The object ID of the shape the updates are applied to.", + "type": "string" + }, + "fields": { + "description": "The fields that should be updated.\n\nAt least one field must be specified. The root `shapeProperties` is\nimplied and should not be specified. A single `\"*\"` can be used as\nshort-hand for listing every field.\n\nFor example to update the shape background solid fill color, set `fields`\nto `\"shapeBackgroundFill.solidFill.color\"`.\n\nTo reset a property to its default value, include its field name in the\nfield mask but leave the field itself unset.", + "type": "string", + "format": "google-fieldmask" + } + }, + "id": "UpdateShapePropertiesRequest" + }, + "CreateLineResponse": { + "description": "The result of creating a line.", + "type": "object", + "properties": { + "objectId": { + "description": "The object ID of the created line.", + "type": "string" + } + }, + "id": "CreateLineResponse" + }, + "Presentation": { + "description": "A Google Slides presentation.", + "type": "object", + "properties": { + "title": { + "description": "The title of the presentation.", + "type": "string" + }, + "locale": { + "description": "The locale of the presentation, as an IETF BCP 47 language tag.", + "type": "string" + }, + "slides": { + "description": "The slides in the presentation.\nA slide inherits properties from a slide layout.", + "type": "array", + "items": { + "$ref": "Page" + } + }, + "masters": { + "description": "The slide masters in the presentation. A slide master contains all common\npage elements and the common properties for a set of layouts. They serve\nthree purposes:\n\n- Placeholder shapes on a master contain the default text styles and shape\n properties of all placeholder shapes on pages that use that master.\n- The master page properties define the common page properties inherited by\n its layouts.\n- Any other shapes on the master slide will appear on all slides using that\n master, regardless of their layout.", + "type": "array", + "items": { + "$ref": "Page" + } + }, + "pageSize": { + "description": "The size of pages in the presentation.", + "$ref": "Size" + }, + "presentationId": { + "description": "The ID of the presentation.", + "type": "string" + }, + "layouts": { + "description": "The layouts in the presentation. A layout is a template that determines\nhow content is arranged and styled on the slides that inherit from that\nlayout.", + "type": "array", + "items": { + "$ref": "Page" + } + } + }, + "id": "Presentation" + }, + "CreateImageRequest": { + "description": "Creates an image.", + "type": "object", + "properties": { + "url": { + "description": "The image URL.\n\nThe image is fetched once at insertion time and a copy is stored for\ndisplay inside the presentation. Images must be less than 50MB in size,\ncannot exceed 25 megapixels, and must be in either in PNG, JPEG, or GIF\nformat.", + "type": "string" + }, + "objectId": { + "description": "A user-supplied object ID.\n\nIf you specify an ID, it must be unique among all pages and page elements\nin the presentation. The ID must start with an alphanumeric character or an\nunderscore (matches regex `[a-zA-Z0-9_]`); remaining characters\nmay include those as well as a hyphen or colon (matches regex\n`[a-zA-Z0-9_-:]`).\nThe length of the ID must not be less than 5 or greater than 50.\n\nIf you don't specify an ID, a unique one is generated.", + "type": "string" + }, + "elementProperties": { + "description": "The element properties for the image.\n\nWhen the aspect ratio of the provided size does not match the image aspect\nratio, the image is scaled and centered with respect to the size in order\nto maintain aspect ratio. The provided transform is applied after this\noperation.", + "$ref": "PageElementProperties" + } + }, + "id": "CreateImageRequest" + }, + "SlideProperties": { + "description": "The properties of Page that are only\nrelevant for pages with page_type SLIDE.", + "type": "object", + "properties": { + "layoutObjectId": { + "description": "The object ID of the layout that this slide is based on.", + "type": "string" + }, + "masterObjectId": { + "description": "The object ID of the master that this slide is based on.", + "type": "string" + } + }, + "id": "SlideProperties" + }, + "UpdatePageElementTransformRequest": { + "description": "Updates the transform of a page element.", + "type": "object", + "properties": { + "applyMode": { + "description": "The apply mode of the transform update.", + "enum": [ + "APPLY_MODE_UNSPECIFIED", + "RELATIVE", + "ABSOLUTE" + ], + "enumDescriptions": [ + "Unspecified mode.", + "Applies the new AffineTransform matrix to the existing one, and\nreplaces the existing one with the resulting concatenation.", + "Replaces the existing AffineTransform matrix with the new one." + ], + "type": "string" + }, + "objectId": { + "description": "The object ID of the page element to update.", + "type": "string" + }, + "transform": { + "description": "The input transform matrix used to update the page element.", + "$ref": "AffineTransform" + } + }, + "id": "UpdatePageElementTransformRequest" + }, + "List": { + "description": "A List describes the look and feel of bullets belonging to paragraphs\nassociated with a list. A paragraph that is part of a list has an implicit\nreference to that list's ID.", + "type": "object", + "properties": { + "nestingLevel": { + "description": "A map of nesting levels to the properties of bullets at the associated\nlevel. A list has at most nine levels of nesting, so the possible values\nfor the keys of this map are 0 through 8, inclusive.", + "additionalProperties": { + "$ref": "NestingLevel" + }, + "type": "object" + }, + "listId": { + "description": "The ID of the list.", + "type": "string" + } + }, + "id": "List" + }, + "CreateVideoResponse": { + "description": "The result of creating a video.", + "type": "object", + "properties": { + "objectId": { + "description": "The object ID of the created video.", + "type": "string" + } + }, + "id": "CreateVideoResponse" + }, + "InsertTableRowsRequest": { + "description": "Inserts rows into a table.", + "type": "object", + "properties": { + "tableObjectId": { + "description": "The table to insert rows into.", + "type": "string" + }, + "insertBelow": { + "description": "Whether to insert new rows below the reference cell location.\n\n- `True`: insert below the cell.\n- `False`: insert above the cell.", + "type": "boolean" + }, + "cellLocation": { + "description": "The reference table cell location from which rows will be inserted.\n\nA new row will be inserted above (or below) the row where the reference\ncell is. If the reference cell is a merged cell, a new row will be\ninserted above (or below) the merged cell.", + "$ref": "TableCellLocation" + }, + "number": { + "description": "The number of rows to be inserted. Maximum 20 per request.", + "type": "integer", + "format": "int32" + } + }, + "id": "InsertTableRowsRequest" + }, + "UpdateVideoPropertiesRequest": { + "description": "Update the properties of a Video.", + "type": "object", + "properties": { + "videoProperties": { + "description": "The video properties to update.", + "$ref": "VideoProperties" + }, + "objectId": { + "description": "The object ID of the video the updates are applied to.", + "type": "string" + }, + "fields": { + "description": "The fields that should be updated.\n\nAt least one field must be specified. The root `videoProperties` is\nimplied and should not be specified. A single `\"*\"` can be used as\nshort-hand for listing every field.\n\nFor example to update the video outline color, set `fields` to\n`\"outline.outlineFill.solidFill.color\"`.\n\nTo reset a property to its default value, include its field name in the\nfield mask but leave the field itself unset.", + "type": "string", + "format": "google-fieldmask" + } + }, + "id": "UpdateVideoPropertiesRequest" + }, + "OpaqueColor": { + "description": "A themeable solid color value.", + "type": "object", + "properties": { + "rgbColor": { + "description": "An opaque RGB color.", + "$ref": "RgbColor" + }, + "themeColor": { + "description": "An opaque theme color.", + "enum": [ + "THEME_COLOR_TYPE_UNSPECIFIED", + "DARK1", + "LIGHT1", + "DARK2", + "LIGHT2", + "ACCENT1", + "ACCENT2", + "ACCENT3", + "ACCENT4", + "ACCENT5", + "ACCENT6", + "HYPERLINK", + "FOLLOWED_HYPERLINK", + "TEXT1", + "BACKGROUND1", + "TEXT2", + "BACKGROUND2" + ], + "enumDescriptions": [ + "Unspecified theme color. This value should not be used.", + "Represents the first dark color.", + "Represents the first light color.", + "Represents the second dark color.", + "Represents the second light color.", + "Represents the first accent color.", + "Represents the second accent color.", + "Represents the third accent color.", + "Represents the fourth accent color.", + "Represents the fifth accent color.", + "Represents the sixth accent color.", + "Represents the color to use for hyperlinks.", + "Represents the color to use for visited hyperlinks.", + "Represents the first text color.", + "Represents the first background color.", + "Represents the second text color.", + "Represents the second background color." + ], + "type": "string" + } + }, + "id": "OpaqueColor" + }, + "Response": { + "description": "A single response from an update.", + "type": "object", + "properties": { + "createTable": { + "description": "The result of creating a table.", + "$ref": "CreateTableResponse" + }, + "replaceAllText": { + "description": "The result of replacing text.", + "$ref": "ReplaceAllTextResponse" + }, + "createLine": { + "description": "The result of creating a line.", + "$ref": "CreateLineResponse" + }, + "createSheetsChart": { + "description": "The result of creating a Google Sheets chart.", + "$ref": "CreateSheetsChartResponse" + }, + "createSlide": { + "description": "The result of creating a slide.", + "$ref": "CreateSlideResponse" + }, + "createShape": { + "description": "The result of creating a shape.", + "$ref": "CreateShapeResponse" + }, + "replaceAllShapesWithImage": { + "description": "The result of replacing all shapes containing the specified text with\nan image.", + "$ref": "ReplaceAllShapesWithImageResponse" + }, + "createVideo": { + "description": "The result of creating a video.", + "$ref": "CreateVideoResponse" + }, + "createImage": { + "description": "The result of creating an image.", + "$ref": "CreateImageResponse" + }, + "duplicateObject": { + "description": "The result of duplicating an object.", + "$ref": "DuplicateObjectResponse" + } + }, + "id": "Response" + }, + "LineProperties": { + "description": "The properties of the Line.\n\nWhen unset, these fields default to values that match the appearance of\nnew lines created in the Slides editor.", + "type": "object", + "properties": { + "weight": { + "description": "The thickness of the line.", + "$ref": "Dimension" + }, + "endArrow": { + "description": "The style of the arrow at the end of the line.", + "enum": [ + "ARROW_STYLE_UNSPECIFIED", + "NONE", + "STEALTH_ARROW", + "FILL_ARROW", + "FILL_CIRCLE", + "FILL_SQUARE", + "FILL_DIAMOND", + "OPEN_ARROW", + "OPEN_CIRCLE", + "OPEN_SQUARE", + "OPEN_DIAMOND" + ], + "enumDescriptions": [ + "An unspecified arrow style.", + "No arrow.", + "Arrow with notched back. Corresponds to ECMA-376 ST_LineEndType value\n'stealth'.", + "Filled arrow. Corresponds to ECMA-376 ST_LineEndType value 'triangle'.", + "Filled circle. Corresponds to ECMA-376 ST_LineEndType value 'oval'.", + "Filled square.", + "Filled diamond. Corresponds to ECMA-376 ST_LineEndType value 'diamond'.", + "Hollow arrow.", + "Hollow circle.", + "Hollow square.", + "Hollow diamond." + ], + "type": "string" + }, + "link": { + "description": "The hyperlink destination of the line. If unset, there is no link.", + "$ref": "Link" + }, + "lineFill": { + "description": "The fill of the line. The default line fill matches the defaults for new\nlines created in the Slides editor.", + "$ref": "LineFill" + }, + "dashStyle": { + "description": "The dash style of the line.", + "enum": [ + "DASH_STYLE_UNSPECIFIED", + "SOLID", + "DOT", + "DASH", + "DASH_DOT", + "LONG_DASH", + "LONG_DASH_DOT" + ], + "enumDescriptions": [ + "Unspecified dash style.", + "Solid line. Corresponds to ECMA-376 ST_PresetLineDashVal value 'solid'.\nThis is the default dash style.", + "Dotted line. Corresponds to ECMA-376 ST_PresetLineDashVal value 'dot'.", + "Dashed line. Corresponds to ECMA-376 ST_PresetLineDashVal value 'dash'.", + "Alternating dashes and dots. Corresponds to ECMA-376 ST_PresetLineDashVal\nvalue 'dashDot'.", + "Line with large dashes. Corresponds to ECMA-376 ST_PresetLineDashVal\nvalue 'lgDash'.", + "Alternating large dashes and dots. Corresponds to ECMA-376\nST_PresetLineDashVal value 'lgDashDot'." + ], + "type": "string" + }, + "startArrow": { + "description": "The style of the arrow at the beginning of the line.", + "enum": [ + "ARROW_STYLE_UNSPECIFIED", + "NONE", + "STEALTH_ARROW", + "FILL_ARROW", + "FILL_CIRCLE", + "FILL_SQUARE", + "FILL_DIAMOND", + "OPEN_ARROW", + "OPEN_CIRCLE", + "OPEN_SQUARE", + "OPEN_DIAMOND" + ], + "enumDescriptions": [ + "An unspecified arrow style.", + "No arrow.", + "Arrow with notched back. Corresponds to ECMA-376 ST_LineEndType value\n'stealth'.", + "Filled arrow. Corresponds to ECMA-376 ST_LineEndType value 'triangle'.", + "Filled circle. Corresponds to ECMA-376 ST_LineEndType value 'oval'.", + "Filled square.", + "Filled diamond. Corresponds to ECMA-376 ST_LineEndType value 'diamond'.", + "Hollow arrow.", + "Hollow circle.", + "Hollow square.", + "Hollow diamond." + ], + "type": "string" + } + }, + "id": "LineProperties" + }, + "Table": { + "description": "A PageElement kind representing a\ntable.", + "type": "object", + "properties": { + "columns": { + "description": "Number of columns in the table.", + "type": "integer", + "format": "int32" + }, + "tableColumns": { + "description": "Properties of each column.", + "type": "array", + "items": { + "$ref": "TableColumnProperties" + } + }, + "rows": { + "description": "Number of rows in the table.", + "type": "integer", + "format": "int32" + }, + "tableRows": { + "description": "Properties and contents of each row.\n\nCells that span multiple rows are contained in only one of these rows and\nhave a row_span greater\nthan 1.", + "type": "array", + "items": { + "$ref": "TableRow" + } + } + }, + "id": "Table" + }, + "NestingLevel": { + "description": "Contains properties describing the look and feel of a list bullet at a given\nlevel of nesting.", + "type": "object", + "properties": { + "bulletStyle": { + "description": "The style of a bullet at this level of nesting.", + "$ref": "TextStyle" + } + }, + "id": "NestingLevel" + }, + "DuplicateObjectResponse": { + "description": "The response of duplicating an object.", + "type": "object", + "properties": { + "objectId": { + "description": "The ID of the new duplicate object.", + "type": "string" + } + }, + "id": "DuplicateObjectResponse" + }, + "RefreshSheetsChartRequest": { + "description": "Refreshes an embedded Google Sheets chart by replacing it with the latest\nversion of the chart from Google Sheets.\n\nNOTE: Refreshing charts requires at least one of the spreadsheets.readonly,\nspreadsheets, drive.readonly, or drive OAuth scopes.", + "type": "object", + "properties": { + "objectId": { + "description": "The object ID of the chart to refresh.", + "type": "string" + } + }, + "id": "RefreshSheetsChartRequest" + }, + "TableCellLocation": { + "description": "A location of a single table cell within a table.", + "type": "object", + "properties": { + "rowIndex": { + "description": "The 0-based row index.", + "type": "integer", + "format": "int32" + }, + "columnIndex": { + "description": "The 0-based column index.", + "type": "integer", + "format": "int32" + } + }, + "id": "TableCellLocation" + }, + "TextContent": { + "description": "The general text content. The text must reside in a compatible shape (e.g.\ntext box or rectangle) or a table cell in a page.", + "type": "object", + "properties": { + "lists": { + "description": "The bulleted lists contained in this text, keyed by list ID.", + "additionalProperties": { + "$ref": "List" + }, + "type": "object" + }, + "textElements": { + "description": "The text contents broken down into its component parts, including styling\ninformation. This property is read-only.", + "type": "array", + "items": { + "$ref": "TextElement" + } + } + }, + "id": "TextContent" + }, + "PageElement": { + "description": "A visual element rendered on a page.", + "type": "object", + "properties": { + "description": { + "description": "The description of the page element. Combined with title to display alt\ntext.", + "type": "string" + }, + "title": { + "description": "The title of the page element. Combined with description to display alt\ntext.", + "type": "string" + }, + "transform": { + "description": "The transform of the page element.", + "$ref": "AffineTransform" + }, + "video": { + "description": "A video page element.", + "$ref": "Video" + }, + "sheetsChart": { + "description": "A linked chart embedded from Google Sheets. Unlinked charts are\nrepresented as images.", + "$ref": "SheetsChart" + }, + "line": { + "description": "A line page element.", + "$ref": "Line" + }, + "table": { + "description": "A table page element.", + "$ref": "Table" + }, + "wordArt": { + "description": "A word art page element.", + "$ref": "WordArt" + }, + "shape": { + "description": "A generic shape.", + "$ref": "Shape" + }, + "elementGroup": { + "description": "A collection of page elements joined as a single unit.", + "$ref": "Group" + }, + "image": { + "description": "An image page element.", + "$ref": "Image" + }, + "objectId": { + "description": "The object ID for this page element. Object IDs used by\ngoogle.apps.slides.v1.Page and\ngoogle.apps.slides.v1.PageElement share the same namespace.", + "type": "string" + }, + "size": { + "description": "The size of the page element.", + "$ref": "Size" + } + }, + "id": "PageElement" + }, + "UpdatePagePropertiesRequest": { + "description": "Updates the properties of a Page.", + "type": "object", + "properties": { + "objectId": { + "description": "The object ID of the page the update is applied to.", + "type": "string" + }, + "fields": { + "description": "The fields that should be updated.\n\nAt least one field must be specified. The root `pageProperties` is\nimplied and should not be specified. A single `\"*\"` can be used as\nshort-hand for listing every field.\n\nFor example to update the page background solid fill color, set `fields`\nto `\"pageBackgroundFill.solidFill.color\"`.\n\nTo reset a property to its default value, include its field name in the\nfield mask but leave the field itself unset.", + "type": "string", + "format": "google-fieldmask" + }, + "pageProperties": { + "description": "The page properties to update.", + "$ref": "PageProperties" + } + }, + "id": "UpdatePagePropertiesRequest" + }, + "UpdateTableCellPropertiesRequest": { + "description": "Update the properties of a TableCell.", + "type": "object", + "properties": { + "objectId": { + "description": "The object ID of the table.", + "type": "string" + }, + "tableRange": { + "description": "The table range representing the subset of the table to which the updates\nare applied. If a table range is not specified, the updates will apply to\nthe entire table.", + "$ref": "TableRange" + }, + "fields": { + "description": "The fields that should be updated.\n\nAt least one field must be specified. The root `tableCellProperties` is\nimplied and should not be specified. A single `\"*\"` can be used as\nshort-hand for listing every field.\n\nFor example to update the table cell background solid fill color, set\n`fields` to `\"tableCellBackgroundFill.solidFill.color\"`.\n\nTo reset a property to its default value, include its field name in the\nfield mask but leave the field itself unset.", + "type": "string", + "format": "google-fieldmask" + }, + "tableCellProperties": { + "description": "The table cell properties to update.", + "$ref": "TableCellProperties" + } + }, + "id": "UpdateTableCellPropertiesRequest" + }, + "BatchUpdatePresentationRequest": { + "description": "Request message for PresentationsService.BatchUpdatePresentation.", + "type": "object", + "properties": { + "requests": { + "description": "A list of updates to apply to the presentation.", + "type": "array", + "items": { + "$ref": "Request" + } + } + }, + "id": "BatchUpdatePresentationRequest" + }, + "Dimension": { + "description": "A magnitude in a single direction in the specified units.", + "type": "object", + "properties": { + "unit": { + "description": "The units for magnitude.", + "enum": [ + "UNIT_UNSPECIFIED", + "EMU", + "PT" + ], + "enumDescriptions": [ + "The units are unknown.", + "An English Metric Unit (EMU) is defined as 1/360,000 of a centimeter\nand thus there are 914,400 EMUs per inch, and 12,700 EMUs per point.", + "A point, 1/72 of an inch." + ], + "type": "string" + }, + "magnitude": { + "description": "The magnitude.", + "type": "number", + "format": "double" + } + }, + "id": "Dimension" + }, + "Placeholder": { + "description": "The placeholder information that uniquely identifies a placeholder shape.", + "type": "object", + "properties": { + "index": { + "description": "The index of the placeholder. If the same placeholder types are the present\nin the same page, they would have different index values.", + "type": "integer", + "format": "int32" + }, + "type": { + "description": "The type of the placeholder.", + "enum": [ + "NONE", + "BODY", + "CHART", + "CLIP_ART", + "CENTERED_TITLE", + "DIAGRAM", + "DATE_AND_TIME", + "FOOTER", + "HEADER", + "MEDIA", + "OBJECT", + "PICTURE", + "SLIDE_NUMBER", + "SUBTITLE", + "TABLE", + "TITLE", + "SLIDE_IMAGE" + ], + "enumDescriptions": [ + "Default value, signifies it is not a placeholder.", + "Body text.", + "Chart or graph.", + "Clip art image.", + "Title centered.", + "Diagram.", + "Date and time.", + "Footer text.", + "Header text.", + "Multimedia.", + "Any content type.", + "Picture.", + "Number of a slide.", + "Subtitle.", + "Table.", + "Slide title.", + "Slide image." + ], + "type": "string" + }, + "parentObjectId": { + "description": "The object ID of this shape's parent placeholder.\nIf unset, the parent placeholder shape does not exist, so the shape does\nnot inherit properties from any other shape.", + "type": "string" + } + }, + "id": "Placeholder" + }, + "CreateSheetsChartRequest": { + "description": "Creates an embedded Google Sheets chart.\n\nNOTE: Chart creation requires at least one of the spreadsheets.readonly,\nspreadsheets, drive.readonly, or drive OAuth scopes.", + "type": "object", + "properties": { + "chartId": { + "description": "The ID of the specific chart in the Google Sheets spreadsheet.", + "type": "integer", + "format": "int32" + }, + "objectId": { + "description": "A user-supplied object ID.\n\nIf specified, the ID must be unique among all pages and page elements in\nthe presentation. The ID should start with a word character [a-zA-Z0-9_]\nand then followed by any number of the following characters [a-zA-Z0-9_-:].\nThe length of the ID should not be less than 5 or greater than 50.\nIf empty, a unique identifier will be generated.", + "type": "string" + }, + "spreadsheetId": { + "description": "The ID of the Google Sheets spreadsheet that contains the chart.", + "type": "string" + }, + "elementProperties": { + "description": "The element properties for the chart.\n\nWhen the aspect ratio of the provided size does not match the chart aspect\nratio, the chart is scaled and centered with respect to the size in order\nto maintain aspect ratio. The provided transform is applied after this\noperation.", + "$ref": "PageElementProperties" + }, + "linkingMode": { + "description": "The mode with which the chart is linked to the source spreadsheet. When\nnot specified, the chart will be an image that is not linked.", + "enum": [ + "NOT_LINKED_IMAGE", + "LINKED" + ], + "enumDescriptions": [ + "The chart is not associated with the source spreadsheet and cannot be\nupdated. A chart that is not linked will be inserted as an image.", + "Linking the chart allows it to be updated, and other collaborators will\nsee a link to the spreadsheet." + ], + "type": "string" + } + }, + "id": "CreateSheetsChartRequest" + }, + "DeleteTableRowRequest": { + "description": "Deletes a row from a table.", + "type": "object", + "properties": { + "tableObjectId": { + "description": "The table to delete rows from.", + "type": "string" + }, + "cellLocation": { + "description": "The reference table cell location from which a row will be deleted.\n\nThe row this cell spans will be deleted. If this is a merged cell, multiple\nrows will be deleted. If no rows remain in the table after this deletion,\nthe whole table is deleted.", + "$ref": "TableCellLocation" + } + }, + "id": "DeleteTableRowRequest" + }, + "Video": { + "description": "A PageElement kind representing a\nvideo.", + "type": "object", + "properties": { + "url": { + "description": "An URL to a video. The URL is valid as long as the source video\nexists and sharing settings do not change.", + "type": "string" + }, + "videoProperties": { + "description": "The properties of the video.", + "$ref": "VideoProperties" + }, + "source": { + "description": "The video source.", + "enum": [ + "SOURCE_UNSPECIFIED", + "YOUTUBE" + ], + "enumDescriptions": [ + "The video source is unspecified.", + "The video source is YouTube." + ], + "type": "string" + }, + "id": { + "description": "The video source's unique identifier for this video.", + "type": "string" + } + }, + "id": "Video" + }, + "Link": { + "description": "A hypertext link.", + "type": "object", + "properties": { + "url": { + "description": "If set, indicates this is a link to the external web page at this URL.", + "type": "string" + }, + "relativeLink": { + "description": "If set, indicates this is a link to a slide in this presentation,\naddressed by its position.", + "enum": [ + "RELATIVE_SLIDE_LINK_UNSPECIFIED", + "NEXT_SLIDE", + "PREVIOUS_SLIDE", + "FIRST_SLIDE", + "LAST_SLIDE" + ], + "enumDescriptions": [ + "An unspecified relative slide link.", + "A link to the next slide.", + "A link to the previous slide.", + "A link to the first slide in the presentation.", + "A link to the last slide in the presentation." + ], + "type": "string" + }, + "slideIndex": { + "description": "If set, indicates this is a link to the slide at this zero-based index\nin the presentation. There may not be a slide at this index.", + "type": "integer", + "format": "int32" + }, + "pageObjectId": { + "description": "If set, indicates this is a link to the specific page in this\npresentation with this ID. A page with this ID may not exist.", + "type": "string" + } + }, + "id": "Link" + }, + "PageBackgroundFill": { + "description": "The page background fill.", + "type": "object", + "properties": { + "stretchedPictureFill": { + "description": "Stretched picture fill.", + "$ref": "StretchedPictureFill" + }, + "propertyState": { + "description": "The background fill property state.\n\nUpdating the the fill on a page will implicitly update this field to\n`RENDERED`, unless another value is specified in the same request. To\nhave no fill on a page, set this field to `NOT_RENDERED`. In this case,\nany other fill fields set in the same request will be ignored.", + "enum": [ + "RENDERED", + "NOT_RENDERED", + "INHERIT" + ], + "enumDescriptions": [ + "If a property's state is RENDERED, then the element has the corresponding\nproperty when rendered on a page. If the element is a placeholder shape as\ndetermined by the placeholder\nfield, and it inherits from a placeholder shape, the corresponding field\nmay be unset, meaning that the property value is inherited from a parent\nplaceholder. If the element does not inherit, then the field will contain\nthe rendered value. This is the default value.", + "If a property's state is NOT_RENDERED, then the element does not have the\ncorresponding property when rendered on a page. However, the field may\nstill be set so it can be inherited by child shapes. To remove a property\nfrom a rendered element, set its property_state to NOT_RENDERED.", + "If a property's state is INHERIT, then the property state uses the value of\ncorresponding `property_state` field on the parent shape. Elements that do\nnot inherit will never have an INHERIT property state." + ], + "type": "string" + }, + "solidFill": { + "description": "Solid color fill.", + "$ref": "SolidFill" + } + }, + "id": "PageBackgroundFill" + }, + "ColorStop": { + "description": "A color and position in a gradient band.", + "type": "object", + "properties": { + "color": { + "description": "The color of the gradient stop.", + "$ref": "OpaqueColor" + }, + "position": { + "description": "The relative position of the color stop in the gradient band measured\nin percentage. The value should be in the interval [0.0, 1.0].", + "type": "number", + "format": "float" + }, + "alpha": { + "description": "The alpha value of this color in the gradient band. Defaults to 1.0,\nfully opaque.", + "type": "number", + "format": "float" + } + }, + "id": "ColorStop" + }, + "ThemeColorPair": { + "description": "A pair mapping a theme color type to the concrete color it represents.", + "type": "object", + "properties": { + "color": { + "description": "The concrete color corresponding to the theme color type above.", + "$ref": "RgbColor" + }, + "type": { + "description": "The type of the theme color.", + "enum": [ + "THEME_COLOR_TYPE_UNSPECIFIED", + "DARK1", + "LIGHT1", + "DARK2", + "LIGHT2", + "ACCENT1", + "ACCENT2", + "ACCENT3", + "ACCENT4", + "ACCENT5", + "ACCENT6", + "HYPERLINK", + "FOLLOWED_HYPERLINK", + "TEXT1", + "BACKGROUND1", + "TEXT2", + "BACKGROUND2" + ], + "enumDescriptions": [ + "Unspecified theme color. This value should not be used.", + "Represents the first dark color.", + "Represents the first light color.", + "Represents the second dark color.", + "Represents the second light color.", + "Represents the first accent color.", + "Represents the second accent color.", + "Represents the third accent color.", + "Represents the fourth accent color.", + "Represents the fifth accent color.", + "Represents the sixth accent color.", + "Represents the color to use for hyperlinks.", + "Represents the color to use for visited hyperlinks.", + "Represents the first text color.", + "Represents the first background color.", + "Represents the second text color.", + "Represents the second background color." + ], + "type": "string" + } + }, + "id": "ThemeColorPair" + }, + "ReplaceAllShapesWithImageRequest": { + "description": "Replaces all shapes that match the given criteria with the provided image.", + "type": "object", + "properties": { + "replaceMethod": { + "description": "The replace method.", + "enum": [ + "CENTER_INSIDE", + "CENTER_CROP" + ], + "enumDescriptions": [ + "Scales and centers the image to fit within the bounds of the original\nshape and maintains the image's aspect ratio. The rendered size of the\nimage may be smaller than the size of the shape. This is the default\nmethod when one is not specified.", + "Scales and centers the image to fill the bounds of the original shape.\nThe image may be cropped in order to fill the shape. The rendered size of\nthe image will be the same as that of the original shape." + ], + "type": "string" + }, + "containsText": { + "description": "If set, this request will replace all of the shapes that contain the\ngiven text.", + "$ref": "SubstringMatchCriteria" + }, + "imageUrl": { + "description": "The image URL.\n\nThe image is fetched once at insertion time and a copy is stored for\ndisplay inside the presentation. Images must be less than 50MB in size,\ncannot exceed 25 megapixels, and must be in either in PNG, JPEG, or GIF\nformat.", + "type": "string" + } + }, + "id": "ReplaceAllShapesWithImageRequest" + }, + "DeleteObjectRequest": { + "description": "Deletes an object, either pages or\npage elements, from the\npresentation.", + "type": "object", + "properties": { + "objectId": { + "description": "The object ID of the page or page element to delete.\n\nIf after a delete operation a group contains\nonly 1 or no page elements, the group is also deleted.\n\nIf a placeholder is deleted on a layout, any empty inheriting shapes are\nalso deleted.", + "type": "string" + } + }, + "id": "DeleteObjectRequest" + }, + "CreateImageResponse": { + "description": "The result of creating an image.", + "type": "object", + "properties": { + "objectId": { + "description": "The object ID of the created image.", + "type": "string" + } + }, + "id": "CreateImageResponse" + }, + "Recolor": { + "description": "A recolor effect applied on an image.", + "type": "object", + "properties": { + "recolorStops": { + "description": "The recolor effect is represented by a gradient, which is a list of color\nstops. This property is read-only.", + "type": "array", + "items": { + "$ref": "ColorStop" + } + } + }, + "id": "Recolor" + }, + "TextStyle": { + "description": "Represents the styling that can be applied to a TextRun.\n\nIf this text is contained in a shape with a parent placeholder, then these text styles may be\ninherited from the parent. Which text styles are inherited depend on the\nnesting level of lists:\n\n* A text run in a paragraph that is not in a list will inherit its text style\n from the the newline character in the paragraph at the 0 nesting level of\n the list inside the parent placeholder.\n* A text run in a paragraph that is in a list will inherit its text style\n from the newline character in the paragraph at its corresponding nesting\n level of the list inside the parent placeholder.\n\nInherited text styles are represented as unset fields in this message. If\ntext is contained in a shape without a parent placeholder, unsetting these\nfields will revert the style to a value matching the defaults in the Slides\neditor.", + "type": "object", + "properties": { + "bold": { + "description": "Whether or not the text is bold.", + "type": "boolean" + }, + "italic": { + "description": "Whether or not the text is italicized.", + "type": "boolean" + }, + "baselineOffset": { + "description": "The text's vertical offset from its normal position.\n\nText with `SUPERSCRIPT` or `SUBSCRIPT` baseline offsets is automatically\nrendered in a smaller font size, computed based on the `font_size` field.\nThe `font_size` itself is not affected by changes in this field.", + "enum": [ + "BASELINE_OFFSET_UNSPECIFIED", + "NONE", + "SUPERSCRIPT", + "SUBSCRIPT" + ], + "enumDescriptions": [ + "The text's baseline offset is inherited from the parent.", + "The text is not vertically offset.", + "The text is vertically offset upwards (superscript).", + "The text is vertically offset downwards (subscript)." + ], + "type": "string" + }, + "foregroundColor": { + "description": "The color of the text itself. If set, the color is either opaque or\ntransparent, depending on if the `opaque_color` field in it is set.", + "$ref": "OptionalColor" + }, + "fontFamily": { + "description": "The font family of the text.\n\nThe font family can be any font from the Font menu in Slides or from\n[Google Fonts] (https://fonts.google.com/). If the font name is\nunrecognized, the text is rendered in `Arial`.\n\nSome fonts can affect the weight of the text. If an update request\nspecifies values for both `font_family` and `bold`, the explicitly-set\n`bold` value is used.", + "type": "string" + }, + "strikethrough": { + "description": "Whether or not the text is struck through.", + "type": "boolean" + }, + "link": { + "description": "The hyperlink destination of the text. If unset, there is no link. Links\nare not inherited from parent text.\n\nChanging the link in an update request causes some other changes to the\ntext style of the range:\n\n* When setting a link, the text foreground color will be set to\n ThemeColorType.HYPERLINK and the text will\n be underlined. If these fields are modified in the same\n request, those values will be used instead of the link defaults.\n* Setting a link on a text range that overlaps with an existing link will\n also update the existing link to point to the new URL.\n* Links are not settable on newline characters. As a result, setting a link\n on a text range that crosses a paragraph boundary, such as `\"ABC\\n123\"`,\n will separate the newline character(s) into their own text runs. The\n link will be applied separately to the runs before and after the newline.\n* Removing a link will update the text style of the range to match the\n style of the preceding text (or the default text styles if the preceding\n text is another link) unless different styles are being set in the same\n request.", + "$ref": "Link" + }, + "smallCaps": { + "description": "Whether or not the text is in small capital letters.", + "type": "boolean" + }, + "backgroundColor": { + "description": "The background color of the text. If set, the color is either opaque or\ntransparent, depending on if the `opaque_color` field in it is set.", + "$ref": "OptionalColor" + }, + "fontSize": { + "description": "The size of the text's font. When read, the `font_size` will specified in\npoints.", + "$ref": "Dimension" + }, + "underline": { + "description": "Whether or not the text is underlined.", + "type": "boolean" + } + }, + "id": "TextStyle" + }, + "UpdateLinePropertiesRequest": { + "description": "Updates the properties of a Line.", + "type": "object", + "properties": { + "objectId": { + "description": "The object ID of the line the update is applied to.", + "type": "string" + }, + "lineProperties": { + "description": "The line properties to update.", + "$ref": "LineProperties" + }, + "fields": { + "description": "The fields that should be updated.\n\nAt least one field must be specified. The root `lineProperties` is\nimplied and should not be specified. A single `\"*\"` can be used as\nshort-hand for listing every field.\n\nFor example to update the line solid fill color, set `fields` to\n`\"lineFill.solidFill.color\"`.\n\nTo reset a property to its default value, include its field name in the\nfield mask but leave the field itself unset.", + "type": "string", + "format": "google-fieldmask" + } + }, + "id": "UpdateLinePropertiesRequest" + }, + "TableCellBackgroundFill": { + "description": "The table cell background fill.", + "type": "object", + "properties": { + "propertyState": { + "description": "The background fill property state.\n\nUpdating the the fill on a table cell will implicitly update this field\nto `RENDERED`, unless another value is specified in the same request. To\nhave no fill on a table cell, set this field to `NOT_RENDERED`. In this\ncase, any other fill fields set in the same request will be ignored.", + "enum": [ + "RENDERED", + "NOT_RENDERED", + "INHERIT" + ], + "enumDescriptions": [ + "If a property's state is RENDERED, then the element has the corresponding\nproperty when rendered on a page. If the element is a placeholder shape as\ndetermined by the placeholder\nfield, and it inherits from a placeholder shape, the corresponding field\nmay be unset, meaning that the property value is inherited from a parent\nplaceholder. If the element does not inherit, then the field will contain\nthe rendered value. This is the default value.", + "If a property's state is NOT_RENDERED, then the element does not have the\ncorresponding property when rendered on a page. However, the field may\nstill be set so it can be inherited by child shapes. To remove a property\nfrom a rendered element, set its property_state to NOT_RENDERED.", + "If a property's state is INHERIT, then the property state uses the value of\ncorresponding `property_state` field on the parent shape. Elements that do\nnot inherit will never have an INHERIT property state." + ], + "type": "string" + }, + "solidFill": { + "description": "Solid color fill.", + "$ref": "SolidFill" + } + }, + "id": "TableCellBackgroundFill" + }, + "SolidFill": { + "description": "A solid color fill. The page or page element is filled entirely with the\nspecified color value.\n\nIf any field is unset, its value may be inherited from a parent placeholder\nif it exists.", + "type": "object", + "properties": { + "color": { + "description": "The color value of the solid fill.", + "$ref": "OpaqueColor" + }, + "alpha": { + "description": "The fraction of this `color` that should be applied to the pixel.\nThat is, the final pixel color is defined by the equation:\n\n pixel color = alpha * (color) + (1.0 - alpha) * (background color)\n\nThis means that a value of 1.0 corresponds to a solid color, whereas\na value of 0.0 corresponds to a completely transparent color.", + "type": "number", + "format": "float" + } + }, + "id": "SolidFill" + }, + "DuplicateObjectRequest": { + "description": "Duplicates a slide or page element.\n\nWhen duplicating a slide, the duplicate slide will be created immediately\nfollowing the specified slide. When duplicating a page element, the duplicate\nwill be placed on the same page at the same position as the original.", + "type": "object", + "properties": { + "objectId": { + "description": "The ID of the object to duplicate.", + "type": "string" + }, + "objectIds": { + "description": "The object being duplicated may contain other objects, for example when\nduplicating a slide or a group page element. This map defines how the IDs\nof duplicated objects are generated: the keys are the IDs of the original\nobjects and its values are the IDs that will be assigned to the\ncorresponding duplicate object. The ID of the source object's duplicate\nmay be specified in this map as well, using the same value of the\n`object_id` field as a key and the newly desired ID as the value.\n\nAll keys must correspond to existing IDs in the presentation. All values\nmust be unique in the presentation and must start with an alphanumeric\ncharacter or an underscore (matches regex `[a-zA-Z0-9_]`); remaining\ncharacters may include those as well as a hyphen or colon (matches regex\n`[a-zA-Z0-9_-:]`). The length of the new ID must not be less than 5 or\ngreater than 50.\n\nIf any IDs of source objects are omitted from the map, a new random ID will\nbe assigned. If the map is empty or unset, all duplicate objects will\nreceive a new random ID.", + "additionalProperties": { + "type": "string" + }, + "type": "object" + } + }, + "id": "DuplicateObjectRequest" + }, + "SheetsChart": { + "description": "A PageElement kind representing\na linked chart embedded from Google Sheets.", + "type": "object", + "properties": { + "chartId": { + "description": "The ID of the specific chart in the Google Sheets spreadsheet that is\nembedded.", + "type": "integer", + "format": "int32" + }, + "spreadsheetId": { + "description": "The ID of the Google Sheets spreadsheet that contains the source chart.", + "type": "string" + }, + "sheetsChartProperties": { + "description": "The properties of the Sheets chart.", + "$ref": "SheetsChartProperties" + }, + "contentUrl": { + "description": "The URL of an image of the embedded chart, with a default lifetime of 30\nminutes. This URL is tagged with the account of the requester. Anyone with\nthe URL effectively accesses the image as the original requester. Access to\nthe image may be lost if the presentation's sharing settings change.", + "type": "string" + } + }, + "id": "SheetsChart" + }, + "PageProperties": { + "description": "The properties of the Page.\n\nThe page will inherit properties from the parent page. Depending on the page\ntype the hierarchy is defined in either\nSlideProperties or\nLayoutProperties.", + "type": "object", + "properties": { + "pageBackgroundFill": { + "description": "The background fill of the page. If unset, the background fill is inherited\nfrom a parent page if it exists. If the page has no parent, then the\nbackground fill defaults to the corresponding fill in the Slides editor.", + "$ref": "PageBackgroundFill" + }, + "colorScheme": { + "description": "The color scheme of the page. If unset, the color scheme is inherited from\na parent page. If the page has no parent, the color scheme uses a default\nSlides color scheme. This field is read-only.", + "$ref": "ColorScheme" + } + }, + "id": "PageProperties" + }, + "Shadow": { + "description": "The shadow properties of a page element.\n\nIf these fields are unset, they may be inherited from a parent placeholder\nif it exists. If there is no parent, the fields will default to the value\nused for new page elements created in the Slides editor, which may depend on\nthe page element kind.", + "type": "object", + "properties": { + "alignment": { + "description": "The alignment point of the shadow, that sets the origin for translate,\nscale and skew of the shadow.", + "enum": [ + "RECTANGLE_POSITION_UNSPECIFIED", + "TOP_LEFT", + "TOP_CENTER", + "TOP_RIGHT", + "LEFT_CENTER", + "CENTER", + "RIGHT_CENTER", + "BOTTOM_LEFT", + "BOTTOM_CENTER", + "BOTTOM_RIGHT" + ], + "enumDescriptions": [ + "Unspecified.", + "Top left.", + "Top center.", + "Top right.", + "Left center.", + "Center.", + "Right center.", + "Bottom left.", + "Bottom center.", + "Bottom right." + ], + "type": "string" + }, + "rotateWithShape": { + "description": "Whether the shadow should rotate with the shape.", + "type": "boolean" + }, + "transform": { + "description": "Transform that encodes the translate, scale, and skew of the shadow,\nrelative to the alignment position.", + "$ref": "AffineTransform" + }, + "color": { + "description": "The shadow color value.", + "$ref": "OpaqueColor" + }, + "blurRadius": { + "description": "The radius of the shadow blur. The larger the radius, the more diffuse the\nshadow becomes.", + "$ref": "Dimension" + }, + "propertyState": { + "description": "The shadow property state.\n\nUpdating the the shadow on a page element will implicitly update this field\nto `RENDERED`, unless another value is specified in the same request. To\nhave no shadow on a page element, set this field to `NOT_RENDERED`. In this\ncase, any other shadow fields set in the same request will be ignored.", + "enum": [ + "RENDERED", + "NOT_RENDERED", + "INHERIT" + ], + "enumDescriptions": [ + "If a property's state is RENDERED, then the element has the corresponding\nproperty when rendered on a page. If the element is a placeholder shape as\ndetermined by the placeholder\nfield, and it inherits from a placeholder shape, the corresponding field\nmay be unset, meaning that the property value is inherited from a parent\nplaceholder. If the element does not inherit, then the field will contain\nthe rendered value. This is the default value.", + "If a property's state is NOT_RENDERED, then the element does not have the\ncorresponding property when rendered on a page. However, the field may\nstill be set so it can be inherited by child shapes. To remove a property\nfrom a rendered element, set its property_state to NOT_RENDERED.", + "If a property's state is INHERIT, then the property state uses the value of\ncorresponding `property_state` field on the parent shape. Elements that do\nnot inherit will never have an INHERIT property state." + ], + "type": "string" + }, + "alpha": { + "description": "The alpha of the shadow's color, from 0.0 to 1.0.", + "type": "number", + "format": "float" + }, + "type": { + "description": "The type of the shadow.", + "enum": [ + "SHADOW_TYPE_UNSPECIFIED", + "OUTER" + ], + "enumDescriptions": [ + "Unspecified shadow type.", + "Outer shadow." + ], + "type": "string" + } + }, + "id": "Shadow" + }, + "LayoutReference": { + "description": "Slide layout reference. This may reference either:\n\n- A predefined layout\n- One of the layouts in the presentation.", + "type": "object", + "properties": { + "predefinedLayout": { + "description": "Predefined layout.", + "enum": [ + "PREDEFINED_LAYOUT_UNSPECIFIED", + "BLANK", + "CAPTION_ONLY", + "TITLE", + "TITLE_AND_BODY", + "TITLE_AND_TWO_COLUMNS", + "TITLE_ONLY", + "SECTION_HEADER", + "SECTION_TITLE_AND_DESCRIPTION", + "ONE_COLUMN_TEXT", + "MAIN_POINT", + "BIG_NUMBER" + ], + "enumDescriptions": [ + "Unspecified layout.", + "Blank layout, with no placeholders.", + "Layout with a caption at the bottom.", + "Layout with a title and a subtitle.", + "Layout with a title and body.", + "Layout with a title and two columns.", + "Layout with only a title.", + "Layout with a section title.", + "Layout with a title and subtitle on one side and description on the other.", + "Layout with one title and one body, arranged in a single column.", + "Layout with a main point.", + "Layout with a big number heading." + ], + "type": "string" + }, + "layoutId": { + "description": "Layout ID: the object ID of one of the layouts in the presentation.", + "type": "string" + } + }, + "id": "LayoutReference" + }, + "CreateSheetsChartResponse": { + "description": "The result of creating an embedded Google Sheets chart.", + "type": "object", + "properties": { + "objectId": { + "description": "The object ID of the created chart.", + "type": "string" + } + }, + "id": "CreateSheetsChartResponse" + }, + "ReplaceAllTextResponse": { + "description": "The result of replacing text.", + "type": "object", + "properties": { + "occurrencesChanged": { + "description": "The number of occurrences changed by replacing all text.", + "type": "integer", + "format": "int32" + } + }, + "id": "ReplaceAllTextResponse" + }, + "LayoutProperties": { + "description": "The properties of Page are only\nrelevant for pages with page_type LAYOUT.", + "type": "object", + "properties": { + "displayName": { + "description": "The human readable name of the layout in the presentation's locale.", + "type": "string" + }, + "masterObjectId": { + "description": "The object ID of the master that this layout is based on.", + "type": "string" + }, + "name": { + "description": "The name of the layout.", + "type": "string" + } + }, + "id": "LayoutProperties" + }, + "InsertTableColumnsRequest": { + "description": "Inserts columns into a table.\n\nOther columns in the table will be resized to fit the new column.", + "type": "object", + "properties": { + "tableObjectId": { + "description": "The table to insert columns into.", + "type": "string" + }, + "insertRight": { + "description": "Whether to insert new columns to the right of the reference cell location.\n\n- `True`: insert to the right.\n- `False`: insert to the left.", + "type": "boolean" + }, + "cellLocation": { + "description": "The reference table cell location from which columns will be inserted.\n\nA new column will be inserted to the left (or right) of the column where\nthe reference cell is. If the reference cell is a merged cell, a new\ncolumn will be inserted to the left (or right) of the merged cell.", + "$ref": "TableCellLocation" + }, + "number": { + "description": "The number of columns to be inserted. Maximum 20 per request.", + "type": "integer", + "format": "int32" + } + }, + "id": "InsertTableColumnsRequest" + }, + "DeleteTableColumnRequest": { + "description": "Deletes a column from a table.", + "type": "object", + "properties": { + "tableObjectId": { + "description": "The table to delete columns from.", + "type": "string" + }, + "cellLocation": { + "description": "The reference table cell location from which a column will be deleted.\n\nThe column this cell spans will be deleted. If this is a merged cell,\nmultiple columns will be deleted. If no columns remain in the table after\nthis deletion, the whole table is deleted.", + "$ref": "TableCellLocation" + } + }, + "id": "DeleteTableColumnRequest" + }, + "TableRow": { + "description": "Properties and contents of each row in a table.", + "type": "object", + "properties": { + "rowHeight": { + "description": "Height of a row.", + "$ref": "Dimension" + }, + "tableCells": { + "description": "Properties and contents of each cell.\n\nCells that span multiple columns are represented only once with a\ncolumn_span greater\nthan 1. As a result, the length of this collection does not always match\nthe number of columns of the entire table.", + "type": "array", + "items": { + "$ref": "TableCell" + } + } + }, + "id": "TableRow" + }, + "AffineTransform": { + "description": "AffineTransform uses a 3x3 matrix with an implied last row of [ 0 0 1 ]\nto transform source coordinates (x,y) into destination coordinates (x', y')\naccording to:\n\n x' x = shear_y scale_y translate_y \n 1 [ 1 ]\n\nAfter transformation,\n\n x' = scale_x * x + shear_x * y + translate_x;\n y' = scale_y * y + shear_y * x + translate_y;\n\nThis message is therefore composed of these six matrix elements.", + "type": "object", + "properties": { + "unit": { + "description": "The units for translate elements.", + "enum": [ + "UNIT_UNSPECIFIED", + "EMU", + "PT" + ], + "enumDescriptions": [ + "The units are unknown.", + "An English Metric Unit (EMU) is defined as 1/360,000 of a centimeter\nand thus there are 914,400 EMUs per inch, and 12,700 EMUs per point.", + "A point, 1/72 of an inch." + ], + "type": "string" + }, + "shearY": { + "description": "The Y coordinate shearing element.", + "type": "number", + "format": "double" + }, + "translateX": { + "description": "The X coordinate translation element.", + "type": "number", + "format": "double" + }, + "shearX": { + "description": "The X coordinate shearing element.", + "type": "number", + "format": "double" + }, + "scaleY": { + "description": "The Y coordinate scaling element.", + "type": "number", + "format": "double" + }, + "scaleX": { + "description": "The X coordinate scaling element.", + "type": "number", + "format": "double" + }, + "translateY": { + "description": "The Y coordinate translation element.", + "type": "number", + "format": "double" + } + }, + "id": "AffineTransform" + }, + "CreateShapeRequest": { + "description": "Creates a new shape.", + "type": "object", + "properties": { + "objectId": { + "description": "A user-supplied object ID.\n\nIf you specify an ID, it must be unique among all pages and page elements\nin the presentation. The ID must start with an alphanumeric character or an\nunderscore (matches regex `[a-zA-Z0-9_]`); remaining characters\nmay include those as well as a hyphen or colon (matches regex\n`[a-zA-Z0-9_-:]`).\nThe length of the ID must not be less than 5 or greater than 50.\nIf empty, a unique identifier will be generated.", + "type": "string" + }, + "shapeType": { + "description": "The shape type.", + "enum": [ + "TYPE_UNSPECIFIED", + "TEXT_BOX", + "RECTANGLE", + "ROUND_RECTANGLE", + "ELLIPSE", + "ARC", + "BENT_ARROW", + "BENT_UP_ARROW", + "BEVEL", + "BLOCK_ARC", + "BRACE_PAIR", + "BRACKET_PAIR", + "CAN", + "CHEVRON", + "CHORD", + "CLOUD", + "CORNER", + "CUBE", + "CURVED_DOWN_ARROW", + "CURVED_LEFT_ARROW", + "CURVED_RIGHT_ARROW", + "CURVED_UP_ARROW", + "DECAGON", + "DIAGONAL_STRIPE", + "DIAMOND", + "DODECAGON", + "DONUT", + "DOUBLE_WAVE", + "DOWN_ARROW", + "DOWN_ARROW_CALLOUT", + "FOLDED_CORNER", + "FRAME", + "HALF_FRAME", + "HEART", + "HEPTAGON", + "HEXAGON", + "HOME_PLATE", + "HORIZONTAL_SCROLL", + "IRREGULAR_SEAL_1", + "IRREGULAR_SEAL_2", + "LEFT_ARROW", + "LEFT_ARROW_CALLOUT", + "LEFT_BRACE", + "LEFT_BRACKET", + "LEFT_RIGHT_ARROW", + "LEFT_RIGHT_ARROW_CALLOUT", + "LEFT_RIGHT_UP_ARROW", + "LEFT_UP_ARROW", + "LIGHTNING_BOLT", + "MATH_DIVIDE", + "MATH_EQUAL", + "MATH_MINUS", + "MATH_MULTIPLY", + "MATH_NOT_EQUAL", + "MATH_PLUS", + "MOON", + "NO_SMOKING", + "NOTCHED_RIGHT_ARROW", + "OCTAGON", + "PARALLELOGRAM", + "PENTAGON", + "PIE", + "PLAQUE", + "PLUS", + "QUAD_ARROW", + "QUAD_ARROW_CALLOUT", + "RIBBON", + "RIBBON_2", + "RIGHT_ARROW", + "RIGHT_ARROW_CALLOUT", + "RIGHT_BRACE", + "RIGHT_BRACKET", + "ROUND_1_RECTANGLE", + "ROUND_2_DIAGONAL_RECTANGLE", + "ROUND_2_SAME_RECTANGLE", + "RIGHT_TRIANGLE", + "SMILEY_FACE", + "SNIP_1_RECTANGLE", + "SNIP_2_DIAGONAL_RECTANGLE", + "SNIP_2_SAME_RECTANGLE", + "SNIP_ROUND_RECTANGLE", + "STAR_10", + "STAR_12", + "STAR_16", + "STAR_24", + "STAR_32", + "STAR_4", + "STAR_5", + "STAR_6", + "STAR_7", + "STAR_8", + "STRIPED_RIGHT_ARROW", + "SUN", + "TRAPEZOID", + "TRIANGLE", + "UP_ARROW", + "UP_ARROW_CALLOUT", + "UP_DOWN_ARROW", + "UTURN_ARROW", + "VERTICAL_SCROLL", + "WAVE", + "WEDGE_ELLIPSE_CALLOUT", + "WEDGE_RECTANGLE_CALLOUT", + "WEDGE_ROUND_RECTANGLE_CALLOUT", + "FLOW_CHART_ALTERNATE_PROCESS", + "FLOW_CHART_COLLATE", + "FLOW_CHART_CONNECTOR", + "FLOW_CHART_DECISION", + "FLOW_CHART_DELAY", + "FLOW_CHART_DISPLAY", + "FLOW_CHART_DOCUMENT", + "FLOW_CHART_EXTRACT", + "FLOW_CHART_INPUT_OUTPUT", + "FLOW_CHART_INTERNAL_STORAGE", + "FLOW_CHART_MAGNETIC_DISK", + "FLOW_CHART_MAGNETIC_DRUM", + "FLOW_CHART_MAGNETIC_TAPE", + "FLOW_CHART_MANUAL_INPUT", + "FLOW_CHART_MANUAL_OPERATION", + "FLOW_CHART_MERGE", + "FLOW_CHART_MULTIDOCUMENT", + "FLOW_CHART_OFFLINE_STORAGE", + "FLOW_CHART_OFFPAGE_CONNECTOR", + "FLOW_CHART_ONLINE_STORAGE", + "FLOW_CHART_OR", + "FLOW_CHART_PREDEFINED_PROCESS", + "FLOW_CHART_PREPARATION", + "FLOW_CHART_PROCESS", + "FLOW_CHART_PUNCHED_CARD", + "FLOW_CHART_PUNCHED_TAPE", + "FLOW_CHART_SORT", + "FLOW_CHART_SUMMING_JUNCTION", + "FLOW_CHART_TERMINATOR", + "ARROW_EAST", + "ARROW_NORTH_EAST", + "ARROW_NORTH", + "SPEECH", + "STARBURST", + "TEARDROP", + "ELLIPSE_RIBBON", + "ELLIPSE_RIBBON_2", + "CLOUD_CALLOUT", + "CUSTOM" + ], + "enumDescriptions": [ + "The shape type that is not predefined.", + "Text box shape.", + "Rectangle shape. Corresponds to ECMA-376 ST_ShapeType 'rect'.", + "Round corner rectangle shape. Corresponds to ECMA-376 ST_ShapeType\n'roundRect'", + "Ellipse shape. Corresponds to ECMA-376 ST_ShapeType 'ellipse'", + "Curved arc shape. Corresponds to ECMA-376 ST_ShapeType 'arc'", + "Bent arrow shape. Corresponds to ECMA-376 ST_ShapeType 'bentArrow'", + "Bent up arrow shape. Corresponds to ECMA-376 ST_ShapeType 'bentUpArrow'", + "Bevel shape. Corresponds to ECMA-376 ST_ShapeType 'bevel'", + "Block arc shape. Corresponds to ECMA-376 ST_ShapeType 'blockArc'", + "Brace pair shape. Corresponds to ECMA-376 ST_ShapeType 'bracePair'", + "Bracket pair shape. Corresponds to ECMA-376 ST_ShapeType 'bracketPair'", + "Can shape. Corresponds to ECMA-376 ST_ShapeType 'can'", + "Chevron shape. Corresponds to ECMA-376 ST_ShapeType 'chevron'", + "Chord shape. Corresponds to ECMA-376 ST_ShapeType 'chord'", + "Cloud shape. Corresponds to ECMA-376 ST_ShapeType 'cloud'", + "Corner shape. Corresponds to ECMA-376 ST_ShapeType 'corner'", + "Cube shape. Corresponds to ECMA-376 ST_ShapeType 'cube'", + "Curved down arrow shape. Corresponds to ECMA-376 ST_ShapeType\n'curvedDownArrow'", + "Curved left arrow shape. Corresponds to ECMA-376 ST_ShapeType\n'curvedLeftArrow'", + "Curved right arrow shape. Corresponds to ECMA-376 ST_ShapeType\n'curvedRightArrow'", + "Curved up arrow shape. Corresponds to ECMA-376 ST_ShapeType\n'curvedUpArrow'", + "Decagon shape. Corresponds to ECMA-376 ST_ShapeType 'decagon'", + "Diagonal stripe shape. Corresponds to ECMA-376 ST_ShapeType 'diagStripe'", + "Diamond shape. Corresponds to ECMA-376 ST_ShapeType 'diamond'", + "Dodecagon shape. Corresponds to ECMA-376 ST_ShapeType 'dodecagon'", + "Donut shape. Corresponds to ECMA-376 ST_ShapeType 'donut'", + "Double wave shape. Corresponds to ECMA-376 ST_ShapeType 'doubleWave'", + "Down arrow shape. Corresponds to ECMA-376 ST_ShapeType 'downArrow'", + "Callout down arrow shape. Corresponds to ECMA-376 ST_ShapeType\n'downArrowCallout'", + "Folded corner shape. Corresponds to ECMA-376 ST_ShapeType 'foldedCorner'", + "Frame shape. Corresponds to ECMA-376 ST_ShapeType 'frame'", + "Half frame shape. Corresponds to ECMA-376 ST_ShapeType 'halfFrame'", + "Heart shape. Corresponds to ECMA-376 ST_ShapeType 'heart'", + "Heptagon shape. Corresponds to ECMA-376 ST_ShapeType 'heptagon'", + "Hexagon shape. Corresponds to ECMA-376 ST_ShapeType 'hexagon'", + "Home plate shape. Corresponds to ECMA-376 ST_ShapeType 'homePlate'", + "Horizontal scroll shape. Corresponds to ECMA-376 ST_ShapeType\n'horizontalScroll'", + "Irregular seal 1 shape. Corresponds to ECMA-376 ST_ShapeType\n'irregularSeal1'", + "Irregular seal 2 shape. Corresponds to ECMA-376 ST_ShapeType\n'irregularSeal2'", + "Left arrow shape. Corresponds to ECMA-376 ST_ShapeType 'leftArrow'", + "Callout left arrow shape. Corresponds to ECMA-376 ST_ShapeType\n'leftArrowCallout'", + "Left brace shape. Corresponds to ECMA-376 ST_ShapeType 'leftBrace'", + "Left bracket shape. Corresponds to ECMA-376 ST_ShapeType 'leftBracket'", + "Left right arrow shape. Corresponds to ECMA-376 ST_ShapeType\n'leftRightArrow'", + "Callout left right arrow shape. Corresponds to ECMA-376 ST_ShapeType\n'leftRightArrowCallout'", + "Left right up arrow shape. Corresponds to ECMA-376 ST_ShapeType\n'leftRightUpArrow'", + "Left up arrow shape. Corresponds to ECMA-376 ST_ShapeType 'leftUpArrow'", + "Lightning bolt shape. Corresponds to ECMA-376 ST_ShapeType\n'lightningBolt'", + "Divide math shape. Corresponds to ECMA-376 ST_ShapeType 'mathDivide'", + "Equal math shape. Corresponds to ECMA-376 ST_ShapeType 'mathEqual'", + "Minus math shape. Corresponds to ECMA-376 ST_ShapeType 'mathMinus'", + "Multiply math shape. Corresponds to ECMA-376 ST_ShapeType 'mathMultiply'", + "Not equal math shape. Corresponds to ECMA-376 ST_ShapeType 'mathNotEqual'", + "Plus math shape. Corresponds to ECMA-376 ST_ShapeType 'mathPlus'", + "Moon shape. Corresponds to ECMA-376 ST_ShapeType 'moon'", + "No smoking shape. Corresponds to ECMA-376 ST_ShapeType 'noSmoking'", + "Notched right arrow shape. Corresponds to ECMA-376 ST_ShapeType\n'notchedRightArrow'", + "Octagon shape. Corresponds to ECMA-376 ST_ShapeType 'octagon'", + "Parallelogram shape. Corresponds to ECMA-376 ST_ShapeType 'parallelogram'", + "Pentagon shape. Corresponds to ECMA-376 ST_ShapeType 'pentagon'", + "Pie shape. Corresponds to ECMA-376 ST_ShapeType 'pie'", + "Plaque shape. Corresponds to ECMA-376 ST_ShapeType 'plaque'", + "Plus shape. Corresponds to ECMA-376 ST_ShapeType 'plus'", + "Quad-arrow shape. Corresponds to ECMA-376 ST_ShapeType 'quadArrow'", + "Callout quad-arrow shape. Corresponds to ECMA-376 ST_ShapeType\n'quadArrowCallout'", + "Ribbon shape. Corresponds to ECMA-376 ST_ShapeType 'ribbon'", + "Ribbon 2 shape. Corresponds to ECMA-376 ST_ShapeType 'ribbon2'", + "Right arrow shape. Corresponds to ECMA-376 ST_ShapeType 'rightArrow'", + "Callout right arrow shape. Corresponds to ECMA-376 ST_ShapeType\n'rightArrowCallout'", + "Right brace shape. Corresponds to ECMA-376 ST_ShapeType 'rightBrace'", + "Right bracket shape. Corresponds to ECMA-376 ST_ShapeType 'rightBracket'", + "One round corner rectangle shape. Corresponds to ECMA-376 ST_ShapeType\n'round1Rect'", + "Two diagonal round corner rectangle shape. Corresponds to ECMA-376\nST_ShapeType 'round2DiagRect'", + "Two same-side round corner rectangle shape. Corresponds to ECMA-376\nST_ShapeType 'round2SameRect'", + "Right triangle shape. Corresponds to ECMA-376 ST_ShapeType 'rtTriangle'", + "Smiley face shape. Corresponds to ECMA-376 ST_ShapeType 'smileyFace'", + "One snip corner rectangle shape. Corresponds to ECMA-376 ST_ShapeType\n'snip1Rect'", + "Two diagonal snip corner rectangle shape. Corresponds to ECMA-376\nST_ShapeType 'snip2DiagRect'", + "Two same-side snip corner rectangle shape. Corresponds to ECMA-376\nST_ShapeType 'snip2SameRect'", + "One snip one round corner rectangle shape. Corresponds to ECMA-376\nST_ShapeType 'snipRoundRect'", + "Ten pointed star shape. Corresponds to ECMA-376 ST_ShapeType 'star10'", + "Twelve pointed star shape. Corresponds to ECMA-376 ST_ShapeType 'star12'", + "Sixteen pointed star shape. Corresponds to ECMA-376 ST_ShapeType 'star16'", + "Twenty four pointed star shape. Corresponds to ECMA-376 ST_ShapeType\n'star24'", + "Thirty two pointed star shape. Corresponds to ECMA-376 ST_ShapeType\n'star32'", + "Four pointed star shape. Corresponds to ECMA-376 ST_ShapeType 'star4'", + "Five pointed star shape. Corresponds to ECMA-376 ST_ShapeType 'star5'", + "Six pointed star shape. Corresponds to ECMA-376 ST_ShapeType 'star6'", + "Seven pointed star shape. Corresponds to ECMA-376 ST_ShapeType 'star7'", + "Eight pointed star shape. Corresponds to ECMA-376 ST_ShapeType 'star8'", + "Striped right arrow shape. Corresponds to ECMA-376 ST_ShapeType\n'stripedRightArrow'", + "Sun shape. Corresponds to ECMA-376 ST_ShapeType 'sun'", + "Trapezoid shape. Corresponds to ECMA-376 ST_ShapeType 'trapezoid'", + "Triangle shape. Corresponds to ECMA-376 ST_ShapeType 'triangle'", + "Up arrow shape. Corresponds to ECMA-376 ST_ShapeType 'upArrow'", + "Callout up arrow shape. Corresponds to ECMA-376 ST_ShapeType\n'upArrowCallout'", + "Up down arrow shape. Corresponds to ECMA-376 ST_ShapeType 'upDownArrow'", + "U-turn arrow shape. Corresponds to ECMA-376 ST_ShapeType 'uturnArrow'", + "Vertical scroll shape. Corresponds to ECMA-376 ST_ShapeType\n'verticalScroll'", + "Wave shape. Corresponds to ECMA-376 ST_ShapeType 'wave'", + "Callout wedge ellipse shape. Corresponds to ECMA-376 ST_ShapeType\n'wedgeEllipseCallout'", + "Callout wedge rectangle shape. Corresponds to ECMA-376 ST_ShapeType\n'wedgeRectCallout'", + "Callout wedge round rectangle shape. Corresponds to ECMA-376 ST_ShapeType\n'wedgeRoundRectCallout'", + "Alternate process flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartAlternateProcess'", + "Collate flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartCollate'", + "Connector flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartConnector'", + "Decision flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartDecision'", + "Delay flow shape. Corresponds to ECMA-376 ST_ShapeType 'flowChartDelay'", + "Display flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartDisplay'", + "Document flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartDocument'", + "Extract flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartExtract'", + "Input output flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartInputOutput'", + "Internal storage flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartInternalStorage'", + "Magnetic disk flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartMagneticDisk'", + "Magnetic drum flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartMagneticDrum'", + "Magnetic tape flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartMagneticTape'", + "Manual input flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartManualInput'", + "Manual operation flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartManualOperation'", + "Merge flow shape. Corresponds to ECMA-376 ST_ShapeType 'flowChartMerge'", + "Multi-document flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartMultidocument'", + "Offline storage flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartOfflineStorage'", + "Off-page connector flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartOffpageConnector'", + "Online storage flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartOnlineStorage'", + "Or flow shape. Corresponds to ECMA-376 ST_ShapeType 'flowChartOr'", + "Predefined process flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartPredefinedProcess'", + "Preparation flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartPreparation'", + "Process flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartProcess'", + "Punched card flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartPunchedCard'", + "Punched tape flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartPunchedTape'", + "Sort flow shape. Corresponds to ECMA-376 ST_ShapeType 'flowChartSort'", + "Summing junction flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartSummingJunction'", + "Terminator flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartTerminator'", + "East arrow shape.", + "Northeast arrow shape.", + "North arrow shape.", + "Speech shape.", + "Star burst shape.", + "Teardrop shape. Corresponds to ECMA-376 ST_ShapeType 'teardrop'", + "Ellipse ribbon shape. Corresponds to ECMA-376 ST_ShapeType\n'ellipseRibbon'", + "Ellipse ribbon 2 shape. Corresponds to ECMA-376 ST_ShapeType\n'ellipseRibbon2'", + "Callout cloud shape. Corresponds to ECMA-376 ST_ShapeType 'cloudCallout'", + "Custom shape." + ], + "type": "string" + }, + "elementProperties": { + "description": "The element properties for the shape.", + "$ref": "PageElementProperties" + } + }, + "id": "CreateShapeRequest" + }, + "ShapeBackgroundFill": { + "description": "The shape background fill.", + "type": "object", + "properties": { + "propertyState": { + "description": "The background fill property state.\n\nUpdating the the fill on a shape will implicitly update this field to\n`RENDERED`, unless another value is specified in the same request. To\nhave no fill on a shape, set this field to `NOT_RENDERED`. In this case,\nany other fill fields set in the same request will be ignored.", + "enum": [ + "RENDERED", + "NOT_RENDERED", + "INHERIT" + ], + "enumDescriptions": [ + "If a property's state is RENDERED, then the element has the corresponding\nproperty when rendered on a page. If the element is a placeholder shape as\ndetermined by the placeholder\nfield, and it inherits from a placeholder shape, the corresponding field\nmay be unset, meaning that the property value is inherited from a parent\nplaceholder. If the element does not inherit, then the field will contain\nthe rendered value. This is the default value.", + "If a property's state is NOT_RENDERED, then the element does not have the\ncorresponding property when rendered on a page. However, the field may\nstill be set so it can be inherited by child shapes. To remove a property\nfrom a rendered element, set its property_state to NOT_RENDERED.", + "If a property's state is INHERIT, then the property state uses the value of\ncorresponding `property_state` field on the parent shape. Elements that do\nnot inherit will never have an INHERIT property state." + ], + "type": "string" + }, + "solidFill": { + "description": "Solid color fill.", + "$ref": "SolidFill" + } + }, + "id": "ShapeBackgroundFill" + }, + "Line": { + "description": "A PageElement kind representing a\nline, curved connector, or bent connector.", + "type": "object", + "properties": { + "lineProperties": { + "description": "The properties of the line.", + "$ref": "LineProperties" + }, + "lineType": { + "description": "The type of the line.", + "enum": [ + "TYPE_UNSPECIFIED", + "STRAIGHT_CONNECTOR_1", + "BENT_CONNECTOR_2", + "BENT_CONNECTOR_3", + "BENT_CONNECTOR_4", + "BENT_CONNECTOR_5", + "CURVED_CONNECTOR_2", + "CURVED_CONNECTOR_3", + "CURVED_CONNECTOR_4", + "CURVED_CONNECTOR_5" + ], + "enumDescriptions": [ + "An unspecified line type.", + "Straight connector 1 form. Corresponds to ECMA-376 ST_ShapeType\n'straightConnector1'.", + "Bent connector 2 form. Corresponds to ECMA-376 ST_ShapeType\n'bentConnector2'.", + "Bent connector 3 form. Corresponds to ECMA-376 ST_ShapeType\n'bentConnector3'.", + "Bent connector 4 form. Corresponds to ECMA-376 ST_ShapeType\n'bentConnector4'.", + "Bent connector 5 form. Corresponds to ECMA-376 ST_ShapeType\n'bentConnector5'.", + "Curved connector 2 form. Corresponds to ECMA-376 ST_ShapeType\n'curvedConnector2'.", + "Curved connector 3 form. Corresponds to ECMA-376 ST_ShapeType\n'curvedConnector3'.", + "Curved connector 4 form. Corresponds to ECMA-376 ST_ShapeType\n'curvedConnector4'.", + "Curved connector 5 form. Corresponds to ECMA-376 ST_ShapeType\n'curvedConnector5'." + ], + "type": "string" + } + }, + "id": "Line" + }, + "SheetsChartProperties": { + "description": "The properties of the SheetsChart.", + "type": "object", + "properties": { + "chartImageProperties": { + "description": "The properties of the embedded chart image.", + "$ref": "ImageProperties" + } + }, + "id": "SheetsChartProperties" + }, + "AutoText": { + "description": "A TextElement kind that represents auto text.", + "type": "object", + "properties": { + "style": { + "description": "The styling applied to this auto text.", + "$ref": "TextStyle" + }, + "type": { + "description": "The type of this auto text.", + "enum": [ + "TYPE_UNSPECIFIED", + "SLIDE_NUMBER" + ], + "enumDescriptions": [ + "An unspecified autotext type.", + "Type for autotext that represents the current slide number." + ], + "type": "string" + }, + "content": { + "description": "The rendered content of this auto text, if available.", + "type": "string" + } + }, + "id": "AutoText" + }, + "TextElement": { + "description": "A TextElement describes the content of a range of indices in the text content\nof a Shape or TableCell.", + "type": "object", + "properties": { + "endIndex": { + "description": "The zero-based end index of this text element, exclusive, in Unicode code\nunits.", + "type": "integer", + "format": "int32" + }, + "textRun": { + "description": "A TextElement representing a run of text where all of the characters\nin the run have the same TextStyle.\n\nThe `start_index` and `end_index` of TextRuns will always be fully\ncontained in the index range of a single `paragraph_marker` TextElement.\nIn other words, a TextRun will never span multiple paragraphs.", + "$ref": "TextRun" + }, + "startIndex": { + "description": "The zero-based start index of this text element, in Unicode code units.", + "type": "integer", + "format": "int32" + }, + "paragraphMarker": { + "description": "A marker representing the beginning of a new paragraph.\n\nThe `start_index` and `end_index` of this TextElement represent the\nrange of the paragraph. Other TextElements with an index range contained\ninside this paragraph's range are considered to be part of this\nparagraph. The range of indices of two separate paragraphs will never\noverlap.", + "$ref": "ParagraphMarker" + }, + "autoText": { + "description": "A TextElement representing a spot in the text that is dynamically\nreplaced with content that can change over time.", + "$ref": "AutoText" + } + }, + "id": "TextElement" + }, + "UpdateSlidesPositionRequest": { + "description": "Updates the position of slides in the presentation.", + "type": "object", + "properties": { + "insertionIndex": { + "description": "The index where the slides should be inserted, based on the slide\narrangement before the move takes place. Must be between zero and the\nnumber of slides in the presentation, inclusive.", + "type": "integer", + "format": "int32" + }, + "slideObjectIds": { + "description": "The IDs of the slides in the presentation that should be moved.\nThe slides in this list must be in existing presentation order, without\nduplicates.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "id": "UpdateSlidesPositionRequest" + }, + "ReplaceAllTextRequest": { + "description": "Replaces all instances of text matching a criteria with replace text.", + "type": "object", + "properties": { + "containsText": { + "description": "Finds text in a shape matching this substring.", + "$ref": "SubstringMatchCriteria" + }, + "replaceText": { + "description": "The text that will replace the matched text.", + "type": "string" + } + }, + "id": "ReplaceAllTextRequest" + }, + "ShapeProperties": { + "description": "The properties of a Shape.\n\nIf the shape is a placeholder shape as determined by the\nplaceholder field, then these\nproperties may be inherited from a parent placeholder shape.\nDetermining the rendered value of the property depends on the corresponding\nproperty_state field value.", + "type": "object", + "properties": { + "outline": { + "description": "The outline of the shape. If unset, the outline is inherited from a\nparent placeholder if it exists. If the shape has no parent, then the\ndefault outline depends on the shape type, matching the defaults for\nnew shapes created in the Slides editor.", + "$ref": "Outline" + }, + "link": { + "description": "The hyperlink destination of the shape. If unset, there is no link. Links\nare not inherited from parent placeholders.", + "$ref": "Link" + }, + "shapeBackgroundFill": { + "description": "The background fill of the shape. If unset, the background fill is\ninherited from a parent placeholder if it exists. If the shape has no\nparent, then the default background fill depends on the shape type,\nmatching the defaults for new shapes created in the Slides editor.", + "$ref": "ShapeBackgroundFill" + }, + "shadow": { + "description": "The shadow properties of the shape. If unset, the shadow is inherited from\na parent placeholder if it exists. If the shape has no parent, then the\ndefault shadow matches the defaults for new shapes created in the Slides\neditor. This property is read-only.", + "$ref": "Shadow" + } + }, + "id": "ShapeProperties" + }, + "CreateLineRequest": { + "description": "Creates a line.", + "type": "object", + "properties": { + "objectId": { + "description": "A user-supplied object ID.\n\nIf you specify an ID, it must be unique among all pages and page elements\nin the presentation. The ID must start with an alphanumeric character or an\nunderscore (matches regex `[a-zA-Z0-9_]`); remaining characters\nmay include those as well as a hyphen or colon (matches regex\n`[a-zA-Z0-9_-:]`).\nThe length of the ID must not be less than 5 or greater than 50.\n\nIf you don't specify an ID, a unique one is generated.", + "type": "string" + }, + "elementProperties": { + "description": "The element properties for the line.", + "$ref": "PageElementProperties" + }, + "lineCategory": { + "description": "The category of line to be created.", + "enum": [ + "STRAIGHT", + "BENT", + "CURVED" + ], + "enumDescriptions": [ + "Straight connectors, including straight connector 1. The is the default\ncategory when one is not specified.", + "Bent connectors, including bent connector 2 to 5.", + "Curved connectors, including curved connector 2 to 5." + ], + "type": "string" + } + }, + "id": "CreateLineRequest" + }, + "CreateShapeResponse": { + "description": "The result of creating a shape.", + "type": "object", + "properties": { + "objectId": { + "description": "The object ID of the created shape.", + "type": "string" + } + }, + "id": "CreateShapeResponse" + }, + "CreateSlideResponse": { + "description": "The result of creating a slide.", + "type": "object", + "properties": { + "objectId": { + "description": "The object ID of the created slide.", + "type": "string" + } + }, + "id": "CreateSlideResponse" + }, + "UpdateImagePropertiesRequest": { + "description": "Update the properties of an Image.", + "type": "object", + "properties": { + "objectId": { + "description": "The object ID of the image the updates are applied to.", + "type": "string" + }, + "fields": { + "description": "The fields that should be updated.\n\nAt least one field must be specified. The root `imageProperties` is\nimplied and should not be specified. A single `\"*\"` can be used as\nshort-hand for listing every field.\n\nFor example to update the image outline color, set `fields` to\n`\"outline.outlineFill.solidFill.color\"`.\n\nTo reset a property to its default value, include its field name in the\nfield mask but leave the field itself unset.", + "type": "string", + "format": "google-fieldmask" + }, + "imageProperties": { + "description": "The image properties to update.", + "$ref": "ImageProperties" + } + }, + "id": "UpdateImagePropertiesRequest" + }, + "CreateVideoRequest": { + "description": "Creates a video.", + "type": "object", + "properties": { + "objectId": { + "description": "A user-supplied object ID.\n\nIf you specify an ID, it must be unique among all pages and page elements\nin the presentation. The ID must start with an alphanumeric character or an\nunderscore (matches regex `[a-zA-Z0-9_]`); remaining characters\nmay include those as well as a hyphen or colon (matches regex\n`[a-zA-Z0-9_-:]`).\nThe length of the ID must not be less than 5 or greater than 50.\n\nIf you don't specify an ID, a unique one is generated.", + "type": "string" + }, + "source": { + "description": "The video source.", + "enum": [ + "SOURCE_UNSPECIFIED", + "YOUTUBE" + ], + "enumDescriptions": [ + "The video source is unspecified.", + "The video source is YouTube." + ], + "type": "string" + }, + "elementProperties": { + "description": "The element properties for the video.", + "$ref": "PageElementProperties" + }, + "id": { + "description": "The video source's unique identifier for this video.\n\ne.g. For YouTube video https://www.youtube.com/watch?v=7U3axjORYZ0,\nthe ID is 7U3axjORYZ0.", + "type": "string" + } + }, + "id": "CreateVideoRequest" + }, + "CreateTableRequest": { + "description": "Creates a new table.", + "type": "object", + "properties": { + "columns": { + "description": "Number of columns in the table.", + "type": "integer", + "format": "int32" + }, + "objectId": { + "description": "A user-supplied object ID.\n\nIf you specify an ID, it must be unique among all pages and page elements\nin the presentation. The ID must start with an alphanumeric character or an\nunderscore (matches regex `[a-zA-Z0-9_]`); remaining characters\nmay include those as well as a hyphen or colon (matches regex\n`[a-zA-Z0-9_-:]`).\nThe length of the ID must not be less than 5 or greater than 50.\n\nIf you don't specify an ID, a unique one is generated.", + "type": "string" + }, + "rows": { + "description": "Number of rows in the table.", + "type": "integer", + "format": "int32" + }, + "elementProperties": { + "description": "The element properties for the table.\n\nThe table will be created at the provided size, subject to a minimum size.\nIf no size is provided, the table will be automatically sized.\n\nTable transforms must have a scale of 1 and no shear components. If no\ntransform is provided, the table will be centered on the page.", + "$ref": "PageElementProperties" + } + }, + "id": "CreateTableRequest" + }, + "OptionalColor": { + "description": "A color that can either be fully opaque or fully transparent.", + "type": "object", + "properties": { + "opaqueColor": { + "description": "If set, this will be used as an opaque color. If unset, this represents\na transparent color.", + "$ref": "OpaqueColor" + } + }, + "id": "OptionalColor" + }, + "TextRun": { + "description": "A TextElement kind that represents a run of text that all has the same\nstyling.", + "type": "object", + "properties": { + "style": { + "description": "The styling applied to this run.", + "$ref": "TextStyle" + }, + "content": { + "description": "The text of this run.", + "type": "string" + } + }, + "id": "TextRun" + }, + "Shape": { + "description": "A PageElement kind representing a\ngeneric shape that does not have a more specific classification.", + "type": "object", + "properties": { + "text": { + "description": "The text content of the shape.", + "$ref": "TextContent" + }, + "shapeProperties": { + "description": "The properties of the shape.", + "$ref": "ShapeProperties" + }, + "shapeType": { + "description": "The type of the shape.", + "enum": [ + "TYPE_UNSPECIFIED", + "TEXT_BOX", + "RECTANGLE", + "ROUND_RECTANGLE", + "ELLIPSE", + "ARC", + "BENT_ARROW", + "BENT_UP_ARROW", + "BEVEL", + "BLOCK_ARC", + "BRACE_PAIR", + "BRACKET_PAIR", + "CAN", + "CHEVRON", + "CHORD", + "CLOUD", + "CORNER", + "CUBE", + "CURVED_DOWN_ARROW", + "CURVED_LEFT_ARROW", + "CURVED_RIGHT_ARROW", + "CURVED_UP_ARROW", + "DECAGON", + "DIAGONAL_STRIPE", + "DIAMOND", + "DODECAGON", + "DONUT", + "DOUBLE_WAVE", + "DOWN_ARROW", + "DOWN_ARROW_CALLOUT", + "FOLDED_CORNER", + "FRAME", + "HALF_FRAME", + "HEART", + "HEPTAGON", + "HEXAGON", + "HOME_PLATE", + "HORIZONTAL_SCROLL", + "IRREGULAR_SEAL_1", + "IRREGULAR_SEAL_2", + "LEFT_ARROW", + "LEFT_ARROW_CALLOUT", + "LEFT_BRACE", + "LEFT_BRACKET", + "LEFT_RIGHT_ARROW", + "LEFT_RIGHT_ARROW_CALLOUT", + "LEFT_RIGHT_UP_ARROW", + "LEFT_UP_ARROW", + "LIGHTNING_BOLT", + "MATH_DIVIDE", + "MATH_EQUAL", + "MATH_MINUS", + "MATH_MULTIPLY", + "MATH_NOT_EQUAL", + "MATH_PLUS", + "MOON", + "NO_SMOKING", + "NOTCHED_RIGHT_ARROW", + "OCTAGON", + "PARALLELOGRAM", + "PENTAGON", + "PIE", + "PLAQUE", + "PLUS", + "QUAD_ARROW", + "QUAD_ARROW_CALLOUT", + "RIBBON", + "RIBBON_2", + "RIGHT_ARROW", + "RIGHT_ARROW_CALLOUT", + "RIGHT_BRACE", + "RIGHT_BRACKET", + "ROUND_1_RECTANGLE", + "ROUND_2_DIAGONAL_RECTANGLE", + "ROUND_2_SAME_RECTANGLE", + "RIGHT_TRIANGLE", + "SMILEY_FACE", + "SNIP_1_RECTANGLE", + "SNIP_2_DIAGONAL_RECTANGLE", + "SNIP_2_SAME_RECTANGLE", + "SNIP_ROUND_RECTANGLE", + "STAR_10", + "STAR_12", + "STAR_16", + "STAR_24", + "STAR_32", + "STAR_4", + "STAR_5", + "STAR_6", + "STAR_7", + "STAR_8", + "STRIPED_RIGHT_ARROW", + "SUN", + "TRAPEZOID", + "TRIANGLE", + "UP_ARROW", + "UP_ARROW_CALLOUT", + "UP_DOWN_ARROW", + "UTURN_ARROW", + "VERTICAL_SCROLL", + "WAVE", + "WEDGE_ELLIPSE_CALLOUT", + "WEDGE_RECTANGLE_CALLOUT", + "WEDGE_ROUND_RECTANGLE_CALLOUT", + "FLOW_CHART_ALTERNATE_PROCESS", + "FLOW_CHART_COLLATE", + "FLOW_CHART_CONNECTOR", + "FLOW_CHART_DECISION", + "FLOW_CHART_DELAY", + "FLOW_CHART_DISPLAY", + "FLOW_CHART_DOCUMENT", + "FLOW_CHART_EXTRACT", + "FLOW_CHART_INPUT_OUTPUT", + "FLOW_CHART_INTERNAL_STORAGE", + "FLOW_CHART_MAGNETIC_DISK", + "FLOW_CHART_MAGNETIC_DRUM", + "FLOW_CHART_MAGNETIC_TAPE", + "FLOW_CHART_MANUAL_INPUT", + "FLOW_CHART_MANUAL_OPERATION", + "FLOW_CHART_MERGE", + "FLOW_CHART_MULTIDOCUMENT", + "FLOW_CHART_OFFLINE_STORAGE", + "FLOW_CHART_OFFPAGE_CONNECTOR", + "FLOW_CHART_ONLINE_STORAGE", + "FLOW_CHART_OR", + "FLOW_CHART_PREDEFINED_PROCESS", + "FLOW_CHART_PREPARATION", + "FLOW_CHART_PROCESS", + "FLOW_CHART_PUNCHED_CARD", + "FLOW_CHART_PUNCHED_TAPE", + "FLOW_CHART_SORT", + "FLOW_CHART_SUMMING_JUNCTION", + "FLOW_CHART_TERMINATOR", + "ARROW_EAST", + "ARROW_NORTH_EAST", + "ARROW_NORTH", + "SPEECH", + "STARBURST", + "TEARDROP", + "ELLIPSE_RIBBON", + "ELLIPSE_RIBBON_2", + "CLOUD_CALLOUT", + "CUSTOM" + ], + "enumDescriptions": [ + "The shape type that is not predefined.", + "Text box shape.", + "Rectangle shape. Corresponds to ECMA-376 ST_ShapeType 'rect'.", + "Round corner rectangle shape. Corresponds to ECMA-376 ST_ShapeType\n'roundRect'", + "Ellipse shape. Corresponds to ECMA-376 ST_ShapeType 'ellipse'", + "Curved arc shape. Corresponds to ECMA-376 ST_ShapeType 'arc'", + "Bent arrow shape. Corresponds to ECMA-376 ST_ShapeType 'bentArrow'", + "Bent up arrow shape. Corresponds to ECMA-376 ST_ShapeType 'bentUpArrow'", + "Bevel shape. Corresponds to ECMA-376 ST_ShapeType 'bevel'", + "Block arc shape. Corresponds to ECMA-376 ST_ShapeType 'blockArc'", + "Brace pair shape. Corresponds to ECMA-376 ST_ShapeType 'bracePair'", + "Bracket pair shape. Corresponds to ECMA-376 ST_ShapeType 'bracketPair'", + "Can shape. Corresponds to ECMA-376 ST_ShapeType 'can'", + "Chevron shape. Corresponds to ECMA-376 ST_ShapeType 'chevron'", + "Chord shape. Corresponds to ECMA-376 ST_ShapeType 'chord'", + "Cloud shape. Corresponds to ECMA-376 ST_ShapeType 'cloud'", + "Corner shape. Corresponds to ECMA-376 ST_ShapeType 'corner'", + "Cube shape. Corresponds to ECMA-376 ST_ShapeType 'cube'", + "Curved down arrow shape. Corresponds to ECMA-376 ST_ShapeType\n'curvedDownArrow'", + "Curved left arrow shape. Corresponds to ECMA-376 ST_ShapeType\n'curvedLeftArrow'", + "Curved right arrow shape. Corresponds to ECMA-376 ST_ShapeType\n'curvedRightArrow'", + "Curved up arrow shape. Corresponds to ECMA-376 ST_ShapeType\n'curvedUpArrow'", + "Decagon shape. Corresponds to ECMA-376 ST_ShapeType 'decagon'", + "Diagonal stripe shape. Corresponds to ECMA-376 ST_ShapeType 'diagStripe'", + "Diamond shape. Corresponds to ECMA-376 ST_ShapeType 'diamond'", + "Dodecagon shape. Corresponds to ECMA-376 ST_ShapeType 'dodecagon'", + "Donut shape. Corresponds to ECMA-376 ST_ShapeType 'donut'", + "Double wave shape. Corresponds to ECMA-376 ST_ShapeType 'doubleWave'", + "Down arrow shape. Corresponds to ECMA-376 ST_ShapeType 'downArrow'", + "Callout down arrow shape. Corresponds to ECMA-376 ST_ShapeType\n'downArrowCallout'", + "Folded corner shape. Corresponds to ECMA-376 ST_ShapeType 'foldedCorner'", + "Frame shape. Corresponds to ECMA-376 ST_ShapeType 'frame'", + "Half frame shape. Corresponds to ECMA-376 ST_ShapeType 'halfFrame'", + "Heart shape. Corresponds to ECMA-376 ST_ShapeType 'heart'", + "Heptagon shape. Corresponds to ECMA-376 ST_ShapeType 'heptagon'", + "Hexagon shape. Corresponds to ECMA-376 ST_ShapeType 'hexagon'", + "Home plate shape. Corresponds to ECMA-376 ST_ShapeType 'homePlate'", + "Horizontal scroll shape. Corresponds to ECMA-376 ST_ShapeType\n'horizontalScroll'", + "Irregular seal 1 shape. Corresponds to ECMA-376 ST_ShapeType\n'irregularSeal1'", + "Irregular seal 2 shape. Corresponds to ECMA-376 ST_ShapeType\n'irregularSeal2'", + "Left arrow shape. Corresponds to ECMA-376 ST_ShapeType 'leftArrow'", + "Callout left arrow shape. Corresponds to ECMA-376 ST_ShapeType\n'leftArrowCallout'", + "Left brace shape. Corresponds to ECMA-376 ST_ShapeType 'leftBrace'", + "Left bracket shape. Corresponds to ECMA-376 ST_ShapeType 'leftBracket'", + "Left right arrow shape. Corresponds to ECMA-376 ST_ShapeType\n'leftRightArrow'", + "Callout left right arrow shape. Corresponds to ECMA-376 ST_ShapeType\n'leftRightArrowCallout'", + "Left right up arrow shape. Corresponds to ECMA-376 ST_ShapeType\n'leftRightUpArrow'", + "Left up arrow shape. Corresponds to ECMA-376 ST_ShapeType 'leftUpArrow'", + "Lightning bolt shape. Corresponds to ECMA-376 ST_ShapeType\n'lightningBolt'", + "Divide math shape. Corresponds to ECMA-376 ST_ShapeType 'mathDivide'", + "Equal math shape. Corresponds to ECMA-376 ST_ShapeType 'mathEqual'", + "Minus math shape. Corresponds to ECMA-376 ST_ShapeType 'mathMinus'", + "Multiply math shape. Corresponds to ECMA-376 ST_ShapeType 'mathMultiply'", + "Not equal math shape. Corresponds to ECMA-376 ST_ShapeType 'mathNotEqual'", + "Plus math shape. Corresponds to ECMA-376 ST_ShapeType 'mathPlus'", + "Moon shape. Corresponds to ECMA-376 ST_ShapeType 'moon'", + "No smoking shape. Corresponds to ECMA-376 ST_ShapeType 'noSmoking'", + "Notched right arrow shape. Corresponds to ECMA-376 ST_ShapeType\n'notchedRightArrow'", + "Octagon shape. Corresponds to ECMA-376 ST_ShapeType 'octagon'", + "Parallelogram shape. Corresponds to ECMA-376 ST_ShapeType 'parallelogram'", + "Pentagon shape. Corresponds to ECMA-376 ST_ShapeType 'pentagon'", + "Pie shape. Corresponds to ECMA-376 ST_ShapeType 'pie'", + "Plaque shape. Corresponds to ECMA-376 ST_ShapeType 'plaque'", + "Plus shape. Corresponds to ECMA-376 ST_ShapeType 'plus'", + "Quad-arrow shape. Corresponds to ECMA-376 ST_ShapeType 'quadArrow'", + "Callout quad-arrow shape. Corresponds to ECMA-376 ST_ShapeType\n'quadArrowCallout'", + "Ribbon shape. Corresponds to ECMA-376 ST_ShapeType 'ribbon'", + "Ribbon 2 shape. Corresponds to ECMA-376 ST_ShapeType 'ribbon2'", + "Right arrow shape. Corresponds to ECMA-376 ST_ShapeType 'rightArrow'", + "Callout right arrow shape. Corresponds to ECMA-376 ST_ShapeType\n'rightArrowCallout'", + "Right brace shape. Corresponds to ECMA-376 ST_ShapeType 'rightBrace'", + "Right bracket shape. Corresponds to ECMA-376 ST_ShapeType 'rightBracket'", + "One round corner rectangle shape. Corresponds to ECMA-376 ST_ShapeType\n'round1Rect'", + "Two diagonal round corner rectangle shape. Corresponds to ECMA-376\nST_ShapeType 'round2DiagRect'", + "Two same-side round corner rectangle shape. Corresponds to ECMA-376\nST_ShapeType 'round2SameRect'", + "Right triangle shape. Corresponds to ECMA-376 ST_ShapeType 'rtTriangle'", + "Smiley face shape. Corresponds to ECMA-376 ST_ShapeType 'smileyFace'", + "One snip corner rectangle shape. Corresponds to ECMA-376 ST_ShapeType\n'snip1Rect'", + "Two diagonal snip corner rectangle shape. Corresponds to ECMA-376\nST_ShapeType 'snip2DiagRect'", + "Two same-side snip corner rectangle shape. Corresponds to ECMA-376\nST_ShapeType 'snip2SameRect'", + "One snip one round corner rectangle shape. Corresponds to ECMA-376\nST_ShapeType 'snipRoundRect'", + "Ten pointed star shape. Corresponds to ECMA-376 ST_ShapeType 'star10'", + "Twelve pointed star shape. Corresponds to ECMA-376 ST_ShapeType 'star12'", + "Sixteen pointed star shape. Corresponds to ECMA-376 ST_ShapeType 'star16'", + "Twenty four pointed star shape. Corresponds to ECMA-376 ST_ShapeType\n'star24'", + "Thirty two pointed star shape. Corresponds to ECMA-376 ST_ShapeType\n'star32'", + "Four pointed star shape. Corresponds to ECMA-376 ST_ShapeType 'star4'", + "Five pointed star shape. Corresponds to ECMA-376 ST_ShapeType 'star5'", + "Six pointed star shape. Corresponds to ECMA-376 ST_ShapeType 'star6'", + "Seven pointed star shape. Corresponds to ECMA-376 ST_ShapeType 'star7'", + "Eight pointed star shape. Corresponds to ECMA-376 ST_ShapeType 'star8'", + "Striped right arrow shape. Corresponds to ECMA-376 ST_ShapeType\n'stripedRightArrow'", + "Sun shape. Corresponds to ECMA-376 ST_ShapeType 'sun'", + "Trapezoid shape. Corresponds to ECMA-376 ST_ShapeType 'trapezoid'", + "Triangle shape. Corresponds to ECMA-376 ST_ShapeType 'triangle'", + "Up arrow shape. Corresponds to ECMA-376 ST_ShapeType 'upArrow'", + "Callout up arrow shape. Corresponds to ECMA-376 ST_ShapeType\n'upArrowCallout'", + "Up down arrow shape. Corresponds to ECMA-376 ST_ShapeType 'upDownArrow'", + "U-turn arrow shape. Corresponds to ECMA-376 ST_ShapeType 'uturnArrow'", + "Vertical scroll shape. Corresponds to ECMA-376 ST_ShapeType\n'verticalScroll'", + "Wave shape. Corresponds to ECMA-376 ST_ShapeType 'wave'", + "Callout wedge ellipse shape. Corresponds to ECMA-376 ST_ShapeType\n'wedgeEllipseCallout'", + "Callout wedge rectangle shape. Corresponds to ECMA-376 ST_ShapeType\n'wedgeRectCallout'", + "Callout wedge round rectangle shape. Corresponds to ECMA-376 ST_ShapeType\n'wedgeRoundRectCallout'", + "Alternate process flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartAlternateProcess'", + "Collate flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartCollate'", + "Connector flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartConnector'", + "Decision flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartDecision'", + "Delay flow shape. Corresponds to ECMA-376 ST_ShapeType 'flowChartDelay'", + "Display flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartDisplay'", + "Document flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartDocument'", + "Extract flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartExtract'", + "Input output flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartInputOutput'", + "Internal storage flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartInternalStorage'", + "Magnetic disk flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartMagneticDisk'", + "Magnetic drum flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartMagneticDrum'", + "Magnetic tape flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartMagneticTape'", + "Manual input flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartManualInput'", + "Manual operation flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartManualOperation'", + "Merge flow shape. Corresponds to ECMA-376 ST_ShapeType 'flowChartMerge'", + "Multi-document flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartMultidocument'", + "Offline storage flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartOfflineStorage'", + "Off-page connector flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartOffpageConnector'", + "Online storage flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartOnlineStorage'", + "Or flow shape. Corresponds to ECMA-376 ST_ShapeType 'flowChartOr'", + "Predefined process flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartPredefinedProcess'", + "Preparation flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartPreparation'", + "Process flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartProcess'", + "Punched card flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartPunchedCard'", + "Punched tape flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartPunchedTape'", + "Sort flow shape. Corresponds to ECMA-376 ST_ShapeType 'flowChartSort'", + "Summing junction flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartSummingJunction'", + "Terminator flow shape. Corresponds to ECMA-376 ST_ShapeType\n'flowChartTerminator'", + "East arrow shape.", + "Northeast arrow shape.", + "North arrow shape.", + "Speech shape.", + "Star burst shape.", + "Teardrop shape. Corresponds to ECMA-376 ST_ShapeType 'teardrop'", + "Ellipse ribbon shape. Corresponds to ECMA-376 ST_ShapeType\n'ellipseRibbon'", + "Ellipse ribbon 2 shape. Corresponds to ECMA-376 ST_ShapeType\n'ellipseRibbon2'", + "Callout cloud shape. Corresponds to ECMA-376 ST_ShapeType 'cloudCallout'", + "Custom shape." + ], + "type": "string" + }, + "placeholder": { + "description": "Placeholders are shapes that are inherit from corresponding placeholders on\nlayouts and masters.\n\nIf set, the shape is a placeholder shape and any inherited properties\ncan be resolved by looking at the parent placeholder identified by the\nPlaceholder.parent_object_id field.", + "$ref": "Placeholder" + } + }, + "id": "Shape" + }, + "BatchUpdatePresentationResponse": { + "description": "Response message from a batch update.", + "type": "object", + "properties": { + "presentationId": { + "description": "The presentation the updates were applied to.", + "type": "string" + }, + "replies": { + "description": "The reply of the updates. This maps 1:1 with the updates, although\nreplies to some requests may be empty.", + "type": "array", + "items": { + "$ref": "Response" + } + } + }, + "id": "BatchUpdatePresentationResponse" + }, + "ImageProperties": { + "description": "The properties of the Image.", + "type": "object", + "properties": { + "cropProperties": { + "description": "The crop properties of the image. If not set, the image is not cropped.\nThis property is read-only.", + "$ref": "CropProperties" + }, + "outline": { + "description": "The outline of the image. If not set, the the image has no outline.", + "$ref": "Outline" + }, + "shadow": { + "description": "The shadow of the image. If not set, the image has no shadow. This property\nis read-only.", + "$ref": "Shadow" + }, + "transparency": { + "description": "The transparency effect of the image. The value should be in the interval\n[0.0, 1.0], where 0 means no effect and 1 means completely transparent.\nThis property is read-only.", + "type": "number", + "format": "float" + }, + "contrast": { + "description": "The contrast effect of the image. The value should be in the interval\n[-1.0, 1.0], where 0 means no effect. This property is read-only.", + "type": "number", + "format": "float" + }, + "link": { + "description": "The hyperlink destination of the image. If unset, there is no link.", + "$ref": "Link" + }, + "recolor": { + "description": "The recolor effect of the image. If not set, the image is not recolored.\nThis property is read-only.", + "$ref": "Recolor" + }, + "brightness": { + "description": "The brightness effect of the image. The value should be in the interval\n[-1.0, 1.0], where 0 means no effect. This property is read-only.", + "type": "number", + "format": "float" + } + }, + "id": "ImageProperties" + }, + "Group": { + "description": "A PageElement kind representing a\njoined collection of PageElements.", + "type": "object", + "properties": { + "children": { + "description": "The collection of elements in the group. The minimum size of a group is 2.", + "type": "array", + "items": { + "$ref": "PageElement" + } + } + }, + "id": "Group" + }, + "Outline": { + "description": "The outline of a PageElement.\n\nIf these fields are unset, they may be inherited from a parent placeholder\nif it exists. If there is no parent, the fields will default to the value\nused for new page elements created in the Slides editor, which may depend on\nthe page element kind.", + "type": "object", + "properties": { + "weight": { + "description": "The thickness of the outline.", + "$ref": "Dimension" + }, + "dashStyle": { + "description": "The dash style of the outline.", + "enum": [ + "DASH_STYLE_UNSPECIFIED", + "SOLID", + "DOT", + "DASH", + "DASH_DOT", + "LONG_DASH", + "LONG_DASH_DOT" + ], + "enumDescriptions": [ + "Unspecified dash style.", + "Solid line. Corresponds to ECMA-376 ST_PresetLineDashVal value 'solid'.\nThis is the default dash style.", + "Dotted line. Corresponds to ECMA-376 ST_PresetLineDashVal value 'dot'.", + "Dashed line. Corresponds to ECMA-376 ST_PresetLineDashVal value 'dash'.", + "Alternating dashes and dots. Corresponds to ECMA-376 ST_PresetLineDashVal\nvalue 'dashDot'.", + "Line with large dashes. Corresponds to ECMA-376 ST_PresetLineDashVal\nvalue 'lgDash'.", + "Alternating large dashes and dots. Corresponds to ECMA-376\nST_PresetLineDashVal value 'lgDashDot'." + ], + "type": "string" + }, + "propertyState": { + "description": "The outline property state.\n\nUpdating the the outline on a page element will implicitly update this\nfield to`RENDERED`, unless another value is specified in the same request.\nTo have no outline on a page element, set this field to `NOT_RENDERED`. In\nthis case, any other outline fields set in the same request will be\nignored.", + "enum": [ + "RENDERED", + "NOT_RENDERED", + "INHERIT" + ], + "enumDescriptions": [ + "If a property's state is RENDERED, then the element has the corresponding\nproperty when rendered on a page. If the element is a placeholder shape as\ndetermined by the placeholder\nfield, and it inherits from a placeholder shape, the corresponding field\nmay be unset, meaning that the property value is inherited from a parent\nplaceholder. If the element does not inherit, then the field will contain\nthe rendered value. This is the default value.", + "If a property's state is NOT_RENDERED, then the element does not have the\ncorresponding property when rendered on a page. However, the field may\nstill be set so it can be inherited by child shapes. To remove a property\nfrom a rendered element, set its property_state to NOT_RENDERED.", + "If a property's state is INHERIT, then the property state uses the value of\ncorresponding `property_state` field on the parent shape. Elements that do\nnot inherit will never have an INHERIT property state." + ], + "type": "string" + }, + "outlineFill": { + "description": "The fill of the outline.", + "$ref": "OutlineFill" + } + }, + "id": "Outline" + }, + "TableCell": { + "description": "Properties and contents of each table cell.", + "type": "object", + "properties": { + "text": { + "description": "The text content of the cell.", + "$ref": "TextContent" + }, + "location": { + "description": "The location of the cell within the table.", + "$ref": "TableCellLocation" + }, + "rowSpan": { + "description": "Row span of the cell.", + "type": "integer", + "format": "int32" + }, + "tableCellProperties": { + "description": "The properties of the table cell.", + "$ref": "TableCellProperties" + }, + "columnSpan": { + "description": "Column span of the cell.", + "type": "integer", + "format": "int32" + } + }, + "id": "TableCell" + }, + "ReplaceAllShapesWithImageResponse": { + "description": "The result of replacing shapes with an image.", + "type": "object", + "properties": { + "occurrencesChanged": { + "description": "The number of shapes replaced with images.", + "type": "integer", + "format": "int32" + } + }, + "id": "ReplaceAllShapesWithImageResponse" + }, + "CreateSlideRequest": { + "description": "Creates a new slide.", + "type": "object", + "properties": { + "objectId": { + "description": "A user-supplied object ID.\n\nIf you specify an ID, it must be unique among all pages and page elements\nin the presentation. The ID must start with an alphanumeric character or an\nunderscore (matches regex `[a-zA-Z0-9_]`); remaining characters\nmay include those as well as a hyphen or colon (matches regex\n`[a-zA-Z0-9_-:]`).\nThe length of the ID must not be less than 5 or greater than 50.\n\nIf you don't specify an ID, a unique one is generated.", + "type": "string" + }, + "insertionIndex": { + "description": "The optional zero-based index indicating where to insert the slides.\n\nIf you don't specify an index, the new slide is created at the end.", + "type": "integer", + "format": "int32" + }, + "slideLayoutReference": { + "description": "Layout reference of the slide to be inserted, based on the *current\nmaster*, which is one of the following:\n\n- The master of the previous slide index.\n- The master of the first slide, if the insertion_index is zero.\n- The first master in the presentation, if there are no slides.\n\nIf the LayoutReference is not found in the current master, a 400 bad\nrequest error is returned.\n\nIf you don't specify a layout reference, then the new slide will use the\npredefined layout `BLANK`.", + "$ref": "LayoutReference" + } + }, + "id": "CreateSlideRequest" + }, + "TableCellProperties": { + "description": "The properties of the TableCell.", + "type": "object", + "properties": { + "tableCellBackgroundFill": { + "description": "The background fill of the table cell. The default fill matches the fill\nfor newly created table cells in the Slides editor.", + "$ref": "TableCellBackgroundFill" + } + }, + "id": "TableCellProperties" + }, + "CreateTableResponse": { + "description": "The result of creating a table.", + "type": "object", + "properties": { + "objectId": { + "description": "The object ID of the created table.", + "type": "string" + } + }, + "id": "CreateTableResponse" + }, + "Size": { + "description": "A width and height.", + "type": "object", + "properties": { + "width": { + "description": "The width of the object.", + "$ref": "Dimension" + }, + "height": { + "description": "The height of the object.", + "$ref": "Dimension" + } + }, + "id": "Size" + }, + "ColorScheme": { + "description": "The palette of predefined colors for a page.", + "type": "object", + "properties": { + "colors": { + "description": "The ThemeColorType and corresponding concrete color pairs.", + "type": "array", + "items": { + "$ref": "ThemeColorPair" + } + } + }, + "id": "ColorScheme" + }, + "ParagraphMarker": { + "description": "A TextElement kind that represents the beginning of a new paragraph.", + "type": "object", + "properties": { + "style": { + "description": "The paragraph's style", + "$ref": "ParagraphStyle" + }, + "bullet": { + "description": "The bullet for this paragraph. If not present, the paragraph does not\nbelong to a list.", + "$ref": "Bullet" + } + }, + "id": "ParagraphMarker" + }, + "CreateParagraphBulletsRequest": { + "description": "Creates bullets for all of the paragraphs that overlap with the given\ntext index range.\n\nThe nesting level of each paragraph will be determined by counting leading\ntabs in front of each paragraph. To avoid excess space between the bullet and\nthe corresponding paragraph, these leading tabs are removed by this request.\nThis may change the indices of parts of the text.\n\nIf the paragraph immediately before paragraphs being updated is in a list\nwith a matching preset, the paragraphs being updated are added to that\npreceding list.", + "type": "object", + "properties": { + "objectId": { + "description": "The object ID of the shape or table containing the text to add bullets to.", + "type": "string" + }, + "textRange": { + "description": "The range of text to apply the bullet presets to, based on TextElement indexes.", + "$ref": "Range" + }, + "bulletPreset": { + "description": "The kinds of bullet glyphs to be used. Defaults to the\n`BULLET_DISC_CIRCLE_SQUARE` preset.", + "enum": [ + "BULLET_DISC_CIRCLE_SQUARE", + "BULLET_DIAMONDX_ARROW3D_SQUARE", + "BULLET_CHECKBOX", + "BULLET_ARROW_DIAMOND_DISC", + "BULLET_STAR_CIRCLE_SQUARE", + "BULLET_ARROW3D_CIRCLE_SQUARE", + "BULLET_LEFTTRIANGLE_DIAMOND_DISC", + "BULLET_DIAMONDX_HOLLOWDIAMOND_SQUARE", + "BULLET_DIAMOND_CIRCLE_SQUARE", + "NUMBERED_DIGIT_ALPHA_ROMAN", + "NUMBERED_DIGIT_ALPHA_ROMAN_PARENS", + "NUMBERED_DIGIT_NESTED", + "NUMBERED_UPPERALPHA_ALPHA_ROMAN", + "NUMBERED_UPPERROMAN_UPPERALPHA_DIGIT", + "NUMBERED_ZERODIGIT_ALPHA_ROMAN" + ], + "enumDescriptions": [ + "A bulleted list with a `DISC`, `CIRCLE` and `SQUARE` bullet glyph for the\nfirst 3 list nesting levels.", + "A bulleted list with a `DIAMONDX`, `ARROW3D` and `SQUARE` bullet glyph for\nthe first 3 list nesting levels.", + "A bulleted list with `CHECKBOX` bullet glyphs for all list nesting levels.", + "A bulleted list with a `ARROW`, `DIAMOND` and `DISC` bullet glyph for\nthe first 3 list nesting levels.", + "A bulleted list with a `STAR`, `CIRCLE` and `DISC` bullet glyph for\nthe first 3 list nesting levels.", + "A bulleted list with a `ARROW3D`, `CIRCLE` and `SQUARE` bullet glyph for\nthe first 3 list nesting levels.", + "A bulleted list with a `LEFTTRIANGLE`, `DIAMOND` and `DISC` bullet glyph\nfor the first 3 list nesting levels.", + "A bulleted list with a `DIAMONDX`, `HOLLOWDIAMOND` and `SQUARE` bullet\nglyph for the first 3 list nesting levels.", + "A bulleted list with a `DIAMOND`, `CIRCLE` and `SQUARE` bullet glyph\nfor the first 3 list nesting levels.", + "A numbered list with `DIGIT`, `ALPHA` and `ROMAN` numeric glyphs for\nthe first 3 list nesting levels, followed by periods.", + "A numbered list with `DIGIT`, `ALPHA` and `ROMAN` numeric glyphs for\nthe first 3 list nesting levels, followed by parenthesis.", + "A numbered list with `DIGIT` numeric glyphs separated by periods, where\neach nesting level uses the previous nesting level's glyph as a prefix.\nFor example: '1.', '1.1.', '2.', '2.2.'.", + "A numbered list with `UPPERALPHA`, `ALPHA` and `ROMAN` numeric glyphs for\nthe first 3 list nesting levels, followed by periods.", + "A numbered list with `UPPERROMAN`, `UPPERALPHA` and `DIGIT` numeric glyphs\nfor the first 3 list nesting levels, followed by periods.", + "A numbered list with `ZERODIGIT`, `ALPHA` and `ROMAN` numeric glyphs for\nthe first 3 list nesting levels, followed by periods." + ], + "type": "string" + }, + "cellLocation": { + "description": "The optional table cell location if the text to be modified is in a table\ncell. If present, the object_id must refer to a table.", + "$ref": "TableCellLocation" + } + }, + "id": "CreateParagraphBulletsRequest" + }, + "SubstringMatchCriteria": { + "description": "A criteria that matches a specific string of text in a shape or table.", + "type": "object", + "properties": { + "text": { + "description": "The text to search for in the shape or table.", + "type": "string" + }, + "matchCase": { + "description": "Indicates whether the search should respect case:\n\n- `True`: the search is case sensitive.\n- `False`: the search is case insensitive.", + "type": "boolean" + } + }, + "id": "SubstringMatchCriteria" + }, + "WordArt": { + "description": "A PageElement kind representing\nword art.", + "type": "object", + "properties": { + "renderedText": { + "description": "The text rendered as word art.", + "type": "string" + } + }, + "id": "WordArt" + }, + "Range": { + "description": "Specifies a contiguous range of an indexed collection, such as characters in\ntext.", + "type": "object", + "properties": { + "endIndex": { + "description": "The optional zero-based index of the end of the collection.\nRequired for `SPECIFIC_RANGE` delete mode.", + "type": "integer", + "format": "int32" + }, + "startIndex": { + "description": "The optional zero-based index of the beginning of the collection.\nRequired for `SPECIFIC_RANGE` and `FROM_START_INDEX` ranges.", + "type": "integer", + "format": "int32" + }, + "type": { + "description": "The type of range.", + "enum": [ + "RANGE_TYPE_UNSPECIFIED", + "FIXED_RANGE", + "FROM_START_INDEX", + "ALL" + ], + "enumDescriptions": [ + "Unspecified range type. This value must not be used.", + "A fixed range. Both the `start_index` and\n`end_index` must be specified.", + "Starts the range at `start_index` and continues until the\nend of the collection. The `end_index` must not be specified.", + "Sets the range to be the whole length of the collection. Both the\n`start_index` and the `end_index` must not be\nspecified." + ], + "type": "string" + } + }, + "id": "Range" + }, + "TableColumnProperties": { + "description": "Properties of each column in a table.", + "type": "object", + "properties": { + "columnWidth": { + "description": "Width of a column.", + "$ref": "Dimension" + } + }, + "id": "TableColumnProperties" + }, + "Request": { + "description": "A single kind of update to apply to a presentation.", + "type": "object", + "properties": { + "createParagraphBullets": { + "description": "Creates bullets for paragraphs.", + "$ref": "CreateParagraphBulletsRequest" + }, + "insertTableColumns": { + "description": "Inserts columns into a table.", + "$ref": "InsertTableColumnsRequest" + }, + "createTable": { + "description": "Creates a new table.", + "$ref": "CreateTableRequest" + }, + "deleteText": { + "description": "Deletes text from a shape or a table cell.", + "$ref": "DeleteTextRequest" + }, + "replaceAllText": { + "description": "Replaces all instances of specified text.", + "$ref": "ReplaceAllTextRequest" + }, + "updateVideoProperties": { + "description": "Updates the properties of a Video.", + "$ref": "UpdateVideoPropertiesRequest" + }, + "insertText": { + "description": "Inserts text into a shape or table cell.", + "$ref": "InsertTextRequest" + }, + "deleteTableRow": { + "description": "Deletes a row from a table.", + "$ref": "DeleteTableRowRequest" + }, + "createLine": { + "description": "Creates a line.", + "$ref": "CreateLineRequest" + }, + "updateTextStyle": { + "description": "Updates the styling of text within a Shape or Table.", + "$ref": "UpdateTextStyleRequest" + }, + "insertTableRows": { + "description": "Inserts rows into a table.", + "$ref": "InsertTableRowsRequest" + }, + "updateTableCellProperties": { + "description": "Updates the properties of a TableCell.", + "$ref": "UpdateTableCellPropertiesRequest" + }, + "refreshSheetsChart": { + "description": "Refreshes a Google Sheets chart.", + "$ref": "RefreshSheetsChartRequest" + }, + "createSheetsChart": { + "description": "Creates an embedded Google Sheets chart.", + "$ref": "CreateSheetsChartRequest" + }, + "updatePageProperties": { + "description": "Updates the properties of a Page.", + "$ref": "UpdatePagePropertiesRequest" + }, + "updateShapeProperties": { + "description": "Updates the properties of a Shape.", + "$ref": "UpdateShapePropertiesRequest" + }, + "createSlide": { + "description": "Creates a new slide.", + "$ref": "CreateSlideRequest" + }, + "deleteObject": { + "description": "Deletes a page or page element from the presentation.", + "$ref": "DeleteObjectRequest" + }, + "createShape": { + "description": "Creates a new shape.", + "$ref": "CreateShapeRequest" + }, + "updatePageElementTransform": { + "description": "Updates the transform of a page element.", + "$ref": "UpdatePageElementTransformRequest" + }, + "updateSlidesPosition": { + "description": "Updates the position of a set of slides in the presentation.", + "$ref": "UpdateSlidesPositionRequest" + }, + "replaceAllShapesWithImage": { + "description": "Replaces all shapes matching some criteria with an image.", + "$ref": "ReplaceAllShapesWithImageRequest" + }, + "updateImageProperties": { + "description": "Updates the properties of an Image.", + "$ref": "UpdateImagePropertiesRequest" + }, + "createVideo": { + "description": "Creates a video.", + "$ref": "CreateVideoRequest" + }, + "createImage": { + "description": "Creates an image.", + "$ref": "CreateImageRequest" + }, + "duplicateObject": { + "description": "Duplicates a slide or page element.", + "$ref": "DuplicateObjectRequest" + }, + "deleteTableColumn": { + "description": "Deletes a column from a table.", + "$ref": "DeleteTableColumnRequest" + }, + "updateLineProperties": { + "description": "Updates the properties of a Line.", + "$ref": "UpdateLinePropertiesRequest" + } + }, + "id": "Request" + }, + "LineFill": { + "description": "The fill of the line.", + "type": "object", + "properties": { + "solidFill": { + "description": "Solid color fill.", + "$ref": "SolidFill" + } + }, + "id": "LineFill" + }, + "OutlineFill": { + "description": "The fill of the outline.", + "type": "object", + "properties": { + "solidFill": { + "description": "Solid color fill.", + "$ref": "SolidFill" + } + }, + "id": "OutlineFill" + }, + "Bullet": { + "description": "Describes the bullet of a paragraph.", + "type": "object", + "properties": { + "nestingLevel": { + "description": "The nesting level of this paragraph in the list.", + "type": "integer", + "format": "int32" + }, + "glyph": { + "description": "The rendered bullet glyph for this paragraph.", + "type": "string" + }, + "bulletStyle": { + "description": "The paragraph specific text style applied to this bullet.", + "$ref": "TextStyle" + }, + "listId": { + "description": "The ID of the list this paragraph belongs to.", + "type": "string" + } + }, + "id": "Bullet" + } + }, + "revision": "20161213", + "basePath": "", + "icons": { + "x32": "http://www.google.com/images/icons/product/search-32.gif", + "x16": "http://www.google.com/images/icons/product/search-16.gif" + }, + "version_module": "True", + "canonicalName": "Slides", + "discoveryVersion": "v1", + "baseUrl": "https://slides.googleapis.com/", + "name": "slides", + "parameters": { + "access_token": { + "description": "OAuth access token.", + "type": "string", + "location": "query" + }, + "prettyPrint": { + "description": "Returns response with indentations and line breaks.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "key": { + "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", + "type": "string", + "location": "query" + }, + "quotaUser": { + "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.", + "type": "string", + "location": "query" + }, + "pp": { + "description": "Pretty-print response.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "fields": { + "description": "Selector specifying which fields to include in a partial response.", + "type": "string", + "location": "query" + }, + "alt": { + "description": "Data format for response.", + "location": "query", + "enum": [ + "json", + "media", + "proto" + ], + "default": "json", + "enumDescriptions": [ + "Responses with Content-Type of application/json", + "Media download with context-dependent Content-Type", + "Responses with Content-Type of application/x-protobuf" + ], + "type": "string" + }, + "$.xgafv": { + "description": "V1 error format.", + "enum": [ + "1", + "2" + ], + "enumDescriptions": [ + "v1 error format", + "v2 error format" + ], + "type": "string", + "location": "query" + }, + "callback": { + "description": "JSONP", + "type": "string", + "location": "query" + }, + "oauth_token": { + "description": "OAuth 2.0 token for the current user.", + "type": "string", + "location": "query" + }, + "uploadType": { + "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").", + "type": "string", + "location": "query" + }, + "bearer_token": { + "description": "OAuth bearer token.", + "type": "string", + "location": "query" + }, + "upload_protocol": { + "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").", + "type": "string", + "location": "query" + } + }, + "documentationLink": "https://developers.google.com/slides/", + "ownerDomain": "google.com", + "batchPath": "batch", + "servicePath": "", + "ownerName": "Google", + "version": "v1", + "rootUrl": "https://slides.googleapis.com/", + "kind": "discovery#restDescription" +} diff --git a/etc/api/spectrum/v1explorer/spectrum-api.json b/etc/api/spectrum/v1explorer/spectrum-api.json index 9c0d1799b1..b118ec86c2 100644 --- a/etc/api/spectrum/v1explorer/spectrum-api.json +++ b/etc/api/spectrum/v1explorer/spectrum-api.json @@ -1,18 +1,18 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/7o5ihLEuj1aR6K5HAKPVJpf81Ag\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/7jsu-YTTnbrRYkb7WAMMQ1iBhP4\"", "discoveryVersion": "v1", "id": "spectrum:v1explorer", "name": "spectrum", "version": "v1explorer", - "revision": "20160606", + "revision": "20161116", "title": "Google Spectrum Database API", "description": "API for spectrum-management functions.", "ownerDomain": "google.com", "ownerName": "Google", "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" }, "documentationLink": "http://developers.google.com/spectrum", "protocol": "rest", diff --git a/etc/api/speech/v1beta1/speech-api.json b/etc/api/speech/v1beta1/speech-api.json index e69de29bb2..a54e0b9c60 100644 --- a/etc/api/speech/v1beta1/speech-api.json +++ b/etc/api/speech/v1beta1/speech-api.json @@ -0,0 +1,529 @@ +{ + "id": "speech:v1beta1", + "auth": { + "oauth2": { + "scopes": { + "https://www.googleapis.com/auth/cloud-platform": { + "description": "View and manage your data across Google Cloud Platform services" + } + } + } + }, + "description": "Google Cloud Speech API.", + "protocol": "rest", + "title": "Google Cloud Speech API", + "resources": { + "operations": { + "methods": { + "get": { + "id": "speech.operations.get", + "response": { + "$ref": "Operation" + }, + "parameterOrder": [ + "name" + ], + "description": "Gets the latest state of a long-running operation. Clients can use this\nmethod to poll the operation result at intervals as recommended by the API\nservice.", + "flatPath": "v1beta1/operations/{operationsId}", + "httpMethod": "GET", + "parameters": { + "name": { + "description": "The name of the operation resource.", + "required": true, + "pattern": "^[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/operations/{+name}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "list": { + "id": "speech.operations.list", + "response": { + "$ref": "ListOperationsResponse" + }, + "parameterOrder": [], + "description": "Lists operations that match the specified filter in the request. If the\nserver doesn't support this method, it returns `UNIMPLEMENTED`.\n\nNOTE: the `name` binding below allows API services to override the binding\nto use different resource name schemes, such as `users/*/operations`.", + "flatPath": "v1beta1/operations", + "httpMethod": "GET", + "parameters": { + "pageSize": { + "description": "The standard list page size.", + "location": "query", + "type": "integer", + "format": "int32" + }, + "filter": { + "description": "The standard list filter.", + "location": "query", + "type": "string" + }, + "name": { + "description": "The name of the operation collection.", + "location": "query", + "type": "string" + }, + "pageToken": { + "description": "The standard list page token.", + "location": "query", + "type": "string" + } + }, + "path": "v1beta1/operations", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "delete": { + "id": "speech.operations.delete", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "name" + ], + "description": "Deletes a long-running operation. This method indicates that the client is\nno longer interested in the operation result. It does not cancel the\noperation. If the server doesn't support this method, it returns\n`google.rpc.Code.UNIMPLEMENTED`.", + "flatPath": "v1beta1/operations/{operationsId}", + "httpMethod": "DELETE", + "parameters": { + "name": { + "description": "The name of the operation resource to be deleted.", + "required": true, + "pattern": "^[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/operations/{+name}", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "cancel": { + "id": "speech.operations.cancel", + "response": { + "$ref": "Empty" + }, + "parameterOrder": [ + "name" + ], + "description": "Starts asynchronous cancellation on a long-running operation. The server\nmakes a best effort to cancel the operation, but success is not\nguaranteed. If the server doesn't support this method, it returns\n`google.rpc.Code.UNIMPLEMENTED`. Clients can use\nOperations.GetOperation or\nother methods to check whether the cancellation succeeded or whether the\noperation completed despite cancellation. On successful cancellation,\nthe operation is not deleted; instead, it becomes an operation with\nan Operation.error value with a google.rpc.Status.code of 1,\ncorresponding to `Code.CANCELLED`.", + "request": { + "$ref": "CancelOperationRequest" + }, + "flatPath": "v1beta1/operations/{operationsId}:cancel", + "httpMethod": "POST", + "parameters": { + "name": { + "description": "The name of the operation resource to be cancelled.", + "required": true, + "pattern": "^[^/]+$", + "location": "path", + "type": "string" + } + }, + "path": "v1beta1/operations/{+name}:cancel", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + } + } + }, + "speech": { + "methods": { + "syncrecognize": { + "id": "speech.speech.syncrecognize", + "response": { + "$ref": "SyncRecognizeResponse" + }, + "parameterOrder": [], + "description": "Performs synchronous speech recognition: receive results after all audio\nhas been sent and processed.", + "request": { + "$ref": "SyncRecognizeRequest" + }, + "flatPath": "v1beta1/speech:syncrecognize", + "httpMethod": "POST", + "parameters": {}, + "path": "v1beta1/speech:syncrecognize", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + }, + "asyncrecognize": { + "id": "speech.speech.asyncrecognize", + "response": { + "$ref": "Operation" + }, + "parameterOrder": [], + "description": "Performs asynchronous speech recognition: receive results via the\n[google.longrunning.Operations]\n(/speech/reference/rest/v1beta1/operations#Operation)\ninterface. Returns either an\n`Operation.error` or an `Operation.response` which contains\nan `AsyncRecognizeResponse` message.", + "request": { + "$ref": "AsyncRecognizeRequest" + }, + "flatPath": "v1beta1/speech:asyncrecognize", + "httpMethod": "POST", + "parameters": {}, + "path": "v1beta1/speech:asyncrecognize", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + } + } + } + }, + "schemas": { + "Status": { + "description": "The `Status` type defines a logical error model that is suitable for different\nprogramming environments, including REST APIs and RPC APIs. It is used by\n[gRPC](https://github.com/grpc). The error model is designed to be:\n\n- Simple to use and understand for most users\n- Flexible enough to meet unexpected needs\n\n# Overview\n\nThe `Status` message contains three pieces of data: error code, error message,\nand error details. The error code should be an enum value of\ngoogle.rpc.Code, but it may accept additional error codes if needed. The\nerror message should be a developer-facing English message that helps\ndevelopers *understand* and *resolve* the error. If a localized user-facing\nerror message is needed, put the localized message in the error details or\nlocalize it in the client. The optional error details may contain arbitrary\ninformation about the error. There is a predefined set of error detail types\nin the package `google.rpc` which can be used for common error conditions.\n\n# Language mapping\n\nThe `Status` message is the logical representation of the error model, but it\nis not necessarily the actual wire format. When the `Status` message is\nexposed in different client libraries and different wire protocols, it can be\nmapped differently. For example, it will likely be mapped to some exceptions\nin Java, but more likely mapped to some error codes in C.\n\n# Other uses\n\nThe error model and the `Status` message can be used in a variety of\nenvironments, either with or without APIs, to provide a\nconsistent developer experience across different environments.\n\nExample uses of this error model include:\n\n- Partial errors. If a service needs to return partial errors to the client,\n it may embed the `Status` in the normal response to indicate the partial\n errors.\n\n- Workflow errors. A typical workflow has multiple steps. Each step may\n have a `Status` message for error reporting purpose.\n\n- Batch operations. If a client uses batch request and batch response, the\n `Status` message should be used directly inside batch response, one for\n each error sub-response.\n\n- Asynchronous operations. If an API call embeds asynchronous operation\n results in its response, the status of those operations should be\n represented directly using the `Status` message.\n\n- Logging. If some API errors are stored in logs, the message `Status` could\n be used directly after any stripping needed for security/privacy reasons.", + "type": "object", + "properties": { + "code": { + "description": "The status code, which should be an enum value of google.rpc.Code.", + "type": "integer", + "format": "int32" + }, + "details": { + "description": "A list of messages that carry the error details. There will be a\ncommon set of message types for APIs to use.", + "type": "array", + "items": { + "additionalProperties": { + "description": "Properties of the object. Contains field @type with type URL.", + "type": "any" + }, + "type": "object" + } + }, + "message": { + "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\ngoogle.rpc.Status.details field, or localized by the client.", + "type": "string" + } + }, + "id": "Status" + }, + "RecognitionAudio": { + "description": "Contains audio data in the encoding specified in the `RecognitionConfig`.\nEither `content` or `uri` must be supplied. Supplying both or neither\nreturns google.rpc.Code.INVALID_ARGUMENT. See\n[audio limits](https://cloud.google.com/speech/limits#content).", + "type": "object", + "properties": { + "content": { + "description": "The audio data bytes encoded as specified in\n`RecognitionConfig`. Note: as with all bytes fields, protobuffers use a\npure binary representation, whereas JSON representations use base64.", + "type": "string", + "format": "byte" + }, + "uri": { + "description": "URI that points to a file that contains audio data bytes as specified in\n`RecognitionConfig`. Currently, only Google Cloud Storage URIs are\nsupported, which must be specified in the following format:\n`gs://bucket_name/object_name` (other URI formats return\ngoogle.rpc.Code.INVALID_ARGUMENT). For more information, see\n[Request URIs](https://cloud.google.com/storage/docs/reference-uris).", + "type": "string" + } + }, + "id": "RecognitionAudio" + }, + "Operation": { + "description": "This resource represents a long-running operation that is the result of a\nnetwork API call.", + "type": "object", + "properties": { + "error": { + "description": "The error result of the operation in case of failure or cancellation.", + "$ref": "Status" + }, + "done": { + "description": "If the value is `false`, it means the operation is still in progress.\nIf true, the operation is completed, and either `error` or `response` is\navailable.", + "type": "boolean" + }, + "metadata": { + "description": "Service-specific metadata associated with the operation. It typically\ncontains progress information and common metadata such as create time.\nSome services might not provide such metadata. Any method that returns a\nlong-running operation should document the metadata type, if any.", + "additionalProperties": { + "description": "Properties of the object. Contains field @type with type URL.", + "type": "any" + }, + "type": "object" + }, + "response": { + "description": "The normal response of the operation in case of success. If the original\nmethod returns no data on success, such as `Delete`, the response is\n`google.protobuf.Empty`. If the original method is standard\n`Get`/`Create`/`Update`, the response should be the resource. For other\nmethods, the response should have the type `XxxResponse`, where `Xxx`\nis the original method name. For example, if the original method name\nis `TakeSnapshot()`, the inferred response type is\n`TakeSnapshotResponse`.", + "additionalProperties": { + "description": "Properties of the object. Contains field @type with type URL.", + "type": "any" + }, + "type": "object" + }, + "name": { + "description": "The server-assigned name, which is only unique within the same service that\noriginally returns it. If you use the default HTTP mapping, the\n`name` should have the format of `operations/some/unique/name`.", + "type": "string" + } + }, + "id": "Operation" + }, + "SpeechRecognitionAlternative": { + "description": "Alternative hypotheses (a.k.a. n-best list).", + "type": "object", + "properties": { + "transcript": { + "description": "[Output-only] Transcript text representing the words that the user spoke.", + "type": "string" + }, + "confidence": { + "description": "[Output-only] The confidence estimate between 0.0 and 1.0. A higher number\nmeans the system is more confident that the recognition is correct.\nThis field is typically provided only for the top hypothesis, and only for\n`is_final=true` results.\nThe default of 0.0 is a sentinel value indicating confidence was not set.", + "type": "number", + "format": "float" + } + }, + "id": "SpeechRecognitionAlternative" + }, + "CancelOperationRequest": { + "description": "The request message for Operations.CancelOperation.", + "type": "object", + "properties": {}, + "id": "CancelOperationRequest" + }, + "RecognitionConfig": { + "description": "The `RecognitionConfig` message provides information to the recognizer\nthat specifies how to process the request.", + "type": "object", + "properties": { + "maxAlternatives": { + "description": "[Optional] Maximum number of recognition hypotheses to be returned.\nSpecifically, the maximum number of `SpeechRecognitionAlternative` messages\nwithin each `SpeechRecognitionResult`.\nThe server may return fewer than `max_alternatives`.\nValid values are `0`-`30`. A value of `0` or `1` will return a maximum of\n`1`. If omitted, defaults to `1`.", + "type": "integer", + "format": "int32" + }, + "languageCode": { + "description": "[Optional] The language of the supplied audio as a BCP-47 language tag.\nExample: \"en-GB\" https://www.rfc-editor.org/rfc/bcp/bcp47.txt\nIf omitted, defaults to \"en-US\". See\n[Language Support](https://cloud.google.com/speech/docs/languages)\nfor a list of the currently supported language codes.", + "type": "string" + }, + "speechContext": { + "description": "[Optional] A means to provide context to assist the speech recognition.", + "$ref": "SpeechContext" + }, + "encoding": { + "description": "[Required] Encoding of audio data sent in all `RecognitionAudio` messages.", + "enum": [ + "ENCODING_UNSPECIFIED", + "LINEAR16", + "FLAC", + "MULAW", + "AMR", + "AMR_WB" + ], + "enumDescriptions": [ + "Not specified. Will return result google.rpc.Code.INVALID_ARGUMENT.", + "Uncompressed 16-bit signed little-endian samples (Linear PCM).\nThis is the only encoding that may be used by `AsyncRecognize`.", + "This is the recommended encoding for `SyncRecognize` and\n`StreamingRecognize` because it uses lossless compression; therefore\nrecognition accuracy is not compromised by a lossy codec.\n\nThe stream FLAC (Free Lossless Audio Codec) encoding is specified at:\nhttp://flac.sourceforge.net/documentation.html.\n16-bit and 24-bit samples are supported.\nNot all fields in STREAMINFO are supported.", + "8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law.", + "Adaptive Multi-Rate Narrowband codec. `sample_rate` must be 8000 Hz.", + "Adaptive Multi-Rate Wideband codec. `sample_rate` must be 16000 Hz." + ], + "type": "string" + }, + "profanityFilter": { + "description": "[Optional] If set to `true`, the server will attempt to filter out\nprofanities, replacing all but the initial character in each filtered word\nwith asterisks, e.g. \"f***\". If set to `false` or omitted, profanities\nwon't be filtered out.", + "type": "boolean" + }, + "sampleRate": { + "description": "[Required] Sample rate in Hertz of the audio data sent in all\n`RecognitionAudio` messages. Valid values are: 8000-48000.\n16000 is optimal. For best results, set the sampling rate of the audio\nsource to 16000 Hz. If that's not possible, use the native sample rate of\nthe audio source (instead of re-sampling).", + "type": "integer", + "format": "int32" + } + }, + "id": "RecognitionConfig" + }, + "SyncRecognizeRequest": { + "description": "`SyncRecognizeRequest` is the top-level message sent by the client for\nthe `SyncRecognize` method.", + "type": "object", + "properties": { + "audio": { + "description": "[Required] The audio data to be recognized.", + "$ref": "RecognitionAudio" + }, + "config": { + "description": "[Required] The `config` message provides information to the recognizer\nthat specifies how to process the request.", + "$ref": "RecognitionConfig" + } + }, + "id": "SyncRecognizeRequest" + }, + "SpeechRecognitionResult": { + "description": "A speech recognition result corresponding to a portion of the audio.", + "type": "object", + "properties": { + "alternatives": { + "description": "[Output-only] May contain one or more recognition hypotheses (up to the\nmaximum specified in `max_alternatives`).", + "type": "array", + "items": { + "$ref": "SpeechRecognitionAlternative" + } + } + }, + "id": "SpeechRecognitionResult" + }, + "ListOperationsResponse": { + "description": "The response message for Operations.ListOperations.", + "type": "object", + "properties": { + "nextPageToken": { + "description": "The standard List next-page token.", + "type": "string" + }, + "operations": { + "description": "A list of operations that matches the specified filter in the request.", + "type": "array", + "items": { + "$ref": "Operation" + } + } + }, + "id": "ListOperationsResponse" + }, + "Empty": { + "description": "A generic empty message that you can re-use to avoid defining duplicated\nempty messages in your APIs. A typical example is to use it as the request\nor the response type of an API method. For instance:\n\n service Foo {\n rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);\n }\n\nThe JSON representation for `Empty` is empty JSON object `{}`.", + "type": "object", + "properties": {}, + "id": "Empty" + }, + "SyncRecognizeResponse": { + "description": "`SyncRecognizeResponse` is the only message returned to the client by\n`SyncRecognize`. It contains the result as zero or more sequential\n`SpeechRecognitionResult` messages.", + "type": "object", + "properties": { + "results": { + "description": "[Output-only] Sequential list of transcription results corresponding to\nsequential portions of audio.", + "type": "array", + "items": { + "$ref": "SpeechRecognitionResult" + } + } + }, + "id": "SyncRecognizeResponse" + }, + "SpeechContext": { + "description": "Provides \"hints\" to the speech recognizer to favor specific words and phrases\nin the results.", + "type": "object", + "properties": { + "phrases": { + "description": "[Optional] A list of strings containing words and phrases \"hints\" so that\nthe speech recognition is more likely to recognize them. This can be used\nto improve the accuracy for specific words and phrases, for example, if\nspecific commands are typically spoken by the user. This can also be used\nto add additional words to the vocabulary of the recognizer. See\n[usage limits](https://cloud.google.com/speech/limits#content).", + "type": "array", + "items": { + "type": "string" + } + } + }, + "id": "SpeechContext" + }, + "AsyncRecognizeRequest": { + "description": "`AsyncRecognizeRequest` is the top-level message sent by the client for\nthe `AsyncRecognize` method.", + "type": "object", + "properties": { + "audio": { + "description": "[Required] The audio data to be recognized.", + "$ref": "RecognitionAudio" + }, + "config": { + "description": "[Required] The `config` message provides information to the recognizer\nthat specifies how to process the request.", + "$ref": "RecognitionConfig" + } + }, + "id": "AsyncRecognizeRequest" + } + }, + "revision": "20161213", + "basePath": "", + "icons": { + "x32": "http://www.google.com/images/icons/product/search-32.gif", + "x16": "http://www.google.com/images/icons/product/search-16.gif" + }, + "version_module": "True", + "discoveryVersion": "v1", + "baseUrl": "https://speech.googleapis.com/", + "name": "speech", + "parameters": { + "access_token": { + "description": "OAuth access token.", + "type": "string", + "location": "query" + }, + "prettyPrint": { + "description": "Returns response with indentations and line breaks.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "key": { + "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", + "type": "string", + "location": "query" + }, + "quotaUser": { + "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.", + "type": "string", + "location": "query" + }, + "pp": { + "description": "Pretty-print response.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "fields": { + "description": "Selector specifying which fields to include in a partial response.", + "type": "string", + "location": "query" + }, + "alt": { + "description": "Data format for response.", + "location": "query", + "enum": [ + "json", + "media", + "proto" + ], + "default": "json", + "enumDescriptions": [ + "Responses with Content-Type of application/json", + "Media download with context-dependent Content-Type", + "Responses with Content-Type of application/x-protobuf" + ], + "type": "string" + }, + "$.xgafv": { + "description": "V1 error format.", + "enum": [ + "1", + "2" + ], + "enumDescriptions": [ + "v1 error format", + "v2 error format" + ], + "type": "string", + "location": "query" + }, + "callback": { + "description": "JSONP", + "type": "string", + "location": "query" + }, + "oauth_token": { + "description": "OAuth 2.0 token for the current user.", + "type": "string", + "location": "query" + }, + "uploadType": { + "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").", + "type": "string", + "location": "query" + }, + "bearer_token": { + "description": "OAuth bearer token.", + "type": "string", + "location": "query" + }, + "upload_protocol": { + "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").", + "type": "string", + "location": "query" + } + }, + "documentationLink": "https://cloud.google.com/speech/", + "ownerDomain": "google.com", + "batchPath": "batch", + "servicePath": "", + "ownerName": "Google", + "version": "v1beta1", + "rootUrl": "https://speech.googleapis.com/", + "kind": "discovery#restDescription" +} diff --git a/etc/api/sqladmin/v1beta3/sqladmin-api.json b/etc/api/sqladmin/v1beta3/sqladmin-api.json index d5cf1191a4..4b962baa60 100644 --- a/etc/api/sqladmin/v1beta3/sqladmin-api.json +++ b/etc/api/sqladmin/v1beta3/sqladmin-api.json @@ -1,19 +1,19 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/415Y_MOhJemLQ99n44vp9SPEXTs\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/BnNZo7KjDfKGhFIvKuQEw2fnFCo\"", "discoveryVersion": "v1", "id": "sqladmin:v1beta3", "name": "sqladmin", "canonicalName": "SQL Admin", "version": "v1beta3", - "revision": "20160907", + "revision": "20161213", "title": "Cloud SQL Administration API", "description": "Creates and configures Cloud SQL instances, which provide fully-managed MySQL databases.", "ownerDomain": "google.com", "ownerName": "Google", "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" }, "documentationLink": "https://cloud.google.com/sql/docs/reference/latest", "protocol": "rest", @@ -244,6 +244,10 @@ "type": "object", "description": "A Cloud SQL instance resource.", "properties": { + "connectionName": { + "type": "string", + "description": "Connection name of the Cloud SQL instance used in connection strings." + }, "currentDiskSize": { "type": "string", "description": "The current disk usage of the instance in bytes.", @@ -1096,7 +1100,7 @@ }, "region": { "type": "array", - "description": "The applicable regions for this tier. Can be us-east1, europe-west1, or asia-east1.", + "description": "The applicable regions for this tier.", "items": { "type": "string" } diff --git a/etc/api/sqladmin/v1beta4/sqladmin-api.json b/etc/api/sqladmin/v1beta4/sqladmin-api.json index c60d9553f9..bc7b76ef17 100644 --- a/etc/api/sqladmin/v1beta4/sqladmin-api.json +++ b/etc/api/sqladmin/v1beta4/sqladmin-api.json @@ -1,19 +1,19 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/zmDns7c8ddqXN0fbR2rCpbUmiN4\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/zyhp6b48ey3HpDh3VFAj4lFLBFo\"", "discoveryVersion": "v1", "id": "sqladmin:v1beta4", "name": "sqladmin", "canonicalName": "SQL Admin", "version": "v1beta4", - "revision": "20160907", + "revision": "20161213", "title": "Cloud SQL Administration API", "description": "Creates and configures Cloud SQL instances, which provide fully-managed MySQL databases.", "ownerDomain": "google.com", "ownerName": "Google", "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" }, "documentationLink": "https://cloud.google.com/sql/docs/reference/latest", "protocol": "rest", @@ -333,6 +333,10 @@ "type": "string", "description": "FIRST_GEN: Basic Cloud SQL instance that runs in a Google-managed container.\nSECOND_GEN: A newer Cloud SQL backend that runs in a Compute Engine VM.\nEXTERNAL: A MySQL server that is not managed by Google." }, + "connectionName": { + "type": "string", + "description": "Connection name of the Cloud SQL instance used in connection strings." + }, "currentDiskSize": { "type": "string", "description": "The current disk usage of the instance in bytes. This property has been deprecated. Users should use the \"cloudsql.googleapis.com/database/disk/bytes_used\" metric in Cloud Monitoring API instead. Please see https://groups.google.com/d/msg/google-cloud-sql-announce/I_7-F9EBhT0/BtvFtdFeAgAJ for details.", @@ -767,6 +771,10 @@ "type": "string", "description": "The due time for this IP to be retired in RFC 3339 format, for example 2012-11-15T16:19:00.094Z. This field is only available when the IP is scheduled to be retired.", "format": "date-time" + }, + "type": { + "type": "string", + "description": "The type of this IP address. A PRIMARY address is an address that can accept incoming connections. An OUTGOING address is the source address of connections originating from the instance, if supported." } } }, @@ -1307,7 +1315,7 @@ }, "region": { "type": "array", - "description": "The applicable regions for this tier. Can be us-east1, europe-west1 or asia-east1.", + "description": "The applicable regions for this tier.", "items": { "type": "string" } @@ -2283,6 +2291,52 @@ "https://www.googleapis.com/auth/sqlservice.admin" ] }, + "truncateLog": { + "id": "sql.instances.truncateLog", + "path": "projects/{project}/instances/{instance}/truncateLog", + "httpMethod": "POST", + "description": "Truncate MySQL general and slow query log tables", + "parameters": { + "instance": { + "type": "string", + "description": "Cloud SQL instance ID. This does not include the project ID.", + "required": true, + "location": "path" + }, + "logType": { + "type": "string", + "description": "The type of Log Table to truncate. Valid values are MYSQL_GENERAL_TABLE and MYSQL_SLOW_TABLE", + "required": true, + "enum": [ + "MYSQL_GENERAL_TABLE", + "MYSQL_SLOW_TABLE" + ], + "enumDescriptions": [ + "Truncate mysql.general_log table", + "Truncate mysql.slow_log table" + ], + "location": "query" + }, + "project": { + "type": "string", + "description": "Project ID of the Cloud SQL project.", + "required": true, + "location": "path" + } + }, + "parameterOrder": [ + "project", + "instance", + "logType" + ], + "response": { + "$ref": "Operation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/sqlservice.admin" + ] + }, "update": { "id": "sql.instances.update", "path": "projects/{project}/instances/{instance}", diff --git a/etc/api/storage/v1/storage-api.json b/etc/api/storage/v1/storage-api.json index 05f038638a..d859b90452 100644 --- a/etc/api/storage/v1/storage-api.json +++ b/etc/api/storage/v1/storage-api.json @@ -1,11 +1,11 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/7UKGvp9HCO73orSqObtC5zYVHKQ\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/ZBb2iLoDHuz7Rvww5u_HoO9Br24\"", "discoveryVersion": "v1", "id": "storage:v1", "name": "storage", "version": "v1", - "revision": "20160901", + "revision": "20161123", "title": "Cloud Storage JSON API", "description": "Stores and retrieves potentially large, immutable data objects.", "ownerDomain": "google.com", @@ -150,15 +150,6 @@ "$ref": "ObjectAccessControl" } }, - "encryption": { - "type": "object", - "description": "Encryption configuration used by default for newly inserted objects, when no encryption config is specified.", - "properties": { - "default_kms_key_name": { - "type": "string" - } - } - }, "etag": { "type": "string", "description": "HTTP 1.1 Entity tag for the bucket." @@ -186,9 +177,13 @@ "type": "object", "description": "The action to take.", "properties": { + "storageClass": { + "type": "string", + "description": "Target storage class. Required iff the type of the action is SetStorageClass." + }, "type": { "type": "string", - "description": "Type of the action. Currently, only Delete is supported." + "description": "Type of the action. Currently, only Delete and SetStorageClass are supported." } } }, @@ -210,6 +205,13 @@ "type": "boolean", "description": "Relevant only for versioned objects. If the value is true, this condition matches live objects; if the value is false, it matches archived objects." }, + "matchesStorageClass": { + "type": "array", + "description": "Objects having any of the storage classes specified by this condition will be matched. Values include MULTI_REGIONAL, REGIONAL, NEARLINE, COLDLINE, STANDARD, and DURABLE_REDUCED_AVAILABILITY.", + "items": { + "type": "string" + } + }, "numNewerVersions": { "type": "integer", "description": "Relevant only for versioned objects. If the value is N, this condition is satisfied when there are at least N versions (including the live version) newer than this version of the object.", @@ -279,7 +281,7 @@ }, "storageClass": { "type": "string", - "description": "The bucket's storage class. This defines how objects in the bucket are stored and determines the SLA and the cost of storage. Values include STANDARD, NEARLINE and DURABLE_REDUCED_AVAILABILITY. Defaults to STANDARD. For more information, see storage classes." + "description": "The bucket's default storage class, used whenever no storageClass is specified for a newly-created object. This defines how objects in the bucket are stored and determines the SLA and the cost of storage. Values include MULTI_REGIONAL, REGIONAL, STANDARD, NEARLINE, COLDLINE, and DURABLE_REDUCED_AVAILABILITY. If this value is not specified when the bucket is created, it will default to STANDARD. For more information, see storage classes." }, "timeCreated": { "type": "string", @@ -621,10 +623,6 @@ "description": "The kind of item this is. For objects, this is always storage#object.", "default": "storage#object" }, - "kmsKeyName": { - "type": "string", - "description": "Cloud KMS Key used to encrypt this object, if the object is encrypted by such a key." - }, "md5Hash": { "type": "string", "description": "MD5 hash of the data; encoded using base64. For more information about using the MD5 hash, see Hashes and ETags: Best Practices." @@ -687,6 +685,11 @@ "description": "The deletion time of the object in RFC 3339 format. Will be returned if and only if this version of the object has been deleted.", "format": "date-time" }, + "timeStorageClassUpdated": { + "type": "string", + "description": "The time at which the object's storage class was last changed. When the object is initially created, it will be set to timeCreated.", + "format": "date-time" + }, "updated": { "type": "string", "description": "The modification time of the object metadata in RFC 3339 format.", @@ -713,7 +716,13 @@ }, "entity": { "type": "string", - "description": "The entity holding the permission, in one of the following forms: \n- user-userId \n- user-email \n- group-groupId \n- group-email \n- domain-domain \n- project-team-projectId \n- allUsers \n- allAuthenticatedUsers Examples: \n- The user liz@example.com would be user-liz@example.com. \n- The group example@googlegroups.com would be group-example@googlegroups.com. \n- To refer to all members of the Google Apps for Business domain example.com, the entity would be domain-example.com." + "description": "The entity holding the permission, in one of the following forms: \n- user-userId \n- user-email \n- group-groupId \n- group-email \n- domain-domain \n- project-team-projectId \n- allUsers \n- allAuthenticatedUsers Examples: \n- The user liz@example.com would be user-liz@example.com. \n- The group example@googlegroups.com would be group-example@googlegroups.com. \n- To refer to all members of the Google Apps for Business domain example.com, the entity would be domain-example.com.", + "annotations": { + "required": [ + "storage.defaultObjectAccessControls.insert", + "storage.objectAccessControls.insert" + ] + } }, "entityId": { "type": "string", @@ -725,7 +734,7 @@ }, "generation": { "type": "string", - "description": "The content generation of the object.", + "description": "The content generation of the object, if applied to an object.", "format": "int64" }, "id": { @@ -739,7 +748,7 @@ }, "object": { "type": "string", - "description": "The name of the object." + "description": "The name of the object, if applied to an object." }, "projectTeam": { "type": "object", @@ -757,7 +766,13 @@ }, "role": { "type": "string", - "description": "The access permission for the entity." + "description": "The access permission for the entity.", + "annotations": { + "required": [ + "storage.defaultObjectAccessControls.insert", + "storage.objectAccessControls.insert" + ] + } }, "selfLink": { "type": "string", @@ -774,7 +789,7 @@ "type": "array", "description": "The list of items.", "items": { - "type": "any" + "$ref": "ObjectAccessControl" } }, "kind": { @@ -1262,7 +1277,7 @@ "id": "storage.buckets.patch", "path": "b/{bucket}", "httpMethod": "PATCH", - "description": "Updates a bucket. This method supports patch semantics.", + "description": "Updates a bucket. Changes to the bucket will be readable immediately after writing, but configuration changes may take time to propagate. This method supports patch semantics.", "parameters": { "bucket": { "type": "string", @@ -1354,7 +1369,7 @@ "id": "storage.buckets.update", "path": "b/{bucket}", "httpMethod": "PUT", - "description": "Updates a bucket.", + "description": "Updates a bucket. Changes to the bucket will be readable immediately after writing, but configuration changes may take time to propagate.", "parameters": { "bucket": { "type": "string", @@ -1971,11 +1986,6 @@ "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.", "format": "int64", "location": "query" - }, - "kmsKeyName": { - "type": "string", - "description": "Resource name of the Cloud KMS key, of the form projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key, that will be used to encrypt the object. Overrides the object metadata's kms_key_name value, if any.", - "location": "query" } }, "parameterOrder": [ @@ -2314,11 +2324,6 @@ "format": "int64", "location": "query" }, - "kmsKeyName": { - "type": "string", - "description": "Resource name of the Cloud KMS key, of the form projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key, that will be used to encrypt the object. Overrides the object metadata's kms_key_name value, if any.", - "location": "query" - }, "name": { "type": "string", "description": "Name of the object. Required when the object metadata is not otherwise provided. Overrides the object metadata's name value, if any. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.", @@ -2570,11 +2575,6 @@ "required": true, "location": "path" }, - "destinationKmsKeyName": { - "type": "string", - "description": "Resource name of the Cloud KMS key, of the form projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key, that will be used to encrypt the object. Overrides the object metadata's kms_key_name value, if any.", - "location": "query" - }, "destinationObject": { "type": "string", "description": "Name of the new object. Required when the object metadata is not otherwise provided. Overrides the object metadata's name value, if any. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.", diff --git a/etc/api/storage/v1beta1/storage-api.json b/etc/api/storage/v1beta1/storage-api.json index 6c9ff3718a..3d18729e6a 100644 --- a/etc/api/storage/v1beta1/storage-api.json +++ b/etc/api/storage/v1beta1/storage-api.json @@ -1,11 +1,11 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/7fnG7WM18_hgZJqvQAIpmR5QQCE\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/hHmFumE4Lpos1zYExrRPmmPIXog\"", "discoveryVersion": "v1", "id": "storage:v1beta1", "name": "storage", "version": "v1beta1", - "revision": "20160901", + "revision": "20161123", "title": "Cloud Storage JSON API", "description": "Lets you store and retrieve potentially-large, immutable data objects.", "ownerDomain": "google.com", diff --git a/etc/api/storage/v1beta2/storage-api.json b/etc/api/storage/v1beta2/storage-api.json index 9bb9edba0e..75e0c5d42c 100644 --- a/etc/api/storage/v1beta2/storage-api.json +++ b/etc/api/storage/v1beta2/storage-api.json @@ -1,11 +1,11 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/LzaHFP4uE260OrVL1y91zlLKqTI\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/HwvP9LO29WwMjJL7HrnyitnxVTc\"", "discoveryVersion": "v1", "id": "storage:v1beta2", "name": "storage", "version": "v1beta2", - "revision": "20160901", + "revision": "20161123", "title": "Cloud Storage JSON API", "description": "Lets you store and retrieve potentially-large, immutable data objects.", "ownerDomain": "google.com", diff --git a/etc/api/storagetransfer/v1/storagetransfer-api.json b/etc/api/storagetransfer/v1/storagetransfer-api.json index 334f4d8880..c58c018184 100644 --- a/etc/api/storagetransfer/v1/storagetransfer-api.json +++ b/etc/api/storagetransfer/v1/storagetransfer-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/fmXUMBI6Gn2x3crK-Doz-fh96kI\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/fmXUMBI6Gn2x3crK-Doz-fh96kI\"", "discoveryVersion": "v1", "id": "storagetransfer:v1", "name": "storagetransfer", diff --git a/etc/api/surveys/v2/surveys-api.json b/etc/api/surveys/v2/surveys-api.json new file mode 100644 index 0000000000..fc39039531 --- /dev/null +++ b/etc/api/surveys/v2/surveys-api.json @@ -0,0 +1,872 @@ +{ + "kind": "discovery#restDescription", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/tlViSJX3ylU_pw2F3DxMwdFrJio\"", + "discoveryVersion": "v1", + "id": "surveys:v2", + "name": "surveys", + "canonicalName": "Surveys", + "version": "v2", + "revision": "20161103", + "title": "Surveys API", + "description": "Creates and conducts surveys, lists the surveys that an authenticated user owns, and retrieves survey results and information about specified surveys.", + "ownerDomain": "google.com", + "ownerName": "Google", + "icons": { + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" + }, + "protocol": "rest", + "baseUrl": "https://www.googleapis.com/surveys/v2/", + "basePath": "/surveys/v2/", + "rootUrl": "https://www.googleapis.com/", + "servicePath": "surveys/v2/", + "batchPath": "batch", + "parameters": { + "alt": { + "type": "string", + "description": "Data format for the response.", + "default": "json", + "enum": [ + "json" + ], + "enumDescriptions": [ + "Responses with Content-Type of application/json" + ], + "location": "query" + }, + "fields": { + "type": "string", + "description": "Selector specifying which fields to include in a partial response.", + "location": "query" + }, + "key": { + "type": "string", + "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", + "location": "query" + }, + "oauth_token": { + "type": "string", + "description": "OAuth 2.0 token for the current user.", + "location": "query" + }, + "prettyPrint": { + "type": "boolean", + "description": "Returns response with indentations and line breaks.", + "default": "true", + "location": "query" + }, + "quotaUser": { + "type": "string", + "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.", + "location": "query" + }, + "userIp": { + "type": "string", + "description": "IP address of the site where the request originates. Use this if you want to enforce per-user limits.", + "location": "query" + } + }, + "auth": { + "oauth2": { + "scopes": { + "https://www.googleapis.com/auth/surveys": { + "description": "View and manage your surveys and results" + }, + "https://www.googleapis.com/auth/surveys.readonly": { + "description": "View your surveys and survey results" + }, + "https://www.googleapis.com/auth/userinfo.email": { + "description": "View your email address" + } + } + } + }, + "schemas": { + "FieldMask": { + "id": "FieldMask", + "type": "object", + "properties": { + "fields": { + "type": "array", + "items": { + "$ref": "FieldMask" + } + }, + "id": { + "type": "integer", + "format": "int32" + } + } + }, + "MobileAppPanel": { + "id": "MobileAppPanel", + "type": "object", + "description": "Representation of an individual pre-defined panel object defining a targeted audience of opinion rewards mobile app users.", + "properties": { + "country": { + "type": "string", + "description": "Country code for the country of the users that the panel contains. Uses standard ISO 3166-1 2-character language codes. For instance, 'US' for the United States, and 'GB' for the United Kingdom. Any survey created targeting this panel must also target the corresponding country." + }, + "isPublicPanel": { + "type": "boolean", + "description": "Whether or not the panel is accessible to all API users." + }, + "language": { + "type": "string", + "description": "Language code that the panel can target. For instance, 'en-US'. Uses standard BCP47 language codes. See specification. Any survey created targeting this panel must also target the corresponding language." + }, + "mobileAppPanelId": { + "type": "string", + "description": "Unique panel ID string. This corresponds to the mobile_app_panel_id used in Survey Insert requests." + }, + "name": { + "type": "string", + "description": "Human readable name of the audience panel." + }, + "owners": { + "type": "array", + "description": "List of email addresses for users who can target members of this panel. Must contain at least the address of the user making the API call for panels that are not public. This field will be empty for public panels.", + "items": { + "type": "string" + } + } + } + }, + "MobileAppPanelsListResponse": { + "id": "MobileAppPanelsListResponse", + "type": "object", + "properties": { + "pageInfo": { + "$ref": "PageInfo" + }, + "requestId": { + "type": "string", + "description": "Unique request ID used for logging and debugging. Please include in any error reporting or troubleshooting requests." + }, + "resources": { + "type": "array", + "description": "An individual predefined panel of Opinion Rewards mobile users.", + "items": { + "$ref": "MobileAppPanel" + } + }, + "tokenPagination": { + "$ref": "TokenPagination" + } + } + }, + "PageInfo": { + "id": "PageInfo", + "type": "object", + "properties": { + "resultPerPage": { + "type": "integer", + "format": "int32" + }, + "startIndex": { + "type": "integer", + "format": "int32" + }, + "totalResults": { + "type": "integer", + "format": "int32" + } + } + }, + "ResultsGetRequest": { + "id": "ResultsGetRequest", + "type": "object", + "properties": { + "resultMask": { + "$ref": "ResultsMask" + } + } + }, + "ResultsMask": { + "id": "ResultsMask", + "type": "object", + "properties": { + "fields": { + "type": "array", + "items": { + "$ref": "FieldMask" + } + }, + "projection": { + "type": "string" + } + } + }, + "Survey": { + "id": "Survey", + "type": "object", + "description": "Representation of an individual survey object.", + "properties": { + "audience": { + "$ref": "SurveyAudience", + "description": "Targeting-criteria message containing demographic information" + }, + "cost": { + "$ref": "SurveyCost", + "description": "Cost to run the survey and collect the necessary number of responses." + }, + "customerData": { + "type": "string", + "description": "Additional information to store on behalf of the API consumer and associate with this question. This binary blob is treated as opaque. This field is limited to 64K bytes.", + "format": "byte" + }, + "description": { + "type": "string", + "description": "Text description of the survey." + }, + "owners": { + "type": "array", + "description": "List of email addresses for survey owners. Must contain at least the address of the user making the API call.", + "items": { + "type": "string" + }, + "annotations": { + "required": [ + "surveys.surveys.insert" + ] + } + }, + "questions": { + "type": "array", + "description": "List of questions defining the survey.", + "items": { + "$ref": "SurveyQuestion" + }, + "annotations": { + "required": [ + "surveys.surveys.insert" + ] + } + }, + "rejectionReason": { + "$ref": "SurveyRejection", + "description": "Reason for the survey being rejected. Only present if the survey state is rejected." + }, + "state": { + "type": "string", + "description": "State that the survey is in." + }, + "surveyUrlId": { + "type": "string", + "description": "Unique survey ID, that is viewable in the URL of the Survey Creator UI" + }, + "title": { + "type": "string", + "description": "Optional name that will be given to the survey." + }, + "wantedResponseCount": { + "type": "integer", + "description": "Number of responses desired for the survey.", + "format": "int32" + } + } + }, + "SurveyAudience": { + "id": "SurveyAudience", + "type": "object", + "description": "Specifications for the target audience of a survey run through the API.", + "properties": { + "ages": { + "type": "array", + "description": "Optional list of age buckets to target. Supported age buckets are: ['18-24', '25-34', '35-44', '45-54', '55-64', '65+']", + "items": { + "type": "string" + } + }, + "country": { + "type": "string", + "description": "Required country code that surveys should be targeted to. Accepts standard ISO 3166-1 2 character language codes. For instance, 'US' for the United States, and 'GB' for the United Kingdom.", + "annotations": { + "required": [ + "surveys.surveys.insert" + ] + } + }, + "countrySubdivision": { + "type": "string", + "description": "Country subdivision (states/provinces/etc) that surveys should be targeted to. For all countries except GB, ISO-3166-2 subdivision code is required (eg. 'US-OH' for Ohio, United States). For GB, NUTS 1 statistical region codes for the United Kingdom is required (eg. 'UK-UKC' for North East England)." + }, + "gender": { + "type": "string", + "description": "Optional gender to target." + }, + "languages": { + "type": "array", + "description": "Language code that surveys should be targeted to. For instance, 'en-US'. Surveys may target bilingual users by specifying a list of language codes (for example, 'de' and 'en-US'). In that case, all languages will be used for targeting users but the survey content (which is displayed) must match the first language listed. Accepts standard BCP47 language codes. See specification.", + "items": { + "type": "string" + }, + "annotations": { + "required": [ + "surveys.surveys.insert" + ] + } + }, + "mobileAppPanelId": { + "type": "string", + "description": "Key for predefined panel that causes survey to be sent to a predefined set of Opinion Rewards App users. You must set PopulationSource to ANDROID_APP_PANEL to use this field." + }, + "populationSource": { + "type": "string", + "description": "Online population source where the respondents are sampled from." + } + } + }, + "SurveyCost": { + "id": "SurveyCost", + "type": "object", + "description": "Message defining the cost to run a given survey through API.", + "properties": { + "costPerResponseNanos": { + "type": "string", + "description": "Cost per survey response in nano units of the given currency. To get the total cost for a survey, multiply this value by wanted_response_count.", + "format": "int64" + }, + "currencyCode": { + "type": "string", + "description": "Currency code that the cost is given in." + }, + "maxCostPerResponseNanos": { + "type": "string", + "description": "Threshold to start a survey automatically if the quoted price is at most this value. When a survey has a Screener (threshold) question, it must go through an incidence pricing test to determine the final cost per response. Typically you will have to make a followup call to start the survey giving the final computed cost per response. If the survey has no threshold_answers, setting this property will return an error. By specifying this property, you indicate the max price per response you are willing to pay in advance of the incidence test. If the price turns out to be lower than the specified value, the survey will begin immediately and you will be charged at the rate determined by the incidence pricing test. If the price turns out to be greater than the specified value the survey will not be started and you will instead be notified what price was determined by the incidence test. At that point, you must raise the value of this property to be greater than or equal to that cost before attempting to start the survey again. This will immediately start the survey as long the incidence test was run within the last 21 days.", + "format": "int64" + }, + "nanos": { + "type": "string", + "description": "Cost of survey in nano units of the given currency. DEPRECATED in favor of cost_per_response_nanos", + "format": "int64" + } + } + }, + "SurveyQuestion": { + "id": "SurveyQuestion", + "type": "object", + "description": "Message defining the question specifications.", + "properties": { + "answerOrder": { + "type": "string", + "description": "The randomization option for multiple choice and multi-select questions. If not specified, this option defaults to randomize." + }, + "answers": { + "type": "array", + "description": "Required list of answer options for a question.", + "items": { + "type": "string" + } + }, + "hasOther": { + "type": "boolean", + "description": "Option to allow open-ended text box for Single Answer and Multiple Answer question types. This can be used with SINGLE_ANSWER, SINGLE_ANSWER_WITH_IMAGE, MULTIPLE_ANSWERS, and MULTIPLE_ANSWERS_WITH_IMAGE question types." + }, + "highValueLabel": { + "type": "string", + "description": "For rating questions, the text for the higher end of the scale, such as 'Best'. For numeric questions, a string representing a floating-point that is the maximum allowed number for a response." + }, + "images": { + "type": "array", + "items": { + "$ref": "SurveyQuestionImage" + } + }, + "lastAnswerPositionPinned": { + "type": "boolean", + "description": "Currently only support pinning an answer option to the last position." + }, + "lowValueLabel": { + "type": "string", + "description": "For rating questions, the text for the lower end of the scale, such as 'Worst'. For numeric questions, a string representing a floating-point that is the minimum allowed number for a response." + }, + "mustPickSuggestion": { + "type": "boolean", + "description": "Option to force the user to pick one of the open text suggestions. This requires that suggestions are provided for this question." + }, + "numStars": { + "type": "string", + "description": "Number of stars to use for ratings questions." + }, + "openTextPlaceholder": { + "type": "string", + "description": "Placeholder text for an open text question." + }, + "openTextSuggestions": { + "type": "array", + "description": "A list of suggested answers for open text question auto-complete. This is only valid if single_line_response is true.", + "items": { + "type": "string" + } + }, + "question": { + "type": "string", + "description": "Required question text shown to the respondent." + }, + "sentimentText": { + "type": "string", + "description": "Used by the Rating Scale with Text question type. This text goes along with the question field that is presented to the respondent, and is the actual text that the respondent is asked to rate." + }, + "singleLineResponse": { + "type": "boolean", + "description": "Option to allow multiple line open text responses instead of a single line response. Note that we don't show auto-complete suggestions with multiple line responses." + }, + "thresholdAnswers": { + "type": "array", + "description": "The threshold/screener answer options, which will screen a user into the rest of the survey. These will be a subset of the answer option strings.", + "items": { + "type": "string" + } + }, + "type": { + "type": "string", + "description": "Required field defining the question type. For details about configuring different type of questions, consult the question configuration guide.", + "annotations": { + "required": [ + "surveys.surveys.insert" + ] + } + }, + "unitOfMeasurementLabel": { + "type": "string", + "description": "Optional unit of measurement for display (for example: hours, people, miles)." + }, + "videoId": { + "type": "string", + "description": "The YouTube video ID to be show in video questions." + } + } + }, + "SurveyQuestionImage": { + "id": "SurveyQuestionImage", + "type": "object", + "description": "Container object for image data and alt_text.", + "properties": { + "altText": { + "type": "string", + "description": "The alt text property used in image tags is required for all images." + }, + "data": { + "type": "string", + "description": "Inline jpeg, gif, tiff, bmp, or png image raw bytes for an image question types.", + "format": "byte" + }, + "url": { + "type": "string", + "description": "The read-only URL for the hosted images." + } + } + }, + "SurveyRejection": { + "id": "SurveyRejection", + "type": "object", + "description": "Message representing why the survey was rejected from review, if it was.", + "properties": { + "explanation": { + "type": "string", + "description": "A human-readable explanation of what was wrong with the survey." + }, + "type": { + "type": "string", + "description": "Which category of rejection this was. See the Google Surveys Help Center for additional details on each category." + } + } + }, + "SurveyResults": { + "id": "SurveyResults", + "type": "object", + "description": "Reference to the current results for a given survey.", + "properties": { + "status": { + "type": "string", + "description": "Human readable string describing the status of the request." + }, + "surveyUrlId": { + "type": "string", + "description": "External survey ID as viewable by survey owners in the editor view." + } + } + }, + "SurveysDeleteResponse": { + "id": "SurveysDeleteResponse", + "type": "object", + "properties": { + "requestId": { + "type": "string", + "description": "Unique request ID used for logging and debugging. Please include in any error reporting or troubleshooting requests." + } + } + }, + "SurveysListResponse": { + "id": "SurveysListResponse", + "type": "object", + "properties": { + "pageInfo": { + "$ref": "PageInfo" + }, + "requestId": { + "type": "string", + "description": "Unique request ID used for logging and debugging. Please include in any error reporting or troubleshooting requests." + }, + "resources": { + "type": "array", + "description": "An individual survey resource.", + "items": { + "$ref": "Survey" + } + }, + "tokenPagination": { + "$ref": "TokenPagination" + } + } + }, + "SurveysStartRequest": { + "id": "SurveysStartRequest", + "type": "object", + "properties": { + "maxCostPerResponseNanos": { + "type": "string", + "description": "Threshold to start a survey automically if the quoted prices is less than or equal to this value. See Survey.Cost for more details.", + "format": "int64" + } + } + }, + "SurveysStartResponse": { + "id": "SurveysStartResponse", + "type": "object", + "properties": { + "requestId": { + "type": "string", + "description": "Unique request ID used for logging and debugging. Please include in any error reporting or troubleshooting requests." + }, + "resource": { + "$ref": "Survey", + "description": "Survey object containing the specification of the started Survey." + } + } + }, + "SurveysStopResponse": { + "id": "SurveysStopResponse", + "type": "object", + "properties": { + "requestId": { + "type": "string", + "description": "Unique request ID used for logging and debugging. Please include in any error reporting or troubleshooting requests." + }, + "resource": { + "$ref": "Survey", + "description": "Survey object containing the specification of the stopped Survey." + } + } + }, + "TokenPagination": { + "id": "TokenPagination", + "type": "object", + "properties": { + "nextPageToken": { + "type": "string" + }, + "previousPageToken": { + "type": "string" + } + } + } + }, + "resources": { + "mobileapppanels": { + "methods": { + "get": { + "id": "surveys.mobileapppanels.get", + "path": "mobileAppPanels/{panelId}", + "httpMethod": "GET", + "description": "Retrieves a MobileAppPanel that is available to the authenticated user.", + "parameters": { + "panelId": { + "type": "string", + "description": "External URL ID for the panel.", + "required": true, + "location": "path" + } + }, + "parameterOrder": [ + "panelId" + ], + "response": { + "$ref": "MobileAppPanel" + }, + "scopes": [ + "https://www.googleapis.com/auth/surveys", + "https://www.googleapis.com/auth/surveys.readonly", + "https://www.googleapis.com/auth/userinfo.email" + ] + }, + "list": { + "id": "surveys.mobileapppanels.list", + "path": "mobileAppPanels", + "httpMethod": "GET", + "description": "Lists the MobileAppPanels available to the authenticated user.", + "parameters": { + "maxResults": { + "type": "integer", + "format": "uint32", + "location": "query" + }, + "startIndex": { + "type": "integer", + "format": "uint32", + "location": "query" + }, + "token": { + "type": "string", + "location": "query" + } + }, + "response": { + "$ref": "MobileAppPanelsListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/surveys", + "https://www.googleapis.com/auth/surveys.readonly", + "https://www.googleapis.com/auth/userinfo.email" + ] + }, + "update": { + "id": "surveys.mobileapppanels.update", + "path": "mobileAppPanels/{panelId}", + "httpMethod": "PUT", + "description": "Updates a MobileAppPanel. Currently the only property that can be updated is the owners property.", + "parameters": { + "panelId": { + "type": "string", + "description": "External URL ID for the panel.", + "required": true, + "location": "path" + } + }, + "parameterOrder": [ + "panelId" + ], + "request": { + "$ref": "MobileAppPanel" + }, + "response": { + "$ref": "MobileAppPanel" + }, + "scopes": [ + "https://www.googleapis.com/auth/surveys", + "https://www.googleapis.com/auth/userinfo.email" + ] + } + } + }, + "results": { + "methods": { + "get": { + "id": "surveys.results.get", + "path": "surveys/{surveyUrlId}/results", + "httpMethod": "GET", + "description": "Retrieves any survey results that have been produced so far. Results are formatted as an Excel file. You must add \"?alt=media\" to the URL as an argument to get results.", + "parameters": { + "surveyUrlId": { + "type": "string", + "description": "External URL ID for the survey.", + "required": true, + "location": "path" + } + }, + "parameterOrder": [ + "surveyUrlId" + ], + "request": { + "$ref": "ResultsGetRequest" + }, + "response": { + "$ref": "SurveyResults" + }, + "scopes": [ + "https://www.googleapis.com/auth/surveys", + "https://www.googleapis.com/auth/surveys.readonly", + "https://www.googleapis.com/auth/userinfo.email" + ], + "supportsMediaDownload": true + } + } + }, + "surveys": { + "methods": { + "delete": { + "id": "surveys.surveys.delete", + "path": "surveys/{surveyUrlId}", + "httpMethod": "DELETE", + "description": "Removes a survey from view in all user GET requests.", + "parameters": { + "surveyUrlId": { + "type": "string", + "description": "External URL ID for the survey.", + "required": true, + "location": "path" + } + }, + "parameterOrder": [ + "surveyUrlId" + ], + "response": { + "$ref": "SurveysDeleteResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/surveys", + "https://www.googleapis.com/auth/userinfo.email" + ] + }, + "get": { + "id": "surveys.surveys.get", + "path": "surveys/{surveyUrlId}", + "httpMethod": "GET", + "description": "Retrieves information about the specified survey.", + "parameters": { + "surveyUrlId": { + "type": "string", + "description": "External URL ID for the survey.", + "required": true, + "location": "path" + } + }, + "parameterOrder": [ + "surveyUrlId" + ], + "response": { + "$ref": "Survey" + }, + "scopes": [ + "https://www.googleapis.com/auth/surveys", + "https://www.googleapis.com/auth/surveys.readonly", + "https://www.googleapis.com/auth/userinfo.email" + ] + }, + "insert": { + "id": "surveys.surveys.insert", + "path": "surveys", + "httpMethod": "POST", + "description": "Creates a survey.", + "request": { + "$ref": "Survey" + }, + "response": { + "$ref": "Survey" + }, + "scopes": [ + "https://www.googleapis.com/auth/surveys", + "https://www.googleapis.com/auth/userinfo.email" + ] + }, + "list": { + "id": "surveys.surveys.list", + "path": "surveys", + "httpMethod": "GET", + "description": "Lists the surveys owned by the authenticated user.", + "parameters": { + "maxResults": { + "type": "integer", + "format": "uint32", + "location": "query" + }, + "startIndex": { + "type": "integer", + "format": "uint32", + "location": "query" + }, + "token": { + "type": "string", + "location": "query" + } + }, + "response": { + "$ref": "SurveysListResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/surveys", + "https://www.googleapis.com/auth/surveys.readonly", + "https://www.googleapis.com/auth/userinfo.email" + ] + }, + "start": { + "id": "surveys.surveys.start", + "path": "surveys/{resourceId}/start", + "httpMethod": "POST", + "description": "Begins running a survey.", + "parameters": { + "resourceId": { + "type": "string", + "required": true, + "location": "path" + } + }, + "parameterOrder": [ + "resourceId" + ], + "request": { + "$ref": "SurveysStartRequest" + }, + "response": { + "$ref": "SurveysStartResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/surveys", + "https://www.googleapis.com/auth/userinfo.email" + ] + }, + "stop": { + "id": "surveys.surveys.stop", + "path": "surveys/{resourceId}/stop", + "httpMethod": "POST", + "description": "Stops a running survey.", + "parameters": { + "resourceId": { + "type": "string", + "required": true, + "location": "path" + } + }, + "parameterOrder": [ + "resourceId" + ], + "response": { + "$ref": "SurveysStopResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/surveys", + "https://www.googleapis.com/auth/userinfo.email" + ] + }, + "update": { + "id": "surveys.surveys.update", + "path": "surveys/{surveyUrlId}", + "httpMethod": "PUT", + "description": "Updates a survey. Currently the only property that can be updated is the owners property.", + "parameters": { + "surveyUrlId": { + "type": "string", + "description": "External URL ID for the survey.", + "required": true, + "location": "path" + } + }, + "parameterOrder": [ + "surveyUrlId" + ], + "request": { + "$ref": "Survey" + }, + "response": { + "$ref": "Survey" + }, + "scopes": [ + "https://www.googleapis.com/auth/surveys", + "https://www.googleapis.com/auth/userinfo.email" + ] + } + } + } + } +} diff --git a/etc/api/tagmanager/v1/tagmanager-api.json b/etc/api/tagmanager/v1/tagmanager-api.json index 452c29e093..6833b09c8e 100644 --- a/etc/api/tagmanager/v1/tagmanager-api.json +++ b/etc/api/tagmanager/v1/tagmanager-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/ZLA8VC_y6gockbSXUvDfNtkMoaM\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/rRpL0Yww6KCNEEWca1YtyKw9Y48\"", "discoveryVersion": "v1", "id": "tagmanager:v1", "name": "tagmanager", @@ -12,8 +12,8 @@ "ownerDomain": "google.com", "ownerName": "Google", "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" }, "documentationLink": "https://developers.google.com/tag-manager/api/v1/", "protocol": "rest", @@ -74,22 +74,22 @@ "description": "Delete your Google Tag Manager containers" }, "https://www.googleapis.com/auth/tagmanager.edit.containers": { - "description": "Manage your Google Tag Manager containers" + "description": "Manage your Google Tag Manager container and its subcomponents, excluding versioning and publishing" }, "https://www.googleapis.com/auth/tagmanager.edit.containerversions": { "description": "Manage your Google Tag Manager container versions" }, "https://www.googleapis.com/auth/tagmanager.manage.accounts": { - "description": "Manage your Google Tag Manager accounts" + "description": "View and manage your Google Tag Manager accounts" }, "https://www.googleapis.com/auth/tagmanager.manage.users": { - "description": "Manage user permissions of your Google Tag Manager data" + "description": "Manage user permissions of your Google Tag Manager account and container" }, "https://www.googleapis.com/auth/tagmanager.publish": { - "description": "Publish your Google Tag Manager containers" + "description": "Publish your Google Tag Manager container versions" }, "https://www.googleapis.com/auth/tagmanager.readonly": { - "description": "View your Google Tag Manager containers" + "description": "View your Google Tag Manager container and its subcomponents" } } } diff --git a/etc/api/taskqueue/v1beta1/taskqueue-api.json b/etc/api/taskqueue/v1beta1/taskqueue-api.json index 85f5250b66..a002d81bd0 100644 --- a/etc/api/taskqueue/v1beta1/taskqueue-api.json +++ b/etc/api/taskqueue/v1beta1/taskqueue-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/UNHEtVyVE-POJmRW0SrDcBQE6KY\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/UNHEtVyVE-POJmRW0SrDcBQE6KY\"", "discoveryVersion": "v1", "id": "taskqueue:v1beta1", "name": "taskqueue", diff --git a/etc/api/taskqueue/v1beta2/taskqueue-api.json b/etc/api/taskqueue/v1beta2/taskqueue-api.json index 832b4d7abd..33b33a86f0 100644 --- a/etc/api/taskqueue/v1beta2/taskqueue-api.json +++ b/etc/api/taskqueue/v1beta2/taskqueue-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/rBU1z2tHcOAAx8ktsJNBvusBoYw\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/rBU1z2tHcOAAx8ktsJNBvusBoYw\"", "discoveryVersion": "v1", "id": "taskqueue:v1beta2", "name": "taskqueue", diff --git a/etc/api/tasks/v1/tasks-api.json b/etc/api/tasks/v1/tasks-api.json index f65418d1f1..2aff5c4dab 100644 --- a/etc/api/tasks/v1/tasks-api.json +++ b/etc/api/tasks/v1/tasks-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/NWN6zUXbR398dbL3sE_mMEw339M\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/NWN6zUXbR398dbL3sE_mMEw339M\"", "discoveryVersion": "v1", "id": "tasks:v1", "name": "tasks", diff --git a/etc/api/toolresults/v1beta3/toolresults-api.json b/etc/api/toolresults/v1beta3/toolresults-api.json index 322f889038..366faff012 100644 --- a/etc/api/toolresults/v1beta3/toolresults-api.json +++ b/etc/api/toolresults/v1beta3/toolresults-api.json @@ -1,19 +1,19 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/2hS1oj5mcs8B_DQH58VCjwk6FdI\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/FTHpccTXwX59pwtPpjnvwTyvahc\"", "discoveryVersion": "v1", "id": "toolresults:v1beta3", "name": "toolresults", "canonicalName": "Tool Results", "version": "v1beta3", - "revision": "20160908", + "revision": "20161214", "title": "Cloud Tool Results API", "description": "Reads and publishes results from Cloud Test Lab.", "ownerDomain": "google.com", "ownerName": "Google", "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" }, "documentationLink": "https://developers.google.com/cloud-test-lab/", "protocol": "rest", diff --git a/etc/api/translate/v2/translate-api.json b/etc/api/translate/v2/translate-api.json index d816dfdf54..16318bc290 100644 --- a/etc/api/translate/v2/translate-api.json +++ b/etc/api/translate/v2/translate-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/6s__cFeA5l1i01rONlu3TmUQEHs\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/6s__cFeA5l1i01rONlu3TmUQEHs\"", "discoveryVersion": "v1", "id": "translate:v2", "name": "translate", diff --git a/etc/api/urlshortener/v1/urlshortener-api.json b/etc/api/urlshortener/v1/urlshortener-api.json index 730bd79589..6b718d1c66 100644 --- a/etc/api/urlshortener/v1/urlshortener-api.json +++ b/etc/api/urlshortener/v1/urlshortener-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/1HSXgVbkO3Z5Y9cbiE9dhFdbqxk\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/OETTXb_C37OrYG6Z2ykB_lpjNQE\"", "discoveryVersion": "v1", "id": "urlshortener:v1", "name": "urlshortener", @@ -11,8 +11,8 @@ "ownerDomain": "google.com", "ownerName": "Google", "icons": { - "x16": "http://www.google.com/images/icons/product/search-16.gif", - "x32": "http://www.google.com/images/icons/product/search-32.gif" + "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png", + "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png" }, "documentationLink": "https://developers.google.com/url-shortener/v1/getting_started", "protocol": "rest", diff --git a/etc/api/vision/v1/vision-api.json b/etc/api/vision/v1/vision-api.json index e69de29bb2..7c9c0295bc 100644 --- a/etc/api/vision/v1/vision-api.json +++ b/etc/api/vision/v1/vision-api.json @@ -0,0 +1,958 @@ +{ + "id": "vision:v1", + "auth": { + "oauth2": { + "scopes": { + "https://www.googleapis.com/auth/cloud-platform": { + "description": "View and manage your data across Google Cloud Platform services" + } + } + } + }, + "description": "Integrates Google Vision features, including image labeling, face, logo, and landmark detection, optical character recognition (OCR), and detection of explicit content, into applications.", + "protocol": "rest", + "title": "Google Cloud Vision API", + "resources": { + "images": { + "methods": { + "annotate": { + "id": "vision.images.annotate", + "response": { + "$ref": "BatchAnnotateImagesResponse" + }, + "parameterOrder": [], + "description": "Run image detection and annotation for a batch of images.", + "request": { + "$ref": "BatchAnnotateImagesRequest" + }, + "flatPath": "v1/images:annotate", + "httpMethod": "POST", + "parameters": {}, + "path": "v1/images:annotate", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + } + } + } + }, + "schemas": { + "ImageSource": { + "description": "External image source (Google Cloud Storage image location).", + "type": "object", + "properties": { + "gcsImageUri": { + "description": "Google Cloud Storage image URI, which must be in the following form:\n`gs://bucket_name/object_name` (for details, see\n[Google Cloud Storage Request URIs](https://cloud.google.com/storage/docs/reference-uris)).\nNOTE: Cloud Storage object versioning is not supported.", + "type": "string" + } + }, + "id": "ImageSource" + }, + "AnnotateImageRequest": { + "description": "Request for performing Google Cloud Vision API tasks over a user-provided\nimage, with user-requested features.", + "type": "object", + "properties": { + "image": { + "description": "The image to be processed.", + "$ref": "Image" + }, + "imageContext": { + "description": "Additional context that may accompany the image.", + "$ref": "ImageContext" + }, + "features": { + "description": "Requested features.", + "type": "array", + "items": { + "$ref": "Feature" + } + } + }, + "id": "AnnotateImageRequest" + }, + "AnnotateImageResponse": { + "description": "Response to an image annotation request.", + "type": "object", + "properties": { + "labelAnnotations": { + "description": "If present, label detection has completed successfully.", + "type": "array", + "items": { + "$ref": "EntityAnnotation" + } + }, + "landmarkAnnotations": { + "description": "If present, landmark detection has completed successfully.", + "type": "array", + "items": { + "$ref": "EntityAnnotation" + } + }, + "safeSearchAnnotation": { + "description": "If present, safe-search annotation has completed successfully.", + "$ref": "SafeSearchAnnotation" + }, + "imagePropertiesAnnotation": { + "description": "If present, image properties were extracted successfully.", + "$ref": "ImageProperties" + }, + "textAnnotations": { + "description": "If present, text (OCR) detection has completed successfully.", + "type": "array", + "items": { + "$ref": "EntityAnnotation" + } + }, + "logoAnnotations": { + "description": "If present, logo detection has completed successfully.", + "type": "array", + "items": { + "$ref": "EntityAnnotation" + } + }, + "faceAnnotations": { + "description": "If present, face detection has completed successfully.", + "type": "array", + "items": { + "$ref": "FaceAnnotation" + } + }, + "error": { + "description": "If set, represents the error message for the operation.\nNote that filled-in image annotations are guaranteed to be\ncorrect, even when `error` is set.", + "$ref": "Status" + } + }, + "id": "AnnotateImageResponse" + }, + "LatLongRect": { + "description": "Rectangle determined by min and max `LatLng` pairs.", + "type": "object", + "properties": { + "maxLatLng": { + "description": "Max lat/long pair.", + "$ref": "LatLng" + }, + "minLatLng": { + "description": "Min lat/long pair.", + "$ref": "LatLng" + } + }, + "id": "LatLongRect" + }, + "Status": { + "description": "The `Status` type defines a logical error model that is suitable for different\nprogramming environments, including REST APIs and RPC APIs. It is used by\n[gRPC](https://github.com/grpc). The error model is designed to be:\n\n- Simple to use and understand for most users\n- Flexible enough to meet unexpected needs\n\n# Overview\n\nThe `Status` message contains three pieces of data: error code, error message,\nand error details. The error code should be an enum value of\ngoogle.rpc.Code, but it may accept additional error codes if needed. The\nerror message should be a developer-facing English message that helps\ndevelopers *understand* and *resolve* the error. If a localized user-facing\nerror message is needed, put the localized message in the error details or\nlocalize it in the client. The optional error details may contain arbitrary\ninformation about the error. There is a predefined set of error detail types\nin the package `google.rpc` which can be used for common error conditions.\n\n# Language mapping\n\nThe `Status` message is the logical representation of the error model, but it\nis not necessarily the actual wire format. When the `Status` message is\nexposed in different client libraries and different wire protocols, it can be\nmapped differently. For example, it will likely be mapped to some exceptions\nin Java, but more likely mapped to some error codes in C.\n\n# Other uses\n\nThe error model and the `Status` message can be used in a variety of\nenvironments, either with or without APIs, to provide a\nconsistent developer experience across different environments.\n\nExample uses of this error model include:\n\n- Partial errors. If a service needs to return partial errors to the client,\n it may embed the `Status` in the normal response to indicate the partial\n errors.\n\n- Workflow errors. A typical workflow has multiple steps. Each step may\n have a `Status` message for error reporting purpose.\n\n- Batch operations. If a client uses batch request and batch response, the\n `Status` message should be used directly inside batch response, one for\n each error sub-response.\n\n- Asynchronous operations. If an API call embeds asynchronous operation\n results in its response, the status of those operations should be\n represented directly using the `Status` message.\n\n- Logging. If some API errors are stored in logs, the message `Status` could\n be used directly after any stripping needed for security/privacy reasons.", + "type": "object", + "properties": { + "code": { + "description": "The status code, which should be an enum value of google.rpc.Code.", + "type": "integer", + "format": "int32" + }, + "details": { + "description": "A list of messages that carry the error details. There will be a\ncommon set of message types for APIs to use.", + "type": "array", + "items": { + "additionalProperties": { + "description": "Properties of the object. Contains field @type with type URL.", + "type": "any" + }, + "type": "object" + } + }, + "message": { + "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\ngoogle.rpc.Status.details field, or localized by the client.", + "type": "string" + } + }, + "id": "Status" + }, + "FaceAnnotation": { + "description": "A face annotation object contains the results of face detection.", + "type": "object", + "properties": { + "tiltAngle": { + "description": "Pitch angle, which indicates the upwards/downwards angle that the face is\npointing relative to the image's horizontal plane. Range [-180,180].", + "type": "number", + "format": "float" + }, + "underExposedLikelihood": { + "description": "Under-exposed likelihood.", + "enum": [ + "UNKNOWN", + "VERY_UNLIKELY", + "UNLIKELY", + "POSSIBLE", + "LIKELY", + "VERY_LIKELY" + ], + "enumDescriptions": [ + "Unknown likelihood.", + "It is very unlikely that the image belongs to the specified vertical.", + "It is unlikely that the image belongs to the specified vertical.", + "It is possible that the image belongs to the specified vertical.", + "It is likely that the image belongs to the specified vertical.", + "It is very likely that the image belongs to the specified vertical." + ], + "type": "string" + }, + "fdBoundingPoly": { + "description": "The `fd_bounding_poly` bounding polygon is tighter than the\n`boundingPoly`, and encloses only the skin part of the face. Typically, it\nis used to eliminate the face from any image analysis that detects the\n\"amount of skin\" visible in an image. It is not based on the\nlandmarker results, only on the initial face detection, hence\nthe \u003ccode\u003efd\u003c/code\u003e (face detection) prefix.", + "$ref": "BoundingPoly" + }, + "landmarkingConfidence": { + "description": "Face landmarking confidence. Range [0, 1].", + "type": "number", + "format": "float" + }, + "joyLikelihood": { + "description": "Joy likelihood.", + "enum": [ + "UNKNOWN", + "VERY_UNLIKELY", + "UNLIKELY", + "POSSIBLE", + "LIKELY", + "VERY_LIKELY" + ], + "enumDescriptions": [ + "Unknown likelihood.", + "It is very unlikely that the image belongs to the specified vertical.", + "It is unlikely that the image belongs to the specified vertical.", + "It is possible that the image belongs to the specified vertical.", + "It is likely that the image belongs to the specified vertical.", + "It is very likely that the image belongs to the specified vertical." + ], + "type": "string" + }, + "detectionConfidence": { + "description": "Detection confidence. Range [0, 1].", + "type": "number", + "format": "float" + }, + "surpriseLikelihood": { + "description": "Surprise likelihood.", + "enum": [ + "UNKNOWN", + "VERY_UNLIKELY", + "UNLIKELY", + "POSSIBLE", + "LIKELY", + "VERY_LIKELY" + ], + "enumDescriptions": [ + "Unknown likelihood.", + "It is very unlikely that the image belongs to the specified vertical.", + "It is unlikely that the image belongs to the specified vertical.", + "It is possible that the image belongs to the specified vertical.", + "It is likely that the image belongs to the specified vertical.", + "It is very likely that the image belongs to the specified vertical." + ], + "type": "string" + }, + "angerLikelihood": { + "description": "Anger likelihood.", + "enum": [ + "UNKNOWN", + "VERY_UNLIKELY", + "UNLIKELY", + "POSSIBLE", + "LIKELY", + "VERY_LIKELY" + ], + "enumDescriptions": [ + "Unknown likelihood.", + "It is very unlikely that the image belongs to the specified vertical.", + "It is unlikely that the image belongs to the specified vertical.", + "It is possible that the image belongs to the specified vertical.", + "It is likely that the image belongs to the specified vertical.", + "It is very likely that the image belongs to the specified vertical." + ], + "type": "string" + }, + "headwearLikelihood": { + "description": "Headwear likelihood.", + "enum": [ + "UNKNOWN", + "VERY_UNLIKELY", + "UNLIKELY", + "POSSIBLE", + "LIKELY", + "VERY_LIKELY" + ], + "enumDescriptions": [ + "Unknown likelihood.", + "It is very unlikely that the image belongs to the specified vertical.", + "It is unlikely that the image belongs to the specified vertical.", + "It is possible that the image belongs to the specified vertical.", + "It is likely that the image belongs to the specified vertical.", + "It is very likely that the image belongs to the specified vertical." + ], + "type": "string" + }, + "panAngle": { + "description": "Yaw angle, which indicates the leftward/rightward angle that the face is\npointing relative to the vertical plane perpendicular to the image. Range\n[-180,180].", + "type": "number", + "format": "float" + }, + "boundingPoly": { + "description": "The bounding polygon around the face. The coordinates of the bounding box\nare in the original image's scale, as returned in `ImageParams`.\nThe bounding box is computed to \"frame\" the face in accordance with human\nexpectations. It is based on the landmarker results.\nNote that one or more x and/or y coordinates may not be generated in the\n`BoundingPoly` (the polygon will be unbounded) if only a partial face\nappears in the image to be annotated.", + "$ref": "BoundingPoly" + }, + "landmarks": { + "description": "Detected face landmarks.", + "type": "array", + "items": { + "$ref": "Landmark" + } + }, + "blurredLikelihood": { + "description": "Blurred likelihood.", + "enum": [ + "UNKNOWN", + "VERY_UNLIKELY", + "UNLIKELY", + "POSSIBLE", + "LIKELY", + "VERY_LIKELY" + ], + "enumDescriptions": [ + "Unknown likelihood.", + "It is very unlikely that the image belongs to the specified vertical.", + "It is unlikely that the image belongs to the specified vertical.", + "It is possible that the image belongs to the specified vertical.", + "It is likely that the image belongs to the specified vertical.", + "It is very likely that the image belongs to the specified vertical." + ], + "type": "string" + }, + "rollAngle": { + "description": "Roll angle, which indicates the amount of clockwise/anti-clockwise rotation\nof the face relative to the image vertical about the axis perpendicular to\nthe face. Range [-180,180].", + "type": "number", + "format": "float" + }, + "sorrowLikelihood": { + "description": "Sorrow likelihood.", + "enum": [ + "UNKNOWN", + "VERY_UNLIKELY", + "UNLIKELY", + "POSSIBLE", + "LIKELY", + "VERY_LIKELY" + ], + "enumDescriptions": [ + "Unknown likelihood.", + "It is very unlikely that the image belongs to the specified vertical.", + "It is unlikely that the image belongs to the specified vertical.", + "It is possible that the image belongs to the specified vertical.", + "It is likely that the image belongs to the specified vertical.", + "It is very likely that the image belongs to the specified vertical." + ], + "type": "string" + } + }, + "id": "FaceAnnotation" + }, + "Vertex": { + "description": "A vertex represents a 2D point in the image.\nNOTE: the vertex coordinates are in the same scale as the original image.", + "type": "object", + "properties": { + "y": { + "description": "Y coordinate.", + "type": "integer", + "format": "int32" + }, + "x": { + "description": "X coordinate.", + "type": "integer", + "format": "int32" + } + }, + "id": "Vertex" + }, + "ColorInfo": { + "description": "Color information consists of RGB channels, score, and the fraction of\nthe image that the color occupies in the image.", + "type": "object", + "properties": { + "pixelFraction": { + "description": "The fraction of pixels the color occupies in the image.\nValue in range [0, 1].", + "type": "number", + "format": "float" + }, + "color": { + "description": "RGB components of the color.", + "$ref": "Color" + }, + "score": { + "description": "Image-specific score for this color. Value in range [0, 1].", + "type": "number", + "format": "float" + } + }, + "id": "ColorInfo" + }, + "BoundingPoly": { + "description": "A bounding polygon for the detected image annotation.", + "type": "object", + "properties": { + "vertices": { + "description": "The bounding polygon vertices.", + "type": "array", + "items": { + "$ref": "Vertex" + } + } + }, + "id": "BoundingPoly" + }, + "Landmark": { + "description": "A face-specific landmark (for example, a face feature).\nLandmark positions may fall outside the bounds of the image\nif the face is near one or more edges of the image.\nTherefore it is NOT guaranteed that `0 \u003c= x \u003c width` or\n`0 \u003c= y \u003c height`.", + "type": "object", + "properties": { + "position": { + "description": "Face landmark position.", + "$ref": "Position" + }, + "type": { + "description": "Face landmark type.", + "enum": [ + "UNKNOWN_LANDMARK", + "LEFT_EYE", + "RIGHT_EYE", + "LEFT_OF_LEFT_EYEBROW", + "RIGHT_OF_LEFT_EYEBROW", + "LEFT_OF_RIGHT_EYEBROW", + "RIGHT_OF_RIGHT_EYEBROW", + "MIDPOINT_BETWEEN_EYES", + "NOSE_TIP", + "UPPER_LIP", + "LOWER_LIP", + "MOUTH_LEFT", + "MOUTH_RIGHT", + "MOUTH_CENTER", + "NOSE_BOTTOM_RIGHT", + "NOSE_BOTTOM_LEFT", + "NOSE_BOTTOM_CENTER", + "LEFT_EYE_TOP_BOUNDARY", + "LEFT_EYE_RIGHT_CORNER", + "LEFT_EYE_BOTTOM_BOUNDARY", + "LEFT_EYE_LEFT_CORNER", + "RIGHT_EYE_TOP_BOUNDARY", + "RIGHT_EYE_RIGHT_CORNER", + "RIGHT_EYE_BOTTOM_BOUNDARY", + "RIGHT_EYE_LEFT_CORNER", + "LEFT_EYEBROW_UPPER_MIDPOINT", + "RIGHT_EYEBROW_UPPER_MIDPOINT", + "LEFT_EAR_TRAGION", + "RIGHT_EAR_TRAGION", + "LEFT_EYE_PUPIL", + "RIGHT_EYE_PUPIL", + "FOREHEAD_GLABELLA", + "CHIN_GNATHION", + "CHIN_LEFT_GONION", + "CHIN_RIGHT_GONION" + ], + "enumDescriptions": [ + "Unknown face landmark detected. Should not be filled.", + "Left eye.", + "Right eye.", + "Left of left eyebrow.", + "Right of left eyebrow.", + "Left of right eyebrow.", + "Right of right eyebrow.", + "Midpoint between eyes.", + "Nose tip.", + "Upper lip.", + "Lower lip.", + "Mouth left.", + "Mouth right.", + "Mouth center.", + "Nose, bottom right.", + "Nose, bottom left.", + "Nose, bottom center.", + "Left eye, top boundary.", + "Left eye, right corner.", + "Left eye, bottom boundary.", + "Left eye, left corner.", + "Right eye, top boundary.", + "Right eye, right corner.", + "Right eye, bottom boundary.", + "Right eye, left corner.", + "Left eyebrow, upper midpoint.", + "Right eyebrow, upper midpoint.", + "Left ear tragion.", + "Right ear tragion.", + "Left eye pupil.", + "Right eye pupil.", + "Forehead glabella.", + "Chin gnathion.", + "Chin left gonion.", + "Chin right gonion." + ], + "type": "string" + } + }, + "id": "Landmark" + }, + "ImageContext": { + "description": "Image context and/or feature-specific parameters.", + "type": "object", + "properties": { + "latLongRect": { + "description": "lat/long rectangle that specifies the location of the image.", + "$ref": "LatLongRect" + }, + "languageHints": { + "description": "List of languages to use for TEXT_DETECTION. In most cases, an empty value\nyields the best results since it enables automatic language detection. For\nlanguages based on the Latin alphabet, setting `language_hints` is not\nneeded. In rare cases, when the language of the text in the image is known,\nsetting a hint will help get better results (although it will be a\nsignificant hindrance if the hint is wrong). Text detection returns an\nerror if one or more of the specified languages is not one of the\n[supported languages](/vision/docs/languages).", + "type": "array", + "items": { + "type": "string" + } + } + }, + "id": "ImageContext" + }, + "BatchAnnotateImagesRequest": { + "description": "Multiple image annotation requests are batched into a single service call.", + "type": "object", + "properties": { + "requests": { + "description": "Individual image annotation requests for this batch.", + "type": "array", + "items": { + "$ref": "AnnotateImageRequest" + } + } + }, + "id": "BatchAnnotateImagesRequest" + }, + "EntityAnnotation": { + "description": "Set of detected entity features.", + "type": "object", + "properties": { + "mid": { + "description": "Opaque entity ID. Some IDs may be available in\n[Google Knowledge Graph Search API](https://developers.google.com/knowledge-graph/).", + "type": "string" + }, + "description": { + "description": "Entity textual description, expressed in its `locale` language.", + "type": "string" + }, + "topicality": { + "description": "The relevancy of the ICA (Image Content Annotation) label to the\nimage. For example, the relevancy of \"tower\" is likely higher to an image\ncontaining the detected \"Eiffel Tower\" than to an image containing a\ndetected distant towering building, even though the confidence that\nthere is a tower in each image may be the same. Range [0, 1].", + "type": "number", + "format": "float" + }, + "locale": { + "description": "The language code for the locale in which the entity textual\n`description` is expressed.", + "type": "string" + }, + "properties": { + "description": "Some entities may have optional user-supplied `Property` (name/value)\nfields, such a score or string that qualifies the entity.", + "type": "array", + "items": { + "$ref": "Property" + } + }, + "score": { + "description": "Overall score of the result. Range [0, 1].", + "type": "number", + "format": "float" + }, + "boundingPoly": { + "description": "Image region to which this entity belongs. Currently not produced\nfor `LABEL_DETECTION` features. For `TEXT_DETECTION` (OCR), `boundingPoly`s\nare produced for the entire text detected in an image region, followed by\n`boundingPoly`s for each word within the detected text.", + "$ref": "BoundingPoly" + }, + "locations": { + "description": "The location information for the detected entity. Multiple\n`LocationInfo` elements can be present because one location may\nindicate the location of the scene in the image, and another location\nmay indicate the location of the place where the image was taken.\nLocation information is usually present for landmarks.", + "type": "array", + "items": { + "$ref": "LocationInfo" + } + }, + "confidence": { + "description": "The accuracy of the entity detection in an image.\nFor example, for an image in which the \"Eiffel Tower\" entity is detected,\nthis field represents the confidence that there is a tower in the query\nimage. Range [0, 1].", + "type": "number", + "format": "float" + } + }, + "id": "EntityAnnotation" + }, + "Property": { + "description": "A `Property` consists of a user-supplied name/value pair.", + "type": "object", + "properties": { + "value": { + "description": "Value of the property.", + "type": "string" + }, + "name": { + "description": "Name of the property.", + "type": "string" + } + }, + "id": "Property" + }, + "Color": { + "description": "Represents a color in the RGBA color space. This representation is designed\nfor simplicity of conversion to/from color representations in various\nlanguages over compactness; for example, the fields of this representation\ncan be trivially provided to the constructor of \"java.awt.Color\" in Java; it\ncan also be trivially provided to UIColor's \"+colorWithRed:green:blue:alpha\"\nmethod in iOS; and, with just a little work, it can be easily formatted into\na CSS \"rgba()\" string in JavaScript, as well. Here are some examples:\n\nExample (Java):\n\n import com.google.type.Color;\n\n // ...\n public static java.awt.Color fromProto(Color protocolor) {\n float alpha = protocolor.hasAlpha()\n ? protocolor.getAlpha().getValue()\n : 1.0;\n\n return new java.awt.Color(\n protocolor.getRed(),\n protocolor.getGreen(),\n protocolor.getBlue(),\n alpha);\n }\n\n public static Color toProto(java.awt.Color color) {\n float red = (float) color.getRed();\n float green = (float) color.getGreen();\n float blue = (float) color.getBlue();\n float denominator = 255.0;\n Color.Builder resultBuilder =\n Color\n .newBuilder()\n .setRed(red / denominator)\n .setGreen(green / denominator)\n .setBlue(blue / denominator);\n int alpha = color.getAlpha();\n if (alpha != 255) {\n result.setAlpha(\n FloatValue\n .newBuilder()\n .setValue(((float) alpha) / denominator)\n .build());\n }\n return resultBuilder.build();\n }\n // ...\n\nExample (iOS / Obj-C):\n\n // ...\n static UIColor* fromProto(Color* protocolor) {\n float red = [protocolor red];\n float green = [protocolor green];\n float blue = [protocolor blue];\n FloatValue* alpha_wrapper = [protocolor alpha];\n float alpha = 1.0;\n if (alpha_wrapper != nil) {\n alpha = [alpha_wrapper value];\n }\n return [UIColor colorWithRed:red green:green blue:blue alpha:alpha];\n }\n\n static Color* toProto(UIColor* color) {\n CGFloat red, green, blue, alpha;\n if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) {\n return nil;\n }\n Color* result = [Color alloc] init];\n [result setRed:red];\n [result setGreen:green];\n [result setBlue:blue];\n if (alpha \u003c= 0.9999) {\n [result setAlpha:floatWrapperWithValue(alpha)];\n }\n [result autorelease];\n return result;\n }\n // ...\n\n Example (JavaScript):\n\n // ...\n\n var protoToCssColor = function(rgb_color) {\n var redFrac = rgb_color.red || 0.0;\n var greenFrac = rgb_color.green || 0.0;\n var blueFrac = rgb_color.blue || 0.0;\n var red = Math.floor(redFrac * 255);\n var green = Math.floor(greenFrac * 255);\n var blue = Math.floor(blueFrac * 255);\n\n if (!('alpha' in rgb_color)) {\n return rgbToCssColor_(red, green, blue);\n }\n\n var alphaFrac = rgb_color.alpha.value || 0.0;\n var rgbParams = [red, green, blue].join(',');\n return ['rgba(', rgbParams, ',', alphaFrac, ')'].join('');\n };\n\n var rgbToCssColor_ = function(red, green, blue) {\n var rgbNumber = new Number((red \u003c\u003c 16) | (green \u003c\u003c 8) | blue);\n var hexString = rgbNumber.toString(16);\n var missingZeros = 6 - hexString.length;\n var resultBuilder = ['#'];\n for (var i = 0; i \u003c missingZeros; i++) {\n resultBuilder.push('0');\n }\n resultBuilder.push(hexString);\n return resultBuilder.join('');\n };\n\n // ...", + "type": "object", + "properties": { + "green": { + "description": "The amount of green in the color as a value in the interval [0, 1].", + "type": "number", + "format": "float" + }, + "blue": { + "description": "The amount of blue in the color as a value in the interval [0, 1].", + "type": "number", + "format": "float" + }, + "red": { + "description": "The amount of red in the color as a value in the interval [0, 1].", + "type": "number", + "format": "float" + }, + "alpha": { + "description": "The fraction of this color that should be applied to the pixel. That is,\nthe final pixel color is defined by the equation:\n\n pixel color = alpha * (this color) + (1.0 - alpha) * (background color)\n\nThis means that a value of 1.0 corresponds to a solid color, whereas\na value of 0.0 corresponds to a completely transparent color. This\nuses a wrapper message rather than a simple float scalar so that it is\npossible to distinguish between a default value and the value being unset.\nIf omitted, this color object is to be rendered as a solid color\n(as if the alpha value had been explicitly given with a value of 1.0).", + "type": "number", + "format": "float" + } + }, + "id": "Color" + }, + "LocationInfo": { + "description": "Detected entity location information.", + "type": "object", + "properties": { + "latLng": { + "description": "lat/long location coordinates.", + "$ref": "LatLng" + } + }, + "id": "LocationInfo" + }, + "SafeSearchAnnotation": { + "type": "object", + "properties": { + "medical": { + "description": "Likelihood that this is a medical image.", + "enum": [ + "UNKNOWN", + "VERY_UNLIKELY", + "UNLIKELY", + "POSSIBLE", + "LIKELY", + "VERY_LIKELY" + ], + "enumDescriptions": [ + "Unknown likelihood.", + "It is very unlikely that the image belongs to the specified vertical.", + "It is unlikely that the image belongs to the specified vertical.", + "It is possible that the image belongs to the specified vertical.", + "It is likely that the image belongs to the specified vertical.", + "It is very likely that the image belongs to the specified vertical." + ], + "type": "string" + }, + "spoof": { + "description": "Spoof likelihood. The likelihood that an modification\nwas made to the image's canonical version to make it appear\nfunny or offensive.", + "enum": [ + "UNKNOWN", + "VERY_UNLIKELY", + "UNLIKELY", + "POSSIBLE", + "LIKELY", + "VERY_LIKELY" + ], + "enumDescriptions": [ + "Unknown likelihood.", + "It is very unlikely that the image belongs to the specified vertical.", + "It is unlikely that the image belongs to the specified vertical.", + "It is possible that the image belongs to the specified vertical.", + "It is likely that the image belongs to the specified vertical.", + "It is very likely that the image belongs to the specified vertical." + ], + "type": "string" + }, + "violence": { + "description": "Violence likelihood.", + "enum": [ + "UNKNOWN", + "VERY_UNLIKELY", + "UNLIKELY", + "POSSIBLE", + "LIKELY", + "VERY_LIKELY" + ], + "enumDescriptions": [ + "Unknown likelihood.", + "It is very unlikely that the image belongs to the specified vertical.", + "It is unlikely that the image belongs to the specified vertical.", + "It is possible that the image belongs to the specified vertical.", + "It is likely that the image belongs to the specified vertical.", + "It is very likely that the image belongs to the specified vertical." + ], + "type": "string" + }, + "adult": { + "description": "Represents the adult content likelihood for the image.", + "enum": [ + "UNKNOWN", + "VERY_UNLIKELY", + "UNLIKELY", + "POSSIBLE", + "LIKELY", + "VERY_LIKELY" + ], + "enumDescriptions": [ + "Unknown likelihood.", + "It is very unlikely that the image belongs to the specified vertical.", + "It is unlikely that the image belongs to the specified vertical.", + "It is possible that the image belongs to the specified vertical.", + "It is likely that the image belongs to the specified vertical.", + "It is very likely that the image belongs to the specified vertical." + ], + "type": "string" + } + }, + "id": "SafeSearchAnnotation" + }, + "Image": { + "description": "Client image to perform Google Cloud Vision API tasks over.", + "type": "object", + "properties": { + "source": { + "description": "Google Cloud Storage image location. If both `content` and `source`\nare provided for an image, `content` takes precedence and is\nused to perform the image annotation request.", + "$ref": "ImageSource" + }, + "content": { + "description": "Image content, represented as a stream of bytes.\nNote: as with all `bytes` fields, protobuffers use a pure binary\nrepresentation, whereas JSON representations use base64.", + "type": "string", + "format": "byte" + } + }, + "id": "Image" + }, + "DominantColorsAnnotation": { + "description": "Set of dominant colors and their corresponding scores.", + "type": "object", + "properties": { + "colors": { + "description": "RGB color values with their score and pixel fraction.", + "type": "array", + "items": { + "$ref": "ColorInfo" + } + } + }, + "id": "DominantColorsAnnotation" + }, + "Feature": { + "description": "Users describe the type of Google Cloud Vision API tasks to perform over\nimages by using *Feature*s. Each Feature indicates a type of image\ndetection task to perform. Features encode the Cloud Vision API\nvertical to operate on and the number of top-scoring results to return.", + "type": "object", + "properties": { + "type": { + "description": "The feature type.", + "enum": [ + "TYPE_UNSPECIFIED", + "FACE_DETECTION", + "LANDMARK_DETECTION", + "LOGO_DETECTION", + "LABEL_DETECTION", + "TEXT_DETECTION", + "SAFE_SEARCH_DETECTION", + "IMAGE_PROPERTIES" + ], + "enumDescriptions": [ + "Unspecified feature type.", + "Run face detection.", + "Run landmark detection.", + "Run logo detection.", + "Run label detection.", + "Run OCR.", + "Run computer vision models to compute image safe-search properties.", + "Compute a set of image properties, such as the image's dominant colors." + ], + "type": "string" + }, + "maxResults": { + "description": "Maximum number of results of this type.", + "type": "integer", + "format": "int32" + } + }, + "id": "Feature" + }, + "BatchAnnotateImagesResponse": { + "description": "Response to a batch image annotation request.", + "type": "object", + "properties": { + "responses": { + "description": "Individual responses to image annotation requests within the batch.", + "type": "array", + "items": { + "$ref": "AnnotateImageResponse" + } + } + }, + "id": "BatchAnnotateImagesResponse" + }, + "ImageProperties": { + "description": "Stores image properties, such as dominant colors.", + "type": "object", + "properties": { + "dominantColors": { + "description": "If present, dominant colors completed successfully.", + "$ref": "DominantColorsAnnotation" + } + }, + "id": "ImageProperties" + }, + "LatLng": { + "description": "An object representing a latitude/longitude pair. This is expressed as a pair\nof doubles representing degrees latitude and degrees longitude. Unless\nspecified otherwise, this must conform to the\n\u003ca href=\"http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf\"\u003eWGS84\nstandard\u003c/a\u003e. Values must be within normalized ranges.\n\nExample of normalization code in Python:\n\n def NormalizeLongitude(longitude):\n \"\"\"Wraps decimal degrees longitude to [-180.0, 180.0].\"\"\"\n q, r = divmod(longitude, 360.0)\n if r \u003e 180.0 or (r == 180.0 and q \u003c= -1.0):\n return r - 360.0\n return r\n\n def NormalizeLatLng(latitude, longitude):\n \"\"\"Wraps decimal degrees latitude and longitude to\n [-90.0, 90.0] and [-180.0, 180.0], respectively.\"\"\"\n r = latitude % 360.0\n if r \u003c= 90.0:\n return r, NormalizeLongitude(longitude)\n elif r \u003e= 270.0:\n return r - 360, NormalizeLongitude(longitude)\n else:\n return 180 - r, NormalizeLongitude(longitude + 180.0)\n\n assert 180.0 == NormalizeLongitude(180.0)\n assert -180.0 == NormalizeLongitude(-180.0)\n assert -179.0 == NormalizeLongitude(181.0)\n assert (0.0, 0.0) == NormalizeLatLng(360.0, 0.0)\n assert (0.0, 0.0) == NormalizeLatLng(-360.0, 0.0)\n assert (85.0, 180.0) == NormalizeLatLng(95.0, 0.0)\n assert (-85.0, -170.0) == NormalizeLatLng(-95.0, 10.0)\n assert (90.0, 10.0) == NormalizeLatLng(90.0, 10.0)\n assert (-90.0, -10.0) == NormalizeLatLng(-90.0, -10.0)\n assert (0.0, -170.0) == NormalizeLatLng(-180.0, 10.0)\n assert (0.0, -170.0) == NormalizeLatLng(180.0, 10.0)\n assert (-90.0, 10.0) == NormalizeLatLng(270.0, 10.0)\n assert (90.0, 10.0) == NormalizeLatLng(-270.0, 10.0)", + "type": "object", + "properties": { + "latitude": { + "description": "The latitude in degrees. It must be in the range [-90.0, +90.0].", + "type": "number", + "format": "double" + }, + "longitude": { + "description": "The longitude in degrees. It must be in the range [-180.0, +180.0].", + "type": "number", + "format": "double" + } + }, + "id": "LatLng" + }, + "Position": { + "description": "A 3D position in the image, used primarily for Face detection landmarks.\nA valid Position must have both x and y coordinates.\nThe position coordinates are in the same scale as the original image.", + "type": "object", + "properties": { + "y": { + "description": "Y coordinate.", + "type": "number", + "format": "float" + }, + "x": { + "description": "X coordinate.", + "type": "number", + "format": "float" + }, + "z": { + "description": "Z coordinate (or depth).", + "type": "number", + "format": "float" + } + }, + "id": "Position" + } + }, + "revision": "20161128", + "basePath": "", + "icons": { + "x32": "http://www.google.com/images/icons/product/search-32.gif", + "x16": "http://www.google.com/images/icons/product/search-16.gif" + }, + "version_module": "True", + "canonicalName": "Vision", + "discoveryVersion": "v1", + "baseUrl": "https://vision.googleapis.com/", + "name": "vision", + "parameters": { + "access_token": { + "description": "OAuth access token.", + "type": "string", + "location": "query" + }, + "prettyPrint": { + "description": "Returns response with indentations and line breaks.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "key": { + "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", + "type": "string", + "location": "query" + }, + "quotaUser": { + "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.", + "type": "string", + "location": "query" + }, + "pp": { + "description": "Pretty-print response.", + "default": "true", + "type": "boolean", + "location": "query" + }, + "fields": { + "description": "Selector specifying which fields to include in a partial response.", + "type": "string", + "location": "query" + }, + "alt": { + "description": "Data format for response.", + "location": "query", + "enum": [ + "json", + "media", + "proto" + ], + "default": "json", + "enumDescriptions": [ + "Responses with Content-Type of application/json", + "Media download with context-dependent Content-Type", + "Responses with Content-Type of application/x-protobuf" + ], + "type": "string" + }, + "$.xgafv": { + "description": "V1 error format.", + "enum": [ + "1", + "2" + ], + "enumDescriptions": [ + "v1 error format", + "v2 error format" + ], + "type": "string", + "location": "query" + }, + "callback": { + "description": "JSONP", + "type": "string", + "location": "query" + }, + "oauth_token": { + "description": "OAuth 2.0 token for the current user.", + "type": "string", + "location": "query" + }, + "uploadType": { + "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").", + "type": "string", + "location": "query" + }, + "bearer_token": { + "description": "OAuth bearer token.", + "type": "string", + "location": "query" + }, + "upload_protocol": { + "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").", + "type": "string", + "location": "query" + } + }, + "documentationLink": "https://cloud.google.com/vision/", + "ownerDomain": "google.com", + "batchPath": "batch", + "servicePath": "", + "ownerName": "Google", + "version": "v1", + "rootUrl": "https://vision.googleapis.com/", + "kind": "discovery#restDescription" +} diff --git a/etc/api/webfonts/v1/webfonts-api.json b/etc/api/webfonts/v1/webfonts-api.json index 9931202ae2..75c5f6eadc 100644 --- a/etc/api/webfonts/v1/webfonts-api.json +++ b/etc/api/webfonts/v1/webfonts-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/Knx7w96lfDrwO6_VUi53vC5n2dE\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/Knx7w96lfDrwO6_VUi53vC5n2dE\"", "discoveryVersion": "v1", "id": "webfonts:v1", "name": "webfonts", diff --git a/etc/api/webmasters/v3/webmasters-api.json b/etc/api/webmasters/v3/webmasters-api.json index 7b4df996ea..fad61b1833 100644 --- a/etc/api/webmasters/v3/webmasters-api.json +++ b/etc/api/webmasters/v3/webmasters-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/P1nSOVfcIgLwg7Nv_EHtJFN7Dbw\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/P1nSOVfcIgLwg7Nv_EHtJFN7Dbw\"", "discoveryVersion": "v1", "id": "webmasters:v3", "name": "webmasters", diff --git a/etc/api/youtube/v3/youtube-api.json b/etc/api/youtube/v3/youtube-api.json index 9b1a2f671e..3f14a1f338 100644 --- a/etc/api/youtube/v3/youtube-api.json +++ b/etc/api/youtube/v3/youtube-api.json @@ -1,12 +1,12 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/pZJ6FrWelp1JEEvc4KJivkB6dHw\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/4auVy5GLotTS3CICB9zLFhVaxUM\"", "discoveryVersion": "v1", "id": "youtube:v3", "name": "youtube", "canonicalName": "YouTube", "version": "v3", - "revision": "20160805", + "revision": "20161202", "title": "YouTube Data API", "description": "Supports core YouTube features, such as uploading videos, creating and managing playlists, searching for content, and much more.", "ownerDomain": "google.com", @@ -762,6 +762,7 @@ "enum": [ "1080p", "1440p", + "2160p", "240p", "360p", "480p", @@ -773,6 +774,7 @@ "", "", "", + "", "" ] } @@ -920,10 +922,6 @@ "type": "object", "description": "Details about the content of a channel.", "properties": { - "googlePlusUserId": { - "type": "string", - "description": "The googlePlusUserId object identifies the Google+ profile ID associated with this channel." - }, "relatedPlaylists": { "type": "object", "properties": { @@ -1572,10 +1570,6 @@ "type": "string", "description": "The name of the user who posted the comment." }, - "authorGoogleplusProfileUrl": { - "type": "string", - "description": "Link to the author's Google+ profile, if any." - }, "authorProfileImageUrl": { "type": "string", "description": "The URL for the avatar of the user who posted the comment." @@ -1770,7 +1764,7 @@ "ContentRating": { "id": "ContentRating", "type": "object", - "description": "Ratings schemes. The country-specific ratings are mostly for movies and shows. NEXT_ID: 68", + "description": "Ratings schemes. The country-specific ratings are mostly for movies and shows. NEXT_ID: 69", "properties": { "acbRating": { "type": "string", @@ -2714,6 +2708,30 @@ "" ] }, + "mcstRating": { + "type": "string", + "description": "The video's rating system for Vietnam - MCST", + "enum": [ + "mcst0", + "mcst16plus", + "mcstC13", + "mcstC16", + "mcstC18", + "mcstGPg", + "mcstP", + "mcstUnrated" + ], + "enumDescriptions": [ + "", + "", + "", + "", + "", + "", + "", + "" + ] + }, "mdaRating": { "type": "string", "description": "The video's rating from Singapore's Media Development Authority (MDA) and, specifically, it's Board of Film Censors (BFC).", @@ -5195,6 +5213,11 @@ "videoId": { "type": "string", "description": "The ID that YouTube uses to uniquely identify a video. To retrieve the video resource, set the id query parameter to this value in your API request." + }, + "videoPublishedAt": { + "type": "string", + "description": "The date and time that the video was published to YouTube. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format.", + "format": "date-time" } } }, @@ -6371,6 +6394,10 @@ "type": "string", "description": "The length of the video. The tag value is an ISO 8601 duration in the format PT#M#S, in which the letters PT indicate that the value specifies a period of time, and the letters M and S refer to length in minutes and seconds, respectively. The # characters preceding the M and S letters are both integers that specify the number of minutes (or seconds) of the video. For example, a value of PT15M51S indicates that the video is 15 minutes and 51 seconds long." }, + "hasCustomThumbnail": { + "type": "boolean", + "description": "Indicates whether the video uploader has provided a custom thumbnail image for the video. This property is only visible to the video uploader." + }, "licensedContent": { "type": "boolean", "description": "The value of is_license_content indicates whether the video is licensed content." @@ -6475,10 +6502,6 @@ "" ] }, - "recordingLocation": { - "$ref": "GeoPoint", - "description": "Geographic coordinates that identify the place where the uploaded video was recorded. Coordinates are defined using WGS 84." - }, "videoStreams": { "type": "array", "description": "A list of video streams contained in the uploaded video file. Each item in the list contains detailed metadata about a video stream.", @@ -6712,9 +6735,18 @@ "type": "object", "description": "Player to be used for a video playback.", "properties": { + "embedHeight": { + "type": "string", + "format": "int64" + }, "embedHtml": { "type": "string", "description": "An \u003ciframe\u003e tag that embeds a player that will play the video." + }, + "embedWidth": { + "type": "string", + "description": "The embed width", + "format": "int64" } } }, @@ -7128,9 +7160,13 @@ "type": "string", "enum": [ "nonStreamableMov", + "procsesingHintSpatialAudio", + "procsesingHintSphericalVideo", "sendBestQualityVideo" ], "enumDescriptions": [ + "", + "", "", "" ] @@ -9242,6 +9278,11 @@ "description": "The id parameter specifies the YouTube playlist item ID for the playlist item that is being deleted. In a playlistItem resource, the id property specifies the playlist item's ID.", "required": true, "location": "query" + }, + "onBehalfOfContentOwner": { + "type": "string", + "description": "Note: This parameter is intended exclusively for YouTube content partners.\n\nThe onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner.", + "location": "query" } }, "parameterOrder": [ @@ -9353,6 +9394,11 @@ "httpMethod": "PUT", "description": "Modifies a playlist item. For example, you could update the item's position in the playlist.", "parameters": { + "onBehalfOfContentOwner": { + "type": "string", + "description": "Note: This parameter is intended exclusively for YouTube content partners.\n\nThe onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner.", + "location": "query" + }, "part": { "type": "string", "description": "The part parameter serves two purposes in this operation. It identifies the properties that the write operation will set as well as the properties that the API response will include.\n\nNote that this method will override the existing values for all of the mutable properties that are contained in any parts that the parameter value specifies. For example, a playlist item can specify a start time and end time, which identify the times portion of the video that should play when users watch the video in the playlist. If your request is updating a playlist item that sets these values, and the request's part parameter value includes the contentDetails part, the playlist item's start and end times will be updated to whatever value the request body specifies. If the request body does not specify values, the existing start and end times will be removed and replaced with the default settings.", @@ -10365,15 +10411,31 @@ "description": "DEPRECATED", "location": "query" }, + "maxHeight": { + "type": "integer", + "description": "The maxHeight parameter specifies a maximum height of the embedded player. If maxWidth is provided, maxHeight may not be reached in order to not violate the width request.", + "format": "uint32", + "minimum": "72", + "maximum": "8192", + "location": "query" + }, "maxResults": { "type": "integer", - "description": "The maxResults parameter specifies the maximum number of items that should be returned in the result set.\n\nNote: This parameter is supported for use in conjunction with the myRating parameter, but it is not supported for use in conjunction with the id parameter.", + "description": "The maxResults parameter specifies the maximum number of items that should be returned in the result set.\n\nNote: This parameter is supported for use in conjunction with the myRating and chart parameters, but it is not supported for use in conjunction with the id parameter.", "default": "5", "format": "uint32", "minimum": "1", "maximum": "50", "location": "query" }, + "maxWidth": { + "type": "integer", + "description": "The maxWidth parameter specifies a maximum width of the embedded player. If maxHeight is provided, maxWidth may not be reached in order to not violate the height request.", + "format": "uint32", + "minimum": "72", + "maximum": "8192", + "location": "query" + }, "myRating": { "type": "string", "description": "Set this parameter's value to like or dislike to instruct the API to only return videos liked or disliked by the authenticated user.", @@ -10394,7 +10456,7 @@ }, "pageToken": { "type": "string", - "description": "The pageToken parameter identifies a specific page in the result set that should be returned. In an API response, the nextPageToken and prevPageToken properties identify other pages that could be retrieved.\n\nNote: This parameter is supported for use in conjunction with the myRating parameter, but it is not supported for use in conjunction with the id parameter.", + "description": "The pageToken parameter identifies a specific page in the result set that should be returned. In an API response, the nextPageToken and prevPageToken properties identify other pages that could be retrieved.\n\nNote: This parameter is supported for use in conjunction with the myRating and chart parameters, but it is not supported for use in conjunction with the id parameter.", "location": "query" }, "part": { diff --git a/etc/api/youtubeanalytics/v1/youtubeanalytics-api.json b/etc/api/youtubeanalytics/v1/youtubeanalytics-api.json index d3f4ffae5e..0c5750b878 100644 --- a/etc/api/youtubeanalytics/v1/youtubeanalytics-api.json +++ b/etc/api/youtubeanalytics/v1/youtubeanalytics-api.json @@ -1,12 +1,12 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/R6NYt8plHWaGxFlvlp5Qu-Bp7c4\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/Kv4k8l-mDK-6OGsxLWV2P7-SUpY\"", "discoveryVersion": "v1", "id": "youtubeAnalytics:v1", "name": "youtubeAnalytics", "canonicalName": "YouTube Analytics", "version": "v1", - "revision": "20160513", + "revision": "20161213", "title": "YouTube Analytics API", "description": "Retrieves your YouTube Analytics data.", "ownerDomain": "google.com", @@ -91,135 +91,6 @@ } }, "schemas": { - "BatchReport": { - "id": "BatchReport", - "type": "object", - "description": "Contains single batchReport resource.", - "properties": { - "id": { - "type": "string", - "description": "The ID that YouTube assigns and uses to uniquely identify the report." - }, - "kind": { - "type": "string", - "description": "This value specifies the type of data of this item. For batch report the kind property value is youtubeAnalytics#batchReport.", - "default": "youtubeAnalytics#batchReport" - }, - "outputs": { - "type": "array", - "description": "Report outputs.", - "items": { - "type": "object", - "properties": { - "downloadUrl": { - "type": "string", - "description": "Cloud storage URL to download this report. This URL is valid for 30 minutes." - }, - "format": { - "type": "string", - "description": "Format of the output." - }, - "type": { - "type": "string", - "description": "Type of the output.", - "default": "cloudStorageOutput" - } - } - } - }, - "reportId": { - "type": "string", - "description": "The ID of the the report definition." - }, - "timeSpan": { - "type": "object", - "description": "Period included in the report. For reports containing all entities endTime is not set. Both startTime and endTime are inclusive.", - "properties": { - "endTime": { - "type": "string", - "description": "End of the period included in the report. Inclusive. For reports containing all entities endTime is not set.", - "format": "date-time" - }, - "startTime": { - "type": "string", - "description": "Start of the period included in the report. Inclusive.", - "format": "date-time" - } - } - }, - "timeUpdated": { - "type": "string", - "description": "The time when the report was updated.", - "format": "date-time" - } - } - }, - "BatchReportDefinition": { - "id": "BatchReportDefinition", - "type": "object", - "description": "Contains single batchReportDefinition resource.", - "properties": { - "id": { - "type": "string", - "description": "The ID that YouTube assigns and uses to uniquely identify the report definition." - }, - "kind": { - "type": "string", - "description": "This value specifies the type of data of this item. For batch report definition the kind property value is youtubeAnalytics#batchReportDefinition.", - "default": "youtubeAnalytics#batchReportDefinition" - }, - "name": { - "type": "string", - "description": "Name of the report definition." - }, - "status": { - "type": "string", - "description": "Status of the report definition." - }, - "type": { - "type": "string", - "description": "Type of the report definition." - } - } - }, - "BatchReportDefinitionList": { - "id": "BatchReportDefinitionList", - "type": "object", - "description": "A paginated list of batchReportDefinition resources returned in response to a youtubeAnalytics.batchReportDefinitions.list request.", - "properties": { - "items": { - "type": "array", - "description": "A list of batchReportDefinition resources that match the request criteria.", - "items": { - "$ref": "BatchReportDefinition" - } - }, - "kind": { - "type": "string", - "description": "This value specifies the type of data included in the API response. For the list method, the kind property value is youtubeAnalytics#batchReportDefinitionList.", - "default": "youtubeAnalytics#batchReportDefinitionList" - } - } - }, - "BatchReportList": { - "id": "BatchReportList", - "type": "object", - "description": "A paginated list of batchReport resources returned in response to a youtubeAnalytics.batchReport.list request.", - "properties": { - "items": { - "type": "array", - "description": "A list of batchReport resources that match the request criteria.", - "items": { - "$ref": "BatchReport" - } - }, - "kind": { - "type": "string", - "description": "This value specifies the type of data included in the API response. For the list method, the kind property value is youtubeAnalytics#batchReportList.", - "default": "youtubeAnalytics#batchReportList" - } - } - }, "Group": { "id": "Group", "type": "object", @@ -378,69 +249,6 @@ } }, "resources": { - "batchReportDefinitions": { - "methods": { - "list": { - "id": "youtubeAnalytics.batchReportDefinitions.list", - "path": "batchReportDefinitions", - "httpMethod": "GET", - "description": "Retrieves a list of available batch report definitions.", - "parameters": { - "onBehalfOfContentOwner": { - "type": "string", - "description": "The onBehalfOfContentOwner parameter identifies the content owner that the user is acting on behalf of.", - "required": true, - "location": "query" - } - }, - "parameterOrder": [ - "onBehalfOfContentOwner" - ], - "response": { - "$ref": "BatchReportDefinitionList" - }, - "scopes": [ - "https://www.googleapis.com/auth/yt-analytics-monetary.readonly", - "https://www.googleapis.com/auth/yt-analytics.readonly" - ] - } - } - }, - "batchReports": { - "methods": { - "list": { - "id": "youtubeAnalytics.batchReports.list", - "path": "batchReports", - "httpMethod": "GET", - "description": "Retrieves a list of processed batch reports.", - "parameters": { - "batchReportDefinitionId": { - "type": "string", - "description": "The batchReportDefinitionId parameter specifies the ID of the batch reportort definition for which you are retrieving reports.", - "required": true, - "location": "query" - }, - "onBehalfOfContentOwner": { - "type": "string", - "description": "The onBehalfOfContentOwner parameter identifies the content owner that the user is acting on behalf of.", - "required": true, - "location": "query" - } - }, - "parameterOrder": [ - "batchReportDefinitionId", - "onBehalfOfContentOwner" - ], - "response": { - "$ref": "BatchReportList" - }, - "scopes": [ - "https://www.googleapis.com/auth/yt-analytics-monetary.readonly", - "https://www.googleapis.com/auth/yt-analytics.readonly" - ] - } - } - }, "groupItems": { "methods": { "delete": { diff --git a/etc/api/youtubeanalytics/v1beta1/youtubeanalytics-api.json b/etc/api/youtubeanalytics/v1beta1/youtubeanalytics-api.json index 1f1afc7481..fdf53d89df 100644 --- a/etc/api/youtubeanalytics/v1beta1/youtubeanalytics-api.json +++ b/etc/api/youtubeanalytics/v1beta1/youtubeanalytics-api.json @@ -1,12 +1,12 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/j6TUaGAA0LPiIem7a4tgr6yOPP8\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/JnpH1YTisCB0AiXUbnKLhAt55UI\"", "discoveryVersion": "v1", "id": "youtubeAnalytics:v1beta1", "name": "youtubeAnalytics", "canonicalName": "YouTube Analytics", "version": "v1beta1", - "revision": "20160513", + "revision": "20161213", "title": "YouTube Analytics API", "description": "Retrieves your YouTube Analytics data.", "ownerDomain": "google.com", @@ -94,135 +94,6 @@ } }, "schemas": { - "BatchReport": { - "id": "BatchReport", - "type": "object", - "description": "Contains single batchReport resource.", - "properties": { - "id": { - "type": "string", - "description": "The ID that YouTube assigns and uses to uniquely identify the report." - }, - "kind": { - "type": "string", - "description": "This value specifies the type of data of this item. For batch report the kind property value is youtubeAnalytics#batchReport.", - "default": "youtubeAnalytics#batchReport" - }, - "outputs": { - "type": "array", - "description": "Report outputs.", - "items": { - "type": "object", - "properties": { - "downloadUrl": { - "type": "string", - "description": "Cloud storage URL to download this report. This URL is valid for 30 minutes." - }, - "format": { - "type": "string", - "description": "Format of the output." - }, - "type": { - "type": "string", - "description": "Type of the output.", - "default": "cloudStorageOutput" - } - } - } - }, - "reportId": { - "type": "string", - "description": "The ID of the the report definition." - }, - "timeSpan": { - "type": "object", - "description": "Period included in the report. For reports containing all entities endTime is not set. Both startTime and endTime are inclusive.", - "properties": { - "endTime": { - "type": "string", - "description": "End of the period included in the report. Inclusive. For reports containing all entities endTime is not set.", - "format": "date-time" - }, - "startTime": { - "type": "string", - "description": "Start of the period included in the report. Inclusive.", - "format": "date-time" - } - } - }, - "timeUpdated": { - "type": "string", - "description": "The time when the report was updated.", - "format": "date-time" - } - } - }, - "BatchReportDefinition": { - "id": "BatchReportDefinition", - "type": "object", - "description": "Contains single batchReportDefinition resource.", - "properties": { - "id": { - "type": "string", - "description": "The ID that YouTube assigns and uses to uniquely identify the report definition." - }, - "kind": { - "type": "string", - "description": "This value specifies the type of data of this item. For batch report definition the kind property value is youtubeAnalytics#batchReportDefinition.", - "default": "youtubeAnalytics#batchReportDefinition" - }, - "name": { - "type": "string", - "description": "Name of the report definition." - }, - "status": { - "type": "string", - "description": "Status of the report definition." - }, - "type": { - "type": "string", - "description": "Type of the report definition." - } - } - }, - "BatchReportDefinitionList": { - "id": "BatchReportDefinitionList", - "type": "object", - "description": "A paginated list of batchReportDefinition resources returned in response to a youtubeAnalytics.batchReportDefinitions.list request.", - "properties": { - "items": { - "type": "array", - "description": "A list of batchReportDefinition resources that match the request criteria.", - "items": { - "$ref": "BatchReportDefinition" - } - }, - "kind": { - "type": "string", - "description": "This value specifies the type of data included in the API response. For the list method, the kind property value is youtubeAnalytics#batchReportDefinitionList.", - "default": "youtubeAnalytics#batchReportDefinitionList" - } - } - }, - "BatchReportList": { - "id": "BatchReportList", - "type": "object", - "description": "A paginated list of batchReport resources returned in response to a youtubeAnalytics.batchReport.list request.", - "properties": { - "items": { - "type": "array", - "description": "A list of batchReport resources that match the request criteria.", - "items": { - "$ref": "BatchReport" - } - }, - "kind": { - "type": "string", - "description": "This value specifies the type of data included in the API response. For the list method, the kind property value is youtubeAnalytics#batchReportList.", - "default": "youtubeAnalytics#batchReportList" - } - } - }, "Group": { "id": "Group", "type": "object", @@ -381,69 +252,6 @@ } }, "resources": { - "batchReportDefinitions": { - "methods": { - "list": { - "id": "youtubeAnalytics.batchReportDefinitions.list", - "path": "batchReportDefinitions", - "httpMethod": "GET", - "description": "Retrieves a list of available batch report definitions.", - "parameters": { - "onBehalfOfContentOwner": { - "type": "string", - "description": "The onBehalfOfContentOwner parameter identifies the content owner that the user is acting on behalf of.", - "required": true, - "location": "query" - } - }, - "parameterOrder": [ - "onBehalfOfContentOwner" - ], - "response": { - "$ref": "BatchReportDefinitionList" - }, - "scopes": [ - "https://www.googleapis.com/auth/yt-analytics-monetary.readonly", - "https://www.googleapis.com/auth/yt-analytics.readonly" - ] - } - } - }, - "batchReports": { - "methods": { - "list": { - "id": "youtubeAnalytics.batchReports.list", - "path": "batchReports", - "httpMethod": "GET", - "description": "Retrieves a list of processed batch reports.", - "parameters": { - "batchReportDefinitionId": { - "type": "string", - "description": "The batchReportDefinitionId parameter specifies the ID of the batch reportort definition for which you are retrieving reports.", - "required": true, - "location": "query" - }, - "onBehalfOfContentOwner": { - "type": "string", - "description": "The onBehalfOfContentOwner parameter identifies the content owner that the user is acting on behalf of.", - "required": true, - "location": "query" - } - }, - "parameterOrder": [ - "batchReportDefinitionId", - "onBehalfOfContentOwner" - ], - "response": { - "$ref": "BatchReportList" - }, - "scopes": [ - "https://www.googleapis.com/auth/yt-analytics-monetary.readonly", - "https://www.googleapis.com/auth/yt-analytics.readonly" - ] - } - } - }, "groupItems": { "methods": { "delete": { diff --git a/etc/api/youtubereporting/v1/youtubereporting-api.json b/etc/api/youtubereporting/v1/youtubereporting-api.json index 7d47b7480f..d6b5ef86cc 100644 --- a/etc/api/youtubereporting/v1/youtubereporting-api.json +++ b/etc/api/youtubereporting/v1/youtubereporting-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/ym0RISeffUziZ77agVd4GWAEUYI\"", + "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/ym0RISeffUziZ77agVd4GWAEUYI\"", "discoveryVersion": "v1", "id": "youtubereporting:v1", "name": "youtubereporting", diff --git a/gen/adexchangebuyer1d3-cli/Cargo.toml b/gen/adexchangebuyer1d3-cli/Cargo.toml index 119cd0479b..472cb101f1 100644 --- a/gen/adexchangebuyer1d3-cli/Cargo.toml +++ b/gen/adexchangebuyer1d3-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-adexchangebuyer1d3-cli" -version = "1.0.0+20160831" +version = "1.0.0+20161020" authors = ["Sebastian Thiel "] description = "A complete library to interact with Ad Exchange Buyer (protocol v1.3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/adexchangebuyer1d3-cli" diff --git a/gen/adexchangebuyer1d3-cli/README.md b/gen/adexchangebuyer1d3-cli/README.md index eb52bc6945..3ee14b5af7 100644 --- a/gen/adexchangebuyer1d3-cli/README.md +++ b/gen/adexchangebuyer1d3-cli/README.md @@ -24,7 +24,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Ad Exchange Buyer* API at revision *20160831*. The CLI is at version *1.0.0*. +This documentation was generated from the *Ad Exchange Buyer* API at revision *20161020*. The CLI is at version *1.0.0*. ```bash adexchangebuyer1d3 [options] diff --git a/gen/adexchangebuyer1d3-cli/mkdocs.yml b/gen/adexchangebuyer1d3-cli/mkdocs.yml index 5e14814e1a..1888ed4fce 100644 --- a/gen/adexchangebuyer1d3-cli/mkdocs.yml +++ b/gen/adexchangebuyer1d3-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Ad Exchange Buyer v1.0.0+20160831 +site_name: Ad Exchange Buyer v1.0.0+20161020 site_url: http://byron.github.io/google-apis-rs/google-adexchangebuyer1d3-cli site_description: Write integrating applications with bcore diff --git a/gen/adexchangebuyer1d3-cli/src/main.rs b/gen/adexchangebuyer1d3-cli/src/main.rs index 2ed3752bb1..5626ea3e73 100644 --- a/gen/adexchangebuyer1d3-cli/src/main.rs +++ b/gen/adexchangebuyer1d3-cli/src/main.rs @@ -2303,7 +2303,7 @@ fn main() { let mut app = App::new("adexchangebuyer1d3") .author("Sebastian Thiel ") - .version("1.0.0+20160831") + .version("1.0.0+20161020") .about("Accesses your bidding-account information, submits creatives for validation, finds available direct deals, and retrieves performance reports.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d3_cli") .arg(Arg::with_name("url") diff --git a/gen/adexchangebuyer1d3/Cargo.toml b/gen/adexchangebuyer1d3/Cargo.toml index 6c0a62c382..8e035963fc 100644 --- a/gen/adexchangebuyer1d3/Cargo.toml +++ b/gen/adexchangebuyer1d3/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-adexchangebuyer1d3" -version = "1.0.0+20160831" +version = "1.0.0+20161020" authors = ["Sebastian Thiel "] description = "A complete library to interact with Ad Exchange Buyer (protocol v1.3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/adexchangebuyer1d3" diff --git a/gen/adexchangebuyer1d3/README.md b/gen/adexchangebuyer1d3/README.md index fcb6d44f9e..c400be413b 100644 --- a/gen/adexchangebuyer1d3/README.md +++ b/gen/adexchangebuyer1d3/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-adexchangebuyer1d3` library allows access to all features of the *Google Ad Exchange Buyer* service. -This documentation was generated from *Ad Exchange Buyer* crate version *1.0.0+20160831*, where *20160831* is the exact revision of the *adexchangebuyer:v1.3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *Ad Exchange Buyer* crate version *1.0.0+20161020*, where *20161020* is the exact revision of the *adexchangebuyer:v1.3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *Ad Exchange Buyer* *v1d3* API can be found at the [official documentation site](https://developers.google.com/ad-exchange/buyer-rest). diff --git a/gen/adexchangebuyer1d3/src/lib.rs b/gen/adexchangebuyer1d3/src/lib.rs index ac9b217c89..36c3096cce 100644 --- a/gen/adexchangebuyer1d3/src/lib.rs +++ b/gen/adexchangebuyer1d3/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Ad Exchange Buyer* crate version *1.0.0+20160831*, where *20160831* is the exact revision of the *adexchangebuyer:v1.3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *Ad Exchange Buyer* crate version *1.0.0+20161020*, where *20161020* is the exact revision of the *adexchangebuyer:v1.3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *Ad Exchange Buyer* *v1d3* API can be found at the //! [official documentation site](https://developers.google.com/ad-exchange/buyer-rest). diff --git a/gen/adexchangebuyer1d3/src/lib.rs.in b/gen/adexchangebuyer1d3/src/lib.rs.in index 20619d05af..bc5152a665 100644 --- a/gen/adexchangebuyer1d3/src/lib.rs.in +++ b/gen/adexchangebuyer1d3/src/lib.rs.in @@ -261,7 +261,7 @@ pub struct Creative { pub advertiser_id: Option>, /// Resource type. pub kind: Option, - /// The url to fetch a video ad. If set, HTMLSnippet should not be set. + /// The URL to fetch a video ad. If set, HTMLSnippet and the nativeAd should not be set. #[serde(rename="videoURL")] pub video_url: Option, /// The set of destination urls for the snippet. diff --git a/gen/adexchangebuyer1d4-cli/Cargo.toml b/gen/adexchangebuyer1d4-cli/Cargo.toml index 75d89837c0..5785de4560 100644 --- a/gen/adexchangebuyer1d4-cli/Cargo.toml +++ b/gen/adexchangebuyer1d4-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-adexchangebuyer1d4-cli" -version = "1.0.0+20160831" +version = "1.0.0+20161020" authors = ["Sebastian Thiel "] description = "A complete library to interact with Ad Exchange Buyer (protocol v1.4)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/adexchangebuyer1d4-cli" diff --git a/gen/adexchangebuyer1d4-cli/README.md b/gen/adexchangebuyer1d4-cli/README.md index 95df4607bf..3c8c2590b6 100644 --- a/gen/adexchangebuyer1d4-cli/README.md +++ b/gen/adexchangebuyer1d4-cli/README.md @@ -24,7 +24,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Ad Exchange Buyer* API at revision *20160831*. The CLI is at version *1.0.0*. +This documentation was generated from the *Ad Exchange Buyer* API at revision *20161020*. The CLI is at version *1.0.0*. ```bash adexchangebuyer1d4 [options] @@ -45,6 +45,7 @@ adexchangebuyer1d4 [options] get [-p ]... [-o ] insert (-r )... [-p ]... [-o ] list [-p ]... [-o ] + list-deals [-p ]... [-o ] remove-deal [-p ]... marketplacedeals delete (-r )... [-p ]... [-o ] diff --git a/gen/adexchangebuyer1d4-cli/mkdocs.yml b/gen/adexchangebuyer1d4-cli/mkdocs.yml index 7359704ad8..27c9d975dd 100644 --- a/gen/adexchangebuyer1d4-cli/mkdocs.yml +++ b/gen/adexchangebuyer1d4-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Ad Exchange Buyer v1.0.0+20160831 +site_name: Ad Exchange Buyer v1.0.0+20161020 site_url: http://byron.github.io/google-apis-rs/google-adexchangebuyer1d4-cli site_description: Write integrating applications with bcore @@ -22,6 +22,7 @@ pages: - ['creatives_get.md', 'Creatives', 'Get'] - ['creatives_insert.md', 'Creatives', 'Insert'] - ['creatives_list.md', 'Creatives', 'List'] +- ['creatives_list-deals.md', 'Creatives', 'List Deals'] - ['creatives_remove-deal.md', 'Creatives', 'Remove Deal'] - ['marketplacedeals_delete.md', 'Marketplacedeals', 'Delete'] - ['marketplacedeals_insert.md', 'Marketplacedeals', 'Insert'] diff --git a/gen/adexchangebuyer1d4-cli/src/main.rs b/gen/adexchangebuyer1d4-cli/src/main.rs index 538a639d40..8a5f597c33 100644 --- a/gen/adexchangebuyer1d4-cli/src/main.rs +++ b/gen/adexchangebuyer1d4-cli/src/main.rs @@ -816,6 +816,7 @@ impl<'n> Engine<'n> { "native-ad.body" => Some(("nativeAd.body", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "native-ad.advertiser" => Some(("nativeAd.advertiser", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "native-ad.store" => Some(("nativeAd.store", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "native-ad.video-url" => Some(("nativeAd.videoURL", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "native-ad.headline" => Some(("nativeAd.headline", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "native-ad.image.url" => Some(("nativeAd.image.url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "native-ad.image.width" => Some(("nativeAd.image.width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -831,6 +832,7 @@ impl<'n> Engine<'n> { "native-ad.impression-tracking-url" => Some(("nativeAd.impressionTrackingUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "native-ad.price" => Some(("nativeAd.price", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "native-ad.click-tracking-url" => Some(("nativeAd.clickTrackingUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "native-ad.click-link-url" => Some(("nativeAd.clickLinkUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "version" => Some(("version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "api-upload-timestamp" => Some(("apiUploadTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "vendor-type" => Some(("vendorType", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), @@ -844,7 +846,7 @@ impl<'n> Engine<'n> { "restricted-categories" => Some(("restrictedCategories", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), "filtering-reasons.date" => Some(("filteringReasons.date", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["html-snippet", "account-id", "ad-choices-destination-url", "advertiser", "advertiser-id", "advertiser-name", "agency-id", "api-upload-timestamp", "app-icon", "attribute", "body", "buyer-creative-id", "call-to-action", "click-through-url", "click-tracking-url", "date", "deals-status", "detected-domains", "filtering-reasons", "headline", "height", "image", "impression-tracking-url", "kind", "languages", "logo", "native-ad", "open-auction-status", "price", "product-categories", "restricted-categories", "sensitive-categories", "star-rating", "store", "url", "vendor-type", "version", "video-url", "width"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["html-snippet", "account-id", "ad-choices-destination-url", "advertiser", "advertiser-id", "advertiser-name", "agency-id", "api-upload-timestamp", "app-icon", "attribute", "body", "buyer-creative-id", "call-to-action", "click-link-url", "click-through-url", "click-tracking-url", "date", "deals-status", "detected-domains", "filtering-reasons", "headline", "height", "image", "impression-tracking-url", "kind", "languages", "logo", "native-ad", "open-auction-status", "price", "product-categories", "restricted-categories", "sensitive-categories", "star-rating", "store", "url", "vendor-type", "version", "video-url", "width"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -975,6 +977,59 @@ impl<'n> Engine<'n> { } } + fn _creatives_list_deals(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let account_id: i32 = arg_from_str(&opt.value_of("account-id").unwrap_or(""), err, "", "integer"); + let mut call = self.hub.creatives().list_deals(account_id, opt.value_of("buyer-creative-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _creatives_remove_deal(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let account_id: i32 = arg_from_str(&opt.value_of("account-id").unwrap_or(""), err, "", "integer"); @@ -1291,12 +1346,13 @@ impl<'n> Engine<'n> { "proposal.is-renegotiating" => Some(("proposal.isRenegotiating", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "proposal.buyer.account-id" => Some(("proposal.buyer.accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "proposal.has-buyer-signed-off" => Some(("proposal.hasBuyerSignedOff", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "proposal.dbm-advertiser-ids" => Some(("proposal.dbmAdvertiserIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "proposal.is-setup-complete" => Some(("proposal.isSetupComplete", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "proposal.revision-number" => Some(("proposal.revisionNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "proposal-revision-number" => Some(("proposalRevisionNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "update-action" => Some(("updateAction", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "billed-buyer", "buyer", "buyer-private-data", "has-buyer-signed-off", "has-seller-signed-off", "inventory-source", "is-renegotiating", "is-setup-complete", "kind", "last-updater-or-commentor-role", "name", "negotiation-id", "originator-role", "private-auction-id", "proposal", "proposal-id", "proposal-revision-number", "proposal-state", "reference-id", "reference-payload", "revision-number", "revision-time-ms", "seller", "sub-account-id", "update-action"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "billed-buyer", "buyer", "buyer-private-data", "dbm-advertiser-ids", "has-buyer-signed-off", "has-seller-signed-off", "inventory-source", "is-renegotiating", "is-setup-complete", "kind", "last-updater-or-commentor-role", "name", "negotiation-id", "originator-role", "private-auction-id", "proposal", "proposal-id", "proposal-revision-number", "proposal-state", "reference-id", "reference-payload", "revision-number", "revision-time-ms", "seller", "sub-account-id", "update-action"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1767,6 +1823,7 @@ impl<'n> Engine<'n> { "config-name" => Some(("configName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "excluded-geo-criteria-ids" => Some(("excludedGeoCriteriaIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "user-lists" => Some(("userLists", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "user-identifier-data-required" => Some(("userIdentifierDataRequired", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "excluded-verticals" => Some(("excludedVerticals", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "vendor-types" => Some(("vendorTypes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "excluded-content-labels" => Some(("excludedContentLabels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -1782,7 +1839,7 @@ impl<'n> Engine<'n> { "is-active" => Some(("isActive", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "supported-creative-attributes" => Some(("supportedCreativeAttributes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["billing-id", "config-id", "config-name", "creative-type", "excluded-content-labels", "excluded-geo-criteria-ids", "excluded-user-lists", "excluded-verticals", "geo-criteria-ids", "is-active", "kind", "languages", "mobile-carriers", "mobile-devices", "mobile-operating-system-versions", "platforms", "supported-creative-attributes", "user-lists", "vendor-types", "verticals"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["billing-id", "config-id", "config-name", "creative-type", "excluded-content-labels", "excluded-geo-criteria-ids", "excluded-user-lists", "excluded-verticals", "geo-criteria-ids", "is-active", "kind", "languages", "mobile-carriers", "mobile-devices", "mobile-operating-system-versions", "platforms", "supported-creative-attributes", "user-identifier-data-required", "user-lists", "vendor-types", "verticals"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1923,6 +1980,7 @@ impl<'n> Engine<'n> { "config-name" => Some(("configName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "excluded-geo-criteria-ids" => Some(("excludedGeoCriteriaIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "user-lists" => Some(("userLists", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "user-identifier-data-required" => Some(("userIdentifierDataRequired", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "excluded-verticals" => Some(("excludedVerticals", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "vendor-types" => Some(("vendorTypes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "excluded-content-labels" => Some(("excludedContentLabels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -1938,7 +1996,7 @@ impl<'n> Engine<'n> { "is-active" => Some(("isActive", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "supported-creative-attributes" => Some(("supportedCreativeAttributes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["billing-id", "config-id", "config-name", "creative-type", "excluded-content-labels", "excluded-geo-criteria-ids", "excluded-user-lists", "excluded-verticals", "geo-criteria-ids", "is-active", "kind", "languages", "mobile-carriers", "mobile-devices", "mobile-operating-system-versions", "platforms", "supported-creative-attributes", "user-lists", "vendor-types", "verticals"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["billing-id", "config-id", "config-name", "creative-type", "excluded-content-labels", "excluded-geo-criteria-ids", "excluded-user-lists", "excluded-verticals", "geo-criteria-ids", "is-active", "kind", "languages", "mobile-carriers", "mobile-devices", "mobile-operating-system-versions", "platforms", "supported-creative-attributes", "user-identifier-data-required", "user-lists", "vendor-types", "verticals"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -2027,6 +2085,7 @@ impl<'n> Engine<'n> { "config-name" => Some(("configName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "excluded-geo-criteria-ids" => Some(("excludedGeoCriteriaIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "user-lists" => Some(("userLists", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "user-identifier-data-required" => Some(("userIdentifierDataRequired", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "excluded-verticals" => Some(("excludedVerticals", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "vendor-types" => Some(("vendorTypes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "excluded-content-labels" => Some(("excludedContentLabels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -2042,7 +2101,7 @@ impl<'n> Engine<'n> { "is-active" => Some(("isActive", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "supported-creative-attributes" => Some(("supportedCreativeAttributes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["billing-id", "config-id", "config-name", "creative-type", "excluded-content-labels", "excluded-geo-criteria-ids", "excluded-user-lists", "excluded-verticals", "geo-criteria-ids", "is-active", "kind", "languages", "mobile-carriers", "mobile-devices", "mobile-operating-system-versions", "platforms", "supported-creative-attributes", "user-lists", "vendor-types", "verticals"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["billing-id", "config-id", "config-name", "creative-type", "excluded-content-labels", "excluded-geo-criteria-ids", "excluded-user-lists", "excluded-verticals", "geo-criteria-ids", "is-active", "kind", "languages", "mobile-carriers", "mobile-devices", "mobile-operating-system-versions", "platforms", "supported-creative-attributes", "user-identifier-data-required", "user-lists", "vendor-types", "verticals"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -2389,10 +2448,11 @@ impl<'n> Engine<'n> { "is-renegotiating" => Some(("isRenegotiating", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "buyer.account-id" => Some(("buyer.accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "has-buyer-signed-off" => Some(("hasBuyerSignedOff", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "dbm-advertiser-ids" => Some(("dbmAdvertiserIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "is-setup-complete" => Some(("isSetupComplete", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "revision-number" => Some(("revisionNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "billed-buyer", "buyer", "buyer-private-data", "has-buyer-signed-off", "has-seller-signed-off", "inventory-source", "is-renegotiating", "is-setup-complete", "kind", "last-updater-or-commentor-role", "name", "negotiation-id", "originator-role", "private-auction-id", "proposal-id", "proposal-state", "reference-id", "reference-payload", "revision-number", "revision-time-ms", "seller", "sub-account-id"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "billed-buyer", "buyer", "buyer-private-data", "dbm-advertiser-ids", "has-buyer-signed-off", "has-seller-signed-off", "inventory-source", "is-renegotiating", "is-setup-complete", "kind", "last-updater-or-commentor-role", "name", "negotiation-id", "originator-role", "private-auction-id", "proposal-id", "proposal-state", "reference-id", "reference-payload", "revision-number", "revision-time-ms", "seller", "sub-account-id"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -2594,10 +2654,11 @@ impl<'n> Engine<'n> { "is-renegotiating" => Some(("isRenegotiating", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "buyer.account-id" => Some(("buyer.accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "has-buyer-signed-off" => Some(("hasBuyerSignedOff", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "dbm-advertiser-ids" => Some(("dbmAdvertiserIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "is-setup-complete" => Some(("isSetupComplete", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "revision-number" => Some(("revisionNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "billed-buyer", "buyer", "buyer-private-data", "has-buyer-signed-off", "has-seller-signed-off", "inventory-source", "is-renegotiating", "is-setup-complete", "kind", "last-updater-or-commentor-role", "name", "negotiation-id", "originator-role", "private-auction-id", "proposal-id", "proposal-state", "reference-id", "reference-payload", "revision-number", "revision-time-ms", "seller", "sub-account-id"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "billed-buyer", "buyer", "buyer-private-data", "dbm-advertiser-ids", "has-buyer-signed-off", "has-seller-signed-off", "inventory-source", "is-renegotiating", "is-setup-complete", "kind", "last-updater-or-commentor-role", "name", "negotiation-id", "originator-role", "private-auction-id", "proposal-id", "proposal-state", "reference-id", "reference-payload", "revision-number", "revision-time-ms", "seller", "sub-account-id"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -2780,6 +2841,9 @@ impl<'n> Engine<'n> { ("list", Some(opt)) => { call_result = self._creatives_list(opt, dry_run, &mut err); }, + ("list-deals", Some(opt)) => { + call_result = self._creatives_list_deals(opt, dry_run, &mut err); + }, ("remove-deal", Some(opt)) => { call_result = self._creatives_remove_deal(opt, dry_run, &mut err); }, @@ -3241,7 +3305,7 @@ fn main() { ]), ]), - ("creatives", "methods: 'add-deal', 'get', 'insert', 'list' and 'remove-deal'", vec![ + ("creatives", "methods: 'add-deal', 'get', 'insert', 'list', 'list-deals' and 'remove-deal'", vec![ ("add-deal", Some(r##"Add a deal id association for the creative."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/creatives_add-deal", @@ -3330,6 +3394,34 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list-deals", + Some(r##"Lists the external deal ids associated with the creative."##), + "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/creatives_list-deals", + vec![ + (Some(r##"account-id"##), + None, + Some(r##"The id for the account that will serve this creative."##), + Some(true), + Some(false)), + + (Some(r##"buyer-creative-id"##), + None, + Some(r##"The buyer-specific id for this creative."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -3990,7 +4082,7 @@ fn main() { let mut app = App::new("adexchangebuyer1d4") .author("Sebastian Thiel ") - .version("1.0.0+20160831") + .version("1.0.0+20161020") .about("Accesses your bidding-account information, submits creatives for validation, finds available direct deals, and retrieves performance reports.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli") .arg(Arg::with_name("url") diff --git a/gen/adexchangebuyer1d4/Cargo.toml b/gen/adexchangebuyer1d4/Cargo.toml index e56754b688..33acd24cb1 100644 --- a/gen/adexchangebuyer1d4/Cargo.toml +++ b/gen/adexchangebuyer1d4/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-adexchangebuyer1d4" -version = "1.0.0+20160831" +version = "1.0.0+20161020" authors = ["Sebastian Thiel "] description = "A complete library to interact with Ad Exchange Buyer (protocol v1.4)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/adexchangebuyer1d4" diff --git a/gen/adexchangebuyer1d4/README.md b/gen/adexchangebuyer1d4/README.md index 16ef3b08b3..d017993b29 100644 --- a/gen/adexchangebuyer1d4/README.md +++ b/gen/adexchangebuyer1d4/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-adexchangebuyer1d4` library allows access to all features of the *Google Ad Exchange Buyer* service. -This documentation was generated from *Ad Exchange Buyer* crate version *1.0.0+20160831*, where *20160831* is the exact revision of the *adexchangebuyer:v1.4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *Ad Exchange Buyer* crate version *1.0.0+20161020*, where *20161020* is the exact revision of the *adexchangebuyer:v1.4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *Ad Exchange Buyer* *v1d4* API can be found at the [official documentation site](https://developers.google.com/ad-exchange/buyer-rest). @@ -20,7 +20,7 @@ Handle the following *Resources* with ease from the central [hub](http://byron.g * [budget](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.Budget.html) * [*get*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.BudgetGetCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.BudgetPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.BudgetUpdateCall.html) * [creatives](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.Creative.html) - * [*add deal*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.CreativeAddDealCall.html), [*get*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.CreativeGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.CreativeInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.CreativeListCall.html) and [*remove deal*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.CreativeRemoveDealCall.html) + * [*add deal*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.CreativeAddDealCall.html), [*get*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.CreativeGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.CreativeInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.CreativeListCall.html), [*list deals*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.CreativeListDealCall.html) and [*remove deal*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.CreativeRemoveDealCall.html) * marketplacedeals * [*delete*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.MarketplacedealDeleteCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.MarketplacedealInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.MarketplacedealListCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.MarketplacedealUpdateCall.html) * marketplacenotes @@ -69,12 +69,12 @@ let r = hub.resource().activity(...).doit() Or specifically ... ```ignore -let r = hub.proposals().update(...).doit() -let r = hub.proposals().search(...).doit() -let r = hub.proposals().insert(...).doit() -let r = hub.proposals().setupcomplete(...).doit() -let r = hub.proposals().patch(...).doit() -let r = hub.proposals().get(...).doit() +let r = hub.creatives().add_deal(...).doit() +let r = hub.creatives().insert(...).doit() +let r = hub.creatives().list(...).doit() +let r = hub.creatives().list_deals(...).doit() +let r = hub.creatives().remove_deal(...).doit() +let r = hub.creatives().get(...).doit() ``` The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -99,7 +99,6 @@ google-adexchangebuyer1d4 = "*" extern crate hyper; extern crate yup_oauth2 as oauth2; extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; -use adexchangebuyer1d4::Proposal; use adexchangebuyer1d4::{Result, Error}; use std::default::Default; use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -117,15 +116,16 @@ let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, hyper::Client::new(), ::default(), None); let mut hub = AdExchangeBuyer::new(hyper::Client::new(), auth); -// As the method needs a request, you would usually fill it with the desired information -// into the respective structure. Some of the parts shown here might not be applicable ! -// Values shown here are possibly random and not representative ! -let mut req = Proposal::default(); - // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! -let result = hub.proposals().update(req, "proposalId", "revisionNumber", "updateAction") +let result = hub.creatives().list() + .page_token("eirmod") + .open_auction_status_filter("sit") + .max_results(36) + .deals_status_filter("sed") + .add_buyer_creative_id("et") + .add_account_id(-18) .doit(); match result { diff --git a/gen/adexchangebuyer1d4/src/lib.rs b/gen/adexchangebuyer1d4/src/lib.rs index cb2166c6d2..71f7deea47 100644 --- a/gen/adexchangebuyer1d4/src/lib.rs +++ b/gen/adexchangebuyer1d4/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Ad Exchange Buyer* crate version *1.0.0+20160831*, where *20160831* is the exact revision of the *adexchangebuyer:v1.4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *Ad Exchange Buyer* crate version *1.0.0+20161020*, where *20161020* is the exact revision of the *adexchangebuyer:v1.4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *Ad Exchange Buyer* *v1d4* API can be found at the //! [official documentation site](https://developers.google.com/ad-exchange/buyer-rest). @@ -18,7 +18,7 @@ //! * [budget](struct.Budget.html) //! * [*get*](struct.BudgetGetCall.html), [*patch*](struct.BudgetPatchCall.html) and [*update*](struct.BudgetUpdateCall.html) //! * [creatives](struct.Creative.html) -//! * [*add deal*](struct.CreativeAddDealCall.html), [*get*](struct.CreativeGetCall.html), [*insert*](struct.CreativeInsertCall.html), [*list*](struct.CreativeListCall.html) and [*remove deal*](struct.CreativeRemoveDealCall.html) +//! * [*add deal*](struct.CreativeAddDealCall.html), [*get*](struct.CreativeGetCall.html), [*insert*](struct.CreativeInsertCall.html), [*list*](struct.CreativeListCall.html), [*list deals*](struct.CreativeListDealCall.html) and [*remove deal*](struct.CreativeRemoveDealCall.html) //! * marketplacedeals //! * [*delete*](struct.MarketplacedealDeleteCall.html), [*insert*](struct.MarketplacedealInsertCall.html), [*list*](struct.MarketplacedealListCall.html) and [*update*](struct.MarketplacedealUpdateCall.html) //! * marketplacenotes @@ -69,12 +69,12 @@ //! Or specifically ... //! //! ```ignore -//! let r = hub.proposals().update(...).doit() -//! let r = hub.proposals().search(...).doit() -//! let r = hub.proposals().insert(...).doit() -//! let r = hub.proposals().setupcomplete(...).doit() -//! let r = hub.proposals().patch(...).doit() -//! let r = hub.proposals().get(...).doit() +//! let r = hub.creatives().add_deal(...).doit() +//! let r = hub.creatives().insert(...).doit() +//! let r = hub.creatives().list(...).doit() +//! let r = hub.creatives().list_deals(...).doit() +//! let r = hub.creatives().remove_deal(...).doit() +//! let r = hub.creatives().get(...).doit() //! ``` //! //! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -99,7 +99,6 @@ //! extern crate hyper; //! extern crate yup_oauth2 as oauth2; //! extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; -//! use adexchangebuyer1d4::Proposal; //! use adexchangebuyer1d4::{Result, Error}; //! # #[test] fn egal() { //! use std::default::Default; @@ -118,15 +117,16 @@ //! hyper::Client::new(), //! ::default(), None); //! let mut hub = AdExchangeBuyer::new(hyper::Client::new(), auth); -//! // As the method needs a request, you would usually fill it with the desired information -//! // into the respective structure. Some of the parts shown here might not be applicable ! -//! // Values shown here are possibly random and not representative ! -//! let mut req = Proposal::default(); -//! //! // You can configure optional parameters by calling the respective setters at will, and //! // execute the final call using `doit()`. //! // Values shown here are possibly random and not representative ! -//! let result = hub.proposals().update(req, "proposalId", "revisionNumber", "updateAction") +//! let result = hub.creatives().list() +//! .page_token("sadipscing") +//! .open_auction_status_filter("vero") +//! .max_results(6) +//! .deals_status_filter("invidunt") +//! .add_buyer_creative_id("consetetur") +//! .add_account_id(-84) //! .doit(); //! //! match result { diff --git a/gen/adexchangebuyer1d4/src/lib.rs.in b/gen/adexchangebuyer1d4/src/lib.rs.in index b8749fe1e3..4cd9180384 100644 --- a/gen/adexchangebuyer1d4/src/lib.rs.in +++ b/gen/adexchangebuyer1d4/src/lib.rs.in @@ -74,7 +74,6 @@ impl Default for Scope { /// extern crate hyper; /// extern crate yup_oauth2 as oauth2; /// extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; -/// use adexchangebuyer1d4::Proposal; /// use adexchangebuyer1d4::{Result, Error}; /// # #[test] fn egal() { /// use std::default::Default; @@ -93,15 +92,16 @@ impl Default for Scope { /// hyper::Client::new(), /// ::default(), None); /// let mut hub = AdExchangeBuyer::new(hyper::Client::new(), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = Proposal::default(); -/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.proposals().update(req, "proposalId", "revisionNumber", "updateAction") +/// let result = hub.creatives().list() +/// .page_token("kasd") +/// .open_auction_status_filter("accusam") +/// .max_results(93) +/// .deals_status_filter("justo") +/// .add_buyer_creative_id("amet.") +/// .add_account_id(-81) /// .doit(); /// /// match result { @@ -316,6 +316,27 @@ impl NestedType for PretargetingConfigPlacements {} impl Part for PretargetingConfigPlacements {} +/// A list of external deal ids and ARC approval status. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeDealIdsDealStatuses { + /// External deal ID. + #[serde(rename="dealId")] + pub deal_id: Option, + /// ARC approval status. + #[serde(rename="arcStatus")] + pub arc_status: Option, + /// Publisher ID. + #[serde(rename="webPropertyId")] + pub web_property_id: Option, +} + +impl NestedType for CreativeDealIdsDealStatuses {} +impl Part for CreativeDealIdsDealStatuses {} + + /// A creative and its classification data. /// /// # Activities @@ -323,10 +344,11 @@ impl Part for PretargetingConfigPlacements {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [remove deal creatives](struct.CreativeRemoveDealCall.html) (none) /// * [add deal creatives](struct.CreativeAddDealCall.html) (none) /// * [insert creatives](struct.CreativeInsertCall.html) (request|response) /// * [list creatives](struct.CreativeListCall.html) (none) +/// * [list deals creatives](struct.CreativeListDealCall.html) (none) +/// * [remove deal creatives](struct.CreativeRemoveDealCall.html) (none) /// * [get creatives](struct.CreativeGetCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] @@ -376,7 +398,7 @@ pub struct Creative { pub advertiser_name: Option, /// Resource type. pub kind: Option, - /// The url to fetch a video ad. If set, HTMLSnippet should not be set. + /// The URL to fetch a video ad. If set, HTMLSnippet and the nativeAd should not be set. Note, this is different from resource.native_ad.video_url above. #[serde(rename="videoURL")] pub video_url: Option, /// The set of destination urls for the snippet. @@ -391,7 +413,7 @@ pub struct Creative { pub languages: Option>, /// Ad width. pub width: Option, - /// If nativeAd is set, HTMLSnippet and videoURL should not be set. + /// If nativeAd is set, HTMLSnippet and the videoURL outside of nativeAd should not be set. (The videoURL inside nativeAd can be set.) #[serde(rename="nativeAd")] pub native_ad: Option, /// The version for this creative. Read-only. This field should not be set in requests. @@ -622,6 +644,9 @@ pub struct Proposal { /// True, if the buyside inventory setup is complete for this proposal. (readonly, except via OrderSetupCompleted action) #[serde(rename="isSetupComplete")] pub is_setup_complete: Option, + /// IDs of DBM advertisers permission to this proposal. + #[serde(rename="dbmAdvertiserIds")] + pub dbm_advertiser_ids: Option>, /// The role of the last user that either updated the proposal or left a comment. (readonly) #[serde(rename="lastUpdaterOrCommentorRole")] pub last_updater_or_commentor_role: Option, @@ -1147,10 +1172,11 @@ pub struct AccountBidderLocation { /// - US_EAST /// - US_WEST pub region: Option, - /// The protocol that the bidder endpoint is using. By default, OpenRTB protocols use JSON, except PROTOCOL_OPENRTB_PROTOBUF. PROTOCOL_OPENRTB_PROTOBUF uses protobuf encoding over the latest OpenRTB protocol version, which is 2.3 right now. Allowed values: + /// The protocol that the bidder endpoint is using. By default, OpenRTB protocols use JSON, except PROTOCOL_OPENRTB_PROTOBUF. PROTOCOL_OPENRTB_PROTOBUF uses protobuf encoding over the latest OpenRTB protocol version, which is 2.4 right now. Allowed values: /// - PROTOCOL_ADX /// - PROTOCOL_OPENRTB_2_2 /// - PROTOCOL_OPENRTB_2_3 + /// - PROTOCOL_OPENRTB_2_4 /// - PROTOCOL_OPENRTB_PROTOBUF #[serde(rename="bidProtocol")] pub bid_protocol: Option, @@ -1614,6 +1640,9 @@ pub struct MarketplaceDeal { /// The external deal id assigned to this deal once the deal is finalized. This is the deal-id that shows up in serving/reporting etc. (readonly) #[serde(rename="externalDealId")] pub external_deal_id: Option, + /// Indicates whether the current deal is a RFP template. RFP template is created by buyer and not based on seller created products. + #[serde(rename="isRfpTemplate")] + pub is_rfp_template: Option, /// The time (ms since epoch) when the deal was last updated. (readonly) #[serde(rename="lastUpdateTimeMs")] pub last_update_time_ms: Option, @@ -1751,6 +1780,9 @@ pub struct PretargetingConfig { /// Requests containing any of these geo criteria ids will not match. #[serde(rename="excludedGeoCriteriaIds")] pub excluded_geo_criteria_ids: Option>, + /// Requests containing the specified type of user data will match. Possible values are HOSTED_MATCH_DATA, which means the request is cookie-targetable and has a match in the buyer's hosted match table, and COOKIE_OR_IDFA, which means the request has either a targetable cookie or an iOS IDFA. + #[serde(rename="userIdentifierDataRequired")] + pub user_identifier_data_required: Option>, /// Creative attributes should be declared here if all creatives corresponding to this pretargeting configuration have that creative attribute. Values are from pretargetable-creative-attributes.txt in the downloadable files section. #[serde(rename="supportedCreativeAttributes")] pub supported_creative_attributes: Option>, @@ -1806,6 +1838,27 @@ pub struct CreateOrdersRequest { impl RequestValue for CreateOrdersRequest {} +/// The external deal ids associated with a creative. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list deals creatives](struct.CreativeListDealCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeDealIds { + /// A list of external deal ids and ARC approval status. + #[serde(rename="dealStatuses")] + pub deal_statuses: Option>, + /// Resource type. + pub kind: Option, +} + +impl ResponseResult for CreativeDealIds {} + + /// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -2041,7 +2094,7 @@ pub struct Dimension { impl Part for Dimension {} -/// If nativeAd is set, HTMLSnippet and videoURL should not be set. +/// If nativeAd is set, HTMLSnippet and the videoURL outside of nativeAd should not be set. (The videoURL inside nativeAd can be set.) /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -2051,6 +2104,9 @@ pub struct CreativeNativeAd { pub body: Option, /// no description provided pub advertiser: Option, + /// The URL of the XML VAST for a native ad. Note this is a separate field from resource.video_url. + #[serde(rename="videoURL")] + pub video_url: Option, /// A short title for the ad. pub headline: Option, /// A large image. @@ -2076,6 +2132,9 @@ pub struct CreativeNativeAd { pub price: Option, /// The URL to the app store to purchase/download the promoted app. pub store: Option, + /// The URL that the browser/SDK will load when the user clicks the ad. + #[serde(rename="clickLinkUrl")] + pub click_link_url: Option, } impl NestedType for CreativeNativeAd {} @@ -3110,7 +3169,7 @@ impl<'a, C, A> AccountMethods<'a, C, A> { /// ::default(), None); /// let mut hub = AdExchangeBuyer::new(hyper::Client::new(), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `add_deal(...)`, `get(...)`, `insert(...)`, `list(...)` and `remove_deal(...)` +/// // like `add_deal(...)`, `get(...)`, `insert(...)`, `list(...)`, `list_deals(...)` and `remove_deal(...)` /// // to build up your call. /// let rb = hub.creatives(); /// # } @@ -3220,6 +3279,25 @@ impl<'a, C, A> CreativeMethods<'a, C, A> { _additional_params: Default::default(), } } + + /// Create a builder to help you perform the following task: + /// + /// Lists the external deal ids associated with the creative. + /// + /// # Arguments + /// + /// * `accountId` - The id for the account that will serve this creative. + /// * `buyerCreativeId` - The buyer-specific id for this creative. + pub fn list_deals(&self, account_id: i32, buyer_creative_id: &str) -> CreativeListDealCall<'a, C, A> { + CreativeListDealCall { + hub: self.hub, + _account_id: account_id, + _buyer_creative_id: buyer_creative_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } } @@ -3413,7 +3491,7 @@ impl<'a, C, A> PretargetingConfigMethods<'a, C, A> { /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.pubprofiles().list(-63) +/// let result = hub.pubprofiles().list(-35) /// .doit(); /// # } /// ``` @@ -3648,7 +3726,7 @@ impl<'a, C, A> PubprofileListCall<'a, C, A> where C: BorrowMut, A /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.billing_info().get(-22) +/// let result = hub.billing_info().get(-9) /// .doit(); /// # } /// ``` @@ -4884,7 +4962,7 @@ impl<'a, C, A> MarketplacedealUpdateCall<'a, C, A> where C: BorrowMut MarketplaceprivateauctionUpdateproposalCall<'a, C, A> where C: Bo /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.proposals().search() -/// .pql_query("nonumy") +/// .pql_query("no") /// .doit(); /// # } /// ``` @@ -7675,8 +7753,8 @@ impl<'a, C, A> BudgetPatchCall<'a, C, A> where C: BorrowMut, A: o /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.performance_report().list("accountId", "endDateTime", "startDateTime") -/// .page_token("Lorem") -/// .max_results(26) +/// .page_token("elitr") +/// .max_results(4) /// .doit(); /// # } /// ``` @@ -7937,7 +8015,7 @@ impl<'a, C, A> PerformanceReportListCall<'a, C, A> where C: BorrowMut ProductGetCall<'a, C, A> where C: BorrowMut, A: oa /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.marketplacenotes().list("proposalId") -/// .pql_query("eirmod") +/// .pql_query("dolore") /// .doit(); /// # } /// ``` @@ -8904,7 +8982,7 @@ impl<'a, C, A> MarketplacenoteInsertCall<'a, C, A> where C: BorrowMut AccountListCall<'a, C, A> where C: BorrowMut, A: o /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.accounts().get(-36) +/// let result = hub.accounts().get(-56) /// .doit(); /// # } /// ``` @@ -9619,7 +9697,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.accounts().update(req, -39) +/// let result = hub.accounts().update(req, -9) /// .confirm_unsafe_account_change(true) /// .doit(); /// # } @@ -9892,12 +9970,12 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.creatives().list() -/// .page_token("invidunt") -/// .open_auction_status_filter("aliquyam") -/// .max_results(28) -/// .deals_status_filter("Lorem") -/// .add_buyer_creative_id("sea") -/// .add_account_id(-21) +/// .page_token("duo") +/// .open_auction_status_filter("et") +/// .max_results(61) +/// .deals_status_filter("sanctus") +/// .add_buyer_creative_id("et") +/// .add_account_id(-46) /// .doit(); /// # } /// ``` @@ -10171,7 +10249,7 @@ impl<'a, C, A> CreativeListCall<'a, C, A> where C: BorrowMut, A: /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.creatives().remove_deal(-70, "buyerCreativeId", "dealId") +/// let result = hub.creatives().remove_deal(-23, "buyerCreativeId", "dealId") /// .doit(); /// # } /// ``` @@ -10419,7 +10497,7 @@ impl<'a, C, A> CreativeRemoveDealCall<'a, C, A> where C: BorrowMut CreativeAddDealCall<'a, C, A> where C: BorrowMut, /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.creatives().get(-23, "buyerCreativeId") +/// let result = hub.creatives().get(-48, "buyerCreativeId") /// .doit(); /// # } /// ``` @@ -11121,6 +11199,253 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A } +/// Lists the external deal ids associated with the creative. +/// +/// A builder for the *listDeals* method supported by a *creative* resource. +/// It is not used directly, but through a `CreativeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use adexchangebuyer1d4::AdExchangeBuyer; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = AdExchangeBuyer::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creatives().list_deals(-23, "buyerCreativeId") +/// .doit(); +/// # } +/// ``` +pub struct CreativeListDealCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AdExchangeBuyer, + _account_id: i32, + _buyer_creative_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeListDealCall<'a, C, A> {} + +impl<'a, C, A> CreativeListDealCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeDealIds)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "adexchangebuyer.creatives.listDeals", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("accountId", self._account_id.to_string())); + params.push(("buyerCreativeId", self._buyer_creative_id.to_string())); + for &field in ["alt", "accountId", "buyerCreativeId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/creatives/{accountId}/{buyerCreativeId}/listDeals".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{accountId}", "accountId"), ("{buyerCreativeId}", "buyerCreativeId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["buyerCreativeId", "accountId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The id for the account that will serve this creative. + /// + /// Sets the *account id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn account_id(mut self, new_value: i32) -> CreativeListDealCall<'a, C, A> { + self._account_id = new_value; + self + } + /// The buyer-specific id for this creative. + /// + /// Sets the *buyer creative id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn buyer_creative_id(mut self, new_value: &str) -> CreativeListDealCall<'a, C, A> { + self._buyer_creative_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeListDealCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeListDealCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::AdexchangeBuyer`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeListDealCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + /// Inserts a new pretargeting configuration. /// /// A builder for the *insert* method supported by a *pretargetingConfig* resource. diff --git a/gen/admin1_directory-cli/Cargo.toml b/gen/admin1_directory-cli/Cargo.toml index 71d0a20844..724d24f324 100644 --- a/gen/admin1_directory-cli/Cargo.toml +++ b/gen/admin1_directory-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-admin1_directory-cli" -version = "1.0.0+20160824" +version = "1.0.0+20161124" authors = ["Sebastian Thiel "] description = "A complete library to interact with directory (protocol directory_v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/admin1_directory-cli" diff --git a/gen/admin1_directory-cli/README.md b/gen/admin1_directory-cli/README.md index 565c76f083..b9d169feae 100644 --- a/gen/admin1_directory-cli/README.md +++ b/gen/admin1_directory-cli/README.md @@ -24,7 +24,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *directory* API at revision *20160824*. The CLI is at version *1.0.0*. +This documentation was generated from the *directory* API at revision *20161124*. The CLI is at version *1.0.0*. ```bash admin1-directory [options] @@ -35,6 +35,7 @@ admin1-directory [options] channels stop (-r )... [-p ]... chromeosdevices + action (-r )... [-p ]... get [-p ]... [-o ] list [-p ]... [-o ] patch (-r )... [-p ]... [-o ] diff --git a/gen/admin1_directory-cli/mkdocs.yml b/gen/admin1_directory-cli/mkdocs.yml index 3f90aced7f..78df20f781 100644 --- a/gen/admin1_directory-cli/mkdocs.yml +++ b/gen/admin1_directory-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: directory v1.0.0+20160824 +site_name: directory v1.0.0+20161124 site_url: http://byron.github.io/google-apis-rs/google-admin1_directory-cli site_description: Write integrating applications with bcore @@ -13,6 +13,7 @@ pages: - ['asps_get.md', 'Asps', 'Get'] - ['asps_list.md', 'Asps', 'List'] - ['channels_stop.md', 'Channels', 'Stop'] +- ['chromeosdevices_action.md', 'Chromeosdevices', 'Action'] - ['chromeosdevices_get.md', 'Chromeosdevices', 'Get'] - ['chromeosdevices_list.md', 'Chromeosdevices', 'List'] - ['chromeosdevices_patch.md', 'Chromeosdevices', 'Patch'] diff --git a/gen/admin1_directory-cli/src/main.rs b/gen/admin1_directory-cli/src/main.rs index dc84238cd4..67dd5b36fb 100644 --- a/gen/admin1_directory-cli/src/main.rs +++ b/gen/admin1_directory-cli/src/main.rs @@ -281,6 +281,84 @@ impl<'n> Engine<'n> { } } + fn _chromeosdevices_action(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "action" => Some(("action", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "deprovision-reason" => Some(("deprovisionReason", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["action", "deprovision-reason"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::ChromeOsDeviceAction = json::value::from_value(object).unwrap(); + let mut call = self.hub.chromeosdevices().action(request, opt.value_of("customer-id").unwrap_or(""), opt.value_of("resource-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + fn _chromeosdevices_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.chromeosdevices().get(opt.value_of("customer-id").unwrap_or(""), opt.value_of("device-id").unwrap_or("")); @@ -6725,6 +6803,9 @@ impl<'n> Engine<'n> { }, ("chromeosdevices", Some(opt)) => { match opt.subcommand() { + ("action", Some(opt)) => { + call_result = self._chromeosdevices_action(opt, dry_run, &mut err); + }, ("get", Some(opt)) => { call_result = self._chromeosdevices_get(opt, dry_run, &mut err); }, @@ -7308,7 +7389,35 @@ fn main() { ]), ]), - ("chromeosdevices", "methods: 'get', 'list', 'patch' and 'update'", vec![ + ("chromeosdevices", "methods: 'action', 'get', 'list', 'patch' and 'update'", vec![ + ("action", + Some(r##"Take action on Chrome OS Device"##), + "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/chromeosdevices_action", + vec![ + (Some(r##"customer-id"##), + None, + Some(r##"Immutable id of the Google Apps account"##), + Some(true), + Some(false)), + + (Some(r##"resource-id"##), + None, + Some(r##"Immutable id of Chrome OS Device"##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), ("get", Some(r##"Retrieve Chrome OS Device"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/chromeosdevices_get", @@ -9683,7 +9792,7 @@ fn main() { let mut app = App::new("admin1-directory") .author("Sebastian Thiel ") - .version("1.0.0+20160824") + .version("1.0.0+20161124") .about("The Admin SDK Directory API lets you view and manage enterprise resources such as users and groups, administrative notifications, security features, and more.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_admin1_directory_cli") .arg(Arg::with_name("url") diff --git a/gen/admin1_directory/Cargo.toml b/gen/admin1_directory/Cargo.toml index e7ae7053a4..0c6d1053de 100644 --- a/gen/admin1_directory/Cargo.toml +++ b/gen/admin1_directory/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-admin1_directory" -version = "1.0.0+20160824" +version = "1.0.0+20161124" authors = ["Sebastian Thiel "] description = "A complete library to interact with directory (protocol directory_v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/admin1_directory" diff --git a/gen/admin1_directory/README.md b/gen/admin1_directory/README.md index 90be071778..0f4719cafa 100644 --- a/gen/admin1_directory/README.md +++ b/gen/admin1_directory/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-admin1_directory` library allows access to all features of the *Google directory* service. -This documentation was generated from *directory* crate version *1.0.0+20160824*, where *20160824* is the exact revision of the *admin:directory_v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *directory* crate version *1.0.0+20161124*, where *20161124* is the exact revision of the *admin:directory_v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *directory* *v1_directory* API can be found at the [official documentation site](https://developers.google.com/admin-sdk/directory/). @@ -18,7 +18,7 @@ Handle the following *Resources* with ease from the central [hub](http://byron.g * [channels](http://byron.github.io/google-apis-rs/google_admin1_directory/struct.Channel.html) * [*stop*](http://byron.github.io/google-apis-rs/google_admin1_directory/struct.ChannelStopCall.html) * chromeosdevices - * [*get*](http://byron.github.io/google-apis-rs/google_admin1_directory/struct.ChromeosdeviceGetCall.html), [*list*](http://byron.github.io/google-apis-rs/google_admin1_directory/struct.ChromeosdeviceListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_admin1_directory/struct.ChromeosdevicePatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_admin1_directory/struct.ChromeosdeviceUpdateCall.html) + * [*action*](http://byron.github.io/google-apis-rs/google_admin1_directory/struct.ChromeosdeviceActionCall.html), [*get*](http://byron.github.io/google-apis-rs/google_admin1_directory/struct.ChromeosdeviceGetCall.html), [*list*](http://byron.github.io/google-apis-rs/google_admin1_directory/struct.ChromeosdeviceListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_admin1_directory/struct.ChromeosdevicePatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_admin1_directory/struct.ChromeosdeviceUpdateCall.html) * [customers](http://byron.github.io/google-apis-rs/google_admin1_directory/struct.Customer.html) * [*get*](http://byron.github.io/google-apis-rs/google_admin1_directory/struct.CustomerGetCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_admin1_directory/struct.CustomerPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_admin1_directory/struct.CustomerUpdateCall.html) * domain aliases diff --git a/gen/admin1_directory/src/lib.rs b/gen/admin1_directory/src/lib.rs index ffd186d7f4..a23b574ced 100644 --- a/gen/admin1_directory/src/lib.rs +++ b/gen/admin1_directory/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *directory* crate version *1.0.0+20160824*, where *20160824* is the exact revision of the *admin:directory_v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *directory* crate version *1.0.0+20161124*, where *20161124* is the exact revision of the *admin:directory_v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *directory* *v1_directory* API can be found at the //! [official documentation site](https://developers.google.com/admin-sdk/directory/). @@ -16,7 +16,7 @@ //! * [channels](struct.Channel.html) //! * [*stop*](struct.ChannelStopCall.html) //! * chromeosdevices -//! * [*get*](struct.ChromeosdeviceGetCall.html), [*list*](struct.ChromeosdeviceListCall.html), [*patch*](struct.ChromeosdevicePatchCall.html) and [*update*](struct.ChromeosdeviceUpdateCall.html) +//! * [*action*](struct.ChromeosdeviceActionCall.html), [*get*](struct.ChromeosdeviceGetCall.html), [*list*](struct.ChromeosdeviceListCall.html), [*patch*](struct.ChromeosdevicePatchCall.html) and [*update*](struct.ChromeosdeviceUpdateCall.html) //! * [customers](struct.Customer.html) //! * [*get*](struct.CustomerGetCall.html), [*patch*](struct.CustomerPatchCall.html) and [*update*](struct.CustomerUpdateCall.html) //! * domain aliases @@ -160,16 +160,16 @@ //! // execute the final call using `doit()`. //! // Values shown here are possibly random and not representative ! //! let result = hub.users().watch(req) -//! .view_type("et") -//! .sort_order("sadipscing") -//! .show_deleted("accusam") -//! .query("magna") -//! .projection("Lorem") -//! .page_token("rebum.") -//! .order_by("et") -//! .max_results(-64) -//! .event("eos") -//! .domain("dolores") +//! .view_type("accusam") +//! .sort_order("magna") +//! .show_deleted("Lorem") +//! .query("rebum.") +//! .projection("et") +//! .page_token("clita") +//! .order_by("eos") +//! .max_results(-69) +//! .event("vero") +//! .domain("consetetur") //! .customer("vero") //! .custom_field_mask("consetetur") //! .doit(); diff --git a/gen/admin1_directory/src/lib.rs.in b/gen/admin1_directory/src/lib.rs.in index fda6bfa3f8..1a28f2191f 100644 --- a/gen/admin1_directory/src/lib.rs.in +++ b/gen/admin1_directory/src/lib.rs.in @@ -544,22 +544,40 @@ impl Resource for Member {} impl ResponseResult for Member {} -/// JSON request template for firing commands on Mobile Device in Directory Devices API. +/// JSON template for Domain object in Directory API. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [action mobiledevices](struct.MobiledeviceActionCall.html) (request) +/// * [insert domains](struct.DomainInsertCall.html) (request|response) +/// * [get domains](struct.DomainGetCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct MobileDeviceAction { - /// Action to be taken on the Mobile Device - pub action: Option, +pub struct Domains { + /// Kind of resource this is. + pub kind: Option, + /// ETag of the resource. + pub etag: Option, + /// Indicates the verification state of a domain. (Read-only). + pub verified: Option, + /// The domain name of the customer. + #[serde(rename="domainName")] + pub domain_name: Option, + /// List of domain alias objects. (Read-only) + #[serde(rename="domainAliases")] + pub domain_aliases: Option>, + /// Indicates if the domain is a primary domain (Read-only). + #[serde(rename="isPrimary")] + pub is_primary: Option, + /// Creation time of the domain. (Read-only). + #[serde(rename="creationTime")] + pub creation_time: Option, } -impl RequestValue for MobileDeviceAction {} +impl RequestValue for Domains {} +impl ResponseResult for Domains {} /// JSON response template for List Organization Units operation in Directory API. @@ -877,6 +895,31 @@ impl Resource for Asp {} impl ResponseResult for Asp {} +/// JSON response template for List Chrome OS Devices operation in Directory API. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list chromeosdevices](struct.ChromeosdeviceListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ChromeOsDevices { + /// Token used to access next page of this result. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// List of Chrome OS Device objects. + pub chromeosdevices: Option>, + /// ETag of the resource. + pub etag: Option, + /// Kind of resource this is. + pub kind: Option, +} + +impl ResponseResult for ChromeOsDevices {} + + /// JSON template for roleAssignment resource in Directory API. /// /// # Activities @@ -1257,29 +1300,30 @@ impl NestedType for ChromeOsDeviceRecentUsers {} impl Part for ChromeOsDeviceRecentUsers {} -/// JSON response template for List Mobile Devices operation in Directory API. +/// List of applications installed on Mobile Device /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [list mobiledevices](struct.MobiledeviceListCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct MobileDevices { - /// Token used to access next page of this result. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// Kind of resource this is. - pub kind: Option, - /// ETag of the resource. - pub etag: Option, - /// List of Mobile Device objects. - pub mobiledevices: Option>, +pub struct MobileDeviceApplications { + /// Version code of application + #[serde(rename="versionCode")] + pub version_code: Option, + /// Package name of application + #[serde(rename="packageName")] + pub package_name: Option, + /// Display name of application + #[serde(rename="displayName")] + pub display_name: Option, + /// Version name of application + #[serde(rename="versionName")] + pub version_name: Option, + /// List of Permissions for application + pub permission: Option>, } -impl ResponseResult for MobileDevices {} +impl NestedType for MobileDeviceApplications {} +impl Part for MobileDeviceApplications {} /// JSON response template for List Members operation in Directory API. @@ -1484,29 +1528,29 @@ pub struct VerificationCodes { impl ResponseResult for VerificationCodes {} -/// JSON response template for List Chrome OS Devices operation in Directory API. +/// JSON response template for List Mobile Devices operation in Directory API. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [list chromeosdevices](struct.ChromeosdeviceListCall.html) (response) +/// * [list mobiledevices](struct.MobiledeviceListCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ChromeOsDevices { +pub struct MobileDevices { /// Token used to access next page of this result. #[serde(rename="nextPageToken")] pub next_page_token: Option, - /// List of Chrome OS Device objects. - pub chromeosdevices: Option>, - /// ETag of the resource. - pub etag: Option, /// Kind of resource this is. pub kind: Option, + /// ETag of the resource. + pub etag: Option, + /// List of Mobile Device objects. + pub mobiledevices: Option>, } -impl ResponseResult for ChromeOsDevices {} +impl ResponseResult for MobileDevices {} /// List of active time ranges (Read-only) @@ -1564,66 +1608,22 @@ impl RequestValue for UserPhoto {} impl ResponseResult for UserPhoto {} -/// List of applications installed on Mobile Device -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct MobileDeviceApplications { - /// Version code of application - #[serde(rename="versionCode")] - pub version_code: Option, - /// Package name of application - #[serde(rename="packageName")] - pub package_name: Option, - /// Display name of application - #[serde(rename="displayName")] - pub display_name: Option, - /// Version name of application - #[serde(rename="versionName")] - pub version_name: Option, - /// List of Permissions for application - pub permission: Option>, -} - -impl NestedType for MobileDeviceApplications {} -impl Part for MobileDeviceApplications {} - - -/// JSON template for Domain object in Directory API. +/// JSON request template for firing commands on Mobile Device in Directory Devices API. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [insert domains](struct.DomainInsertCall.html) (request|response) -/// * [get domains](struct.DomainGetCall.html) (response) +/// * [action mobiledevices](struct.MobiledeviceActionCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Domains { - /// Kind of resource this is. - pub kind: Option, - /// ETag of the resource. - pub etag: Option, - /// Indicates the verification state of a domain. (Read-only). - pub verified: Option, - /// The domain name of the customer. - #[serde(rename="domainName")] - pub domain_name: Option, - /// List of domain alias objects. (Read-only) - #[serde(rename="domainAliases")] - pub domain_aliases: Option>, - /// Indicates if the domain is a primary domain (Read-only). - #[serde(rename="isPrimary")] - pub is_primary: Option, - /// Creation time of the domain. (Read-only). - #[serde(rename="creationTime")] - pub creation_time: Option, +pub struct MobileDeviceAction { + /// Action to be taken on the Mobile Device + pub action: Option, } -impl RequestValue for Domains {} -impl ResponseResult for Domains {} +impl RequestValue for MobileDeviceAction {} /// JSON request template for setting/revoking admin status of a user in Directory API. @@ -1711,9 +1711,6 @@ impl ResponseResult for Alias {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct MobileDevice { - /// Mobile Device Kernel version (Read-only) - #[serde(rename="kernelVersion")] - pub kernel_version: Option, /// Date and time the device was last synchronized with the policy settings in the Google Apps administrator control panel (Read-only) #[serde(rename="lastSync")] pub last_sync: Option, @@ -1723,14 +1720,51 @@ pub struct MobileDevice { /// Unique identifier of Mobile Device (Read-only) #[serde(rename="resourceId")] pub resource_id: Option, - /// Mobile Device MEID number (Read-only) - pub meid: Option, /// The default locale used on the Mobile Device (Read-only) #[serde(rename="defaultLanguage")] pub default_language: Option, - /// Work profile supported on device (Read-only) - #[serde(rename="supportsWorkProfile")] - pub supports_work_profile: Option, + /// Mobile Device Hardware (Read-only) + pub hardware: Option, + /// Mobile Device user agent + #[serde(rename="userAgent")] + pub user_agent: Option, + /// Date and time the device was first synchronized with the policy settings in the Google Apps administrator control panel (Read-only) + #[serde(rename="firstSync")] + pub first_sync: Option, + /// List of accounts added on device (Read-only) + #[serde(rename="otherAccountsInfo")] + pub other_accounts_info: Option>, + /// Mobile Device release version version (Read-only) + #[serde(rename="releaseVersion")] + pub release_version: Option, + /// Mobile Device Hardware Id (Read-only) + #[serde(rename="hardwareId")] + pub hardware_id: Option, + /// ETag of the resource. + pub etag: Option, + /// Mobile Device Security patch level (Read-only) + #[serde(rename="securityPatchLevel")] + pub security_patch_level: Option, + /// DMAgentPermission (Read-only) + pub privilege: Option, + /// Mobile Device Encryption Status (Read-only) + #[serde(rename="encryptionStatus")] + pub encryption_status: Option, + /// The type of device (Read-only) + #[serde(rename="type")] + pub type_: Option, + /// List of owner user's email addresses (Read-only) + pub email: Option>, + /// DevicePasswordStatus (Read-only) + #[serde(rename="devicePasswordStatus")] + pub device_password_status: Option, + /// Mobile Device Kernel version (Read-only) + #[serde(rename="kernelVersion")] + pub kernel_version: Option, + /// Mobile Device Brand (Read-only) + pub brand: Option, + /// Mobile Device MEID number (Read-only) + pub meid: Option, /// Mobile Device Build number (Read-only) #[serde(rename="buildNumber")] pub build_number: Option, @@ -1741,12 +1775,14 @@ pub struct MobileDevice { pub device_id: Option, /// Mobile Device IMEI number (Read-only) pub imei: Option, - /// Mobile Device user agent - #[serde(rename="userAgent")] - pub user_agent: Option, /// Adb (USB debugging) enabled or disabled on device (Read-only) #[serde(rename="adbStatus")] pub adb_status: Option, + /// Mobile Device Bootloader version (Read-only) + #[serde(rename="bootloaderVersion")] + pub bootloader_version: Option, + /// Mobile Device manufacturer (Read-only) + pub manufacturer: Option, /// Mobile Device Baseband version (Read-only) #[serde(rename="basebandVersion")] pub baseband_version: Option, @@ -1757,25 +1793,15 @@ pub struct MobileDevice { pub developer_options_status: Option, /// List of owner user's names (Read-only) pub name: Option>, - /// Date and time the device was first synchronized with the policy settings in the Google Apps administrator control panel (Read-only) - #[serde(rename="firstSync")] - pub first_sync: Option, - /// List of accounts added on device (Read-only) - #[serde(rename="otherAccountsInfo")] - pub other_accounts_info: Option>, - /// Name of the mobile operating system - pub os: Option, /// Mobile Device SSN or Serial Number (Read-only) #[serde(rename="serialNumber")] pub serial_number: Option, - /// Mobile Device Hardware Id (Read-only) - #[serde(rename="hardwareId")] - pub hardware_id: Option, + /// Work profile supported on device (Read-only) + #[serde(rename="supportsWorkProfile")] + pub supports_work_profile: Option, /// Mobile Device mobile or network operator (if available) (Read-only) #[serde(rename="networkOperator")] pub network_operator: Option, - /// ETag of the resource. - pub etag: Option, /// Status of the device (Read-only) pub status: Option, /// Unknown sources enabled or disabled on device (Read-only) @@ -1786,11 +1812,8 @@ pub struct MobileDevice { pub managed_account_is_on_owner_profile: Option, /// Name of the model of the device pub model: Option, - /// The type of device (Read-only) - #[serde(rename="type")] - pub type_: Option, - /// List of owner user's email addresses (Read-only) - pub email: Option>, + /// Name of the mobile operating system + pub os: Option, /// Mobile Device WiFi MAC address (Read-only) #[serde(rename="wifiMacAddress")] pub wifi_mac_address: Option, @@ -1933,6 +1956,27 @@ pub struct VerificationCode { impl Resource for VerificationCode {} +/// JSON request template for firing actions on ChromeOs Device in Directory Devices API. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [action chromeosdevices](struct.ChromeosdeviceActionCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ChromeOsDeviceAction { + /// Action to be taken on the ChromeOs Device + pub action: Option, + /// no description provided + #[serde(rename="deprovisionReason")] + pub deprovision_reason: Option, +} + +impl RequestValue for ChromeOsDeviceAction {} + + /// Indexing spec for a numeric field. By default, only exact match queries will be supported for numeric fields. Setting the numericIndexingSpec allows range queries to be supported. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -3311,7 +3355,7 @@ impl<'a, C, A> RoleAssignmentMethods<'a, C, A> { /// ::default(), None); /// let mut hub = Directory::new(hyper::Client::new(), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `get(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // like `action(...)`, `get(...)`, `list(...)`, `patch(...)` and `update(...)` /// // to build up your call. /// let rb = hub.chromeosdevices(); /// # } @@ -3412,6 +3456,27 @@ impl<'a, C, A> ChromeosdeviceMethods<'a, C, A> { _additional_params: Default::default(), } } + + /// Create a builder to help you perform the following task: + /// + /// Take action on Chrome OS Device + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `customerId` - Immutable id of the Google Apps account + /// * `resourceId` - Immutable id of Chrome OS Device + pub fn action(&self, request: ChromeOsDeviceAction, customer_id: &str, resource_id: &str) -> ChromeosdeviceActionCall<'a, C, A> { + ChromeosdeviceActionCall { + hub: self.hub, + _request: request, + _customer_id: customer_id.to_string(), + _resource_id: resource_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } } @@ -16545,6 +16610,273 @@ impl<'a, C, A> ChromeosdeviceGetCall<'a, C, A> where C: BorrowMut } +/// Take action on Chrome OS Device +/// +/// A builder for the *action* method supported by a *chromeosdevice* resource. +/// It is not used directly, but through a `ChromeosdeviceMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// use admin1_directory::ChromeOsDeviceAction; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ChromeOsDeviceAction::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.chromeosdevices().action(req, "customerId", "resourceId") +/// .doit(); +/// # } +/// ``` +pub struct ChromeosdeviceActionCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _request: ChromeOsDeviceAction, + _customer_id: String, + _resource_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ChromeosdeviceActionCall<'a, C, A> {} + +impl<'a, C, A> ChromeosdeviceActionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.chromeosdevices.action", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("customerId", self._customer_id.to_string())); + params.push(("resourceId", self._resource_id.to_string())); + for &field in ["customerId", "resourceId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customerId}/devices/chromeos/{resourceId}/action".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryDeviceChromeo.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customerId}", "customerId"), ("{resourceId}", "resourceId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["resourceId", "customerId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ChromeOsDeviceAction) -> ChromeosdeviceActionCall<'a, C, A> { + self._request = new_value; + self + } + /// Immutable id of the Google Apps account + /// + /// Sets the *customer id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer_id(mut self, new_value: &str) -> ChromeosdeviceActionCall<'a, C, A> { + self._customer_id = new_value.to_string(); + self + } + /// Immutable id of Chrome OS Device + /// + /// Sets the *resource id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource_id(mut self, new_value: &str) -> ChromeosdeviceActionCall<'a, C, A> { + self._resource_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ChromeosdeviceActionCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ChromeosdeviceActionCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryDeviceChromeo`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ChromeosdeviceActionCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + /// Delete Group /// /// A builder for the *delete* method supported by a *group* resource. @@ -16796,11 +17128,11 @@ impl<'a, C, A> GroupDeleteCall<'a, C, A> where C: BorrowMut, A: o /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.groups().list() -/// .user_key("diam") -/// .page_token("justo") -/// .max_results(-57) -/// .domain("clita") -/// .customer("invidunt") +/// .user_key("est") +/// .page_token("clita") +/// .max_results(-37) +/// .domain("ut") +/// .customer("dolores") /// .doit(); /// # } /// ``` @@ -18794,7 +19126,7 @@ impl<'a, C, A> GroupAliaseDeleteCall<'a, C, A> where C: BorrowMut /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.asps().get("userKey", -17) +/// let result = hub.asps().get("userKey", -48) /// .doit(); /// # } /// ``` @@ -19041,7 +19373,7 @@ impl<'a, C, A> AspGetCall<'a, C, A> where C: BorrowMut, A: oauth2 /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.asps().delete("userKey", -48) +/// let result = hub.asps().delete("userKey", -62) /// .doit(); /// # } /// ``` @@ -21010,7 +21342,7 @@ impl<'a, C, A> DomainAliaseGetCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.domain_aliases().list("customer") -/// .parent_domain_name("sed") +/// .parent_domain_name("takimata") /// .doit(); /// # } /// ``` @@ -23033,8 +23365,8 @@ impl<'a, C, A> SchemaInsertCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.resources().calendars_list("customer") -/// .page_token("dolor") -/// .max_results(-9) +/// .page_token("ut") +/// .max_results(-39) /// .doit(); /// # } /// ``` @@ -25581,7 +25913,7 @@ impl<'a, C, A> UserInsertCall<'a, C, A> where C: BorrowMut, A: oa /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.users().aliases_watch(req, "userKey") -/// .event("dolore") +/// .event("dolor") /// .doit(); /// # } /// ``` @@ -26125,18 +26457,18 @@ impl<'a, C, A> UserPhotoUpdateCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.users().watch(req) -/// .view_type("dolor") -/// .sort_order("takimata") +/// .view_type("et") +/// .sort_order("nonumy") /// .show_deleted("et") -/// .query("nonumy") -/// .projection("et") -/// .page_token("sed") -/// .order_by("no") -/// .max_results(-38) -/// .event("rebum.") -/// .domain("labore") -/// .customer("aliquyam") -/// .custom_field_mask("elitr") +/// .query("sed") +/// .projection("no") +/// .page_token("invidunt") +/// .order_by("rebum.") +/// .max_results(-86) +/// .event("aliquyam") +/// .domain("elitr") +/// .customer("consetetur") +/// .custom_field_mask("sea") /// .doit(); /// # } /// ``` @@ -26997,18 +27329,18 @@ impl<'a, C, A> UserPhotoGetCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.users().list() -/// .view_type("elitr") -/// .sort_order("At") -/// .show_deleted("sea") -/// .query("consetetur") -/// .projection("diam") -/// .page_token("accusam") -/// .order_by("dolores") -/// .max_results(-46) -/// .event("dolor") -/// .domain("aliquyam") -/// .customer("elitr") -/// .custom_field_mask("ea") +/// .view_type("sea") +/// .sort_order("consetetur") +/// .show_deleted("diam") +/// .query("accusam") +/// .projection("dolores") +/// .page_token("consetetur") +/// .order_by("dolor") +/// .max_results(-82) +/// .event("elitr") +/// .domain("ea") +/// .customer("et") +/// .custom_field_mask("Stet") /// .doit(); /// # } /// ``` @@ -27343,9 +27675,9 @@ impl<'a, C, A> UserListCall<'a, C, A> where C: BorrowMut, A: oaut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.users().get("userKey") -/// .view_type("Stet") -/// .projection("sed") -/// .custom_field_mask("dolor") +/// .view_type("dolor") +/// .projection("sanctus") +/// .custom_field_mask("dolore") /// .doit(); /// # } /// ``` @@ -27880,7 +28212,7 @@ impl<'a, C, A> UserAliaseInsertCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.users().aliases_list("userKey") -/// .event("Lorem") +/// .event("consetetur") /// .doit(); /// # } /// ``` diff --git a/gen/adsense1d4-cli/Cargo.toml b/gen/adsense1d4-cli/Cargo.toml index 365ef01385..e04e94a53f 100644 --- a/gen/adsense1d4-cli/Cargo.toml +++ b/gen/adsense1d4-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-adsense1d4-cli" -version = "1.0.0+20160907" +version = "1.0.0+20161206" authors = ["Sebastian Thiel "] description = "A complete library to interact with AdSense (protocol v1.4)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/adsense1d4-cli" diff --git a/gen/adsense1d4-cli/README.md b/gen/adsense1d4-cli/README.md index 42c32b6897..1285f6bfff 100644 --- a/gen/adsense1d4-cli/README.md +++ b/gen/adsense1d4-cli/README.md @@ -24,7 +24,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *AdSense* API at revision *20160907*. The CLI is at version *1.0.0*. +This documentation was generated from the *AdSense* API at revision *20161206*. The CLI is at version *1.0.0*. ```bash adsense1d4 [options] diff --git a/gen/adsense1d4-cli/mkdocs.yml b/gen/adsense1d4-cli/mkdocs.yml index d221b340cb..ff9051473c 100644 --- a/gen/adsense1d4-cli/mkdocs.yml +++ b/gen/adsense1d4-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: AdSense v1.0.0+20160907 +site_name: AdSense v1.0.0+20161206 site_url: http://byron.github.io/google-apis-rs/google-adsense1d4-cli site_description: Write integrating applications with bcore diff --git a/gen/adsense1d4-cli/src/main.rs b/gen/adsense1d4-cli/src/main.rs index 088914232a..a8613943d3 100644 --- a/gen/adsense1d4-cli/src/main.rs +++ b/gen/adsense1d4-cli/src/main.rs @@ -3480,7 +3480,7 @@ fn main() { let mut app = App::new("adsense1d4") .author("Sebastian Thiel ") - .version("1.0.0+20160907") + .version("1.0.0+20161206") .about("Accesses AdSense publishers' inventory and generates performance reports.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_adsense1d4_cli") .arg(Arg::with_name("url") diff --git a/gen/adsense1d4/Cargo.toml b/gen/adsense1d4/Cargo.toml index f10241fca0..728a49b172 100644 --- a/gen/adsense1d4/Cargo.toml +++ b/gen/adsense1d4/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-adsense1d4" -version = "1.0.0+20160907" +version = "1.0.0+20161206" authors = ["Sebastian Thiel "] description = "A complete library to interact with AdSense (protocol v1.4)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/adsense1d4" diff --git a/gen/adsense1d4/README.md b/gen/adsense1d4/README.md index f037b6579f..c2d6a053d9 100644 --- a/gen/adsense1d4/README.md +++ b/gen/adsense1d4/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-adsense1d4` library allows access to all features of the *Google AdSense* service. -This documentation was generated from *AdSense* crate version *1.0.0+20160907*, where *20160907* is the exact revision of the *adsense:v1.4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *AdSense* crate version *1.0.0+20161206*, where *20161206* is the exact revision of the *adsense:v1.4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *AdSense* *v1d4* API can be found at the [official documentation site](https://developers.google.com/adsense/management/). diff --git a/gen/adsense1d4/src/lib.rs b/gen/adsense1d4/src/lib.rs index 086a48909b..4714672c2b 100644 --- a/gen/adsense1d4/src/lib.rs +++ b/gen/adsense1d4/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *AdSense* crate version *1.0.0+20160907*, where *20160907* is the exact revision of the *adsense:v1.4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *AdSense* crate version *1.0.0+20161206*, where *20161206* is the exact revision of the *adsense:v1.4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *AdSense* *v1d4* API can be found at the //! [official documentation site](https://developers.google.com/adsense/management/). diff --git a/gen/adsense1d4/src/lib.rs.in b/gen/adsense1d4/src/lib.rs.in index c2abc1a4a4..848793ee22 100644 --- a/gen/adsense1d4/src/lib.rs.in +++ b/gen/adsense1d4/src/lib.rs.in @@ -699,7 +699,7 @@ impl ResponseResult for AdClients {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct AdStyle { - /// The style of the corners in the ad. + /// The style of the corners in the ad (deprecated: never populated, ignored). pub corners: Option, /// The colors which are included in the style. These are represented as six hexadecimal characters, similar to HTML color codes, but without the leading hash. pub colors: Option, diff --git a/gen/adsensehost4d1-cli/Cargo.toml b/gen/adsensehost4d1-cli/Cargo.toml index ab9453bb48..bf49606d32 100644 --- a/gen/adsensehost4d1-cli/Cargo.toml +++ b/gen/adsensehost4d1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-adsensehost4d1-cli" -version = "1.0.0+20160907" +version = "1.0.0+20161206" authors = ["Sebastian Thiel "] description = "A complete library to interact with AdSense Host (protocol v4.1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/adsensehost4d1-cli" diff --git a/gen/adsensehost4d1-cli/README.md b/gen/adsensehost4d1-cli/README.md index 49a485c094..9f30264566 100644 --- a/gen/adsensehost4d1-cli/README.md +++ b/gen/adsensehost4d1-cli/README.md @@ -24,7 +24,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *AdSense Host* API at revision *20160907*. The CLI is at version *1.0.0*. +This documentation was generated from the *AdSense Host* API at revision *20161206*. The CLI is at version *1.0.0*. ```bash adsensehost4d1 [options] diff --git a/gen/adsensehost4d1-cli/mkdocs.yml b/gen/adsensehost4d1-cli/mkdocs.yml index 5a6253b822..8d32b4c836 100644 --- a/gen/adsensehost4d1-cli/mkdocs.yml +++ b/gen/adsensehost4d1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: AdSense Host v1.0.0+20160907 +site_name: AdSense Host v1.0.0+20161206 site_url: http://byron.github.io/google-apis-rs/google-adsensehost4d1-cli site_description: Write integrating applications with bcore diff --git a/gen/adsensehost4d1-cli/src/main.rs b/gen/adsensehost4d1-cli/src/main.rs index 9115dda159..59b827c034 100644 --- a/gen/adsensehost4d1-cli/src/main.rs +++ b/gen/adsensehost4d1-cli/src/main.rs @@ -2761,7 +2761,7 @@ fn main() { let mut app = App::new("adsensehost4d1") .author("Sebastian Thiel ") - .version("1.0.0+20160907") + .version("1.0.0+20161206") .about("Generates performance reports, generates ad codes, and provides publisher management capabilities for AdSense Hosts.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_adsensehost4d1_cli") .arg(Arg::with_name("url") diff --git a/gen/adsensehost4d1/Cargo.toml b/gen/adsensehost4d1/Cargo.toml index 70a4706c7c..d930ce868a 100644 --- a/gen/adsensehost4d1/Cargo.toml +++ b/gen/adsensehost4d1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-adsensehost4d1" -version = "1.0.0+20160907" +version = "1.0.0+20161206" authors = ["Sebastian Thiel "] description = "A complete library to interact with AdSense Host (protocol v4.1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/adsensehost4d1" diff --git a/gen/adsensehost4d1/README.md b/gen/adsensehost4d1/README.md index c278d40587..08b10b4d27 100644 --- a/gen/adsensehost4d1/README.md +++ b/gen/adsensehost4d1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-adsensehost4d1` library allows access to all features of the *Google AdSense Host* service. -This documentation was generated from *AdSense Host* crate version *1.0.0+20160907*, where *20160907* is the exact revision of the *adsensehost:v4.1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *AdSense Host* crate version *1.0.0+20161206*, where *20161206* is the exact revision of the *adsensehost:v4.1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *AdSense Host* *v4d1* API can be found at the [official documentation site](https://developers.google.com/adsense/host/). diff --git a/gen/adsensehost4d1/src/lib.rs b/gen/adsensehost4d1/src/lib.rs index 9de7770248..88339149c6 100644 --- a/gen/adsensehost4d1/src/lib.rs +++ b/gen/adsensehost4d1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *AdSense Host* crate version *1.0.0+20160907*, where *20160907* is the exact revision of the *adsensehost:v4.1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *AdSense Host* crate version *1.0.0+20161206*, where *20161206* is the exact revision of the *adsensehost:v4.1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *AdSense Host* *v4d1* API can be found at the //! [official documentation site](https://developers.google.com/adsense/host/). diff --git a/gen/adsensehost4d1/src/lib.rs.in b/gen/adsensehost4d1/src/lib.rs.in index 05e7a14307..1b6851443a 100644 --- a/gen/adsensehost4d1/src/lib.rs.in +++ b/gen/adsensehost4d1/src/lib.rs.in @@ -313,7 +313,7 @@ impl ResponseResult for AdClients {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct AdStyle { - /// The style of the corners in the ad. Possible values are SQUARE, SLIGHTLY_ROUNDED and VERY_ROUNDED. + /// The style of the corners in the ad (deprecated: never populated, ignored). pub corners: Option, /// The colors included in the style. These are represented as six hexadecimal characters, similar to HTML color codes, but without the leading hash. pub colors: Option, diff --git a/gen/analytics3-cli/Cargo.toml b/gen/analytics3-cli/Cargo.toml index debcbe97f6..a880d9eadf 100644 --- a/gen/analytics3-cli/Cargo.toml +++ b/gen/analytics3-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-analytics3-cli" -version = "1.0.0+20160805" +version = "1.0.0+20161004" authors = ["Sebastian Thiel "] description = "A complete library to interact with analytics (protocol v3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/analytics3-cli" diff --git a/gen/analytics3-cli/README.md b/gen/analytics3-cli/README.md index c10102feec..18895b81fd 100644 --- a/gen/analytics3-cli/README.md +++ b/gen/analytics3-cli/README.md @@ -24,7 +24,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *analytics* API at revision *20160805*. The CLI is at version *1.0.0*. +This documentation was generated from the *analytics* API at revision *20161004*. The CLI is at version *1.0.0*. ```bash analytics3 [options] diff --git a/gen/analytics3-cli/mkdocs.yml b/gen/analytics3-cli/mkdocs.yml index 66480de5be..e8d76e8110 100644 --- a/gen/analytics3-cli/mkdocs.yml +++ b/gen/analytics3-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: analytics v1.0.0+20160805 +site_name: analytics v1.0.0+20161004 site_url: http://byron.github.io/google-apis-rs/google-analytics3-cli site_description: Write integrating applications with bcore diff --git a/gen/analytics3-cli/src/main.rs b/gen/analytics3-cli/src/main.rs index b70445dfb8..269b896668 100644 --- a/gen/analytics3-cli/src/main.rs +++ b/gen/analytics3-cli/src/main.rs @@ -8923,24 +8923,24 @@ fn main() { Some(false)), ]), ("remarketing-audience-get", - Some(r##"Gets remarketing audiences to which the user has access."##), + Some(r##"Gets a remarketing audience to which the user has access."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_remarketing-audience-get", vec![ (Some(r##"account-id"##), None, - Some(r##"Account ID for the remarketing audience to retrieve."##), + Some(r##"The account ID of the remarketing audience to retrieve."##), Some(true), Some(false)), (Some(r##"web-property-id"##), None, - Some(r##"Web property ID for the remarketing audience to retrieve."##), + Some(r##"The web property ID of the remarketing audience to retrieve."##), Some(true), Some(false)), (Some(r##"remarketing-audience-id"##), None, - Some(r##"The ID to retrieve the Remarketing Audience for."##), + Some(r##"The ID of the remarketing audience to retrieve."##), Some(true), Some(false)), @@ -8957,18 +8957,18 @@ fn main() { Some(false)), ]), ("remarketing-audience-insert", - Some(r##"Creates a new remarketing audiences."##), + Some(r##"Creates a new remarketing audience."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_remarketing-audience-insert", vec![ (Some(r##"account-id"##), None, - Some(r##"Account ID to create the remarketing audience for."##), + Some(r##"The account ID for which to create the remarketing audience."##), Some(true), Some(false)), (Some(r##"web-property-id"##), None, - Some(r##"Web property ID to create the remarketing audience for."##), + Some(r##"Web property ID for which to create the remarketing audience."##), Some(true), Some(false)), @@ -8996,13 +8996,13 @@ fn main() { vec![ (Some(r##"account-id"##), None, - Some(r##"Account ID for the remarketing audience to retrieve."##), + Some(r##"The account ID of the remarketing audiences to retrieve."##), Some(true), Some(false)), (Some(r##"web-property-id"##), None, - Some(r##"Web property ID for the remarketing audience to retrieve."##), + Some(r##"The web property ID of the remarketing audiences to retrieve."##), Some(true), Some(false)), @@ -9019,24 +9019,24 @@ fn main() { Some(false)), ]), ("remarketing-audience-patch", - Some(r##"Updates an existing remarketing audiences. This method supports patch semantics."##), + Some(r##"Updates an existing remarketing audience. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_remarketing-audience-patch", vec![ (Some(r##"account-id"##), None, - Some(r##"Account ID for the remarketing audience to update."##), + Some(r##"The account ID of the remarketing audience to update."##), Some(true), Some(false)), (Some(r##"web-property-id"##), None, - Some(r##"Web property ID for the remarketing audience to update."##), + Some(r##"The web property ID of the remarketing audience to update."##), Some(true), Some(false)), (Some(r##"remarketing-audience-id"##), None, - Some(r##"Remarketing audience ID of the remarketing audience to update."##), + Some(r##"The ID of the remarketing audience to update."##), Some(true), Some(false)), @@ -9059,24 +9059,24 @@ fn main() { Some(false)), ]), ("remarketing-audience-update", - Some(r##"Updates an existing remarketing audiences."##), + Some(r##"Updates an existing remarketing audience."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_remarketing-audience-update", vec![ (Some(r##"account-id"##), None, - Some(r##"Account ID for the remarketing audience to update."##), + Some(r##"The account ID of the remarketing audience to update."##), Some(true), Some(false)), (Some(r##"web-property-id"##), None, - Some(r##"Web property ID for the remarketing audience to update."##), + Some(r##"The web property ID of the remarketing audience to update."##), Some(true), Some(false)), (Some(r##"remarketing-audience-id"##), None, - Some(r##"Remarketing audience ID of the remarketing audience to update."##), + Some(r##"The ID of the remarketing audience to update."##), Some(true), Some(false)), @@ -9946,7 +9946,7 @@ fn main() { let mut app = App::new("analytics3") .author("Sebastian Thiel ") - .version("1.0.0+20160805") + .version("1.0.0+20161004") .about("Views and manages your Google Analytics data.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_analytics3_cli") .arg(Arg::with_name("url") diff --git a/gen/analytics3/Cargo.toml b/gen/analytics3/Cargo.toml index d33541f439..aa077ac97c 100644 --- a/gen/analytics3/Cargo.toml +++ b/gen/analytics3/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-analytics3" -version = "1.0.0+20160805" +version = "1.0.0+20161004" authors = ["Sebastian Thiel "] description = "A complete library to interact with analytics (protocol v3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/analytics3" diff --git a/gen/analytics3/README.md b/gen/analytics3/README.md index 17272d4f67..ed373c0cd6 100644 --- a/gen/analytics3/README.md +++ b/gen/analytics3/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-analytics3` library allows access to all features of the *Google analytics* service. -This documentation was generated from *analytics* crate version *1.0.0+20160805*, where *20160805* is the exact revision of the *analytics:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *analytics* crate version *1.0.0+20161004*, where *20161004* is the exact revision of the *analytics:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *analytics* *v3* API can be found at the [official documentation site](https://developers.google.com/analytics/). diff --git a/gen/analytics3/src/lib.rs b/gen/analytics3/src/lib.rs index a9f84d6add..4f36d32e5d 100644 --- a/gen/analytics3/src/lib.rs +++ b/gen/analytics3/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *analytics* crate version *1.0.0+20160805*, where *20160805* is the exact revision of the *analytics:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *analytics* crate version *1.0.0+20161004*, where *20161004* is the exact revision of the *analytics:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *analytics* *v3* API can be found at the //! [official documentation site](https://developers.google.com/analytics/). diff --git a/gen/analytics3/src/lib.rs.in b/gen/analytics3/src/lib.rs.in index 6d725c2c2f..ce071429c2 100644 --- a/gen/analytics3/src/lib.rs.in +++ b/gen/analytics3/src/lib.rs.in @@ -713,6 +713,9 @@ pub struct GaData { /// The number of samples used to calculate the result. #[serde(rename="sampleSize")] pub sample_size: Option, + /// The last refreshed time in seconds for Analytics data. + #[serde(rename="dataLastRefreshed")] + pub data_last_refreshed: Option, /// Information for the view (profile), for which the Analytics data was requested. #[serde(rename="profileInfo")] pub profile_info: Option, @@ -1106,7 +1109,7 @@ pub struct IncludeConditions { pub kind: Option, /// The segment condition that will cause a user to be added to an audience. pub segment: Option, - /// Number of days a user remains in the audience. Use any integer from 1-540. In remarketing audiences for search ads, membership duration is truncated to 180 days. + /// Number of days (in the range 1 to 540) a user remains in the audience. #[serde(rename="membershipDurationDays")] pub membership_duration_days: Option, } @@ -2899,7 +2902,7 @@ pub struct Profile { /// Indicates whether this view (profile) is starred or not. pub starred: Option, /// The currency type associated with this view (profile), defaults to USD. The supported values are: - /// ARS, AUD, BGN, BRL, CAD, CHF, CNY, CZK, DKK, EUR, GBP, HKD, HUF, IDR, INR, JPY, KRW, LTL, MXN, NOK, NZD, PHP, PLN, RUB, SEK, THB, TRY, TWD, USD, VND, ZAR + /// USD, JPY, EUR, GBP, AUD, KRW, BRL, CNY, DKK, RUB, SEK, NOK, PLN, TRY, TWD, HKD, THB, IDR, ARS, MXN, VND, PHP, INR, CHF, CAD, CZK, NZD, HUF, BGN, LTL, ZAR, UAH, AED, BOB, CLP, COP, EGP, HRK, ILS, MAD, MYR, PEN, PKR, RON, RSD, SAR, SGD, VEF, LVL pub currency: Option, /// Internal ID for the web property to which this view (profile) belongs. #[serde(rename="internalWebPropertyId")] @@ -3613,14 +3616,14 @@ impl<'a, C, A> ManagementMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates an existing remarketing audiences. + /// Updates an existing remarketing audience. /// /// # Arguments /// /// * `request` - No description provided. - /// * `accountId` - Account ID for the remarketing audience to update. - /// * `webPropertyId` - Web property ID for the remarketing audience to update. - /// * `remarketingAudienceId` - Remarketing audience ID of the remarketing audience to update. + /// * `accountId` - The account ID of the remarketing audience to update. + /// * `webPropertyId` - The web property ID of the remarketing audience to update. + /// * `remarketingAudienceId` - The ID of the remarketing audience to update. pub fn remarketing_audience_update(&self, request: RemarketingAudience, account_id: &str, web_property_id: &str, remarketing_audience_id: &str) -> ManagementRemarketingAudienceUpdateCall<'a, C, A> { ManagementRemarketingAudienceUpdateCall { hub: self.hub, @@ -4379,13 +4382,13 @@ impl<'a, C, A> ManagementMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Creates a new remarketing audiences. + /// Creates a new remarketing audience. /// /// # Arguments /// /// * `request` - No description provided. - /// * `accountId` - Account ID to create the remarketing audience for. - /// * `webPropertyId` - Web property ID to create the remarketing audience for. + /// * `accountId` - The account ID for which to create the remarketing audience. + /// * `webPropertyId` - Web property ID for which to create the remarketing audience. pub fn remarketing_audience_insert(&self, request: RemarketingAudience, account_id: &str, web_property_id: &str) -> ManagementRemarketingAudienceInsertCall<'a, C, A> { ManagementRemarketingAudienceInsertCall { hub: self.hub, @@ -4641,13 +4644,13 @@ impl<'a, C, A> ManagementMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets remarketing audiences to which the user has access. + /// Gets a remarketing audience to which the user has access. /// /// # Arguments /// - /// * `accountId` - Account ID for the remarketing audience to retrieve. - /// * `webPropertyId` - Web property ID for the remarketing audience to retrieve. - /// * `remarketingAudienceId` - The ID to retrieve the Remarketing Audience for. + /// * `accountId` - The account ID of the remarketing audience to retrieve. + /// * `webPropertyId` - The web property ID of the remarketing audience to retrieve. + /// * `remarketingAudienceId` - The ID of the remarketing audience to retrieve. pub fn remarketing_audience_get(&self, account_id: &str, web_property_id: &str, remarketing_audience_id: &str) -> ManagementRemarketingAudienceGetCall<'a, C, A> { ManagementRemarketingAudienceGetCall { hub: self.hub, @@ -4881,14 +4884,14 @@ impl<'a, C, A> ManagementMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates an existing remarketing audiences. This method supports patch semantics. + /// Updates an existing remarketing audience. This method supports patch semantics. /// /// # Arguments /// /// * `request` - No description provided. - /// * `accountId` - Account ID for the remarketing audience to update. - /// * `webPropertyId` - Web property ID for the remarketing audience to update. - /// * `remarketingAudienceId` - Remarketing audience ID of the remarketing audience to update. + /// * `accountId` - The account ID of the remarketing audience to update. + /// * `webPropertyId` - The web property ID of the remarketing audience to update. + /// * `remarketingAudienceId` - The ID of the remarketing audience to update. pub fn remarketing_audience_patch(&self, request: RemarketingAudience, account_id: &str, web_property_id: &str, remarketing_audience_id: &str) -> ManagementRemarketingAudiencePatchCall<'a, C, A> { ManagementRemarketingAudiencePatchCall { hub: self.hub, @@ -5030,8 +5033,8 @@ impl<'a, C, A> ManagementMethods<'a, C, A> { /// /// # Arguments /// - /// * `accountId` - Account ID for the remarketing audience to retrieve. - /// * `webPropertyId` - Web property ID for the remarketing audience to retrieve. + /// * `accountId` - The account ID of the remarketing audiences to retrieve. + /// * `webPropertyId` - The web property ID of the remarketing audiences to retrieve. pub fn remarketing_audience_list(&self, account_id: &str, web_property_id: &str) -> ManagementRemarketingAudienceListCall<'a, C, A> { ManagementRemarketingAudienceListCall { hub: self.hub, @@ -8814,7 +8817,7 @@ impl<'a, C, A> ManagementProfileFilterLinkDeleteCall<'a, C, A> where C: BorrowMu } -/// Updates an existing remarketing audiences. +/// Updates an existing remarketing audience. /// /// A builder for the *remarketingAudience.update* method supported by a *management* resource. /// It is not used directly, but through a `ManagementMethods` instance. @@ -9022,7 +9025,7 @@ impl<'a, C, A> ManagementRemarketingAudienceUpdateCall<'a, C, A> where C: Borrow self._request = new_value; self } - /// Account ID for the remarketing audience to update. + /// The account ID of the remarketing audience to update. /// /// Sets the *account id* path property to the given value. /// @@ -9032,7 +9035,7 @@ impl<'a, C, A> ManagementRemarketingAudienceUpdateCall<'a, C, A> where C: Borrow self._account_id = new_value.to_string(); self } - /// Web property ID for the remarketing audience to update. + /// The web property ID of the remarketing audience to update. /// /// Sets the *web property id* path property to the given value. /// @@ -9042,7 +9045,7 @@ impl<'a, C, A> ManagementRemarketingAudienceUpdateCall<'a, C, A> where C: Borrow self._web_property_id = new_value.to_string(); self } - /// Remarketing audience ID of the remarketing audience to update. + /// The ID of the remarketing audience to update. /// /// Sets the *remarketing audience id* path property to the given value. /// @@ -18581,7 +18584,7 @@ impl<'a, C, A> ManagementProfileUserLinkListCall<'a, C, A> where C: BorrowMut ManagementRemarketingAudienceInsertCall<'a, C, A> where C: Borrow self._request = new_value; self } - /// Account ID to create the remarketing audience for. + /// The account ID for which to create the remarketing audience. /// /// Sets the *account id* path property to the given value. /// @@ -18797,7 +18800,7 @@ impl<'a, C, A> ManagementRemarketingAudienceInsertCall<'a, C, A> where C: Borrow self._account_id = new_value.to_string(); self } - /// Web property ID to create the remarketing audience for. + /// Web property ID for which to create the remarketing audience. /// /// Sets the *web property id* path property to the given value. /// @@ -21847,7 +21850,7 @@ impl<'a, C, A> ManagementCustomDimensionGetCall<'a, C, A> where C: BorrowMut ManagementRemarketingAudienceGetCall<'a, C, A> where C: BorrowMut } - /// Account ID for the remarketing audience to retrieve. + /// The account ID of the remarketing audience to retrieve. /// /// Sets the *account id* path property to the given value. /// @@ -22034,7 +22037,7 @@ impl<'a, C, A> ManagementRemarketingAudienceGetCall<'a, C, A> where C: BorrowMut self._account_id = new_value.to_string(); self } - /// Web property ID for the remarketing audience to retrieve. + /// The web property ID of the remarketing audience to retrieve. /// /// Sets the *web property id* path property to the given value. /// @@ -22044,7 +22047,7 @@ impl<'a, C, A> ManagementRemarketingAudienceGetCall<'a, C, A> where C: BorrowMut self._web_property_id = new_value.to_string(); self } - /// The ID to retrieve the Remarketing Audience for. + /// The ID of the remarketing audience to retrieve. /// /// Sets the *remarketing audience id* path property to the given value. /// @@ -24890,7 +24893,7 @@ impl<'a, C, A> ManagementCustomMetricUpdateCall<'a, C, A> where C: BorrowMut ManagementRemarketingAudiencePatchCall<'a, C, A> where C: BorrowM self._request = new_value; self } - /// Account ID for the remarketing audience to update. + /// The account ID of the remarketing audience to update. /// /// Sets the *account id* path property to the given value. /// @@ -25108,7 +25111,7 @@ impl<'a, C, A> ManagementRemarketingAudiencePatchCall<'a, C, A> where C: BorrowM self._account_id = new_value.to_string(); self } - /// Web property ID for the remarketing audience to update. + /// The web property ID of the remarketing audience to update. /// /// Sets the *web property id* path property to the given value. /// @@ -25118,7 +25121,7 @@ impl<'a, C, A> ManagementRemarketingAudiencePatchCall<'a, C, A> where C: BorrowM self._web_property_id = new_value.to_string(); self } - /// Remarketing audience ID of the remarketing audience to update. + /// The ID of the remarketing audience to update. /// /// Sets the *remarketing audience id* path property to the given value. /// @@ -26981,7 +26984,7 @@ impl<'a, C, A> ManagementRemarketingAudienceListCall<'a, C, A> where C: BorrowMu } - /// Account ID for the remarketing audience to retrieve. + /// The account ID of the remarketing audiences to retrieve. /// /// Sets the *account id* path property to the given value. /// @@ -26991,7 +26994,7 @@ impl<'a, C, A> ManagementRemarketingAudienceListCall<'a, C, A> where C: BorrowMu self._account_id = new_value.to_string(); self } - /// Web property ID for the remarketing audience to retrieve. + /// The web property ID of the remarketing audiences to retrieve. /// /// Sets the *web property id* path property to the given value. /// diff --git a/gen/androidenterprise1-cli/Cargo.toml b/gen/androidenterprise1-cli/Cargo.toml index b3678ad471..c5a8682e0d 100644 --- a/gen/androidenterprise1-cli/Cargo.toml +++ b/gen/androidenterprise1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-androidenterprise1-cli" -version = "1.0.0+20160831" +version = "1.0.0+20161207" authors = ["Sebastian Thiel "] description = "A complete library to interact with Android Enterprise (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/androidenterprise1-cli" diff --git a/gen/androidenterprise1-cli/README.md b/gen/androidenterprise1-cli/README.md index f80477b4ca..cb7f306c13 100644 --- a/gen/androidenterprise1-cli/README.md +++ b/gen/androidenterprise1-cli/README.md @@ -24,7 +24,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Android Enterprise* API at revision *20160831*. The CLI is at version *1.0.0*. +This documentation was generated from the *Android Enterprise* API at revision *20161207*. The CLI is at version *1.0.0*. ```bash androidenterprise1 [options] @@ -49,6 +49,7 @@ androidenterprise1 [options] enterprises acknowledge-notification-set [-p ]... complete-signup [-p ]... [-o ] + create-web-token (-r )... [-p ]... [-o ] delete [-p ]... enroll (-r )... [-p ]... [-o ] generate-signup-url [-p ]... [-o ] diff --git a/gen/androidenterprise1-cli/mkdocs.yml b/gen/androidenterprise1-cli/mkdocs.yml index 624f798b88..6d602113cc 100644 --- a/gen/androidenterprise1-cli/mkdocs.yml +++ b/gen/androidenterprise1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Android Enterprise v1.0.0+20160831 +site_name: Android Enterprise v1.0.0+20161207 site_url: http://byron.github.io/google-apis-rs/google-androidenterprise1-cli site_description: Write integrating applications with bcore @@ -26,6 +26,7 @@ pages: - ['devices_set-state.md', 'Devices', 'Set State'] - ['enterprises_acknowledge-notification-set.md', 'Enterprises', 'Acknowledge Notification Set'] - ['enterprises_complete-signup.md', 'Enterprises', 'Complete Signup'] +- ['enterprises_create-web-token.md', 'Enterprises', 'Create Web Token'] - ['enterprises_delete.md', 'Enterprises', 'Delete'] - ['enterprises_enroll.md', 'Enterprises', 'Enroll'] - ['enterprises_generate-signup-url.md', 'Enterprises', 'Generate Signup Url'] diff --git a/gen/androidenterprise1-cli/src/main.rs b/gen/androidenterprise1-cli/src/main.rs index d4b460a374..9edea30b8a 100644 --- a/gen/androidenterprise1-cli/src/main.rs +++ b/gen/androidenterprise1-cli/src/main.rs @@ -1139,6 +1139,93 @@ impl<'n> Engine<'n> { } } + fn _enterprises_create_web_token(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "parent" => Some(("parent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "permission" => Some(("permission", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["kind", "parent", "permission"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::AdministratorWebTokenSpec = json::value::from_value(object).unwrap(); + let mut call = self.hub.enterprises().create_web_token(request, opt.value_of("enterprise-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _enterprises_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.enterprises().delete(opt.value_of("enterprise-id").unwrap_or("")); @@ -1846,8 +1933,9 @@ impl<'n> Engine<'n> { match &temp_cursor.to_string()[..] { "homepage-id" => Some(("homepageId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "store-layout-type" => Some(("storeLayoutType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["homepage-id", "kind"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["homepage-id", "kind", "store-layout-type"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -4020,12 +4108,13 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "public-data" => Some(("publicData", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "data" => Some(("data", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["data", "id", "kind", "type"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["data", "id", "kind", "public-data", "type"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -5512,9 +5601,10 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "product-set-behavior" => Some(("productSetBehavior", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "product-id" => Some(("productId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["kind", "product-id"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["kind", "product-id", "product-set-behavior"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -5747,6 +5837,9 @@ impl<'n> Engine<'n> { ("complete-signup", Some(opt)) => { call_result = self._enterprises_complete_signup(opt, dry_run, &mut err); }, + ("create-web-token", Some(opt)) => { + call_result = self._enterprises_create_web_token(opt, dry_run, &mut err); + }, ("delete", Some(opt)) => { call_result = self._enterprises_delete(opt, dry_run, &mut err); }, @@ -6627,7 +6720,7 @@ fn main() { ]), ]), - ("enterprises", "methods: 'acknowledge-notification-set', 'complete-signup', 'delete', 'enroll', 'generate-signup-url', 'get', 'get-service-account', 'get-store-layout', 'insert', 'list', 'pull-notification-set', 'send-test-push-notification', 'set-account', 'set-store-layout' and 'unenroll'", vec![ + ("enterprises", "methods: 'acknowledge-notification-set', 'complete-signup', 'create-web-token', 'delete', 'enroll', 'generate-signup-url', 'get', 'get-service-account', 'get-store-layout', 'insert', 'list', 'pull-notification-set', 'send-test-push-notification', 'set-account', 'set-store-layout' and 'unenroll'", vec![ ("acknowledge-notification-set", Some(r##"Acknowledges notifications that were received from Enterprises.PullNotificationSet to prevent subsequent calls from returning the same notifications."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/enterprises_acknowledge-notification-set", @@ -6648,6 +6741,34 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("create-web-token", + Some(r##"Returns a unique token to access an embeddable UI. To generate a web UI, pass the generated token into the Play for Work javascript API. Each token may only be used to start one UI session. See the javascript API documentation for further information."##), + "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/enterprises_create-web-token", + vec![ + (Some(r##"enterprise-id"##), + None, + Some(r##"The ID of the enterprise."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -6838,9 +6959,10 @@ fn main() { ]), ("pull-notification-set", Some(r##"Pulls and returns a notification set for the enterprises associated with the service account authenticated for the request. The notification set may be empty if no notification are pending. - A notification set returned needs to be acknowledged within 20 seconds by calling Enterprises.AcknowledgeNotificationSet, unless the notification set is empty. + A notification set returned needs to be acknowledged within 20 seconds by calling Enterprises​.AcknowledgeNotificationSet, unless the notification set is empty. Notifications that are not acknowledged within the 20 seconds will eventually be included again in the response to another PullNotificationSet request, and those that are never acknowledged will ultimately be deleted according to the Google Cloud Platform Pub/Sub system policy. - Multiple requests might be performed concurrently to retrieve notifications, in which case the pending notifications (if any) will be split among each caller, if any are pending."##), + Multiple requests might be performed concurrently to retrieve notifications, in which case the pending notifications (if any) will be split among each caller, if any are pending. + If no notifications are present, an empty notification list is returned. Subsequent requests may return more notifications once they become available."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/enterprises_pull-notification-set", vec![ (Some(r##"v"##), @@ -6906,7 +7028,7 @@ fn main() { Some(false)), ]), ("set-store-layout", - Some(r##"Sets the store layout for the enterprise."##), + Some(r##"Sets the store layout for the enterprise. By default, storeLayoutType is set to "basic" and the basic store layout is enabled. The basic layout only contains apps approved by the administrator, and that have been added to the available product set for a user (using the setAvailableProductSet call). Apps on the page are sorted in order of their product ID value. If you create a custom store layout (by setting storeLayoutType = "custom"), the basic store layout is disabled."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/enterprises_set-store-layout", vec![ (Some(r##"enterprise-id"##), @@ -8636,7 +8758,8 @@ fn main() { ("insert", Some(r##"Creates a new EMM-managed user. - The Users resource passed in the body of the request should include an accountIdentifier and an accountType."##), + The Users resource passed in the body of the request should include an accountIdentifier and an accountType. + If a corresponding user already exists with the same account identifier, the user will be updated with the resource. In this case only the displayName field can be changed."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/users_insert", vec![ (Some(r##"enterprise-id"##), @@ -8825,7 +8948,7 @@ fn main() { let mut app = App::new("androidenterprise1") .author("Sebastian Thiel ") - .version("1.0.0+20160831") + .version("1.0.0+20161207") .about("Manages the deployment of apps to Android for Work users.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli") .arg(Arg::with_name("url") diff --git a/gen/androidenterprise1/Cargo.toml b/gen/androidenterprise1/Cargo.toml index 4b4e4bfcbd..592e357f21 100644 --- a/gen/androidenterprise1/Cargo.toml +++ b/gen/androidenterprise1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-androidenterprise1" -version = "1.0.0+20160831" +version = "1.0.0+20161207" authors = ["Sebastian Thiel "] description = "A complete library to interact with Android Enterprise (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/androidenterprise1" diff --git a/gen/androidenterprise1/README.md b/gen/androidenterprise1/README.md index e8f2270f1c..4eadeb9163 100644 --- a/gen/androidenterprise1/README.md +++ b/gen/androidenterprise1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-androidenterprise1` library allows access to all features of the *Google Android Enterprise* service. -This documentation was generated from *Android Enterprise* crate version *1.0.0+20160831*, where *20160831* is the exact revision of the *androidenterprise:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *Android Enterprise* crate version *1.0.0+20161207*, where *20161207* is the exact revision of the *androidenterprise:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *Android Enterprise* *v1* API can be found at the [official documentation site](https://developers.google.com/android/work/play/emm-api). @@ -20,7 +20,7 @@ Handle the following *Resources* with ease from the central [hub](http://byron.g * [devices](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.Device.html) * [*get*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.DeviceGetCall.html), [*get state*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.DeviceGetStateCall.html), [*list*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.DeviceListCall.html) and [*set state*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.DeviceSetStateCall.html) * [enterprises](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.Enterprise.html) - * [*acknowledge notification set*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseAcknowledgeNotificationSetCall.html), [*complete signup*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseCompleteSignupCall.html), [*delete*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseDeleteCall.html), [*enroll*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseEnrollCall.html), [*generate signup url*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseGenerateSignupUrlCall.html), [*get*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseGetCall.html), [*get service account*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseGetServiceAccountCall.html), [*get store layout*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseGetStoreLayoutCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseListCall.html), [*pull notification set*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterprisePullNotificationSetCall.html), [*send test push notification*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseSendTestPushNotificationCall.html), [*set account*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseSetAccountCall.html), [*set store layout*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseSetStoreLayoutCall.html) and [*unenroll*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseUnenrollCall.html) + * [*acknowledge notification set*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseAcknowledgeNotificationSetCall.html), [*complete signup*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseCompleteSignupCall.html), [*create web token*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseCreateWebTokenCall.html), [*delete*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseDeleteCall.html), [*enroll*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseEnrollCall.html), [*generate signup url*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseGenerateSignupUrlCall.html), [*get*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseGetCall.html), [*get service account*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseGetServiceAccountCall.html), [*get store layout*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseGetStoreLayoutCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseListCall.html), [*pull notification set*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterprisePullNotificationSetCall.html), [*send test push notification*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseSendTestPushNotificationCall.html), [*set account*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseSetAccountCall.html), [*set store layout*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseSetStoreLayoutCall.html) and [*unenroll*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseUnenrollCall.html) * [entitlements](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.Entitlement.html) * [*delete*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EntitlementDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EntitlementGetCall.html), [*list*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EntitlementListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EntitlementPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EntitlementUpdateCall.html) * grouplicenses @@ -78,20 +78,21 @@ Or specifically ... ```ignore let r = hub.enterprises().send_test_push_notification(...).doit() -let r = hub.enterprises().get_store_layout(...).doit() +let r = hub.enterprises().generate_signup_url(...).doit() let r = hub.enterprises().get_service_account(...).doit() let r = hub.enterprises().acknowledge_notification_set(...).doit() let r = hub.enterprises().set_store_layout(...).doit() -let r = hub.enterprises().insert(...).doit() -let r = hub.enterprises().complete_signup(...).doit() -let r = hub.enterprises().list(...).doit() -let r = hub.enterprises().unenroll(...).doit() -let r = hub.enterprises().set_account(...).doit() +let r = hub.enterprises().get_store_layout(...).doit() let r = hub.enterprises().pull_notification_set(...).doit() -let r = hub.enterprises().enroll(...).doit() -let r = hub.enterprises().get(...).doit() +let r = hub.enterprises().list(...).doit() +let r = hub.enterprises().complete_signup(...).doit() +let r = hub.enterprises().set_account(...).doit() let r = hub.enterprises().delete(...).doit() -let r = hub.enterprises().generate_signup_url(...).doit() +let r = hub.enterprises().enroll(...).doit() +let r = hub.enterprises().create_web_token(...).doit() +let r = hub.enterprises().insert(...).doit() +let r = hub.enterprises().get(...).doit() +let r = hub.enterprises().unenroll(...).doit() ``` The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` diff --git a/gen/androidenterprise1/src/lib.rs b/gen/androidenterprise1/src/lib.rs index 49d87e519d..7a43da6cb6 100644 --- a/gen/androidenterprise1/src/lib.rs +++ b/gen/androidenterprise1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Android Enterprise* crate version *1.0.0+20160831*, where *20160831* is the exact revision of the *androidenterprise:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *Android Enterprise* crate version *1.0.0+20161207*, where *20161207* is the exact revision of the *androidenterprise:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *Android Enterprise* *v1* API can be found at the //! [official documentation site](https://developers.google.com/android/work/play/emm-api). @@ -18,7 +18,7 @@ //! * [devices](struct.Device.html) //! * [*get*](struct.DeviceGetCall.html), [*get state*](struct.DeviceGetStateCall.html), [*list*](struct.DeviceListCall.html) and [*set state*](struct.DeviceSetStateCall.html) //! * [enterprises](struct.Enterprise.html) -//! * [*acknowledge notification set*](struct.EnterpriseAcknowledgeNotificationSetCall.html), [*complete signup*](struct.EnterpriseCompleteSignupCall.html), [*delete*](struct.EnterpriseDeleteCall.html), [*enroll*](struct.EnterpriseEnrollCall.html), [*generate signup url*](struct.EnterpriseGenerateSignupUrlCall.html), [*get*](struct.EnterpriseGetCall.html), [*get service account*](struct.EnterpriseGetServiceAccountCall.html), [*get store layout*](struct.EnterpriseGetStoreLayoutCall.html), [*insert*](struct.EnterpriseInsertCall.html), [*list*](struct.EnterpriseListCall.html), [*pull notification set*](struct.EnterprisePullNotificationSetCall.html), [*send test push notification*](struct.EnterpriseSendTestPushNotificationCall.html), [*set account*](struct.EnterpriseSetAccountCall.html), [*set store layout*](struct.EnterpriseSetStoreLayoutCall.html) and [*unenroll*](struct.EnterpriseUnenrollCall.html) +//! * [*acknowledge notification set*](struct.EnterpriseAcknowledgeNotificationSetCall.html), [*complete signup*](struct.EnterpriseCompleteSignupCall.html), [*create web token*](struct.EnterpriseCreateWebTokenCall.html), [*delete*](struct.EnterpriseDeleteCall.html), [*enroll*](struct.EnterpriseEnrollCall.html), [*generate signup url*](struct.EnterpriseGenerateSignupUrlCall.html), [*get*](struct.EnterpriseGetCall.html), [*get service account*](struct.EnterpriseGetServiceAccountCall.html), [*get store layout*](struct.EnterpriseGetStoreLayoutCall.html), [*insert*](struct.EnterpriseInsertCall.html), [*list*](struct.EnterpriseListCall.html), [*pull notification set*](struct.EnterprisePullNotificationSetCall.html), [*send test push notification*](struct.EnterpriseSendTestPushNotificationCall.html), [*set account*](struct.EnterpriseSetAccountCall.html), [*set store layout*](struct.EnterpriseSetStoreLayoutCall.html) and [*unenroll*](struct.EnterpriseUnenrollCall.html) //! * [entitlements](struct.Entitlement.html) //! * [*delete*](struct.EntitlementDeleteCall.html), [*get*](struct.EntitlementGetCall.html), [*list*](struct.EntitlementListCall.html), [*patch*](struct.EntitlementPatchCall.html) and [*update*](struct.EntitlementUpdateCall.html) //! * grouplicenses @@ -78,20 +78,21 @@ //! //! ```ignore //! let r = hub.enterprises().send_test_push_notification(...).doit() -//! let r = hub.enterprises().get_store_layout(...).doit() +//! let r = hub.enterprises().generate_signup_url(...).doit() //! let r = hub.enterprises().get_service_account(...).doit() //! let r = hub.enterprises().acknowledge_notification_set(...).doit() //! let r = hub.enterprises().set_store_layout(...).doit() -//! let r = hub.enterprises().insert(...).doit() -//! let r = hub.enterprises().complete_signup(...).doit() -//! let r = hub.enterprises().list(...).doit() -//! let r = hub.enterprises().unenroll(...).doit() -//! let r = hub.enterprises().set_account(...).doit() +//! let r = hub.enterprises().get_store_layout(...).doit() //! let r = hub.enterprises().pull_notification_set(...).doit() -//! let r = hub.enterprises().enroll(...).doit() -//! let r = hub.enterprises().get(...).doit() +//! let r = hub.enterprises().list(...).doit() +//! let r = hub.enterprises().complete_signup(...).doit() +//! let r = hub.enterprises().set_account(...).doit() //! let r = hub.enterprises().delete(...).doit() -//! let r = hub.enterprises().generate_signup_url(...).doit() +//! let r = hub.enterprises().enroll(...).doit() +//! let r = hub.enterprises().create_web_token(...).doit() +//! let r = hub.enterprises().insert(...).doit() +//! let r = hub.enterprises().get(...).doit() +//! let r = hub.enterprises().unenroll(...).doit() //! ``` //! //! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -138,7 +139,7 @@ //! // execute the final call using `doit()`. //! // Values shown here are possibly random and not representative ! //! let result = hub.enterprises().get_service_account("enterpriseId") -//! .key_type("dolor") +//! .key_type("aliquyam") //! .doit(); //! //! match result { diff --git a/gen/androidenterprise1/src/lib.rs.in b/gen/androidenterprise1/src/lib.rs.in index 8957459401..4fa4da1608 100644 --- a/gen/androidenterprise1/src/lib.rs.in +++ b/gen/androidenterprise1/src/lib.rs.in @@ -355,6 +355,9 @@ pub struct ProductSet { /// The list of product IDs making up the set of products. #[serde(rename="productId")] pub product_id: Option>, + /// The interpretation of this product set. "unknown" should never be sent and ignored if received. "whitelist" means that this product set constitutes a whitelist. "includeAll" means that all products are accessible, including products that are approved, not approved, and even products where approval has been revoked. If the value is "includeAll", the value of the productId field is therefore ignored. If a value is not supplied, it is interpreted to be "whitelist" for backwards compatibility. + #[serde(rename="productSetBehavior")] + pub product_set_behavior: Option, } impl RequestValue for ProductSet {} @@ -828,13 +831,13 @@ pub struct AppRestrictionsSchemaRestriction { pub description: Option, /// The name of the restriction. pub title: Option, - /// The default value of the restriction. + /// The default value of the restriction. bundle and bundleArray restrictions never have a default value. #[serde(rename="defaultValue")] pub default_value: Option, - /// For bundle or bundleArray restrictions, the list of nested restrictions. + /// For bundle or bundleArray restrictions, the list of nested restrictions. A bundle restriction is always nested within a bundleArray restriction, and a bundleArray restriction is at most two levels deep. #[serde(rename="nestedRestriction")] pub nested_restriction: Option>, - /// For choice or multiselect restrictions, the list of possible entries' machine-readable values. + /// For choice or multiselect restrictions, the list of possible entries' machine-readable values. These values should be used in the configuration, either as a single string value for a choice restriction or in a stringArray for a multiselect restriction. #[serde(rename="entryValue")] pub entry_value: Option>, /// The unique key that the product uses to identify the restriction, e.g. "com.google.android.gm.fieldname". @@ -1035,11 +1038,12 @@ pub struct Device { #[serde(rename="androidId")] pub android_id: Option, /// Identifies the extent to which the device is controlled by an Android for Work EMM in various deployment configurations. + /// /// Possible values include: - /// - "managedDevice"—A device that has the EMM's device policy controller (DPC) as the device owner. - /// - "managedProfile"—A device that has a work profile managed by the DPC (DPC is profile owner) in addition to a separate, personal profile that is unavailable to the DPC. - /// - "containerApp"—A device running the Android for Work App. The Android for Work App is managed by the DPC. - /// - "unmanagedProfile"—A device that has been allowed (by the domain's admin, using the Admin Console to enable the privilege) to use Android for Work apps or Google Apps for Work, but the profile is itself not owned by a DPC. + /// - "managedDevice", a device that has the EMM's device policy controller (DPC) as the device owner, + /// - "managedProfile", a device that has a work profile managed by the DPC (DPC is profile owner) in addition to a separate, personal profile that is unavailable to the DPC, + /// - "containerApp", a device running the Android for Work App. The Android for Work App is managed by the DPC, + /// - "unmanagedProfile", a device that has been allowed (by the domain's admin, using the Admin Console to enable the privilege) to use Android for Work apps or Google Apps for Work, but the profile is itself not owned by a DPC. #[serde(rename="managementType")] pub management_type: Option, } @@ -1144,20 +1148,21 @@ impl ResponseResult for Install {} /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [send test push notification enterprises](struct.EnterpriseSendTestPushNotificationCall.html) (none) -/// * [get store layout enterprises](struct.EnterpriseGetStoreLayoutCall.html) (none) +/// * [generate signup url enterprises](struct.EnterpriseGenerateSignupUrlCall.html) (none) /// * [get service account enterprises](struct.EnterpriseGetServiceAccountCall.html) (none) /// * [acknowledge notification set enterprises](struct.EnterpriseAcknowledgeNotificationSetCall.html) (none) /// * [set store layout enterprises](struct.EnterpriseSetStoreLayoutCall.html) (none) -/// * [insert enterprises](struct.EnterpriseInsertCall.html) (request|response) -/// * [complete signup enterprises](struct.EnterpriseCompleteSignupCall.html) (response) -/// * [list enterprises](struct.EnterpriseListCall.html) (none) -/// * [unenroll enterprises](struct.EnterpriseUnenrollCall.html) (none) -/// * [set account enterprises](struct.EnterpriseSetAccountCall.html) (none) +/// * [get store layout enterprises](struct.EnterpriseGetStoreLayoutCall.html) (none) /// * [pull notification set enterprises](struct.EnterprisePullNotificationSetCall.html) (none) -/// * [enroll enterprises](struct.EnterpriseEnrollCall.html) (request|response) -/// * [get enterprises](struct.EnterpriseGetCall.html) (response) +/// * [list enterprises](struct.EnterpriseListCall.html) (none) +/// * [complete signup enterprises](struct.EnterpriseCompleteSignupCall.html) (response) +/// * [set account enterprises](struct.EnterpriseSetAccountCall.html) (none) /// * [delete enterprises](struct.EnterpriseDeleteCall.html) (none) -/// * [generate signup url enterprises](struct.EnterpriseGenerateSignupUrlCall.html) (none) +/// * [enroll enterprises](struct.EnterpriseEnrollCall.html) (request|response) +/// * [create web token enterprises](struct.EnterpriseCreateWebTokenCall.html) (none) +/// * [insert enterprises](struct.EnterpriseInsertCall.html) (request|response) +/// * [get enterprises](struct.EnterpriseGetCall.html) (response) +/// * [unenroll enterprises](struct.EnterpriseUnenrollCall.html) (none) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Enterprise { @@ -1228,6 +1233,28 @@ pub struct UserToken { impl ResponseResult for UserToken {} +/// Specification for a token used to generate iframes. The token specifies what data the admin is allowed to modify and the URI the iframe is allowed to communiate with. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [create web token enterprises](struct.EnterpriseCreateWebTokenCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AdministratorWebTokenSpec { + /// Identifies what kind of resource this is. Value: the fixed string "androidenterprise#administratorWebTokenSpec". + pub kind: Option, + /// The URI of the parent frame hosting the iframe. To prevent XSS, the iframe may not be hosted at other URIs. This URI must be https. + pub parent: Option, + /// The list of permissions the admin is granted within the iframe. The admin will only be allowed to view an iframe if they have all of the permissions associated with it. The only valid value is "approveApps" that will allow the admin to access the iframe in "approve" mode. + pub permission: Option>, +} + +impl RequestValue for AdministratorWebTokenSpec {} + + /// An event generated when a new version of an app is uploaded to Google Play. Notifications are sent for new public versions only: alpha, beta, or canary versions do not generate this event. To fetch up-to-date version history for an app, use Products.Get on the EMM API. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1242,6 +1269,26 @@ pub struct AppUpdateEvent { impl Part for AppUpdateEvent {} +/// A token authorizing an administrator to access an iframe. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [create web token enterprises](struct.EnterpriseCreateWebTokenCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AdministratorWebToken { + /// Identifies what kind of resource this is. Value: the fixed string "androidenterprise#administratorWebToken". + pub kind: Option, + /// An opaque token to be passed to the Play front-end to generate an iframe. + pub token: Option, +} + +impl ResponseResult for AdministratorWebToken {} + + /// The user resources for the collection. /// /// # Activities @@ -1337,6 +1384,9 @@ pub struct StoreLayout { pub homepage_id: Option, /// Identifies what kind of resource this is. Value: the fixed string "androidenterprise#storeLayout". pub kind: Option, + /// The store layout type. By default, this value is set to "basic". If set to "custom", "homepageId" must be specified. If set to "basic", the layout will consist of all approved apps accessible by the user, split in pages of 100 each; in this case, "homepageId" must not be specified. The "basic" setting takes precedence over any existing collections setup for this enterprise (if any). Should the enterprise use collectionViewers for controlling access rights, these will still be respected. + #[serde(rename="storeLayoutType")] + pub store_layout_type: Option, } impl RequestValue for StoreLayout {} @@ -1354,15 +1404,18 @@ impl ResponseResult for StoreLayout {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ServiceAccountKey { - /// The body of the private key credentials file, in string format. This is only populated when the ServiceAccountKey is created, and is not stored by Google. - pub data: Option, + /// Public key data for the credentials file. This is an X.509 cert. If you are using the googleCredentials key type, this is identical to the cert that can be retrieved by using the X.509 cert url inside of the credentials file. + #[serde(rename="publicData")] + pub public_data: Option, /// Identifies what kind of resource this is. Value: the fixed string "androidenterprise#serviceAccountKey". pub kind: Option, + /// The body of the private key credentials file, in string format. This is only populated when the ServiceAccountKey is created, and is not stored by Google. + pub data: Option, + /// An opaque, unique identifier for this ServiceAccountKey. Assigned by the server. + pub id: Option, /// The file format of the generated key data. #[serde(rename="type")] pub type_: Option, - /// An opaque, unique identifier for this ServiceAccountKey. Assigned by the server. - pub id: Option, } impl RequestValue for ServiceAccountKey {} @@ -2152,6 +2205,7 @@ impl<'a, C, A> UserMethods<'a, C, A> { /// Creates a new EMM-managed user. /// /// The Users resource passed in the body of the request should include an accountIdentifier and an accountType. + /// If a corresponding user already exists with the same account identifier, the user will be updated with the resource. In this case only the displayName field can be changed. /// /// # Arguments /// @@ -2792,7 +2846,7 @@ impl<'a, C, A> DeviceMethods<'a, C, A> { /// ::default(), None); /// let mut hub = AndroidEnterprise::new(hyper::Client::new(), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `acknowledge_notification_set(...)`, `complete_signup(...)`, `delete(...)`, `enroll(...)`, `generate_signup_url(...)`, `get(...)`, `get_service_account(...)`, `get_store_layout(...)`, `insert(...)`, `list(...)`, `pull_notification_set(...)`, `send_test_push_notification(...)`, `set_account(...)`, `set_store_layout(...)` and `unenroll(...)` +/// // like `acknowledge_notification_set(...)`, `complete_signup(...)`, `create_web_token(...)`, `delete(...)`, `enroll(...)`, `generate_signup_url(...)`, `get(...)`, `get_service_account(...)`, `get_store_layout(...)`, `insert(...)`, `list(...)`, `pull_notification_set(...)`, `send_test_push_notification(...)`, `set_account(...)`, `set_store_layout(...)` and `unenroll(...)` /// // to build up your call. /// let rb = hub.enterprises(); /// # } @@ -2828,7 +2882,7 @@ impl<'a, C, A> EnterpriseMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Sets the store layout for the enterprise. + /// Sets the store layout for the enterprise. By default, storeLayoutType is set to "basic" and the basic store layout is enabled. The basic layout only contains apps approved by the administrator, and that have been added to the available product set for a user (using the setAvailableProductSet call). Apps on the page are sorted in order of their product ID value. If you create a custom store layout (by setting storeLayoutType = "custom"), the basic store layout is disabled. /// /// # Arguments /// @@ -2848,9 +2902,10 @@ impl<'a, C, A> EnterpriseMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// /// Pulls and returns a notification set for the enterprises associated with the service account authenticated for the request. The notification set may be empty if no notification are pending. - /// A notification set returned needs to be acknowledged within 20 seconds by calling Enterprises.AcknowledgeNotificationSet, unless the notification set is empty. + /// A notification set returned needs to be acknowledged within 20 seconds by calling Enterprises​.AcknowledgeNotificationSet, unless the notification set is empty. /// Notifications that are not acknowledged within the 20 seconds will eventually be included again in the response to another PullNotificationSet request, and those that are never acknowledged will ultimately be deleted according to the Google Cloud Platform Pub/Sub system policy. /// Multiple requests might be performed concurrently to retrieve notifications, in which case the pending notifications (if any) will be split among each caller, if any are pending. + /// If no notifications are present, an empty notification list is returned. Subsequent requests may return more notifications once they become available. pub fn pull_notification_set(&self) -> EnterprisePullNotificationSetCall<'a, C, A> { EnterprisePullNotificationSetCall { hub: self.hub, @@ -2899,6 +2954,25 @@ impl<'a, C, A> EnterpriseMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Returns a unique token to access an embeddable UI. To generate a web UI, pass the generated token into the Play for Work javascript API. Each token may only be used to start one UI session. See the javascript API documentation for further information. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `enterpriseId` - The ID of the enterprise. + pub fn create_web_token(&self, request: AdministratorWebTokenSpec, enterprise_id: &str) -> EnterpriseCreateWebTokenCall<'a, C, A> { + EnterpriseCreateWebTokenCall { + hub: self.hub, + _request: request, + _enterprise_id: enterprise_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Looks up an enterprise by domain name. This is only supported for enterprises created via the Google-initiated creation flow. Lookup of the id is not needed for enterprises created via the EMM-initiated flow since the EMM learns the enterprise ID in the callback specified in the Enterprises.generateSignupUrl call. @@ -8569,6 +8643,7 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth /// Creates a new EMM-managed user. /// /// The Users resource passed in the body of the request should include an accountIdentifier and an accountType. +/// If a corresponding user already exists with the same account identifier, the user will be updated with the resource. In this case only the displayName field can be changed. /// /// A builder for the *insert* method supported by a *user* resource. /// It is not used directly, but through a `UserMethods` instance. @@ -14385,7 +14460,7 @@ impl<'a, C, A> EnterpriseInsertCall<'a, C, A> where C: BorrowMut, } -/// Sets the store layout for the enterprise. +/// Sets the store layout for the enterprise. By default, storeLayoutType is set to "basic" and the basic store layout is enabled. The basic layout only contains apps approved by the administrator, and that have been added to the available product set for a user (using the setAvailableProductSet call). Apps on the page are sorted in order of their product ID value. If you create a custom store layout (by setting storeLayoutType = "custom"), the basic store layout is disabled. /// /// A builder for the *setStoreLayout* method supported by a *enterprise* resource. /// It is not used directly, but through a `EnterpriseMethods` instance. @@ -14652,9 +14727,10 @@ impl<'a, C, A> EnterpriseSetStoreLayoutCall<'a, C, A> where C: BorrowMut EnterprisePullNotificationSetCall<'a, C, A> where C: BorrowMut EnterprisePullNotificationSetCall<'a, C, A> { @@ -15380,6 +15458,272 @@ impl<'a, C, A> EnterpriseSetAccountCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = AndroidEnterprise::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = AdministratorWebTokenSpec::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.enterprises().create_web_token(req, "enterpriseId") +/// .doit(); +/// # } +/// ``` +pub struct EnterpriseCreateWebTokenCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidEnterprise, + _request: AdministratorWebTokenSpec, + _enterprise_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EnterpriseCreateWebTokenCall<'a, C, A> {} + +impl<'a, C, A> EnterpriseCreateWebTokenCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AdministratorWebToken)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "androidenterprise.enterprises.createWebToken", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("enterpriseId", self._enterprise_id.to_string())); + for &field in ["alt", "enterpriseId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/androidenterprise/v1/enterprises/{enterpriseId}/createWebToken".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["enterpriseId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: AdministratorWebTokenSpec) -> EnterpriseCreateWebTokenCall<'a, C, A> { + self._request = new_value; + self + } + /// The ID of the enterprise. + /// + /// Sets the *enterprise id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn enterprise_id(mut self, new_value: &str) -> EnterpriseCreateWebTokenCall<'a, C, A> { + self._enterprise_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> EnterpriseCreateWebTokenCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> EnterpriseCreateWebTokenCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> EnterpriseCreateWebTokenCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + /// Looks up an enterprise by domain name. This is only supported for enterprises created via the Google-initiated creation flow. Lookup of the id is not needed for enterprises created via the EMM-initiated flow since the EMM learns the enterprise ID in the callback specified in the Enterprises.generateSignupUrl call. /// /// A builder for the *list* method supported by a *enterprise* resource. @@ -15856,8 +16200,8 @@ impl<'a, C, A> EnterpriseGetStoreLayoutCall<'a, C, A> where C: BorrowMut EnterpriseCompleteSignupCall<'a, C, A> where C: BorrowMut EnterpriseGetServiceAccountCall<'a, C, A> where C: BorrowMut EnterpriseDeleteCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.enterprises().generate_signup_url() -/// .callback_url("dolores") +/// .callback_url("sit") /// .doit(); /// # } /// ``` @@ -20315,7 +20659,7 @@ impl<'a, C, A> ProductUpdatePermissionCall<'a, C, A> where C: BorrowMut ProductGetAppRestrictionsSchemaCall<'a, C, A> where C: BorrowMut< /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.products().list("enterpriseId") -/// .token("Lorem") -/// .query("clita") -/// .max_results(64) -/// .language("eirmod") +/// .token("clita") +/// .query("invidunt") +/// .max_results(11) +/// .language("At") /// .approved(false) /// .doit(); /// # } @@ -20869,7 +21213,7 @@ impl<'a, C, A> ProductListCall<'a, C, A> where C: BorrowMut, A: o /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.products().get("enterpriseId", "productId") -/// .language("sed") +/// .language("sit") /// .doit(); /// # } /// ``` @@ -21130,7 +21474,7 @@ impl<'a, C, A> ProductGetCall<'a, C, A> where C: BorrowMut, A: oa /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.products().generate_approval_url("enterpriseId", "productId") -/// .language_code("elitr") +/// .language_code("nonumy") /// .doit(); /// # } /// ``` @@ -24032,7 +24376,7 @@ impl<'a, C, A> EntitlementDeleteCall<'a, C, A> where C: BorrowMut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.entitlements().patch(req, "enterpriseId", "userId", "entitlementId") -/// .install(false) +/// .install(true) /// .doit(); /// # } /// ``` @@ -26607,7 +26951,7 @@ impl<'a, C, A> ServiceaccountkeyDeleteCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with Android Publisher (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/androidpublisher2-cli" diff --git a/gen/androidpublisher2-cli/README.md b/gen/androidpublisher2-cli/README.md index 510119bb83..cf66d9e8fc 100644 --- a/gen/androidpublisher2-cli/README.md +++ b/gen/androidpublisher2-cli/README.md @@ -24,7 +24,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Android Publisher* API at revision *20160817*. The CLI is at version *1.0.0*. +This documentation was generated from the *Android Publisher* API at revision *20161212*. The CLI is at version *1.0.0*. ```bash androidpublisher2 [options] @@ -40,6 +40,7 @@ androidpublisher2 [options] apks-upload (-u (simple|resumable) -f [-m ]) [-p ]... [-o ] commit [-p ]... [-o ] delete [-p ]... + deobfuscationfiles-upload (-u (simple|resumable) -f [-m ]) [-p ]... [-o ] details-get [-p ]... [-o ] details-patch (-r )... [-p ]... [-o ] details-update (-r )... [-p ]... [-o ] @@ -84,6 +85,7 @@ androidpublisher2 [options] subscriptions-get [-p ]... [-o ] subscriptions-refund [-p ]... subscriptions-revoke [-p ]... + voidedpurchases-list [-p ]... [-o ] reviews get [-p ]... [-o ] list [-p ]... [-o ] diff --git a/gen/androidpublisher2-cli/mkdocs.yml b/gen/androidpublisher2-cli/mkdocs.yml index a0fa9e78d4..f2e38c7c22 100644 --- a/gen/androidpublisher2-cli/mkdocs.yml +++ b/gen/androidpublisher2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Android Publisher v1.0.0+20160817 +site_name: Android Publisher v1.0.0+20161212 site_url: http://byron.github.io/google-apis-rs/google-androidpublisher2-cli site_description: Write integrating applications with bcore @@ -20,6 +20,7 @@ pages: - ['edits_apks-upload.md', 'Edits', 'Apks Upload'] - ['edits_commit.md', 'Edits', 'Commit'] - ['edits_delete.md', 'Edits', 'Delete'] +- ['edits_deobfuscationfiles-upload.md', 'Edits', 'Deobfuscationfiles Upload'] - ['edits_details-get.md', 'Edits', 'Details Get'] - ['edits_details-patch.md', 'Edits', 'Details Patch'] - ['edits_details-update.md', 'Edits', 'Details Update'] @@ -61,6 +62,7 @@ pages: - ['purchases_subscriptions-get.md', 'Purchases', 'Subscriptions Get'] - ['purchases_subscriptions-refund.md', 'Purchases', 'Subscriptions Refund'] - ['purchases_subscriptions-revoke.md', 'Purchases', 'Subscriptions Revoke'] +- ['purchases_voidedpurchases-list.md', 'Purchases', 'Voidedpurchases List'] - ['reviews_get.md', 'Reviews', 'Get'] - ['reviews_list.md', 'Reviews', 'List'] - ['reviews_reply.md', 'Reviews', 'Reply'] diff --git a/gen/androidpublisher2-cli/src/main.rs b/gen/androidpublisher2-cli/src/main.rs index 24063850ba..a95b487f07 100644 --- a/gen/androidpublisher2-cli/src/main.rs +++ b/gen/androidpublisher2-cli/src/main.rs @@ -717,6 +717,63 @@ impl<'n> Engine<'n> { } } + fn _edits_deobfuscationfiles_upload(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let apk_version_code: i32 = arg_from_str(&opt.value_of("apk-version-code").unwrap_or(""), err, "", "integer"); + let mut call = self.hub.edits().deobfuscationfiles_upload(opt.value_of("package-name").unwrap_or(""), opt.value_of("edit-id").unwrap_or(""), apk_version_code, opt.value_of("deobfuscation-file-type").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let vals = opt.values_of("mode").unwrap().collect::>(); + let protocol = calltype_from_str(vals[0], ["simple", "resumable"].iter().map(|&v| v.to_string()).collect(), err); + let mut input_file = input_file_from_opts(vals[1], err); + let mime_type = input_mime_from_opts(opt.value_of("mime").unwrap_or("application/octet-stream"), err); + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Upload(UploadProtocol::Simple) => call.upload(input_file.unwrap(), mime_type.unwrap()), + CallType::Upload(UploadProtocol::Resumable) => call.upload_resumable(input_file.unwrap(), mime_type.unwrap()), + CallType::Standard => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _edits_details_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.edits().details_get(opt.value_of("package-name").unwrap_or(""), opt.value_of("edit-id").unwrap_or("")); @@ -3424,12 +3481,27 @@ impl<'n> Engine<'n> { } } - fn _reviews_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + fn _purchases_voidedpurchases_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { - let mut call = self.hub.reviews().get(opt.value_of("package-name").unwrap_or(""), opt.value_of("review-id").unwrap_or("")); + let mut call = self.hub.purchases().voidedpurchases_list(opt.value_of("package-name").unwrap_or("")); for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { + "token" => { + call = call.token(value.unwrap_or("")); + }, + "start-time" => { + call = call.start_time(value.unwrap_or("")); + }, + "start-index" => { + call = call.start_index(arg_from_str(value.unwrap_or("-0"), err, "start-index", "integer")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "end-time" => { + call = call.end_time(value.unwrap_or("")); + }, _ => { let mut found = false; for param in &self.gp { @@ -3443,6 +3515,63 @@ impl<'n> Engine<'n> { err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); + v.extend(["token", "end-time", "max-results", "start-index", "start-time"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _reviews_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.reviews().get(opt.value_of("package-name").unwrap_or(""), opt.value_of("review-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "translation-language" => { + call = call.translation_language(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["translation-language"].iter().map(|v|*v)); v } )); } } @@ -3482,6 +3611,9 @@ impl<'n> Engine<'n> { for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { + "translation-language" => { + call = call.translation_language(value.unwrap_or("")); + }, "token" => { call = call.token(value.unwrap_or("")); }, @@ -3504,7 +3636,7 @@ impl<'n> Engine<'n> { err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); - v.extend(["token", "start-index", "max-results"].iter().map(|v|*v)); + v.extend(["token", "translation-language", "start-index", "max-results"].iter().map(|v|*v)); v } )); } } @@ -3663,6 +3795,9 @@ impl<'n> Engine<'n> { ("delete", Some(opt)) => { call_result = self._edits_delete(opt, dry_run, &mut err); }, + ("deobfuscationfiles-upload", Some(opt)) => { + call_result = self._edits_deobfuscationfiles_upload(opt, dry_run, &mut err); + }, ("details-get", Some(opt)) => { call_result = self._edits_details_get(opt, dry_run, &mut err); }, @@ -3810,6 +3945,9 @@ impl<'n> Engine<'n> { ("subscriptions-revoke", Some(opt)) => { call_result = self._purchases_subscriptions_revoke(opt, dry_run, &mut err); }, + ("voidedpurchases-list", Some(opt)) => { + call_result = self._purchases_voidedpurchases_list(opt, dry_run, &mut err); + }, _ => { err.issues.push(CLIError::MissingMethodError("purchases".to_string())); writeln!(io::stderr(), "{}\n", opt.usage()).ok(); @@ -3916,7 +4054,7 @@ fn main() { let mut exit_status = 0i32; let upload_value_names = ["mode", "file"]; let arg_data = [ - ("edits", "methods: 'apklistings-delete', 'apklistings-deleteall', 'apklistings-get', 'apklistings-list', 'apklistings-patch', 'apklistings-update', 'apks-addexternallyhosted', 'apks-list', 'apks-upload', 'commit', 'delete', 'details-get', 'details-patch', 'details-update', 'expansionfiles-get', 'expansionfiles-patch', 'expansionfiles-update', 'expansionfiles-upload', 'get', 'images-delete', 'images-deleteall', 'images-list', 'images-upload', 'insert', 'listings-delete', 'listings-deleteall', 'listings-get', 'listings-list', 'listings-patch', 'listings-update', 'testers-get', 'testers-patch', 'testers-update', 'tracks-get', 'tracks-list', 'tracks-patch', 'tracks-update' and 'validate'", vec![ + ("edits", "methods: 'apklistings-delete', 'apklistings-deleteall', 'apklistings-get', 'apklistings-list', 'apklistings-patch', 'apklistings-update', 'apks-addexternallyhosted', 'apks-list', 'apks-upload', 'commit', 'delete', 'deobfuscationfiles-upload', 'details-get', 'details-patch', 'details-update', 'expansionfiles-get', 'expansionfiles-patch', 'expansionfiles-update', 'expansionfiles-upload', 'get', 'images-delete', 'images-deleteall', 'images-list', 'images-upload', 'insert', 'listings-delete', 'listings-deleteall', 'listings-get', 'listings-list', 'listings-patch', 'listings-update', 'testers-get', 'testers-patch', 'testers-update', 'tracks-get', 'tracks-list', 'tracks-patch', 'tracks-update' and 'validate'", vec![ ("apklistings-delete", Some(r##"Deletes the APK-specific localized listing for a specified APK and language code."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/edits_apklistings-delete", @@ -4291,6 +4429,52 @@ fn main() { Some(false), Some(true)), ]), + ("deobfuscationfiles-upload", + Some(r##"Uploads the deobfuscation file of the specified APK. If a deobfuscation file already exists, it will be replaced."##), + "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/edits_deobfuscationfiles-upload", + vec![ + (Some(r##"package-name"##), + None, + Some(r##"Unique identifier of the Android app for which the deobfuscatiuon files are being uploaded; for example, "com.spiffygame"."##), + Some(true), + Some(false)), + + (Some(r##"edit-id"##), + None, + Some(r##"Unique identifier for this edit."##), + Some(true), + Some(false)), + + (Some(r##"apk-version-code"##), + None, + Some(r##"The version code of the APK whose deobfuscation file is being uploaded."##), + Some(true), + Some(false)), + + (Some(r##"deobfuscation-file-type"##), + None, + None, + Some(true), + Some(false)), + + (Some(r##"mode"##), + Some(r##"u"##), + Some(r##"Specify the upload protocol (simple|resumable) and the file to upload"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), ("details-get", Some(r##"Fetches app details for this edit. This includes the default language and developer support contact information."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/edits_details-get", @@ -5483,7 +5667,7 @@ fn main() { ]), ]), - ("purchases", "methods: 'products-get', 'subscriptions-cancel', 'subscriptions-defer', 'subscriptions-get', 'subscriptions-refund' and 'subscriptions-revoke'", vec![ + ("purchases", "methods: 'products-get', 'subscriptions-cancel', 'subscriptions-defer', 'subscriptions-get', 'subscriptions-refund', 'subscriptions-revoke' and 'voidedpurchases-list'", vec![ ("products-get", Some(r##"Checks the purchase and consumption status of an inapp item."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/purchases_products-get", @@ -5676,6 +5860,28 @@ fn main() { Some(false), Some(true)), ]), + ("voidedpurchases-list", + Some(r##"Lists the purchases that were cancelled, refunded or charged-back."##), + "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/purchases_voidedpurchases-list", + vec![ + (Some(r##"package-name"##), + None, + Some(r##"The package name of the application for which voided purchases need to be returned (for example, 'com.some.thing')."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), ]), ("reviews", "methods: 'get', 'list' and 'reply'", vec![ @@ -5769,7 +5975,7 @@ fn main() { let mut app = App::new("androidpublisher2") .author("Sebastian Thiel ") - .version("1.0.0+20160817") + .version("1.0.0+20161212") .about("Lets Android application developers access their Google Play accounts.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli") .arg(Arg::with_name("url") diff --git a/gen/androidpublisher2/Cargo.toml b/gen/androidpublisher2/Cargo.toml index c0c5221f20..7c79a35d63 100644 --- a/gen/androidpublisher2/Cargo.toml +++ b/gen/androidpublisher2/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-androidpublisher2" -version = "1.0.0+20160817" +version = "1.0.0+20161212" authors = ["Sebastian Thiel "] description = "A complete library to interact with Android Publisher (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/androidpublisher2" diff --git a/gen/androidpublisher2/README.md b/gen/androidpublisher2/README.md index 4cd9e5cd52..044c14f365 100644 --- a/gen/androidpublisher2/README.md +++ b/gen/androidpublisher2/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-androidpublisher2` library allows access to all features of the *Google Android Publisher* service. -This documentation was generated from *Android Publisher* crate version *1.0.0+20160817*, where *20160817* is the exact revision of the *androidpublisher:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *Android Publisher* crate version *1.0.0+20161212*, where *20161212* is the exact revision of the *androidpublisher:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *Android Publisher* *v2* API can be found at the [official documentation site](https://developers.google.com/android-publisher). @@ -14,19 +14,20 @@ Everything else about the *Android Publisher* *v2* API can be found at the Handle the following *Resources* with ease from the central [hub](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.AndroidPublisher.html) ... * edits - * [*apklistings delete*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditApklistingDeleteCall.html), [*apklistings deleteall*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditApklistingDeleteallCall.html), [*apklistings get*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditApklistingGetCall.html), [*apklistings list*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditApklistingListCall.html), [*apklistings patch*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditApklistingPatchCall.html), [*apklistings update*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditApklistingUpdateCall.html), [*apks addexternallyhosted*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditApkAddexternallyhostedCall.html), [*apks list*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditApkListCall.html), [*apks upload*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditApkUploadCall.html), [*commit*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditCommitCall.html), [*delete*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditDeleteCall.html), [*details get*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditDetailGetCall.html), [*details patch*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditDetailPatchCall.html), [*details update*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditDetailUpdateCall.html), [*expansionfiles get*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditExpansionfileGetCall.html), [*expansionfiles patch*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditExpansionfilePatchCall.html), [*expansionfiles update*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditExpansionfileUpdateCall.html), [*expansionfiles upload*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditExpansionfileUploadCall.html), [*get*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditGetCall.html), [*images delete*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditImageDeleteCall.html), [*images deleteall*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditImageDeleteallCall.html), [*images list*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditImageListCall.html), [*images upload*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditImageUploadCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditInsertCall.html), [*listings delete*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditListingDeleteCall.html), [*listings deleteall*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditListingDeleteallCall.html), [*listings get*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditListingGetCall.html), [*listings list*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditListingListCall.html), [*listings patch*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditListingPatchCall.html), [*listings update*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditListingUpdateCall.html), [*testers get*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditTesterGetCall.html), [*testers patch*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditTesterPatchCall.html), [*testers update*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditTesterUpdateCall.html), [*tracks get*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditTrackGetCall.html), [*tracks list*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditTrackListCall.html), [*tracks patch*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditTrackPatchCall.html), [*tracks update*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditTrackUpdateCall.html) and [*validate*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditValidateCall.html) + * [*apklistings delete*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditApklistingDeleteCall.html), [*apklistings deleteall*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditApklistingDeleteallCall.html), [*apklistings get*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditApklistingGetCall.html), [*apklistings list*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditApklistingListCall.html), [*apklistings patch*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditApklistingPatchCall.html), [*apklistings update*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditApklistingUpdateCall.html), [*apks addexternallyhosted*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditApkAddexternallyhostedCall.html), [*apks list*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditApkListCall.html), [*apks upload*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditApkUploadCall.html), [*commit*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditCommitCall.html), [*delete*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditDeleteCall.html), [*deobfuscationfiles upload*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditDeobfuscationfileUploadCall.html), [*details get*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditDetailGetCall.html), [*details patch*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditDetailPatchCall.html), [*details update*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditDetailUpdateCall.html), [*expansionfiles get*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditExpansionfileGetCall.html), [*expansionfiles patch*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditExpansionfilePatchCall.html), [*expansionfiles update*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditExpansionfileUpdateCall.html), [*expansionfiles upload*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditExpansionfileUploadCall.html), [*get*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditGetCall.html), [*images delete*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditImageDeleteCall.html), [*images deleteall*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditImageDeleteallCall.html), [*images list*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditImageListCall.html), [*images upload*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditImageUploadCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditInsertCall.html), [*listings delete*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditListingDeleteCall.html), [*listings deleteall*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditListingDeleteallCall.html), [*listings get*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditListingGetCall.html), [*listings list*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditListingListCall.html), [*listings patch*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditListingPatchCall.html), [*listings update*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditListingUpdateCall.html), [*testers get*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditTesterGetCall.html), [*testers patch*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditTesterPatchCall.html), [*testers update*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditTesterUpdateCall.html), [*tracks get*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditTrackGetCall.html), [*tracks list*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditTrackListCall.html), [*tracks patch*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditTrackPatchCall.html), [*tracks update*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditTrackUpdateCall.html) and [*validate*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditValidateCall.html) * [entitlements](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.Entitlement.html) * [*list*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EntitlementListCall.html) * inappproducts * [*batch*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.InappproductBatchCall.html), [*delete*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.InappproductDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.InappproductGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.InappproductInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.InappproductListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.InappproductPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.InappproductUpdateCall.html) * purchases - * [*products get*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.PurchaseProductGetCall.html), [*subscriptions cancel*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.PurchaseSubscriptionCancelCall.html), [*subscriptions defer*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.PurchaseSubscriptionDeferCall.html), [*subscriptions get*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.PurchaseSubscriptionGetCall.html), [*subscriptions refund*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.PurchaseSubscriptionRefundCall.html) and [*subscriptions revoke*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.PurchaseSubscriptionRevokeCall.html) + * [*products get*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.PurchaseProductGetCall.html), [*subscriptions cancel*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.PurchaseSubscriptionCancelCall.html), [*subscriptions defer*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.PurchaseSubscriptionDeferCall.html), [*subscriptions get*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.PurchaseSubscriptionGetCall.html), [*subscriptions refund*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.PurchaseSubscriptionRefundCall.html), [*subscriptions revoke*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.PurchaseSubscriptionRevokeCall.html) and [*voidedpurchases list*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.PurchaseVoidedpurchaseListCall.html) * [reviews](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.Review.html) * [*get*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.ReviewGetCall.html), [*list*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.ReviewListCall.html) and [*reply*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.ReviewReplyCall.html) Upload supported by ... +* [*deobfuscationfiles upload edits*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditDeobfuscationfileUploadCall.html) * [*images upload edits*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditImageUploadCall.html) * [*expansionfiles upload edits*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditExpansionfileUploadCall.html) * [*apks upload edits*](http://byron.github.io/google-apis-rs/google_androidpublisher2/struct.EditApkUploadCall.html) diff --git a/gen/androidpublisher2/src/lib.rs b/gen/androidpublisher2/src/lib.rs index 3038ed417d..51da63fc6c 100644 --- a/gen/androidpublisher2/src/lib.rs +++ b/gen/androidpublisher2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Android Publisher* crate version *1.0.0+20160817*, where *20160817* is the exact revision of the *androidpublisher:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *Android Publisher* crate version *1.0.0+20161212*, where *20161212* is the exact revision of the *androidpublisher:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *Android Publisher* *v2* API can be found at the //! [official documentation site](https://developers.google.com/android-publisher). @@ -12,19 +12,20 @@ //! Handle the following *Resources* with ease from the central [hub](struct.AndroidPublisher.html) ... //! //! * edits -//! * [*apklistings delete*](struct.EditApklistingDeleteCall.html), [*apklistings deleteall*](struct.EditApklistingDeleteallCall.html), [*apklistings get*](struct.EditApklistingGetCall.html), [*apklistings list*](struct.EditApklistingListCall.html), [*apklistings patch*](struct.EditApklistingPatchCall.html), [*apklistings update*](struct.EditApklistingUpdateCall.html), [*apks addexternallyhosted*](struct.EditApkAddexternallyhostedCall.html), [*apks list*](struct.EditApkListCall.html), [*apks upload*](struct.EditApkUploadCall.html), [*commit*](struct.EditCommitCall.html), [*delete*](struct.EditDeleteCall.html), [*details get*](struct.EditDetailGetCall.html), [*details patch*](struct.EditDetailPatchCall.html), [*details update*](struct.EditDetailUpdateCall.html), [*expansionfiles get*](struct.EditExpansionfileGetCall.html), [*expansionfiles patch*](struct.EditExpansionfilePatchCall.html), [*expansionfiles update*](struct.EditExpansionfileUpdateCall.html), [*expansionfiles upload*](struct.EditExpansionfileUploadCall.html), [*get*](struct.EditGetCall.html), [*images delete*](struct.EditImageDeleteCall.html), [*images deleteall*](struct.EditImageDeleteallCall.html), [*images list*](struct.EditImageListCall.html), [*images upload*](struct.EditImageUploadCall.html), [*insert*](struct.EditInsertCall.html), [*listings delete*](struct.EditListingDeleteCall.html), [*listings deleteall*](struct.EditListingDeleteallCall.html), [*listings get*](struct.EditListingGetCall.html), [*listings list*](struct.EditListingListCall.html), [*listings patch*](struct.EditListingPatchCall.html), [*listings update*](struct.EditListingUpdateCall.html), [*testers get*](struct.EditTesterGetCall.html), [*testers patch*](struct.EditTesterPatchCall.html), [*testers update*](struct.EditTesterUpdateCall.html), [*tracks get*](struct.EditTrackGetCall.html), [*tracks list*](struct.EditTrackListCall.html), [*tracks patch*](struct.EditTrackPatchCall.html), [*tracks update*](struct.EditTrackUpdateCall.html) and [*validate*](struct.EditValidateCall.html) +//! * [*apklistings delete*](struct.EditApklistingDeleteCall.html), [*apklistings deleteall*](struct.EditApklistingDeleteallCall.html), [*apklistings get*](struct.EditApklistingGetCall.html), [*apklistings list*](struct.EditApklistingListCall.html), [*apklistings patch*](struct.EditApklistingPatchCall.html), [*apklistings update*](struct.EditApklistingUpdateCall.html), [*apks addexternallyhosted*](struct.EditApkAddexternallyhostedCall.html), [*apks list*](struct.EditApkListCall.html), [*apks upload*](struct.EditApkUploadCall.html), [*commit*](struct.EditCommitCall.html), [*delete*](struct.EditDeleteCall.html), [*deobfuscationfiles upload*](struct.EditDeobfuscationfileUploadCall.html), [*details get*](struct.EditDetailGetCall.html), [*details patch*](struct.EditDetailPatchCall.html), [*details update*](struct.EditDetailUpdateCall.html), [*expansionfiles get*](struct.EditExpansionfileGetCall.html), [*expansionfiles patch*](struct.EditExpansionfilePatchCall.html), [*expansionfiles update*](struct.EditExpansionfileUpdateCall.html), [*expansionfiles upload*](struct.EditExpansionfileUploadCall.html), [*get*](struct.EditGetCall.html), [*images delete*](struct.EditImageDeleteCall.html), [*images deleteall*](struct.EditImageDeleteallCall.html), [*images list*](struct.EditImageListCall.html), [*images upload*](struct.EditImageUploadCall.html), [*insert*](struct.EditInsertCall.html), [*listings delete*](struct.EditListingDeleteCall.html), [*listings deleteall*](struct.EditListingDeleteallCall.html), [*listings get*](struct.EditListingGetCall.html), [*listings list*](struct.EditListingListCall.html), [*listings patch*](struct.EditListingPatchCall.html), [*listings update*](struct.EditListingUpdateCall.html), [*testers get*](struct.EditTesterGetCall.html), [*testers patch*](struct.EditTesterPatchCall.html), [*testers update*](struct.EditTesterUpdateCall.html), [*tracks get*](struct.EditTrackGetCall.html), [*tracks list*](struct.EditTrackListCall.html), [*tracks patch*](struct.EditTrackPatchCall.html), [*tracks update*](struct.EditTrackUpdateCall.html) and [*validate*](struct.EditValidateCall.html) //! * [entitlements](struct.Entitlement.html) //! * [*list*](struct.EntitlementListCall.html) //! * inappproducts //! * [*batch*](struct.InappproductBatchCall.html), [*delete*](struct.InappproductDeleteCall.html), [*get*](struct.InappproductGetCall.html), [*insert*](struct.InappproductInsertCall.html), [*list*](struct.InappproductListCall.html), [*patch*](struct.InappproductPatchCall.html) and [*update*](struct.InappproductUpdateCall.html) //! * purchases -//! * [*products get*](struct.PurchaseProductGetCall.html), [*subscriptions cancel*](struct.PurchaseSubscriptionCancelCall.html), [*subscriptions defer*](struct.PurchaseSubscriptionDeferCall.html), [*subscriptions get*](struct.PurchaseSubscriptionGetCall.html), [*subscriptions refund*](struct.PurchaseSubscriptionRefundCall.html) and [*subscriptions revoke*](struct.PurchaseSubscriptionRevokeCall.html) +//! * [*products get*](struct.PurchaseProductGetCall.html), [*subscriptions cancel*](struct.PurchaseSubscriptionCancelCall.html), [*subscriptions defer*](struct.PurchaseSubscriptionDeferCall.html), [*subscriptions get*](struct.PurchaseSubscriptionGetCall.html), [*subscriptions refund*](struct.PurchaseSubscriptionRefundCall.html), [*subscriptions revoke*](struct.PurchaseSubscriptionRevokeCall.html) and [*voidedpurchases list*](struct.PurchaseVoidedpurchaseListCall.html) //! * [reviews](struct.Review.html) //! * [*get*](struct.ReviewGetCall.html), [*list*](struct.ReviewListCall.html) and [*reply*](struct.ReviewReplyCall.html) //! //! //! Upload supported by ... //! +//! * [*deobfuscationfiles upload edits*](struct.EditDeobfuscationfileUploadCall.html) //! * [*images upload edits*](struct.EditImageUploadCall.html) //! * [*expansionfiles upload edits*](struct.EditExpansionfileUploadCall.html) //! * [*apks upload edits*](struct.EditApkUploadCall.html) diff --git a/gen/androidpublisher2/src/lib.rs.in b/gen/androidpublisher2/src/lib.rs.in index 5dcfa3db02..034d05b39c 100644 --- a/gen/androidpublisher2/src/lib.rs.in +++ b/gen/androidpublisher2/src/lib.rs.in @@ -180,16 +180,16 @@ impl<'a, C, A> AndroidPublisher /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [subscriptions defer purchases](struct.PurchaseSubscriptionDeferCall.html) (request) +/// * [reply reviews](struct.ReviewReplyCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SubscriptionPurchasesDeferRequest { - /// The information about the new desired expiry time for the subscription. - #[serde(rename="deferralInfo")] - pub deferral_info: Option, +pub struct ReviewsReplyRequest { + /// The text to set as the reply. Replies of more than approximately 350 characters will be rejected. HTML tags will be stripped. + #[serde(rename="replyText")] + pub reply_text: Option, } -impl RequestValue for SubscriptionPurchasesDeferRequest {} +impl RequestValue for ReviewsReplyRequest {} /// An Entitlement resource indicates a user's current entitlement to an inapp item or subscription. @@ -456,6 +456,49 @@ pub struct InappproductsBatchRequest { impl RequestValue for InappproductsBatchRequest {} +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DeviceMetadata { + /// Screen density in DPI + #[serde(rename="screenDensityDpi")] + pub screen_density_dpi: Option, + /// Screen height in pixels + #[serde(rename="screenHeightPx")] + pub screen_height_px: Option, + /// Device CPU model e.g. "MSM8974" + #[serde(rename="cpuModel")] + pub cpu_model: Option, + /// Device model name (e.g. Droid) + #[serde(rename="productName")] + pub product_name: Option, + /// Comma separated list of native platforms (e.g. "arm", "arm7") + #[serde(rename="nativePlatform")] + pub native_platform: Option, + /// Device class (e.g. tablet) + #[serde(rename="deviceClass")] + pub device_class: Option, + /// Device CPU make e.g. "Qualcomm" + #[serde(rename="cpuMake")] + pub cpu_make: Option, + /// Device RAM in Megabytes e.g. "2048" + #[serde(rename="ramMb")] + pub ram_mb: Option, + /// Device manufacturer (e.g. Motorola) + pub manufacturer: Option, + /// OpenGL version + #[serde(rename="glEsVersion")] + pub gl_es_version: Option, + /// Screen width in pixels + #[serde(rename="screenWidthPx")] + pub screen_width_px: Option, +} + +impl Part for DeviceMetadata {} + + /// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -598,16 +641,30 @@ impl Part for InAppProductListing {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [reply reviews](struct.ReviewReplyCall.html) (request) +/// * [subscriptions defer purchases](struct.PurchaseSubscriptionDeferCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ReviewsReplyRequest { - /// The text to set as the reply. Replies of more than approximately 350 characters will be rejected. HTML tags will be stripped. - #[serde(rename="replyText")] - pub reply_text: Option, +pub struct SubscriptionPurchasesDeferRequest { + /// The information about the new desired expiry time for the subscription. + #[serde(rename="deferralInfo")] + pub deferral_info: Option, } -impl RequestValue for ReviewsReplyRequest {} +impl RequestValue for SubscriptionPurchasesDeferRequest {} + + +/// Represents a deobfuscation file. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DeobfuscationFile { + /// The type of the deobfuscation file. + #[serde(rename="symbolType")] + pub symbol_type: Option, +} + +impl Part for DeobfuscationFile {} /// There is no detailed description. @@ -737,12 +794,18 @@ pub struct UserComment { /// Integer version code of the app as installed at the time the review was written. May be absent. #[serde(rename="appVersionCode")] pub app_version_code: Option, + /// Untranslated text of the review, in the case where the review has been translated. If the review has not been translated this is left blank. + #[serde(rename="originalText")] + pub original_text: Option, /// Language code for the reviewer. This is taken from the device settings so is not guaranteed to match the language the review is written in. May be absent. #[serde(rename="reviewerLanguage")] pub reviewer_language: Option, /// The last time at which this comment was updated. #[serde(rename="lastModified")] pub last_modified: Option, + /// Number of users who have given this review a thumbs up + #[serde(rename="thumbsUpCount")] + pub thumbs_up_count: Option, /// The star rating associated with the review, from 1 to 5. #[serde(rename="starRating")] pub star_rating: Option, @@ -753,9 +816,15 @@ pub struct UserComment { /// Integer Android SDK version of the user's device at the time the review was written, e.g. 23 is Marshmallow. May be absent. #[serde(rename="androidOsVersion")] pub android_os_version: Option, + /// Some information about the characteristics of the user's device + #[serde(rename="deviceMetadata")] + pub device_metadata: Option, /// String version name of the app as installed at the time the review was written. May be absent. #[serde(rename="appVersionName")] pub app_version_name: Option, + /// Number of users who have given this review a thumbs down + #[serde(rename="thumbsDownCount")] + pub thumbs_down_count: Option, } impl Part for UserComment {} @@ -918,6 +987,31 @@ pub struct TokenPagination { impl Part for TokenPagination {} +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [voidedpurchases list purchases](struct.PurchaseVoidedpurchaseListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct VoidedPurchasesListResponse { + /// no description provided + #[serde(rename="voidedPurchases")] + pub voided_purchases: Option>, + /// no description provided + #[serde(rename="tokenPagination")] + pub token_pagination: Option, + /// no description provided + #[serde(rename="pageInfo")] + pub page_info: Option, +} + +impl ResponseResult for VoidedPurchasesListResponse {} + + /// There is no detailed description. /// /// # Activities @@ -983,6 +1077,28 @@ impl RequestValue for Testers {} impl ResponseResult for Testers {} +/// A VoidedPurchase resource indicates the purchase was either cancelled/refunded/charged-back. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct VoidedPurchase { + /// This kind represents a voided purchase object in the androidpublisher service. + pub kind: Option, + /// The time when the purchase was cancelled/refunded/chargeback, in milliseconds since the epoch (Jan 1, 1970). + #[serde(rename="voidedTimeMillis")] + pub voided_time_millis: Option, + /// The token that was generated when a purchase was made and uniquely identifies a purchase. + #[serde(rename="purchaseToken")] + pub purchase_token: Option, + /// The time the purchase was made, in milliseconds since the epoch (Jan 1, 1970). + #[serde(rename="purchaseTimeMillis")] + pub purchase_time_millis: Option, +} + +impl Part for VoidedPurchase {} + + /// There is no detailed description. /// /// # Activities @@ -1117,6 +1233,25 @@ pub struct SubscriptionPurchase { impl ResponseResult for SubscriptionPurchase {} +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [deobfuscationfiles upload edits](struct.EditDeobfuscationfileUploadCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DeobfuscationFilesUploadResponse { + /// no description provided + #[serde(rename="deobfuscationFile")] + pub deobfuscation_file: Option, +} + +impl ResponseResult for DeobfuscationFilesUploadResponse {} + + /// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1460,7 +1595,7 @@ impl<'a, C, A> EntitlementMethods<'a, C, A> { /// ::default(), None); /// let mut hub = AndroidPublisher::new(hyper::Client::new(), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `products_get(...)`, `subscriptions_cancel(...)`, `subscriptions_defer(...)`, `subscriptions_get(...)`, `subscriptions_refund(...)` and `subscriptions_revoke(...)` +/// // like `products_get(...)`, `subscriptions_cancel(...)`, `subscriptions_defer(...)`, `subscriptions_get(...)`, `subscriptions_refund(...)`, `subscriptions_revoke(...)` and `voidedpurchases_list(...)` /// // to build up your call. /// let rb = hub.purchases(); /// # } @@ -1538,6 +1673,28 @@ impl<'a, C, A> PurchaseMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Lists the purchases that were cancelled, refunded or charged-back. + /// + /// # Arguments + /// + /// * `packageName` - The package name of the application for which voided purchases need to be returned (for example, 'com.some.thing'). + pub fn voidedpurchases_list(&self, package_name: &str) -> PurchaseVoidedpurchaseListCall<'a, C, A> { + PurchaseVoidedpurchaseListCall { + hub: self.hub, + _package_name: package_name.to_string(), + _token: Default::default(), + _start_time: Default::default(), + _start_index: Default::default(), + _max_results: Default::default(), + _end_time: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Cancels a user's subscription purchase. The subscription remains valid until its expiration time. @@ -1629,7 +1786,7 @@ impl<'a, C, A> PurchaseMethods<'a, C, A> { /// ::default(), None); /// let mut hub = AndroidPublisher::new(hyper::Client::new(), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `apklistings_delete(...)`, `apklistings_deleteall(...)`, `apklistings_get(...)`, `apklistings_list(...)`, `apklistings_patch(...)`, `apklistings_update(...)`, `apks_addexternallyhosted(...)`, `apks_list(...)`, `apks_upload(...)`, `commit(...)`, `delete(...)`, `details_get(...)`, `details_patch(...)`, `details_update(...)`, `expansionfiles_get(...)`, `expansionfiles_patch(...)`, `expansionfiles_update(...)`, `expansionfiles_upload(...)`, `get(...)`, `images_delete(...)`, `images_deleteall(...)`, `images_list(...)`, `images_upload(...)`, `insert(...)`, `listings_delete(...)`, `listings_deleteall(...)`, `listings_get(...)`, `listings_list(...)`, `listings_patch(...)`, `listings_update(...)`, `testers_get(...)`, `testers_patch(...)`, `testers_update(...)`, `tracks_get(...)`, `tracks_list(...)`, `tracks_patch(...)`, `tracks_update(...)` and `validate(...)` +/// // like `apklistings_delete(...)`, `apklistings_deleteall(...)`, `apklistings_get(...)`, `apklistings_list(...)`, `apklistings_patch(...)`, `apklistings_update(...)`, `apks_addexternallyhosted(...)`, `apks_list(...)`, `apks_upload(...)`, `commit(...)`, `delete(...)`, `deobfuscationfiles_upload(...)`, `details_get(...)`, `details_patch(...)`, `details_update(...)`, `expansionfiles_get(...)`, `expansionfiles_patch(...)`, `expansionfiles_update(...)`, `expansionfiles_upload(...)`, `get(...)`, `images_delete(...)`, `images_deleteall(...)`, `images_list(...)`, `images_upload(...)`, `insert(...)`, `listings_delete(...)`, `listings_deleteall(...)`, `listings_get(...)`, `listings_list(...)`, `listings_patch(...)`, `listings_update(...)`, `testers_get(...)`, `testers_patch(...)`, `testers_update(...)`, `tracks_get(...)`, `tracks_list(...)`, `tracks_patch(...)`, `tracks_update(...)` and `validate(...)` /// // to build up your call. /// let rb = hub.edits(); /// # } @@ -1644,6 +1801,29 @@ impl<'a, C, A> MethodsBuilder for EditMethods<'a, C, A> {} impl<'a, C, A> EditMethods<'a, C, A> { + /// Create a builder to help you perform the following task: + /// + /// Uploads the deobfuscation file of the specified APK. If a deobfuscation file already exists, it will be replaced. + /// + /// # Arguments + /// + /// * `packageName` - Unique identifier of the Android app for which the deobfuscatiuon files are being uploaded; for example, "com.spiffygame". + /// * `editId` - Unique identifier for this edit. + /// * `apkVersionCode` - The version code of the APK whose deobfuscation file is being uploaded. + /// * `deobfuscationFileType` - No description provided. + pub fn deobfuscationfiles_upload(&self, package_name: &str, edit_id: &str, apk_version_code: i32, deobfuscation_file_type: &str) -> EditDeobfuscationfileUploadCall<'a, C, A> { + EditDeobfuscationfileUploadCall { + hub: self.hub, + _package_name: package_name.to_string(), + _edit_id: edit_id.to_string(), + _apk_version_code: apk_version_code, + _deobfuscation_file_type: deobfuscation_file_type.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Uploads a new image and adds it to the list of images for the specified language and image type. @@ -2526,6 +2706,7 @@ impl<'a, C, A> ReviewMethods<'a, C, A> { hub: self.hub, _package_name: package_name.to_string(), _review_id: review_id.to_string(), + _translation_language: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -2543,6 +2724,7 @@ impl<'a, C, A> ReviewMethods<'a, C, A> { ReviewListCall { hub: self.hub, _package_name: package_name.to_string(), + _translation_language: Default::default(), _token: Default::default(), _start_index: Default::default(), _max_results: Default::default(), @@ -3762,6 +3944,298 @@ impl<'a, C, A> PurchaseSubscriptionGetCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = AndroidPublisher::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.purchases().voidedpurchases_list("packageName") +/// .token("justo") +/// .start_time("justo") +/// .start_index(67) +/// .max_results(84) +/// .end_time("diam") +/// .doit(); +/// # } +/// ``` +pub struct PurchaseVoidedpurchaseListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidPublisher, + _package_name: String, + _token: Option, + _start_time: Option, + _start_index: Option, + _max_results: Option, + _end_time: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PurchaseVoidedpurchaseListCall<'a, C, A> {} + +impl<'a, C, A> PurchaseVoidedpurchaseListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, VoidedPurchasesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "androidpublisher.purchases.voidedpurchases.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); + params.push(("packageName", self._package_name.to_string())); + if let Some(value) = self._token { + params.push(("token", value.to_string())); + } + if let Some(value) = self._start_time { + params.push(("startTime", value.to_string())); + } + if let Some(value) = self._start_index { + params.push(("startIndex", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._end_time { + params.push(("endTime", value.to_string())); + } + for &field in ["alt", "packageName", "token", "startTime", "startIndex", "maxResults", "endTime"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/androidpublisher/v2/applications/{packageName}/purchases/voidedpurchases".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{packageName}", "packageName")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["packageName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The package name of the application for which voided purchases need to be returned (for example, 'com.some.thing'). + /// + /// Sets the *package name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn package_name(mut self, new_value: &str) -> PurchaseVoidedpurchaseListCall<'a, C, A> { + self._package_name = new_value.to_string(); + self + } + /// + /// Sets the *token* query property to the given value. + pub fn token(mut self, new_value: &str) -> PurchaseVoidedpurchaseListCall<'a, C, A> { + self._token = Some(new_value.to_string()); + self + } + /// The start time of list window, in milliseconds since the epoch (Jan 1, 1970). If not specified, default to current time - 30 days, which is also the earlies accepted start time. This parameter will be ignored if pagination token is set. + /// + /// Sets the *start time* query property to the given value. + pub fn start_time(mut self, new_value: &str) -> PurchaseVoidedpurchaseListCall<'a, C, A> { + self._start_time = Some(new_value.to_string()); + self + } + /// + /// Sets the *start index* query property to the given value. + pub fn start_index(mut self, new_value: u32) -> PurchaseVoidedpurchaseListCall<'a, C, A> { + self._start_index = Some(new_value); + self + } + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: u32) -> PurchaseVoidedpurchaseListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// The end time of list window, in milliseconds since the epoch (Jan 1, 1970). If not specified, default to current time, which is also the latest accepted end time. This parameter will be ignored if pagination token is set. + /// + /// Sets the *end time* query property to the given value. + pub fn end_time(mut self, new_value: &str) -> PurchaseVoidedpurchaseListCall<'a, C, A> { + self._end_time = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PurchaseVoidedpurchaseListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PurchaseVoidedpurchaseListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PurchaseVoidedpurchaseListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + /// Cancels a user's subscription purchase. The subscription remains valid until its expiration time. /// /// A builder for the *subscriptions.cancel* method supported by a *purchase* resource. @@ -4548,6 +5022,385 @@ impl<'a, C, A> PurchaseSubscriptionDeferCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = AndroidPublisher::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `upload_resumable(...)`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.edits().deobfuscationfiles_upload("packageName", "editId", -39, "deobfuscationFileType") +/// .upload_resumable(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()); +/// # } +/// ``` +pub struct EditDeobfuscationfileUploadCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidPublisher, + _package_name: String, + _edit_id: String, + _apk_version_code: i32, + _deobfuscation_file_type: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EditDeobfuscationfileUploadCall<'a, C, A> {} + +impl<'a, C, A> EditDeobfuscationfileUploadCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + fn doit(mut self, mut reader: RS, reader_mime_type: mime::Mime, protocol: &'static str) -> Result<(hyper::client::Response, DeobfuscationFilesUploadResponse)> + where RS: ReadSeek { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "androidpublisher.edits.deobfuscationfiles.upload", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + params.push(("packageName", self._package_name.to_string())); + params.push(("editId", self._edit_id.to_string())); + params.push(("apkVersionCode", self._apk_version_code.to_string())); + params.push(("deobfuscationFileType", self._deobfuscation_file_type.to_string())); + for &field in ["alt", "packageName", "editId", "apkVersionCode", "deobfuscationFileType"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let (mut url, upload_type) = + if protocol == "simple" { + ("https://www.googleapis.com/upload/androidpublisher/v2/applications/{packageName}/edits/{editId}/apks/{apkVersionCode}/deobfuscationFiles/{deobfuscationFileType}".to_string(), "multipart") + } else if protocol == "resumable" { + ("https://www.googleapis.com/resumable/upload/androidpublisher/v2/applications/{packageName}/edits/{editId}/apks/{apkVersionCode}/deobfuscationFiles/{deobfuscationFileType}".to_string(), "resumable") + } else { + unreachable!() + }; + params.push(("uploadType", upload_type.to_string())); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{packageName}", "packageName"), ("{editId}", "editId"), ("{apkVersionCode}", "apkVersionCode"), ("{deobfuscationFileType}", "deobfuscationFileType")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(4); + for param_name in ["deobfuscationFileType", "apkVersionCode", "editId", "packageName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + let mut should_ask_dlg_for_url = false; + let mut upload_url_from_server; + let mut upload_url: Option = None; + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + if should_ask_dlg_for_url && (upload_url = dlg.upload_url()) == () && upload_url.is_some() { + should_ask_dlg_for_url = false; + upload_url_from_server = false; + let url = upload_url.as_ref().and_then(|s| Some(hyper::Url::parse(s).unwrap())).unwrap(); + hyper::client::Response::new(url, Box::new(cmn::DummyNetworkStream)).and_then(|mut res| { + res.status = hyper::status::StatusCode::Ok; + res.headers.set(Location(upload_url.as_ref().unwrap().clone())); + Ok(res) + }) + } else { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + if protocol == "simple" { + let size = reader.seek(io::SeekFrom::End(0)).unwrap(); + reader.seek(io::SeekFrom::Start(0)).unwrap(); + if size > 314572800 { + return Err(Error::UploadSizeLimitExceeded(size, 314572800)) + } + req = req.header(ContentType(reader_mime_type.clone())) + .header(ContentLength(size)) + .body(&mut reader); + } + upload_url_from_server = true; + if protocol == "resumable" { + req = req.header(cmn::XUploadContentType(reader_mime_type.clone())); + } + + dlg.pre_request(); + req.send() + } + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + if protocol == "resumable" { + let size = reader.seek(io::SeekFrom::End(0)).unwrap(); + reader.seek(io::SeekFrom::Start(0)).unwrap(); + if size > 314572800 { + return Err(Error::UploadSizeLimitExceeded(size, 314572800)) + } + let mut client = &mut *self.hub.client.borrow_mut(); + let upload_result = { + let url_str = &res.headers.get::().expect("Location header is part of protocol").0; + if upload_url_from_server { + dlg.store_upload_url(Some(url_str)); + } + + cmn::ResumableUploadHelper { + client: &mut client.borrow_mut(), + delegate: dlg, + start_at: if upload_url_from_server { Some(0) } else { None }, + auth: &mut *self.hub.auth.borrow_mut(), + user_agent: &self.hub._user_agent, + auth_header: auth_header.clone(), + url: url_str, + reader: &mut reader, + media_type: reader_mime_type.clone(), + content_length: size + }.upload() + }; + match upload_result { + None => { + dlg.finished(false); + return Err(Error::Cancelled) + } + Some(Err(err)) => { + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Some(Ok(upload_result)) => { + res = upload_result; + if !res.status.is_success() { + dlg.store_upload_url(None); + dlg.finished(false); + return Err(Error::Failure(res)) + } + } + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + /// Upload media all at once. + /// If the upload fails for whichever reason, all progress is lost. + /// + /// * *max size*: 300MB + /// * *multipart*: yes + /// * *valid mime types*: 'application/octet-stream' + pub fn upload(self, stream: RS, mime_type: mime::Mime) -> Result<(hyper::client::Response, DeobfuscationFilesUploadResponse)> + where RS: ReadSeek { + self.doit(stream, mime_type, "simple") + } + /// Upload media in a resumable fashion. + /// Even if the upload fails or is interrupted, it can be resumed for a + /// certain amount of time as the server maintains state temporarily. + /// + /// The delegate will be asked for an `upload_url()`, and if not provided, will be asked to store an upload URL + /// that was provided by the server, using `store_upload_url(...)`. The upload will be done in chunks, the delegate + /// may specify the `chunk_size()` and may cancel the operation before each chunk is uploaded, using + /// `cancel_chunk_upload(...)`. + /// + /// * *max size*: 300MB + /// * *multipart*: yes + /// * *valid mime types*: 'application/octet-stream' + pub fn upload_resumable(self, resumeable_stream: RS, mime_type: mime::Mime) -> Result<(hyper::client::Response, DeobfuscationFilesUploadResponse)> + where RS: ReadSeek { + self.doit(resumeable_stream, mime_type, "resumable") + } + + /// Unique identifier of the Android app for which the deobfuscatiuon files are being uploaded; for example, "com.spiffygame". + /// + /// Sets the *package name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn package_name(mut self, new_value: &str) -> EditDeobfuscationfileUploadCall<'a, C, A> { + self._package_name = new_value.to_string(); + self + } + /// Unique identifier for this edit. + /// + /// Sets the *edit id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn edit_id(mut self, new_value: &str) -> EditDeobfuscationfileUploadCall<'a, C, A> { + self._edit_id = new_value.to_string(); + self + } + /// The version code of the APK whose deobfuscation file is being uploaded. + /// + /// Sets the *apk version code* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn apk_version_code(mut self, new_value: i32) -> EditDeobfuscationfileUploadCall<'a, C, A> { + self._apk_version_code = new_value; + self + } + /// + /// Sets the *deobfuscation file type* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn deobfuscation_file_type(mut self, new_value: &str) -> EditDeobfuscationfileUploadCall<'a, C, A> { + self._deobfuscation_file_type = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> EditDeobfuscationfileUploadCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> EditDeobfuscationfileUploadCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> EditDeobfuscationfileUploadCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + /// Uploads a new image and adds it to the list of images for the specified language and image type. /// /// A builder for the *images.upload* method supported by a *edit* resource. @@ -4959,7 +5812,7 @@ impl<'a, C, A> EditImageUploadCall<'a, C, A> where C: BorrowMut, /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.edits().expansionfiles_update(req, "packageName", "editId", -95, "expansionFileType") +/// let result = hub.edits().expansionfiles_update(req, "packageName", "editId", -82, "expansionFileType") /// .doit(); /// # } /// ``` @@ -6015,7 +6868,7 @@ impl<'a, C, A> EditApkAddexternallyhostedCall<'a, C, A> where C: BorrowMut EditTrackGetCall<'a, C, A> where C: BorrowMut, A: /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.edits().expansionfiles_patch(req, "packageName", "editId", -58, "expansionFileType") +/// let result = hub.edits().expansionfiles_patch(req, "packageName", "editId", -48, "expansionFileType") /// .doit(); /// # } /// ``` @@ -8829,7 +9682,7 @@ impl<'a, C, A> EditApkUploadCall<'a, C, A> where C: BorrowMut, A: /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.edits().apklistings_update(req, "packageName", "editId", -44, "language") +/// let result = hub.edits().apklistings_update(req, "packageName", "editId", -13, "language") /// .doit(); /// # } /// ``` @@ -9376,7 +10229,7 @@ impl<'a, C, A> EditApkListCall<'a, C, A> where C: BorrowMut, A: o /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.edits().apklistings_patch(req, "packageName", "editId", -19, "language") +/// let result = hub.edits().apklistings_patch(req, "packageName", "editId", -58, "language") /// .doit(); /// # } /// ``` @@ -9931,7 +10784,7 @@ impl<'a, C, A> EditListingGetCall<'a, C, A> where C: BorrowMut, A /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.edits().apklistings_delete("packageName", "editId", -40, "language") +/// let result = hub.edits().apklistings_delete("packageName", "editId", -33, "language") /// .doit(); /// # } /// ``` @@ -10684,7 +11537,7 @@ impl<'a, C, A> EditDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `upload_resumable(...)`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.edits().expansionfiles_upload("packageName", "editId", -66, "expansionFileType") +/// let result = hub.edits().expansionfiles_upload("packageName", "editId", -16, "expansionFileType") /// .upload_resumable(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()); /// # } /// ``` @@ -12893,7 +13746,7 @@ impl<'a, C, A> EditListingUpdateCall<'a, C, A> where C: BorrowMut /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.edits().expansionfiles_get("packageName", "editId", -69, "expansionFileType") +/// let result = hub.edits().expansionfiles_get("packageName", "editId", -71, "expansionFileType") /// .doit(); /// # } /// ``` @@ -14249,7 +15102,7 @@ impl<'a, C, A> EditListingDeleteCall<'a, C, A> where C: BorrowMut /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.edits().apklistings_get("packageName", "editId", -24, "language") +/// let result = hub.edits().apklistings_get("packageName", "editId", -62, "language") /// .doit(); /// # } /// ``` @@ -14807,7 +15660,7 @@ impl<'a, C, A> EditTesterUpdateCall<'a, C, A> where C: BorrowMut, /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.edits().apklistings_list("packageName", "editId", -74) +/// let result = hub.edits().apklistings_list("packageName", "editId", -77) /// .doit(); /// # } /// ``` @@ -15344,6 +16197,7 @@ impl<'a, C, A> ReviewReplyCall<'a, C, A> where C: BorrowMut, A: o /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.reviews().get("packageName", "reviewId") +/// .translation_language("takimata") /// .doit(); /// # } /// ``` @@ -15353,6 +16207,7 @@ pub struct ReviewGetCall<'a, C, A> hub: &'a AndroidPublisher, _package_name: String, _review_id: String, + _translation_language: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap @@ -15374,10 +16229,13 @@ impl<'a, C, A> ReviewGetCall<'a, C, A> where C: BorrowMut, A: oau }; dlg.begin(MethodInfo { id: "androidpublisher.reviews.get", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); params.push(("reviewId", self._review_id.to_string())); - for &field in ["alt", "packageName", "reviewId"].iter() { + if let Some(value) = self._translation_language { + params.push(("translationLanguage", value.to_string())); + } + for &field in ["alt", "packageName", "reviewId", "translationLanguage"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -15511,6 +16369,12 @@ impl<'a, C, A> ReviewGetCall<'a, C, A> where C: BorrowMut, A: oau self._review_id = new_value.to_string(); self } + /// + /// Sets the *translation language* query property to the given value. + pub fn translation_language(mut self, new_value: &str) -> ReviewGetCall<'a, C, A> { + self._translation_language = Some(new_value.to_string()); + self + } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// @@ -15590,9 +16454,10 @@ impl<'a, C, A> ReviewGetCall<'a, C, A> where C: BorrowMut, A: oau /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.reviews().list("packageName") -/// .token("Lorem") -/// .start_index(38) -/// .max_results(64) +/// .translation_language("nonumy") +/// .token("rebum.") +/// .start_index(95) +/// .max_results(51) /// .doit(); /// # } /// ``` @@ -15601,6 +16466,7 @@ pub struct ReviewListCall<'a, C, A> hub: &'a AndroidPublisher, _package_name: String, + _translation_language: Option, _token: Option, _start_index: Option, _max_results: Option, @@ -15625,8 +16491,11 @@ impl<'a, C, A> ReviewListCall<'a, C, A> where C: BorrowMut, A: oa }; dlg.begin(MethodInfo { id: "androidpublisher.reviews.list", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); + if let Some(value) = self._translation_language { + params.push(("translationLanguage", value.to_string())); + } if let Some(value) = self._token { params.push(("token", value.to_string())); } @@ -15636,7 +16505,7 @@ impl<'a, C, A> ReviewListCall<'a, C, A> where C: BorrowMut, A: oa if let Some(value) = self._max_results { params.push(("maxResults", value.to_string())); } - for &field in ["alt", "packageName", "token", "startIndex", "maxResults"].iter() { + for &field in ["alt", "packageName", "translationLanguage", "token", "startIndex", "maxResults"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -15762,6 +16631,12 @@ impl<'a, C, A> ReviewListCall<'a, C, A> where C: BorrowMut, A: oa self } /// + /// Sets the *translation language* query property to the given value. + pub fn translation_language(mut self, new_value: &str) -> ReviewListCall<'a, C, A> { + self._translation_language = Some(new_value.to_string()); + self + } + /// /// Sets the *token* query property to the given value. pub fn token(mut self, new_value: &str) -> ReviewListCall<'a, C, A> { self._token = Some(new_value.to_string()); @@ -16089,9 +16964,9 @@ impl<'a, C, A> InappproductBatchCall<'a, C, A> where C: BorrowMut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.inappproducts().list("packageName") -/// .token("At") -/// .start_index(5) -/// .max_results(79) +/// .token("ut") +/// .start_index(64) +/// .max_results(50) /// .doit(); /// # } /// ``` @@ -16363,7 +17238,7 @@ impl<'a, C, A> InappproductListCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.inappproducts().insert(req, "packageName") -/// .auto_convert_missing_prices(true) +/// .auto_convert_missing_prices(false) /// .doit(); /// # } /// ``` @@ -17123,7 +17998,7 @@ impl<'a, C, A> InappproductGetCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.inappproducts().update(req, "packageName", "sku") -/// .auto_convert_missing_prices(true) +/// .auto_convert_missing_prices(false) /// .doit(); /// # } /// ``` @@ -17413,7 +18288,7 @@ impl<'a, C, A> InappproductUpdateCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with appengine (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/appengine1-cli" diff --git a/gen/appengine1-cli/README.md b/gen/appengine1-cli/README.md index d801f284f9..7c80a3475e 100644 --- a/gen/appengine1-cli/README.md +++ b/gen/appengine1-cli/README.md @@ -24,16 +24,18 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *appengine* API at revision *20160802*. The CLI is at version *1.0.0*. +This documentation was generated from the *appengine* API at revision *20161208*. The CLI is at version *1.0.0*. ```bash appengine1 [options] apps + create (-r )... [-p ]... [-o ] get [-p ]... [-o ] locations-get [-p ]... [-o ] locations-list [-p ]... [-o ] operations-get [-p ]... [-o ] operations-list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] repair (-r )... [-p ]... [-o ] services-delete [-p ]... [-o ] services-get [-p ]... [-o ] diff --git a/gen/appengine1-cli/mkdocs.yml b/gen/appengine1-cli/mkdocs.yml index fa6757bfc5..ccc2987232 100644 --- a/gen/appengine1-cli/mkdocs.yml +++ b/gen/appengine1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: appengine v1.0.0+20160802 +site_name: appengine v1.0.0+20161208 site_url: http://byron.github.io/google-apis-rs/google-appengine1-cli site_description: Write integrating applications with bcore @@ -9,11 +9,13 @@ site_dir: build_html pages: - ['index.md', 'Home'] +- ['apps_create.md', 'Apps', 'Create'] - ['apps_get.md', 'Apps', 'Get'] - ['apps_locations-get.md', 'Apps', 'Locations Get'] - ['apps_locations-list.md', 'Apps', 'Locations List'] - ['apps_operations-get.md', 'Apps', 'Operations Get'] - ['apps_operations-list.md', 'Apps', 'Operations List'] +- ['apps_patch.md', 'Apps', 'Patch'] - ['apps_repair.md', 'Apps', 'Repair'] - ['apps_services-delete.md', 'Apps', 'Services Delete'] - ['apps_services-get.md', 'Apps', 'Services Get'] diff --git a/gen/appengine1-cli/src/main.rs b/gen/appengine1-cli/src/main.rs index 30c1d798d0..1ba01fa831 100644 --- a/gen/appengine1-cli/src/main.rs +++ b/gen/appengine1-cli/src/main.rs @@ -45,6 +45,98 @@ struct Engine<'n> { impl<'n> Engine<'n> { + fn _apps_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "default-hostname" => Some(("defaultHostname", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "code-bucket" => Some(("codeBucket", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-bucket" => Some(("defaultBucket", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-cookie-expiration" => Some(("defaultCookieExpiration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "location-id" => Some(("locationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "auth-domain" => Some(("authDomain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["auth-domain", "code-bucket", "default-bucket", "default-cookie-expiration", "default-hostname", "id", "location-id", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Application = json::value::from_value(object).unwrap(); + let mut call = self.hub.apps().create(request); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _apps_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.apps().get(opt.value_of("apps-id").unwrap_or("")); @@ -325,6 +417,102 @@ impl<'n> Engine<'n> { } } + fn _apps_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "default-hostname" => Some(("defaultHostname", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "code-bucket" => Some(("codeBucket", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-bucket" => Some(("defaultBucket", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-cookie-expiration" => Some(("defaultCookieExpiration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "location-id" => Some(("locationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "auth-domain" => Some(("authDomain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["auth-domain", "code-bucket", "default-bucket", "default-cookie-expiration", "default-hostname", "id", "location-id", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Application = json::value::from_value(object).unwrap(); + let mut call = self.hub.apps().patch(request, opt.value_of("apps-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "update-mask" => { + call = call.update_mask(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["update-mask"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _apps_repair(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -690,6 +878,8 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { + "endpoints-api-service.config-id" => Some(("endpointsApiService.configId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "endpoints-api-service.name" => Some(("endpointsApiService.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "basic-scaling.idle-timeout" => Some(("basicScaling.idleTimeout", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "basic-scaling.max-instances" => Some(("basicScaling.maxInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "beta-settings" => Some(("betaSettings", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), @@ -747,12 +937,13 @@ impl<'n> Engine<'n> { "network.instance-tag" => Some(("network.instanceTag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "network.forwarded-ports" => Some(("network.forwardedPorts", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "network.name" => Some(("network.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "network.subnetwork-name" => Some(("network.subnetworkName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "nobuild-files-regex" => Some(("nobuildFilesRegex", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "serving-status" => Some(("servingStatus", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "runtime" => Some(("runtime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["aggregation-window-length", "api-config", "auth-fail-action", "automatic-scaling", "basic-scaling", "beta-settings", "check-interval", "container", "cool-down-period", "cpu", "cpu-utilization", "create-time", "created-by", "default-expiration", "deployment", "disable-health-check", "disk-gb", "disk-usage-bytes", "disk-utilization", "env", "env-variables", "files-count", "forwarded-ports", "health-check", "healthy-threshold", "host", "id", "idle-timeout", "image", "inbound-services", "instance-class", "instance-tag", "instances", "login", "manual-scaling", "max-concurrent-requests", "max-idle-instances", "max-instances", "max-pending-latency", "max-total-instances", "memory-gb", "min-idle-instances", "min-pending-latency", "min-total-instances", "name", "network", "network-utilization", "nobuild-files-regex", "request-utilization", "resources", "restart-threshold", "runtime", "script", "security-level", "serving-status", "source-url", "target-concurrent-requests", "target-read-bytes-per-second", "target-read-ops-per-second", "target-received-bytes-per-second", "target-received-packets-per-second", "target-request-count-per-second", "target-sent-bytes-per-second", "target-sent-packets-per-second", "target-utilization", "target-write-bytes-per-second", "target-write-ops-per-second", "threadsafe", "timeout", "unhealthy-threshold", "url", "version-url", "vm", "zip"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["aggregation-window-length", "api-config", "auth-fail-action", "automatic-scaling", "basic-scaling", "beta-settings", "check-interval", "config-id", "container", "cool-down-period", "cpu", "cpu-utilization", "create-time", "created-by", "default-expiration", "deployment", "disable-health-check", "disk-gb", "disk-usage-bytes", "disk-utilization", "endpoints-api-service", "env", "env-variables", "files-count", "forwarded-ports", "health-check", "healthy-threshold", "host", "id", "idle-timeout", "image", "inbound-services", "instance-class", "instance-tag", "instances", "login", "manual-scaling", "max-concurrent-requests", "max-idle-instances", "max-instances", "max-pending-latency", "max-total-instances", "memory-gb", "min-idle-instances", "min-pending-latency", "min-total-instances", "name", "network", "network-utilization", "nobuild-files-regex", "request-utilization", "resources", "restart-threshold", "runtime", "script", "security-level", "serving-status", "source-url", "subnetwork-name", "target-concurrent-requests", "target-read-bytes-per-second", "target-read-ops-per-second", "target-received-bytes-per-second", "target-received-packets-per-second", "target-request-count-per-second", "target-sent-bytes-per-second", "target-sent-packets-per-second", "target-utilization", "target-write-bytes-per-second", "target-write-ops-per-second", "threadsafe", "timeout", "unhealthy-threshold", "url", "version-url", "vm", "zip"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -943,8 +1134,9 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { + "ssh-key" => Some(("sshKey", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec![]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["ssh-key"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1252,6 +1444,8 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { + "endpoints-api-service.config-id" => Some(("endpointsApiService.configId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "endpoints-api-service.name" => Some(("endpointsApiService.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "basic-scaling.idle-timeout" => Some(("basicScaling.idleTimeout", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "basic-scaling.max-instances" => Some(("basicScaling.maxInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "beta-settings" => Some(("betaSettings", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), @@ -1309,12 +1503,13 @@ impl<'n> Engine<'n> { "network.instance-tag" => Some(("network.instanceTag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "network.forwarded-ports" => Some(("network.forwardedPorts", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "network.name" => Some(("network.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "network.subnetwork-name" => Some(("network.subnetworkName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "nobuild-files-regex" => Some(("nobuildFilesRegex", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "serving-status" => Some(("servingStatus", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "runtime" => Some(("runtime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["aggregation-window-length", "api-config", "auth-fail-action", "automatic-scaling", "basic-scaling", "beta-settings", "check-interval", "container", "cool-down-period", "cpu", "cpu-utilization", "create-time", "created-by", "default-expiration", "deployment", "disable-health-check", "disk-gb", "disk-usage-bytes", "disk-utilization", "env", "env-variables", "files-count", "forwarded-ports", "health-check", "healthy-threshold", "host", "id", "idle-timeout", "image", "inbound-services", "instance-class", "instance-tag", "instances", "login", "manual-scaling", "max-concurrent-requests", "max-idle-instances", "max-instances", "max-pending-latency", "max-total-instances", "memory-gb", "min-idle-instances", "min-pending-latency", "min-total-instances", "name", "network", "network-utilization", "nobuild-files-regex", "request-utilization", "resources", "restart-threshold", "runtime", "script", "security-level", "serving-status", "source-url", "target-concurrent-requests", "target-read-bytes-per-second", "target-read-ops-per-second", "target-received-bytes-per-second", "target-received-packets-per-second", "target-request-count-per-second", "target-sent-bytes-per-second", "target-sent-packets-per-second", "target-utilization", "target-write-bytes-per-second", "target-write-ops-per-second", "threadsafe", "timeout", "unhealthy-threshold", "url", "version-url", "vm", "zip"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["aggregation-window-length", "api-config", "auth-fail-action", "automatic-scaling", "basic-scaling", "beta-settings", "check-interval", "config-id", "container", "cool-down-period", "cpu", "cpu-utilization", "create-time", "created-by", "default-expiration", "deployment", "disable-health-check", "disk-gb", "disk-usage-bytes", "disk-utilization", "endpoints-api-service", "env", "env-variables", "files-count", "forwarded-ports", "health-check", "healthy-threshold", "host", "id", "idle-timeout", "image", "inbound-services", "instance-class", "instance-tag", "instances", "login", "manual-scaling", "max-concurrent-requests", "max-idle-instances", "max-instances", "max-pending-latency", "max-total-instances", "memory-gb", "min-idle-instances", "min-pending-latency", "min-total-instances", "name", "network", "network-utilization", "nobuild-files-regex", "request-utilization", "resources", "restart-threshold", "runtime", "script", "security-level", "serving-status", "source-url", "subnetwork-name", "target-concurrent-requests", "target-read-bytes-per-second", "target-read-ops-per-second", "target-received-bytes-per-second", "target-received-packets-per-second", "target-request-count-per-second", "target-sent-bytes-per-second", "target-sent-packets-per-second", "target-utilization", "target-write-bytes-per-second", "target-write-ops-per-second", "threadsafe", "timeout", "unhealthy-threshold", "url", "version-url", "vm", "zip"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1385,6 +1580,9 @@ impl<'n> Engine<'n> { match self.opt.subcommand() { ("apps", Some(opt)) => { match opt.subcommand() { + ("create", Some(opt)) => { + call_result = self._apps_create(opt, dry_run, &mut err); + }, ("get", Some(opt)) => { call_result = self._apps_get(opt, dry_run, &mut err); }, @@ -1400,6 +1598,9 @@ impl<'n> Engine<'n> { ("operations-list", Some(opt)) => { call_result = self._apps_operations_list(opt, dry_run, &mut err); }, + ("patch", Some(opt)) => { + call_result = self._apps_patch(opt, dry_run, &mut err); + }, ("repair", Some(opt)) => { call_result = self._apps_repair(opt, dry_run, &mut err); }, @@ -1534,14 +1735,36 @@ impl<'n> Engine<'n> { fn main() { let mut exit_status = 0i32; let arg_data = [ - ("apps", "methods: 'get', 'locations-get', 'locations-list', 'operations-get', 'operations-list', 'repair', 'services-delete', 'services-get', 'services-list', 'services-patch', 'services-versions-create', 'services-versions-delete', 'services-versions-get', 'services-versions-instances-debug', 'services-versions-instances-delete', 'services-versions-instances-get', 'services-versions-instances-list', 'services-versions-list' and 'services-versions-patch'", vec![ + ("apps", "methods: 'create', 'get', 'locations-get', 'locations-list', 'operations-get', 'operations-list', 'patch', 'repair', 'services-delete', 'services-get', 'services-list', 'services-patch', 'services-versions-create', 'services-versions-delete', 'services-versions-get', 'services-versions-instances-debug', 'services-versions-instances-delete', 'services-versions-instances-get', 'services-versions-instances-list', 'services-versions-list' and 'services-versions-patch'", vec![ + ("create", + Some(r##"Creates an App Engine application for a Google Cloud Platform project. This requires a project that excludes an App Engine application. For details about creating a project without an application, see the Google Cloud Resource Manager create project topic (https://cloud.google.com/resource-manager/docs/creating-project)."##), + "Details at http://byron.github.io/google-apis-rs/google_appengine1_cli/apps_create", + vec![ + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), ("get", Some(r##"Gets information about an application."##), "Details at http://byron.github.io/google-apis-rs/google_appengine1_cli/apps_get", vec![ (Some(r##"apps-id"##), None, - Some(r##"Part of `name`. Name of the Application resource to get. Example: `apps/myapp`."##), + Some(r##"Part of `name`. Name of the Application resource to get. Example: apps/myapp."##), Some(true), Some(false)), @@ -1636,7 +1859,7 @@ fn main() { Some(false)), ]), ("operations-list", - Some(r##"Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`. NOTE: the `name` binding below allows API services to override the binding to use different resource name schemes, such as `users/*/operations`."##), + Some(r##"Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED.NOTE: the name binding below allows API services to override the binding to use different resource name schemes, such as users/*/operations."##), "Details at http://byron.github.io/google-apis-rs/google_appengine1_cli/apps_operations-list", vec![ (Some(r##"apps-id"##), @@ -1651,6 +1874,34 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates the specified Application resource. You can update the following fields: auth_domain (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps#Application.FIELDS.auth_domain) default_cookie_expiration (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps#Application.FIELDS.default_cookie_expiration)"##), + "Details at http://byron.github.io/google-apis-rs/google_appengine1_cli/apps_patch", + vec![ + (Some(r##"apps-id"##), + None, + Some(r##"Part of `name`. Name of the Application resource to update. Example: apps/myapp."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -1658,12 +1909,12 @@ fn main() { Some(false)), ]), ("repair", - Some(r##"Recreates the required App Engine features for the application in your project, for example a Cloud Storage bucket or App Engine service account. Use this method if you receive an error message about a missing feature, for example "*Error retrieving the App Engine service account*"."##), + Some(r##"Recreates the required App Engine features for the specified App Engine application, for example a Cloud Storage bucket or App Engine service account. Use this method if you receive an error message about a missing feature, for example, Error retrieving the App Engine service account."##), "Details at http://byron.github.io/google-apis-rs/google_appengine1_cli/apps_repair", vec![ (Some(r##"apps-id"##), None, - Some(r##"Part of `name`. Name of the application to repair. Example: `apps/myapp`"##), + Some(r##"Part of `name`. Name of the application to repair. Example: apps/myapp"##), Some(true), Some(false)), @@ -1691,7 +1942,7 @@ fn main() { vec![ (Some(r##"apps-id"##), None, - Some(r##"Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default`."##), + Some(r##"Part of `name`. Name of the resource requested. Example: apps/myapp/services/default."##), Some(true), Some(false)), @@ -1719,7 +1970,7 @@ fn main() { vec![ (Some(r##"apps-id"##), None, - Some(r##"Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default`."##), + Some(r##"Part of `name`. Name of the resource requested. Example: apps/myapp/services/default."##), Some(true), Some(false)), @@ -1747,7 +1998,7 @@ fn main() { vec![ (Some(r##"apps-id"##), None, - Some(r##"Part of `parent`. Name of the parent Application resource. Example: `apps/myapp`."##), + Some(r##"Part of `parent`. Name of the parent Application resource. Example: apps/myapp."##), Some(true), Some(false)), @@ -1769,7 +2020,7 @@ fn main() { vec![ (Some(r##"apps-id"##), None, - Some(r##"Part of `name`. Name of the resource to update. Example: `apps/myapp/services/default`."##), + Some(r##"Part of `name`. Name of the resource to update. Example: apps/myapp/services/default."##), Some(true), Some(false)), @@ -1803,7 +2054,7 @@ fn main() { vec![ (Some(r##"apps-id"##), None, - Some(r##"Part of `parent`. Name of the parent resource to create this version under. Example: `apps/myapp/services/default`."##), + Some(r##"Part of `parent`. Name of the parent resource to create this version under. Example: apps/myapp/services/default."##), Some(true), Some(false)), @@ -1837,7 +2088,7 @@ fn main() { vec![ (Some(r##"apps-id"##), None, - Some(r##"Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default/versions/v1`."##), + Some(r##"Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1."##), Some(true), Some(false)), @@ -1866,12 +2117,12 @@ fn main() { Some(false)), ]), ("services-versions-get", - Some(r##"Gets the specified Version resource. By default, only a `BASIC_VIEW` will be returned. Specify the `FULL_VIEW` parameter to get the full resource."##), + Some(r##"Gets the specified Version resource. By default, only a BASIC_VIEW will be returned. Specify the FULL_VIEW parameter to get the full resource."##), "Details at http://byron.github.io/google-apis-rs/google_appengine1_cli/apps_services-versions-get", vec![ (Some(r##"apps-id"##), None, - Some(r##"Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default/versions/v1`."##), + Some(r##"Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1."##), Some(true), Some(false)), @@ -1900,12 +2151,12 @@ fn main() { Some(false)), ]), ("services-versions-instances-debug", - Some(r##"Enables debugging on a VM instance. This allows you to use the SSH command to connect to the virtual machine where the instance lives. While in "debug mode", the instance continues to serve live traffic. You should delete the instance when you are done debugging and then allow the system to take over and determine if another instance should be started. Only applicable for instances in App Engine flexible environment."##), + Some(r##"Enables debugging on a VM instance. This allows you to use the SSH command to connect to the virtual machine where the instance lives. While in "debug mode", the instance continues to serve live traffic. You should delete the instance when you are done debugging and then allow the system to take over and determine if another instance should be started.Only applicable for instances in App Engine flexible environment."##), "Details at http://byron.github.io/google-apis-rs/google_appengine1_cli/apps_services-versions-instances-debug", vec![ (Some(r##"apps-id"##), None, - Some(r##"Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default/versions/v1/instances/instance-1`."##), + Some(r##"Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1/instances/instance-1."##), Some(true), Some(false)), @@ -1951,7 +2202,7 @@ fn main() { vec![ (Some(r##"apps-id"##), None, - Some(r##"Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default/versions/v1/instances/instance-1`."##), + Some(r##"Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1/instances/instance-1."##), Some(true), Some(false)), @@ -1991,7 +2242,7 @@ fn main() { vec![ (Some(r##"apps-id"##), None, - Some(r##"Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default/versions/v1/instances/instance-1`."##), + Some(r##"Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1/instances/instance-1."##), Some(true), Some(false)), @@ -2031,7 +2282,7 @@ fn main() { vec![ (Some(r##"apps-id"##), None, - Some(r##"Part of `parent`. Name of the parent Version resource. Example: `apps/myapp/services/default/versions/v1`."##), + Some(r##"Part of `parent`. Name of the parent Version resource. Example: apps/myapp/services/default/versions/v1."##), Some(true), Some(false)), @@ -2065,7 +2316,7 @@ fn main() { vec![ (Some(r##"apps-id"##), None, - Some(r##"Part of `parent`. Name of the parent Service resource. Example: `apps/myapp/services/default`."##), + Some(r##"Part of `parent`. Name of the parent Service resource. Example: apps/myapp/services/default."##), Some(true), Some(false)), @@ -2088,12 +2339,12 @@ fn main() { Some(false)), ]), ("services-versions-patch", - Some(r##"Updates the specified Version resource. You can specify the following fields depending on the App Engine environment and type of scaling that the version resource uses: * [`serving_status`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.serving_status): For Version resources that use basic scaling, manual scaling, or run in the App Engine flexible environment. * [`instance_class`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.instance_class): For Version resources that run in the App Engine standard environment. * [`automatic_scaling.min_idle_instances`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment. * [`automatic_scaling.max_idle_instances`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment."##), + Some(r##"Updates the specified Version resource. You can specify the following fields depending on the App Engine environment and type of scaling that the version resource uses: serving_status (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.serving_status): For Version resources that use basic scaling, manual scaling, or run in the App Engine flexible environment. instance_class (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.instance_class): For Version resources that run in the App Engine standard environment. automatic_scaling.min_idle_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment. automatic_scaling.max_idle_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment."##), "Details at http://byron.github.io/google-apis-rs/google_appengine1_cli/apps_services-versions-patch", vec![ (Some(r##"apps-id"##), None, - Some(r##"Part of `name`. Name of the resource to update. Example: `apps/myapp/services/default/versions/1`."##), + Some(r##"Part of `name`. Name of the resource to update. Example: apps/myapp/services/default/versions/1."##), Some(true), Some(false)), @@ -2133,7 +2384,7 @@ fn main() { let mut app = App::new("appengine1") .author("Sebastian Thiel ") - .version("1.0.0+20160802") + .version("1.0.0+20161208") .about("Provisions and manages App Engine applications.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_appengine1_cli") .arg(Arg::with_name("url") diff --git a/gen/appengine1/Cargo.toml b/gen/appengine1/Cargo.toml index cef608f6e8..95291d6e69 100644 --- a/gen/appengine1/Cargo.toml +++ b/gen/appengine1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-appengine1" -version = "1.0.0+20160802" +version = "1.0.0+20161208" authors = ["Sebastian Thiel "] description = "A complete library to interact with appengine (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/appengine1" diff --git a/gen/appengine1/README.md b/gen/appengine1/README.md index 322ce6a5c5..e28b4afdc5 100644 --- a/gen/appengine1/README.md +++ b/gen/appengine1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-appengine1` library allows access to all features of the *Google appengine* service. -This documentation was generated from *appengine* crate version *1.0.0+20160802*, where *20160802* is the exact revision of the *appengine:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *appengine* crate version *1.0.0+20161208*, where *20161208* is the exact revision of the *appengine:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *appengine* *v1* API can be found at the [official documentation site](https://cloud.google.com/appengine/docs/admin-api/). @@ -14,7 +14,7 @@ Everything else about the *appengine* *v1* API can be found at the Handle the following *Resources* with ease from the central [hub](http://byron.github.io/google-apis-rs/google_appengine1/struct.Appengine.html) ... * apps - * [*get*](http://byron.github.io/google-apis-rs/google_appengine1/struct.AppGetCall.html), [*locations get*](http://byron.github.io/google-apis-rs/google_appengine1/struct.AppLocationGetCall.html), [*locations list*](http://byron.github.io/google-apis-rs/google_appengine1/struct.AppLocationListCall.html), [*operations get*](http://byron.github.io/google-apis-rs/google_appengine1/struct.AppOperationGetCall.html), [*operations list*](http://byron.github.io/google-apis-rs/google_appengine1/struct.AppOperationListCall.html), [*repair*](http://byron.github.io/google-apis-rs/google_appengine1/struct.AppRepairCall.html), [*services delete*](http://byron.github.io/google-apis-rs/google_appengine1/struct.AppServiceDeleteCall.html), [*services get*](http://byron.github.io/google-apis-rs/google_appengine1/struct.AppServiceGetCall.html), [*services list*](http://byron.github.io/google-apis-rs/google_appengine1/struct.AppServiceListCall.html), [*services patch*](http://byron.github.io/google-apis-rs/google_appengine1/struct.AppServicePatchCall.html), [*services versions create*](http://byron.github.io/google-apis-rs/google_appengine1/struct.AppServiceVersionCreateCall.html), [*services versions delete*](http://byron.github.io/google-apis-rs/google_appengine1/struct.AppServiceVersionDeleteCall.html), [*services versions get*](http://byron.github.io/google-apis-rs/google_appengine1/struct.AppServiceVersionGetCall.html), [*services versions instances debug*](http://byron.github.io/google-apis-rs/google_appengine1/struct.AppServiceVersionInstanceDebugCall.html), [*services versions instances delete*](http://byron.github.io/google-apis-rs/google_appengine1/struct.AppServiceVersionInstanceDeleteCall.html), [*services versions instances get*](http://byron.github.io/google-apis-rs/google_appengine1/struct.AppServiceVersionInstanceGetCall.html), [*services versions instances list*](http://byron.github.io/google-apis-rs/google_appengine1/struct.AppServiceVersionInstanceListCall.html), [*services versions list*](http://byron.github.io/google-apis-rs/google_appengine1/struct.AppServiceVersionListCall.html) and [*services versions patch*](http://byron.github.io/google-apis-rs/google_appengine1/struct.AppServiceVersionPatchCall.html) + * [*create*](http://byron.github.io/google-apis-rs/google_appengine1/struct.AppCreateCall.html), [*get*](http://byron.github.io/google-apis-rs/google_appengine1/struct.AppGetCall.html), [*locations get*](http://byron.github.io/google-apis-rs/google_appengine1/struct.AppLocationGetCall.html), [*locations list*](http://byron.github.io/google-apis-rs/google_appengine1/struct.AppLocationListCall.html), [*operations get*](http://byron.github.io/google-apis-rs/google_appengine1/struct.AppOperationGetCall.html), [*operations list*](http://byron.github.io/google-apis-rs/google_appengine1/struct.AppOperationListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_appengine1/struct.AppPatchCall.html), [*repair*](http://byron.github.io/google-apis-rs/google_appengine1/struct.AppRepairCall.html), [*services delete*](http://byron.github.io/google-apis-rs/google_appengine1/struct.AppServiceDeleteCall.html), [*services get*](http://byron.github.io/google-apis-rs/google_appengine1/struct.AppServiceGetCall.html), [*services list*](http://byron.github.io/google-apis-rs/google_appengine1/struct.AppServiceListCall.html), [*services patch*](http://byron.github.io/google-apis-rs/google_appengine1/struct.AppServicePatchCall.html), [*services versions create*](http://byron.github.io/google-apis-rs/google_appengine1/struct.AppServiceVersionCreateCall.html), [*services versions delete*](http://byron.github.io/google-apis-rs/google_appengine1/struct.AppServiceVersionDeleteCall.html), [*services versions get*](http://byron.github.io/google-apis-rs/google_appengine1/struct.AppServiceVersionGetCall.html), [*services versions instances debug*](http://byron.github.io/google-apis-rs/google_appengine1/struct.AppServiceVersionInstanceDebugCall.html), [*services versions instances delete*](http://byron.github.io/google-apis-rs/google_appengine1/struct.AppServiceVersionInstanceDeleteCall.html), [*services versions instances get*](http://byron.github.io/google-apis-rs/google_appengine1/struct.AppServiceVersionInstanceGetCall.html), [*services versions instances list*](http://byron.github.io/google-apis-rs/google_appengine1/struct.AppServiceVersionInstanceListCall.html), [*services versions list*](http://byron.github.io/google-apis-rs/google_appengine1/struct.AppServiceVersionListCall.html) and [*services versions patch*](http://byron.github.io/google-apis-rs/google_appengine1/struct.AppServiceVersionPatchCall.html) @@ -48,7 +48,9 @@ Or specifically ... ```ignore let r = hub.apps().services_versions_create(...).doit() +let r = hub.apps().patch(...).doit() let r = hub.apps().services_versions_instances_debug(...).doit() +let r = hub.apps().create(...).doit() let r = hub.apps().services_versions_instances_delete(...).doit() let r = hub.apps().services_versions_patch(...).doit() let r = hub.apps().operations_get(...).doit() diff --git a/gen/appengine1/src/lib.rs b/gen/appengine1/src/lib.rs index c4fbaf5f56..1276b123fa 100644 --- a/gen/appengine1/src/lib.rs +++ b/gen/appengine1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *appengine* crate version *1.0.0+20160802*, where *20160802* is the exact revision of the *appengine:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *appengine* crate version *1.0.0+20161208*, where *20161208* is the exact revision of the *appengine:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *appengine* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/appengine/docs/admin-api/). @@ -12,7 +12,7 @@ //! Handle the following *Resources* with ease from the central [hub](struct.Appengine.html) ... //! //! * apps -//! * [*get*](struct.AppGetCall.html), [*locations get*](struct.AppLocationGetCall.html), [*locations list*](struct.AppLocationListCall.html), [*operations get*](struct.AppOperationGetCall.html), [*operations list*](struct.AppOperationListCall.html), [*repair*](struct.AppRepairCall.html), [*services delete*](struct.AppServiceDeleteCall.html), [*services get*](struct.AppServiceGetCall.html), [*services list*](struct.AppServiceListCall.html), [*services patch*](struct.AppServicePatchCall.html), [*services versions create*](struct.AppServiceVersionCreateCall.html), [*services versions delete*](struct.AppServiceVersionDeleteCall.html), [*services versions get*](struct.AppServiceVersionGetCall.html), [*services versions instances debug*](struct.AppServiceVersionInstanceDebugCall.html), [*services versions instances delete*](struct.AppServiceVersionInstanceDeleteCall.html), [*services versions instances get*](struct.AppServiceVersionInstanceGetCall.html), [*services versions instances list*](struct.AppServiceVersionInstanceListCall.html), [*services versions list*](struct.AppServiceVersionListCall.html) and [*services versions patch*](struct.AppServiceVersionPatchCall.html) +//! * [*create*](struct.AppCreateCall.html), [*get*](struct.AppGetCall.html), [*locations get*](struct.AppLocationGetCall.html), [*locations list*](struct.AppLocationListCall.html), [*operations get*](struct.AppOperationGetCall.html), [*operations list*](struct.AppOperationListCall.html), [*patch*](struct.AppPatchCall.html), [*repair*](struct.AppRepairCall.html), [*services delete*](struct.AppServiceDeleteCall.html), [*services get*](struct.AppServiceGetCall.html), [*services list*](struct.AppServiceListCall.html), [*services patch*](struct.AppServicePatchCall.html), [*services versions create*](struct.AppServiceVersionCreateCall.html), [*services versions delete*](struct.AppServiceVersionDeleteCall.html), [*services versions get*](struct.AppServiceVersionGetCall.html), [*services versions instances debug*](struct.AppServiceVersionInstanceDebugCall.html), [*services versions instances delete*](struct.AppServiceVersionInstanceDeleteCall.html), [*services versions instances get*](struct.AppServiceVersionInstanceGetCall.html), [*services versions instances list*](struct.AppServiceVersionInstanceListCall.html), [*services versions list*](struct.AppServiceVersionListCall.html) and [*services versions patch*](struct.AppServiceVersionPatchCall.html) //! //! //! @@ -48,7 +48,9 @@ //! //! ```ignore //! let r = hub.apps().services_versions_create(...).doit() +//! let r = hub.apps().patch(...).doit() //! let r = hub.apps().services_versions_instances_debug(...).doit() +//! let r = hub.apps().create(...).doit() //! let r = hub.apps().services_versions_instances_delete(...).doit() //! let r = hub.apps().services_versions_patch(...).doit() //! let r = hub.apps().operations_get(...).doit() diff --git a/gen/appengine1/src/lib.rs.in b/gen/appengine1/src/lib.rs.in index 152e541a72..b4f8ccab00 100644 --- a/gen/appengine1/src/lib.rs.in +++ b/gen/appengine1/src/lib.rs.in @@ -40,14 +40,22 @@ pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, /// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). #[derive(PartialEq, Eq, Hash)] pub enum Scope { + /// View and manage your applications deployed on Google App Engine + Admin, + /// View and manage your data across Google Cloud Platform services CloudPlatform, + + /// View your data across Google Cloud Platform services + CloudPlatformReadOnly, } impl AsRef for Scope { fn as_ref(&self) -> &str { match *self { + Scope::Admin => "https://www.googleapis.com/auth/appengine.admin", Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform", + Scope::CloudPlatformReadOnly => "https://www.googleapis.com/auth/cloud-platform.read-only", } } } @@ -160,7 +168,7 @@ impl<'a, C, A> Appengine // ############ // SCHEMAS ### // ########## -/// Response message for `Instances.ListInstances`. +/// Response message for Instances.ListInstances. /// /// # Activities /// @@ -193,8 +201,11 @@ pub struct Network { /// List of ports, or port pairs, to forward from the virtual machine to the application container. #[serde(rename="forwardedPorts")] pub forwarded_ports: Option>, - /// Google Cloud Platform network where the virtual machines are created. Specify the short name, not the resource path. Defaults to `default`. + /// Google Cloud Platform network where the virtual machines are created. Specify the short name, not the resource path.Defaults to default. pub name: Option, + /// Google Cloud Platform sub-network where the virtual machines are created. Specify the short name, not the resource path.If a subnetwork name is specified, a network name will also be required unless it is for the default network. If the network the VM instance is being created in is a Legacy network, then the IP address is allocated from the IPv4Range. If the network the VM instance is being created in is an auto Subnet Mode Network, then only network name should be specified (not the subnetwork_name) and the IP address is created from the IPCidrRange of the subnetwork that exists in that zone for that network. If the network the VM instance is being created in is a custom Subnet Mode Network, then the subnetwork_name must be specified and the IP address is created from the IPCidrRange of the subnetwork.If specified, the subnetwork must exist in the same region as the Flex app. + #[serde(rename="subnetworkName")] + pub subnetwork_name: Option, } impl Part for Network {} @@ -214,9 +225,9 @@ impl Part for Network {} pub struct Service { /// Mapping that defines fractional HTTP traffic diversion to different versions within the service. pub split: Option, - /// Relative name of the service within the application. Example: `default`. @OutputOnly + /// Relative name of the service within the application. Example: default.@OutputOnly pub id: Option, - /// Full path to the Service resource in the API. Example: `apps/myapp/services/default`. @OutputOnly + /// Full path to the Service resource in the API. Example: apps/myapp/services/default.@OutputOnly pub name: Option, } @@ -246,37 +257,40 @@ impl RequestValue for RepairApplicationRequest {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// +/// * [create apps](struct.AppCreateCall.html) (request) +/// * [patch apps](struct.AppPatchCall.html) (request) /// * [get apps](struct.AppGetCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Application { - /// Hostname used to reach this application, as resolved by App Engine. @OutputOnly + /// Hostname used to reach this application, as resolved by App Engine.@OutputOnly #[serde(rename="defaultHostname")] pub default_hostname: Option, - /// Full path to the Application resource in the API. Example: `apps/myapp`. @OutputOnly + /// Full path to the Application resource in the API. Example: apps/myapp.@OutputOnly pub name: Option, - /// Google Cloud Storage bucket that can be used for storing files associated with this application. This bucket is associated with the application and can be used by the gcloud deployment commands. @OutputOnly + /// Google Cloud Storage bucket that can be used for storing files associated with this application. This bucket is associated with the application and can be used by the gcloud deployment commands.@OutputOnly #[serde(rename="codeBucket")] pub code_bucket: Option, - /// Google Cloud Storage bucket that can be used by this application to store content. @OutputOnly + /// Google Cloud Storage bucket that can be used by this application to store content.@OutputOnly #[serde(rename="defaultBucket")] pub default_bucket: Option, - /// HTTP path dispatch rules for requests to the application that do not explicitly target a service or version. Rules are order-dependent. @OutputOnly + /// HTTP path dispatch rules for requests to the application that do not explicitly target a service or version. Rules are order-dependent.@OutputOnly #[serde(rename="dispatchRules")] pub dispatch_rules: Option>, - /// Cookie expiration policy for this application. @OutputOnly + /// Cookie expiration policy for this application. #[serde(rename="defaultCookieExpiration")] pub default_cookie_expiration: Option, - /// Location from which this application will be run. Application instances will run out of data centers in the chosen location, which is also where all of the application's end user content is stored. Defaults to `us-central`. Options are: `us-central` - Central US `europe-west` - Western Europe `us-east1` - Eastern US + /// Location from which this application will be run. Application instances will run out of data centers in the chosen location, which is also where all of the application's end user content is stored.Defaults to us-central.Options are:us-central - Central USeurope-west - Western Europeus-east1 - Eastern US #[serde(rename="locationId")] pub location_id: Option, - /// Google Apps authentication domain that controls which users can access this application. Defaults to open access for any Google Account. + /// Google Apps authentication domain that controls which users can access this application.Defaults to open access for any Google Account. #[serde(rename="authDomain")] pub auth_domain: Option, - /// Identifier of the Application resource. This identifier is equivalent to the project ID of the Google Cloud Platform project where you want to deploy your application. Example: `myapp`. + /// Identifier of the Application resource. This identifier is equivalent to the project ID of the Google Cloud Platform project where you want to deploy your application. Example: myapp. pub id: Option, } +impl RequestValue for Application {} impl ResponseResult for Application {} @@ -293,10 +307,13 @@ impl ResponseResult for Application {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Version { + /// Cloud Endpoints configuration.If endpoints_api_service is set, the Cloud Endpoints Extensible Service Proxy will be provided to serve the API implemented by the app. + #[serde(rename="endpointsApiService")] + pub endpoints_api_service: Option, /// A service with basic scaling will create an instance when the application receives a request. The instance will be turned down when the app becomes idle. Basic scaling is ideal for work that is intermittent or driven by user activity. #[serde(rename="basicScaling")] pub basic_scaling: Option, - /// Full path to the Version resource in the API. Example: `apps/myapp/services/default/versions/v1`. @OutputOnly + /// Full path to the Version resource in the API. Example: apps/myapp/services/default/versions/v1.@OutputOnly pub name: Option, /// Metadata settings that are supplied to this version to enable beta runtime features. #[serde(rename="betaSettings")] @@ -306,62 +323,62 @@ pub struct Version { pub manual_scaling: Option, /// Whether to deploy this version in a container on a virtual machine. pub vm: Option, - /// Time that this version was created. @OutputOnly + /// Time that this version was created.@OutputOnly #[serde(rename="createTime")] pub create_time: Option, /// Before an application can receive email or XMPP messages, the application must be configured to enable the service. #[serde(rename="inboundServices")] pub inbound_services: Option>, - /// Instance class that is used to run this version. Valid values are: * AutomaticScaling: `F1`, `F2`, `F4`, `F4_1G` * ManualScaling or BasicScaling: `B1`, `B2`, `B4`, `B8`, `B4_1G` Defaults to `F1` for AutomaticScaling and `B1` for ManualScaling or BasicScaling. + /// Instance class that is used to run this version. Valid values are: AutomaticScaling: F1, F2, F4, F4_1G ManualScaling or BasicScaling: B1, B2, B4, B8, B4_1GDefaults to F1 for AutomaticScaling and B1 for ManualScaling or BasicScaling. #[serde(rename="instanceClass")] pub instance_class: Option, - /// Email address of the user who created this version. @OutputOnly + /// Email address of the user who created this version.@OutputOnly #[serde(rename="createdBy")] pub created_by: Option, - /// Code and application artifacts that make up this version. Only returned in `GET` requests if `view=FULL` is set. + /// Code and application artifacts that make up this version.Only returned in GET requests if view=FULL is set. pub deployment: Option, - /// Custom static error pages. Limited to 10KB per page. Only returned in `GET` requests if `view=FULL` is set. + /// Custom static error pages. Limited to 10KB per page.Only returned in GET requests if view=FULL is set. #[serde(rename="errorHandlers")] pub error_handlers: Option>, - /// Current serving status of this version. Only the versions with a `SERVING` status create instances and can be billed. `SERVING_STATUS_UNSPECIFIED` is an invalid value. Defaults to `SERVING`. + /// Current serving status of this version. Only the versions with a SERVING status create instances and can be billed.SERVING_STATUS_UNSPECIFIED is an invalid value. Defaults to SERVING. #[serde(rename="servingStatus")] pub serving_status: Option, - /// Relative name of the version within the service. Example: `v1`. Version names can contain only lowercase letters, numbers, or hyphens. Reserved names: "default", "latest", and any name with the prefix "ah-". + /// Relative name of the version within the service. Example: v1. Version names can contain only lowercase letters, numbers, or hyphens. Reserved names: "default", "latest", and any name with the prefix "ah-". pub id: Option, /// Extra network settings. Only applicable for VM runtimes. pub network: Option, - /// Serving configuration for [Google Cloud Endpoints](https://cloud.google.com/appengine/docs/python/endpoints/). Only returned in `GET` requests if `view=FULL` is set. + /// Serving configuration for Google Cloud Endpoints (https://cloud.google.com/appengine/docs/python/endpoints/).Only returned in GET requests if view=FULL is set. #[serde(rename="apiConfig")] pub api_config: Option, - /// Files that match this pattern will not be built into this version. Only applicable for Go runtimes. Only returned in `GET` requests if `view=FULL` is set. + /// Files that match this pattern will not be built into this version. Only applicable for Go runtimes.Only returned in GET requests if view=FULL is set. #[serde(rename="nobuildFilesRegex")] pub nobuild_files_regex: Option, /// Whether multiple requests can be dispatched to this version at once. pub threadsafe: Option, - /// An ordered list of URL-matching patterns that should be applied to incoming requests. The first matching URL handles the request and other request handlers are not attempted. Only returned in `GET` requests if `view=FULL` is set. + /// An ordered list of URL-matching patterns that should be applied to incoming requests. The first matching URL handles the request and other request handlers are not attempted.Only returned in GET requests if view=FULL is set. pub handlers: Option>, - /// Configures health checking for VM instances. Unhealthy instances are stopped and replaced with new instances. Only applicable for VM runtimes. Only returned in `GET` requests if `view=FULL` is set. + /// Configures health checking for VM instances. Unhealthy instances are stopped and replaced with new instances. Only applicable for VM runtimes.Only returned in GET requests if view=FULL is set. #[serde(rename="healthCheck")] pub health_check: Option, - /// Duration that static files should be cached by web proxies and browsers. Only applicable if the corresponding [StaticFilesHandler](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#staticfileshandler) does not specify its own expiration time. Only returned in `GET` requests if `view=FULL` is set. + /// Duration that static files should be cached by web proxies and browsers. Only applicable if the corresponding StaticFilesHandler (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#staticfileshandler) does not specify its own expiration time.Only returned in GET requests if view=FULL is set. #[serde(rename="defaultExpiration")] pub default_expiration: Option, - /// Serving URL for this version. Example: "https://myversion-dot-myservice-dot-myapp.appspot.com" @OutputOnly + /// Serving URL for this version. Example: "https://myversion-dot-myservice-dot-myapp.appspot.com"@OutputOnly #[serde(rename="versionUrl")] pub version_url: Option, - /// Configuration for third-party Python runtime libraries that are required by the application. Only returned in `GET` requests if `view=FULL` is set. + /// Configuration for third-party Python runtime libraries that are required by the application.Only returned in GET requests if view=FULL is set. pub libraries: Option>, - /// App Engine execution environment for this version. Defaults to `standard`. + /// App Engine execution environment for this version.Defaults to standard. pub env: Option, - /// Total size in bytes of all the files that are included in this version and curerntly hosted on the App Engine disk. @OutputOnly + /// Total size in bytes of all the files that are included in this version and curerntly hosted on the App Engine disk.@OutputOnly #[serde(rename="diskUsageBytes")] pub disk_usage_bytes: Option, /// Automatic scaling is based on request rate, response latencies, and other application metrics. #[serde(rename="automaticScaling")] pub automatic_scaling: Option, - /// Desired runtime. Example: `python27`. + /// Desired runtime. Example: python27. pub runtime: Option, - /// Environment variables available to the application. Only returned in `GET` requests if `view=FULL` is set. + /// Environment variables available to the application.Only returned in GET requests if view=FULL is set. #[serde(rename="envVariables")] pub env_variables: Option>, /// Machine resources for this version. Only applicable for VM runtimes. @@ -406,10 +423,10 @@ impl ResponseResult for ListLocationsResponse {} pub struct Location { /// Cross-service attributes for the location. For example {"cloud.googleapis.com/region": "us-east1"} pub labels: Option>, - /// The cononical id for this location. For example: `"us-east1"`. + /// The canonical id for this location. For example: "us-east1". #[serde(rename="locationId")] pub location_id: Option, - /// Resource name for the location, which may vary between implementations. For example: `"projects/example-project/locations/us-east1"` + /// Resource name for the location, which may vary between implementations. For example: "projects/example-project/locations/us-east1" pub name: Option, /// Service-specific metadata. For example the available capacity at the given location. pub metadata: Option>, @@ -418,7 +435,7 @@ pub struct Location { impl ResponseResult for Location {} -/// Request message for `Instances.DebugInstance`. +/// Request message for Instances.DebugInstance. /// /// # Activities /// @@ -428,7 +445,11 @@ impl ResponseResult for Location {} /// * [services versions instances debug apps](struct.AppServiceVersionInstanceDebugCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DebugInstanceRequest { _never_set: Option } +pub struct DebugInstanceRequest { + /// Public SSH key to add to the instance. Examples: [USERNAME]:ssh-rsa [KEY_VALUE] [USERNAME] [USERNAME]:ssh-rsa [KEY_VALUE] google-ssh {"userName":"[USERNAME]","expireOn":"[EXPIRE_TIME]"}For more information, see Adding and Removing SSH Keys (https://cloud.google.com/compute/docs/instances/adding-removing-ssh-keys). + #[serde(rename="sshKey")] + pub ssh_key: Option, +} impl RequestValue for DebugInstanceRequest {} @@ -456,20 +477,22 @@ impl Part for CpuUtilization {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Resources { + /// Memory (GB) needed. + #[serde(rename="memoryGb")] + pub memory_gb: Option, /// Disk size (GB) needed. #[serde(rename="diskGb")] pub disk_gb: Option, /// Number of CPU cores needed. pub cpu: Option, - /// Memory (GB) needed. - #[serde(rename="memoryGb")] - pub memory_gb: Option, + /// User specified volumes. + pub volumes: Option>, } impl Part for Resources {} -/// The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). The error model is designed to be: - Simple to use and understand for most users - Flexible enough to meet unexpected needs # Overview The `Status` message contains three pieces of data: error code, error message, and error details. The error code should be an enum value of google.rpc.Code, but it may accept additional error codes if needed. The error message should be a developer-facing English message that helps developers *understand* and *resolve* the error. If a localized user-facing error message is needed, put the localized message in the error details or localize it in the client. The optional error details may contain arbitrary information about the error. There is a predefined set of error detail types in the package `google.rpc` which can be used for common error conditions. # Language mapping The `Status` message is the logical representation of the error model, but it is not necessarily the actual wire format. When the `Status` message is exposed in different client libraries and different wire protocols, it can be mapped differently. For example, it will likely be mapped to some exceptions in Java, but more likely mapped to some error codes in C. # Other uses The error model and the `Status` message can be used in a variety of environments, either with or without APIs, to provide a consistent developer experience across different environments. Example uses of this error model include: - Partial errors. If a service needs to return partial errors to the client, it may embed the `Status` in the normal response to indicate the partial errors. - Workflow errors. A typical workflow has multiple steps. Each step may have a `Status` message for error reporting purpose. - Batch operations. If a client uses batch request and batch response, the `Status` message should be used directly inside batch response, one for each error sub-response. - Asynchronous operations. If an API call embeds asynchronous operation results in its response, the status of those operations should be represented directly using the `Status` message. - Logging. If some API errors are stored in logs, the message `Status` could be used directly after any stripping needed for security/privacy reasons. +/// The Status type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by gRPC (https://github.com/grpc). The error model is designed to be: Simple to use and understand for most users Flexible enough to meet unexpected needsOverviewThe Status message contains three pieces of data: error code, error message, and error details. The error code should be an enum value of google.rpc.Code, but it may accept additional error codes if needed. The error message should be a developer-facing English message that helps developers understand and resolve the error. If a localized user-facing error message is needed, put the localized message in the error details or localize it in the client. The optional error details may contain arbitrary information about the error. There is a predefined set of error detail types in the package google.rpc which can be used for common error conditions.Language mappingThe Status message is the logical representation of the error model, but it is not necessarily the actual wire format. When the Status message is exposed in different client libraries and different wire protocols, it can be mapped differently. For example, it will likely be mapped to some exceptions in Java, but more likely mapped to some error codes in C.Other usesThe error model and the Status message can be used in a variety of environments, either with or without APIs, to provide a consistent developer experience across different environments.Example uses of this error model include: Partial errors. If a service needs to return partial errors to the client, it may embed the Status in the normal response to indicate the partial errors. Workflow errors. A typical workflow has multiple steps. Each step may have a Status message for error reporting purpose. Batch operations. If a client uses batch request and batch response, the Status message should be used directly inside batch response, one for each error sub-response. Asynchronous operations. If an API call embeds asynchronous operation results in its response, the status of those operations should be represented directly using the Status message. Logging. If some API errors are stored in logs, the message Status could be used directly after any stripping needed for security/privacy reasons. /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -509,7 +532,7 @@ impl Part for BasicScaling {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct StaticFilesHandler { - /// MIME type used to serve all files served by this handler. Defaults to file-specific MIME types, which are derived from each file's filename extension. + /// MIME type used to serve all files served by this handler.Defaults to file-specific MIME types, which are derived from each file's filename extension. #[serde(rename="mimeType")] pub mime_type: Option, /// Time a static file served by this handler should be cached by web proxies and browsers. @@ -556,7 +579,7 @@ pub struct NetworkUtilization { impl Part for NetworkUtilization {} -/// Response message for `Versions.ListVersions`. +/// Response message for Versions.ListVersions. /// /// # Activities /// @@ -577,7 +600,26 @@ pub struct ListVersionsResponse { impl ResponseResult for ListVersionsResponse {} -/// Response message for `Services.ListServices`. +/// Volumes mounted within the app container. Only applicable for VM runtimes. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Volume { + /// Underlying volume type, e.g. 'tmpfs'. + #[serde(rename="volumeType")] + pub volume_type: Option, + /// Unique name for the volume. + pub name: Option, + /// Volume size in gigabytes. + #[serde(rename="sizeGb")] + pub size_gb: Option, +} + +impl Part for Volume {} + + +/// Response message for Services.ListServices. /// /// # Activities /// @@ -618,11 +660,11 @@ impl Part for ScriptHandler {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct UrlDispatchRule { - /// Pathname within the host. Must start with a "`/`". A single "`*`" can be included at the end of the path. The sum of the lengths of the domain and path may not exceed 100 characters. + /// Pathname within the host. Must start with a "/". A single "*" can be included at the end of the path. The sum of the lengths of the domain and path may not exceed 100 characters. pub path: Option, - /// Domain name to match against. The wildcard "`*`" is supported if specified before a period: "`*.`". Defaults to matching all domains: "`*`". + /// Domain name to match against. The wildcard "*" is supported if specified before a period: "*.".Defaults to matching all domains: "*". pub domain: Option, - /// Resource ID of a service in this application that should serve the matched request. The service must already exist. Example: `default`. + /// Resource ID of a service in this application that should serve the matched request. The service must already exist. Example: default. pub service: Option, } @@ -699,7 +741,7 @@ pub struct ErrorHandler { /// Error condition this handler applies to. #[serde(rename="errorCode")] pub error_code: Option, - /// MIME type of file. Defaults to `text/html`. + /// MIME type of file. Defaults to text/html. #[serde(rename="mimeType")] pub mime_type: Option, /// Static file content to be served for this error. @@ -737,13 +779,13 @@ pub struct AutomaticScaling { /// Target scaling by request utilization. #[serde(rename="requestUtilization")] pub request_utilization: Option, - /// Amount of time that the [Autoscaler](https://cloud.google.com/compute/docs/autoscaler/) should wait between changes to the number of virtual machines. Only applicable for VM runtimes. + /// Amount of time that the Autoscaler (https://cloud.google.com/compute/docs/autoscaler/) should wait between changes to the number of virtual machines. Only applicable for VM runtimes. #[serde(rename="coolDownPeriod")] pub cool_down_period: Option, /// Maximum number of instances that should be started to handle requests. #[serde(rename="maxTotalInstances")] pub max_total_instances: Option, - /// Number of concurrent requests an automatic scaling instance can accept before the scheduler spawns a new instance. Defaults to a runtime-specific value. + /// Number of concurrent requests an automatic scaling instance can accept before the scheduler spawns a new instance.Defaults to a runtime-specific value. #[serde(rename="maxConcurrentRequests")] pub max_concurrent_requests: Option, /// Minimum number of instances that should be maintained for this version. @@ -766,7 +808,7 @@ pub struct UrlMap { /// Security (HTTPS) enforcement for this URL. #[serde(rename="securityLevel")] pub security_level: Option, - /// Action to take when users access resources that require authentication. Defaults to `redirect`. + /// Action to take when users access resources that require authentication. Defaults to redirect. #[serde(rename="authFailAction")] pub auth_fail_action: Option, /// URL prefix. Uses regular expression syntax, which means regexp special characters must be escaped, but should not contain groupings. All URLs that begin with this prefix are handled by this handler, using the portion of the URL after the prefix as part of the file path. @@ -782,7 +824,7 @@ pub struct UrlMap { pub api_endpoint: Option, /// Level of login required to access this resource. pub login: Option, - /// `30x` code to use when performing redirects for the `secure` field. Defaults to `302`. + /// 30x code to use when performing redirects for the secure field. Defaults to 302. #[serde(rename="redirectHttpResponseCode")] pub redirect_http_response_code: Option, } @@ -796,10 +838,10 @@ impl Part for UrlMap {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct FileInfo { - /// The MIME type of the file. Defaults to the value from Google Cloud Storage. + /// The MIME type of the file.Defaults to the value from Google Cloud Storage. #[serde(rename="mimeType")] pub mime_type: Option, - /// URL source to use to fetch this file. Must be a URL to a resource in Google Cloud Storage in the form 'http(s)://storage.googleapis.com/\/\'. + /// URL source to use to fetch this file. Must be a URL to a resource in Google Cloud Storage in the form 'http(s)://storage.googleapis.com//'. #[serde(rename="sourceUrl")] pub source_url: Option, /// The SHA1 hash of the file, in hex. @@ -810,7 +852,7 @@ pub struct FileInfo { impl Part for FileInfo {} -/// There is no detailed description. +/// The zip file information for a zip deployment. /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -819,7 +861,7 @@ pub struct ZipInfo { /// An estimate of the number of files in a zip for a zip deployment. If set, must be greater than or equal to the actual number of files. Used for optimizing performance; if not provided, deployment may be slow. #[serde(rename="filesCount")] pub files_count: Option, - /// URL of the zip file to deploy from. Must be a URL to a resource in Google Cloud Storage in the form 'http(s)://storage.googleapis.com/\/\'. + /// URL of the zip file to deploy from. Must be a URL to a resource in Google Cloud Storage in the form 'http(s)://storage.googleapis.com//'. #[serde(rename="sourceUrl")] pub source_url: Option, } @@ -827,6 +869,22 @@ pub struct ZipInfo { impl Part for ZipInfo {} +/// Cloud Endpoints (https://cloud.google.com/endpoints) configuration. The Endpoints API Service provides tooling for serving Open API and gRPC endpoints via an NGINX proxy.The fields here refer to the name and configuration id of a "service" resource in the Service Management API (https://cloud.google.com/service-management/overview). +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct EndpointsApiService { + /// Endpoints service configuration id as specified by the Service Management API. For example "2016-09-19r1" + #[serde(rename="configId")] + pub config_id: Option, + /// Endpoints service name which is the name of the "service" resource in the Service Management API. For example "myapi.endpoints.myproject.cloud.goog" + pub name: Option, +} + +impl Part for EndpointsApiService {} + + /// The response message for Operations.ListOperations. /// /// # Activities @@ -859,45 +917,48 @@ impl ResponseResult for ListOperationsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Instance { - /// Number of errors since this instance was started. @OutputOnly - pub errors: Option, - /// Full path to the Instance resource in the API. Example: `apps/myapp/services/default/versions/v1/instances/instance-1`. @OutputOnly - pub name: Option, - /// App Engine release this instance is running on. @OutputOnly + /// App Engine release this instance is running on.@OutputOnly #[serde(rename="appEngineRelease")] pub app_engine_release: Option, - /// Virtual machine ID of this instance. Only applicable for instances in App Engine flexible environment. @OutputOnly + /// Virtual machine ID of this instance. Only applicable for instances in App Engine flexible environment.@OutputOnly #[serde(rename="vmId")] pub vm_id: Option, - /// Total memory in use (bytes). @OutputOnly + /// Total memory in use (bytes).@OutputOnly #[serde(rename="memoryUsage")] pub memory_usage: Option, - /// Availability of the instance. @OutputOnly - pub availability: Option, - /// Average latency (ms) over the last minute. @OutputOnly - #[serde(rename="averageLatency")] - pub average_latency: Option, - /// Whether this instance is in debug mode. Only applicable for instances in App Engine flexible environment. @OutputOnly + /// Whether this instance is in debug mode. Only applicable for instances in App Engine flexible environment.@OutputOnly #[serde(rename="vmDebugEnabled")] pub vm_debug_enabled: Option, - /// Time that this instance was started. @OutputOnly + /// Time that this instance was started.@OutputOnly #[serde(rename="startTime")] pub start_time: Option, - /// Average queries per second (QPS) over the last minute. @OutputOnly + /// The IP address of this instance. Only applicable for instances in App Engine flexible environment.@OutputOnly + #[serde(rename="vmIp")] + pub vm_ip: Option, + /// Average queries per second (QPS) over the last minute.@OutputOnly pub qps: Option, - /// Number of requests since this instance was started. @OutputOnly - pub requests: Option, - /// Name of the virtual machine where this instance lives. Only applicable for instances in App Engine flexible environment. @OutputOnly - #[serde(rename="vmName")] - pub vm_name: Option, - /// Relative name of the instance within the version. Example: `instance-1`. @OutputOnly - pub id: Option, - /// Zone where the virtual machine is located. Only applicable for instances in App Engine flexible environment. @OutputOnly - #[serde(rename="vmZoneName")] - pub vm_zone_name: Option, - /// Status of the virtual machine where this instance lives. Only applicable for instances in App Engine flexible environment. @OutputOnly + /// Availability of the instance.@OutputOnly + pub availability: Option, + /// Full path to the Instance resource in the API. Example: apps/myapp/services/default/versions/v1/instances/instance-1.@OutputOnly + pub name: Option, + /// Number of errors since this instance was started.@OutputOnly + pub errors: Option, + /// Status of the virtual machine where this instance lives. Only applicable for instances in App Engine flexible environment.@OutputOnly #[serde(rename="vmStatus")] pub vm_status: Option, + /// Relative name of the instance within the version. Example: instance-1.@OutputOnly + pub id: Option, + /// Average latency (ms) over the last minute.@OutputOnly + #[serde(rename="averageLatency")] + pub average_latency: Option, + /// Number of requests since this instance was started.@OutputOnly + pub requests: Option, + /// Name of the virtual machine where this instance lives. Only applicable for instances in App Engine flexible environment.@OutputOnly + #[serde(rename="vmName")] + pub vm_name: Option, + /// Zone where the virtual machine is located. Only applicable for instances in App Engine flexible environment.@OutputOnly + #[serde(rename="vmZoneName")] + pub vm_zone_name: Option, } impl ResponseResult for Instance {} @@ -909,7 +970,7 @@ impl ResponseResult for Instance {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ManualScaling { - /// Number of instances to assign to the service at the start. This number can later be altered by using the [Modules API](https://cloud.google.com/appengine/docs/python/modules/functions) `set_num_instances()` function. + /// Number of instances to assign to the service at the start. This number can later be altered by using the Modules API (https://cloud.google.com/appengine/docs/python/modules/functions) set_num_instances() function. pub instances: Option, } @@ -932,7 +993,7 @@ pub struct TrafficSplit { impl Part for TrafficSplit {} -/// [Google Cloud Endpoints](https://cloud.google.com/appengine/docs/python/endpoints/) configuration for API handlers. +/// Google Cloud Endpoints (https://cloud.google.com/appengine/docs/python/endpoints/) configuration for API handlers. /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -943,10 +1004,10 @@ pub struct ApiConfigHandler { /// Security (HTTPS) enforcement for this URL. #[serde(rename="securityLevel")] pub security_level: Option, - /// Action to take when users access resources that require authentication. Defaults to `redirect`. + /// Action to take when users access resources that require authentication. Defaults to redirect. #[serde(rename="authFailAction")] pub auth_fail_action: Option, - /// Level of login required to access this resource. Defaults to `optional`. + /// Level of login required to access this resource. Defaults to optional. pub login: Option, /// Path to the script from the application root directory. pub script: Option, @@ -1031,7 +1092,9 @@ impl Part for ContainerInfo {} /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [services versions create apps](struct.AppServiceVersionCreateCall.html) (response) +/// * [patch apps](struct.AppPatchCall.html) (response) /// * [services versions instances debug apps](struct.AppServiceVersionInstanceDebugCall.html) (response) +/// * [create apps](struct.AppCreateCall.html) (response) /// * [services versions instances delete apps](struct.AppServiceVersionInstanceDeleteCall.html) (response) /// * [services versions patch apps](struct.AppServiceVersionPatchCall.html) (response) /// * [operations get apps](struct.AppOperationGetCall.html) (response) @@ -1044,13 +1107,13 @@ impl Part for ContainerInfo {} pub struct Operation { /// Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any. pub metadata: Option>, - /// If the value is `false`, it means the operation is still in progress. If true, the operation is completed, and either `error` or `response` is available. + /// If the value is false, it means the operation is still in progress. If true, the operation is completed, and either error or response is available. pub done: Option, - /// The normal response of the operation in case of success. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`. + /// The normal response of the operation in case of success. If the original method returns no data on success, such as Delete, the response is google.protobuf.Empty. If the original method is standard Get/Create/Update, the response should be the resource. For other methods, the response should have the type XxxResponse, where Xxx is the original method name. For example, if the original method name is TakeSnapshot(), the inferred response type is TakeSnapshotResponse. pub response: Option>, - /// The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should have the format of `operations/some/unique/name`. + /// The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the name should have the format of operations/some/unique/name. pub name: Option, - /// The error result of the operation in case of failure. + /// The error result of the operation in case of failure or cancellation. pub error: Option, } @@ -1085,7 +1148,7 @@ impl ResponseResult for Operation {} /// ::default(), None); /// let mut hub = Appengine::new(hyper::Client::new(), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `get(...)`, `locations_get(...)`, `locations_list(...)`, `operations_get(...)`, `operations_list(...)`, `repair(...)`, `services_delete(...)`, `services_get(...)`, `services_list(...)`, `services_patch(...)`, `services_versions_create(...)`, `services_versions_delete(...)`, `services_versions_get(...)`, `services_versions_instances_debug(...)`, `services_versions_instances_delete(...)`, `services_versions_instances_get(...)`, `services_versions_instances_list(...)`, `services_versions_list(...)` and `services_versions_patch(...)` +/// // like `create(...)`, `get(...)`, `locations_get(...)`, `locations_list(...)`, `operations_get(...)`, `operations_list(...)`, `patch(...)`, `repair(...)`, `services_delete(...)`, `services_get(...)`, `services_list(...)`, `services_patch(...)`, `services_versions_create(...)`, `services_versions_delete(...)`, `services_versions_get(...)`, `services_versions_instances_debug(...)`, `services_versions_instances_delete(...)`, `services_versions_instances_get(...)`, `services_versions_instances_list(...)`, `services_versions_list(...)` and `services_versions_patch(...)` /// // to build up your call. /// let rb = hub.apps(); /// # } @@ -1106,7 +1169,7 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// /// # Arguments /// - /// * `appsId` - Part of `parent`. Name of the parent Version resource. Example: `apps/myapp/services/default/versions/v1`. + /// * `appsId` - Part of `parent`. Name of the parent Version resource. Example: apps/myapp/services/default/versions/v1. /// * `servicesId` - Part of `parent`. See documentation of `appsId`. /// * `versionsId` - Part of `parent`. See documentation of `appsId`. pub fn services_versions_instances_list(&self, apps_id: &str, services_id: &str, versions_id: &str) -> AppServiceVersionInstanceListCall<'a, C, A> { @@ -1130,7 +1193,7 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `appsId` - Part of `parent`. Name of the parent resource to create this version under. Example: `apps/myapp/services/default`. + /// * `appsId` - Part of `parent`. Name of the parent resource to create this version under. Example: apps/myapp/services/default. /// * `servicesId` - Part of `parent`. See documentation of `appsId`. pub fn services_versions_create(&self, request: Version, apps_id: &str, services_id: &str) -> AppServiceVersionCreateCall<'a, C, A> { AppServiceVersionCreateCall { @@ -1146,12 +1209,12 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Recreates the required App Engine features for the application in your project, for example a Cloud Storage bucket or App Engine service account. Use this method if you receive an error message about a missing feature, for example "*Error retrieving the App Engine service account*". + /// Recreates the required App Engine features for the specified App Engine application, for example a Cloud Storage bucket or App Engine service account. Use this method if you receive an error message about a missing feature, for example, Error retrieving the App Engine service account. /// /// # Arguments /// /// * `request` - No description provided. - /// * `appsId` - Part of `name`. Name of the application to repair. Example: `apps/myapp` + /// * `appsId` - Part of `name`. Name of the application to repair. Example: apps/myapp pub fn repair(&self, request: RepairApplicationRequest, apps_id: &str) -> AppRepairCall<'a, C, A> { AppRepairCall { hub: self.hub, @@ -1165,12 +1228,12 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Enables debugging on a VM instance. This allows you to use the SSH command to connect to the virtual machine where the instance lives. While in "debug mode", the instance continues to serve live traffic. You should delete the instance when you are done debugging and then allow the system to take over and determine if another instance should be started. Only applicable for instances in App Engine flexible environment. + /// Enables debugging on a VM instance. This allows you to use the SSH command to connect to the virtual machine where the instance lives. While in "debug mode", the instance continues to serve live traffic. You should delete the instance when you are done debugging and then allow the system to take over and determine if another instance should be started.Only applicable for instances in App Engine flexible environment. /// /// # Arguments /// /// * `request` - No description provided. - /// * `appsId` - Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default/versions/v1/instances/instance-1`. + /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1/instances/instance-1. /// * `servicesId` - Part of `name`. See documentation of `appsId`. /// * `versionsId` - Part of `name`. See documentation of `appsId`. /// * `instancesId` - Part of `name`. See documentation of `appsId`. @@ -1194,7 +1257,7 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// /// # Arguments /// - /// * `appsId` - Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default`. + /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/services/default. /// * `servicesId` - Part of `name`. See documentation of `appsId`. pub fn services_get(&self, apps_id: &str, services_id: &str) -> AppServiceGetCall<'a, C, A> { AppServiceGetCall { @@ -1207,13 +1270,33 @@ impl<'a, C, A> AppMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Updates the specified Application resource. You can update the following fields: auth_domain (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps#Application.FIELDS.auth_domain) default_cookie_expiration (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps#Application.FIELDS.default_cookie_expiration) + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `appsId` - Part of `name`. Name of the Application resource to update. Example: apps/myapp. + pub fn patch(&self, request: Application, apps_id: &str) -> AppPatchCall<'a, C, A> { + AppPatchCall { + hub: self.hub, + _request: request, + _apps_id: apps_id.to_string(), + _update_mask: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Stops a running instance. /// /// # Arguments /// - /// * `appsId` - Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default/versions/v1/instances/instance-1`. + /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1/instances/instance-1. /// * `servicesId` - Part of `name`. See documentation of `appsId`. /// * `versionsId` - Part of `name`. See documentation of `appsId`. /// * `instancesId` - Part of `name`. See documentation of `appsId`. @@ -1232,12 +1315,12 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates the specified Version resource. You can specify the following fields depending on the App Engine environment and type of scaling that the version resource uses: * [`serving_status`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.serving_status): For Version resources that use basic scaling, manual scaling, or run in the App Engine flexible environment. * [`instance_class`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.instance_class): For Version resources that run in the App Engine standard environment. * [`automatic_scaling.min_idle_instances`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment. * [`automatic_scaling.max_idle_instances`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment. + /// Updates the specified Version resource. You can specify the following fields depending on the App Engine environment and type of scaling that the version resource uses: serving_status (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.serving_status): For Version resources that use basic scaling, manual scaling, or run in the App Engine flexible environment. instance_class (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.instance_class): For Version resources that run in the App Engine standard environment. automatic_scaling.min_idle_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment. automatic_scaling.max_idle_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment. /// /// # Arguments /// /// * `request` - No description provided. - /// * `appsId` - Part of `name`. Name of the resource to update. Example: `apps/myapp/services/default/versions/1`. + /// * `appsId` - Part of `name`. Name of the resource to update. Example: apps/myapp/services/default/versions/1. /// * `servicesId` - Part of `name`. See documentation of `appsId`. /// * `versionsId` - Part of `name`. See documentation of `appsId`. pub fn services_versions_patch(&self, request: Version, apps_id: &str, services_id: &str, versions_id: &str) -> AppServiceVersionPatchCall<'a, C, A> { @@ -1260,7 +1343,7 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// /// # Arguments /// - /// * `appsId` - Part of `parent`. Name of the parent Service resource. Example: `apps/myapp/services/default`. + /// * `appsId` - Part of `parent`. Name of the parent Service resource. Example: apps/myapp/services/default. /// * `servicesId` - Part of `parent`. See documentation of `appsId`. pub fn services_versions_list(&self, apps_id: &str, services_id: &str) -> AppServiceVersionListCall<'a, C, A> { AppServiceVersionListCall { @@ -1301,7 +1384,7 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// /// # Arguments /// - /// * `appsId` - Part of `parent`. Name of the parent Application resource. Example: `apps/myapp`. + /// * `appsId` - Part of `parent`. Name of the parent Application resource. Example: apps/myapp. pub fn services_list(&self, apps_id: &str) -> AppServiceListCall<'a, C, A> { AppServiceListCall { hub: self.hub, @@ -1340,7 +1423,7 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// /// # Arguments /// - /// * `appsId` - Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default/versions/v1/instances/instance-1`. + /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1/instances/instance-1. /// * `servicesId` - Part of `name`. See documentation of `appsId`. /// * `versionsId` - Part of `name`. See documentation of `appsId`. /// * `instancesId` - Part of `name`. See documentation of `appsId`. @@ -1359,7 +1442,7 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`. NOTE: the `name` binding below allows API services to override the binding to use different resource name schemes, such as `users/*/operations`. + /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED.NOTE: the name binding below allows API services to override the binding to use different resource name schemes, such as users/*/operations. /// /// # Arguments /// @@ -1383,7 +1466,7 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// /// # Arguments /// - /// * `appsId` - Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default/versions/v1`. + /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1. /// * `servicesId` - Part of `name`. See documentation of `appsId`. /// * `versionsId` - Part of `name`. See documentation of `appsId`. pub fn services_versions_delete(&self, apps_id: &str, services_id: &str, versions_id: &str) -> AppServiceVersionDeleteCall<'a, C, A> { @@ -1424,7 +1507,7 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `appsId` - Part of `name`. Name of the resource to update. Example: `apps/myapp/services/default`. + /// * `appsId` - Part of `name`. Name of the resource to update. Example: apps/myapp/services/default. /// * `servicesId` - Part of `name`. See documentation of `appsId`. pub fn services_patch(&self, request: Service, apps_id: &str, services_id: &str) -> AppServicePatchCall<'a, C, A> { AppServicePatchCall { @@ -1446,7 +1529,7 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// /// # Arguments /// - /// * `appsId` - Part of `name`. Name of the Application resource to get. Example: `apps/myapp`. + /// * `appsId` - Part of `name`. Name of the Application resource to get. Example: apps/myapp. pub fn get(&self, apps_id: &str) -> AppGetCall<'a, C, A> { AppGetCall { hub: self.hub, @@ -1463,7 +1546,7 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// /// # Arguments /// - /// * `appsId` - Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default`. + /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/services/default. /// * `servicesId` - Part of `name`. See documentation of `appsId`. pub fn services_delete(&self, apps_id: &str, services_id: &str) -> AppServiceDeleteCall<'a, C, A> { AppServiceDeleteCall { @@ -1478,11 +1561,28 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets the specified Version resource. By default, only a `BASIC_VIEW` will be returned. Specify the `FULL_VIEW` parameter to get the full resource. + /// Creates an App Engine application for a Google Cloud Platform project. This requires a project that excludes an App Engine application. For details about creating a project without an application, see the Google Cloud Resource Manager create project topic (https://cloud.google.com/resource-manager/docs/creating-project). /// /// # Arguments /// - /// * `appsId` - Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default/versions/v1`. + /// * `request` - No description provided. + pub fn create(&self, request: Application) -> AppCreateCall<'a, C, A> { + AppCreateCall { + hub: self.hub, + _request: request, + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets the specified Version resource. By default, only a BASIC_VIEW will be returned. Specify the FULL_VIEW parameter to get the full resource. + /// + /// # Arguments + /// + /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1. /// * `servicesId` - Part of `name`. See documentation of `appsId`. /// * `versionsId` - Part of `name`. See documentation of `appsId`. pub fn services_versions_get(&self, apps_id: &str, services_id: &str, versions_id: &str) -> AppServiceVersionGetCall<'a, C, A> { @@ -1593,7 +1693,7 @@ impl<'a, C, A> AppServiceVersionInstanceListCall<'a, C, A> where C: BorrowMut AppServiceVersionInstanceListCall<'a, C, A> where C: BorrowMut AppServiceVersionInstanceListCall<'a, C, A> where C: BorrowMut AppServiceVersionCreateCall<'a, C, A> where C: BorrowMut AppServiceVersionCreateCall<'a, C, A> where C: BorrowMut AppRepairCall<'a, C, A> where C: BorrowMut, A: oau self._request = new_value; self } - /// Part of `name`. Name of the application to repair. Example: `apps/myapp` + /// Part of `name`. Name of the application to repair. Example: apps/myapp /// /// Sets the *apps id* path property to the given value. /// @@ -2352,7 +2452,7 @@ impl<'a, C, A> AppRepairCall<'a, C, A> where C: BorrowMut, A: oau } -/// Enables debugging on a VM instance. This allows you to use the SSH command to connect to the virtual machine where the instance lives. While in "debug mode", the instance continues to serve live traffic. You should delete the instance when you are done debugging and then allow the system to take over and determine if another instance should be started. Only applicable for instances in App Engine flexible environment. +/// Enables debugging on a VM instance. This allows you to use the SSH command to connect to the virtual machine where the instance lives. While in "debug mode", the instance continues to serve live traffic. You should delete the instance when you are done debugging and then allow the system to take over and determine if another instance should be started.Only applicable for instances in App Engine flexible environment. /// /// A builder for the *services.versions.instances.debug* method supported by a *app* resource. /// It is not used directly, but through a `AppMethods` instance. @@ -2562,7 +2662,7 @@ impl<'a, C, A> AppServiceVersionInstanceDebugCall<'a, C, A> where C: BorrowMut AppServiceGetCall<'a, C, A> where C: BorrowMut, A: let mut url = "https://appengine.googleapis.com/v1/apps/{appsId}/services/{servicesId}".to_string(); if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + self._scopes.insert(Scope::Admin.as_ref().to_string(), ()); } for &(find_this, param_name) in [("{appsId}", "appsId"), ("{servicesId}", "servicesId")].iter() { @@ -2835,7 +2935,7 @@ impl<'a, C, A> AppServiceGetCall<'a, C, A> where C: BorrowMut, A: } - /// Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default`. + /// Part of `name`. Name of the resource requested. Example: apps/myapp/services/default. /// /// Sets the *apps id* path property to the given value. /// @@ -2897,7 +2997,7 @@ impl<'a, C, A> AppServiceGetCall<'a, C, A> where C: BorrowMut, A: /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. + /// `Scope::Admin`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. @@ -2913,6 +3013,290 @@ impl<'a, C, A> AppServiceGetCall<'a, C, A> where C: BorrowMut, A: } +/// Updates the specified Application resource. You can update the following fields: auth_domain (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps#Application.FIELDS.auth_domain) default_cookie_expiration (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps#Application.FIELDS.default_cookie_expiration) +/// +/// A builder for the *patch* method supported by a *app* resource. +/// It is not used directly, but through a `AppMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_appengine1 as appengine1; +/// use appengine1::Application; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use appengine1::Appengine; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Appengine::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Application::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.apps().patch(req, "appsId") +/// .update_mask("et") +/// .doit(); +/// # } +/// ``` +pub struct AppPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Appengine, + _request: Application, + _apps_id: String, + _update_mask: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AppPatchCall<'a, C, A> {} + +impl<'a, C, A> AppPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "appengine.apps.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("appsId", self._apps_id.to_string())); + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + for &field in ["alt", "appsId", "updateMask"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://appengine.googleapis.com/v1/apps/{appsId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{appsId}", "appsId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["appsId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Application) -> AppPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// Part of `name`. Name of the Application resource to update. Example: apps/myapp. + /// + /// Sets the *apps id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn apps_id(mut self, new_value: &str) -> AppPatchCall<'a, C, A> { + self._apps_id = new_value.to_string(); + self + } + /// Standard field mask for the set of fields to be updated. + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> AppPatchCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AppPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AppPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AppPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + /// Stops a running instance. /// /// A builder for the *services.versions.instances.delete* method supported by a *app* resource. @@ -3092,7 +3476,7 @@ impl<'a, C, A> AppServiceVersionInstanceDeleteCall<'a, C, A> where C: BorrowMut< } - /// Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default/versions/v1/instances/instance-1`. + /// Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1/instances/instance-1. /// /// Sets the *apps id* path property to the given value. /// @@ -3190,7 +3574,7 @@ impl<'a, C, A> AppServiceVersionInstanceDeleteCall<'a, C, A> where C: BorrowMut< } -/// Updates the specified Version resource. You can specify the following fields depending on the App Engine environment and type of scaling that the version resource uses: * [`serving_status`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.serving_status): For Version resources that use basic scaling, manual scaling, or run in the App Engine flexible environment. * [`instance_class`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.instance_class): For Version resources that run in the App Engine standard environment. * [`automatic_scaling.min_idle_instances`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment. * [`automatic_scaling.max_idle_instances`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment. +/// Updates the specified Version resource. You can specify the following fields depending on the App Engine environment and type of scaling that the version resource uses: serving_status (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.serving_status): For Version resources that use basic scaling, manual scaling, or run in the App Engine flexible environment. instance_class (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.instance_class): For Version resources that run in the App Engine standard environment. automatic_scaling.min_idle_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment. automatic_scaling.max_idle_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment. /// /// A builder for the *services.versions.patch* method supported by a *app* resource. /// It is not used directly, but through a `AppMethods` instance. @@ -3223,7 +3607,7 @@ impl<'a, C, A> AppServiceVersionInstanceDeleteCall<'a, C, A> where C: BorrowMut< /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().services_versions_patch(req, "appsId", "servicesId", "versionsId") -/// .update_mask("duo") +/// .update_mask("sea") /// .doit(); /// # } /// ``` @@ -3403,7 +3787,7 @@ impl<'a, C, A> AppServiceVersionPatchCall<'a, C, A> where C: BorrowMut AppServiceVersionPatchCall<'a, C, A> where C: BorrowMut AppServiceVersionListCall<'a, C, A> where C: BorrowMut AppServiceVersionListCall<'a, C, A> where C: BorrowMut AppServiceVersionListCall<'a, C, A> where C: BorrowMut AppServiceVersionListCall<'a, C, A> { @@ -3771,7 +4155,7 @@ impl<'a, C, A> AppServiceVersionListCall<'a, C, A> where C: BorrowMut AppOperationGetCall<'a, C, A> where C: BorrowMut, let mut url = "https://appengine.googleapis.com/v1/apps/{appsId}/operations/{operationsId}".to_string(); if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + self._scopes.insert(Scope::Admin.as_ref().to_string(), ()); } for &(find_this, param_name) in [("{appsId}", "appsId"), ("{operationsId}", "operationsId")].iter() { @@ -4024,7 +4408,7 @@ impl<'a, C, A> AppOperationGetCall<'a, C, A> where C: BorrowMut, /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. + /// `Scope::Admin`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. @@ -4067,8 +4451,8 @@ impl<'a, C, A> AppOperationGetCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().services_list("appsId") -/// .page_token("elitr") -/// .page_size(-97) +/// .page_token("no") +/// .page_size(-36) /// .doit(); /// # } /// ``` @@ -4122,7 +4506,7 @@ impl<'a, C, A> AppServiceListCall<'a, C, A> where C: BorrowMut, A let mut url = "https://appengine.googleapis.com/v1/apps/{appsId}/services".to_string(); if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + self._scopes.insert(Scope::Admin.as_ref().to_string(), ()); } for &(find_this, param_name) in [("{appsId}", "appsId")].iter() { @@ -4223,7 +4607,7 @@ impl<'a, C, A> AppServiceListCall<'a, C, A> where C: BorrowMut, A } - /// Part of `parent`. Name of the parent Application resource. Example: `apps/myapp`. + /// Part of `parent`. Name of the parent Application resource. Example: apps/myapp. /// /// Sets the *apps id* path property to the given value. /// @@ -4289,7 +4673,7 @@ impl<'a, C, A> AppServiceListCall<'a, C, A> where C: BorrowMut, A /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. + /// `Scope::Admin`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. @@ -4332,9 +4716,9 @@ impl<'a, C, A> AppServiceListCall<'a, C, A> where C: BorrowMut, A /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().locations_list("appsId") -/// .page_token("labore") -/// .page_size(-39) -/// .filter("dolore") +/// .page_token("dolore") +/// .page_size(-37) +/// .filter("aliquyam") /// .doit(); /// # } /// ``` @@ -4392,7 +4776,7 @@ impl<'a, C, A> AppLocationListCall<'a, C, A> where C: BorrowMut, let mut url = "https://appengine.googleapis.com/v1/apps/{appsId}/locations".to_string(); if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + self._scopes.insert(Scope::Admin.as_ref().to_string(), ()); } for &(find_this, param_name) in [("{appsId}", "appsId")].iter() { @@ -4566,7 +4950,7 @@ impl<'a, C, A> AppLocationListCall<'a, C, A> where C: BorrowMut, /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. + /// `Scope::Admin`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. @@ -4660,7 +5044,7 @@ impl<'a, C, A> AppServiceVersionInstanceGetCall<'a, C, A> where C: BorrowMut AppServiceVersionInstanceGetCall<'a, C, A> where C: BorrowMut AppServiceVersionInstanceGetCall<'a, C, A> where C: BorrowMut AppServiceVersionInstanceGetCall<'a, C, A> where C: BorrowMut AppServiceVersionInstanceGetCall<'a, C, A> where C: BorrowMut AppOperationListCall<'a, C, A> where C: BorrowMut, let mut url = "https://appengine.googleapis.com/v1/apps/{appsId}/operations".to_string(); if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + self._scopes.insert(Scope::Admin.as_ref().to_string(), ()); } for &(find_this, param_name) in [("{appsId}", "appsId")].iter() { @@ -5120,7 +5504,7 @@ impl<'a, C, A> AppOperationListCall<'a, C, A> where C: BorrowMut, /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. + /// `Scope::Admin`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. @@ -5313,7 +5697,7 @@ impl<'a, C, A> AppServiceVersionDeleteCall<'a, C, A> where C: BorrowMut AppLocationGetCall<'a, C, A> where C: BorrowMut, A let mut url = "https://appengine.googleapis.com/v1/apps/{appsId}/locations/{locationsId}".to_string(); if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + self._scopes.insert(Scope::Admin.as_ref().to_string(), ()); } for &(find_this, param_name) in [("{appsId}", "appsId"), ("{locationsId}", "locationsId")].iter() { @@ -5638,7 +6022,7 @@ impl<'a, C, A> AppLocationGetCall<'a, C, A> where C: BorrowMut, A /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. + /// `Scope::Admin`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. @@ -5687,8 +6071,8 @@ impl<'a, C, A> AppLocationGetCall<'a, C, A> where C: BorrowMut, A /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().services_patch(req, "appsId", "servicesId") -/// .update_mask("ea") -/// .migrate_traffic(false) +/// .update_mask("dolor") +/// .migrate_traffic(true) /// .doit(); /// # } /// ``` @@ -5870,7 +6254,7 @@ impl<'a, C, A> AppServicePatchCall<'a, C, A> where C: BorrowMut, self._request = new_value; self } - /// Part of `name`. Name of the resource to update. Example: `apps/myapp/services/default`. + /// Part of `name`. Name of the resource to update. Example: apps/myapp/services/default. /// /// Sets the *apps id* path property to the given value. /// @@ -5897,7 +6281,7 @@ impl<'a, C, A> AppServicePatchCall<'a, C, A> where C: BorrowMut, self._update_mask = Some(new_value.to_string()); self } - /// Set to `true` to gradually shift traffic from one version to another single version. By default, traffic is shifted immediately. For gradual traffic migration, the target version must be located within instances that are configured for both [warmup requests](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#inboundservicetype) and [automatic scaling](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#automaticscaling). You must specify the [`shardBy`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services#shardby) field in the Service resource. Gradual traffic migration is not supported in the App Engine flexible environment. For examples, see [Migrating and Splitting Traffic](https://cloud.google.com/appengine/docs/admin-api/migrating-splitting-traffic). + /// Set to true to gradually shift traffic from one version to another single version. By default, traffic is shifted immediately. For gradual traffic migration, the target version must be located within instances that are configured for both warmup requests (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#inboundservicetype) and automatic scaling (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#automaticscaling). You must specify the shardBy (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services#shardby) field in the Service resource. Gradual traffic migration is not supported in the App Engine flexible environment. For examples, see Migrating and Splitting Traffic (https://cloud.google.com/appengine/docs/admin-api/migrating-splitting-traffic). /// /// Sets the *migrate traffic* query property to the given value. pub fn migrate_traffic(mut self, new_value: bool) -> AppServicePatchCall<'a, C, A> { @@ -6034,7 +6418,7 @@ impl<'a, C, A> AppGetCall<'a, C, A> where C: BorrowMut, A: oauth2 let mut url = "https://appengine.googleapis.com/v1/apps/{appsId}".to_string(); if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + self._scopes.insert(Scope::Admin.as_ref().to_string(), ()); } for &(find_this, param_name) in [("{appsId}", "appsId")].iter() { @@ -6135,7 +6519,7 @@ impl<'a, C, A> AppGetCall<'a, C, A> where C: BorrowMut, A: oauth2 } - /// Part of `name`. Name of the Application resource to get. Example: `apps/myapp`. + /// Part of `name`. Name of the Application resource to get. Example: apps/myapp. /// /// Sets the *apps id* path property to the given value. /// @@ -6187,7 +6571,7 @@ impl<'a, C, A> AppGetCall<'a, C, A> where C: BorrowMut, A: oauth2 /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. + /// `Scope::Admin`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. @@ -6378,7 +6762,7 @@ impl<'a, C, A> AppServiceDeleteCall<'a, C, A> where C: BorrowMut, } - /// Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default`. + /// Part of `name`. Name of the resource requested. Example: apps/myapp/services/default. /// /// Sets the *apps id* path property to the given value. /// @@ -6456,7 +6840,246 @@ impl<'a, C, A> AppServiceDeleteCall<'a, C, A> where C: BorrowMut, } -/// Gets the specified Version resource. By default, only a `BASIC_VIEW` will be returned. Specify the `FULL_VIEW` parameter to get the full resource. +/// Creates an App Engine application for a Google Cloud Platform project. This requires a project that excludes an App Engine application. For details about creating a project without an application, see the Google Cloud Resource Manager create project topic (https://cloud.google.com/resource-manager/docs/creating-project). +/// +/// A builder for the *create* method supported by a *app* resource. +/// It is not used directly, but through a `AppMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_appengine1 as appengine1; +/// use appengine1::Application; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use appengine1::Appengine; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Appengine::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Application::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.apps().create(req) +/// .doit(); +/// # } +/// ``` +pub struct AppCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Appengine, + _request: Application, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AppCreateCall<'a, C, A> {} + +impl<'a, C, A> AppCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "appengine.apps.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + for &field in ["alt"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://appengine.googleapis.com/v1/apps".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Application) -> AppCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AppCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AppCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AppCreateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets the specified Version resource. By default, only a BASIC_VIEW will be returned. Specify the FULL_VIEW parameter to get the full resource. /// /// A builder for the *services.versions.get* method supported by a *app* resource. /// It is not used directly, but through a `AppMethods` instance. @@ -6483,7 +7106,7 @@ impl<'a, C, A> AppServiceDeleteCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().services_versions_get("appsId", "servicesId", "versionsId") -/// .view("voluptua.") +/// .view("gubergren") /// .doit(); /// # } /// ``` @@ -6537,7 +7160,7 @@ impl<'a, C, A> AppServiceVersionGetCall<'a, C, A> where C: BorrowMut AppServiceVersionGetCall<'a, C, A> where C: BorrowMut AppServiceVersionGetCall<'a, C, A> where C: BorrowMut AppServiceVersionGetCall<'a, C, A> { @@ -6717,7 +7340,7 @@ impl<'a, C, A> AppServiceVersionGetCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with appengine (protocol v1beta4)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/appengine1_beta4-cli" diff --git a/gen/appengine1_beta4-cli/README.md b/gen/appengine1_beta4-cli/README.md index 2b8cf38194..6244b92404 100644 --- a/gen/appengine1_beta4-cli/README.md +++ b/gen/appengine1_beta4-cli/README.md @@ -24,7 +24,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *appengine* API at revision *20160802*. The CLI is at version *1.0.0*. +This documentation was generated from the *appengine* API at revision *20161208*. The CLI is at version *1.0.0*. ```bash appengine1-beta4 [options] @@ -48,6 +48,7 @@ appengine1-beta4 [options] modules-versions-patch (-r )... [-p ]... [-o ] operations-get [-p ]... [-o ] operations-list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] appengine1-beta4 --help Configuration: diff --git a/gen/appengine1_beta4-cli/mkdocs.yml b/gen/appengine1_beta4-cli/mkdocs.yml index 04d14362d9..18c76c02f9 100644 --- a/gen/appengine1_beta4-cli/mkdocs.yml +++ b/gen/appengine1_beta4-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: appengine v1.0.0+20160802 +site_name: appengine v1.0.0+20161208 site_url: http://byron.github.io/google-apis-rs/google-appengine1_beta4-cli site_description: Write integrating applications with bcore @@ -28,6 +28,7 @@ pages: - ['apps_modules-versions-patch.md', 'Apps', 'Modules Versions Patch'] - ['apps_operations-get.md', 'Apps', 'Operations Get'] - ['apps_operations-list.md', 'Apps', 'Operations List'] +- ['apps_patch.md', 'Apps', 'Patch'] theme: readthedocs diff --git a/gen/appengine1_beta4-cli/src/main.rs b/gen/appengine1_beta4-cli/src/main.rs index 1daef08f7d..fa2fb5edcc 100644 --- a/gen/appengine1_beta4-cli/src/main.rs +++ b/gen/appengine1_beta4-cli/src/main.rs @@ -837,8 +837,9 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { + "ssh-key" => Some(("sshKey", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec![]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["ssh-key"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1382,6 +1383,102 @@ impl<'n> Engine<'n> { } } + fn _apps_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "default-hostname" => Some(("defaultHostname", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "code-bucket" => Some(("codeBucket", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-bucket" => Some(("defaultBucket", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-cookie-expiration" => Some(("defaultCookieExpiration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "location" => Some(("location", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "auth-domain" => Some(("authDomain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["auth-domain", "code-bucket", "default-bucket", "default-cookie-expiration", "default-hostname", "id", "location", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Application = json::value::from_value(object).unwrap(); + let mut call = self.hub.apps().patch(request, opt.value_of("apps-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "mask" => { + call = call.mask(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["mask"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _doit(&self, dry_run: bool) -> Result, Option> { let mut err = InvalidOptionsError::new(); let mut call_result: Result<(), DoitError> = Ok(()); @@ -1446,6 +1543,9 @@ impl<'n> Engine<'n> { ("operations-list", Some(opt)) => { call_result = self._apps_operations_list(opt, dry_run, &mut err); }, + ("patch", Some(opt)) => { + call_result = self._apps_patch(opt, dry_run, &mut err); + }, _ => { err.issues.push(CLIError::MissingMethodError("apps".to_string())); writeln!(io::stderr(), "{}\n", opt.usage()).ok(); @@ -1538,9 +1638,9 @@ impl<'n> Engine<'n> { fn main() { let mut exit_status = 0i32; let arg_data = [ - ("apps", "methods: 'create', 'get', 'locations-get', 'locations-list', 'modules-delete', 'modules-get', 'modules-list', 'modules-patch', 'modules-versions-create', 'modules-versions-delete', 'modules-versions-get', 'modules-versions-instances-debug', 'modules-versions-instances-delete', 'modules-versions-instances-get', 'modules-versions-instances-list', 'modules-versions-list', 'modules-versions-patch', 'operations-get' and 'operations-list'", vec![ + ("apps", "methods: 'create', 'get', 'locations-get', 'locations-list', 'modules-delete', 'modules-get', 'modules-list', 'modules-patch', 'modules-versions-create', 'modules-versions-delete', 'modules-versions-get', 'modules-versions-instances-debug', 'modules-versions-instances-delete', 'modules-versions-instances-get', 'modules-versions-instances-list', 'modules-versions-list', 'modules-versions-patch', 'operations-get', 'operations-list' and 'patch'", vec![ ("create", - Some(r##"Creates an App Engine application for a Google Cloud Platform project. This requires a project that excludes an App Engine application. For details about creating a project without an application, see the [Google Cloud Resource Manager create project topic](https://cloud.google.com/resource-manager/docs/creating-project)."##), + Some(r##"Creates an App Engine application for a Google Cloud Platform project. This requires a project that excludes an App Engine application. For details about creating a project without an application, see the Google Cloud Resource Manager create project topic (https://cloud.google.com/resource-manager/docs/creating-project)."##), "Details at http://byron.github.io/google-apis-rs/google_appengine1_beta4_cli/apps_create", vec![ (Some(r##"kv"##), @@ -1567,7 +1667,7 @@ fn main() { vec![ (Some(r##"apps-id"##), None, - Some(r##"Part of `name`. Name of the application to get. Example: `apps/myapp`."##), + Some(r##"Part of `name`. Name of the application to get. Example: apps/myapp."##), Some(true), Some(false)), @@ -1639,7 +1739,7 @@ fn main() { vec![ (Some(r##"apps-id"##), None, - Some(r##"Part of `name`. Name of the resource requested. Example: `apps/myapp/modules/default`."##), + Some(r##"Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default."##), Some(true), Some(false)), @@ -1667,7 +1767,7 @@ fn main() { vec![ (Some(r##"apps-id"##), None, - Some(r##"Part of `name`. Name of the resource requested. Example: `apps/myapp/modules/default`."##), + Some(r##"Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default."##), Some(true), Some(false)), @@ -1695,7 +1795,7 @@ fn main() { vec![ (Some(r##"apps-id"##), None, - Some(r##"Part of `name`. Name of the resource requested. Example: `apps/myapp`."##), + Some(r##"Part of `name`. Name of the resource requested. Example: apps/myapp."##), Some(true), Some(false)), @@ -1717,7 +1817,7 @@ fn main() { vec![ (Some(r##"apps-id"##), None, - Some(r##"Part of `name`. Name of the resource to update. Example: `apps/myapp/modules/default`."##), + Some(r##"Part of `name`. Name of the resource to update. Example: apps/myapp/modules/default."##), Some(true), Some(false)), @@ -1751,7 +1851,7 @@ fn main() { vec![ (Some(r##"apps-id"##), None, - Some(r##"Part of `name`. Name of the resource to update. Example: `apps/myapp/modules/default`."##), + Some(r##"Part of `name`. Name of the resource to update. Example: apps/myapp/modules/default."##), Some(true), Some(false)), @@ -1785,7 +1885,7 @@ fn main() { vec![ (Some(r##"apps-id"##), None, - Some(r##"Part of `name`. Name of the resource requested. Example: `apps/myapp/modules/default/versions/v1`."##), + Some(r##"Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default/versions/v1."##), Some(true), Some(false)), @@ -1814,12 +1914,12 @@ fn main() { Some(false)), ]), ("modules-versions-get", - Some(r##"Gets the specified Version resource. By default, only a `BASIC_VIEW` will be returned. Specify the `FULL_VIEW` parameter to get the full resource."##), + Some(r##"Gets the specified Version resource. By default, only a BASIC_VIEW will be returned. Specify the FULL_VIEW parameter to get the full resource."##), "Details at http://byron.github.io/google-apis-rs/google_appengine1_beta4_cli/apps_modules-versions-get", vec![ (Some(r##"apps-id"##), None, - Some(r##"Part of `name`. Name of the resource requested. Example: `apps/myapp/modules/default/versions/v1`."##), + Some(r##"Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default/versions/v1."##), Some(true), Some(false)), @@ -1848,12 +1948,12 @@ fn main() { Some(false)), ]), ("modules-versions-instances-debug", - Some(r##"Enables debugging on a VM instance. This allows you to use the SSH command to connect to the virtual machine where the instance lives. While in "debug mode", the instance continues to serve live traffic. You should delete the instance when you are done debugging and then allow the system to take over and determine if another instance should be started. Only applicable for instances in App Engine flexible environment."##), + Some(r##"Enables debugging on a VM instance. This allows you to use the SSH command to connect to the virtual machine where the instance lives. While in "debug mode", the instance continues to serve live traffic. You should delete the instance when you are done debugging and then allow the system to take over and determine if another instance should be started.Only applicable for instances in App Engine flexible environment."##), "Details at http://byron.github.io/google-apis-rs/google_appengine1_beta4_cli/apps_modules-versions-instances-debug", vec![ (Some(r##"apps-id"##), None, - Some(r##"Part of `name`. Name of the resource requested. Example: `apps/myapp/modules/default/versions/v1/instances/instance-1`."##), + Some(r##"Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default/versions/v1/instances/instance-1."##), Some(true), Some(false)), @@ -1899,7 +1999,7 @@ fn main() { vec![ (Some(r##"apps-id"##), None, - Some(r##"Part of `name`. Name of the resource requested. Example: `apps/myapp/modules/default/versions/v1/instances/instance-1`."##), + Some(r##"Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default/versions/v1/instances/instance-1."##), Some(true), Some(false)), @@ -1939,7 +2039,7 @@ fn main() { vec![ (Some(r##"apps-id"##), None, - Some(r##"Part of `name`. Name of the resource requested. Example: `apps/myapp/modules/default/versions/v1/instances/instance-1`."##), + Some(r##"Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default/versions/v1/instances/instance-1."##), Some(true), Some(false)), @@ -1979,7 +2079,7 @@ fn main() { vec![ (Some(r##"apps-id"##), None, - Some(r##"Part of `name`. Name of the resource requested. Example: `apps/myapp/modules/default/versions/v1`."##), + Some(r##"Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default/versions/v1."##), Some(true), Some(false)), @@ -2013,7 +2113,7 @@ fn main() { vec![ (Some(r##"apps-id"##), None, - Some(r##"Part of `name`. Name of the resource requested. Example: `apps/myapp/modules/default`."##), + Some(r##"Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default."##), Some(true), Some(false)), @@ -2036,12 +2136,12 @@ fn main() { Some(false)), ]), ("modules-versions-patch", - Some(r##"Updates the specified Version resource. You can specify the following fields depending on the App Engine environment and type of scaling that the version resource uses: * [`serving_status`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#Version.FIELDS.serving_status): For Version resources that use basic scaling, manual scaling, or run in the App Engine flexible environment. * [`instance_class`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#Version.FIELDS.instance_class): For Version resources that run in the App Engine standard environment. * [`automatic_scaling.min_idle_instances`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment. * [`automatic_scaling.max_idle_instances`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment."##), + Some(r##"Updates the specified Version resource. You can specify the following fields depending on the App Engine environment and type of scaling that the version resource uses: serving_status (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#Version.FIELDS.serving_status): For Version resources that use basic scaling, manual scaling, or run in the App Engine flexible environment. instance_class (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#Version.FIELDS.instance_class): For Version resources that run in the App Engine standard environment. automatic_scaling.min_idle_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment. automatic_scaling.max_idle_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment."##), "Details at http://byron.github.io/google-apis-rs/google_appengine1_beta4_cli/apps_modules-versions-patch", vec![ (Some(r##"apps-id"##), None, - Some(r##"Part of `name`. Name of the resource to update. Example: `apps/myapp/modules/default/versions/1`."##), + Some(r##"Part of `name`. Name of the resource to update. Example: apps/myapp/modules/default/versions/1."##), Some(true), Some(false)), @@ -2104,7 +2204,7 @@ fn main() { Some(false)), ]), ("operations-list", - Some(r##"Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`. NOTE: the `name` binding below allows API services to override the binding to use different resource name schemes, such as `users/*/operations`."##), + Some(r##"Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED.NOTE: the name binding below allows API services to override the binding to use different resource name schemes, such as users/*/operations."##), "Details at http://byron.github.io/google-apis-rs/google_appengine1_beta4_cli/apps_operations-list", vec![ (Some(r##"apps-id"##), @@ -2119,6 +2219,34 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates the specified Application resource. You can update the following fields: auth_domain (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps#Application.FIELDS.auth_domain) default_cookie_expiration (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps#Application.FIELDS.default_cookie_expiration)"##), + "Details at http://byron.github.io/google-apis-rs/google_appengine1_beta4_cli/apps_patch", + vec![ + (Some(r##"apps-id"##), + None, + Some(r##"Part of `name`. Name of the Application resource to update. Example: apps/myapp."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -2131,7 +2259,7 @@ fn main() { let mut app = App::new("appengine1-beta4") .author("Sebastian Thiel ") - .version("1.0.0+20160802") + .version("1.0.0+20161208") .about("Provisions and manages App Engine applications.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_appengine1_beta4_cli") .arg(Arg::with_name("url") diff --git a/gen/appengine1_beta4/Cargo.toml b/gen/appengine1_beta4/Cargo.toml index cdea5c924b..f5807ea89c 100644 --- a/gen/appengine1_beta4/Cargo.toml +++ b/gen/appengine1_beta4/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-appengine1_beta4" -version = "1.0.0+20160802" +version = "1.0.0+20161208" authors = ["Sebastian Thiel "] description = "A complete library to interact with appengine (protocol v1beta4)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/appengine1_beta4" diff --git a/gen/appengine1_beta4/README.md b/gen/appengine1_beta4/README.md index 4f1dead9b4..25644dd166 100644 --- a/gen/appengine1_beta4/README.md +++ b/gen/appengine1_beta4/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-appengine1_beta4` library allows access to all features of the *Google appengine* service. -This documentation was generated from *appengine* crate version *1.0.0+20160802*, where *20160802* is the exact revision of the *appengine:v1beta4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *appengine* crate version *1.0.0+20161208*, where *20161208* is the exact revision of the *appengine:v1beta4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *appengine* *v1_beta4* API can be found at the [official documentation site](https://cloud.google.com/appengine/docs/admin-api/). @@ -14,7 +14,7 @@ Everything else about the *appengine* *v1_beta4* API can be found at the Handle the following *Resources* with ease from the central [hub](http://byron.github.io/google-apis-rs/google_appengine1_beta4/struct.Appengine.html) ... * apps - * [*create*](http://byron.github.io/google-apis-rs/google_appengine1_beta4/struct.AppCreateCall.html), [*get*](http://byron.github.io/google-apis-rs/google_appengine1_beta4/struct.AppGetCall.html), [*locations get*](http://byron.github.io/google-apis-rs/google_appengine1_beta4/struct.AppLocationGetCall.html), [*locations list*](http://byron.github.io/google-apis-rs/google_appengine1_beta4/struct.AppLocationListCall.html), [*modules delete*](http://byron.github.io/google-apis-rs/google_appengine1_beta4/struct.AppModuleDeleteCall.html), [*modules get*](http://byron.github.io/google-apis-rs/google_appengine1_beta4/struct.AppModuleGetCall.html), [*modules list*](http://byron.github.io/google-apis-rs/google_appengine1_beta4/struct.AppModuleListCall.html), [*modules patch*](http://byron.github.io/google-apis-rs/google_appengine1_beta4/struct.AppModulePatchCall.html), [*modules versions create*](http://byron.github.io/google-apis-rs/google_appengine1_beta4/struct.AppModuleVersionCreateCall.html), [*modules versions delete*](http://byron.github.io/google-apis-rs/google_appengine1_beta4/struct.AppModuleVersionDeleteCall.html), [*modules versions get*](http://byron.github.io/google-apis-rs/google_appengine1_beta4/struct.AppModuleVersionGetCall.html), [*modules versions instances debug*](http://byron.github.io/google-apis-rs/google_appengine1_beta4/struct.AppModuleVersionInstanceDebugCall.html), [*modules versions instances delete*](http://byron.github.io/google-apis-rs/google_appengine1_beta4/struct.AppModuleVersionInstanceDeleteCall.html), [*modules versions instances get*](http://byron.github.io/google-apis-rs/google_appengine1_beta4/struct.AppModuleVersionInstanceGetCall.html), [*modules versions instances list*](http://byron.github.io/google-apis-rs/google_appengine1_beta4/struct.AppModuleVersionInstanceListCall.html), [*modules versions list*](http://byron.github.io/google-apis-rs/google_appengine1_beta4/struct.AppModuleVersionListCall.html), [*modules versions patch*](http://byron.github.io/google-apis-rs/google_appengine1_beta4/struct.AppModuleVersionPatchCall.html), [*operations get*](http://byron.github.io/google-apis-rs/google_appengine1_beta4/struct.AppOperationGetCall.html) and [*operations list*](http://byron.github.io/google-apis-rs/google_appengine1_beta4/struct.AppOperationListCall.html) + * [*create*](http://byron.github.io/google-apis-rs/google_appengine1_beta4/struct.AppCreateCall.html), [*get*](http://byron.github.io/google-apis-rs/google_appengine1_beta4/struct.AppGetCall.html), [*locations get*](http://byron.github.io/google-apis-rs/google_appengine1_beta4/struct.AppLocationGetCall.html), [*locations list*](http://byron.github.io/google-apis-rs/google_appengine1_beta4/struct.AppLocationListCall.html), [*modules delete*](http://byron.github.io/google-apis-rs/google_appengine1_beta4/struct.AppModuleDeleteCall.html), [*modules get*](http://byron.github.io/google-apis-rs/google_appengine1_beta4/struct.AppModuleGetCall.html), [*modules list*](http://byron.github.io/google-apis-rs/google_appengine1_beta4/struct.AppModuleListCall.html), [*modules patch*](http://byron.github.io/google-apis-rs/google_appengine1_beta4/struct.AppModulePatchCall.html), [*modules versions create*](http://byron.github.io/google-apis-rs/google_appengine1_beta4/struct.AppModuleVersionCreateCall.html), [*modules versions delete*](http://byron.github.io/google-apis-rs/google_appengine1_beta4/struct.AppModuleVersionDeleteCall.html), [*modules versions get*](http://byron.github.io/google-apis-rs/google_appengine1_beta4/struct.AppModuleVersionGetCall.html), [*modules versions instances debug*](http://byron.github.io/google-apis-rs/google_appengine1_beta4/struct.AppModuleVersionInstanceDebugCall.html), [*modules versions instances delete*](http://byron.github.io/google-apis-rs/google_appengine1_beta4/struct.AppModuleVersionInstanceDeleteCall.html), [*modules versions instances get*](http://byron.github.io/google-apis-rs/google_appengine1_beta4/struct.AppModuleVersionInstanceGetCall.html), [*modules versions instances list*](http://byron.github.io/google-apis-rs/google_appengine1_beta4/struct.AppModuleVersionInstanceListCall.html), [*modules versions list*](http://byron.github.io/google-apis-rs/google_appengine1_beta4/struct.AppModuleVersionListCall.html), [*modules versions patch*](http://byron.github.io/google-apis-rs/google_appengine1_beta4/struct.AppModuleVersionPatchCall.html), [*operations get*](http://byron.github.io/google-apis-rs/google_appengine1_beta4/struct.AppOperationGetCall.html), [*operations list*](http://byron.github.io/google-apis-rs/google_appengine1_beta4/struct.AppOperationListCall.html) and [*patch*](http://byron.github.io/google-apis-rs/google_appengine1_beta4/struct.AppPatchCall.html) @@ -48,6 +48,7 @@ Or specifically ... ```ignore let r = hub.apps().modules_patch(...).doit() +let r = hub.apps().patch(...).doit() let r = hub.apps().create(...).doit() let r = hub.apps().modules_versions_instances_delete(...).doit() let r = hub.apps().modules_versions_instances_debug(...).doit() diff --git a/gen/appengine1_beta4/src/lib.rs b/gen/appengine1_beta4/src/lib.rs index 1b5dd8f990..bdc19c5d9d 100644 --- a/gen/appengine1_beta4/src/lib.rs +++ b/gen/appengine1_beta4/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *appengine* crate version *1.0.0+20160802*, where *20160802* is the exact revision of the *appengine:v1beta4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *appengine* crate version *1.0.0+20161208*, where *20161208* is the exact revision of the *appengine:v1beta4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *appengine* *v1_beta4* API can be found at the //! [official documentation site](https://cloud.google.com/appengine/docs/admin-api/). @@ -12,7 +12,7 @@ //! Handle the following *Resources* with ease from the central [hub](struct.Appengine.html) ... //! //! * apps -//! * [*create*](struct.AppCreateCall.html), [*get*](struct.AppGetCall.html), [*locations get*](struct.AppLocationGetCall.html), [*locations list*](struct.AppLocationListCall.html), [*modules delete*](struct.AppModuleDeleteCall.html), [*modules get*](struct.AppModuleGetCall.html), [*modules list*](struct.AppModuleListCall.html), [*modules patch*](struct.AppModulePatchCall.html), [*modules versions create*](struct.AppModuleVersionCreateCall.html), [*modules versions delete*](struct.AppModuleVersionDeleteCall.html), [*modules versions get*](struct.AppModuleVersionGetCall.html), [*modules versions instances debug*](struct.AppModuleVersionInstanceDebugCall.html), [*modules versions instances delete*](struct.AppModuleVersionInstanceDeleteCall.html), [*modules versions instances get*](struct.AppModuleVersionInstanceGetCall.html), [*modules versions instances list*](struct.AppModuleVersionInstanceListCall.html), [*modules versions list*](struct.AppModuleVersionListCall.html), [*modules versions patch*](struct.AppModuleVersionPatchCall.html), [*operations get*](struct.AppOperationGetCall.html) and [*operations list*](struct.AppOperationListCall.html) +//! * [*create*](struct.AppCreateCall.html), [*get*](struct.AppGetCall.html), [*locations get*](struct.AppLocationGetCall.html), [*locations list*](struct.AppLocationListCall.html), [*modules delete*](struct.AppModuleDeleteCall.html), [*modules get*](struct.AppModuleGetCall.html), [*modules list*](struct.AppModuleListCall.html), [*modules patch*](struct.AppModulePatchCall.html), [*modules versions create*](struct.AppModuleVersionCreateCall.html), [*modules versions delete*](struct.AppModuleVersionDeleteCall.html), [*modules versions get*](struct.AppModuleVersionGetCall.html), [*modules versions instances debug*](struct.AppModuleVersionInstanceDebugCall.html), [*modules versions instances delete*](struct.AppModuleVersionInstanceDeleteCall.html), [*modules versions instances get*](struct.AppModuleVersionInstanceGetCall.html), [*modules versions instances list*](struct.AppModuleVersionInstanceListCall.html), [*modules versions list*](struct.AppModuleVersionListCall.html), [*modules versions patch*](struct.AppModuleVersionPatchCall.html), [*operations get*](struct.AppOperationGetCall.html), [*operations list*](struct.AppOperationListCall.html) and [*patch*](struct.AppPatchCall.html) //! //! //! @@ -48,6 +48,7 @@ //! //! ```ignore //! let r = hub.apps().modules_patch(...).doit() +//! let r = hub.apps().patch(...).doit() //! let r = hub.apps().create(...).doit() //! let r = hub.apps().modules_versions_instances_delete(...).doit() //! let r = hub.apps().modules_versions_instances_debug(...).doit() @@ -109,7 +110,7 @@ //! // Values shown here are possibly random and not representative ! //! let result = hub.apps().modules_patch(req, "appsId", "modulesId") //! .migrate_traffic(true) -//! .mask("sit") +//! .mask("diam") //! .doit(); //! //! match result { diff --git a/gen/appengine1_beta4/src/lib.rs.in b/gen/appengine1_beta4/src/lib.rs.in index 3a2ebc43b9..30dde7e397 100644 --- a/gen/appengine1_beta4/src/lib.rs.in +++ b/gen/appengine1_beta4/src/lib.rs.in @@ -40,14 +40,22 @@ pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, /// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). #[derive(PartialEq, Eq, Hash)] pub enum Scope { + /// View and manage your applications deployed on Google App Engine + Admin, + /// View and manage your data across Google Cloud Platform services CloudPlatform, + + /// View your data across Google Cloud Platform services + CloudPlatformReadOnly, } impl AsRef for Scope { fn as_ref(&self) -> &str { match *self { + Scope::Admin => "https://www.googleapis.com/auth/appengine.admin", Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform", + Scope::CloudPlatformReadOnly => "https://www.googleapis.com/auth/cloud-platform.read-only", } } } @@ -162,7 +170,7 @@ impl<'a, C, A> Appengine // ############ // SCHEMAS ### // ########## -/// Response message for `Instances.ListInstances`. +/// Response message for Instances.ListInstances. /// /// # Activities /// @@ -195,7 +203,7 @@ pub struct Network { /// List of ports, or port pairs, to forward from the virtual machine to the application container. #[serde(rename="forwardedPorts")] pub forwarded_ports: Option>, - /// Google Cloud Platform network where the virtual machines are created. Specify the short name, not the resource path. Defaults to `default`. + /// Google Cloud Platform network where the virtual machines are created. Specify the short name, not the resource path.Defaults to default. pub name: Option, } @@ -210,33 +218,34 @@ impl Part for Network {} /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [create apps](struct.AppCreateCall.html) (request) +/// * [patch apps](struct.AppPatchCall.html) (request) /// * [get apps](struct.AppGetCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Application { - /// Hostname used to reach the application, as resolved by App Engine. @OutputOnly + /// Hostname used to reach the application, as resolved by App Engine.@OutputOnly #[serde(rename="defaultHostname")] pub default_hostname: Option, - /// Full path to the Application resource in the API. Example: `apps/myapp`. @OutputOnly + /// Full path to the Application resource in the API. Example: apps/myapp.@OutputOnly pub name: Option, - /// Google Cloud Storage bucket that can be used for storing files associated with this application. This bucket is associated with the application and can be used by the gcloud deployment commands. @OutputOnly + /// Google Cloud Storage bucket that can be used for storing files associated with this application. This bucket is associated with the application and can be used by the gcloud deployment commands.@OutputOnly #[serde(rename="codeBucket")] pub code_bucket: Option, - /// Google Cloud Storage bucket that can be used by this application to store content. @OutputOnly + /// Google Cloud Storage bucket that can be used by this application to store content.@OutputOnly #[serde(rename="defaultBucket")] pub default_bucket: Option, - /// HTTP path dispatch rules for requests to the application that do not explicitly target a module or version. Rules are order-dependent. @OutputOnly + /// HTTP path dispatch rules for requests to the application that do not explicitly target a module or version. Rules are order-dependent.@OutputOnly #[serde(rename="dispatchRules")] pub dispatch_rules: Option>, - /// Cookie expiration policy for this application. @OutputOnly + /// Cookie expiration policy for this application. #[serde(rename="defaultCookieExpiration")] pub default_cookie_expiration: Option, - /// Location from which this application will be run. Application instances will run out of data centers in the chosen location, which is also where all of the application's end user content is stored. Defaults to `us-central`. Options are: `us-central` - Central US `europe-west` - Western Europe `us-east1` - Eastern US + /// Location from which this application will be run. Application instances will run out of data centers in the chosen location, which is also where all of the application's end user content is stored.Defaults to us-central.Options are:us-central - Central USeurope-west - Western Europeus-east1 - Eastern US pub location: Option, - /// Google Apps authentication domain that controls which users can access this application. Defaults to open access for any Google Account. + /// Google Apps authentication domain that controls which users can access this application.Defaults to open access for any Google Account. #[serde(rename="authDomain")] pub auth_domain: Option, - /// Identifier of the Application resource. This identifier is equivalent to the project ID of the Google Cloud Platform project where you want to deploy your application. Example: `myapp`. + /// Identifier of the Application resource. This identifier is equivalent to the project ID of the Google Cloud Platform project where you want to deploy your application. Example: myapp. pub id: Option, } @@ -266,7 +275,7 @@ pub struct Version { /// A module with manual scaling runs continuously, allowing you to perform complex initialization and rely on the state of its memory over time. #[serde(rename="manualScaling")] pub manual_scaling: Option, - /// Time that this version was created. @OutputOnly + /// Time that this version was created.@OutputOnly #[serde(rename="creationTime")] pub creation_time: Option, /// Whether to deploy this version in a container on a virtual machine. @@ -274,51 +283,51 @@ pub struct Version { /// Before an application can receive email or XMPP messages, the application must be configured to enable the service. #[serde(rename="inboundServices")] pub inbound_services: Option>, - /// Instance class that is used to run this version. Valid values are: * AutomaticScaling: `F1`, `F2`, `F4`, `F4_1G` * ManualScaling or BasicScaling: `B1`, `B2`, `B4`, `B8`, `B4_1G` Defaults to `F1` for AutomaticScaling and `B1` for ManualScaling or BasicScaling. + /// Instance class that is used to run this version. Valid values are: AutomaticScaling: F1, F2, F4, F4_1G ManualScaling or BasicScaling: B1, B2, B4, B8, B4_1GDefaults to F1 for AutomaticScaling and B1 for ManualScaling or BasicScaling. #[serde(rename="instanceClass")] pub instance_class: Option, - /// Code and application artifacts that make up this version. Only returned in `GET` requests if `view=FULL` is set. + /// Code and application artifacts that make up this version.Only returned in GET requests if view=FULL is set. pub deployment: Option, - /// Custom static error pages. Limited to 10KB per page. Only returned in `GET` requests if `view=FULL` is set. + /// Custom static error pages. Limited to 10KB per page.Only returned in GET requests if view=FULL is set. #[serde(rename="errorHandlers")] pub error_handlers: Option>, - /// Current serving status of this version. Only the versions with a `SERVING` status create instances and can be billed. `SERVING_STATUS_UNSPECIFIED` is an invalid value. Defaults to `SERVING`. + /// Current serving status of this version. Only the versions with a SERVING status create instances and can be billed.SERVING_STATUS_UNSPECIFIED is an invalid value. Defaults to SERVING. #[serde(rename="servingStatus")] pub serving_status: Option, - /// Relative name of the version within the module. Example: `v1`. Version names can contain only lowercase letters, numbers, or hyphens. Reserved names: "default", "latest", and any name with the prefix "ah-". + /// Relative name of the version within the module. Example: v1. Version names can contain only lowercase letters, numbers, or hyphens. Reserved names: "default", "latest", and any name with the prefix "ah-". pub id: Option, /// Whether multiple requests can be dispatched to this version at once. pub threadsafe: Option, - /// Serving configuration for [Google Cloud Endpoints](https://cloud.google.com/appengine/docs/python/endpoints/). Only returned in `GET` requests if `view=FULL` is set. + /// Serving configuration for Google Cloud Endpoints (https://cloud.google.com/appengine/docs/python/endpoints/).Only returned in GET requests if view=FULL is set. #[serde(rename="apiConfig")] pub api_config: Option, - /// Files that match this pattern will not be built into this version. Only applicable for Go runtimes. Only returned in `GET` requests if `view=FULL` is set. + /// Files that match this pattern will not be built into this version. Only applicable for Go runtimes.Only returned in GET requests if view=FULL is set. #[serde(rename="nobuildFilesRegex")] pub nobuild_files_regex: Option, /// Extra network settings. Only applicable for VM runtimes. pub network: Option, - /// An ordered list of URL-matching patterns that should be applied to incoming requests. The first matching URL handles the request and other request handlers are not attempted. Only returned in `GET` requests if `view=FULL` is set. + /// An ordered list of URL-matching patterns that should be applied to incoming requests. The first matching URL handles the request and other request handlers are not attempted.Only returned in GET requests if view=FULL is set. pub handlers: Option>, - /// Configures health checking for VM instances. Unhealthy instances are stopped and replaced with new instances. Only applicable for VM runtimes. Only returned in `GET` requests if `view=FULL` is set. + /// Configures health checking for VM instances. Unhealthy instances are stopped and replaced with new instances. Only applicable for VM runtimes.Only returned in GET requests if view=FULL is set. #[serde(rename="healthCheck")] pub health_check: Option, - /// Duration that static files should be cached by web proxies and browsers. Only applicable if the corresponding [StaticFilesHandler](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#staticfileshandler) does not specify its own expiration time. Only returned in `GET` requests if `view=FULL` is set. + /// Duration that static files should be cached by web proxies and browsers. Only applicable if the corresponding StaticFilesHandler (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#staticfileshandler) does not specify its own expiration time.Only returned in GET requests if view=FULL is set. #[serde(rename="defaultExpiration")] pub default_expiration: Option, - /// Full path to the Version resource in the API. Example: `apps/myapp/modules/default/versions/v1`. @OutputOnly + /// Full path to the Version resource in the API. Example: apps/myapp/modules/default/versions/v1.@OutputOnly pub name: Option, - /// Configuration for third-party Python runtime libraries required by the application. Only returned in `GET` requests if `view=FULL` is set. + /// Configuration for third-party Python runtime libraries required by the application.Only returned in GET requests if view=FULL is set. pub libraries: Option>, - /// Email address of the user who created this version. @OutputOnly + /// Email address of the user who created this version.@OutputOnly pub deployer: Option, - /// App Engine execution environment to use for this version. Defaults to `1`. + /// App Engine execution environment to use for this version.Defaults to 1. pub env: Option, /// Automatic scaling is based on request rate, response latencies, and other application metrics. #[serde(rename="automaticScaling")] pub automatic_scaling: Option, - /// Desired runtime. Example: `python27`. + /// Desired runtime. Example: python27. pub runtime: Option, - /// Environment variables made available to the application. Only returned in `GET` requests if `view=FULL` is set. + /// Environment variables made available to the application.Only returned in GET requests if view=FULL is set. #[serde(rename="envVariables")] pub env_variables: Option>, /// Machine resources for this version. Only applicable for VM runtimes. @@ -365,7 +374,7 @@ pub struct Library { impl Part for Library {} -/// Request message for `Instances.DebugInstance`. +/// Request message for Instances.DebugInstance. /// /// # Activities /// @@ -375,7 +384,11 @@ impl Part for Library {} /// * [modules versions instances debug apps](struct.AppModuleVersionInstanceDebugCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DebugInstanceRequest { _never_set: Option } +pub struct DebugInstanceRequest { + /// Public SSH key to add to the instance. Examples: [USERNAME]:ssh-rsa [KEY_VALUE] [USERNAME] [USERNAME]:ssh-rsa [KEY_VALUE] google-ssh {"userName":"[USERNAME]","expireOn":"[EXPIRE_TIME]"}For more information, see Adding and Removing SSH Keys (https://cloud.google.com/compute/docs/instances/adding-removing-ssh-keys). + #[serde(rename="sshKey")] + pub ssh_key: Option, +} impl RequestValue for DebugInstanceRequest {} @@ -403,20 +416,22 @@ impl Part for CpuUtilization {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Resources { + /// Memory (GB) needed. + #[serde(rename="memoryGb")] + pub memory_gb: Option, /// Disk size (GB) needed. #[serde(rename="diskGb")] pub disk_gb: Option, /// Number of CPU cores needed. pub cpu: Option, - /// Memory (GB) needed. - #[serde(rename="memoryGb")] - pub memory_gb: Option, + /// User specified volumes. + pub volumes: Option>, } impl Part for Resources {} -/// Response message for `Modules.ListModules`. +/// Response message for Modules.ListModules. /// /// # Activities /// @@ -437,7 +452,7 @@ pub struct ListModulesResponse { impl ResponseResult for ListModulesResponse {} -/// The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). The error model is designed to be: - Simple to use and understand for most users - Flexible enough to meet unexpected needs # Overview The `Status` message contains three pieces of data: error code, error message, and error details. The error code should be an enum value of google.rpc.Code, but it may accept additional error codes if needed. The error message should be a developer-facing English message that helps developers *understand* and *resolve* the error. If a localized user-facing error message is needed, put the localized message in the error details or localize it in the client. The optional error details may contain arbitrary information about the error. There is a predefined set of error detail types in the package `google.rpc` which can be used for common error conditions. # Language mapping The `Status` message is the logical representation of the error model, but it is not necessarily the actual wire format. When the `Status` message is exposed in different client libraries and different wire protocols, it can be mapped differently. For example, it will likely be mapped to some exceptions in Java, but more likely mapped to some error codes in C. # Other uses The error model and the `Status` message can be used in a variety of environments, either with or without APIs, to provide a consistent developer experience across different environments. Example uses of this error model include: - Partial errors. If a service needs to return partial errors to the client, it may embed the `Status` in the normal response to indicate the partial errors. - Workflow errors. A typical workflow has multiple steps. Each step may have a `Status` message for error reporting purpose. - Batch operations. If a client uses batch request and batch response, the `Status` message should be used directly inside batch response, one for each error sub-response. - Asynchronous operations. If an API call embeds asynchronous operation results in its response, the status of those operations should be represented directly using the `Status` message. - Logging. If some API errors are stored in logs, the message `Status` could be used directly after any stripping needed for security/privacy reasons. +/// The Status type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by gRPC (https://github.com/grpc). The error model is designed to be: Simple to use and understand for most users Flexible enough to meet unexpected needsOverviewThe Status message contains three pieces of data: error code, error message, and error details. The error code should be an enum value of google.rpc.Code, but it may accept additional error codes if needed. The error message should be a developer-facing English message that helps developers understand and resolve the error. If a localized user-facing error message is needed, put the localized message in the error details or localize it in the client. The optional error details may contain arbitrary information about the error. There is a predefined set of error detail types in the package google.rpc which can be used for common error conditions.Language mappingThe Status message is the logical representation of the error model, but it is not necessarily the actual wire format. When the Status message is exposed in different client libraries and different wire protocols, it can be mapped differently. For example, it will likely be mapped to some exceptions in Java, but more likely mapped to some error codes in C.Other usesThe error model and the Status message can be used in a variety of environments, either with or without APIs, to provide a consistent developer experience across different environments.Example uses of this error model include: Partial errors. If a service needs to return partial errors to the client, it may embed the Status in the normal response to indicate the partial errors. Workflow errors. A typical workflow has multiple steps. Each step may have a Status message for error reporting purpose. Batch operations. If a client uses batch request and batch response, the Status message should be used directly inside batch response, one for each error sub-response. Asynchronous operations. If an API call embeds asynchronous operation results in its response, the status of those operations should be represented directly using the Status message. Logging. If some API errors are stored in logs, the message Status could be used directly after any stripping needed for security/privacy reasons. /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -524,7 +539,7 @@ pub struct NetworkUtilization { impl Part for NetworkUtilization {} -/// Response message for `Versions.ListVersions`. +/// Response message for Versions.ListVersions. /// /// # Activities /// @@ -545,6 +560,25 @@ pub struct ListVersionsResponse { impl ResponseResult for ListVersionsResponse {} +/// Volumes mounted within the app container. Only applicable for VM runtimes. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Volume { + /// Underlying volume type, e.g. 'tmpfs'. + #[serde(rename="volumeType")] + pub volume_type: Option, + /// Unique name for the volume. + pub name: Option, + /// Volume size in gigabytes. + #[serde(rename="sizeGb")] + pub size_gb: Option, +} + +impl Part for Volume {} + + /// Code and application artifacts used to deploy a version to App Engine. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -583,11 +617,11 @@ impl Part for ScriptHandler {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct UrlDispatchRule { - /// Pathname within the host. Must start with a "`/`". A single "`*`" can be included at the end of the path. The sum of the lengths of the domain and path may not exceed 100 characters. + /// Pathname within the host. Must start with a "/". A single "*" can be included at the end of the path. The sum of the lengths of the domain and path may not exceed 100 characters. pub path: Option, - /// Domain name to match against. The wildcard "`*`" is supported if specified before a period: "`*.`". Defaults to matching all domains: "`*`". + /// Domain name to match against. The wildcard "*" is supported if specified before a period: "*.".Defaults to matching all domains: "*". pub domain: Option, - /// Resource ID of a module in this application that should serve the matched request. The module must already exist. Example: `default`. + /// Resource ID of a module in this application that should serve the matched request. The module must already exist. Example: default. pub module: Option, } @@ -647,7 +681,7 @@ pub struct ErrorHandler { /// Error condition this handler applies to. #[serde(rename="errorCode")] pub error_code: Option, - /// MIME type of file. Defaults to `text/html`. + /// MIME type of file. Defaults to text/html. #[serde(rename="mimeType")] pub mime_type: Option, /// Static file content to be served for this error. @@ -669,7 +703,7 @@ pub struct StaticDirectoryHandler { pub mime_type: Option, /// Time a static file served by this handler should be cached. pub expiration: Option, - /// Path to the directory containing the static files from the application root directory. Everything after the end of the matched URL pattern is appended to `static_dir` to form the full path to the requested file. + /// Path to the directory containing the static files from the application root directory. Everything after the end of the matched URL pattern is appended to static_dir to form the full path to the requested file. pub directory: Option, /// Whether this handler should match the request if the file referenced by the handler does not exist. #[serde(rename="requireMatchingFile")] @@ -712,13 +746,13 @@ pub struct AutomaticScaling { /// Target scaling by request utilization. #[serde(rename="requestUtilization")] pub request_utilization: Option, - /// Amount of time that the [Autoscaler](https://cloud.google.com/compute/docs/autoscaler/) should wait between changes to the number of virtual machines. Only applicable for VM runtimes. + /// Amount of time that the Autoscaler (https://cloud.google.com/compute/docs/autoscaler/) should wait between changes to the number of virtual machines. Only applicable for VM runtimes. #[serde(rename="coolDownPeriod")] pub cool_down_period: Option, /// Maximum number of instances that should be started to handle requests. #[serde(rename="maxTotalInstances")] pub max_total_instances: Option, - /// Number of concurrent requests an automatic scaling instance can accept before the scheduler spawns a new instance. Defaults to a runtime-specific value. + /// Number of concurrent requests an automatic scaling instance can accept before the scheduler spawns a new instance.Defaults to a runtime-specific value. #[serde(rename="maxConcurrentRequests")] pub max_concurrent_requests: Option, /// Minimum number of instances that should be maintained for this version. @@ -738,13 +772,13 @@ impl Part for AutomaticScaling {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct UrlMap { - /// Serves the entire contents of a directory as static files. This attribute is deprecated. You can mimic the behavior of static directories using static files. + /// Serves the entire contents of a directory as static files.This attribute is deprecated. You can mimic the behavior of static directories using static files. #[serde(rename="staticDirectory")] pub static_directory: Option, /// Security (HTTPS) enforcement for this URL. #[serde(rename="securityLevel")] pub security_level: Option, - /// Action to take when users access resources that require authentication. Defaults to `redirect`. + /// Action to take when users access resources that require authentication. Defaults to redirect. #[serde(rename="authFailAction")] pub auth_fail_action: Option, /// A URL prefix. Uses regular expression syntax, which means regexp special characters must be escaped, but should not contain groupings. All URLs that begin with this prefix are handled by this handler, using the portion of the URL after the prefix as part of the file path. @@ -760,7 +794,7 @@ pub struct UrlMap { pub api_endpoint: Option, /// Level of login required to access this resource. pub login: Option, - /// `30x` code to use when performing redirects for the `secure` field. Defaults to `302`. + /// 30x code to use when performing redirects for the secure field. Defaults to 302. #[serde(rename="redirectHttpResponseCode")] pub redirect_http_response_code: Option, } @@ -774,10 +808,10 @@ impl Part for UrlMap {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct FileInfo { - /// The MIME type of the file. Defaults to the value from Google Cloud Storage. + /// The MIME type of the file.Defaults to the value from Google Cloud Storage. #[serde(rename="mimeType")] pub mime_type: Option, - /// URL source to use to fetch this file. Must be a URL to a resource in Google Cloud Storage in the form 'http(s)://storage.googleapis.com/\/\'. + /// URL source to use to fetch this file. Must be a URL to a resource in Google Cloud Storage in the form 'http(s)://storage.googleapis.com//'. #[serde(rename="sourceUrl")] pub source_url: Option, /// The SHA1 hash of the file, in hex. @@ -820,45 +854,48 @@ impl ResponseResult for ListOperationsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Instance { - /// Number of errors since this instance was started. @OutputOnly - pub errors: Option, - /// Full path to the Instance resource in the API. Example: `apps/myapp/modules/default/versions/v1/instances/instance-1`. @OutputOnly - pub name: Option, - /// Whether this instance is in debug mode. Only applicable for instances in App Engine flexible environment. @OutputOnly - #[serde(rename="vmUnlocked")] - pub vm_unlocked: Option, - /// App Engine release this instance is running on. @OutputOnly + /// App Engine release this instance is running on.@OutputOnly #[serde(rename="appEngineRelease")] pub app_engine_release: Option, - /// Virtual machine ID of this instance. Only applicable for instances in App Engine flexible environment. @OutputOnly + /// Virtual machine ID of this instance. Only applicable for instances in App Engine flexible environment.@OutputOnly #[serde(rename="vmId")] pub vm_id: Option, - /// Total memory in use (bytes). @OutputOnly + /// Total memory in use (bytes).@OutputOnly #[serde(rename="memoryUsage")] pub memory_usage: Option, - /// Availability of the instance. @OutputOnly - pub availability: Option, - /// Average latency (ms) over the last minute. @OutputOnly - #[serde(rename="averageLatency")] - pub average_latency: Option, - /// Relative name of the instance within the version. Example: `instance-1`. @OutputOnly - pub id: Option, - /// Average queries per second (QPS) over the last minute. @OutputOnly + /// The IP address of this instance. Only applicable for instances in App Engine flexible environment.@OutputOnly + #[serde(rename="vmIp")] + pub vm_ip: Option, + /// Average queries per second (QPS) over the last minute.@OutputOnly pub qps: Option, - /// Number of requests since this instance was started. @OutputOnly - pub requests: Option, - /// Name of the virtual machine where this instance lives. Only applicable for instances in App Engine flexible environment. @OutputOnly - #[serde(rename="vmName")] - pub vm_name: Option, - /// Time that this instance was started. @OutputOnly - #[serde(rename="startTimestamp")] - pub start_timestamp: Option, - /// Zone where the virtual machine is located. Only applicable for instances in App Engine flexible environment. @OutputOnly - #[serde(rename="vmZoneName")] - pub vm_zone_name: Option, - /// Status of the virtual machine where this instance lives. Only applicable for instances in App Engine flexible environment. @OutputOnly + /// Availability of the instance.@OutputOnly + pub availability: Option, + /// Full path to the Instance resource in the API. Example: apps/myapp/modules/default/versions/v1/instances/instance-1.@OutputOnly + pub name: Option, + /// Number of errors since this instance was started.@OutputOnly + pub errors: Option, + /// Status of the virtual machine where this instance lives. Only applicable for instances in App Engine flexible environment.@OutputOnly #[serde(rename="vmStatus")] pub vm_status: Option, + /// Whether this instance is in debug mode. Only applicable for instances in App Engine flexible environment.@OutputOnly + #[serde(rename="vmUnlocked")] + pub vm_unlocked: Option, + /// Relative name of the instance within the version. Example: instance-1.@OutputOnly + pub id: Option, + /// Average latency (ms) over the last minute.@OutputOnly + #[serde(rename="averageLatency")] + pub average_latency: Option, + /// Number of requests since this instance was started.@OutputOnly + pub requests: Option, + /// Name of the virtual machine where this instance lives. Only applicable for instances in App Engine flexible environment.@OutputOnly + #[serde(rename="vmName")] + pub vm_name: Option, + /// Time that this instance was started.@OutputOnly + #[serde(rename="startTimestamp")] + pub start_timestamp: Option, + /// Zone where the virtual machine is located. Only applicable for instances in App Engine flexible environment.@OutputOnly + #[serde(rename="vmZoneName")] + pub vm_zone_name: Option, } impl ResponseResult for Instance {} @@ -870,7 +907,7 @@ impl ResponseResult for Instance {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ManualScaling { - /// Number of instances to assign to the module at the start. This number can later be altered by using the [Modules API](https://cloud.google.com/appengine/docs/python/modules/functions) `set_num_instances()` function. + /// Number of instances to assign to the module at the start. This number can later be altered by using the Modules API (https://cloud.google.com/appengine/docs/python/modules/functions) set_num_instances() function. pub instances: Option, } @@ -890,7 +927,7 @@ pub struct ContainerInfo { impl Part for ContainerInfo {} -/// [Google Cloud Endpoints](https://cloud.google.com/appengine/docs/python/endpoints/) configuration for API handlers. +/// Google Cloud Endpoints (https://cloud.google.com/appengine/docs/python/endpoints/) configuration for API handlers. /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -901,10 +938,10 @@ pub struct ApiConfigHandler { /// Security (HTTPS) enforcement for this URL. #[serde(rename="securityLevel")] pub security_level: Option, - /// Action to take when users access resources that require authentication. Defaults to `redirect`. + /// Action to take when users access resources that require authentication. Defaults to redirect. #[serde(rename="authFailAction")] pub auth_fail_action: Option, - /// Level of login required to access this resource. Defaults to `optional`. + /// Level of login required to access this resource. Defaults to optional. pub login: Option, /// Path to the script from the application root directory. pub script: Option, @@ -927,9 +964,9 @@ impl Part for ApiConfigHandler {} pub struct Module { /// Mapping that defines fractional HTTP traffic diversion to different versions within the module. pub split: Option, - /// Relative name of the module within the application. Example: `default`. @OutputOnly + /// Relative name of the module within the application. Example: default.@OutputOnly pub id: Option, - /// Full path to the Module resource in the API. Example: `apps/myapp/modules/default`. @OutputOnly + /// Full path to the Module resource in the API. Example: apps/myapp/modules/default.@OutputOnly pub name: Option, } @@ -1017,6 +1054,7 @@ impl Part for TrafficSplit {} /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [modules patch apps](struct.AppModulePatchCall.html) (response) +/// * [patch apps](struct.AppPatchCall.html) (response) /// * [create apps](struct.AppCreateCall.html) (response) /// * [modules versions instances delete apps](struct.AppModuleVersionInstanceDeleteCall.html) (response) /// * [modules versions instances debug apps](struct.AppModuleVersionInstanceDebugCall.html) (response) @@ -1030,13 +1068,13 @@ impl Part for TrafficSplit {} pub struct Operation { /// Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any. pub metadata: Option>, - /// If the value is `false`, it means the operation is still in progress. If true, the operation is completed, and either `error` or `response` is available. + /// If the value is false, it means the operation is still in progress. If true, the operation is completed, and either error or response is available. pub done: Option, - /// The normal response of the operation in case of success. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`. + /// The normal response of the operation in case of success. If the original method returns no data on success, such as Delete, the response is google.protobuf.Empty. If the original method is standard Get/Create/Update, the response should be the resource. For other methods, the response should have the type XxxResponse, where Xxx is the original method name. For example, if the original method name is TakeSnapshot(), the inferred response type is TakeSnapshotResponse. pub response: Option>, - /// The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should have the format of `operations/some/unique/name`. + /// The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the name should have the format of operations/some/unique/name. pub name: Option, - /// The error result of the operation in case of failure. + /// The error result of the operation in case of failure or cancellation. pub error: Option, } @@ -1056,10 +1094,10 @@ impl ResponseResult for Operation {} pub struct Location { /// Cross-service attributes for the location. For example {"cloud.googleapis.com/region": "us-east1"} pub labels: Option>, - /// The cononical id for this location. For example: `"us-east1"`. + /// The canonical id for this location. For example: "us-east1". #[serde(rename="locationId")] pub location_id: Option, - /// Resource name for the location, which may vary between implementations. For example: `"projects/example-project/locations/us-east1"` + /// Resource name for the location, which may vary between implementations. For example: "projects/example-project/locations/us-east1" pub name: Option, /// Service-specific metadata. For example the available capacity at the given location. pub metadata: Option>, @@ -1096,7 +1134,7 @@ impl ResponseResult for Location {} /// ::default(), None); /// let mut hub = Appengine::new(hyper::Client::new(), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `create(...)`, `get(...)`, `locations_get(...)`, `locations_list(...)`, `modules_delete(...)`, `modules_get(...)`, `modules_list(...)`, `modules_patch(...)`, `modules_versions_create(...)`, `modules_versions_delete(...)`, `modules_versions_get(...)`, `modules_versions_instances_debug(...)`, `modules_versions_instances_delete(...)`, `modules_versions_instances_get(...)`, `modules_versions_instances_list(...)`, `modules_versions_list(...)`, `modules_versions_patch(...)`, `operations_get(...)` and `operations_list(...)` +/// // like `create(...)`, `get(...)`, `locations_get(...)`, `locations_list(...)`, `modules_delete(...)`, `modules_get(...)`, `modules_list(...)`, `modules_patch(...)`, `modules_versions_create(...)`, `modules_versions_delete(...)`, `modules_versions_get(...)`, `modules_versions_instances_debug(...)`, `modules_versions_instances_delete(...)`, `modules_versions_instances_get(...)`, `modules_versions_instances_list(...)`, `modules_versions_list(...)`, `modules_versions_patch(...)`, `operations_get(...)`, `operations_list(...)` and `patch(...)` /// // to build up your call. /// let rb = hub.apps(); /// # } @@ -1118,7 +1156,7 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `appsId` - Part of `name`. Name of the resource to update. Example: `apps/myapp/modules/default`. + /// * `appsId` - Part of `name`. Name of the resource to update. Example: apps/myapp/modules/default. /// * `modulesId` - Part of `name`. See documentation of `appsId`. pub fn modules_patch(&self, request: Module, apps_id: &str, modules_id: &str) -> AppModulePatchCall<'a, C, A> { AppModulePatchCall { @@ -1140,7 +1178,7 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// /// # Arguments /// - /// * `appsId` - Part of `name`. Name of the resource requested. Example: `apps/myapp/modules/default`. + /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default. /// * `modulesId` - Part of `name`. See documentation of `appsId`. pub fn modules_get(&self, apps_id: &str, modules_id: &str) -> AppModuleGetCall<'a, C, A> { AppModuleGetCall { @@ -1159,7 +1197,7 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// /// # Arguments /// - /// * `appsId` - Part of `name`. Name of the resource requested. Example: `apps/myapp/modules/default/versions/v1/instances/instance-1`. + /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default/versions/v1/instances/instance-1. /// * `modulesId` - Part of `name`. See documentation of `appsId`. /// * `versionsId` - Part of `name`. See documentation of `appsId`. /// * `instancesId` - Part of `name`. See documentation of `appsId`. @@ -1182,7 +1220,7 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// /// # Arguments /// - /// * `appsId` - Part of `name`. Name of the resource requested. Example: `apps/myapp`. + /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp. pub fn modules_list(&self, apps_id: &str) -> AppModuleListCall<'a, C, A> { AppModuleListCall { hub: self.hub, @@ -1197,7 +1235,7 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Creates an App Engine application for a Google Cloud Platform project. This requires a project that excludes an App Engine application. For details about creating a project without an application, see the [Google Cloud Resource Manager create project topic](https://cloud.google.com/resource-manager/docs/creating-project). + /// Creates an App Engine application for a Google Cloud Platform project. This requires a project that excludes an App Engine application. For details about creating a project without an application, see the Google Cloud Resource Manager create project topic (https://cloud.google.com/resource-manager/docs/creating-project). /// /// # Arguments /// @@ -1218,7 +1256,7 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// /// # Arguments /// - /// * `appsId` - Part of `name`. Name of the resource requested. Example: `apps/myapp/modules/default/versions/v1`. + /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default/versions/v1. /// * `modulesId` - Part of `name`. See documentation of `appsId`. /// * `versionsId` - Part of `name`. See documentation of `appsId`. pub fn modules_versions_instances_list(&self, apps_id: &str, modules_id: &str, versions_id: &str) -> AppModuleVersionInstanceListCall<'a, C, A> { @@ -1241,7 +1279,7 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// /// # Arguments /// - /// * `appsId` - Part of `name`. Name of the resource requested. Example: `apps/myapp/modules/default/versions/v1/instances/instance-1`. + /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default/versions/v1/instances/instance-1. /// * `modulesId` - Part of `name`. See documentation of `appsId`. /// * `versionsId` - Part of `name`. See documentation of `appsId`. /// * `instancesId` - Part of `name`. See documentation of `appsId`. @@ -1260,12 +1298,12 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Enables debugging on a VM instance. This allows you to use the SSH command to connect to the virtual machine where the instance lives. While in "debug mode", the instance continues to serve live traffic. You should delete the instance when you are done debugging and then allow the system to take over and determine if another instance should be started. Only applicable for instances in App Engine flexible environment. + /// Enables debugging on a VM instance. This allows you to use the SSH command to connect to the virtual machine where the instance lives. While in "debug mode", the instance continues to serve live traffic. You should delete the instance when you are done debugging and then allow the system to take over and determine if another instance should be started.Only applicable for instances in App Engine flexible environment. /// /// # Arguments /// /// * `request` - No description provided. - /// * `appsId` - Part of `name`. Name of the resource requested. Example: `apps/myapp/modules/default/versions/v1/instances/instance-1`. + /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default/versions/v1/instances/instance-1. /// * `modulesId` - Part of `name`. See documentation of `appsId`. /// * `versionsId` - Part of `name`. See documentation of `appsId`. /// * `instancesId` - Part of `name`. See documentation of `appsId`. @@ -1289,7 +1327,7 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// /// # Arguments /// - /// * `appsId` - Part of `name`. Name of the application to get. Example: `apps/myapp`. + /// * `appsId` - Part of `name`. Name of the application to get. Example: apps/myapp. pub fn get(&self, apps_id: &str) -> AppGetCall<'a, C, A> { AppGetCall { hub: self.hub, @@ -1307,7 +1345,7 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// /// # Arguments /// - /// * `appsId` - Part of `name`. Name of the resource requested. Example: `apps/myapp/modules/default`. + /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default. /// * `modulesId` - Part of `name`. See documentation of `appsId`. pub fn modules_delete(&self, apps_id: &str, modules_id: &str) -> AppModuleDeleteCall<'a, C, A> { AppModuleDeleteCall { @@ -1320,6 +1358,26 @@ impl<'a, C, A> AppMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Updates the specified Application resource. You can update the following fields: auth_domain (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps#Application.FIELDS.auth_domain) default_cookie_expiration (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps#Application.FIELDS.default_cookie_expiration) + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `appsId` - Part of `name`. Name of the Application resource to update. Example: apps/myapp. + pub fn patch(&self, request: Application, apps_id: &str) -> AppPatchCall<'a, C, A> { + AppPatchCall { + hub: self.hub, + _request: request, + _apps_id: apps_id.to_string(), + _mask: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service. @@ -1380,12 +1438,12 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates the specified Version resource. You can specify the following fields depending on the App Engine environment and type of scaling that the version resource uses: * [`serving_status`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#Version.FIELDS.serving_status): For Version resources that use basic scaling, manual scaling, or run in the App Engine flexible environment. * [`instance_class`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#Version.FIELDS.instance_class): For Version resources that run in the App Engine standard environment. * [`automatic_scaling.min_idle_instances`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment. * [`automatic_scaling.max_idle_instances`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment. + /// Updates the specified Version resource. You can specify the following fields depending on the App Engine environment and type of scaling that the version resource uses: serving_status (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#Version.FIELDS.serving_status): For Version resources that use basic scaling, manual scaling, or run in the App Engine flexible environment. instance_class (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#Version.FIELDS.instance_class): For Version resources that run in the App Engine standard environment. automatic_scaling.min_idle_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment. automatic_scaling.max_idle_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment. /// /// # Arguments /// /// * `request` - No description provided. - /// * `appsId` - Part of `name`. Name of the resource to update. Example: `apps/myapp/modules/default/versions/1`. + /// * `appsId` - Part of `name`. Name of the resource to update. Example: apps/myapp/modules/default/versions/1. /// * `modulesId` - Part of `name`. See documentation of `appsId`. /// * `versionsId` - Part of `name`. See documentation of `appsId`. pub fn modules_versions_patch(&self, request: Version, apps_id: &str, modules_id: &str, versions_id: &str) -> AppModuleVersionPatchCall<'a, C, A> { @@ -1404,7 +1462,7 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`. NOTE: the `name` binding below allows API services to override the binding to use different resource name schemes, such as `users/*/operations`. + /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED.NOTE: the name binding below allows API services to override the binding to use different resource name schemes, such as users/*/operations. /// /// # Arguments /// @@ -1428,7 +1486,7 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// /// # Arguments /// - /// * `appsId` - Part of `name`. Name of the resource requested. Example: `apps/myapp/modules/default/versions/v1`. + /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default/versions/v1. /// * `modulesId` - Part of `name`. See documentation of `appsId`. /// * `versionsId` - Part of `name`. See documentation of `appsId`. pub fn modules_versions_delete(&self, apps_id: &str, modules_id: &str, versions_id: &str) -> AppModuleVersionDeleteCall<'a, C, A> { @@ -1450,7 +1508,7 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `appsId` - Part of `name`. Name of the resource to update. Example: `apps/myapp/modules/default`. + /// * `appsId` - Part of `name`. Name of the resource to update. Example: apps/myapp/modules/default. /// * `modulesId` - Part of `name`. See documentation of `appsId`. pub fn modules_versions_create(&self, request: Version, apps_id: &str, modules_id: &str) -> AppModuleVersionCreateCall<'a, C, A> { AppModuleVersionCreateCall { @@ -1466,11 +1524,11 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets the specified Version resource. By default, only a `BASIC_VIEW` will be returned. Specify the `FULL_VIEW` parameter to get the full resource. + /// Gets the specified Version resource. By default, only a BASIC_VIEW will be returned. Specify the FULL_VIEW parameter to get the full resource. /// /// # Arguments /// - /// * `appsId` - Part of `name`. Name of the resource requested. Example: `apps/myapp/modules/default/versions/v1`. + /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default/versions/v1. /// * `modulesId` - Part of `name`. See documentation of `appsId`. /// * `versionsId` - Part of `name`. See documentation of `appsId`. pub fn modules_versions_get(&self, apps_id: &str, modules_id: &str, versions_id: &str) -> AppModuleVersionGetCall<'a, C, A> { @@ -1492,7 +1550,7 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// /// # Arguments /// - /// * `appsId` - Part of `name`. Name of the resource requested. Example: `apps/myapp/modules/default`. + /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default. /// * `modulesId` - Part of `name`. See documentation of `appsId`. pub fn modules_versions_list(&self, apps_id: &str, modules_id: &str) -> AppModuleVersionListCall<'a, C, A> { AppModuleVersionListCall { @@ -1733,7 +1791,7 @@ impl<'a, C, A> AppModulePatchCall<'a, C, A> where C: BorrowMut, A self._request = new_value; self } - /// Part of `name`. Name of the resource to update. Example: `apps/myapp/modules/default`. + /// Part of `name`. Name of the resource to update. Example: apps/myapp/modules/default. /// /// Sets the *apps id* path property to the given value. /// @@ -1753,7 +1811,7 @@ impl<'a, C, A> AppModulePatchCall<'a, C, A> where C: BorrowMut, A self._modules_id = new_value.to_string(); self } - /// Set to `true` to gradually shift traffic from one version to another single version. By default, traffic is shifted immediately. For gradual traffic migration, the target version must be located within instances that are configured for both [warmup requests](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#inboundservicetype) and [automatic scaling](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#automaticscaling). You must specify the [`shardBy`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules#shardby) field in the Module resource. Gradual traffic migration is not supported in the App Engine flexible environment. For examples, see [Migrating and Splitting Traffic](https://cloud.google.com/appengine/docs/admin-api/migrating-splitting-traffic). + /// Set to true to gradually shift traffic from one version to another single version. By default, traffic is shifted immediately. For gradual traffic migration, the target version must be located within instances that are configured for both warmup requests (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#inboundservicetype) and automatic scaling (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#automaticscaling). You must specify the shardBy (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules#shardby) field in the Module resource. Gradual traffic migration is not supported in the App Engine flexible environment. For examples, see Migrating and Splitting Traffic (https://cloud.google.com/appengine/docs/admin-api/migrating-splitting-traffic). /// /// Sets the *migrate traffic* query property to the given value. pub fn migrate_traffic(mut self, new_value: bool) -> AppModulePatchCall<'a, C, A> { @@ -1899,7 +1957,7 @@ impl<'a, C, A> AppModuleGetCall<'a, C, A> where C: BorrowMut, A: let mut url = "https://appengine.googleapis.com/v1beta4/apps/{appsId}/modules/{modulesId}".to_string(); if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + self._scopes.insert(Scope::Admin.as_ref().to_string(), ()); } for &(find_this, param_name) in [("{appsId}", "appsId"), ("{modulesId}", "modulesId")].iter() { @@ -2000,7 +2058,7 @@ impl<'a, C, A> AppModuleGetCall<'a, C, A> where C: BorrowMut, A: } - /// Part of `name`. Name of the resource requested. Example: `apps/myapp/modules/default`. + /// Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default. /// /// Sets the *apps id* path property to the given value. /// @@ -2062,7 +2120,7 @@ impl<'a, C, A> AppModuleGetCall<'a, C, A> where C: BorrowMut, A: /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. + /// `Scope::Admin`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. @@ -2156,7 +2214,7 @@ impl<'a, C, A> AppModuleVersionInstanceGetCall<'a, C, A> where C: BorrowMut AppModuleVersionInstanceGetCall<'a, C, A> where C: BorrowMut AppModuleVersionInstanceGetCall<'a, C, A> where C: BorrowMut AppModuleListCall<'a, C, A> where C: BorrowMut, A: let mut url = "https://appengine.googleapis.com/v1beta4/apps/{appsId}/modules".to_string(); if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + self._scopes.insert(Scope::Admin.as_ref().to_string(), ()); } for &(find_this, param_name) in [("{appsId}", "appsId")].iter() { @@ -2538,7 +2596,7 @@ impl<'a, C, A> AppModuleListCall<'a, C, A> where C: BorrowMut, A: } - /// Part of `name`. Name of the resource requested. Example: `apps/myapp`. + /// Part of `name`. Name of the resource requested. Example: apps/myapp. /// /// Sets the *apps id* path property to the given value. /// @@ -2604,7 +2662,7 @@ impl<'a, C, A> AppModuleListCall<'a, C, A> where C: BorrowMut, A: /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. + /// `Scope::Admin`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. @@ -2620,7 +2678,7 @@ impl<'a, C, A> AppModuleListCall<'a, C, A> where C: BorrowMut, A: } -/// Creates an App Engine application for a Google Cloud Platform project. This requires a project that excludes an App Engine application. For details about creating a project without an application, see the [Google Cloud Resource Manager create project topic](https://cloud.google.com/resource-manager/docs/creating-project). +/// Creates an App Engine application for a Google Cloud Platform project. This requires a project that excludes an App Engine application. For details about creating a project without an application, see the Google Cloud Resource Manager create project topic (https://cloud.google.com/resource-manager/docs/creating-project). /// /// A builder for the *create* method supported by a *app* resource. /// It is not used directly, but through a `AppMethods` instance. @@ -2945,7 +3003,7 @@ impl<'a, C, A> AppModuleVersionInstanceListCall<'a, C, A> where C: BorrowMut AppModuleVersionInstanceListCall<'a, C, A> where C: BorrowMut AppModuleVersionInstanceListCall<'a, C, A> where C: BorrowMut AppModuleVersionInstanceDeleteCall<'a, C, A> where C: BorrowMut AppModuleVersionInstanceDeleteCall<'a, C, A> where C: BorrowMut AppModuleVersionInstanceDebugCall<'a, C, A> where C: BorrowMut AppGetCall<'a, C, A> where C: BorrowMut, A: oauth2 } - /// Part of `name`. Name of the application to get. Example: `apps/myapp`. + /// Part of `name`. Name of the application to get. Example: apps/myapp. /// /// Sets the *apps id* path property to the given value. /// @@ -3921,7 +3979,7 @@ impl<'a, C, A> AppGetCall<'a, C, A> where C: BorrowMut, A: oauth2 self._apps_id = new_value.to_string(); self } - /// Certain resources associated with an application are created on-demand. Controls whether these resources should be created when performing the `GET` operation. If specified and any resources could not be created, the request will fail with an error code. Additionally, this parameter can cause the request to take longer to complete. + /// Certain resources associated with an application are created on-demand. Controls whether these resources should be created when performing the GET operation. If specified and any resources could not be created, the request will fail with an error code. Additionally, this parameter can cause the request to take longer to complete. /// /// Sets the *ensure resources exist* query property to the given value. pub fn ensure_resources_exist(mut self, new_value: bool) -> AppGetCall<'a, C, A> { @@ -4161,7 +4219,7 @@ impl<'a, C, A> AppModuleDeleteCall<'a, C, A> where C: BorrowMut, } - /// Part of `name`. Name of the resource requested. Example: `apps/myapp/modules/default`. + /// Part of `name`. Name of the resource requested. Example: apps/myapp/modules/default. /// /// Sets the *apps id* path property to the given value. /// @@ -4239,6 +4297,290 @@ impl<'a, C, A> AppModuleDeleteCall<'a, C, A> where C: BorrowMut, } +/// Updates the specified Application resource. You can update the following fields: auth_domain (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps#Application.FIELDS.auth_domain) default_cookie_expiration (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps#Application.FIELDS.default_cookie_expiration) +/// +/// A builder for the *patch* method supported by a *app* resource. +/// It is not used directly, but through a `AppMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_appengine1_beta4 as appengine1_beta4; +/// use appengine1_beta4::Application; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use appengine1_beta4::Appengine; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Appengine::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Application::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.apps().patch(req, "appsId") +/// .mask("amet") +/// .doit(); +/// # } +/// ``` +pub struct AppPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Appengine, + _request: Application, + _apps_id: String, + _mask: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AppPatchCall<'a, C, A> {} + +impl<'a, C, A> AppPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "appengine.apps.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("appsId", self._apps_id.to_string())); + if let Some(value) = self._mask { + params.push(("mask", value.to_string())); + } + for &field in ["alt", "appsId", "mask"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://appengine.googleapis.com/v1beta4/apps/{appsId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{appsId}", "appsId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["appsId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Application) -> AppPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// Part of `name`. Name of the Application resource to update. Example: apps/myapp. + /// + /// Sets the *apps id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn apps_id(mut self, new_value: &str) -> AppPatchCall<'a, C, A> { + self._apps_id = new_value.to_string(); + self + } + /// Standard field mask for the set of fields to be updated. + /// + /// Sets the *mask* query property to the given value. + pub fn mask(mut self, new_value: &str) -> AppPatchCall<'a, C, A> { + self._mask = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AppPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AppPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AppPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + /// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service. /// /// A builder for the *operations.get* method supported by a *app* resource. @@ -4313,7 +4655,7 @@ impl<'a, C, A> AppOperationGetCall<'a, C, A> where C: BorrowMut, let mut url = "https://appengine.googleapis.com/v1beta4/apps/{appsId}/operations/{operationsId}".to_string(); if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + self._scopes.insert(Scope::Admin.as_ref().to_string(), ()); } for &(find_this, param_name) in [("{appsId}", "appsId"), ("{operationsId}", "operationsId")].iter() { @@ -4476,7 +4818,7 @@ impl<'a, C, A> AppOperationGetCall<'a, C, A> where C: BorrowMut, /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. + /// `Scope::Admin`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. @@ -4566,7 +4908,7 @@ impl<'a, C, A> AppLocationGetCall<'a, C, A> where C: BorrowMut, A let mut url = "https://appengine.googleapis.com/v1beta4/apps/{appsId}/locations/{locationsId}".to_string(); if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + self._scopes.insert(Scope::Admin.as_ref().to_string(), ()); } for &(find_this, param_name) in [("{appsId}", "appsId"), ("{locationsId}", "locationsId")].iter() { @@ -4729,7 +5071,7 @@ impl<'a, C, A> AppLocationGetCall<'a, C, A> where C: BorrowMut, A /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. + /// `Scope::Admin`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. @@ -4772,9 +5114,9 @@ impl<'a, C, A> AppLocationGetCall<'a, C, A> where C: BorrowMut, A /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().locations_list("appsId") -/// .page_token("dolore") -/// .page_size(-37) -/// .filter("aliquyam") +/// .page_token("aliquyam") +/// .page_size(-73) +/// .filter("Lorem") /// .doit(); /// # } /// ``` @@ -4832,7 +5174,7 @@ impl<'a, C, A> AppLocationListCall<'a, C, A> where C: BorrowMut, let mut url = "https://appengine.googleapis.com/v1beta4/apps/{appsId}/locations".to_string(); if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + self._scopes.insert(Scope::Admin.as_ref().to_string(), ()); } for &(find_this, param_name) in [("{appsId}", "appsId")].iter() { @@ -5006,7 +5348,7 @@ impl<'a, C, A> AppLocationListCall<'a, C, A> where C: BorrowMut, /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. + /// `Scope::Admin`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. @@ -5022,7 +5364,7 @@ impl<'a, C, A> AppLocationListCall<'a, C, A> where C: BorrowMut, } -/// Updates the specified Version resource. You can specify the following fields depending on the App Engine environment and type of scaling that the version resource uses: * [`serving_status`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#Version.FIELDS.serving_status): For Version resources that use basic scaling, manual scaling, or run in the App Engine flexible environment. * [`instance_class`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#Version.FIELDS.instance_class): For Version resources that run in the App Engine standard environment. * [`automatic_scaling.min_idle_instances`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment. * [`automatic_scaling.max_idle_instances`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment. +/// Updates the specified Version resource. You can specify the following fields depending on the App Engine environment and type of scaling that the version resource uses: serving_status (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#Version.FIELDS.serving_status): For Version resources that use basic scaling, manual scaling, or run in the App Engine flexible environment. instance_class (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#Version.FIELDS.instance_class): For Version resources that run in the App Engine standard environment. automatic_scaling.min_idle_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment. automatic_scaling.max_idle_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta4/apps.modules.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment. /// /// A builder for the *modules.versions.patch* method supported by a *app* resource. /// It is not used directly, but through a `AppMethods` instance. @@ -5235,7 +5577,7 @@ impl<'a, C, A> AppModuleVersionPatchCall<'a, C, A> where C: BorrowMut AppModuleVersionPatchCall<'a, C, A> where C: BorrowMut AppModuleVersionPatchCall<'a, C, A> where C: BorrowMut AppOperationListCall<'a, C, A> where C: BorrowMut, let mut url = "https://appengine.googleapis.com/v1beta4/apps/{appsId}/operations".to_string(); if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + self._scopes.insert(Scope::Admin.as_ref().to_string(), ()); } for &(find_this, param_name) in [("{appsId}", "appsId")].iter() { @@ -5591,7 +5933,7 @@ impl<'a, C, A> AppOperationListCall<'a, C, A> where C: BorrowMut, /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. + /// `Scope::Admin`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. @@ -5784,7 +6126,7 @@ impl<'a, C, A> AppModuleVersionDeleteCall<'a, C, A> where C: BorrowMut AppModuleVersionCreateCall<'a, C, A> where C: BorrowMut AppModuleVersionCreateCall<'a, C, A> where C: BorrowMut AppModuleVersionCreateCall<'a, C, A> where C: BorrowMut AppModuleVersionGetCall<'a, C, A> where C: BorrowMut AppModuleVersionGetCall<'a, C, A> where C: BorrowMut AppModuleVersionGetCall<'a, C, A> where C: BorrowMut AppModuleVersionGetCall<'a, C, A> { @@ -6417,7 +6759,7 @@ impl<'a, C, A> AppModuleVersionGetCall<'a, C, A> where C: BorrowMut AppModuleVersionGetCall<'a, C, A> where C: BorrowMut AppModuleVersionListCall<'a, C, A> where C: BorrowMut AppModuleVersionListCall<'a, C, A> where C: BorrowMut AppModuleVersionListCall<'a, C, A> where C: BorrowMut AppModuleVersionListCall<'a, C, A> { @@ -6706,7 +7048,7 @@ impl<'a, C, A> AppModuleVersionListCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with appengine (protocol v1beta5)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/appengine1_beta5-cli" diff --git a/gen/appengine1_beta5-cli/README.md b/gen/appengine1_beta5-cli/README.md index 1bf97455df..f7017e72a6 100644 --- a/gen/appengine1_beta5-cli/README.md +++ b/gen/appengine1_beta5-cli/README.md @@ -24,7 +24,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *appengine* API at revision *20160802*. The CLI is at version *1.0.0*. +This documentation was generated from the *appengine* API at revision *20161208*. The CLI is at version *1.0.0*. ```bash appengine1-beta5 [options] @@ -35,6 +35,7 @@ appengine1-beta5 [options] locations-list [-p ]... [-o ] operations-get [-p ]... [-o ] operations-list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] services-delete [-p ]... [-o ] services-get [-p ]... [-o ] services-list [-p ]... [-o ] diff --git a/gen/appengine1_beta5-cli/mkdocs.yml b/gen/appengine1_beta5-cli/mkdocs.yml index ac63d20893..f739c208b2 100644 --- a/gen/appengine1_beta5-cli/mkdocs.yml +++ b/gen/appengine1_beta5-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: appengine v1.0.0+20160802 +site_name: appengine v1.0.0+20161208 site_url: http://byron.github.io/google-apis-rs/google-appengine1_beta5-cli site_description: Write integrating applications with bcore @@ -15,6 +15,7 @@ pages: - ['apps_locations-list.md', 'Apps', 'Locations List'] - ['apps_operations-get.md', 'Apps', 'Operations Get'] - ['apps_operations-list.md', 'Apps', 'Operations List'] +- ['apps_patch.md', 'Apps', 'Patch'] - ['apps_services-delete.md', 'Apps', 'Services Delete'] - ['apps_services-get.md', 'Apps', 'Services Get'] - ['apps_services-list.md', 'Apps', 'Services List'] diff --git a/gen/appengine1_beta5-cli/src/main.rs b/gen/appengine1_beta5-cli/src/main.rs index 953e67e10d..438526c0ee 100644 --- a/gen/appengine1_beta5-cli/src/main.rs +++ b/gen/appengine1_beta5-cli/src/main.rs @@ -421,6 +421,102 @@ impl<'n> Engine<'n> { } } + fn _apps_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "default-hostname" => Some(("defaultHostname", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "code-bucket" => Some(("codeBucket", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-bucket" => Some(("defaultBucket", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-cookie-expiration" => Some(("defaultCookieExpiration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "location" => Some(("location", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "auth-domain" => Some(("authDomain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["auth-domain", "code-bucket", "default-bucket", "default-cookie-expiration", "default-hostname", "id", "location", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Application = json::value::from_value(object).unwrap(); + let mut call = self.hub.apps().patch(request, opt.value_of("apps-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "mask" => { + call = call.mask(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["mask"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _apps_services_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.apps().services_delete(opt.value_of("apps-id").unwrap_or(""), opt.value_of("services-id").unwrap_or("")); @@ -702,6 +798,8 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { + "endpoints-api-service.config-id" => Some(("endpointsApiService.configId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "endpoints-api-service.name" => Some(("endpointsApiService.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "basic-scaling.idle-timeout" => Some(("basicScaling.idleTimeout", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "basic-scaling.max-instances" => Some(("basicScaling.maxInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "beta-settings" => Some(("betaSettings", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), @@ -755,13 +853,14 @@ impl<'n> Engine<'n> { "network.instance-tag" => Some(("network.instanceTag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "network.forwarded-ports" => Some(("network.forwardedPorts", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "network.name" => Some(("network.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "network.subnetwork-name" => Some(("network.subnetworkName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "nobuild-files-regex" => Some(("nobuildFilesRegex", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "creation-time" => Some(("creationTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "serving-status" => Some(("servingStatus", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "runtime" => Some(("runtime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["aggregation-window-length", "api-config", "auth-fail-action", "automatic-scaling", "basic-scaling", "beta-settings", "check-interval", "container", "cool-down-period", "cpu", "cpu-utilization", "creation-time", "default-expiration", "deployer", "deployment", "disable-health-check", "disk-gb", "disk-usage-bytes", "disk-utilization", "env", "env-variables", "forwarded-ports", "health-check", "healthy-threshold", "host", "id", "idle-timeout", "image", "inbound-services", "instance-class", "instance-tag", "instances", "login", "manual-scaling", "max-concurrent-requests", "max-idle-instances", "max-instances", "max-pending-latency", "max-total-instances", "memory-gb", "min-idle-instances", "min-pending-latency", "min-total-instances", "name", "network", "network-utilization", "nobuild-files-regex", "request-utilization", "resources", "restart-threshold", "runtime", "script", "security-level", "serving-status", "target-concurrent-requests", "target-read-bytes-per-sec", "target-read-ops-per-sec", "target-received-bytes-per-sec", "target-received-packets-per-sec", "target-request-count-per-sec", "target-sent-bytes-per-sec", "target-sent-packets-per-sec", "target-utilization", "target-write-bytes-per-sec", "target-write-ops-per-sec", "threadsafe", "timeout", "unhealthy-threshold", "url", "vm"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["aggregation-window-length", "api-config", "auth-fail-action", "automatic-scaling", "basic-scaling", "beta-settings", "check-interval", "config-id", "container", "cool-down-period", "cpu", "cpu-utilization", "creation-time", "default-expiration", "deployer", "deployment", "disable-health-check", "disk-gb", "disk-usage-bytes", "disk-utilization", "endpoints-api-service", "env", "env-variables", "forwarded-ports", "health-check", "healthy-threshold", "host", "id", "idle-timeout", "image", "inbound-services", "instance-class", "instance-tag", "instances", "login", "manual-scaling", "max-concurrent-requests", "max-idle-instances", "max-instances", "max-pending-latency", "max-total-instances", "memory-gb", "min-idle-instances", "min-pending-latency", "min-total-instances", "name", "network", "network-utilization", "nobuild-files-regex", "request-utilization", "resources", "restart-threshold", "runtime", "script", "security-level", "serving-status", "subnetwork-name", "target-concurrent-requests", "target-read-bytes-per-sec", "target-read-ops-per-sec", "target-received-bytes-per-sec", "target-received-packets-per-sec", "target-request-count-per-sec", "target-sent-bytes-per-sec", "target-sent-packets-per-sec", "target-utilization", "target-write-bytes-per-sec", "target-write-ops-per-sec", "threadsafe", "timeout", "unhealthy-threshold", "url", "vm"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -952,8 +1051,9 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { + "ssh-key" => Some(("sshKey", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec![]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["ssh-key"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1261,6 +1361,8 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { + "endpoints-api-service.config-id" => Some(("endpointsApiService.configId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "endpoints-api-service.name" => Some(("endpointsApiService.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "basic-scaling.idle-timeout" => Some(("basicScaling.idleTimeout", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "basic-scaling.max-instances" => Some(("basicScaling.maxInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "beta-settings" => Some(("betaSettings", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), @@ -1314,13 +1416,14 @@ impl<'n> Engine<'n> { "network.instance-tag" => Some(("network.instanceTag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "network.forwarded-ports" => Some(("network.forwardedPorts", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "network.name" => Some(("network.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "network.subnetwork-name" => Some(("network.subnetworkName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "nobuild-files-regex" => Some(("nobuildFilesRegex", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "creation-time" => Some(("creationTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "serving-status" => Some(("servingStatus", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "runtime" => Some(("runtime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["aggregation-window-length", "api-config", "auth-fail-action", "automatic-scaling", "basic-scaling", "beta-settings", "check-interval", "container", "cool-down-period", "cpu", "cpu-utilization", "creation-time", "default-expiration", "deployer", "deployment", "disable-health-check", "disk-gb", "disk-usage-bytes", "disk-utilization", "env", "env-variables", "forwarded-ports", "health-check", "healthy-threshold", "host", "id", "idle-timeout", "image", "inbound-services", "instance-class", "instance-tag", "instances", "login", "manual-scaling", "max-concurrent-requests", "max-idle-instances", "max-instances", "max-pending-latency", "max-total-instances", "memory-gb", "min-idle-instances", "min-pending-latency", "min-total-instances", "name", "network", "network-utilization", "nobuild-files-regex", "request-utilization", "resources", "restart-threshold", "runtime", "script", "security-level", "serving-status", "target-concurrent-requests", "target-read-bytes-per-sec", "target-read-ops-per-sec", "target-received-bytes-per-sec", "target-received-packets-per-sec", "target-request-count-per-sec", "target-sent-bytes-per-sec", "target-sent-packets-per-sec", "target-utilization", "target-write-bytes-per-sec", "target-write-ops-per-sec", "threadsafe", "timeout", "unhealthy-threshold", "url", "vm"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["aggregation-window-length", "api-config", "auth-fail-action", "automatic-scaling", "basic-scaling", "beta-settings", "check-interval", "config-id", "container", "cool-down-period", "cpu", "cpu-utilization", "creation-time", "default-expiration", "deployer", "deployment", "disable-health-check", "disk-gb", "disk-usage-bytes", "disk-utilization", "endpoints-api-service", "env", "env-variables", "forwarded-ports", "health-check", "healthy-threshold", "host", "id", "idle-timeout", "image", "inbound-services", "instance-class", "instance-tag", "instances", "login", "manual-scaling", "max-concurrent-requests", "max-idle-instances", "max-instances", "max-pending-latency", "max-total-instances", "memory-gb", "min-idle-instances", "min-pending-latency", "min-total-instances", "name", "network", "network-utilization", "nobuild-files-regex", "request-utilization", "resources", "restart-threshold", "runtime", "script", "security-level", "serving-status", "subnetwork-name", "target-concurrent-requests", "target-read-bytes-per-sec", "target-read-ops-per-sec", "target-received-bytes-per-sec", "target-received-packets-per-sec", "target-request-count-per-sec", "target-sent-bytes-per-sec", "target-sent-packets-per-sec", "target-utilization", "target-write-bytes-per-sec", "target-write-ops-per-sec", "threadsafe", "timeout", "unhealthy-threshold", "url", "vm"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1409,6 +1512,9 @@ impl<'n> Engine<'n> { ("operations-list", Some(opt)) => { call_result = self._apps_operations_list(opt, dry_run, &mut err); }, + ("patch", Some(opt)) => { + call_result = self._apps_patch(opt, dry_run, &mut err); + }, ("services-delete", Some(opt)) => { call_result = self._apps_services_delete(opt, dry_run, &mut err); }, @@ -1540,9 +1646,9 @@ impl<'n> Engine<'n> { fn main() { let mut exit_status = 0i32; let arg_data = [ - ("apps", "methods: 'create', 'get', 'locations-get', 'locations-list', 'operations-get', 'operations-list', 'services-delete', 'services-get', 'services-list', 'services-patch', 'services-versions-create', 'services-versions-delete', 'services-versions-get', 'services-versions-instances-debug', 'services-versions-instances-delete', 'services-versions-instances-get', 'services-versions-instances-list', 'services-versions-list' and 'services-versions-patch'", vec![ + ("apps", "methods: 'create', 'get', 'locations-get', 'locations-list', 'operations-get', 'operations-list', 'patch', 'services-delete', 'services-get', 'services-list', 'services-patch', 'services-versions-create', 'services-versions-delete', 'services-versions-get', 'services-versions-instances-debug', 'services-versions-instances-delete', 'services-versions-instances-get', 'services-versions-instances-list', 'services-versions-list' and 'services-versions-patch'", vec![ ("create", - Some(r##"Creates an App Engine application for a Google Cloud Platform project. This requires a project that excludes an App Engine application. For details about creating a project without an application, see the [Google Cloud Resource Manager create project topic](https://cloud.google.com/resource-manager/docs/creating-project)."##), + Some(r##"Creates an App Engine application for a Google Cloud Platform project. This requires a project that excludes an App Engine application. For details about creating a project without an application, see the Google Cloud Resource Manager create project topic (https://cloud.google.com/resource-manager/docs/creating-project)."##), "Details at http://byron.github.io/google-apis-rs/google_appengine1_beta5_cli/apps_create", vec![ (Some(r##"kv"##), @@ -1569,7 +1675,7 @@ fn main() { vec![ (Some(r##"apps-id"##), None, - Some(r##"Part of `name`. Name of the application to get. Example: `apps/myapp`."##), + Some(r##"Part of `name`. Name of the application to get. Example: apps/myapp."##), Some(true), Some(false)), @@ -1664,7 +1770,7 @@ fn main() { Some(false)), ]), ("operations-list", - Some(r##"Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`. NOTE: the `name` binding below allows API services to override the binding to use different resource name schemes, such as `users/*/operations`."##), + Some(r##"Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED.NOTE: the name binding below allows API services to override the binding to use different resource name schemes, such as users/*/operations."##), "Details at http://byron.github.io/google-apis-rs/google_appengine1_beta5_cli/apps_operations-list", vec![ (Some(r##"apps-id"##), @@ -1679,6 +1785,34 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates the specified Application resource. You can update the following fields: auth_domain (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps#Application.FIELDS.auth_domain) default_cookie_expiration (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps#Application.FIELDS.default_cookie_expiration)"##), + "Details at http://byron.github.io/google-apis-rs/google_appengine1_beta5_cli/apps_patch", + vec![ + (Some(r##"apps-id"##), + None, + Some(r##"Part of `name`. Name of the Application resource to update. Example: apps/myapp."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -1691,7 +1825,7 @@ fn main() { vec![ (Some(r##"apps-id"##), None, - Some(r##"Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default`."##), + Some(r##"Part of `name`. Name of the resource requested. Example: apps/myapp/services/default."##), Some(true), Some(false)), @@ -1719,7 +1853,7 @@ fn main() { vec![ (Some(r##"apps-id"##), None, - Some(r##"Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default`."##), + Some(r##"Part of `name`. Name of the resource requested. Example: apps/myapp/services/default."##), Some(true), Some(false)), @@ -1747,7 +1881,7 @@ fn main() { vec![ (Some(r##"apps-id"##), None, - Some(r##"Part of `name`. Name of the resource requested. Example: `apps/myapp`."##), + Some(r##"Part of `name`. Name of the resource requested. Example: apps/myapp."##), Some(true), Some(false)), @@ -1769,7 +1903,7 @@ fn main() { vec![ (Some(r##"apps-id"##), None, - Some(r##"Part of `name`. Name of the resource to update. Example: `apps/myapp/services/default`."##), + Some(r##"Part of `name`. Name of the resource to update. Example: apps/myapp/services/default."##), Some(true), Some(false)), @@ -1837,7 +1971,7 @@ fn main() { vec![ (Some(r##"apps-id"##), None, - Some(r##"Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default/versions/v1`."##), + Some(r##"Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1."##), Some(true), Some(false)), @@ -1866,12 +2000,12 @@ fn main() { Some(false)), ]), ("services-versions-get", - Some(r##"Gets the specified Version resource. By default, only a `BASIC_VIEW` will be returned. Specify the `FULL_VIEW` parameter to get the full resource."##), + Some(r##"Gets the specified Version resource. By default, only a BASIC_VIEW will be returned. Specify the FULL_VIEW parameter to get the full resource."##), "Details at http://byron.github.io/google-apis-rs/google_appengine1_beta5_cli/apps_services-versions-get", vec![ (Some(r##"apps-id"##), None, - Some(r##"Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default/versions/v1`."##), + Some(r##"Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1."##), Some(true), Some(false)), @@ -1900,12 +2034,12 @@ fn main() { Some(false)), ]), ("services-versions-instances-debug", - Some(r##"Enables debugging on a VM instance. This allows you to use the SSH command to connect to the virtual machine where the instance lives. While in "debug mode", the instance continues to serve live traffic. You should delete the instance when you are done debugging and then allow the system to take over and determine if another instance should be started. Only applicable for instances in App Engine flexible environment."##), + Some(r##"Enables debugging on a VM instance. This allows you to use the SSH command to connect to the virtual machine where the instance lives. While in "debug mode", the instance continues to serve live traffic. You should delete the instance when you are done debugging and then allow the system to take over and determine if another instance should be started.Only applicable for instances in App Engine flexible environment."##), "Details at http://byron.github.io/google-apis-rs/google_appengine1_beta5_cli/apps_services-versions-instances-debug", vec![ (Some(r##"apps-id"##), None, - Some(r##"Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default/versions/v1/instances/instance-1`."##), + Some(r##"Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1/instances/instance-1."##), Some(true), Some(false)), @@ -1991,7 +2125,7 @@ fn main() { vec![ (Some(r##"apps-id"##), None, - Some(r##"Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default/versions/v1/instances/instance-1`."##), + Some(r##"Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1/instances/instance-1."##), Some(true), Some(false)), @@ -2031,7 +2165,7 @@ fn main() { vec![ (Some(r##"apps-id"##), None, - Some(r##"Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default/versions/v1`."##), + Some(r##"Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1."##), Some(true), Some(false)), @@ -2065,7 +2199,7 @@ fn main() { vec![ (Some(r##"apps-id"##), None, - Some(r##"Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default`."##), + Some(r##"Part of `name`. Name of the resource requested. Example: apps/myapp/services/default."##), Some(true), Some(false)), @@ -2088,12 +2222,12 @@ fn main() { Some(false)), ]), ("services-versions-patch", - Some(r##"Updates the specified Version resource. You can specify the following fields depending on the App Engine environment and type of scaling that the version resource uses: * [`serving_status`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps.services.versions#Version.FIELDS.serving_status): For Version resources that use basic scaling, manual scaling, or run in the App Engine flexible environment. * [`instance_class`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps.services.versions#Version.FIELDS.instance_class): For Version resources that run in the App Engine standard environment. * [`automatic_scaling.min_idle_instances`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps.services.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment. * [`automatic_scaling.max_idle_instances`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps.services.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment."##), + Some(r##"Updates the specified Version resource. You can specify the following fields depending on the App Engine environment and type of scaling that the version resource uses: serving_status (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps.services.versions#Version.FIELDS.serving_status): For Version resources that use basic scaling, manual scaling, or run in the App Engine flexible environment. instance_class (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps.services.versions#Version.FIELDS.instance_class): For Version resources that run in the App Engine standard environment. automatic_scaling.min_idle_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps.services.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment. automatic_scaling.max_idle_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps.services.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment."##), "Details at http://byron.github.io/google-apis-rs/google_appengine1_beta5_cli/apps_services-versions-patch", vec![ (Some(r##"apps-id"##), None, - Some(r##"Part of `name`. Name of the resource to update. Example: `apps/myapp/services/default/versions/1`."##), + Some(r##"Part of `name`. Name of the resource to update. Example: apps/myapp/services/default/versions/1."##), Some(true), Some(false)), @@ -2133,7 +2267,7 @@ fn main() { let mut app = App::new("appengine1-beta5") .author("Sebastian Thiel ") - .version("1.0.0+20160802") + .version("1.0.0+20161208") .about("Provisions and manages App Engine applications.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_appengine1_beta5_cli") .arg(Arg::with_name("url") diff --git a/gen/appengine1_beta5/Cargo.toml b/gen/appengine1_beta5/Cargo.toml index aad68bbe68..2349c53ce0 100644 --- a/gen/appengine1_beta5/Cargo.toml +++ b/gen/appengine1_beta5/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-appengine1_beta5" -version = "1.0.0+20160802" +version = "1.0.0+20161208" authors = ["Sebastian Thiel "] description = "A complete library to interact with appengine (protocol v1beta5)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/appengine1_beta5" diff --git a/gen/appengine1_beta5/README.md b/gen/appengine1_beta5/README.md index 92f270da3a..8e9e793c66 100644 --- a/gen/appengine1_beta5/README.md +++ b/gen/appengine1_beta5/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-appengine1_beta5` library allows access to all features of the *Google appengine* service. -This documentation was generated from *appengine* crate version *1.0.0+20160802*, where *20160802* is the exact revision of the *appengine:v1beta5* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *appengine* crate version *1.0.0+20161208*, where *20161208* is the exact revision of the *appengine:v1beta5* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *appengine* *v1_beta5* API can be found at the [official documentation site](https://cloud.google.com/appengine/docs/admin-api/). @@ -14,7 +14,7 @@ Everything else about the *appengine* *v1_beta5* API can be found at the Handle the following *Resources* with ease from the central [hub](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.Appengine.html) ... * apps - * [*create*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppCreateCall.html), [*get*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppGetCall.html), [*locations get*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppLocationGetCall.html), [*locations list*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppLocationListCall.html), [*operations get*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppOperationGetCall.html), [*operations list*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppOperationListCall.html), [*services delete*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppServiceDeleteCall.html), [*services get*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppServiceGetCall.html), [*services list*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppServiceListCall.html), [*services patch*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppServicePatchCall.html), [*services versions create*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppServiceVersionCreateCall.html), [*services versions delete*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppServiceVersionDeleteCall.html), [*services versions get*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppServiceVersionGetCall.html), [*services versions instances debug*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppServiceVersionInstanceDebugCall.html), [*services versions instances delete*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppServiceVersionInstanceDeleteCall.html), [*services versions instances get*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppServiceVersionInstanceGetCall.html), [*services versions instances list*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppServiceVersionInstanceListCall.html), [*services versions list*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppServiceVersionListCall.html) and [*services versions patch*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppServiceVersionPatchCall.html) + * [*create*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppCreateCall.html), [*get*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppGetCall.html), [*locations get*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppLocationGetCall.html), [*locations list*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppLocationListCall.html), [*operations get*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppOperationGetCall.html), [*operations list*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppOperationListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppPatchCall.html), [*services delete*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppServiceDeleteCall.html), [*services get*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppServiceGetCall.html), [*services list*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppServiceListCall.html), [*services patch*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppServicePatchCall.html), [*services versions create*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppServiceVersionCreateCall.html), [*services versions delete*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppServiceVersionDeleteCall.html), [*services versions get*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppServiceVersionGetCall.html), [*services versions instances debug*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppServiceVersionInstanceDebugCall.html), [*services versions instances delete*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppServiceVersionInstanceDeleteCall.html), [*services versions instances get*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppServiceVersionInstanceGetCall.html), [*services versions instances list*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppServiceVersionInstanceListCall.html), [*services versions list*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppServiceVersionListCall.html) and [*services versions patch*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppServiceVersionPatchCall.html) @@ -48,6 +48,7 @@ Or specifically ... ```ignore let r = hub.apps().services_versions_create(...).doit() +let r = hub.apps().patch(...).doit() let r = hub.apps().services_versions_instances_debug(...).doit() let r = hub.apps().create(...).doit() let r = hub.apps().services_versions_instances_delete(...).doit() diff --git a/gen/appengine1_beta5/src/lib.rs b/gen/appengine1_beta5/src/lib.rs index 06e491a9b1..9e095c233b 100644 --- a/gen/appengine1_beta5/src/lib.rs +++ b/gen/appengine1_beta5/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *appengine* crate version *1.0.0+20160802*, where *20160802* is the exact revision of the *appengine:v1beta5* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *appengine* crate version *1.0.0+20161208*, where *20161208* is the exact revision of the *appengine:v1beta5* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *appengine* *v1_beta5* API can be found at the //! [official documentation site](https://cloud.google.com/appengine/docs/admin-api/). @@ -12,7 +12,7 @@ //! Handle the following *Resources* with ease from the central [hub](struct.Appengine.html) ... //! //! * apps -//! * [*create*](struct.AppCreateCall.html), [*get*](struct.AppGetCall.html), [*locations get*](struct.AppLocationGetCall.html), [*locations list*](struct.AppLocationListCall.html), [*operations get*](struct.AppOperationGetCall.html), [*operations list*](struct.AppOperationListCall.html), [*services delete*](struct.AppServiceDeleteCall.html), [*services get*](struct.AppServiceGetCall.html), [*services list*](struct.AppServiceListCall.html), [*services patch*](struct.AppServicePatchCall.html), [*services versions create*](struct.AppServiceVersionCreateCall.html), [*services versions delete*](struct.AppServiceVersionDeleteCall.html), [*services versions get*](struct.AppServiceVersionGetCall.html), [*services versions instances debug*](struct.AppServiceVersionInstanceDebugCall.html), [*services versions instances delete*](struct.AppServiceVersionInstanceDeleteCall.html), [*services versions instances get*](struct.AppServiceVersionInstanceGetCall.html), [*services versions instances list*](struct.AppServiceVersionInstanceListCall.html), [*services versions list*](struct.AppServiceVersionListCall.html) and [*services versions patch*](struct.AppServiceVersionPatchCall.html) +//! * [*create*](struct.AppCreateCall.html), [*get*](struct.AppGetCall.html), [*locations get*](struct.AppLocationGetCall.html), [*locations list*](struct.AppLocationListCall.html), [*operations get*](struct.AppOperationGetCall.html), [*operations list*](struct.AppOperationListCall.html), [*patch*](struct.AppPatchCall.html), [*services delete*](struct.AppServiceDeleteCall.html), [*services get*](struct.AppServiceGetCall.html), [*services list*](struct.AppServiceListCall.html), [*services patch*](struct.AppServicePatchCall.html), [*services versions create*](struct.AppServiceVersionCreateCall.html), [*services versions delete*](struct.AppServiceVersionDeleteCall.html), [*services versions get*](struct.AppServiceVersionGetCall.html), [*services versions instances debug*](struct.AppServiceVersionInstanceDebugCall.html), [*services versions instances delete*](struct.AppServiceVersionInstanceDeleteCall.html), [*services versions instances get*](struct.AppServiceVersionInstanceGetCall.html), [*services versions instances list*](struct.AppServiceVersionInstanceListCall.html), [*services versions list*](struct.AppServiceVersionListCall.html) and [*services versions patch*](struct.AppServiceVersionPatchCall.html) //! //! //! @@ -48,6 +48,7 @@ //! //! ```ignore //! let r = hub.apps().services_versions_create(...).doit() +//! let r = hub.apps().patch(...).doit() //! let r = hub.apps().services_versions_instances_debug(...).doit() //! let r = hub.apps().create(...).doit() //! let r = hub.apps().services_versions_instances_delete(...).doit() diff --git a/gen/appengine1_beta5/src/lib.rs.in b/gen/appengine1_beta5/src/lib.rs.in index a32a7d3012..ad20bc5edb 100644 --- a/gen/appengine1_beta5/src/lib.rs.in +++ b/gen/appengine1_beta5/src/lib.rs.in @@ -40,14 +40,22 @@ pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, /// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). #[derive(PartialEq, Eq, Hash)] pub enum Scope { + /// View and manage your applications deployed on Google App Engine + Admin, + /// View and manage your data across Google Cloud Platform services CloudPlatform, + + /// View your data across Google Cloud Platform services + CloudPlatformReadOnly, } impl AsRef for Scope { fn as_ref(&self) -> &str { match *self { + Scope::Admin => "https://www.googleapis.com/auth/appengine.admin", Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform", + Scope::CloudPlatformReadOnly => "https://www.googleapis.com/auth/cloud-platform.read-only", } } } @@ -160,7 +168,7 @@ impl<'a, C, A> Appengine // ############ // SCHEMAS ### // ########## -/// Response message for `Instances.ListInstances`. +/// Response message for Instances.ListInstances. /// /// # Activities /// @@ -193,8 +201,11 @@ pub struct Network { /// List of ports, or port pairs, to forward from the virtual machine to the application container. #[serde(rename="forwardedPorts")] pub forwarded_ports: Option>, - /// Google Cloud Platform network where the virtual machines are created. Specify the short name, not the resource path. Defaults to `default`. + /// Google Cloud Platform network where the virtual machines are created. Specify the short name, not the resource path.Defaults to default. pub name: Option, + /// Google Cloud Platform sub-network where the virtual machines are created. Specify the short name, not the resource path.If a subnetwork name is specified, a network name will also be required unless it is for the default network. If the network the VM instance is being created in is a Legacy network, then the IP address is allocated from the IPv4Range. If the network the VM instance is being created in is an auto Subnet Mode Network, then only network name should be specified (not the subnetwork_name) and the IP address is created from the IPCidrRange of the subnetwork that exists in that zone for that network. If the network the VM instance is being created in is a custom Subnet Mode Network, then the subnetwork_name must be specified and the IP address is created from the IPCidrRange of the subnetwork.If specified, the subnetwork must exist in the same region as the Flex app. + #[serde(rename="subnetworkName")] + pub subnetwork_name: Option, } impl Part for Network {} @@ -214,9 +225,9 @@ impl Part for Network {} pub struct Service { /// Mapping that defines fractional HTTP traffic diversion to different versions within the service. pub split: Option, - /// Relative name of the service within the application. Example: `default`. @OutputOnly + /// Relative name of the service within the application. Example: default.@OutputOnly pub id: Option, - /// Full path to the Service resource in the API. Example: `apps/myapp/services/default`. @OutputOnly + /// Full path to the Service resource in the API. Example: apps/myapp/services/default.@OutputOnly pub name: Option, } @@ -232,33 +243,34 @@ impl ResponseResult for Service {} /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [create apps](struct.AppCreateCall.html) (request) +/// * [patch apps](struct.AppPatchCall.html) (request) /// * [get apps](struct.AppGetCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Application { - /// Hostname used to reach the application, as resolved by App Engine. @OutputOnly + /// Hostname used to reach the application, as resolved by App Engine.@OutputOnly #[serde(rename="defaultHostname")] pub default_hostname: Option, - /// Full path to the Application resource in the API. Example: `apps/myapp`. @OutputOnly + /// Full path to the Application resource in the API. Example: apps/myapp.@OutputOnly pub name: Option, - /// A Google Cloud Storage bucket that can be used for storing files associated with this application. This bucket is associated with the application and can be used by the gcloud deployment commands. @OutputOnly + /// A Google Cloud Storage bucket that can be used for storing files associated with this application. This bucket is associated with the application and can be used by the gcloud deployment commands.@OutputOnly #[serde(rename="codeBucket")] pub code_bucket: Option, - /// A Google Cloud Storage bucket that can be used by the application to store content. @OutputOnly + /// A Google Cloud Storage bucket that can be used by the application to store content.@OutputOnly #[serde(rename="defaultBucket")] pub default_bucket: Option, - /// HTTP path dispatch rules for requests to the application that do not explicitly target a service or version. Rules are order-dependent. @OutputOnly + /// HTTP path dispatch rules for requests to the application that do not explicitly target a service or version. Rules are order-dependent.@OutputOnly #[serde(rename="dispatchRules")] pub dispatch_rules: Option>, - /// Cookie expiration policy for this application. @OutputOnly + /// Cookie expiration policy for this application. #[serde(rename="defaultCookieExpiration")] pub default_cookie_expiration: Option, - /// Location from which this application will be run. Application instances will run out of data centers in the chosen location, which is also where all of the application's end user content is stored. Defaults to `us-central`. Options are: `us-central` - Central US `europe-west` - Western Europe `us-east1` - Eastern US + /// Location from which this application will be run. Application instances will run out of data centers in the chosen location, which is also where all of the application's end user content is stored.Defaults to us-central.Options are:us-central - Central USeurope-west - Western Europeus-east1 - Eastern US pub location: Option, - /// Google Apps authentication domain that controls which users can access this application. Defaults to open access for any Google Account. + /// Google Apps authentication domain that controls which users can access this application.Defaults to open access for any Google Account. #[serde(rename="authDomain")] pub auth_domain: Option, - /// Identifier of the Application resource. This identifier is equivalent to the project ID of the Google Cloud Platform project where you want to deploy your application. Example: `myapp`. + /// Identifier of the Application resource. This identifier is equivalent to the project ID of the Google Cloud Platform project where you want to deploy your application. Example: myapp. pub id: Option, } @@ -279,6 +291,9 @@ impl ResponseResult for Application {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Version { + /// Cloud Endpoints configuration.If endpoints_api_service is set, the Cloud Endpoints Extensible Service Proxy will be provided to serve the API implemented by the app. + #[serde(rename="endpointsApiService")] + pub endpoints_api_service: Option, /// A service with basic scaling will create an instance when the application receives a request. The instance will be turned down when the app becomes idle. Basic scaling is ideal for work that is intermittent or driven by user activity. #[serde(rename="basicScaling")] pub basic_scaling: Option, @@ -288,7 +303,7 @@ pub struct Version { /// A service with manual scaling runs continuously, allowing you to perform complex initialization and rely on the state of its memory over time. #[serde(rename="manualScaling")] pub manual_scaling: Option, - /// Time that this version was created. @OutputOnly + /// Time that this version was created.@OutputOnly #[serde(rename="creationTime")] pub creation_time: Option, /// Whether to deploy this version in a container on a virtual machine. @@ -296,54 +311,54 @@ pub struct Version { /// Before an application can receive email or XMPP messages, the application must be configured to enable the service. #[serde(rename="inboundServices")] pub inbound_services: Option>, - /// Instance class that is used to run this version. Valid values are: * AutomaticScaling: `F1`, `F2`, `F4`, `F4_1G` * ManualScaling or BasicScaling: `B1`, `B2`, `B4`, `B8`, `B4_1G` Defaults to `F1` for AutomaticScaling and `B1` for ManualScaling or BasicScaling. + /// Instance class that is used to run this version. Valid values are: AutomaticScaling: F1, F2, F4, F4_1G ManualScaling or BasicScaling: B1, B2, B4, B8, B4_1GDefaults to F1 for AutomaticScaling and B1 for ManualScaling or BasicScaling. #[serde(rename="instanceClass")] pub instance_class: Option, - /// Code and application artifacts that make up this version. Only returned in `GET` requests if `view=FULL` is set. + /// Code and application artifacts that make up this version.Only returned in GET requests if view=FULL is set. pub deployment: Option, - /// Custom static error pages. Limited to 10KB per page. Only returned in `GET` requests if `view=FULL` is set. + /// Custom static error pages. Limited to 10KB per page.Only returned in GET requests if view=FULL is set. #[serde(rename="errorHandlers")] pub error_handlers: Option>, - /// Current serving status of this version. Only the versions with a `SERVING` status create instances and can be billed. `SERVING_STATUS_UNSPECIFIED` is an invalid value. Defaults to `SERVING`. + /// Current serving status of this version. Only the versions with a SERVING status create instances and can be billed.SERVING_STATUS_UNSPECIFIED is an invalid value. Defaults to SERVING. #[serde(rename="servingStatus")] pub serving_status: Option, - /// Relative name of the version within the module. Example: `v1`. Version names can contain only lowercase letters, numbers, or hyphens. Reserved names: "default", "latest", and any name with the prefix "ah-". + /// Relative name of the version within the module. Example: v1. Version names can contain only lowercase letters, numbers, or hyphens. Reserved names: "default", "latest", and any name with the prefix "ah-". pub id: Option, /// Whether multiple requests can be dispatched to this version at once. pub threadsafe: Option, - /// Serving configuration for [Google Cloud Endpoints](https://cloud.google.com/appengine/docs/python/endpoints/). Only returned in `GET` requests if `view=FULL` is set. + /// Serving configuration for Google Cloud Endpoints (https://cloud.google.com/appengine/docs/python/endpoints/).Only returned in GET requests if view=FULL is set. #[serde(rename="apiConfig")] pub api_config: Option, - /// Files that match this pattern will not be built into this version. Only applicable for Go runtimes. Only returned in `GET` requests if `view=FULL` is set. + /// Files that match this pattern will not be built into this version. Only applicable for Go runtimes.Only returned in GET requests if view=FULL is set. #[serde(rename="nobuildFilesRegex")] pub nobuild_files_regex: Option, /// Extra network settings. Only applicable for VM runtimes. pub network: Option, - /// An ordered list of URL-matching patterns that should be applied to incoming requests. The first matching URL handles the request and other request handlers are not attempted. Only returned in `GET` requests if `view=FULL` is set. + /// An ordered list of URL-matching patterns that should be applied to incoming requests. The first matching URL handles the request and other request handlers are not attempted.Only returned in GET requests if view=FULL is set. pub handlers: Option>, - /// Configures health checking for VM instances. Unhealthy instances are be stopped and replaced with new instances. Only applicable for VM runtimes. Only returned in `GET` requests if `view=FULL` is set. + /// Configures health checking for VM instances. Unhealthy instances are be stopped and replaced with new instances. Only applicable for VM runtimes.Only returned in GET requests if view=FULL is set. #[serde(rename="healthCheck")] pub health_check: Option, - /// Duration that static files should be cached by web proxies and browsers. Only applicable if the corresponding [StaticFilesHandler](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#staticfileshandler) does not specify its own expiration time. Only returned in `GET` requests if `view=FULL` is set. + /// Duration that static files should be cached by web proxies and browsers. Only applicable if the corresponding StaticFilesHandler (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#staticfileshandler) does not specify its own expiration time.Only returned in GET requests if view=FULL is set. #[serde(rename="defaultExpiration")] pub default_expiration: Option, - /// Full path to the Version resource in the API. Example: `apps/myapp/services/default/versions/v1`. @OutputOnly + /// Full path to the Version resource in the API. Example: apps/myapp/services/default/versions/v1.@OutputOnly pub name: Option, - /// Configuration for third-party Python runtime libraries required by the application. Only returned in `GET` requests if `view=FULL` is set. + /// Configuration for third-party Python runtime libraries required by the application.Only returned in GET requests if view=FULL is set. pub libraries: Option>, - /// Email address of the user who created this version. @OutputOnly + /// Email address of the user who created this version.@OutputOnly pub deployer: Option, - /// App Engine execution environment to use for this version. Defaults to `1`. + /// App Engine execution environment to use for this version.Defaults to 1. pub env: Option, - /// Total size of version files hosted on App Engine disk in bytes. @OutputOnly + /// Total size of version files hosted on App Engine disk in bytes.@OutputOnly #[serde(rename="diskUsageBytes")] pub disk_usage_bytes: Option, /// Automatic scaling is based on request rate, response latencies, and other application metrics. #[serde(rename="automaticScaling")] pub automatic_scaling: Option, - /// Desired runtime. Example: `python27`. + /// Desired runtime. Example: python27. pub runtime: Option, - /// Environment variables made available to the application. Only returned in `GET` requests if `view=FULL` is set. + /// Environment variables made available to the application.Only returned in GET requests if view=FULL is set. #[serde(rename="envVariables")] pub env_variables: Option>, /// Machine resources for this version. Only applicable for VM runtimes. @@ -388,10 +403,10 @@ impl ResponseResult for ListLocationsResponse {} pub struct Location { /// Cross-service attributes for the location. For example {"cloud.googleapis.com/region": "us-east1"} pub labels: Option>, - /// The cononical id for this location. For example: `"us-east1"`. + /// The canonical id for this location. For example: "us-east1". #[serde(rename="locationId")] pub location_id: Option, - /// Resource name for the location, which may vary between implementations. For example: `"projects/example-project/locations/us-east1"` + /// Resource name for the location, which may vary between implementations. For example: "projects/example-project/locations/us-east1" pub name: Option, /// Service-specific metadata. For example the available capacity at the given location. pub metadata: Option>, @@ -400,7 +415,7 @@ pub struct Location { impl ResponseResult for Location {} -/// Request message for `Instances.DebugInstance`. +/// Request message for Instances.DebugInstance. /// /// # Activities /// @@ -410,7 +425,11 @@ impl ResponseResult for Location {} /// * [services versions instances debug apps](struct.AppServiceVersionInstanceDebugCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DebugInstanceRequest { _never_set: Option } +pub struct DebugInstanceRequest { + /// Public SSH key to add to the instance. Examples: [USERNAME]:ssh-rsa [KEY_VALUE] [USERNAME] [USERNAME]:ssh-rsa [KEY_VALUE] google-ssh {"userName":"[USERNAME]","expireOn":"[EXPIRE_TIME]"}For more information, see Adding and Removing SSH Keys (https://cloud.google.com/compute/docs/instances/adding-removing-ssh-keys). + #[serde(rename="sshKey")] + pub ssh_key: Option, +} impl RequestValue for DebugInstanceRequest {} @@ -438,20 +457,22 @@ impl Part for CpuUtilization {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Resources { + /// Memory (GB) needed. + #[serde(rename="memoryGb")] + pub memory_gb: Option, /// Disk size (GB) needed. #[serde(rename="diskGb")] pub disk_gb: Option, /// Number of CPU cores needed. pub cpu: Option, - /// Memory (GB) needed. - #[serde(rename="memoryGb")] - pub memory_gb: Option, + /// Volumes mounted within the app container. + pub volumes: Option>, } impl Part for Resources {} -/// The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). The error model is designed to be: - Simple to use and understand for most users - Flexible enough to meet unexpected needs # Overview The `Status` message contains three pieces of data: error code, error message, and error details. The error code should be an enum value of google.rpc.Code, but it may accept additional error codes if needed. The error message should be a developer-facing English message that helps developers *understand* and *resolve* the error. If a localized user-facing error message is needed, put the localized message in the error details or localize it in the client. The optional error details may contain arbitrary information about the error. There is a predefined set of error detail types in the package `google.rpc` which can be used for common error conditions. # Language mapping The `Status` message is the logical representation of the error model, but it is not necessarily the actual wire format. When the `Status` message is exposed in different client libraries and different wire protocols, it can be mapped differently. For example, it will likely be mapped to some exceptions in Java, but more likely mapped to some error codes in C. # Other uses The error model and the `Status` message can be used in a variety of environments, either with or without APIs, to provide a consistent developer experience across different environments. Example uses of this error model include: - Partial errors. If a service needs to return partial errors to the client, it may embed the `Status` in the normal response to indicate the partial errors. - Workflow errors. A typical workflow has multiple steps. Each step may have a `Status` message for error reporting purpose. - Batch operations. If a client uses batch request and batch response, the `Status` message should be used directly inside batch response, one for each error sub-response. - Asynchronous operations. If an API call embeds asynchronous operation results in its response, the status of those operations should be represented directly using the `Status` message. - Logging. If some API errors are stored in logs, the message `Status` could be used directly after any stripping needed for security/privacy reasons. +/// The Status type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by gRPC (https://github.com/grpc). The error model is designed to be: Simple to use and understand for most users Flexible enough to meet unexpected needsOverviewThe Status message contains three pieces of data: error code, error message, and error details. The error code should be an enum value of google.rpc.Code, but it may accept additional error codes if needed. The error message should be a developer-facing English message that helps developers understand and resolve the error. If a localized user-facing error message is needed, put the localized message in the error details or localize it in the client. The optional error details may contain arbitrary information about the error. There is a predefined set of error detail types in the package google.rpc which can be used for common error conditions.Language mappingThe Status message is the logical representation of the error model, but it is not necessarily the actual wire format. When the Status message is exposed in different client libraries and different wire protocols, it can be mapped differently. For example, it will likely be mapped to some exceptions in Java, but more likely mapped to some error codes in C.Other usesThe error model and the Status message can be used in a variety of environments, either with or without APIs, to provide a consistent developer experience across different environments.Example uses of this error model include: Partial errors. If a service needs to return partial errors to the client, it may embed the Status in the normal response to indicate the partial errors. Workflow errors. A typical workflow has multiple steps. Each step may have a Status message for error reporting purpose. Batch operations. If a client uses batch request and batch response, the Status message should be used directly inside batch response, one for each error sub-response. Asynchronous operations. If an API call embeds asynchronous operation results in its response, the status of those operations should be represented directly using the Status message. Logging. If some API errors are stored in logs, the message Status could be used directly after any stripping needed for security/privacy reasons. /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -538,7 +559,7 @@ pub struct NetworkUtilization { impl Part for NetworkUtilization {} -/// Response message for `Versions.ListVersions`. +/// Response message for Versions.ListVersions. /// /// # Activities /// @@ -559,6 +580,25 @@ pub struct ListVersionsResponse { impl ResponseResult for ListVersionsResponse {} +/// Volumes mounted within the app container. Only applicable for VM runtimes. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Volume { + /// Underlying volume type, e.g. 'tmpfs'. + #[serde(rename="volumeType")] + pub volume_type: Option, + /// Unique name for the volume. + pub name: Option, + /// Volume size in gigabytes. + #[serde(rename="sizeGb")] + pub size_gb: Option, +} + +impl Part for Volume {} + + /// Code and application artifacts used to deploy a version to App Engine. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -597,11 +637,11 @@ impl Part for ScriptHandler {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct UrlDispatchRule { - /// Pathname within the host. Must start with a "`/`". A single "`*`" can be included at the end of the path. The sum of the lengths of the domain and path may not exceed 100 characters. + /// Pathname within the host. Must start with a "/". A single "*" can be included at the end of the path. The sum of the lengths of the domain and path may not exceed 100 characters. pub path: Option, - /// Domain name to match against. The wildcard "`*`" is supported if specified before a period: "`*.`". Defaults to matching all domains: "`*`". + /// Domain name to match against. The wildcard "*" is supported if specified before a period: "*.".Defaults to matching all domains: "*". pub domain: Option, - /// Resource id of a service in this application that should serve the matched request. The service must already exist. Example: `default`. + /// Resource id of a service in this application that should serve the matched request. The service must already exist. Example: default. pub service: Option, } @@ -661,7 +701,7 @@ pub struct ErrorHandler { /// Error condition this handler applies to. #[serde(rename="errorCode")] pub error_code: Option, - /// MIME type of file. Defaults to `text/html`. + /// MIME type of file. Defaults to text/html. #[serde(rename="mimeType")] pub mime_type: Option, /// Static file content to be served for this error. @@ -699,13 +739,13 @@ pub struct AutomaticScaling { /// Target scaling by request utilization. #[serde(rename="requestUtilization")] pub request_utilization: Option, - /// Amount of time that the [Autoscaler](https://cloud.google.com/compute/docs/autoscaler/) should wait between changes to the number of virtual machines. Only applicable for VM runtimes. + /// Amount of time that the Autoscaler (https://cloud.google.com/compute/docs/autoscaler/) should wait between changes to the number of virtual machines. Only applicable for VM runtimes. #[serde(rename="coolDownPeriod")] pub cool_down_period: Option, /// Maximum number of instances that should be started to handle requests. #[serde(rename="maxTotalInstances")] pub max_total_instances: Option, - /// Number of concurrent requests an automatic scaling instance can accept before the scheduler spawns a new instance. Defaults to a runtime-specific value. + /// Number of concurrent requests an automatic scaling instance can accept before the scheduler spawns a new instance.Defaults to a runtime-specific value. #[serde(rename="maxConcurrentRequests")] pub max_concurrent_requests: Option, /// Minimum number of instances that should be maintained for this version. @@ -728,7 +768,7 @@ pub struct UrlMap { /// Security (HTTPS) enforcement for this URL. #[serde(rename="securityLevel")] pub security_level: Option, - /// Action to take when users access resources that require authentication. Defaults to `redirect`. + /// Action to take when users access resources that require authentication. Defaults to redirect. #[serde(rename="authFailAction")] pub auth_fail_action: Option, /// A URL prefix. Uses regular expression syntax, which means regexp special characters must be escaped, but should not contain groupings. All URLs that begin with this prefix are handled by this handler, using the portion of the URL after the prefix as part of the file path. @@ -744,7 +784,7 @@ pub struct UrlMap { pub api_endpoint: Option, /// Level of login required to access this resource. pub login: Option, - /// `30x` code to use when performing redirects for the `secure` field. Defaults to `302`. + /// 30x code to use when performing redirects for the secure field. Defaults to 302. #[serde(rename="redirectHttpResponseCode")] pub redirect_http_response_code: Option, } @@ -758,10 +798,10 @@ impl Part for UrlMap {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct FileInfo { - /// The MIME type of the file. Defaults to the value from Google Cloud Storage. + /// The MIME type of the file.Defaults to the value from Google Cloud Storage. #[serde(rename="mimeType")] pub mime_type: Option, - /// URL source to use to fetch this file. Must be a URL to a resource in Google Cloud Storage in the form 'http(s)://storage.googleapis.com/\/\'. + /// URL source to use to fetch this file. Must be a URL to a resource in Google Cloud Storage in the form 'http(s)://storage.googleapis.com//'. #[serde(rename="sourceUrl")] pub source_url: Option, /// The SHA1 hash of the file, in hex. @@ -772,6 +812,22 @@ pub struct FileInfo { impl Part for FileInfo {} +/// Cloud Endpoints (https://cloud.google.com/endpoints) configuration. The Endpoints API Service provides tooling for serving Open API and gRPC endpoints via an NGINX proxy.The fields here refer to the name and configuration id of a "service" resource in the Service Management API (https://cloud.google.com/service-management/overview). +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct EndpointsApiService { + /// Endpoints service configuration id as specified by the Service Management API. For example "2016-09-19r1" + #[serde(rename="configId")] + pub config_id: Option, + /// Endpoints service name which is the name of the "service" resource in the Service Management API. For example "myapi.endpoints.myproject.cloud.goog" + pub name: Option, +} + +impl Part for EndpointsApiService {} + + /// The response message for Operations.ListOperations. /// /// # Activities @@ -804,45 +860,48 @@ impl ResponseResult for ListOperationsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Instance { - /// Number of errors since this instance was started. @OutputOnly - pub errors: Option, - /// Full path to the Instance resource in the API. Example: `apps/myapp/services/default/versions/v1/instances/instance-1`. @OutputOnly - pub name: Option, - /// Whether this instance is in debug mode. Only applicable for instances in App Engine flexible environment. @OutputOnly - #[serde(rename="vmUnlocked")] - pub vm_unlocked: Option, - /// App Engine release this instance is running on. @OutputOnly + /// App Engine release this instance is running on.@OutputOnly #[serde(rename="appEngineRelease")] pub app_engine_release: Option, - /// Virtual machine ID of this instance. Only applicable for instances in App Engine flexible environment. @OutputOnly + /// Virtual machine ID of this instance. Only applicable for instances in App Engine flexible environment.@OutputOnly #[serde(rename="vmId")] pub vm_id: Option, - /// Total memory in use (bytes). @OutputOnly + /// Total memory in use (bytes).@OutputOnly #[serde(rename="memoryUsage")] pub memory_usage: Option, - /// Availability of the instance. @OutputOnly - pub availability: Option, - /// Average latency (ms) over the last minute. @OutputOnly - #[serde(rename="averageLatency")] - pub average_latency: Option, - /// Relative name of the instance within the version. Example: `instance-1`. @OutputOnly - pub id: Option, - /// Average queries per second (QPS) over the last minute. @OutputOnly + /// The IP address of this instance. Only applicable for instances in App Engine flexible environment.@OutputOnly + #[serde(rename="vmIp")] + pub vm_ip: Option, + /// Average queries per second (QPS) over the last minute.@OutputOnly pub qps: Option, - /// Number of requests since this instance was started. @OutputOnly - pub requests: Option, - /// Name of the virtual machine where this instance lives. Only applicable for instances in App Engine flexible environment. @OutputOnly - #[serde(rename="vmName")] - pub vm_name: Option, - /// Time that this instance was started. @OutputOnly - #[serde(rename="startTimestamp")] - pub start_timestamp: Option, - /// Zone where the virtual machine is located. Only applicable for instances in App Engine flexible environment. @OutputOnly - #[serde(rename="vmZoneName")] - pub vm_zone_name: Option, - /// Status of the virtual machine where this instance lives. Only applicable for instances in App Engine flexible environment. @OutputOnly + /// Availability of the instance.@OutputOnly + pub availability: Option, + /// Full path to the Instance resource in the API. Example: apps/myapp/services/default/versions/v1/instances/instance-1.@OutputOnly + pub name: Option, + /// Number of errors since this instance was started.@OutputOnly + pub errors: Option, + /// Status of the virtual machine where this instance lives. Only applicable for instances in App Engine flexible environment.@OutputOnly #[serde(rename="vmStatus")] pub vm_status: Option, + /// Whether this instance is in debug mode. Only applicable for instances in App Engine flexible environment.@OutputOnly + #[serde(rename="vmUnlocked")] + pub vm_unlocked: Option, + /// Relative name of the instance within the version. Example: instance-1.@OutputOnly + pub id: Option, + /// Average latency (ms) over the last minute.@OutputOnly + #[serde(rename="averageLatency")] + pub average_latency: Option, + /// Number of requests since this instance was started.@OutputOnly + pub requests: Option, + /// Name of the virtual machine where this instance lives. Only applicable for instances in App Engine flexible environment.@OutputOnly + #[serde(rename="vmName")] + pub vm_name: Option, + /// Time that this instance was started.@OutputOnly + #[serde(rename="startTimestamp")] + pub start_timestamp: Option, + /// Zone where the virtual machine is located. Only applicable for instances in App Engine flexible environment.@OutputOnly + #[serde(rename="vmZoneName")] + pub vm_zone_name: Option, } impl ResponseResult for Instance {} @@ -854,7 +913,7 @@ impl ResponseResult for Instance {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ManualScaling { - /// Number of instances to assign to the service at the start. This number can later be altered by using the [Modules API](https://cloud.google.com/appengine/docs/python/modules/functions) `set_num_instances()` function. + /// Number of instances to assign to the service at the start. This number can later be altered by using the Modules API (https://cloud.google.com/appengine/docs/python/modules/functions) set_num_instances() function. pub instances: Option, } @@ -874,7 +933,7 @@ pub struct ContainerInfo { impl Part for ContainerInfo {} -/// [Google Cloud Endpoints](https://cloud.google.com/appengine/docs/python/endpoints/) configuration for API handlers. +/// Google Cloud Endpoints (https://cloud.google.com/appengine/docs/python/endpoints/) configuration for API handlers. /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -885,10 +944,10 @@ pub struct ApiConfigHandler { /// Security (HTTPS) enforcement for this URL. #[serde(rename="securityLevel")] pub security_level: Option, - /// Action to take when users access resources that require authentication. Defaults to `redirect`. + /// Action to take when users access resources that require authentication. Defaults to redirect. #[serde(rename="authFailAction")] pub auth_fail_action: Option, - /// Level of login required to access this resource. Defaults to `optional`. + /// Level of login required to access this resource. Defaults to optional. pub login: Option, /// Path to the script from the application root directory. pub script: Option, @@ -968,7 +1027,7 @@ pub struct RequestUtilization { impl Part for RequestUtilization {} -/// Response message for `Services.ListServices`. +/// Response message for Services.ListServices. /// /// # Activities /// @@ -1013,6 +1072,7 @@ impl Part for TrafficSplit {} /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [services versions create apps](struct.AppServiceVersionCreateCall.html) (response) +/// * [patch apps](struct.AppPatchCall.html) (response) /// * [services versions instances debug apps](struct.AppServiceVersionInstanceDebugCall.html) (response) /// * [create apps](struct.AppCreateCall.html) (response) /// * [services versions instances delete apps](struct.AppServiceVersionInstanceDeleteCall.html) (response) @@ -1026,13 +1086,13 @@ impl Part for TrafficSplit {} pub struct Operation { /// Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any. pub metadata: Option>, - /// If the value is `false`, it means the operation is still in progress. If true, the operation is completed, and either `error` or `response` is available. + /// If the value is false, it means the operation is still in progress. If true, the operation is completed, and either error or response is available. pub done: Option, - /// The normal response of the operation in case of success. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`. + /// The normal response of the operation in case of success. If the original method returns no data on success, such as Delete, the response is google.protobuf.Empty. If the original method is standard Get/Create/Update, the response should be the resource. For other methods, the response should have the type XxxResponse, where Xxx is the original method name. For example, if the original method name is TakeSnapshot(), the inferred response type is TakeSnapshotResponse. pub response: Option>, - /// The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should have the format of `operations/some/unique/name`. + /// The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the name should have the format of operations/some/unique/name. pub name: Option, - /// The error result of the operation in case of failure. + /// The error result of the operation in case of failure or cancellation. pub error: Option, } @@ -1067,7 +1127,7 @@ impl ResponseResult for Operation {} /// ::default(), None); /// let mut hub = Appengine::new(hyper::Client::new(), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `create(...)`, `get(...)`, `locations_get(...)`, `locations_list(...)`, `operations_get(...)`, `operations_list(...)`, `services_delete(...)`, `services_get(...)`, `services_list(...)`, `services_patch(...)`, `services_versions_create(...)`, `services_versions_delete(...)`, `services_versions_get(...)`, `services_versions_instances_debug(...)`, `services_versions_instances_delete(...)`, `services_versions_instances_get(...)`, `services_versions_instances_list(...)`, `services_versions_list(...)` and `services_versions_patch(...)` +/// // like `create(...)`, `get(...)`, `locations_get(...)`, `locations_list(...)`, `operations_get(...)`, `operations_list(...)`, `patch(...)`, `services_delete(...)`, `services_get(...)`, `services_list(...)`, `services_patch(...)`, `services_versions_create(...)`, `services_versions_delete(...)`, `services_versions_get(...)`, `services_versions_instances_debug(...)`, `services_versions_instances_delete(...)`, `services_versions_instances_get(...)`, `services_versions_instances_list(...)`, `services_versions_list(...)` and `services_versions_patch(...)` /// // to build up your call. /// let rb = hub.apps(); /// # } @@ -1088,7 +1148,7 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// /// # Arguments /// - /// * `appsId` - Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default/versions/v1`. + /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1. /// * `servicesId` - Part of `name`. See documentation of `appsId`. /// * `versionsId` - Part of `name`. See documentation of `appsId`. pub fn services_versions_instances_list(&self, apps_id: &str, services_id: &str, versions_id: &str) -> AppServiceVersionInstanceListCall<'a, C, A> { @@ -1128,12 +1188,32 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Enables debugging on a VM instance. This allows you to use the SSH command to connect to the virtual machine where the instance lives. While in "debug mode", the instance continues to serve live traffic. You should delete the instance when you are done debugging and then allow the system to take over and determine if another instance should be started. Only applicable for instances in App Engine flexible environment. + /// Updates the specified Application resource. You can update the following fields: auth_domain (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps#Application.FIELDS.auth_domain) default_cookie_expiration (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps#Application.FIELDS.default_cookie_expiration) /// /// # Arguments /// /// * `request` - No description provided. - /// * `appsId` - Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default/versions/v1/instances/instance-1`. + /// * `appsId` - Part of `name`. Name of the Application resource to update. Example: apps/myapp. + pub fn patch(&self, request: Application, apps_id: &str) -> AppPatchCall<'a, C, A> { + AppPatchCall { + hub: self.hub, + _request: request, + _apps_id: apps_id.to_string(), + _mask: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Enables debugging on a VM instance. This allows you to use the SSH command to connect to the virtual machine where the instance lives. While in "debug mode", the instance continues to serve live traffic. You should delete the instance when you are done debugging and then allow the system to take over and determine if another instance should be started.Only applicable for instances in App Engine flexible environment. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1/instances/instance-1. /// * `servicesId` - Part of `name`. See documentation of `appsId`. /// * `versionsId` - Part of `name`. See documentation of `appsId`. /// * `instancesId` - Part of `name`. See documentation of `appsId`. @@ -1157,7 +1237,7 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// /// # Arguments /// - /// * `appsId` - Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default`. + /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/services/default. /// * `servicesId` - Part of `name`. See documentation of `appsId`. pub fn services_get(&self, apps_id: &str, services_id: &str) -> AppServiceGetCall<'a, C, A> { AppServiceGetCall { @@ -1195,12 +1275,12 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates the specified Version resource. You can specify the following fields depending on the App Engine environment and type of scaling that the version resource uses: * [`serving_status`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps.services.versions#Version.FIELDS.serving_status): For Version resources that use basic scaling, manual scaling, or run in the App Engine flexible environment. * [`instance_class`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps.services.versions#Version.FIELDS.instance_class): For Version resources that run in the App Engine standard environment. * [`automatic_scaling.min_idle_instances`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps.services.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment. * [`automatic_scaling.max_idle_instances`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps.services.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment. + /// Updates the specified Version resource. You can specify the following fields depending on the App Engine environment and type of scaling that the version resource uses: serving_status (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps.services.versions#Version.FIELDS.serving_status): For Version resources that use basic scaling, manual scaling, or run in the App Engine flexible environment. instance_class (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps.services.versions#Version.FIELDS.instance_class): For Version resources that run in the App Engine standard environment. automatic_scaling.min_idle_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps.services.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment. automatic_scaling.max_idle_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps.services.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment. /// /// # Arguments /// /// * `request` - No description provided. - /// * `appsId` - Part of `name`. Name of the resource to update. Example: `apps/myapp/services/default/versions/1`. + /// * `appsId` - Part of `name`. Name of the resource to update. Example: apps/myapp/services/default/versions/1. /// * `servicesId` - Part of `name`. See documentation of `appsId`. /// * `versionsId` - Part of `name`. See documentation of `appsId`. pub fn services_versions_patch(&self, request: Version, apps_id: &str, services_id: &str, versions_id: &str) -> AppServiceVersionPatchCall<'a, C, A> { @@ -1223,7 +1303,7 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// /// # Arguments /// - /// * `appsId` - Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default`. + /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/services/default. /// * `servicesId` - Part of `name`. See documentation of `appsId`. pub fn services_versions_list(&self, apps_id: &str, services_id: &str) -> AppServiceVersionListCall<'a, C, A> { AppServiceVersionListCall { @@ -1264,7 +1344,7 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// /// # Arguments /// - /// * `appsId` - Part of `name`. Name of the resource requested. Example: `apps/myapp`. + /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp. pub fn services_list(&self, apps_id: &str) -> AppServiceListCall<'a, C, A> { AppServiceListCall { hub: self.hub, @@ -1303,7 +1383,7 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// /// # Arguments /// - /// * `appsId` - Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default/versions/v1/instances/instance-1`. + /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1/instances/instance-1. /// * `servicesId` - Part of `name`. See documentation of `appsId`. /// * `versionsId` - Part of `name`. See documentation of `appsId`. /// * `instancesId` - Part of `name`. See documentation of `appsId`. @@ -1322,7 +1402,7 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`. NOTE: the `name` binding below allows API services to override the binding to use different resource name schemes, such as `users/*/operations`. + /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED.NOTE: the name binding below allows API services to override the binding to use different resource name schemes, such as users/*/operations. /// /// # Arguments /// @@ -1346,7 +1426,7 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// /// # Arguments /// - /// * `appsId` - Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default/versions/v1`. + /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1. /// * `servicesId` - Part of `name`. See documentation of `appsId`. /// * `versionsId` - Part of `name`. See documentation of `appsId`. pub fn services_versions_delete(&self, apps_id: &str, services_id: &str, versions_id: &str) -> AppServiceVersionDeleteCall<'a, C, A> { @@ -1387,7 +1467,7 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `appsId` - Part of `name`. Name of the resource to update. Example: `apps/myapp/services/default`. + /// * `appsId` - Part of `name`. Name of the resource to update. Example: apps/myapp/services/default. /// * `servicesId` - Part of `name`. See documentation of `appsId`. pub fn services_patch(&self, request: Service, apps_id: &str, services_id: &str) -> AppServicePatchCall<'a, C, A> { AppServicePatchCall { @@ -1409,7 +1489,7 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// /// # Arguments /// - /// * `appsId` - Part of `name`. Name of the application to get. Example: `apps/myapp`. + /// * `appsId` - Part of `name`. Name of the application to get. Example: apps/myapp. pub fn get(&self, apps_id: &str) -> AppGetCall<'a, C, A> { AppGetCall { hub: self.hub, @@ -1427,7 +1507,7 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// /// # Arguments /// - /// * `appsId` - Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default`. + /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/services/default. /// * `servicesId` - Part of `name`. See documentation of `appsId`. pub fn services_delete(&self, apps_id: &str, services_id: &str) -> AppServiceDeleteCall<'a, C, A> { AppServiceDeleteCall { @@ -1442,7 +1522,7 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Creates an App Engine application for a Google Cloud Platform project. This requires a project that excludes an App Engine application. For details about creating a project without an application, see the [Google Cloud Resource Manager create project topic](https://cloud.google.com/resource-manager/docs/creating-project). + /// Creates an App Engine application for a Google Cloud Platform project. This requires a project that excludes an App Engine application. For details about creating a project without an application, see the Google Cloud Resource Manager create project topic (https://cloud.google.com/resource-manager/docs/creating-project). /// /// # Arguments /// @@ -1459,11 +1539,11 @@ impl<'a, C, A> AppMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets the specified Version resource. By default, only a `BASIC_VIEW` will be returned. Specify the `FULL_VIEW` parameter to get the full resource. + /// Gets the specified Version resource. By default, only a BASIC_VIEW will be returned. Specify the FULL_VIEW parameter to get the full resource. /// /// # Arguments /// - /// * `appsId` - Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default/versions/v1`. + /// * `appsId` - Part of `name`. Name of the resource requested. Example: apps/myapp/services/default/versions/v1. /// * `servicesId` - Part of `name`. See documentation of `appsId`. /// * `versionsId` - Part of `name`. See documentation of `appsId`. pub fn services_versions_get(&self, apps_id: &str, services_id: &str, versions_id: &str) -> AppServiceVersionGetCall<'a, C, A> { @@ -1574,7 +1654,7 @@ impl<'a, C, A> AppServiceVersionInstanceListCall<'a, C, A> where C: BorrowMut AppServiceVersionInstanceListCall<'a, C, A> where C: BorrowMut AppServiceVersionInstanceListCall<'a, C, A> where C: BorrowMut AppServiceVersionCreateCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = Appengine::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Application::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.apps().patch(req, "appsId") +/// .mask("gubergren") +/// .doit(); +/// # } +/// ``` +pub struct AppPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Appengine, + _request: Application, + _apps_id: String, + _mask: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AppPatchCall<'a, C, A> {} + +impl<'a, C, A> AppPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "appengine.apps.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("appsId", self._apps_id.to_string())); + if let Some(value) = self._mask { + params.push(("mask", value.to_string())); + } + for &field in ["alt", "appsId", "mask"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://appengine.googleapis.com/v1beta5/apps/{appsId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{appsId}", "appsId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["appsId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Application) -> AppPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// Part of `name`. Name of the Application resource to update. Example: apps/myapp. + /// + /// Sets the *apps id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn apps_id(mut self, new_value: &str) -> AppPatchCall<'a, C, A> { + self._apps_id = new_value.to_string(); + self + } + /// Standard field mask for the set of fields to be updated. + /// + /// Sets the *mask* query property to the given value. + pub fn mask(mut self, new_value: &str) -> AppPatchCall<'a, C, A> { + self._mask = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AppPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AppPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AppPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Enables debugging on a VM instance. This allows you to use the SSH command to connect to the virtual machine where the instance lives. While in "debug mode", the instance continues to serve live traffic. You should delete the instance when you are done debugging and then allow the system to take over and determine if another instance should be started.Only applicable for instances in App Engine flexible environment. /// /// A builder for the *services.versions.instances.debug* method supported by a *app* resource. /// It is not used directly, but through a `AppMethods` instance. @@ -2271,7 +2635,7 @@ impl<'a, C, A> AppServiceVersionInstanceDebugCall<'a, C, A> where C: BorrowMut AppServiceGetCall<'a, C, A> where C: BorrowMut, A: let mut url = "https://appengine.googleapis.com/v1beta5/apps/{appsId}/services/{servicesId}".to_string(); if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + self._scopes.insert(Scope::Admin.as_ref().to_string(), ()); } for &(find_this, param_name) in [("{appsId}", "appsId"), ("{servicesId}", "servicesId")].iter() { @@ -2544,7 +2908,7 @@ impl<'a, C, A> AppServiceGetCall<'a, C, A> where C: BorrowMut, A: } - /// Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default`. + /// Part of `name`. Name of the resource requested. Example: apps/myapp/services/default. /// /// Sets the *apps id* path property to the given value. /// @@ -2606,7 +2970,7 @@ impl<'a, C, A> AppServiceGetCall<'a, C, A> where C: BorrowMut, A: /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. + /// `Scope::Admin`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. @@ -2899,7 +3263,7 @@ impl<'a, C, A> AppServiceVersionInstanceDeleteCall<'a, C, A> where C: BorrowMut< } -/// Updates the specified Version resource. You can specify the following fields depending on the App Engine environment and type of scaling that the version resource uses: * [`serving_status`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps.services.versions#Version.FIELDS.serving_status): For Version resources that use basic scaling, manual scaling, or run in the App Engine flexible environment. * [`instance_class`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps.services.versions#Version.FIELDS.instance_class): For Version resources that run in the App Engine standard environment. * [`automatic_scaling.min_idle_instances`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps.services.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment. * [`automatic_scaling.max_idle_instances`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps.services.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment. +/// Updates the specified Version resource. You can specify the following fields depending on the App Engine environment and type of scaling that the version resource uses: serving_status (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps.services.versions#Version.FIELDS.serving_status): For Version resources that use basic scaling, manual scaling, or run in the App Engine flexible environment. instance_class (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps.services.versions#Version.FIELDS.instance_class): For Version resources that run in the App Engine standard environment. automatic_scaling.min_idle_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps.services.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment. automatic_scaling.max_idle_instances (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps.services.versions#Version.FIELDS.automatic_scaling): For Version resources that use automatic scaling and run in the App Engine standard environment. /// /// A builder for the *services.versions.patch* method supported by a *app* resource. /// It is not used directly, but through a `AppMethods` instance. @@ -2932,7 +3296,7 @@ impl<'a, C, A> AppServiceVersionInstanceDeleteCall<'a, C, A> where C: BorrowMut< /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().services_versions_patch(req, "appsId", "servicesId", "versionsId") -/// .mask("et") +/// .mask("aliquyam") /// .doit(); /// # } /// ``` @@ -3112,7 +3476,7 @@ impl<'a, C, A> AppServiceVersionPatchCall<'a, C, A> where C: BorrowMut AppServiceVersionPatchCall<'a, C, A> where C: BorrowMut AppServiceVersionListCall<'a, C, A> where C: BorrowMut AppServiceVersionListCall<'a, C, A> where C: BorrowMut AppServiceVersionListCall<'a, C, A> where C: BorrowMut AppServiceVersionListCall<'a, C, A> { @@ -3480,7 +3844,7 @@ impl<'a, C, A> AppServiceVersionListCall<'a, C, A> where C: BorrowMut AppOperationGetCall<'a, C, A> where C: BorrowMut, let mut url = "https://appengine.googleapis.com/v1beta5/apps/{appsId}/operations/{operationsId}".to_string(); if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + self._scopes.insert(Scope::Admin.as_ref().to_string(), ()); } for &(find_this, param_name) in [("{appsId}", "appsId"), ("{operationsId}", "operationsId")].iter() { @@ -3733,7 +4097,7 @@ impl<'a, C, A> AppOperationGetCall<'a, C, A> where C: BorrowMut, /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. + /// `Scope::Admin`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. @@ -3776,8 +4140,8 @@ impl<'a, C, A> AppOperationGetCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().services_list("appsId") -/// .page_token("eirmod") -/// .page_size(-43) +/// .page_token("amet") +/// .page_size(-60) /// .doit(); /// # } /// ``` @@ -3831,7 +4195,7 @@ impl<'a, C, A> AppServiceListCall<'a, C, A> where C: BorrowMut, A let mut url = "https://appengine.googleapis.com/v1beta5/apps/{appsId}/services".to_string(); if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + self._scopes.insert(Scope::Admin.as_ref().to_string(), ()); } for &(find_this, param_name) in [("{appsId}", "appsId")].iter() { @@ -3932,7 +4296,7 @@ impl<'a, C, A> AppServiceListCall<'a, C, A> where C: BorrowMut, A } - /// Part of `name`. Name of the resource requested. Example: `apps/myapp`. + /// Part of `name`. Name of the resource requested. Example: apps/myapp. /// /// Sets the *apps id* path property to the given value. /// @@ -3998,7 +4362,7 @@ impl<'a, C, A> AppServiceListCall<'a, C, A> where C: BorrowMut, A /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. + /// `Scope::Admin`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. @@ -4041,9 +4405,9 @@ impl<'a, C, A> AppServiceListCall<'a, C, A> where C: BorrowMut, A /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().locations_list("appsId") -/// .page_token("no") -/// .page_size(-36) -/// .filter("eirmod") +/// .page_token("eirmod") +/// .page_size(-33) +/// .filter("invidunt") /// .doit(); /// # } /// ``` @@ -4101,7 +4465,7 @@ impl<'a, C, A> AppLocationListCall<'a, C, A> where C: BorrowMut, let mut url = "https://appengine.googleapis.com/v1beta5/apps/{appsId}/locations".to_string(); if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + self._scopes.insert(Scope::Admin.as_ref().to_string(), ()); } for &(find_this, param_name) in [("{appsId}", "appsId")].iter() { @@ -4275,7 +4639,7 @@ impl<'a, C, A> AppLocationListCall<'a, C, A> where C: BorrowMut, /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. + /// `Scope::Admin`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. @@ -4369,7 +4733,7 @@ impl<'a, C, A> AppServiceVersionInstanceGetCall<'a, C, A> where C: BorrowMut AppServiceVersionInstanceGetCall<'a, C, A> where C: BorrowMut AppServiceVersionInstanceGetCall<'a, C, A> where C: BorrowMut AppServiceVersionInstanceGetCall<'a, C, A> where C: BorrowMut AppServiceVersionInstanceGetCall<'a, C, A> where C: BorrowMut AppOperationListCall<'a, C, A> where C: BorrowMut, let mut url = "https://appengine.googleapis.com/v1beta5/apps/{appsId}/operations".to_string(); if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + self._scopes.insert(Scope::Admin.as_ref().to_string(), ()); } for &(find_this, param_name) in [("{appsId}", "appsId")].iter() { @@ -4829,7 +5193,7 @@ impl<'a, C, A> AppOperationListCall<'a, C, A> where C: BorrowMut, /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. + /// `Scope::Admin`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. @@ -5022,7 +5386,7 @@ impl<'a, C, A> AppServiceVersionDeleteCall<'a, C, A> where C: BorrowMut AppLocationGetCall<'a, C, A> where C: BorrowMut, A let mut url = "https://appengine.googleapis.com/v1beta5/apps/{appsId}/locations/{locationsId}".to_string(); if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + self._scopes.insert(Scope::Admin.as_ref().to_string(), ()); } for &(find_this, param_name) in [("{appsId}", "appsId"), ("{locationsId}", "locationsId")].iter() { @@ -5347,7 +5711,7 @@ impl<'a, C, A> AppLocationGetCall<'a, C, A> where C: BorrowMut, A /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. + /// `Scope::Admin`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. @@ -5396,8 +5760,8 @@ impl<'a, C, A> AppLocationGetCall<'a, C, A> where C: BorrowMut, A /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().services_patch(req, "appsId", "servicesId") -/// .migrate_traffic(true) -/// .mask("ea") +/// .migrate_traffic(false) +/// .mask("dolor") /// .doit(); /// # } /// ``` @@ -5579,7 +5943,7 @@ impl<'a, C, A> AppServicePatchCall<'a, C, A> where C: BorrowMut, self._request = new_value; self } - /// Part of `name`. Name of the resource to update. Example: `apps/myapp/services/default`. + /// Part of `name`. Name of the resource to update. Example: apps/myapp/services/default. /// /// Sets the *apps id* path property to the given value. /// @@ -5599,7 +5963,7 @@ impl<'a, C, A> AppServicePatchCall<'a, C, A> where C: BorrowMut, self._services_id = new_value.to_string(); self } - /// Set to `true` to gradually shift traffic from one version to another single version. By default, traffic is shifted immediately. For gradual traffic migration, the target version must be located within instances that are configured for both [warmup requests](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps.services.versions#inboundservicetype) and [automatic scaling](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps.services.versions#automaticscaling). You must specify the [`shardBy`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps.services#shardby) field in the Service resource. Gradual traffic migration is not supported in the App Engine flexible environment. For examples, see [Migrating and Splitting Traffic](https://cloud.google.com/appengine/docs/admin-api/migrating-splitting-traffic). + /// Set to true to gradually shift traffic from one version to another single version. By default, traffic is shifted immediately. For gradual traffic migration, the target version must be located within instances that are configured for both warmup requests (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps.services.versions#inboundservicetype) and automatic scaling (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps.services.versions#automaticscaling). You must specify the shardBy (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta5/apps.services#shardby) field in the Service resource. Gradual traffic migration is not supported in the App Engine flexible environment. For examples, see Migrating and Splitting Traffic (https://cloud.google.com/appengine/docs/admin-api/migrating-splitting-traffic). /// /// Sets the *migrate traffic* query property to the given value. pub fn migrate_traffic(mut self, new_value: bool) -> AppServicePatchCall<'a, C, A> { @@ -5849,7 +6213,7 @@ impl<'a, C, A> AppGetCall<'a, C, A> where C: BorrowMut, A: oauth2 } - /// Part of `name`. Name of the application to get. Example: `apps/myapp`. + /// Part of `name`. Name of the application to get. Example: apps/myapp. /// /// Sets the *apps id* path property to the given value. /// @@ -5859,7 +6223,7 @@ impl<'a, C, A> AppGetCall<'a, C, A> where C: BorrowMut, A: oauth2 self._apps_id = new_value.to_string(); self } - /// Certain resources associated with an application are created on-demand. Controls whether these resources should be created when performing the `GET` operation. If specified and any resources could not be created, the request will fail with an error code. Additionally, this parameter can cause the request to take longer to complete. Note: This parameter will be deprecated in a future version of the API. + /// Certain resources associated with an application are created on-demand. Controls whether these resources should be created when performing the GET operation. If specified and any resources could not be created, the request will fail with an error code. Additionally, this parameter can cause the request to take longer to complete. Note: This parameter will be deprecated in a future version of the API. /// /// Sets the *ensure resources exist* query property to the given value. pub fn ensure_resources_exist(mut self, new_value: bool) -> AppGetCall<'a, C, A> { @@ -6099,7 +6463,7 @@ impl<'a, C, A> AppServiceDeleteCall<'a, C, A> where C: BorrowMut, } - /// Part of `name`. Name of the resource requested. Example: `apps/myapp/services/default`. + /// Part of `name`. Name of the resource requested. Example: apps/myapp/services/default. /// /// Sets the *apps id* path property to the given value. /// @@ -6177,7 +6541,7 @@ impl<'a, C, A> AppServiceDeleteCall<'a, C, A> where C: BorrowMut, } -/// Creates an App Engine application for a Google Cloud Platform project. This requires a project that excludes an App Engine application. For details about creating a project without an application, see the [Google Cloud Resource Manager create project topic](https://cloud.google.com/resource-manager/docs/creating-project). +/// Creates an App Engine application for a Google Cloud Platform project. This requires a project that excludes an App Engine application. For details about creating a project without an application, see the Google Cloud Resource Manager create project topic (https://cloud.google.com/resource-manager/docs/creating-project). /// /// A builder for the *create* method supported by a *app* resource. /// It is not used directly, but through a `AppMethods` instance. @@ -6416,7 +6780,7 @@ impl<'a, C, A> AppCreateCall<'a, C, A> where C: BorrowMut, A: oau } -/// Gets the specified Version resource. By default, only a `BASIC_VIEW` will be returned. Specify the `FULL_VIEW` parameter to get the full resource. +/// Gets the specified Version resource. By default, only a BASIC_VIEW will be returned. Specify the FULL_VIEW parameter to get the full resource. /// /// A builder for the *services.versions.get* method supported by a *app* resource. /// It is not used directly, but through a `AppMethods` instance. @@ -6443,7 +6807,7 @@ impl<'a, C, A> AppCreateCall<'a, C, A> where C: BorrowMut, A: oau /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.apps().services_versions_get("appsId", "servicesId", "versionsId") -/// .view("voluptua.") +/// .view("gubergren") /// .doit(); /// # } /// ``` @@ -6497,7 +6861,7 @@ impl<'a, C, A> AppServiceVersionGetCall<'a, C, A> where C: BorrowMut AppServiceVersionGetCall<'a, C, A> where C: BorrowMut AppServiceVersionGetCall<'a, C, A> where C: BorrowMut AppServiceVersionGetCall<'a, C, A> { @@ -6677,7 +7041,7 @@ impl<'a, C, A> AppServiceVersionGetCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with appsactivity (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/appsactivity1-cli" diff --git a/gen/appsactivity1-cli/README.md b/gen/appsactivity1-cli/README.md index 401aa2acc3..8ef5d857ad 100644 --- a/gen/appsactivity1-cli/README.md +++ b/gen/appsactivity1-cli/README.md @@ -24,7 +24,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *appsactivity* API at revision *20160805*. The CLI is at version *1.0.0*. +This documentation was generated from the *appsactivity* API at revision *20161202*. The CLI is at version *1.0.0*. ```bash appsactivity1 [options] diff --git a/gen/appsactivity1-cli/mkdocs.yml b/gen/appsactivity1-cli/mkdocs.yml index 9eab6b4158..272f25afb9 100644 --- a/gen/appsactivity1-cli/mkdocs.yml +++ b/gen/appsactivity1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: appsactivity v1.0.0+20160805 +site_name: appsactivity v1.0.0+20161202 site_url: http://byron.github.io/google-apis-rs/google-appsactivity1-cli site_description: Write integrating applications with bcore diff --git a/gen/appsactivity1-cli/src/main.rs b/gen/appsactivity1-cli/src/main.rs index 846b066910..de057051e7 100644 --- a/gen/appsactivity1-cli/src/main.rs +++ b/gen/appsactivity1-cli/src/main.rs @@ -240,7 +240,7 @@ fn main() { let mut app = App::new("appsactivity1") .author("Sebastian Thiel ") - .version("1.0.0+20160805") + .version("1.0.0+20161202") .about("Provides a historical view of activity.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_appsactivity1_cli") .arg(Arg::with_name("url") diff --git a/gen/appsactivity1/Cargo.toml b/gen/appsactivity1/Cargo.toml index e41464c328..4dedfb0be9 100644 --- a/gen/appsactivity1/Cargo.toml +++ b/gen/appsactivity1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-appsactivity1" -version = "1.0.0+20160805" +version = "1.0.0+20161202" authors = ["Sebastian Thiel "] description = "A complete library to interact with appsactivity (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/appsactivity1" diff --git a/gen/appsactivity1/README.md b/gen/appsactivity1/README.md index 51759ad7ba..8231ebb798 100644 --- a/gen/appsactivity1/README.md +++ b/gen/appsactivity1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-appsactivity1` library allows access to all features of the *Google appsactivity* service. -This documentation was generated from *appsactivity* crate version *1.0.0+20160805*, where *20160805* is the exact revision of the *appsactivity:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *appsactivity* crate version *1.0.0+20161202*, where *20161202* is the exact revision of the *appsactivity:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *appsactivity* *v1* API can be found at the [official documentation site](https://developers.google.com/google-apps/activity/). diff --git a/gen/appsactivity1/src/lib.rs b/gen/appsactivity1/src/lib.rs index 661449f974..c341339d10 100644 --- a/gen/appsactivity1/src/lib.rs +++ b/gen/appsactivity1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *appsactivity* crate version *1.0.0+20160805*, where *20160805* is the exact revision of the *appsactivity:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *appsactivity* crate version *1.0.0+20161202*, where *20161202* is the exact revision of the *appsactivity:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *appsactivity* *v1* API can be found at the //! [official documentation site](https://developers.google.com/google-apps/activity/). diff --git a/gen/appsactivity1/src/lib.rs.in b/gen/appsactivity1/src/lib.rs.in index 1c4e992b2a..70f51b747d 100644 --- a/gen/appsactivity1/src/lib.rs.in +++ b/gen/appsactivity1/src/lib.rs.in @@ -335,11 +335,14 @@ pub struct User { /// The permission ID associated with this user. Equivalent to the Drive API's permission ID for this user, returned as part of the Drive Permissions resource. #[serde(rename="permissionId")] pub permission_id: Option, - /// The displayable name of the user. - pub name: Option, /// A boolean which indicates whether the specified User was deleted. If true, name, photo and permission_id will be omitted. #[serde(rename="isDeleted")] pub is_deleted: Option, + /// Whether the user is the authenticated user. + #[serde(rename="isMe")] + pub is_me: Option, + /// The displayable name of the user. + pub name: Option, } impl Part for User {} diff --git a/gen/appstate1-cli/Cargo.toml b/gen/appstate1-cli/Cargo.toml index 92cb73d8bc..311cc03968 100644 --- a/gen/appstate1-cli/Cargo.toml +++ b/gen/appstate1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-appstate1-cli" -version = "1.0.0+20160901" +version = "1.0.0+20161207" authors = ["Sebastian Thiel "] description = "A complete library to interact with App State (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/appstate1-cli" diff --git a/gen/appstate1-cli/README.md b/gen/appstate1-cli/README.md index cee0bdc026..0af1b26b0a 100644 --- a/gen/appstate1-cli/README.md +++ b/gen/appstate1-cli/README.md @@ -24,7 +24,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *App State* API at revision *20160901*. The CLI is at version *1.0.0*. +This documentation was generated from the *App State* API at revision *20161207*. The CLI is at version *1.0.0*. ```bash appstate1 [options] diff --git a/gen/appstate1-cli/mkdocs.yml b/gen/appstate1-cli/mkdocs.yml index f638939dce..98a6a526bb 100644 --- a/gen/appstate1-cli/mkdocs.yml +++ b/gen/appstate1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: App State v1.0.0+20160901 +site_name: App State v1.0.0+20161207 site_url: http://byron.github.io/google-apis-rs/google-appstate1-cli site_description: Write integrating applications with bcore diff --git a/gen/appstate1-cli/src/main.rs b/gen/appstate1-cli/src/main.rs index d1194ef232..2edb2a8a34 100644 --- a/gen/appstate1-cli/src/main.rs +++ b/gen/appstate1-cli/src/main.rs @@ -568,7 +568,7 @@ fn main() { let mut app = App::new("appstate1") .author("Sebastian Thiel ") - .version("1.0.0+20160901") + .version("1.0.0+20161207") .about("The Google App State API.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_appstate1_cli") .arg(Arg::with_name("url") diff --git a/gen/appstate1/Cargo.toml b/gen/appstate1/Cargo.toml index cf8d56a5dc..35bf0e8bd3 100644 --- a/gen/appstate1/Cargo.toml +++ b/gen/appstate1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-appstate1" -version = "1.0.0+20160901" +version = "1.0.0+20161207" authors = ["Sebastian Thiel "] description = "A complete library to interact with App State (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/appstate1" diff --git a/gen/appstate1/README.md b/gen/appstate1/README.md index efbbedf757..07b5d20467 100644 --- a/gen/appstate1/README.md +++ b/gen/appstate1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-appstate1` library allows access to all features of the *Google App State* service. -This documentation was generated from *App State* crate version *1.0.0+20160901*, where *20160901* is the exact revision of the *appstate:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *App State* crate version *1.0.0+20161207*, where *20161207* is the exact revision of the *appstate:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *App State* *v1* API can be found at the [official documentation site](https://developers.google.com/games/services/web/api/states). diff --git a/gen/appstate1/src/lib.rs b/gen/appstate1/src/lib.rs index 8d054ff687..5d52056082 100644 --- a/gen/appstate1/src/lib.rs +++ b/gen/appstate1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *App State* crate version *1.0.0+20160901*, where *20160901* is the exact revision of the *appstate:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *App State* crate version *1.0.0+20161207*, where *20161207* is the exact revision of the *appstate:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *App State* *v1* API can be found at the //! [official documentation site](https://developers.google.com/games/services/web/api/states). diff --git a/gen/bigquery2-cli/Cargo.toml b/gen/bigquery2-cli/Cargo.toml index 41143c2984..fd01ab55f6 100644 --- a/gen/bigquery2-cli/Cargo.toml +++ b/gen/bigquery2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-bigquery2-cli" -version = "1.0.0+20160903" +version = "1.0.0+20161130" authors = ["Sebastian Thiel "] description = "A complete library to interact with bigquery (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/bigquery2-cli" diff --git a/gen/bigquery2-cli/README.md b/gen/bigquery2-cli/README.md index a06b3cb7cc..ab8fc36b4d 100644 --- a/gen/bigquery2-cli/README.md +++ b/gen/bigquery2-cli/README.md @@ -24,7 +24,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *bigquery* API at revision *20160903*. The CLI is at version *1.0.0*. +This documentation was generated from the *bigquery* API at revision *20161130*. The CLI is at version *1.0.0*. ```bash bigquery2 [options] diff --git a/gen/bigquery2-cli/mkdocs.yml b/gen/bigquery2-cli/mkdocs.yml index 17a377422d..e0da1eae00 100644 --- a/gen/bigquery2-cli/mkdocs.yml +++ b/gen/bigquery2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: bigquery v1.0.0+20160903 +site_name: bigquery v1.0.0+20161130 site_url: http://byron.github.io/google-apis-rs/google-bigquery2-cli site_description: Write integrating applications with bcore diff --git a/gen/bigquery2-cli/src/main.rs b/gen/bigquery2-cli/src/main.rs index 11be6f8cbb..4ffdf2440b 100644 --- a/gen/bigquery2-cli/src/main.rs +++ b/gen/bigquery2-cli/src/main.rs @@ -706,30 +706,32 @@ impl<'n> Engine<'n> { "statistics.creation-time" => Some(("statistics.creationTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "statistics.total-bytes-processed" => Some(("statistics.totalBytesProcessed", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "statistics.start-time" => Some(("statistics.startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "statistics.query.statement-type" => Some(("statistics.query.statementType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "statistics.query.total-bytes-billed" => Some(("statistics.query.totalBytesBilled", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "statistics.query.total-bytes-processed" => Some(("statistics.query.totalBytesProcessed", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "statistics.query.cache-hit" => Some(("statistics.query.cacheHit", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "statistics.query.billing-tier" => Some(("statistics.query.billingTier", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "statistics.query.total-bytes-billed" => Some(("statistics.query.totalBytesBilled", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "statistics.query.num-dml-affected-rows" => Some(("statistics.query.numDmlAffectedRows", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "statistics.query.total-bytes-processed" => Some(("statistics.query.totalBytesProcessed", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "statistics.end-time" => Some(("statistics.endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "statistics.extract.destination-uri-file-counts" => Some(("statistics.extract.destinationUriFileCounts", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), "job-reference.project-id" => Some(("jobReference.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-reference.job-id" => Some(("jobReference.jobId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "user-email" => Some(("user_email", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "configuration.load.skip-leading-rows" => Some(("configuration.load.skipLeadingRows", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "configuration.load.schema-update-options" => Some(("configuration.load.schemaUpdateOptions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "configuration.load.encoding" => Some(("configuration.load.encoding", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "configuration.load.ignore-unknown-values" => Some(("configuration.load.ignoreUnknownValues", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "configuration.load.quote" => Some(("configuration.load.quote", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "configuration.load.skip-leading-rows" => Some(("configuration.load.skipLeadingRows", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "configuration.load.autodetect" => Some(("configuration.load.autodetect", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "configuration.load.destination-table.project-id" => Some(("configuration.load.destinationTable.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "configuration.load.destination-table.table-id" => Some(("configuration.load.destinationTable.tableId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "configuration.load.destination-table.dataset-id" => Some(("configuration.load.destinationTable.datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "configuration.load.max-bad-records" => Some(("configuration.load.maxBadRecords", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "configuration.load.schema-update-options" => Some(("configuration.load.schemaUpdateOptions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "configuration.load.null-marker" => Some(("configuration.load.nullMarker", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "configuration.load.allow-jagged-rows" => Some(("configuration.load.allowJaggedRows", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "configuration.load.write-disposition" => Some(("configuration.load.writeDisposition", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "configuration.load.source-uris" => Some(("configuration.load.sourceUris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "configuration.load.quote" => Some(("configuration.load.quote", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "configuration.load.field-delimiter" => Some(("configuration.load.fieldDelimiter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "configuration.load.create-disposition" => Some(("configuration.load.createDisposition", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "configuration.load.schema-inline-format" => Some(("configuration.load.schemaInlineFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -737,24 +739,8 @@ impl<'n> Engine<'n> { "configuration.load.allow-quoted-newlines" => Some(("configuration.load.allowQuotedNewlines", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "configuration.load.projection-fields" => Some(("configuration.load.projectionFields", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "configuration.load.source-format" => Some(("configuration.load.sourceFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "configuration.extract.destination-uri" => Some(("configuration.extract.destinationUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "configuration.extract.compression" => Some(("configuration.extract.compression", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "configuration.extract.field-delimiter" => Some(("configuration.extract.fieldDelimiter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "configuration.extract.destination-format" => Some(("configuration.extract.destinationFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "configuration.extract.print-header" => Some(("configuration.extract.printHeader", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "configuration.extract.destination-uris" => Some(("configuration.extract.destinationUris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "configuration.extract.source-table.project-id" => Some(("configuration.extract.sourceTable.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "configuration.extract.source-table.table-id" => Some(("configuration.extract.sourceTable.tableId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "configuration.extract.source-table.dataset-id" => Some(("configuration.extract.sourceTable.datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "configuration.copy.create-disposition" => Some(("configuration.copy.createDisposition", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "configuration.copy.write-disposition" => Some(("configuration.copy.writeDisposition", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "configuration.copy.destination-table.project-id" => Some(("configuration.copy.destinationTable.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "configuration.copy.destination-table.table-id" => Some(("configuration.copy.destinationTable.tableId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "configuration.copy.destination-table.dataset-id" => Some(("configuration.copy.destinationTable.datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "configuration.copy.source-table.project-id" => Some(("configuration.copy.sourceTable.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "configuration.copy.source-table.table-id" => Some(("configuration.copy.sourceTable.tableId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "configuration.copy.source-table.dataset-id" => Some(("configuration.copy.sourceTable.datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "configuration.dry-run" => Some(("configuration.dryRun", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "configuration.labels" => Some(("configuration.labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "configuration.query.flatten-results" => Some(("configuration.query.flattenResults", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "configuration.query.maximum-billing-tier" => Some(("configuration.query.maximumBillingTier", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "configuration.query.use-query-cache" => Some(("configuration.query.useQueryCache", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -773,10 +759,27 @@ impl<'n> Engine<'n> { "configuration.query.preserve-nulls" => Some(("configuration.query.preserveNulls", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "configuration.query.maximum-bytes-billed" => Some(("configuration.query.maximumBytesBilled", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "configuration.query.parameter-mode" => Some(("configuration.query.parameterMode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "configuration.copy.create-disposition" => Some(("configuration.copy.createDisposition", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "configuration.copy.write-disposition" => Some(("configuration.copy.writeDisposition", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "configuration.copy.destination-table.project-id" => Some(("configuration.copy.destinationTable.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "configuration.copy.destination-table.table-id" => Some(("configuration.copy.destinationTable.tableId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "configuration.copy.destination-table.dataset-id" => Some(("configuration.copy.destinationTable.datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "configuration.copy.source-table.project-id" => Some(("configuration.copy.sourceTable.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "configuration.copy.source-table.table-id" => Some(("configuration.copy.sourceTable.tableId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "configuration.copy.source-table.dataset-id" => Some(("configuration.copy.sourceTable.datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "configuration.extract.destination-uri" => Some(("configuration.extract.destinationUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "configuration.extract.compression" => Some(("configuration.extract.compression", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "configuration.extract.field-delimiter" => Some(("configuration.extract.fieldDelimiter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "configuration.extract.destination-format" => Some(("configuration.extract.destinationFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "configuration.extract.print-header" => Some(("configuration.extract.printHeader", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "configuration.extract.destination-uris" => Some(("configuration.extract.destinationUris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "configuration.extract.source-table.project-id" => Some(("configuration.extract.sourceTable.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "configuration.extract.source-table.table-id" => Some(("configuration.extract.sourceTable.tableId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "configuration.extract.source-table.dataset-id" => Some(("configuration.extract.sourceTable.datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["allow-jagged-rows", "allow-large-results", "allow-quoted-newlines", "autodetect", "billing-tier", "cache-hit", "compression", "configuration", "copy", "create-disposition", "creation-time", "dataset-id", "debug-info", "default-dataset", "destination-format", "destination-table", "destination-uri", "destination-uri-file-counts", "destination-uris", "dry-run", "encoding", "end-time", "error-result", "etag", "extract", "field-delimiter", "flatten-results", "id", "ignore-unknown-values", "input-file-bytes", "input-files", "job-id", "job-reference", "kind", "load", "location", "max-bad-records", "maximum-billing-tier", "maximum-bytes-billed", "message", "num-dml-affected-rows", "output-bytes", "output-rows", "parameter-mode", "preserve-nulls", "print-header", "priority", "project-id", "projection-fields", "query", "quote", "reason", "schema-inline", "schema-inline-format", "schema-update-options", "self-link", "skip-leading-rows", "source-format", "source-table", "source-uris", "start-time", "state", "statistics", "status", "table-id", "total-bytes-billed", "total-bytes-processed", "use-legacy-sql", "use-query-cache", "user-email", "write-disposition"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["allow-jagged-rows", "allow-large-results", "allow-quoted-newlines", "autodetect", "billing-tier", "cache-hit", "compression", "configuration", "copy", "create-disposition", "creation-time", "dataset-id", "debug-info", "default-dataset", "destination-format", "destination-table", "destination-uri", "destination-uri-file-counts", "destination-uris", "dry-run", "encoding", "end-time", "error-result", "etag", "extract", "field-delimiter", "flatten-results", "id", "ignore-unknown-values", "input-file-bytes", "input-files", "job-id", "job-reference", "kind", "labels", "load", "location", "max-bad-records", "maximum-billing-tier", "maximum-bytes-billed", "message", "null-marker", "num-dml-affected-rows", "output-bytes", "output-rows", "parameter-mode", "preserve-nulls", "print-header", "priority", "project-id", "projection-fields", "query", "quote", "reason", "schema-inline", "schema-inline-format", "schema-update-options", "self-link", "skip-leading-rows", "source-format", "source-table", "source-uris", "start-time", "state", "statement-type", "statistics", "status", "table-id", "total-bytes-billed", "total-bytes-processed", "use-legacy-sql", "use-query-cache", "user-email", "write-disposition"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1337,6 +1340,7 @@ impl<'n> Engine<'n> { "streaming-buffer.estimated-bytes" => Some(("streamingBuffer.estimatedBytes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "streaming-buffer.estimated-rows" => Some(("streamingBuffer.estimatedRows", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "streaming-buffer.oldest-entry-time" => Some(("streamingBuffer.oldestEntryTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "creation-time" => Some(("creationTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "table-reference.project-id" => Some(("tableReference.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "table-reference.table-id" => Some(("tableReference.tableId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1371,7 +1375,7 @@ impl<'n> Engine<'n> { "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "num-long-term-bytes" => Some(("numLongTermBytes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["allow-jagged-rows", "allow-quoted-newlines", "autodetect", "bigtable-options", "compression", "creation-time", "csv-options", "dataset-id", "description", "encoding", "estimated-bytes", "estimated-rows", "etag", "expiration-ms", "expiration-time", "external-data-configuration", "field-delimiter", "friendly-name", "google-sheets-options", "id", "ignore-unknown-values", "ignore-unspecified-column-families", "kind", "last-modified-time", "location", "max-bad-records", "num-bytes", "num-long-term-bytes", "num-rows", "oldest-entry-time", "project-id", "query", "quote", "read-rowkey-as-string", "self-link", "skip-leading-rows", "source-format", "source-uris", "streaming-buffer", "table-id", "table-reference", "time-partitioning", "type", "use-legacy-sql", "view"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["allow-jagged-rows", "allow-quoted-newlines", "autodetect", "bigtable-options", "compression", "creation-time", "csv-options", "dataset-id", "description", "encoding", "estimated-bytes", "estimated-rows", "etag", "expiration-ms", "expiration-time", "external-data-configuration", "field-delimiter", "friendly-name", "google-sheets-options", "id", "ignore-unknown-values", "ignore-unspecified-column-families", "kind", "labels", "last-modified-time", "location", "max-bad-records", "num-bytes", "num-long-term-bytes", "num-rows", "oldest-entry-time", "project-id", "query", "quote", "read-rowkey-as-string", "self-link", "skip-leading-rows", "source-format", "source-uris", "streaming-buffer", "table-id", "table-reference", "time-partitioning", "type", "use-legacy-sql", "view"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1519,6 +1523,7 @@ impl<'n> Engine<'n> { "streaming-buffer.estimated-bytes" => Some(("streamingBuffer.estimatedBytes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "streaming-buffer.estimated-rows" => Some(("streamingBuffer.estimatedRows", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "streaming-buffer.oldest-entry-time" => Some(("streamingBuffer.oldestEntryTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "creation-time" => Some(("creationTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "table-reference.project-id" => Some(("tableReference.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "table-reference.table-id" => Some(("tableReference.tableId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1553,7 +1558,7 @@ impl<'n> Engine<'n> { "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "num-long-term-bytes" => Some(("numLongTermBytes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["allow-jagged-rows", "allow-quoted-newlines", "autodetect", "bigtable-options", "compression", "creation-time", "csv-options", "dataset-id", "description", "encoding", "estimated-bytes", "estimated-rows", "etag", "expiration-ms", "expiration-time", "external-data-configuration", "field-delimiter", "friendly-name", "google-sheets-options", "id", "ignore-unknown-values", "ignore-unspecified-column-families", "kind", "last-modified-time", "location", "max-bad-records", "num-bytes", "num-long-term-bytes", "num-rows", "oldest-entry-time", "project-id", "query", "quote", "read-rowkey-as-string", "self-link", "skip-leading-rows", "source-format", "source-uris", "streaming-buffer", "table-id", "table-reference", "time-partitioning", "type", "use-legacy-sql", "view"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["allow-jagged-rows", "allow-quoted-newlines", "autodetect", "bigtable-options", "compression", "creation-time", "csv-options", "dataset-id", "description", "encoding", "estimated-bytes", "estimated-rows", "etag", "expiration-ms", "expiration-time", "external-data-configuration", "field-delimiter", "friendly-name", "google-sheets-options", "id", "ignore-unknown-values", "ignore-unspecified-column-families", "kind", "labels", "last-modified-time", "location", "max-bad-records", "num-bytes", "num-long-term-bytes", "num-rows", "oldest-entry-time", "project-id", "query", "quote", "read-rowkey-as-string", "self-link", "skip-leading-rows", "source-format", "source-uris", "streaming-buffer", "table-id", "table-reference", "time-partitioning", "type", "use-legacy-sql", "view"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1642,6 +1647,7 @@ impl<'n> Engine<'n> { "streaming-buffer.estimated-bytes" => Some(("streamingBuffer.estimatedBytes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "streaming-buffer.estimated-rows" => Some(("streamingBuffer.estimatedRows", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "streaming-buffer.oldest-entry-time" => Some(("streamingBuffer.oldestEntryTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "creation-time" => Some(("creationTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "table-reference.project-id" => Some(("tableReference.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "table-reference.table-id" => Some(("tableReference.tableId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1676,7 +1682,7 @@ impl<'n> Engine<'n> { "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "num-long-term-bytes" => Some(("numLongTermBytes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["allow-jagged-rows", "allow-quoted-newlines", "autodetect", "bigtable-options", "compression", "creation-time", "csv-options", "dataset-id", "description", "encoding", "estimated-bytes", "estimated-rows", "etag", "expiration-ms", "expiration-time", "external-data-configuration", "field-delimiter", "friendly-name", "google-sheets-options", "id", "ignore-unknown-values", "ignore-unspecified-column-families", "kind", "last-modified-time", "location", "max-bad-records", "num-bytes", "num-long-term-bytes", "num-rows", "oldest-entry-time", "project-id", "query", "quote", "read-rowkey-as-string", "self-link", "skip-leading-rows", "source-format", "source-uris", "streaming-buffer", "table-id", "table-reference", "time-partitioning", "type", "use-legacy-sql", "view"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["allow-jagged-rows", "allow-quoted-newlines", "autodetect", "bigtable-options", "compression", "creation-time", "csv-options", "dataset-id", "description", "encoding", "estimated-bytes", "estimated-rows", "etag", "expiration-ms", "expiration-time", "external-data-configuration", "field-delimiter", "friendly-name", "google-sheets-options", "id", "ignore-unknown-values", "ignore-unspecified-column-families", "kind", "labels", "last-modified-time", "location", "max-bad-records", "num-bytes", "num-long-term-bytes", "num-rows", "oldest-entry-time", "project-id", "query", "quote", "read-rowkey-as-string", "self-link", "skip-leading-rows", "source-format", "source-uris", "streaming-buffer", "table-id", "table-reference", "time-partitioning", "type", "use-legacy-sql", "view"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -2576,7 +2582,7 @@ fn main() { let mut app = App::new("bigquery2") .author("Sebastian Thiel ") - .version("1.0.0+20160903") + .version("1.0.0+20161130") .about("A data platform for customers to create, manage, share and query data.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_bigquery2_cli") .arg(Arg::with_name("url") diff --git a/gen/bigquery2/Cargo.toml b/gen/bigquery2/Cargo.toml index 6ae6a5b294..12fc849b6b 100644 --- a/gen/bigquery2/Cargo.toml +++ b/gen/bigquery2/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-bigquery2" -version = "1.0.0+20160903" +version = "1.0.0+20161130" authors = ["Sebastian Thiel "] description = "A complete library to interact with bigquery (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/bigquery2" diff --git a/gen/bigquery2/README.md b/gen/bigquery2/README.md index e26ebf52f8..6c64a24648 100644 --- a/gen/bigquery2/README.md +++ b/gen/bigquery2/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-bigquery2` library allows access to all features of the *Google bigquery* service. -This documentation was generated from *bigquery* crate version *1.0.0+20160903*, where *20160903* is the exact revision of the *bigquery:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *bigquery* crate version *1.0.0+20161130*, where *20161130* is the exact revision of the *bigquery:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *bigquery* *v2* API can be found at the [official documentation site](https://cloud.google.com/bigquery/). diff --git a/gen/bigquery2/src/lib.rs b/gen/bigquery2/src/lib.rs index 64a32eb885..aefaa3bd1b 100644 --- a/gen/bigquery2/src/lib.rs +++ b/gen/bigquery2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *bigquery* crate version *1.0.0+20160903*, where *20160903* is the exact revision of the *bigquery:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *bigquery* crate version *1.0.0+20161130*, where *20161130* is the exact revision of the *bigquery:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *bigquery* *v2* API can be found at the //! [official documentation site](https://cloud.google.com/bigquery/). diff --git a/gen/bigquery2/src/lib.rs.in b/gen/bigquery2/src/lib.rs.in index 8d8ba8c4a5..57b7f75f57 100644 --- a/gen/bigquery2/src/lib.rs.in +++ b/gen/bigquery2/src/lib.rs.in @@ -255,7 +255,7 @@ pub struct QueryRequest { /// [Optional] Specifies the default datasetId and projectId to assume for any unqualified table names in the query. If not set, all table names in the query string must be qualified in the format 'datasetId.tableId'. #[serde(rename="defaultDataset")] pub default_dataset: Option, - /// [Experimental] Specifies whether to use BigQuery's legacy SQL dialect for this query. The default value is true. If set to false, the query will use BigQuery's standard SQL: https://cloud.google.com/bigquery/sql-reference/ When useLegacySql is set to false, the values of allowLargeResults and flattenResults are ignored; query will be run as if allowLargeResults is true and flattenResults is false. + /// Specifies whether to use BigQuery's legacy SQL dialect for this query. The default value is true. If set to false, the query will use BigQuery's standard SQL: https://cloud.google.com/bigquery/sql-reference/ When useLegacySql is set to false, the values of allowLargeResults and flattenResults are ignored; query will be run as if allowLargeResults is true and flattenResults is false. #[serde(rename="useLegacySql")] pub use_legacy_sql: Option, /// [Optional] The maximum number of rows of data to return per page of results. Setting this flag to a small value such as 1000 and then paging through results might improve reliability when the query result set is large. In addition to this limit, responses are also limited to 10 MB. By default, there is no maximum row count, and only the byte limit applies. @@ -283,6 +283,9 @@ pub struct JobStatistics2 { /// [Output-only, Experimental] Describes execution plan for the query. #[serde(rename="queryPlan")] pub query_plan: Option>, + /// [Output-only, Experimental] The type of query statement, if valid. + #[serde(rename="statementType")] + pub statement_type: Option, /// [Output-only] Total bytes billed for the job. #[serde(rename="totalBytesBilled")] pub total_bytes_billed: Option, @@ -382,7 +385,7 @@ pub struct TableFieldSchema { pub fields: Option>, /// [Optional] The field description. The maximum length is 16K characters. pub description: Option, - /// [Required] The field data type. Possible values include STRING, BYTES, INTEGER, FLOAT, BOOLEAN, TIMESTAMP or RECORD (where RECORD indicates that the field contains a nested schema). + /// [Required] The field data type. Possible values include STRING, BYTES, INTEGER, INT64 (same as INTEGER), FLOAT, FLOAT64 (same as FLOAT), BOOLEAN, BOOL (same as BOOLEAN), TIMESTAMP, DATE, TIME, DATETIME, RECORD (where RECORD indicates that the field contains a nested schema) or STRUCT (same as RECORD). #[serde(rename="type")] pub type_: Option, /// [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE. @@ -665,19 +668,21 @@ impl Part for UserDefinedFunctionResource {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TableListTables { + /// The resource type. + pub kind: Option, /// The user-friendly name for this table. #[serde(rename="friendlyName")] pub friendly_name: Option, - /// The resource type. - pub kind: Option, + /// [Experimental] The labels associated with this table. You can use these to organize and group your tables. + pub labels: Option>, /// The type of table. Possible values are: TABLE, VIEW. #[serde(rename="type")] pub type_: Option, - /// An opaque ID of the table - pub id: Option, /// A reference uniquely identifying the table. #[serde(rename="tableReference")] pub table_reference: Option, + /// An opaque ID of the table + pub id: Option, } impl NestedType for TableListTables {} @@ -854,8 +859,9 @@ impl Part for TimePartitioning {} pub struct JobConfigurationLoad { /// [Optional] The character encoding of the data. The supported values are UTF-8 or ISO-8859-1. The default value is UTF-8. BigQuery decodes the data after the raw, binary data has been split using the values of the quote and fieldDelimiter properties. pub encoding: Option, - /// [Optional] The value that is used to quote data sections in a CSV file. BigQuery converts the string to ISO-8859-1 encoding, and then uses the first byte of the encoded string to split the data in its raw, binary state. The default value is a double-quote ('"'). If your data does not contain quoted sections, set the property value to an empty string. If your data contains quoted newline characters, you must also set the allowQuotedNewlines property to true. - pub quote: Option, + /// [Optional] The number of rows at the top of a CSV file that BigQuery will skip when loading the data. The default value is 0. This property is useful if you have header rows in the file that should be skipped. + #[serde(rename="skipLeadingRows")] + pub skip_leading_rows: Option, /// [Experimental] Indicates if we should automatically infer the options and schema for CSV and JSON sources. pub autodetect: Option, /// [Required] The destination table to load the data into. @@ -864,12 +870,15 @@ pub struct JobConfigurationLoad { /// [Required] The fully-qualified URIs that point to your data in Google Cloud Storage. Each URI can contain one '*' wildcard character and it must come after the 'bucket' name. #[serde(rename="sourceUris")] pub source_uris: Option>, - /// Indicates if BigQuery should allow quoted data sections that contain newline characters in a CSV file. The default value is false. - #[serde(rename="allowQuotedNewlines")] - pub allow_quoted_newlines: Option, + /// [Optional] This string will be interpreted as a null value when it appears in a CSV file. The default value is the empty string. Please refer to the documentation for further information. + #[serde(rename="nullMarker")] + pub null_marker: Option, /// [Experimental] If sourceFormat is set to "DATASTORE_BACKUP", indicates which entity properties to load into BigQuery from a Cloud Datastore backup. Property names are case sensitive and must be top-level properties. If no properties are specified, BigQuery loads all properties. If any named property isn't found in the Cloud Datastore backup, an invalid error is returned in the job result. #[serde(rename="projectionFields")] pub projection_fields: Option>, + /// Indicates if BigQuery should allow quoted data sections that contain newline characters in a CSV file. The default value is false. + #[serde(rename="allowQuotedNewlines")] + pub allow_quoted_newlines: Option, /// [Optional] Accept rows that are missing trailing optional columns. The missing values are treated as nulls. If false, records with missing trailing columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. Only applicable to CSV, ignored for other formats. #[serde(rename="allowJaggedRows")] pub allow_jagged_rows: Option, @@ -891,9 +900,8 @@ pub struct JobConfigurationLoad { /// [Optional] Specifies the action that occurs if the destination table already exists. The following values are supported: WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data. WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. The default value is WRITE_APPEND. Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion. #[serde(rename="writeDisposition")] pub write_disposition: Option, - /// [Optional] The number of rows at the top of a CSV file that BigQuery will skip when loading the data. The default value is 0. This property is useful if you have header rows in the file that should be skipped. - #[serde(rename="skipLeadingRows")] - pub skip_leading_rows: Option, + /// [Optional] The value that is used to quote data sections in a CSV file. BigQuery converts the string to ISO-8859-1 encoding, and then uses the first byte of the encoded string to split the data in its raw, binary state. The default value is a double-quote ('"'). If your data does not contain quoted sections, set the property value to an empty string. If your data contains quoted newline characters, you must also set the allowQuotedNewlines property to true. + pub quote: Option, /// [Optional] Specifies whether the job is allowed to create new tables. The following values are supported: CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table. CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result. The default value is CREATE_IF_NEEDED. Creation, truncation and append actions occur as one atomic update upon job completion. #[serde(rename="createDisposition")] pub create_disposition: Option, @@ -1141,7 +1149,7 @@ impl Part for ErrorProto {} pub struct ViewDefinition { /// [Required] A query that BigQuery executes when the view is referenced. pub query: Option, - /// [Experimental] Specifies whether to use BigQuery's legacy SQL for this view. The default value is true. If set to false, the view will use BigQuery's standard SQL: https://cloud.google.com/bigquery/sql-reference/ Queries and views that reference this view must use the same flag value. + /// Specifies whether to use BigQuery's legacy SQL for this view. The default value is true. If set to false, the view will use BigQuery's standard SQL: https://cloud.google.com/bigquery/sql-reference/ Queries and views that reference this view must use the same flag value. #[serde(rename="useLegacySql")] pub use_legacy_sql: Option, /// [Experimental] Describes user-defined function resources used in the query. @@ -1345,7 +1353,7 @@ pub struct JobConfigurationQuery { /// [Optional] Describes the table where the query results should be stored. If not present, a new table will be created to store the results. #[serde(rename="destinationTable")] pub destination_table: Option, - /// [Experimental] Query parameters for Standard SQL queries. + /// Query parameters for standard SQL queries. #[serde(rename="queryParameters")] pub query_parameters: Option>, /// [Required] BigQuery SQL query to execute. @@ -1365,10 +1373,10 @@ pub struct JobConfigurationQuery { /// [Optional] Specifies the default dataset to use for unqualified table names in the query. #[serde(rename="defaultDataset")] pub default_dataset: Option, - /// [Experimental] Specifies whether to use BigQuery's legacy SQL dialect for this query. The default value is true. If set to false, the query will use BigQuery's standard SQL: https://cloud.google.com/bigquery/sql-reference/ When useLegacySql is set to false, the values of allowLargeResults and flattenResults are ignored; query will be run as if allowLargeResults is true and flattenResults is false. + /// Specifies whether to use BigQuery's legacy SQL dialect for this query. The default value is true. If set to false, the query will use BigQuery's standard SQL: https://cloud.google.com/bigquery/sql-reference/ When useLegacySql is set to false, the values of allowLargeResults and flattenResults are ignored; query will be run as if allowLargeResults is true and flattenResults is false. #[serde(rename="useLegacySql")] pub use_legacy_sql: Option, - /// [Experimental] Allows the schema of the desitination table to be updated as a side effect of the query job. Schema update options are supported in two cases: when writeDisposition is WRITE_APPEND; when writeDisposition is WRITE_TRUNCATE and the destination table is a partition of a table, specified by partition decorators. For normal tables, WRITE_TRUNCATE will always overwrite the schema. One or more of the following values are specified: ALLOW_FIELD_ADDITION: allow adding a nullable field to the schema. ALLOW_FIELD_RELAXATION: allow relaxing a required field in the original schema to nullable. + /// [Experimental] Allows the schema of the destination table to be updated as a side effect of the query job. Schema update options are supported in two cases: when writeDisposition is WRITE_APPEND; when writeDisposition is WRITE_TRUNCATE and the destination table is a partition of a table, specified by partition decorators. For normal tables, WRITE_TRUNCATE will always overwrite the schema. One or more of the following values are specified: ALLOW_FIELD_ADDITION: allow adding a nullable field to the schema. ALLOW_FIELD_RELAXATION: allow relaxing a required field in the original schema to nullable. #[serde(rename="schemaUpdateOptions")] pub schema_update_options: Option>, /// [Optional] Specifies a priority for the query. Possible values include INTERACTIVE and BATCH. The default value is INTERACTIVE. @@ -1431,15 +1439,17 @@ impl Part for TableRow {} pub struct JobConfiguration { /// [Pick one] Configures a load job. pub load: Option, + /// [Pick one] Copies a table. + pub copy: Option, /// [Optional] If set, don't actually run this job. A valid query will return a mostly empty response with some processing statistics, while an invalid query will return the same error it would if it wasn't a dry run. Behavior of non-query jobs is undefined. #[serde(rename="dryRun")] pub dry_run: Option, - /// [Pick one] Copies a table. - pub copy: Option, - /// [Pick one] Configures an extract job. - pub extract: Option, /// [Pick one] Configures a query job. pub query: Option, + /// [Experimental] The labels associated with this job. You can use these to organize and group your jobs. Label keys and values can be no longer than 63 characters, can only contain letters, numeric characters, underscores and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter and must be unique within a dataset. Both keys and values are additionally constrained to be <= 128 bytes in size. + pub labels: Option>, + /// [Pick one] Configures an extract job. + pub extract: Option, } impl Part for JobConfiguration {} @@ -1585,6 +1595,8 @@ pub struct Table { /// [Output-only] The time when this table was created, in milliseconds since the epoch. #[serde(rename="creationTime")] pub creation_time: Option, + /// [Experimental] The labels associated with this table. You can use these to organize and group your tables. Label keys and values can be no longer than 63 characters, can only contain letters, numeric characters, underscores and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter and must be unique within a dataset. Both keys and values are additionally constrained to be <= 128 bytes in size. + pub labels: Option>, /// [Output-only] The size of this table in bytes, excluding any data in the streaming buffer. #[serde(rename="numBytes")] pub num_bytes: Option, diff --git a/gen/books1-cli/Cargo.toml b/gen/books1-cli/Cargo.toml index 6fa0840fdb..e41c808903 100644 --- a/gen/books1-cli/Cargo.toml +++ b/gen/books1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-books1-cli" -version = "1.0.0+20160823" +version = "1.0.0+20161206" authors = ["Sebastian Thiel "] description = "A complete library to interact with books (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/books1-cli" diff --git a/gen/books1-cli/README.md b/gen/books1-cli/README.md index 66c0bf947f..ac74a2b03b 100644 --- a/gen/books1-cli/README.md +++ b/gen/books1-cli/README.md @@ -24,7 +24,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *books* API at revision *20160823*. The CLI is at version *1.0.0*. +This documentation was generated from the *books* API at revision *20161206*. The CLI is at version *1.0.0*. ```bash books1 [options] diff --git a/gen/books1-cli/mkdocs.yml b/gen/books1-cli/mkdocs.yml index e3aad683d7..418f6b0dec 100644 --- a/gen/books1-cli/mkdocs.yml +++ b/gen/books1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: books v1.0.0+20160823 +site_name: books v1.0.0+20161206 site_url: http://byron.github.io/google-apis-rs/google-books1-cli site_description: Write integrating applications with bcore diff --git a/gen/books1-cli/src/main.rs b/gen/books1-cli/src/main.rs index 975524ea20..a2e8169359 100644 --- a/gen/books1-cli/src/main.rs +++ b/gen/books1-cli/src/main.rs @@ -4701,7 +4701,7 @@ fn main() { let mut app = App::new("books1") .author("Sebastian Thiel ") - .version("1.0.0+20160823") + .version("1.0.0+20161206") .about("Searches for books and manages your Google Books library.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_books1_cli") .arg(Arg::with_name("url") diff --git a/gen/books1/Cargo.toml b/gen/books1/Cargo.toml index 1125f0ae71..affffe7904 100644 --- a/gen/books1/Cargo.toml +++ b/gen/books1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-books1" -version = "1.0.0+20160823" +version = "1.0.0+20161206" authors = ["Sebastian Thiel "] description = "A complete library to interact with books (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/books1" diff --git a/gen/books1/README.md b/gen/books1/README.md index e80cf222db..dc7ac1c27e 100644 --- a/gen/books1/README.md +++ b/gen/books1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-books1` library allows access to all features of the *Google books* service. -This documentation was generated from *books* crate version *1.0.0+20160823*, where *20160823* is the exact revision of the *books:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *books* crate version *1.0.0+20161206*, where *20161206* is the exact revision of the *books:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *books* *v1* API can be found at the [official documentation site](https://developers.google.com/books/docs/v1/getting_started). diff --git a/gen/books1/src/lib.rs b/gen/books1/src/lib.rs index 2bdc96b147..4ac0c9c1d3 100644 --- a/gen/books1/src/lib.rs +++ b/gen/books1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *books* crate version *1.0.0+20160823*, where *20160823* is the exact revision of the *books:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *books* crate version *1.0.0+20161206*, where *20161206* is the exact revision of the *books:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *books* *v1* API can be found at the //! [official documentation site](https://developers.google.com/books/docs/v1/getting_started). diff --git a/gen/books1/src/lib.rs.in b/gen/books1/src/lib.rs.in index 187d2cf896..8b60aa0f62 100644 --- a/gen/books1/src/lib.rs.in +++ b/gen/books1/src/lib.rs.in @@ -525,6 +525,9 @@ pub struct Notification { /// no description provided pub reason: Option, /// no description provided + #[serde(rename="notificationGroup")] + pub notification_group: Option, + /// no description provided #[serde(rename="targetUrl")] pub target_url: Option, /// no description provided diff --git a/gen/calendar3-cli/Cargo.toml b/gen/calendar3-cli/Cargo.toml index 195a1af8a6..5868f8c25b 100644 --- a/gen/calendar3-cli/Cargo.toml +++ b/gen/calendar3-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-calendar3-cli" -version = "1.0.0+20160830" +version = "1.0.0+20161211" authors = ["Sebastian Thiel "] description = "A complete library to interact with calendar (protocol v3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/calendar3-cli" diff --git a/gen/calendar3-cli/README.md b/gen/calendar3-cli/README.md index 9f8b0a9075..86e7ec3ccc 100644 --- a/gen/calendar3-cli/README.md +++ b/gen/calendar3-cli/README.md @@ -24,7 +24,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *calendar* API at revision *20160830*. The CLI is at version *1.0.0*. +This documentation was generated from the *calendar* API at revision *20161211*. The CLI is at version *1.0.0*. ```bash calendar3 [options] diff --git a/gen/calendar3-cli/mkdocs.yml b/gen/calendar3-cli/mkdocs.yml index 6dc6cd0d70..575d136f16 100644 --- a/gen/calendar3-cli/mkdocs.yml +++ b/gen/calendar3-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: calendar v1.0.0+20160830 +site_name: calendar v1.0.0+20161211 site_url: http://byron.github.io/google-apis-rs/google-calendar3-cli site_description: Write integrating applications with bcore diff --git a/gen/calendar3-cli/src/main.rs b/gen/calendar3-cli/src/main.rs index 01baf777c5..68297dd8b6 100644 --- a/gen/calendar3-cli/src/main.rs +++ b/gen/calendar3-cli/src/main.rs @@ -4385,7 +4385,7 @@ fn main() { let mut app = App::new("calendar3") .author("Sebastian Thiel ") - .version("1.0.0+20160830") + .version("1.0.0+20161211") .about("Manipulates events and other calendar data.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_calendar3_cli") .arg(Arg::with_name("url") diff --git a/gen/calendar3/Cargo.toml b/gen/calendar3/Cargo.toml index 0041185c09..32d2d5187a 100644 --- a/gen/calendar3/Cargo.toml +++ b/gen/calendar3/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-calendar3" -version = "1.0.0+20160830" +version = "1.0.0+20161211" authors = ["Sebastian Thiel "] description = "A complete library to interact with calendar (protocol v3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/calendar3" diff --git a/gen/calendar3/README.md b/gen/calendar3/README.md index 84ec550ba9..9381394fd9 100644 --- a/gen/calendar3/README.md +++ b/gen/calendar3/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-calendar3` library allows access to all features of the *Google calendar* service. -This documentation was generated from *calendar* crate version *1.0.0+20160830*, where *20160830* is the exact revision of the *calendar:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *calendar* crate version *1.0.0+20161211*, where *20161211* is the exact revision of the *calendar:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *calendar* *v3* API can be found at the [official documentation site](https://developers.google.com/google-apps/calendar/firstapp). diff --git a/gen/calendar3/src/lib.rs b/gen/calendar3/src/lib.rs index 2d329815ec..65509ca131 100644 --- a/gen/calendar3/src/lib.rs +++ b/gen/calendar3/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *calendar* crate version *1.0.0+20160830*, where *20160830* is the exact revision of the *calendar:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *calendar* crate version *1.0.0+20161211*, where *20161211* is the exact revision of the *calendar:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *calendar* *v3* API can be found at the //! [official documentation site](https://developers.google.com/google-apps/calendar/firstapp). diff --git a/gen/civicinfo2-cli/Cargo.toml b/gen/civicinfo2-cli/Cargo.toml index b1c10612ad..b2ec0c7a25 100644 --- a/gen/civicinfo2-cli/Cargo.toml +++ b/gen/civicinfo2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-civicinfo2-cli" -version = "1.0.0+20160823" +version = "1.0.0+20161102" authors = ["Sebastian Thiel "] description = "A complete library to interact with Civic Info (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/civicinfo2-cli" diff --git a/gen/civicinfo2/Cargo.toml b/gen/civicinfo2/Cargo.toml index 8c2b36170b..72e85b27f1 100644 --- a/gen/civicinfo2/Cargo.toml +++ b/gen/civicinfo2/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-civicinfo2" -version = "1.0.0+20160823" +version = "1.0.0+20161102" authors = ["Sebastian Thiel "] description = "A complete library to interact with Civic Info (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/civicinfo2" diff --git a/gen/civicinfo2/README.md b/gen/civicinfo2/README.md index 3f51822e2f..6ebc4232ae 100644 --- a/gen/civicinfo2/README.md +++ b/gen/civicinfo2/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-civicinfo2` library allows access to all features of the *Google Civic Info* service. -This documentation was generated from *Civic Info* crate version *1.0.0+20160823*, where *20160823* is the exact revision of the *civicinfo:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *Civic Info* crate version *1.0.0+20161102*, where *20161102* is the exact revision of the *civicinfo:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *Civic Info* *v2* API can be found at the [official documentation site](https://developers.google.com/civic-information). @@ -77,6 +77,7 @@ google-civicinfo2 = "*" extern crate hyper; extern crate yup_oauth2 as oauth2; extern crate google_civicinfo2 as civicinfo2; +use civicinfo2::VoterInfoRequest; use civicinfo2::{Result, Error}; use std::default::Default; use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -94,10 +95,15 @@ let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, hyper::Client::new(), ::default(), None); let mut hub = CivicInfo::new(hyper::Client::new(), auth); +// As the method needs a request, you would usually fill it with the desired information +// into the respective structure. Some of the parts shown here might not be applicable ! +// Values shown here are possibly random and not representative ! +let mut req = VoterInfoRequest::default(); + // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! -let result = hub.elections().voter_info_query("address") +let result = hub.elections().voter_info_query(req, "address") .return_all_available_data(true) .official_only(false) .election_id("sed") diff --git a/gen/civicinfo2/src/lib.rs b/gen/civicinfo2/src/lib.rs index 597c2e0757..6fbc3e4c73 100644 --- a/gen/civicinfo2/src/lib.rs +++ b/gen/civicinfo2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Civic Info* crate version *1.0.0+20160823*, where *20160823* is the exact revision of the *civicinfo:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *Civic Info* crate version *1.0.0+20161102*, where *20161102* is the exact revision of the *civicinfo:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *Civic Info* *v2* API can be found at the //! [official documentation site](https://developers.google.com/civic-information). @@ -77,6 +77,7 @@ //! extern crate hyper; //! extern crate yup_oauth2 as oauth2; //! extern crate google_civicinfo2 as civicinfo2; +//! use civicinfo2::VoterInfoRequest; //! use civicinfo2::{Result, Error}; //! # #[test] fn egal() { //! use std::default::Default; @@ -95,10 +96,15 @@ //! hyper::Client::new(), //! ::default(), None); //! let mut hub = CivicInfo::new(hyper::Client::new(), auth); +//! // As the method needs a request, you would usually fill it with the desired information +//! // into the respective structure. Some of the parts shown here might not be applicable ! +//! // Values shown here are possibly random and not representative ! +//! let mut req = VoterInfoRequest::default(); +//! //! // You can configure optional parameters by calling the respective setters at will, and //! // execute the final call using `doit()`. //! // Values shown here are possibly random and not representative ! -//! let result = hub.elections().voter_info_query("address") +//! let result = hub.elections().voter_info_query(req, "address") //! .return_all_available_data(true) //! .official_only(true) //! .election_id("et") diff --git a/gen/civicinfo2/src/lib.rs.in b/gen/civicinfo2/src/lib.rs.in index 71d53120f1..645b82ed80 100644 --- a/gen/civicinfo2/src/lib.rs.in +++ b/gen/civicinfo2/src/lib.rs.in @@ -52,6 +52,7 @@ pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, /// extern crate hyper; /// extern crate yup_oauth2 as oauth2; /// extern crate google_civicinfo2 as civicinfo2; +/// use civicinfo2::VoterInfoRequest; /// use civicinfo2::{Result, Error}; /// # #[test] fn egal() { /// use std::default::Default; @@ -70,10 +71,15 @@ pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, /// hyper::Client::new(), /// ::default(), None); /// let mut hub = CivicInfo::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = VoterInfoRequest::default(); +/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.elections().voter_info_query("address") +/// let result = hub.elections().voter_info_query(req, "address") /// .return_all_available_data(true) /// .official_only(false) /// .election_id("accusam") @@ -141,6 +147,25 @@ impl<'a, C, A> CivicInfo // ############ // SCHEMAS ### // ########## +/// A search request for political geographies. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [search divisions](struct.DivisionSearchCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DivisionSearchRequest { + /// no description provided + #[serde(rename="contextParams")] + pub context_params: Option, +} + +impl RequestValue for DivisionSearchRequest {} + + /// Describes information about a regional election administrative area. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -211,24 +236,28 @@ pub struct ElectoralDistrict { impl Part for ElectoralDistrict {} -/// The result of a division search query. +/// Information about individual election officials. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [search divisions](struct.DivisionSearchCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DivisionSearchResponse { - /// Identifies what kind of resource this is. Value: the fixed string "civicinfo#divisionSearchResponse". - pub kind: Option, - /// no description provided - pub results: Option>, +pub struct ElectionOfficial { + /// The fax number of the election official. + #[serde(rename="faxNumber")] + pub fax_number: Option, + /// The email address of the election official. + #[serde(rename="emailAddress")] + pub email_address: Option, + /// The full name of the election official. + pub name: Option, + /// The office phone number of the election official. + #[serde(rename="officePhoneNumber")] + pub office_phone_number: Option, + /// The title of the election official. + pub title: Option, } -impl ResponseResult for DivisionSearchResponse {} +impl Part for ElectionOfficial {} /// Information about a candidate running for elected office. @@ -237,7 +266,7 @@ impl ResponseResult for DivisionSearchResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Candidate { - /// The candidate's name. + /// The candidate's name. If this is a joint ticket it will indicate the name of the candidate at the top of a ticket followed by a / and that name of candidate at the bottom of the ticket. e.g. "Mitt Romney / Paul Ryan" pub name: Option, /// A URL for a photo of the candidate. #[serde(rename="photoUrl")] @@ -383,6 +412,28 @@ pub struct RepresentativeInfoResponse { impl ResponseResult for RepresentativeInfoResponse {} +/// A request for information about a voter. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [voter info query elections](struct.ElectionVoterInfoQueryCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct VoterInfoRequest { + /// no description provided + #[serde(rename="voterInfoSegmentResult")] + pub voter_info_segment_result: Option, + /// no description provided + #[serde(rename="contextParams")] + pub context_params: Option, +} + +impl RequestValue for VoterInfoRequest {} + + /// Contains information about the data source for the element containing it. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -398,28 +449,142 @@ pub struct Source { impl Part for Source {} -/// Information about individual election officials. +/// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ElectionOfficial { - /// The fax number of the election official. - #[serde(rename="faxNumber")] - pub fax_number: Option, - /// The email address of the election official. - #[serde(rename="emailAddress")] - pub email_address: Option, - /// The full name of the election official. - pub name: Option, - /// The office phone number of the election official. - #[serde(rename="officePhoneNumber")] - pub office_phone_number: Option, - /// The title of the election official. - pub title: Option, +pub struct ContextParams { + /// no description provided + #[serde(rename="clientProfile")] + pub client_profile: Option, } -impl Part for ElectionOfficial {} +impl Part for ContextParams {} + + +/// The result of a division search query. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [search divisions](struct.DivisionSearchCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DivisionSearchResponse { + /// Identifies what kind of resource this is. Value: the fixed string "civicinfo#divisionSearchResponse". + pub kind: Option, + /// no description provided + pub results: Option>, +} + +impl ResponseResult for DivisionSearchResponse {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PostalAddress { + /// no description provided + #[serde(rename="languageCode")] + pub language_code: Option, + /// no description provided + #[serde(rename="dependentThoroughfareTrailingType")] + pub dependent_thoroughfare_trailing_type: Option, + /// no description provided + #[serde(rename="postalCodeNumber")] + pub postal_code_number: Option, + /// no description provided + #[serde(rename="dependentThoroughfaresType")] + pub dependent_thoroughfares_type: Option, + /// no description provided + #[serde(rename="thoroughfareTrailingType")] + pub thoroughfare_trailing_type: Option, + /// no description provided + #[serde(rename="dependentThoroughfaresIndicator")] + pub dependent_thoroughfares_indicator: Option, + /// no description provided + #[serde(rename="dependentThoroughfareLeadingType")] + pub dependent_thoroughfare_leading_type: Option, + /// no description provided + #[serde(rename="countryName")] + pub country_name: Option, + /// no description provided + #[serde(rename="premiseName")] + pub premise_name: Option, + /// no description provided + #[serde(rename="postalCodeNumberExtension")] + pub postal_code_number_extension: Option, + /// no description provided + #[serde(rename="localityName")] + pub locality_name: Option, + /// no description provided + #[serde(rename="thoroughfarePreDirection")] + pub thoroughfare_pre_direction: Option, + /// no description provided + #[serde(rename="recipientName")] + pub recipient_name: Option, + /// no description provided + #[serde(rename="thoroughfareNumber")] + pub thoroughfare_number: Option, + /// no description provided + #[serde(rename="dependentThoroughfarePreDirection")] + pub dependent_thoroughfare_pre_direction: Option, + /// no description provided + #[serde(rename="administrativeAreaName")] + pub administrative_area_name: Option, + /// no description provided + #[serde(rename="thoroughfareLeadingType")] + pub thoroughfare_leading_type: Option, + /// no description provided + #[serde(rename="firmName")] + pub firm_name: Option, + /// no description provided + #[serde(rename="dependentThoroughfarePostDirection")] + pub dependent_thoroughfare_post_direction: Option, + /// no description provided + #[serde(rename="countryNameCode")] + pub country_name_code: Option, + /// no description provided + #[serde(rename="sortingCode")] + pub sorting_code: Option, + /// no description provided + #[serde(rename="dependentThoroughfaresConnector")] + pub dependent_thoroughfares_connector: Option, + /// no description provided + #[serde(rename="isDisputed")] + pub is_disputed: Option, + /// no description provided + #[serde(rename="subAdministrativeAreaName")] + pub sub_administrative_area_name: Option, + /// no description provided + #[serde(rename="thoroughfarePostDirection")] + pub thoroughfare_post_direction: Option, + /// no description provided + #[serde(rename="dependentLocalityName")] + pub dependent_locality_name: Option, + /// no description provided + #[serde(rename="dependentThoroughfareName")] + pub dependent_thoroughfare_name: Option, + /// no description provided + #[serde(rename="subPremiseName")] + pub sub_premise_name: Option, + /// no description provided + #[serde(rename="thoroughfareName")] + pub thoroughfare_name: Option, + /// no description provided + #[serde(rename="postBoxNumber")] + pub post_box_number: Option, + /// no description provided + #[serde(rename="addressLines")] + pub address_lines: Option>, +} + +impl Part for PostalAddress {} /// Information about an election administrative body (e.g. County Board of Elections). @@ -489,6 +654,46 @@ pub struct Channel { impl Part for Channel {} +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct VoterInfoSegmentResult { + /// no description provided + #[serde(rename="postalAddress")] + pub postal_address: Option, + /// no description provided + pub request: Option, + /// no description provided + pub response: Option, + /// no description provided + #[serde(rename="generatedMillis")] + pub generated_millis: Option, +} + +impl Part for VoterInfoSegmentResult {} + + +/// A request for political geography and representative information for an address. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [representative info by address representatives](struct.RepresentativeRepresentativeInfoByAddresCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RepresentativeInfoRequest { + /// no description provided + #[serde(rename="contextParams")] + pub context_params: Option, +} + +impl RequestValue for RepresentativeInfoRequest {} + + /// Information about an Office held by one or more Officials. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -514,24 +719,6 @@ pub struct Office { impl Part for Office {} -/// Represents a political geographic division that matches the requested query. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DivisionSearchResult { - /// The unique Open Civic Data identifier for this division. - #[serde(rename="ocdId")] - pub ocd_id: Option, - /// The name of the division. - pub name: Option, - /// Other Open Civic Data identifiers that refer to the same division -- for example, those that refer to other political divisions whose boundaries are defined to be coterminous with this one. For example, ocd-division/country:us/state:wy will include an alias of ocd-division/country:us/state:wy/cd:1, since Wyoming has only one Congressional district. - pub aliases: Option>, -} - -impl Part for DivisionSearchResult {} - - /// A simple representation of an address. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -558,6 +745,43 @@ pub struct SimpleAddressType { impl Part for SimpleAddressType {} +/// Represents a political geographic division that matches the requested query. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DivisionSearchResult { + /// The unique Open Civic Data identifier for this division. + #[serde(rename="ocdId")] + pub ocd_id: Option, + /// The name of the division. + pub name: Option, + /// Other Open Civic Data identifiers that refer to the same division -- for example, those that refer to other political divisions whose boundaries are defined to be coterminous with this one. For example, ocd-division/country:us/state:wy will include an alias of ocd-division/country:us/state:wy/cd:1, since Wyoming has only one Congressional district. + pub aliases: Option>, +} + +impl Part for DivisionSearchResult {} + + +/// A request to look up representative information for a single division. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [representative info by division representatives](struct.RepresentativeRepresentativeInfoByDivisionCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DivisionRepresentativeInfoRequest { + /// no description provided + #[serde(rename="contextParams")] + pub context_params: Option, +} + +impl RequestValue for DivisionRepresentativeInfoRequest {} + + /// Describes a political geography. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -614,6 +838,33 @@ pub struct PollingLocation { impl Part for PollingLocation {} +/// Information about the election that was queried. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [voter info query elections](struct.ElectionVoterInfoQueryCall.html) (none) +/// * [election query elections](struct.ElectionElectionQueryCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Election { + /// Day of the election in YYYY-MM-DD format. + #[serde(rename="electionDay")] + pub election_day: Option, + /// The unique ID of this election. + pub id: Option, + /// A displayable name for the election. + pub name: Option, + /// The political division of the election. Represented as an OCD Division ID. Voters within these political jurisdictions are covered by this election. This is typically a state such as ocd-division/country:us/state:ca or for the midterms or general election the entire US (i.e. ocd-division/country:us). + #[serde(rename="ocdDivisionId")] + pub ocd_division_id: Option, +} + +impl Resource for Election {} + + /// There is no detailed description. /// /// # Activities @@ -621,19 +872,16 @@ impl Part for PollingLocation {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [representative info by division representatives](struct.RepresentativeRepresentativeInfoByDivisionCall.html) (response) +/// * [election query elections](struct.ElectionElectionQueryCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct RepresentativeInfoData { - /// Political geographic divisions that contain the requested address. - pub divisions: Option>, - /// Officials holding the offices listed above. Will only be present if includeOffices was true in the request. - pub officials: Option>, - /// Elected offices referenced by the divisions listed above. Will only be present if includeOffices was true in the request. - pub offices: Option>, +pub struct ElectionsQueryRequest { + /// no description provided + #[serde(rename="contextParams")] + pub context_params: Option, } -impl ResponseResult for RepresentativeInfoData {} +impl RequestValue for ElectionsQueryRequest {} /// The result of a voter info lookup query. @@ -681,31 +929,26 @@ pub struct VoterInfoResponse { impl ResponseResult for VoterInfoResponse {} -/// Information about the election that was queried. +/// There is no detailed description. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [voter info query elections](struct.ElectionVoterInfoQueryCall.html) (none) -/// * [election query elections](struct.ElectionElectionQueryCall.html) (none) +/// * [representative info by division representatives](struct.RepresentativeRepresentativeInfoByDivisionCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Election { - /// Day of the election in YYYY-MM-DD format. - #[serde(rename="electionDay")] - pub election_day: Option, - /// The unique ID of this election. - pub id: Option, - /// A displayable name for the election. - pub name: Option, - /// The political division of the election. Represented as an OCD Division ID. Voters within these political jurisdictions are covered by this election. This is typically a state such as ocd-division/country:us/state:ca or for the midterms or general election the entire US (i.e. ocd-division/country:us). - #[serde(rename="ocdDivisionId")] - pub ocd_division_id: Option, +pub struct RepresentativeInfoData { + /// Political geographic divisions that contain the requested address. + pub divisions: Option>, + /// Officials holding the offices listed above. Will only be present if includeOffices was true in the request. + pub officials: Option>, + /// Elected offices referenced by the divisions listed above. Will only be present if includeOffices was true in the request. + pub offices: Option>, } -impl Resource for Election {} +impl ResponseResult for RepresentativeInfoData {} @@ -754,9 +997,14 @@ impl<'a, C, A> DivisionMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// /// Searches for political divisions by their natural name or OCD ID. - pub fn search(&self) -> DivisionSearchCall<'a, C, A> { + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn search(&self, request: DivisionSearchRequest) -> DivisionSearchCall<'a, C, A> { DivisionSearchCall { hub: self.hub, + _request: request, _query: Default::default(), _delegate: Default::default(), _additional_params: Default::default(), @@ -807,9 +1055,14 @@ impl<'a, C, A> ElectionMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// /// List of available elections to query. - pub fn election_query(&self) -> ElectionElectionQueryCall<'a, C, A> { + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn election_query(&self, request: ElectionsQueryRequest) -> ElectionElectionQueryCall<'a, C, A> { ElectionElectionQueryCall { hub: self.hub, + _request: request, _delegate: Default::default(), _additional_params: Default::default(), } @@ -821,10 +1074,12 @@ impl<'a, C, A> ElectionMethods<'a, C, A> { /// /// # Arguments /// + /// * `request` - No description provided. /// * `address` - The registered address of the voter to look up. - pub fn voter_info_query(&self, address: &str) -> ElectionVoterInfoQueryCall<'a, C, A> { + pub fn voter_info_query(&self, request: VoterInfoRequest, address: &str) -> ElectionVoterInfoQueryCall<'a, C, A> { ElectionVoterInfoQueryCall { hub: self.hub, + _request: request, _address: address.to_string(), _return_all_available_data: Default::default(), _official_only: Default::default(), @@ -878,9 +1133,14 @@ impl<'a, C, A> RepresentativeMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// /// Looks up political geography and representative information for a single address. - pub fn representative_info_by_address(&self) -> RepresentativeRepresentativeInfoByAddresCall<'a, C, A> { + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn representative_info_by_address(&self, request: RepresentativeInfoRequest) -> RepresentativeRepresentativeInfoByAddresCall<'a, C, A> { RepresentativeRepresentativeInfoByAddresCall { hub: self.hub, + _request: request, _roles: Default::default(), _levels: Default::default(), _include_offices: Default::default(), @@ -896,10 +1156,12 @@ impl<'a, C, A> RepresentativeMethods<'a, C, A> { /// /// # Arguments /// + /// * `request` - No description provided. /// * `ocdId` - The Open Civic Data division identifier of the division to look up. - pub fn representative_info_by_division(&self, ocd_id: &str) -> RepresentativeRepresentativeInfoByDivisionCall<'a, C, A> { + pub fn representative_info_by_division(&self, request: DivisionRepresentativeInfoRequest, ocd_id: &str) -> RepresentativeRepresentativeInfoByDivisionCall<'a, C, A> { RepresentativeRepresentativeInfoByDivisionCall { hub: self.hub, + _request: request, _ocd_id: ocd_id.to_string(), _roles: Default::default(), _recursive: Default::default(), @@ -931,6 +1193,7 @@ impl<'a, C, A> RepresentativeMethods<'a, C, A> { /// # extern crate hyper; /// # extern crate yup_oauth2 as oauth2; /// # extern crate google_civicinfo2 as civicinfo2; +/// use civicinfo2::DivisionSearchRequest; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -941,10 +1204,15 @@ impl<'a, C, A> RepresentativeMethods<'a, C, A> { /// # hyper::Client::new(), /// # ::default(), None); /// # let mut hub = CivicInfo::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = DivisionSearchRequest::default(); +/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.divisions().search() +/// let result = hub.divisions().search(req) /// .query("takimata") /// .doit(); /// # } @@ -953,6 +1221,7 @@ pub struct DivisionSearchCall<'a, C, A> where C: 'a, A: 'a { hub: &'a CivicInfo, + _request: DivisionSearchRequest, _query: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, @@ -974,7 +1243,7 @@ impl<'a, C, A> DivisionSearchCall<'a, C, A> where C: BorrowMut, A }; dlg.begin(MethodInfo { id: "civicinfo.divisions.search", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); if let Some(value) = self._query { params.push(("query", value.to_string())); } @@ -1010,13 +1279,28 @@ impl<'a, C, A> DivisionSearchCall<'a, C, A> where C: BorrowMut, A url.push_str(&url::form_urlencoded::serialize(params)); } + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())); + .header(UserAgent(self.hub._user_agent.clone())) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); dlg.pre_request(); req.send() @@ -1067,6 +1351,15 @@ impl<'a, C, A> DivisionSearchCall<'a, C, A> where C: BorrowMut, A } + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: DivisionSearchRequest) -> DivisionSearchCall<'a, C, A> { + self._request = new_value; + self + } /// The search query. Queries can cover any parts of a OCD ID or a human readable division name. All words given in the query are treated as required patterns. In addition to that, most query operators of the Apache Lucene library are supported. See http://lucene.apache.org/core/2_9_4/queryparsersyntax.html /// /// Sets the *query* query property to the given value. @@ -1123,6 +1416,7 @@ impl<'a, C, A> DivisionSearchCall<'a, C, A> where C: BorrowMut, A /// # extern crate hyper; /// # extern crate yup_oauth2 as oauth2; /// # extern crate google_civicinfo2 as civicinfo2; +/// use civicinfo2::ElectionsQueryRequest; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -1133,10 +1427,15 @@ impl<'a, C, A> DivisionSearchCall<'a, C, A> where C: BorrowMut, A /// # hyper::Client::new(), /// # ::default(), None); /// # let mut hub = CivicInfo::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ElectionsQueryRequest::default(); +/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.elections().election_query() +/// let result = hub.elections().election_query(req) /// .doit(); /// # } /// ``` @@ -1144,6 +1443,7 @@ pub struct ElectionElectionQueryCall<'a, C, A> where C: 'a, A: 'a { hub: &'a CivicInfo, + _request: ElectionsQueryRequest, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, } @@ -1164,7 +1464,7 @@ impl<'a, C, A> ElectionElectionQueryCall<'a, C, A> where C: BorrowMut = Vec::with_capacity((2 + self._additional_params.len())); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); @@ -1197,13 +1497,28 @@ impl<'a, C, A> ElectionElectionQueryCall<'a, C, A> where C: BorrowMut ElectionElectionQueryCall<'a, C, A> where C: BorrowMut ElectionElectionQueryCall<'a, C, A> { + self._request = new_value; + self + } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// @@ -1303,6 +1627,7 @@ impl<'a, C, A> ElectionElectionQueryCall<'a, C, A> where C: BorrowMut ElectionElectionQueryCall<'a, C, A> where C: BorrowMut::default(), None); /// # let mut hub = CivicInfo::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = VoterInfoRequest::default(); +/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.elections().voter_info_query("address") +/// let result = hub.elections().voter_info_query(req, "address") /// .return_all_available_data(true) /// .official_only(false) /// .election_id("labore") @@ -1327,6 +1657,7 @@ pub struct ElectionVoterInfoQueryCall<'a, C, A> where C: 'a, A: 'a { hub: &'a CivicInfo, + _request: VoterInfoRequest, _address: String, _return_all_available_data: Option, _official_only: Option, @@ -1351,7 +1682,7 @@ impl<'a, C, A> ElectionVoterInfoQueryCall<'a, C, A> where C: BorrowMut = Vec::with_capacity((6 + self._additional_params.len())); + let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("address", self._address.to_string())); if let Some(value) = self._return_all_available_data { params.push(("returnAllAvailableData", value.to_string())); @@ -1394,13 +1725,28 @@ impl<'a, C, A> ElectionVoterInfoQueryCall<'a, C, A> where C: BorrowMut ElectionVoterInfoQueryCall<'a, C, A> where C: BorrowMut ElectionVoterInfoQueryCall<'a, C, A> { + self._request = new_value; + self + } /// The registered address of the voter to look up. /// /// Sets the *address* query property to the given value. @@ -1531,6 +1886,7 @@ impl<'a, C, A> ElectionVoterInfoQueryCall<'a, C, A> where C: BorrowMut ElectionVoterInfoQueryCall<'a, C, A> where C: BorrowMut::default(), None); /// # let mut hub = CivicInfo::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = RepresentativeInfoRequest::default(); +/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.representatives().representative_info_by_address() +/// let result = hub.representatives().representative_info_by_address(req) /// .add_roles("sea") /// .add_levels("nonumy") /// .include_offices(true) @@ -1556,6 +1917,7 @@ pub struct RepresentativeRepresentativeInfoByAddresCall<'a, C, A> where C: 'a, A: 'a { hub: &'a CivicInfo, + _request: RepresentativeInfoRequest, _roles: Vec, _levels: Vec, _include_offices: Option, @@ -1580,7 +1942,7 @@ impl<'a, C, A> RepresentativeRepresentativeInfoByAddresCall<'a, C, A> where C: B }; dlg.begin(MethodInfo { id: "civicinfo.representatives.representativeInfoByAddress", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); if self._roles.len() > 0 { for f in self._roles.iter() { params.push(("roles", f.to_string())); @@ -1629,13 +1991,28 @@ impl<'a, C, A> RepresentativeRepresentativeInfoByAddresCall<'a, C, A> where C: B url.push_str(&url::form_urlencoded::serialize(params)); } + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())); + .header(UserAgent(self.hub._user_agent.clone())) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); dlg.pre_request(); req.send() @@ -1686,6 +2063,15 @@ impl<'a, C, A> RepresentativeRepresentativeInfoByAddresCall<'a, C, A> where C: B } + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: RepresentativeInfoRequest) -> RepresentativeRepresentativeInfoByAddresCall<'a, C, A> { + self._request = new_value; + self + } /// A list of office roles to filter by. Only offices fulfilling one of these roles will be returned. Divisions that don't contain a matching office will not be returned. /// /// Append the given value to the *roles* query property. @@ -1765,6 +2151,7 @@ impl<'a, C, A> RepresentativeRepresentativeInfoByAddresCall<'a, C, A> where C: B /// # extern crate hyper; /// # extern crate yup_oauth2 as oauth2; /// # extern crate google_civicinfo2 as civicinfo2; +/// use civicinfo2::DivisionRepresentativeInfoRequest; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -1775,10 +2162,15 @@ impl<'a, C, A> RepresentativeRepresentativeInfoByAddresCall<'a, C, A> where C: B /// # hyper::Client::new(), /// # ::default(), None); /// # let mut hub = CivicInfo::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = DivisionRepresentativeInfoRequest::default(); +/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.representatives().representative_info_by_division("ocdId") +/// let result = hub.representatives().representative_info_by_division(req, "ocdId") /// .add_roles("aliquyam") /// .recursive(false) /// .add_levels("no") @@ -1789,6 +2181,7 @@ pub struct RepresentativeRepresentativeInfoByDivisionCall<'a, C, A> where C: 'a, A: 'a { hub: &'a CivicInfo, + _request: DivisionRepresentativeInfoRequest, _ocd_id: String, _roles: Vec, _recursive: Option, @@ -1813,7 +2206,7 @@ impl<'a, C, A> RepresentativeRepresentativeInfoByDivisionCall<'a, C, A> where C: }; dlg.begin(MethodInfo { id: "civicinfo.representatives.representativeInfoByDivision", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("ocdId", self._ocd_id.to_string())); if self._roles.len() > 0 { for f in self._roles.iter() { @@ -1881,13 +2274,28 @@ impl<'a, C, A> RepresentativeRepresentativeInfoByDivisionCall<'a, C, A> where C: url.push_str(&url::form_urlencoded::serialize(params)); } + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())); + .header(UserAgent(self.hub._user_agent.clone())) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); dlg.pre_request(); req.send() @@ -1938,6 +2346,15 @@ impl<'a, C, A> RepresentativeRepresentativeInfoByDivisionCall<'a, C, A> where C: } + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: DivisionRepresentativeInfoRequest) -> RepresentativeRepresentativeInfoByDivisionCall<'a, C, A> { + self._request = new_value; + self + } /// The Open Civic Data division identifier of the division to look up. /// /// Sets the *ocd id* path property to the given value. diff --git a/gen/classroom1-cli/Cargo.toml b/gen/classroom1-cli/Cargo.toml index 8752a4932c..8a694e5b63 100644 --- a/gen/classroom1-cli/Cargo.toml +++ b/gen/classroom1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-classroom1-cli" -version = "1.0.0+20160816" +version = "1.0.0+20161006" authors = ["Sebastian Thiel "] description = "A complete library to interact with classroom (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/classroom1-cli" diff --git a/gen/classroom1-cli/README.md b/gen/classroom1-cli/README.md index fb27c4356d..cb09a012e0 100644 --- a/gen/classroom1-cli/README.md +++ b/gen/classroom1-cli/README.md @@ -24,7 +24,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *classroom* API at revision *20160816*. The CLI is at version *1.0.0*. +This documentation was generated from the *classroom* API at revision *20161006*. The CLI is at version *1.0.0*. ```bash classroom1 [options] diff --git a/gen/classroom1-cli/mkdocs.yml b/gen/classroom1-cli/mkdocs.yml index d203fd66ef..245b915971 100644 --- a/gen/classroom1-cli/mkdocs.yml +++ b/gen/classroom1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: classroom v1.0.0+20160816 +site_name: classroom v1.0.0+20161006 site_url: http://byron.github.io/google-apis-rs/google-classroom1-cli site_description: Write integrating applications with bcore diff --git a/gen/classroom1-cli/src/main.rs b/gen/classroom1-cli/src/main.rs index f01df68b67..996ded14e8 100644 --- a/gen/classroom1-cli/src/main.rs +++ b/gen/classroom1-cli/src/main.rs @@ -1052,6 +1052,7 @@ impl<'n> Engine<'n> { "alternate-link" => Some(("alternateLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "enrollment-code" => Some(("enrollmentCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "section" => Some(("section", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "guardians-enabled" => Some(("guardiansEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "course-group-email" => Some(("courseGroupEmail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "teacher-group-email" => Some(("teacherGroupEmail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1065,7 +1066,7 @@ impl<'n> Engine<'n> { "description-heading" => Some(("descriptionHeading", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "room" => Some(("room", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["alternate-link", "course-group-email", "course-state", "creation-time", "description", "description-heading", "enrollment-code", "id", "name", "owner-id", "room", "section", "teacher-folder", "teacher-group-email", "title", "update-time"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["alternate-link", "course-group-email", "course-state", "creation-time", "description", "description-heading", "enrollment-code", "guardians-enabled", "id", "name", "owner-id", "room", "section", "teacher-folder", "teacher-group-email", "title", "update-time"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1247,6 +1248,9 @@ impl<'n> Engine<'n> { "page-size" => { call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); }, + "course-states" => { + call = call.add_course_states(value.unwrap_or("")); + }, _ => { let mut found = false; for param in &self.gp { @@ -1260,7 +1264,7 @@ impl<'n> Engine<'n> { err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); - v.extend(["teacher-id", "page-token", "student-id", "page-size"].iter().map(|v|*v)); + v.extend(["teacher-id", "page-token", "student-id", "page-size", "course-states"].iter().map(|v|*v)); v } )); } } @@ -1322,6 +1326,7 @@ impl<'n> Engine<'n> { "alternate-link" => Some(("alternateLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "enrollment-code" => Some(("enrollmentCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "section" => Some(("section", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "guardians-enabled" => Some(("guardiansEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "course-group-email" => Some(("courseGroupEmail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "teacher-group-email" => Some(("teacherGroupEmail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1335,7 +1340,7 @@ impl<'n> Engine<'n> { "description-heading" => Some(("descriptionHeading", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "room" => Some(("room", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["alternate-link", "course-group-email", "course-state", "creation-time", "description", "description-heading", "enrollment-code", "id", "name", "owner-id", "room", "section", "teacher-folder", "teacher-group-email", "title", "update-time"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["alternate-link", "course-group-email", "course-state", "creation-time", "description", "description-heading", "enrollment-code", "guardians-enabled", "id", "name", "owner-id", "room", "section", "teacher-folder", "teacher-group-email", "title", "update-time"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1944,6 +1949,7 @@ impl<'n> Engine<'n> { "alternate-link" => Some(("alternateLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "enrollment-code" => Some(("enrollmentCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "section" => Some(("section", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "guardians-enabled" => Some(("guardiansEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "course-group-email" => Some(("courseGroupEmail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "teacher-group-email" => Some(("teacherGroupEmail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1957,7 +1963,7 @@ impl<'n> Engine<'n> { "description-heading" => Some(("descriptionHeading", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "room" => Some(("room", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["alternate-link", "course-group-email", "course-state", "creation-time", "description", "description-heading", "enrollment-code", "id", "name", "owner-id", "room", "section", "teacher-folder", "teacher-group-email", "title", "update-time"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["alternate-link", "course-group-email", "course-state", "creation-time", "description", "description-heading", "enrollment-code", "guardians-enabled", "id", "name", "owner-id", "room", "section", "teacher-folder", "teacher-group-email", "title", "update-time"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -4015,12 +4021,12 @@ fn main() { Some(false)), ]), ("guardian-invitations-list", - Some(r##"Returns a list of guardian invitations that the requesting user is permitted to view, filtered by the parameters provided. This method returns the following error codes: * `PERMISSION_DENIED` if a `student_id` is specified, and the requesting user is not permitted to view guardian invitations for that student, if guardians are not enabled for the domain in question, or for other access errors. * `INVALID_ARGUMENT` if a `student_id` is specified, but its format cannot be recognized (it is not an email address, nor a `student_id` from the API, nor the literal string `me`). May also be returned if an invalid `page_token` or `state` is provided. * `NOT_FOUND` if a `student_id` is specified, and its format can be recognized, but Classroom has no record of that student."##), + Some(r##"Returns a list of guardian invitations that the requesting user is permitted to view, filtered by the parameters provided. This method returns the following error codes: * `PERMISSION_DENIED` if a `student_id` is specified, and the requesting user is not permitted to view guardian invitations for that student, if `"-"` is specified as the `student_id` and the user is not a domain administrator, if guardians are not enabled for the domain in question, or for other access errors. * `INVALID_ARGUMENT` if a `student_id` is specified, but its format cannot be recognized (it is not an email address, nor a `student_id` from the API, nor the literal string `me`). May also be returned if an invalid `page_token` or `state` is provided. * `NOT_FOUND` if a `student_id` is specified, and its format can be recognized, but Classroom has no record of that student."##), "Details at http://byron.github.io/google-apis-rs/google_classroom1_cli/user-profiles_guardian-invitations-list", vec![ (Some(r##"student-id"##), None, - Some(r##"The ID of the student whose guardian invitations are to be returned. The identifier can be one of the following: * the numeric identifier for the user * the email address of the user * the string literal `"me"`, indicating the requesting user"##), + Some(r##"The ID of the student whose guardian invitations are to be returned. The identifier can be one of the following: * the numeric identifier for the user * the email address of the user * the string literal `"me"`, indicating the requesting user * the string literal `"-"`, indicating that results should be returned for all students that the requesting user is permitted to view guardian invitations."##), Some(true), Some(false)), @@ -4127,12 +4133,12 @@ fn main() { Some(false)), ]), ("guardians-list", - Some(r##"Returns a list of guardians that the requesting user is permitted to view, restricted to those that match the request. This method returns the following error codes: * `PERMISSION_DENIED` if a `student_id` is specified, and the requesting user is not permitted to view guardian information for that student, if guardians are not enabled for the domain in question, if the `invited_email_address` filter is set by a user who is not a domain administrator, or for other access errors. * `INVALID_ARGUMENT` if a `student_id` is specified, but its format cannot be recognized (it is not an email address, nor a `student_id` from the API, nor the literal string `me`). May also be returned if an invalid `page_token` is provided. * `NOT_FOUND` if a `student_id` is specified, and its format can be recognized, but Classroom has no record of that student."##), + Some(r##"Returns a list of guardians that the requesting user is permitted to view, restricted to those that match the request. To list guardians for any student that the requesting user may view guardians for, use the literal character `-` for the student ID. This method returns the following error codes: * `PERMISSION_DENIED` if a `student_id` is specified, and the requesting user is not permitted to view guardian information for that student, if `"-"` is specified as the `student_id` and the user is not a domain administrator, if guardians are not enabled for the domain in question, if the `invited_email_address` filter is set by a user who is not a domain administrator, or for other access errors. * `INVALID_ARGUMENT` if a `student_id` is specified, but its format cannot be recognized (it is not an email address, nor a `student_id` from the API, nor the literal string `me`). May also be returned if an invalid `page_token` is provided. * `NOT_FOUND` if a `student_id` is specified, and its format can be recognized, but Classroom has no record of that student."##), "Details at http://byron.github.io/google-apis-rs/google_classroom1_cli/user-profiles_guardians-list", vec![ (Some(r##"student-id"##), None, - Some(r##"Filter results by the student who the guardian is linked to. The identifier can be one of the following: * the numeric identifier for the user * the email address of the user * the string literal `"me"`, indicating the requesting user"##), + Some(r##"Filter results by the student who the guardian is linked to. The identifier can be one of the following: * the numeric identifier for the user * the email address of the user * the string literal `"me"`, indicating the requesting user * the string literal `"-"`, indicating that results should be returned for all students that the requesting user has access to view."##), Some(true), Some(false)), @@ -4154,7 +4160,7 @@ fn main() { let mut app = App::new("classroom1") .author("Sebastian Thiel ") - .version("1.0.0+20160816") + .version("1.0.0+20161006") .about("Manages classes, rosters, and invitations in Google Classroom.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_classroom1_cli") .arg(Arg::with_name("url") diff --git a/gen/classroom1/Cargo.toml b/gen/classroom1/Cargo.toml index a540446d27..4a52e6c06d 100644 --- a/gen/classroom1/Cargo.toml +++ b/gen/classroom1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-classroom1" -version = "1.0.0+20160816" +version = "1.0.0+20161006" authors = ["Sebastian Thiel "] description = "A complete library to interact with classroom (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/classroom1" diff --git a/gen/classroom1/README.md b/gen/classroom1/README.md index da3043afb8..99f6a991a9 100644 --- a/gen/classroom1/README.md +++ b/gen/classroom1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-classroom1` library allows access to all features of the *Google classroom* service. -This documentation was generated from *classroom* crate version *1.0.0+20160816*, where *20160816* is the exact revision of the *classroom:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *classroom* crate version *1.0.0+20161006*, where *20161006* is the exact revision of the *classroom:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *classroom* *v1* API can be found at the [official documentation site](https://developers.google.com/classroom/). diff --git a/gen/classroom1/src/lib.rs b/gen/classroom1/src/lib.rs index 5e76b6c5c1..b65efea4f0 100644 --- a/gen/classroom1/src/lib.rs +++ b/gen/classroom1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *classroom* crate version *1.0.0+20160816*, where *20160816* is the exact revision of the *classroom:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *classroom* crate version *1.0.0+20161006*, where *20161006* is the exact revision of the *classroom:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *classroom* *v1* API can be found at the //! [official documentation site](https://developers.google.com/classroom/). @@ -124,11 +124,11 @@ //! // execute the final call using `doit()`. //! // Values shown here are possibly random and not representative ! //! let result = hub.courses().course_work_student_submissions_list("courseId", "courseWorkId") -//! .user_id("gubergren") -//! .add_states("aliquyam") -//! .page_token("eos") -//! .page_size(-38) -//! .late("sea") +//! .user_id("aliquyam") +//! .add_states("eos") +//! .page_token("tempor") +//! .page_size(-59) +//! .late("labore") //! .doit(); //! //! match result { diff --git a/gen/classroom1/src/lib.rs.in b/gen/classroom1/src/lib.rs.in index d80aab99fc..1fc7c46722 100644 --- a/gen/classroom1/src/lib.rs.in +++ b/gen/classroom1/src/lib.rs.in @@ -1097,6 +1097,9 @@ pub struct Course { /// Enrollment code to use when joining this course. Specifying this field in a course update mask results in an error. Read-only. #[serde(rename="enrollmentCode")] pub enrollment_code: Option, + /// Whether or not guardian notifications are enabled for this course. Read-only. + #[serde(rename="guardiansEnabled")] + pub guardians_enabled: Option, /// The email address of a Google group containing all members of the course. This group does not accept email and can only be used for permissions. Read-only. #[serde(rename="courseGroupEmail")] pub course_group_email: Option, @@ -1562,6 +1565,7 @@ impl<'a, C, A> CourseMethods<'a, C, A> { _student_id: Default::default(), _page_token: Default::default(), _page_size: Default::default(), + _course_states: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -1954,11 +1958,11 @@ impl<'a, C, A> UserProfileMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Returns a list of guardians that the requesting user is permitted to view, restricted to those that match the request. This method returns the following error codes: * `PERMISSION_DENIED` if a `student_id` is specified, and the requesting user is not permitted to view guardian information for that student, if guardians are not enabled for the domain in question, if the `invited_email_address` filter is set by a user who is not a domain administrator, or for other access errors. * `INVALID_ARGUMENT` if a `student_id` is specified, but its format cannot be recognized (it is not an email address, nor a `student_id` from the API, nor the literal string `me`). May also be returned if an invalid `page_token` is provided. * `NOT_FOUND` if a `student_id` is specified, and its format can be recognized, but Classroom has no record of that student. + /// Returns a list of guardians that the requesting user is permitted to view, restricted to those that match the request. To list guardians for any student that the requesting user may view guardians for, use the literal character `-` for the student ID. This method returns the following error codes: * `PERMISSION_DENIED` if a `student_id` is specified, and the requesting user is not permitted to view guardian information for that student, if `"-"` is specified as the `student_id` and the user is not a domain administrator, if guardians are not enabled for the domain in question, if the `invited_email_address` filter is set by a user who is not a domain administrator, or for other access errors. * `INVALID_ARGUMENT` if a `student_id` is specified, but its format cannot be recognized (it is not an email address, nor a `student_id` from the API, nor the literal string `me`). May also be returned if an invalid `page_token` is provided. * `NOT_FOUND` if a `student_id` is specified, and its format can be recognized, but Classroom has no record of that student. /// /// # Arguments /// - /// * `studentId` - Filter results by the student who the guardian is linked to. The identifier can be one of the following: * the numeric identifier for the user * the email address of the user * the string literal `"me"`, indicating the requesting user + /// * `studentId` - Filter results by the student who the guardian is linked to. The identifier can be one of the following: * the numeric identifier for the user * the email address of the user * the string literal `"me"`, indicating the requesting user * the string literal `"-"`, indicating that results should be returned for all students that the requesting user has access to view. pub fn guardians_list(&self, student_id: &str) -> UserProfileGuardianListCall<'a, C, A> { UserProfileGuardianListCall { hub: self.hub, @@ -1973,11 +1977,11 @@ impl<'a, C, A> UserProfileMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Returns a list of guardian invitations that the requesting user is permitted to view, filtered by the parameters provided. This method returns the following error codes: * `PERMISSION_DENIED` if a `student_id` is specified, and the requesting user is not permitted to view guardian invitations for that student, if guardians are not enabled for the domain in question, or for other access errors. * `INVALID_ARGUMENT` if a `student_id` is specified, but its format cannot be recognized (it is not an email address, nor a `student_id` from the API, nor the literal string `me`). May also be returned if an invalid `page_token` or `state` is provided. * `NOT_FOUND` if a `student_id` is specified, and its format can be recognized, but Classroom has no record of that student. + /// Returns a list of guardian invitations that the requesting user is permitted to view, filtered by the parameters provided. This method returns the following error codes: * `PERMISSION_DENIED` if a `student_id` is specified, and the requesting user is not permitted to view guardian invitations for that student, if `"-"` is specified as the `student_id` and the user is not a domain administrator, if guardians are not enabled for the domain in question, or for other access errors. * `INVALID_ARGUMENT` if a `student_id` is specified, but its format cannot be recognized (it is not an email address, nor a `student_id` from the API, nor the literal string `me`). May also be returned if an invalid `page_token` or `state` is provided. * `NOT_FOUND` if a `student_id` is specified, and its format can be recognized, but Classroom has no record of that student. /// /// # Arguments /// - /// * `studentId` - The ID of the student whose guardian invitations are to be returned. The identifier can be one of the following: * the numeric identifier for the user * the email address of the user * the string literal `"me"`, indicating the requesting user + /// * `studentId` - The ID of the student whose guardian invitations are to be returned. The identifier can be one of the following: * the numeric identifier for the user * the email address of the user * the string literal `"me"`, indicating the requesting user * the string literal `"-"`, indicating that results should be returned for all students that the requesting user is permitted to view guardian invitations. pub fn guardian_invitations_list(&self, student_id: &str) -> UserProfileGuardianInvitationListCall<'a, C, A> { UserProfileGuardianInvitationListCall { hub: self.hub, @@ -5787,6 +5791,7 @@ impl<'a, C, A> CourseCourseWorkCreateCall<'a, C, A> where C: BorrowMut _student_id: Option, _page_token: Option, _page_size: Option, + _course_states: Vec, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap @@ -5819,7 +5825,7 @@ impl<'a, C, A> CourseListCall<'a, C, A> where C: BorrowMut, A: oa }; dlg.begin(MethodInfo { id: "classroom.courses.list", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); if let Some(value) = self._teacher_id { params.push(("teacherId", value.to_string())); } @@ -5832,7 +5838,12 @@ impl<'a, C, A> CourseListCall<'a, C, A> where C: BorrowMut, A: oa if let Some(value) = self._page_size { params.push(("pageSize", value.to_string())); } - for &field in ["alt", "teacherId", "studentId", "pageToken", "pageSize"].iter() { + if self._course_states.len() > 0 { + for f in self._course_states.iter() { + params.push(("courseStates", f.to_string())); + } + } + for &field in ["alt", "teacherId", "studentId", "pageToken", "pageSize", "courseStates"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -5954,6 +5965,14 @@ impl<'a, C, A> CourseListCall<'a, C, A> where C: BorrowMut, A: oa self._page_size = Some(new_value); self } + /// Restricts returned courses to those in one of the specified states + /// + /// Append the given value to the *course states* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_course_states(mut self, new_value: &str) -> CourseListCall<'a, C, A> { + self._course_states.push(new_value.to_string()); + self + } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// @@ -6613,7 +6632,7 @@ impl<'a, C, A> CourseAliaseCreateCall<'a, C, A> where C: BorrowMut CourseCreateCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.courses().students_list("courseId") -/// .page_token("et") -/// .page_size(-96) +/// .page_token("consetetur") +/// .page_size(-52) /// .doit(); /// # } /// ``` @@ -7895,7 +7914,7 @@ impl<'a, C, A> CourseDeleteCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.courses().patch(req, "id") -/// .update_mask("Lorem") +/// .update_mask("gubergren") /// .doit(); /// # } /// ``` @@ -8173,8 +8192,8 @@ impl<'a, C, A> CoursePatchCall<'a, C, A> where C: BorrowMut, A: o /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.courses().aliases_list("courseId") -/// .page_token("justo") -/// .page_size(-52) +/// .page_token("sit") +/// .page_size(-26) /// .doit(); /// # } /// ``` @@ -10209,7 +10228,7 @@ impl<'a, C, A> UserProfileGetCall<'a, C, A> where C: BorrowMut, A /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.user_profiles().guardian_invitations_patch(req, "studentId", "invitationId") -/// .update_mask("clita") +/// .update_mask("consetetur") /// .doit(); /// # } /// ``` @@ -10681,7 +10700,7 @@ impl<'a, C, A> UserProfileGuardianInvitationGetCall<'a, C, A> where C: BorrowMut } -/// Returns a list of guardians that the requesting user is permitted to view, restricted to those that match the request. This method returns the following error codes: * `PERMISSION_DENIED` if a `student_id` is specified, and the requesting user is not permitted to view guardian information for that student, if guardians are not enabled for the domain in question, if the `invited_email_address` filter is set by a user who is not a domain administrator, or for other access errors. * `INVALID_ARGUMENT` if a `student_id` is specified, but its format cannot be recognized (it is not an email address, nor a `student_id` from the API, nor the literal string `me`). May also be returned if an invalid `page_token` is provided. * `NOT_FOUND` if a `student_id` is specified, and its format can be recognized, but Classroom has no record of that student. +/// Returns a list of guardians that the requesting user is permitted to view, restricted to those that match the request. To list guardians for any student that the requesting user may view guardians for, use the literal character `-` for the student ID. This method returns the following error codes: * `PERMISSION_DENIED` if a `student_id` is specified, and the requesting user is not permitted to view guardian information for that student, if `"-"` is specified as the `student_id` and the user is not a domain administrator, if guardians are not enabled for the domain in question, if the `invited_email_address` filter is set by a user who is not a domain administrator, or for other access errors. * `INVALID_ARGUMENT` if a `student_id` is specified, but its format cannot be recognized (it is not an email address, nor a `student_id` from the API, nor the literal string `me`). May also be returned if an invalid `page_token` is provided. * `NOT_FOUND` if a `student_id` is specified, and its format can be recognized, but Classroom has no record of that student. /// /// A builder for the *guardians.list* method supported by a *userProfile* resource. /// It is not used directly, but through a `UserProfileMethods` instance. @@ -10708,9 +10727,9 @@ impl<'a, C, A> UserProfileGuardianInvitationGetCall<'a, C, A> where C: BorrowMut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.user_profiles().guardians_list("studentId") -/// .page_token("kasd") -/// .page_size(-7) -/// .invited_email_address("takimata") +/// .page_token("sanctus") +/// .page_size(-58) +/// .invited_email_address("At") /// .doit(); /// # } /// ``` @@ -10863,7 +10882,7 @@ impl<'a, C, A> UserProfileGuardianListCall<'a, C, A> where C: BorrowMut UserProfileGuardianListCall<'a, C, A> where C: BorrowMut UserProfileGuardianListCall<'a, C, A> where C: BorrowMut UserProfileGuardianInvitationListCall<'a, C, A> where C: BorrowMu } - /// The ID of the student whose guardian invitations are to be returned. The identifier can be one of the following: * the numeric identifier for the user * the email address of the user * the string literal `"me"`, indicating the requesting user + /// The ID of the student whose guardian invitations are to be returned. The identifier can be one of the following: * the numeric identifier for the user * the email address of the user * the string literal `"me"`, indicating the requesting user * the string literal `"-"`, indicating that results should be returned for all students that the requesting user is permitted to view guardian invitations. /// /// Sets the *student id* path property to the given value. /// @@ -11705,10 +11724,10 @@ impl<'a, C, A> InvitationDeleteCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.invitations().list() -/// .user_id("sed") -/// .page_token("aliquyam") -/// .page_size(-53) -/// .course_id("eirmod") +/// .user_id("aliquyam") +/// .page_token("sit") +/// .page_size(-40) +/// .course_id("consetetur") /// .doit(); /// # } /// ``` diff --git a/gen/cloudmonitoring2_beta2-cli/Cargo.toml b/gen/cloudmonitoring2_beta2-cli/Cargo.toml index b0f57faf56..dae0363493 100644 --- a/gen/cloudmonitoring2_beta2-cli/Cargo.toml +++ b/gen/cloudmonitoring2_beta2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-cloudmonitoring2_beta2-cli" -version = "1.0.0+20160718" +version = "1.0.0+20161031" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Monitoring (protocol v2beta2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudmonitoring2_beta2-cli" diff --git a/gen/cloudmonitoring2_beta2-cli/README.md b/gen/cloudmonitoring2_beta2-cli/README.md index d4272c91c0..72f1e1bbb1 100644 --- a/gen/cloudmonitoring2_beta2-cli/README.md +++ b/gen/cloudmonitoring2_beta2-cli/README.md @@ -24,7 +24,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Cloud Monitoring* API at revision *20160718*. The CLI is at version *1.0.0*. +This documentation was generated from the *Cloud Monitoring* API at revision *20161031*. The CLI is at version *1.0.0*. ```bash cloudmonitoring2-beta2 [options] diff --git a/gen/cloudmonitoring2_beta2-cli/mkdocs.yml b/gen/cloudmonitoring2_beta2-cli/mkdocs.yml index 1d2255d96a..50c11ad8f6 100644 --- a/gen/cloudmonitoring2_beta2-cli/mkdocs.yml +++ b/gen/cloudmonitoring2_beta2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Cloud Monitoring v1.0.0+20160718 +site_name: Cloud Monitoring v1.0.0+20161031 site_url: http://byron.github.io/google-apis-rs/google-cloudmonitoring2_beta2-cli site_description: Write integrating applications with bcore diff --git a/gen/cloudmonitoring2_beta2-cli/src/main.rs b/gen/cloudmonitoring2_beta2-cli/src/main.rs index 2a2863d77e..c0aaf17345 100644 --- a/gen/cloudmonitoring2_beta2-cli/src/main.rs +++ b/gen/cloudmonitoring2_beta2-cli/src/main.rs @@ -914,7 +914,7 @@ fn main() { let mut app = App::new("cloudmonitoring2-beta2") .author("Sebastian Thiel ") - .version("1.0.0+20160718") + .version("1.0.0+20161031") .about("Accesses Google Cloud Monitoring data.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_cloudmonitoring2_beta2_cli") .arg(Arg::with_name("url") diff --git a/gen/cloudmonitoring2_beta2/Cargo.toml b/gen/cloudmonitoring2_beta2/Cargo.toml index be4e7421f3..6c2996422e 100644 --- a/gen/cloudmonitoring2_beta2/Cargo.toml +++ b/gen/cloudmonitoring2_beta2/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-cloudmonitoring2_beta2" -version = "1.0.0+20160718" +version = "1.0.0+20161031" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Monitoring (protocol v2beta2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudmonitoring2_beta2" diff --git a/gen/cloudmonitoring2_beta2/README.md b/gen/cloudmonitoring2_beta2/README.md index 745f1c77d7..3d6a4538c6 100644 --- a/gen/cloudmonitoring2_beta2/README.md +++ b/gen/cloudmonitoring2_beta2/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-cloudmonitoring2_beta2` library allows access to all features of the *Google Cloud Monitoring* service. -This documentation was generated from *Cloud Monitoring* crate version *1.0.0+20160718*, where *20160718* is the exact revision of the *cloudmonitoring:v2beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *Cloud Monitoring* crate version *1.0.0+20161031*, where *20161031* is the exact revision of the *cloudmonitoring:v2beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *Cloud Monitoring* *v2_beta2* API can be found at the [official documentation site](https://cloud.google.com/monitoring/v2beta2/). diff --git a/gen/cloudmonitoring2_beta2/src/lib.rs b/gen/cloudmonitoring2_beta2/src/lib.rs index 043079ffad..b0623d99bb 100644 --- a/gen/cloudmonitoring2_beta2/src/lib.rs +++ b/gen/cloudmonitoring2_beta2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Cloud Monitoring* crate version *1.0.0+20160718*, where *20160718* is the exact revision of the *cloudmonitoring:v2beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *Cloud Monitoring* crate version *1.0.0+20161031*, where *20161031* is the exact revision of the *cloudmonitoring:v2beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *Cloud Monitoring* *v2_beta2* API can be found at the //! [official documentation site](https://cloud.google.com/monitoring/v2beta2/). diff --git a/gen/cloudresourcemanager1-cli/Cargo.toml b/gen/cloudresourcemanager1-cli/Cargo.toml index 17545b142e..cfbf121239 100644 --- a/gen/cloudresourcemanager1-cli/Cargo.toml +++ b/gen/cloudresourcemanager1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-cloudresourcemanager1-cli" -version = "1.0.0+20160617" +version = "1.0.0+20161212" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Resource Manager (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudresourcemanager1-cli" diff --git a/gen/cloudresourcemanager1-cli/README.md b/gen/cloudresourcemanager1-cli/README.md index b3044712bb..25d1faf4ec 100644 --- a/gen/cloudresourcemanager1-cli/README.md +++ b/gen/cloudresourcemanager1-cli/README.md @@ -24,15 +24,23 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Cloud Resource Manager* API at revision *20160617*. The CLI is at version *1.0.0*. +This documentation was generated from the *Cloud Resource Manager* API at revision *20161212*. The CLI is at version *1.0.0*. ```bash cloudresourcemanager1 [options] operations get [-p ]... [-o ] + organizations + get [-p ]... [-o ] + get-iam-policy (-r )... [-p ]... [-o ] + search (-r )... [-p ]... [-o ] + set-iam-policy (-r )... [-p ]... [-o ] + test-iam-permissions (-r )... [-p ]... [-o ] projects + create (-r )... [-p ]... [-o ] delete [-p ]... [-o ] get [-p ]... [-o ] + get-ancestry (-r )... [-p ]... [-o ] get-iam-policy (-r )... [-p ]... [-o ] list [-p ]... [-o ] set-iam-policy (-r )... [-p ]... [-o ] diff --git a/gen/cloudresourcemanager1-cli/mkdocs.yml b/gen/cloudresourcemanager1-cli/mkdocs.yml index 2157d2ca7e..c859d31825 100644 --- a/gen/cloudresourcemanager1-cli/mkdocs.yml +++ b/gen/cloudresourcemanager1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Cloud Resource Manager v1.0.0+20160617 +site_name: Cloud Resource Manager v1.0.0+20161212 site_url: http://byron.github.io/google-apis-rs/google-cloudresourcemanager1-cli site_description: Write integrating applications with bcore @@ -10,8 +10,15 @@ site_dir: build_html pages: - ['index.md', 'Home'] - ['operations_get.md', 'Operations', 'Get'] +- ['organizations_get.md', 'Organizations', 'Get'] +- ['organizations_get-iam-policy.md', 'Organizations', 'Get Iam Policy'] +- ['organizations_search.md', 'Organizations', 'Search'] +- ['organizations_set-iam-policy.md', 'Organizations', 'Set Iam Policy'] +- ['organizations_test-iam-permissions.md', 'Organizations', 'Test Iam Permissions'] +- ['projects_create.md', 'Projects', 'Create'] - ['projects_delete.md', 'Projects', 'Delete'] - ['projects_get.md', 'Projects', 'Get'] +- ['projects_get-ancestry.md', 'Projects', 'Get Ancestry'] - ['projects_get-iam-policy.md', 'Projects', 'Get Iam Policy'] - ['projects_list.md', 'Projects', 'List'] - ['projects_set-iam-policy.md', 'Projects', 'Set Iam Policy'] diff --git a/gen/cloudresourcemanager1-cli/src/main.rs b/gen/cloudresourcemanager1-cli/src/main.rs index 151a5da40b..744efdf7f3 100644 --- a/gen/cloudresourcemanager1-cli/src/main.rs +++ b/gen/cloudresourcemanager1-cli/src/main.rs @@ -97,6 +97,492 @@ impl<'n> Engine<'n> { } } + fn _organizations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.organizations().get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _organizations_get_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec![]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GetIamPolicyRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.organizations().get_iam_policy(request, opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _organizations_search(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "page-token" => Some(("pageToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "page-size" => Some(("pageSize", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["filter", "page-size", "page-token"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::SearchOrganizationsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.organizations().search(request); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _organizations_set_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["etag", "policy", "version"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::SetIamPolicyRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.organizations().set_iam_policy(request, opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _organizations_test_iam_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "permissions" => Some(("permissions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["permissions"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::TestIamPermissionsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.organizations().test_iam_permissions(request, opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "parent.type" => Some(("parent.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "parent.id" => Some(("parent.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "lifecycle-state" => Some(("lifecycleState", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "project-number" => Some(("projectNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "id", "labels", "lifecycle-state", "name", "parent", "project-id", "project-number", "type"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Project = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().create(request); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _projects_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().delete(opt.value_of("project-id").unwrap_or("")); @@ -201,6 +687,90 @@ impl<'n> Engine<'n> { } } + fn _projects_get_ancestry(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec![]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GetAncestryRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().get_ancestry(request, opt.value_of("project-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _projects_get_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -370,8 +940,8 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["etag", "policy", "version"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -630,9 +1200,9 @@ impl<'n> Engine<'n> { "parent.id" => Some(("parent.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), - "project-number" => Some(("projectNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "lifecycle-state" => Some(("lifecycleState", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "lifecycle-state" => Some(("lifecycleState", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "project-number" => Some(("projectNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "id", "labels", "lifecycle-state", "name", "parent", "project-id", "project-number", "type"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -710,14 +1280,43 @@ impl<'n> Engine<'n> { } } }, + ("organizations", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._organizations_get(opt, dry_run, &mut err); + }, + ("get-iam-policy", Some(opt)) => { + call_result = self._organizations_get_iam_policy(opt, dry_run, &mut err); + }, + ("search", Some(opt)) => { + call_result = self._organizations_search(opt, dry_run, &mut err); + }, + ("set-iam-policy", Some(opt)) => { + call_result = self._organizations_set_iam_policy(opt, dry_run, &mut err); + }, + ("test-iam-permissions", Some(opt)) => { + call_result = self._organizations_test_iam_permissions(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("organizations".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, ("projects", Some(opt)) => { match opt.subcommand() { + ("create", Some(opt)) => { + call_result = self._projects_create(opt, dry_run, &mut err); + }, ("delete", Some(opt)) => { call_result = self._projects_delete(opt, dry_run, &mut err); }, ("get", Some(opt)) => { call_result = self._projects_get(opt, dry_run, &mut err); }, + ("get-ancestry", Some(opt)) => { + call_result = self._projects_get_ancestry(opt, dry_run, &mut err); + }, ("get-iam-policy", Some(opt)) => { call_result = self._projects_get_iam_policy(opt, dry_run, &mut err); }, @@ -830,7 +1429,9 @@ fn main() { let arg_data = [ ("operations", "methods: 'get'", vec![ ("get", - Some(r##"Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service."##), + Some(r##"Gets the latest state of a long-running operation. Clients can use this + method to poll the operation result at intervals as recommended by the API + service."##), "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_cli/operations_get", vec![ (Some(r##"name"##), @@ -853,36 +1454,14 @@ fn main() { ]), ]), - ("projects", "methods: 'delete', 'get', 'get-iam-policy', 'list', 'set-iam-policy', 'test-iam-permissions', 'undelete' and 'update'", vec![ - ("delete", - Some(r##"Marks the Project identified by the specified `project_id` (for example, `my-project-123`) for deletion. This method will only affect the Project if the following criteria are met: + The Project does not have a billing account associated with it. + The Project has a lifecycle state of ACTIVE. This method changes the Project's lifecycle state from ACTIVE to DELETE_REQUESTED. The deletion starts at an unspecified time, at which point the Project is no longer accessible. Until the deletion completes, you can check the lifecycle state checked by retrieving the Project with GetProject, and the Project remains visible to ListProjects. However, you cannot update the project. After the deletion completes, the Project is not retrievable by the GetProject and ListProjects methods. The caller must have modify permissions for this Project."##), - "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_cli/projects_delete", - vec![ - (Some(r##"project-id"##), - None, - Some(r##"The Project ID (for example, `foo-bar-123`). Required."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), + ("organizations", "methods: 'get', 'get-iam-policy', 'search', 'set-iam-policy' and 'test-iam-permissions'", vec![ ("get", - Some(r##"Retrieves the Project identified by the specified `project_id` (for example, `my-project-123`). The caller must have read permissions for this Project."##), - "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_cli/projects_get", + Some(r##"Fetches an Organization resource identified by the specified resource name."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_cli/organizations_get", vec![ - (Some(r##"project-id"##), + (Some(r##"name"##), None, - Some(r##"The Project ID (for example, `my-project-123`). Required."##), + Some(r##"The resource name of the Organization to fetch, e.g. "organizations/1234"."##), Some(true), Some(false)), @@ -899,12 +1478,275 @@ fn main() { Some(false)), ]), ("get-iam-policy", - Some(r##"Returns the IAM access control policy for the specified Project. Permission is denied if the policy or the resource does not exist."##), + Some(r##"Gets the access control policy for an Organization resource. May be empty + if no such policy or resource exists. The `resource` field should be the + organization's resource name, e.g. "organizations/123"."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_cli/organizations_get-iam-policy", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy is being requested. + `resource` is usually specified as a path. For example, a Project + resource is specified as `projects/{project}`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("search", + Some(r##"Searches Organization resources that are visible to the user and satisfy + the specified filter. This method returns Organizations in an unspecified + order. New Organizations do not necessarily appear at the end of the + results."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_cli/organizations_search", + vec![ + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("set-iam-policy", + Some(r##"Sets the access control policy on an Organization resource. Replaces any + existing policy. The `resource` field should be the organization's resource + name, e.g. "organizations/123"."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_cli/organizations_set-iam-policy", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy is being specified. + `resource` is usually specified as a path. For example, a Project + resource is specified as `projects/{project}`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("test-iam-permissions", + Some(r##"Returns permissions that a caller has on the specified Organization. + The `resource` field should be the organization's resource name, + e.g. "organizations/123"."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_cli/organizations_test-iam-permissions", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy detail is being requested. + `resource` is usually specified as a path. For example, a Project + resource is specified as `projects/{project}`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("projects", "methods: 'create', 'delete', 'get', 'get-ancestry', 'get-iam-policy', 'list', 'set-iam-policy', 'test-iam-permissions', 'undelete' and 'update'", vec![ + ("create", + Some(r##"Request that a new Project be created. The result is an Operation which + can be used to track the creation process. It is automatically deleted + after a few hours, so there is no need to call DeleteOperation. + + Our SLO permits Project creation to take up to 30 seconds at the 90th + percentile. As of 2016-08-29, we are observing 6 seconds 50th percentile + latency. 95th percentile latency is around 11 seconds. We recommend + polling at the 5th second with an exponential backoff."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_cli/projects_create", + vec![ + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("delete", + Some(r##"Marks the Project identified by the specified + `project_id` (for example, `my-project-123`) for deletion. + This method will only affect the Project if the following criteria are met: + + + The Project does not have a billing account associated with it. + + The Project has a lifecycle state of + ACTIVE. + + This method changes the Project's lifecycle state from + ACTIVE + to DELETE_REQUESTED. + The deletion starts at an unspecified time, + at which point the Project is no longer accessible. + + Until the deletion completes, you can check the lifecycle state + checked by retrieving the Project with GetProject, + and the Project remains visible to ListProjects. + However, you cannot update the project. + + After the deletion completes, the Project is not retrievable by + the GetProject and + ListProjects methods. + + The caller must have modify permissions for this Project."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_cli/projects_delete", + vec![ + (Some(r##"project-id"##), + None, + Some(r##"The Project ID (for example, `foo-bar-123`). + + Required."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("get", + Some(r##"Retrieves the Project identified by the specified + `project_id` (for example, `my-project-123`). + + The caller must have read permissions for this Project."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_cli/projects_get", + vec![ + (Some(r##"project-id"##), + None, + Some(r##"The Project ID (for example, `my-project-123`). + + Required."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("get-ancestry", + Some(r##"Gets a list of ancestors in the resource hierarchy for the Project + identified by the specified `project_id` (for example, `my-project-123`). + + The caller must have read permissions for this Project."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_cli/projects_get-ancestry", + vec![ + (Some(r##"project-id"##), + None, + Some(r##"The Project ID (for example, `my-project-123`). + + Required."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("get-iam-policy", + Some(r##"Returns the IAM access control policy for the specified Project. + Permission is denied if the policy or the resource does not exist."##), "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_cli/projects_get-iam-policy", vec![ (Some(r##"resource"##), None, - Some(r##"REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation."##), + Some(r##"REQUIRED: The resource for which the policy is being requested. + `resource` is usually specified as a path. For example, a Project + resource is specified as `projects/{project}`."##), Some(true), Some(false)), @@ -927,7 +1769,9 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Lists Projects that are visible to the user and satisfy the specified filter. This method returns Projects in an unspecified order. New Projects do not necessarily appear at the end of the list."##), + Some(r##"Lists Projects that are visible to the user and satisfy the + specified filter. This method returns Projects in an unspecified order. + New Projects do not necessarily appear at the end of the list."##), "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_cli/projects_list", vec![ (Some(r##"v"##), @@ -943,12 +1787,51 @@ fn main() { Some(false)), ]), ("set-iam-policy", - Some(r##"Sets the IAM access control policy for the specified Project. Replaces any existing policy. The following constraints apply when using `setIamPolicy()`: + Project does not support `allUsers` and `allAuthenticatedUsers` as `members` in a `Binding` of a `Policy`. + The owner role can be granted only to `user` and `serviceAccount`. + Service accounts can be made owners of a project directly without any restrictions. However, to be added as an owner, a user must be invited via Cloud Platform console and must accept the invitation. + A user cannot be granted the owner role using `setIamPolicy()`. The user must be granted the owner role using the Cloud Platform Console and must explicitly accept the invitation. + Invitations to grant the owner role cannot be sent using `setIamPolicy()`; they must be sent only using the Cloud Platform Console. + Membership changes that leave the project without any owners that have accepted the Terms of Service (ToS) will be rejected. + Members cannot be added to more than one role in the same policy. + There must be at least one owner who has accepted the Terms of Service (ToS) agreement in the policy. Calling `setIamPolicy()` to to remove the last ToS-accepted owner from the policy will fail. This restriction also applies to legacy projects that no longer have owners who have accepted the ToS. Edits to IAM policies will be rejected until the lack of a ToS-accepting owner is rectified. + Calling this method requires enabling the App Engine Admin API. Note: Removing service accounts from policies or changing their roles can render services completely inoperable. It is important to understand how the service account is being used before removing or updating its roles."##), + Some(r##"Sets the IAM access control policy for the specified Project. Replaces + any existing policy. + + The following constraints apply when using `setIamPolicy()`: + + + Project does not support `allUsers` and `allAuthenticatedUsers` as + `members` in a `Binding` of a `Policy`. + + + The owner role can be granted only to `user` and `serviceAccount`. + + + Service accounts can be made owners of a project directly + without any restrictions. However, to be added as an owner, a user must be + invited via Cloud Platform console and must accept the invitation. + + + A user cannot be granted the owner role using `setIamPolicy()`. The user + must be granted the owner role using the Cloud Platform Console and must + explicitly accept the invitation. + + + Invitations to grant the owner role cannot be sent using + `setIamPolicy()`; + they must be sent only using the Cloud Platform Console. + + + Membership changes that leave the project without any owners that have + accepted the Terms of Service (ToS) will be rejected. + + + There must be at least one owner who has accepted the Terms of + Service (ToS) agreement in the policy. Calling `setIamPolicy()` to + to remove the last ToS-accepted owner from the policy will fail. This + restriction also applies to legacy projects that no longer have owners + who have accepted the ToS. Edits to IAM policies will be rejected until + the lack of a ToS-accepting owner is rectified. + + + Calling this method requires enabling the App Engine Admin API. + + Note: Removing service accounts from policies or changing their roles + can render services completely inoperable. It is important to understand + how the service account is being used before removing or updating its + roles."##), "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_cli/projects_set-iam-policy", vec![ (Some(r##"resource"##), None, - Some(r##"REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `setIamPolicy` documentation."##), + Some(r##"REQUIRED: The resource for which the policy is being specified. + `resource` is usually specified as a path. For example, a Project + resource is specified as `projects/{project}`."##), Some(true), Some(false)), @@ -976,7 +1859,9 @@ fn main() { vec![ (Some(r##"resource"##), None, - Some(r##"REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `testIamPermissions` documentation."##), + Some(r##"REQUIRED: The resource for which the policy detail is being requested. + `resource` is usually specified as a path. For example, a Project + resource is specified as `projects/{project}`."##), Some(true), Some(false)), @@ -999,12 +1884,20 @@ fn main() { Some(false)), ]), ("undelete", - Some(r##"Restores the Project identified by the specified `project_id` (for example, `my-project-123`). You can only use this method for a Project that has a lifecycle state of DELETE_REQUESTED. After deletion starts, the Project cannot be restored. The caller must have modify permissions for this Project."##), + Some(r##"Restores the Project identified by the specified + `project_id` (for example, `my-project-123`). + You can only use this method for a Project that has a lifecycle state of + DELETE_REQUESTED. + After deletion starts, the Project cannot be restored. + + The caller must have modify permissions for this Project."##), "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_cli/projects_undelete", vec![ (Some(r##"project-id"##), None, - Some(r##"The project ID (for example, `foo-bar-123`). Required."##), + Some(r##"The project ID (for example, `foo-bar-123`). + + Required."##), Some(true), Some(false)), @@ -1027,12 +1920,17 @@ fn main() { Some(false)), ]), ("update", - Some(r##"Updates the attributes of the Project identified by the specified `project_id` (for example, `my-project-123`). The caller must have modify permissions for this Project."##), + Some(r##"Updates the attributes of the Project identified by the specified + `project_id` (for example, `my-project-123`). + + The caller must have modify permissions for this Project."##), "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_cli/projects_update", vec![ (Some(r##"project-id"##), None, - Some(r##"The project ID (for example, `my-project-123`). Required."##), + Some(r##"The project ID (for example, `my-project-123`). + + Required."##), Some(true), Some(false)), @@ -1060,7 +1958,7 @@ fn main() { let mut app = App::new("cloudresourcemanager1") .author("Sebastian Thiel ") - .version("1.0.0+20160617") + .version("1.0.0+20161212") .about("The Google Cloud Resource Manager API provides methods for creating, reading, and updating project metadata.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_cli") .arg(Arg::with_name("url") diff --git a/gen/cloudresourcemanager1/Cargo.toml b/gen/cloudresourcemanager1/Cargo.toml index 82f0d9714d..dbd926ebf8 100644 --- a/gen/cloudresourcemanager1/Cargo.toml +++ b/gen/cloudresourcemanager1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-cloudresourcemanager1" -version = "1.0.0+20160617" +version = "1.0.0+20161212" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Resource Manager (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudresourcemanager1" diff --git a/gen/cloudresourcemanager1/README.md b/gen/cloudresourcemanager1/README.md index 0967f5b4e4..c1f4ac0aa9 100644 --- a/gen/cloudresourcemanager1/README.md +++ b/gen/cloudresourcemanager1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-cloudresourcemanager1` library allows access to all features of the *Google Cloud Resource Manager* service. -This documentation was generated from *Cloud Resource Manager* crate version *1.0.0+20160617*, where *20160617* is the exact revision of the *cloudresourcemanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *Cloud Resource Manager* crate version *1.0.0+20161212*, where *20161212* is the exact revision of the *cloudresourcemanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *Cloud Resource Manager* *v1* API can be found at the [official documentation site](https://cloud.google.com/resource-manager). @@ -15,8 +15,10 @@ Handle the following *Resources* with ease from the central [hub](http://byron.g * [operations](http://byron.github.io/google-apis-rs/google_cloudresourcemanager1/struct.Operation.html) * [*get*](http://byron.github.io/google-apis-rs/google_cloudresourcemanager1/struct.OperationGetCall.html) +* [organizations](http://byron.github.io/google-apis-rs/google_cloudresourcemanager1/struct.Organization.html) + * [*get*](http://byron.github.io/google-apis-rs/google_cloudresourcemanager1/struct.OrganizationGetCall.html), [*get iam policy*](http://byron.github.io/google-apis-rs/google_cloudresourcemanager1/struct.OrganizationGetIamPolicyCall.html), [*search*](http://byron.github.io/google-apis-rs/google_cloudresourcemanager1/struct.OrganizationSearchCall.html), [*set iam policy*](http://byron.github.io/google-apis-rs/google_cloudresourcemanager1/struct.OrganizationSetIamPolicyCall.html) and [*test iam permissions*](http://byron.github.io/google-apis-rs/google_cloudresourcemanager1/struct.OrganizationTestIamPermissionCall.html) * [projects](http://byron.github.io/google-apis-rs/google_cloudresourcemanager1/struct.Project.html) - * [*delete*](http://byron.github.io/google-apis-rs/google_cloudresourcemanager1/struct.ProjectDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_cloudresourcemanager1/struct.ProjectGetCall.html), [*get iam policy*](http://byron.github.io/google-apis-rs/google_cloudresourcemanager1/struct.ProjectGetIamPolicyCall.html), [*list*](http://byron.github.io/google-apis-rs/google_cloudresourcemanager1/struct.ProjectListCall.html), [*set iam policy*](http://byron.github.io/google-apis-rs/google_cloudresourcemanager1/struct.ProjectSetIamPolicyCall.html), [*test iam permissions*](http://byron.github.io/google-apis-rs/google_cloudresourcemanager1/struct.ProjectTestIamPermissionCall.html), [*undelete*](http://byron.github.io/google-apis-rs/google_cloudresourcemanager1/struct.ProjectUndeleteCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_cloudresourcemanager1/struct.ProjectUpdateCall.html) + * [*create*](http://byron.github.io/google-apis-rs/google_cloudresourcemanager1/struct.ProjectCreateCall.html), [*delete*](http://byron.github.io/google-apis-rs/google_cloudresourcemanager1/struct.ProjectDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_cloudresourcemanager1/struct.ProjectGetCall.html), [*get ancestry*](http://byron.github.io/google-apis-rs/google_cloudresourcemanager1/struct.ProjectGetAncestryCall.html), [*get iam policy*](http://byron.github.io/google-apis-rs/google_cloudresourcemanager1/struct.ProjectGetIamPolicyCall.html), [*list*](http://byron.github.io/google-apis-rs/google_cloudresourcemanager1/struct.ProjectListCall.html), [*set iam policy*](http://byron.github.io/google-apis-rs/google_cloudresourcemanager1/struct.ProjectSetIamPolicyCall.html), [*test iam permissions*](http://byron.github.io/google-apis-rs/google_cloudresourcemanager1/struct.ProjectTestIamPermissionCall.html), [*undelete*](http://byron.github.io/google-apis-rs/google_cloudresourcemanager1/struct.ProjectUndeleteCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_cloudresourcemanager1/struct.ProjectUpdateCall.html) @@ -49,13 +51,15 @@ let r = hub.resource().activity(...).doit() Or specifically ... ```ignore -let r = hub.projects().get(...).doit() +let r = hub.projects().test_iam_permissions(...).doit() let r = hub.projects().undelete(...).doit() let r = hub.projects().set_iam_policy(...).doit() -let r = hub.projects().test_iam_permissions(...).doit() +let r = hub.projects().get(...).doit() +let r = hub.projects().get_ancestry(...).doit() let r = hub.projects().update(...).doit() let r = hub.projects().get_iam_policy(...).doit() let r = hub.projects().delete(...).doit() +let r = hub.projects().create(...).doit() let r = hub.projects().list(...).doit() ``` diff --git a/gen/cloudresourcemanager1/src/lib.rs b/gen/cloudresourcemanager1/src/lib.rs index ae951bac03..302a0d96d7 100644 --- a/gen/cloudresourcemanager1/src/lib.rs +++ b/gen/cloudresourcemanager1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Cloud Resource Manager* crate version *1.0.0+20160617*, where *20160617* is the exact revision of the *cloudresourcemanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *Cloud Resource Manager* crate version *1.0.0+20161212*, where *20161212* is the exact revision of the *cloudresourcemanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *Cloud Resource Manager* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/resource-manager). @@ -13,8 +13,10 @@ //! //! * [operations](struct.Operation.html) //! * [*get*](struct.OperationGetCall.html) +//! * [organizations](struct.Organization.html) +//! * [*get*](struct.OrganizationGetCall.html), [*get iam policy*](struct.OrganizationGetIamPolicyCall.html), [*search*](struct.OrganizationSearchCall.html), [*set iam policy*](struct.OrganizationSetIamPolicyCall.html) and [*test iam permissions*](struct.OrganizationTestIamPermissionCall.html) //! * [projects](struct.Project.html) -//! * [*delete*](struct.ProjectDeleteCall.html), [*get*](struct.ProjectGetCall.html), [*get iam policy*](struct.ProjectGetIamPolicyCall.html), [*list*](struct.ProjectListCall.html), [*set iam policy*](struct.ProjectSetIamPolicyCall.html), [*test iam permissions*](struct.ProjectTestIamPermissionCall.html), [*undelete*](struct.ProjectUndeleteCall.html) and [*update*](struct.ProjectUpdateCall.html) +//! * [*create*](struct.ProjectCreateCall.html), [*delete*](struct.ProjectDeleteCall.html), [*get*](struct.ProjectGetCall.html), [*get ancestry*](struct.ProjectGetAncestryCall.html), [*get iam policy*](struct.ProjectGetIamPolicyCall.html), [*list*](struct.ProjectListCall.html), [*set iam policy*](struct.ProjectSetIamPolicyCall.html), [*test iam permissions*](struct.ProjectTestIamPermissionCall.html), [*undelete*](struct.ProjectUndeleteCall.html) and [*update*](struct.ProjectUpdateCall.html) //! //! //! @@ -49,13 +51,15 @@ //! Or specifically ... //! //! ```ignore -//! let r = hub.projects().get(...).doit() +//! let r = hub.projects().test_iam_permissions(...).doit() //! let r = hub.projects().undelete(...).doit() //! let r = hub.projects().set_iam_policy(...).doit() -//! let r = hub.projects().test_iam_permissions(...).doit() +//! let r = hub.projects().get(...).doit() +//! let r = hub.projects().get_ancestry(...).doit() //! let r = hub.projects().update(...).doit() //! let r = hub.projects().get_iam_policy(...).doit() //! let r = hub.projects().delete(...).doit() +//! let r = hub.projects().create(...).doit() //! let r = hub.projects().list(...).doit() //! ``` //! @@ -103,9 +107,9 @@ //! // execute the final call using `doit()`. //! // Values shown here are possibly random and not representative ! //! let result = hub.projects().list() -//! .page_token("sadipscing") -//! .page_size(-31) -//! .filter("ea") +//! .page_token("justo") +//! .page_size(-34) +//! .filter("et") //! .doit(); //! //! match result { diff --git a/gen/cloudresourcemanager1/src/lib.rs.in b/gen/cloudresourcemanager1/src/lib.rs.in index 8d56646554..7868a107c3 100644 --- a/gen/cloudresourcemanager1/src/lib.rs.in +++ b/gen/cloudresourcemanager1/src/lib.rs.in @@ -145,6 +145,9 @@ impl<'a, C, A> CloudResourceManager pub fn operations(&'a self) -> OperationMethods<'a, C, A> { OperationMethods { hub: &self } } + pub fn organizations(&'a self) -> OrganizationMethods<'a, C, A> { + OrganizationMethods { hub: &self } + } pub fn projects(&'a self) -> ProjectMethods<'a, C, A> { ProjectMethods { hub: &self } } @@ -164,7 +167,8 @@ impl<'a, C, A> CloudResourceManager // ############ // SCHEMAS ### // ########## -/// The request sent to the UndeleteProject method. +/// The request sent to the UndeleteProject +/// method. /// /// # Activities /// @@ -179,41 +183,6 @@ pub struct UndeleteProjectRequest { _never_set: Option } impl RequestValue for UndeleteProjectRequest {} -/// The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). The error model is designed to be: - Simple to use and understand for most users - Flexible enough to meet unexpected needs # Overview The `Status` message contains three pieces of data: error code, error message, and error details. The error code should be an enum value of google.rpc.Code, but it may accept additional error codes if needed. The error message should be a developer-facing English message that helps developers *understand* and *resolve* the error. If a localized user-facing error message is needed, put the localized message in the error details or localize it in the client. The optional error details may contain arbitrary information about the error. There is a predefined set of error detail types in the package `google.rpc` which can be used for common error conditions. # Language mapping The `Status` message is the logical representation of the error model, but it is not necessarily the actual wire format. When the `Status` message is exposed in different client libraries and different wire protocols, it can be mapped differently. For example, it will likely be mapped to some exceptions in Java, but more likely mapped to some error codes in C. # Other uses The error model and the `Status` message can be used in a variety of environments, either with or without APIs, to provide a consistent developer experience across different environments. Example uses of this error model include: - Partial errors. If a service needs to return partial errors to the client, it may embed the `Status` in the normal response to indicate the partial errors. - Workflow errors. A typical workflow has multiple steps. Each step may have a `Status` message for error reporting purpose. - Batch operations. If a client uses batch request and batch response, the `Status` message should be used directly inside batch response, one for each error sub-response. - Asynchronous operations. If an API call embeds asynchronous operation results in its response, the status of those operations should be represented directly using the `Status` message. - Logging. If some API errors are stored in logs, the message `Status` could be used directly after any stripping needed for security/privacy reasons. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Status { - /// A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client. - pub message: Option, - /// The status code, which should be an enum value of google.rpc.Code. - pub code: Option, - /// A list of messages that carry the error details. There will be a common set of message types for APIs to use. - pub details: Option>>, -} - -impl Part for Status {} - - -/// Response message for `TestIamPermissions` method. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [test iam permissions projects](struct.ProjectTestIamPermissionCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TestIamPermissionsResponse { - /// A subset of `TestPermissionsRequest.permissions` that the caller is allowed. - pub permissions: Option>, -} - -impl ResponseResult for TestIamPermissionsResponse {} - - /// Request message for `GetIamPolicy` method. /// /// # Activities @@ -222,6 +191,7 @@ impl ResponseResult for TestIamPermissionsResponse {} /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [get iam policy projects](struct.ProjectGetIamPolicyCall.html) (request) +/// * [get iam policy organizations](struct.OrganizationGetIamPolicyCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GetIamPolicyRequest { _never_set: Option } @@ -236,17 +206,47 @@ impl RequestValue for GetIamPolicyRequest {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// +/// * [test iam permissions organizations](struct.OrganizationTestIamPermissionCall.html) (request) /// * [test iam permissions projects](struct.ProjectTestIamPermissionCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TestIamPermissionsRequest { - /// The set of permissions to check for the `resource`. Permissions with wildcards (such as '*' or 'storage.*') are not allowed. For more information see IAM Overview. + /// The set of permissions to check for the `resource`. Permissions with + /// wildcards (such as '*' or 'storage.*') are not allowed. For more + /// information see + /// [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). pub permissions: Option>, } impl RequestValue for TestIamPermissionsRequest {} +/// The response returned from the `SearchOrganizations` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [search organizations](struct.OrganizationSearchCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SearchOrganizationsResponse { + /// A pagination token to be used to retrieve the next page of results. If the + /// result is too large to fit within the page size specified in the request, + /// this field will be set with a token that can be used to fetch the next page + /// of results. If this field is empty, it indicates that this response + /// contains the last page of results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The list of Organizations that matched the search query, possibly + /// paginated. + pub organizations: Option>, +} + +impl ResponseResult for SearchOrganizationsResponse {} + + /// Request message for `SetIamPolicy` method. /// /// # Activities @@ -255,81 +255,122 @@ impl RequestValue for TestIamPermissionsRequest {} /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [set iam policy projects](struct.ProjectSetIamPolicyCall.html) (request) +/// * [set iam policy organizations](struct.OrganizationSetIamPolicyCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct SetIamPolicyRequest { - /// REQUIRED: The complete policy to be applied to the `resource`. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them. + /// REQUIRED: The complete policy to be applied to the `resource`. The size of + /// the policy is limited to a few 10s of KB. An empty policy is a + /// valid policy but certain Cloud Platform services (such as Projects) + /// might reject them. pub policy: Option, } impl RequestValue for SetIamPolicyRequest {} -/// A container to reference an id for any resource type. A `resource` in Google Cloud Platform is a generic term for something you (a developer) may want to interact with through one of our API's. Some examples are an AppEngine app, a Compute Engine instance, a Cloud SQL database, and so on. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ResourceId { - /// Required field representing the resource type this id is for. At present, the only valid type is "organization". - #[serde(rename="type")] - pub type_: Option, - /// Required field for the type-specific id. This should correspond to the id used in the type-specific API's. - pub id: Option, -} - -impl Part for ResourceId {} - - -/// Associates `members` with a `role`. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Binding { - /// Role that is assigned to `members`. For example, `roles/viewer`, `roles/editor`, or `roles/owner`. Required - pub role: Option, - /// Specifies the identities requesting access for a Cloud Platform resource. `members` can have the following values: * `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account. * `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account. * `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@gmail.com` or `joe@example.com`. * `serviceAccount:{emailid}`: An email address that represents a service account. For example, `my-other-app@appspot.gserviceaccount.com`. * `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`. * `domain:{domain}`: A Google Apps domain name that represents all the users of that domain. For example, `google.com` or `example.com`. - pub members: Option>, -} - -impl Part for Binding {} - - -/// A Project is a high-level Google Cloud Platform entity. It is a container for ACLs, APIs, AppEngine Apps, VMs, and other Google Cloud Platform resources. +/// Response from the GetAncestry method. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [get projects](struct.ProjectGetCall.html) (response) +/// * [get ancestry projects](struct.ProjectGetAncestryCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GetAncestryResponse { + /// Ancestors are ordered from bottom to top of the resource hierarchy. The + /// first ancestor is the project itself, followed by the project's parent, + /// etc. + pub ancestor: Option>, +} + +impl ResponseResult for GetAncestryResponse {} + + +/// A Project is a high-level Google Cloud Platform entity. It is a +/// container for ACLs, APIs, AppEngine Apps, VMs, and other +/// Google Cloud Platform resources. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [test iam permissions projects](struct.ProjectTestIamPermissionCall.html) (none) /// * [undelete projects](struct.ProjectUndeleteCall.html) (none) /// * [set iam policy projects](struct.ProjectSetIamPolicyCall.html) (none) -/// * [test iam permissions projects](struct.ProjectTestIamPermissionCall.html) (none) +/// * [get projects](struct.ProjectGetCall.html) (response) +/// * [get ancestry projects](struct.ProjectGetAncestryCall.html) (none) /// * [update projects](struct.ProjectUpdateCall.html) (request|response) /// * [get iam policy projects](struct.ProjectGetIamPolicyCall.html) (none) /// * [delete projects](struct.ProjectDeleteCall.html) (none) +/// * [create projects](struct.ProjectCreateCall.html) (request) /// * [list projects](struct.ProjectListCall.html) (none) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Project { - /// The user-assigned display name of the Project. It must be 4 to 30 characters. Allowed characters are: lowercase and uppercase letters, numbers, hyphen, single-quote, double-quote, space, and exclamation point. Example: My Project Read-write. + /// The user-assigned display name of the Project. + /// It must be 4 to 30 characters. + /// Allowed characters are: lowercase and uppercase letters, numbers, + /// hyphen, single-quote, double-quote, space, and exclamation point. + /// + /// Example: My Project + /// + /// Read-write. pub name: Option, - /// An optional reference to a parent Resource. The only supported parent type is "organization". Once set, the parent cannot be modified. Read-write. + /// An optional reference to a parent Resource. + /// + /// The only supported parent type is "organization". Once set, the parent + /// cannot be modified. The `parent` can be set on creation or using the + /// `UpdateProject` method; the end user must have the + /// `resourcemanager.projects.create` permission on the parent. + /// + /// Read-write. pub parent: Option, - /// The unique, user-assigned ID of the Project. It must be 6 to 30 lowercase letters, digits, or hyphens. It must start with a letter. Trailing hyphens are prohibited. Example: tokyo-rain-123 Read-only after creation. + /// The unique, user-assigned ID of the Project. + /// It must be 6 to 30 lowercase letters, digits, or hyphens. + /// It must start with a letter. + /// Trailing hyphens are prohibited. + /// + /// Example: tokyo-rain-123 + /// + /// Read-only after creation. #[serde(rename="projectId")] pub project_id: Option, - /// The labels associated with this Project. Label keys must be between 1 and 63 characters long and must conform to the following regular expression: \[a-z\](\[-a-z0-9\]*\[a-z0-9\])?. Label values must be between 0 and 63 characters long and must conform to the regular expression (\[a-z\](\[-a-z0-9\]*\[a-z0-9\])?)?. No more than 256 labels can be associated with a given resource. Clients should store labels in a representation such as JSON that does not depend on specific characters being disallowed. Example: "environment" : "dev" Read-write. + /// The labels associated with this Project. + /// + /// Label keys must be between 1 and 63 characters long and must conform + /// to the following regular expression: \[a-z\](\[-a-z0-9\]*\[a-z0-9\])?. + /// + /// Label values must be between 0 and 63 characters long and must conform + /// to the regular expression (\[a-z\](\[-a-z0-9\]*\[a-z0-9\])?)?. + /// + /// No more than 256 labels can be associated with a given resource. + /// + /// Clients should store labels in a representation such as JSON that does not + /// depend on specific characters being disallowed. + /// + /// Example: "environment" : "dev" + /// + /// Read-write. pub labels: Option>, - /// The number uniquely identifying the project. Example: 415104041262 Read-only. - #[serde(rename="projectNumber")] - pub project_number: Option, - /// Creation time. Read-only. + /// Creation time. + /// + /// Read-only. #[serde(rename="createTime")] pub create_time: Option, - /// The Project lifecycle state. Read-only. + /// The number uniquely identifying the project. + /// + /// Example: 415104041262 + /// + /// Read-only. + #[serde(rename="projectNumber")] + pub project_number: Option, + /// The Project lifecycle state. + /// + /// Read-only. #[serde(rename="lifecycleState")] pub lifecycle_state: Option, } @@ -339,7 +380,54 @@ impl Resource for Project {} impl ResponseResult for Project {} -/// Defines an Identity and Access Management (IAM) policy. It is used to specify access control policies for Cloud Platform resources. A `Policy` consists of a list of `bindings`. A `Binding` binds a list of `members` to a `role`, where the members can be user accounts, Google groups, Google domains, and service accounts. A `role` is a named list of permissions defined by IAM. **Example** { "bindings": [ { "role": "roles/owner", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-other-app@appspot.gserviceaccount.com", ] }, { "role": "roles/viewer", "members": ["user:sean@example.com"] } ] } For a description of IAM and its features, see the [IAM developer's guide](https://cloud.google.com/iam). +/// The request sent to the +/// GetAncestry +/// method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get ancestry projects](struct.ProjectGetAncestryCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GetAncestryRequest { _never_set: Option } + +impl RequestValue for GetAncestryRequest {} + + +/// Defines an Identity and Access Management (IAM) policy. It is used to +/// specify access control policies for Cloud Platform resources. +/// +/// +/// A `Policy` consists of a list of `bindings`. A `Binding` binds a list of +/// `members` to a `role`, where the members can be user accounts, Google groups, +/// Google domains, and service accounts. A `role` is a named list of permissions +/// defined by IAM. +/// +/// **Example** +/// +/// { +/// "bindings": [ +/// { +/// "role": "roles/owner", +/// "members": [ +/// "user:mike@example.com", +/// "group:admins@example.com", +/// "domain:google.com", +/// "serviceAccount:my-other-app@appspot.gserviceaccount.com", +/// ] +/// }, +/// { +/// "role": "roles/viewer", +/// "members": ["user:sean@example.com"] +/// } +/// ] +/// } +/// +/// For a description of IAM and its features, see the +/// [IAM developer's guide](https://cloud.google.com/iam). /// /// # Activities /// @@ -347,70 +435,101 @@ impl ResponseResult for Project {} /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [set iam policy projects](struct.ProjectSetIamPolicyCall.html) (response) +/// * [set iam policy organizations](struct.OrganizationSetIamPolicyCall.html) (response) /// * [get iam policy projects](struct.ProjectGetIamPolicyCall.html) (response) +/// * [get iam policy organizations](struct.OrganizationGetIamPolicyCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Policy { - /// Associates a list of `members` to a `role`. Multiple `bindings` must not be specified for the same `role`. `bindings` with no members will result in an error. + /// Associates a list of `members` to a `role`. + /// Multiple `bindings` must not be specified for the same `role`. + /// `bindings` with no members will result in an error. pub bindings: Option>, + /// `etag` is used for optimistic concurrency control as a way to help + /// prevent simultaneous updates of a policy from overwriting each other. + /// It is strongly suggested that systems make use of the `etag` in the + /// read-modify-write cycle to perform policy updates in order to avoid race + /// conditions: An `etag` is returned in the response to `getIamPolicy`, and + /// systems are expected to put that etag in the request to `setIamPolicy` to + /// ensure that their change will be applied to the same version of the policy. + /// + /// If no `etag` is provided in the call to `setIamPolicy`, then the existing + /// policy is overwritten blindly. + pub etag: Option, /// Version of the `Policy`. The default version is 0. pub version: Option, - /// `etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other. It is strongly suggested that systems make use of the `etag` in the read-modify-write cycle to perform policy updates in order to avoid race conditions: An `etag` is returned in the response to `getIamPolicy`, and systems are expected to put that etag in the request to `setIamPolicy` to ensure that their change will be applied to the same version of the policy. If no `etag` is provided in the call to `setIamPolicy`, then the existing policy is overwritten blindly. - pub etag: Option, } impl ResponseResult for Policy {} -/// This resource represents a long-running operation that is the result of a network API call. +/// The root node in the resource hierarchy to which a particular entity's +/// (e.g., company) resources belong. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [get operations](struct.OperationGetCall.html) (response) +/// * [test iam permissions organizations](struct.OrganizationTestIamPermissionCall.html) (none) +/// * [search organizations](struct.OrganizationSearchCall.html) (none) +/// * [set iam policy organizations](struct.OrganizationSetIamPolicyCall.html) (none) +/// * [get organizations](struct.OrganizationGetCall.html) (response) +/// * [get iam policy organizations](struct.OrganizationGetIamPolicyCall.html) (none) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Operation { - /// Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any. - pub metadata: Option>, - /// If the value is `false`, it means the operation is still in progress. If true, the operation is completed, and either `error` or `response` is available. - pub done: Option, - /// The normal response of the operation in case of success. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`. - pub response: Option>, - /// The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should have the format of `operations/some/unique/name`. +pub struct Organization { + /// The owner of this Organization. The owner should be specified on + /// creation. Once set, it cannot be changed. + /// This field is required. + pub owner: Option, + /// A friendly string to be used to refer to the Organization in the UI. + /// Assigned by the server, set to the firm name of the Google For Work + /// customer that owns this organization. + /// @OutputOnly + #[serde(rename="displayName")] + pub display_name: Option, + /// Timestamp when the Organization was created. Assigned by the server. + /// @OutputOnly + #[serde(rename="creationTime")] + pub creation_time: Option, + /// The organization's current lifecycle state. Assigned by the server. + /// @OutputOnly + #[serde(rename="lifecycleState")] + pub lifecycle_state: Option, + /// Output Only. The resource name of the organization. This is the + /// organization's relative path in the API. Its format is + /// "organizations/[organization_id]". For example, "organizations/1234". pub name: Option, - /// The error result of the operation in case of failure. - pub error: Option, } -impl Resource for Operation {} -impl ResponseResult for Operation {} +impl Resource for Organization {} +impl ResponseResult for Organization {} -/// A page of the response received from the ListProjects method. A paginated response where more pages are available has `next_page_token` set. This token can be used in a subsequent request to retrieve the next request page. +/// Identifying information for a single ancestor of a project. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [list projects](struct.ProjectListCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListProjectsResponse { - /// Pagination token. If the result set is too large to fit in a single response, this token is returned. It encodes the position of the current result cursor. Feeding this value into a new list request with the `page_token` parameter gives the next page of the results. When `next_page_token` is not filled in, there is no next page and the list returned is the last page in the result set. Pagination tokens have a limited lifetime. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The list of Projects that matched the list filter. This list can be paginated. - pub projects: Option>, +pub struct Ancestor { + /// Resource id of the ancestor. + #[serde(rename="resourceId")] + pub resource_id: Option, } -impl ResponseResult for ListProjectsResponse {} +impl Part for Ancestor {} -/// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON representation for `Empty` is empty JSON object `{}`. +/// A generic empty message that you can re-use to avoid defining duplicated +/// empty messages in your APIs. A typical example is to use it as the request +/// or the response type of an API method. For instance: +/// +/// service Foo { +/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); +/// } +/// +/// The JSON representation for `Empty` is empty JSON object `{}`. /// /// # Activities /// @@ -426,6 +545,295 @@ pub struct Empty { _never_set: Option } impl ResponseResult for Empty {} +/// The `Status` type defines a logical error model that is suitable for different +/// programming environments, including REST APIs and RPC APIs. It is used by +/// [gRPC](https://github.com/grpc). The error model is designed to be: +/// +/// - Simple to use and understand for most users +/// - Flexible enough to meet unexpected needs +/// +/// # Overview +/// +/// The `Status` message contains three pieces of data: error code, error message, +/// and error details. The error code should be an enum value of +/// google.rpc.Code, but it may accept additional error codes if needed. The +/// error message should be a developer-facing English message that helps +/// developers *understand* and *resolve* the error. If a localized user-facing +/// error message is needed, put the localized message in the error details or +/// localize it in the client. The optional error details may contain arbitrary +/// information about the error. There is a predefined set of error detail types +/// in the package `google.rpc` which can be used for common error conditions. +/// +/// # Language mapping +/// +/// The `Status` message is the logical representation of the error model, but it +/// is not necessarily the actual wire format. When the `Status` message is +/// exposed in different client libraries and different wire protocols, it can be +/// mapped differently. For example, it will likely be mapped to some exceptions +/// in Java, but more likely mapped to some error codes in C. +/// +/// # Other uses +/// +/// The error model and the `Status` message can be used in a variety of +/// environments, either with or without APIs, to provide a +/// consistent developer experience across different environments. +/// +/// Example uses of this error model include: +/// +/// - Partial errors. If a service needs to return partial errors to the client, +/// it may embed the `Status` in the normal response to indicate the partial +/// errors. +/// +/// - Workflow errors. A typical workflow has multiple steps. Each step may +/// have a `Status` message for error reporting purpose. +/// +/// - Batch operations. If a client uses batch request and batch response, the +/// `Status` message should be used directly inside batch response, one for +/// each error sub-response. +/// +/// - Asynchronous operations. If an API call embeds asynchronous operation +/// results in its response, the status of those operations should be +/// represented directly using the `Status` message. +/// +/// - Logging. If some API errors are stored in logs, the message `Status` could +/// be used directly after any stripping needed for security/privacy reasons. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Status { + /// A developer-facing error message, which should be in English. Any + /// user-facing error message should be localized and sent in the + /// google.rpc.Status.details field, or localized by the client. + pub message: Option, + /// The status code, which should be an enum value of google.rpc.Code. + pub code: Option, + /// A list of messages that carry the error details. There will be a + /// common set of message types for APIs to use. + pub details: Option>>, +} + +impl Part for Status {} + + +/// Response message for `TestIamPermissions` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [test iam permissions organizations](struct.OrganizationTestIamPermissionCall.html) (response) +/// * [test iam permissions projects](struct.ProjectTestIamPermissionCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TestIamPermissionsResponse { + /// A subset of `TestPermissionsRequest.permissions` that the caller is + /// allowed. + pub permissions: Option>, +} + +impl ResponseResult for TestIamPermissionsResponse {} + + +/// A page of the response received from the +/// ListProjects +/// method. +/// +/// A paginated response where more pages are available has +/// `next_page_token` set. This token can be used in a subsequent request to +/// retrieve the next request page. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list projects](struct.ProjectListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListProjectsResponse { + /// Pagination token. + /// + /// If the result set is too large to fit in a single response, this token + /// is returned. It encodes the position of the current result cursor. + /// Feeding this value into a new list request with the `page_token` parameter + /// gives the next page of the results. + /// + /// When `next_page_token` is not filled in, there is no next page and + /// the list returned is the last page in the result set. + /// + /// Pagination tokens have a limited lifetime. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The list of Projects that matched the list filter. This list can + /// be paginated. + pub projects: Option>, +} + +impl ResponseResult for ListProjectsResponse {} + + +/// A container to reference an id for any resource type. A `resource` in Google +/// Cloud Platform is a generic term for something you (a developer) may want to +/// interact with through one of our API's. Some examples are an AppEngine app, +/// a Compute Engine instance, a Cloud SQL database, and so on. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ResourceId { + /// Required field representing the resource type this id is for. + /// At present, the only valid type is "organization". + #[serde(rename="type")] + pub type_: Option, + /// Required field for the type-specific id. This should correspond to the id + /// used in the type-specific API's. + pub id: Option, +} + +impl Part for ResourceId {} + + +/// Associates `members` with a `role`. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Binding { + /// Role that is assigned to `members`. + /// For example, `roles/viewer`, `roles/editor`, or `roles/owner`. + /// Required + pub role: Option, + /// Specifies the identities requesting access for a Cloud Platform resource. + /// `members` can have the following values: + /// + /// * `allUsers`: A special identifier that represents anyone who is + /// on the internet; with or without a Google account. + /// + /// * `allAuthenticatedUsers`: A special identifier that represents anyone + /// who is authenticated with a Google account or a service account. + /// + /// * `user:{emailid}`: An email address that represents a specific Google + /// account. For example, `alice@gmail.com` or `joe@example.com`. + /// + /// + /// * `serviceAccount:{emailid}`: An email address that represents a service + /// account. For example, `my-other-app@appspot.gserviceaccount.com`. + /// + /// * `group:{emailid}`: An email address that represents a Google group. + /// For example, `admins@example.com`. + /// + /// * `domain:{domain}`: A Google Apps domain name that represents all the + /// users of that domain. For example, `google.com` or `example.com`. + /// + /// + pub members: Option>, +} + +impl Part for Binding {} + + +/// The request sent to the `SearchOrganizations` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [search organizations](struct.OrganizationSearchCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SearchOrganizationsRequest { + /// An optional query string used to filter the Organizations to return in + /// the response. Filter rules are case-insensitive. + /// + /// + /// Organizations may be filtered by `owner.directoryCustomerId` or by + /// `domain`, where the domain is a Google for Work domain, for example: + /// + /// |Filter|Description| + /// |------|-----------| + /// |owner.directorycustomerid:123456789|Organizations with + /// `owner.directory_customer_id` equal to `123456789`.| + /// |domain:google.com|Organizations corresponding to the domain `google.com`.| + /// + /// This field is optional. + pub filter: Option, + /// A pagination token returned from a previous call to `SearchOrganizations` + /// that indicates from where listing should continue. + /// This field is optional. + #[serde(rename="pageToken")] + pub page_token: Option, + /// The maximum number of Organizations to return in the response. + /// This field is optional. + #[serde(rename="pageSize")] + pub page_size: Option, +} + +impl RequestValue for SearchOrganizationsRequest {} + + +/// This resource represents a long-running operation that is the result of a +/// network API call. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get operations](struct.OperationGetCall.html) (response) +/// * [create projects](struct.ProjectCreateCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Operation { + /// The error result of the operation in case of failure or cancellation. + pub error: Option, + /// If the value is `false`, it means the operation is still in progress. + /// If true, the operation is completed, and either `error` or `response` is + /// available. + pub done: Option, + /// The normal response of the operation in case of success. If the original + /// method returns no data on success, such as `Delete`, the response is + /// `google.protobuf.Empty`. If the original method is standard + /// `Get`/`Create`/`Update`, the response should be the resource. For other + /// methods, the response should have the type `XxxResponse`, where `Xxx` + /// is the original method name. For example, if the original method name + /// is `TakeSnapshot()`, the inferred response type is + /// `TakeSnapshotResponse`. + pub response: Option>, + /// The server-assigned name, which is only unique within the same service that + /// originally returns it. If you use the default HTTP mapping, the + /// `name` should have the format of `operations/some/unique/name`. + pub name: Option, + /// Service-specific metadata associated with the operation. It typically + /// contains progress information and common metadata such as create time. + /// Some services might not provide such metadata. Any method that returns a + /// long-running operation should document the metadata type, if any. + pub metadata: Option>, +} + +impl Resource for Operation {} +impl ResponseResult for Operation {} + + +/// The entity that owns an Organization. The lifetime of the Organization and +/// all of its descendants are bound to the `OrganizationOwner`. If the +/// `OrganizationOwner` is deleted, the Organization and all its descendants will +/// be deleted. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OrganizationOwner { + /// The Google for Work customer id used in the Directory API. + #[serde(rename="directoryCustomerId")] + pub directory_customer_id: Option, +} + +impl Part for OrganizationOwner {} + + // ################### // MethodBuilders ### @@ -471,7 +879,9 @@ impl<'a, C, A> OperationMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service. + /// Gets the latest state of a long-running operation. Clients can use this + /// method to poll the operation result at intervals as recommended by the API + /// service. /// /// # Arguments /// @@ -489,6 +899,153 @@ impl<'a, C, A> OperationMethods<'a, C, A> { +/// A builder providing access to all methods supported on *organization* resources. +/// It is not used directly, but through the `CloudResourceManager` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_cloudresourcemanager1 as cloudresourcemanager1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use cloudresourcemanager1::CloudResourceManager; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = CloudResourceManager::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `get_iam_policy(...)`, `search(...)`, `set_iam_policy(...)` and `test_iam_permissions(...)` +/// // to build up your call. +/// let rb = hub.organizations(); +/// # } +/// ``` +pub struct OrganizationMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudResourceManager, +} + +impl<'a, C, A> MethodsBuilder for OrganizationMethods<'a, C, A> {} + +impl<'a, C, A> OrganizationMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Sets the access control policy on an Organization resource. Replaces any + /// existing policy. The `resource` field should be the organization's resource + /// name, e.g. "organizations/123". + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resource` - REQUIRED: The resource for which the policy is being specified. + /// `resource` is usually specified as a path. For example, a Project + /// resource is specified as `projects/{project}`. + pub fn set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> OrganizationSetIamPolicyCall<'a, C, A> { + OrganizationSetIamPolicyCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets the access control policy for an Organization resource. May be empty + /// if no such policy or resource exists. The `resource` field should be the + /// organization's resource name, e.g. "organizations/123". + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resource` - REQUIRED: The resource for which the policy is being requested. + /// `resource` is usually specified as a path. For example, a Project + /// resource is specified as `projects/{project}`. + pub fn get_iam_policy(&self, request: GetIamPolicyRequest, resource: &str) -> OrganizationGetIamPolicyCall<'a, C, A> { + OrganizationGetIamPolicyCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Returns permissions that a caller has on the specified Organization. + /// The `resource` field should be the organization's resource name, + /// e.g. "organizations/123". + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. + /// `resource` is usually specified as a path. For example, a Project + /// resource is specified as `projects/{project}`. + pub fn test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> OrganizationTestIamPermissionCall<'a, C, A> { + OrganizationTestIamPermissionCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Fetches an Organization resource identified by the specified resource name. + /// + /// # Arguments + /// + /// * `name` - The resource name of the Organization to fetch, e.g. "organizations/1234". + pub fn get(&self, name: &str) -> OrganizationGetCall<'a, C, A> { + OrganizationGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Searches Organization resources that are visible to the user and satisfy + /// the specified filter. This method returns Organizations in an unspecified + /// order. New Organizations do not necessarily appear at the end of the + /// results. + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn search(&self, request: SearchOrganizationsRequest) -> OrganizationSearchCall<'a, C, A> { + OrganizationSearchCall { + hub: self.hub, + _request: request, + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + /// A builder providing access to all methods supported on *project* resources. /// It is not used directly, but through the `CloudResourceManager` hub. /// @@ -512,7 +1069,7 @@ impl<'a, C, A> OperationMethods<'a, C, A> { /// ::default(), None); /// let mut hub = CloudResourceManager::new(hyper::Client::new(), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `delete(...)`, `get(...)`, `get_iam_policy(...)`, `list(...)`, `set_iam_policy(...)`, `test_iam_permissions(...)`, `undelete(...)` and `update(...)` +/// // like `create(...)`, `delete(...)`, `get(...)`, `get_ancestry(...)`, `get_iam_policy(...)`, `list(...)`, `set_iam_policy(...)`, `test_iam_permissions(...)`, `undelete(...)` and `update(...)` /// // to build up your call. /// let rb = hub.projects(); /// # } @@ -534,7 +1091,9 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `testIamPermissions` documentation. + /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. + /// `resource` is usually specified as a path. For example, a Project + /// resource is specified as `projects/{project}`. pub fn test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> ProjectTestIamPermissionCall<'a, C, A> { ProjectTestIamPermissionCall { hub: self.hub, @@ -548,12 +1107,19 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Restores the Project identified by the specified `project_id` (for example, `my-project-123`). You can only use this method for a Project that has a lifecycle state of DELETE_REQUESTED. After deletion starts, the Project cannot be restored. The caller must have modify permissions for this Project. + /// Restores the Project identified by the specified + /// `project_id` (for example, `my-project-123`). + /// You can only use this method for a Project that has a lifecycle state of + /// DELETE_REQUESTED. + /// After deletion starts, the Project cannot be restored. + /// + /// The caller must have modify permissions for this Project. /// /// # Arguments /// /// * `request` - No description provided. - /// * `projectId` - The project ID (for example, `foo-bar-123`). Required. + /// * `projectId` - The project ID (for example, `foo-bar-123`). + /// Required. pub fn undelete(&self, request: UndeleteProjectRequest, project_id: &str) -> ProjectUndeleteCall<'a, C, A> { ProjectUndeleteCall { hub: self.hub, @@ -567,12 +1133,51 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Sets the IAM access control policy for the specified Project. Replaces any existing policy. The following constraints apply when using `setIamPolicy()`: + Project does not support `allUsers` and `allAuthenticatedUsers` as `members` in a `Binding` of a `Policy`. + The owner role can be granted only to `user` and `serviceAccount`. + Service accounts can be made owners of a project directly without any restrictions. However, to be added as an owner, a user must be invited via Cloud Platform console and must accept the invitation. + A user cannot be granted the owner role using `setIamPolicy()`. The user must be granted the owner role using the Cloud Platform Console and must explicitly accept the invitation. + Invitations to grant the owner role cannot be sent using `setIamPolicy()`; they must be sent only using the Cloud Platform Console. + Membership changes that leave the project without any owners that have accepted the Terms of Service (ToS) will be rejected. + Members cannot be added to more than one role in the same policy. + There must be at least one owner who has accepted the Terms of Service (ToS) agreement in the policy. Calling `setIamPolicy()` to to remove the last ToS-accepted owner from the policy will fail. This restriction also applies to legacy projects that no longer have owners who have accepted the ToS. Edits to IAM policies will be rejected until the lack of a ToS-accepting owner is rectified. + Calling this method requires enabling the App Engine Admin API. Note: Removing service accounts from policies or changing their roles can render services completely inoperable. It is important to understand how the service account is being used before removing or updating its roles. + /// Sets the IAM access control policy for the specified Project. Replaces + /// any existing policy. + /// + /// The following constraints apply when using `setIamPolicy()`: + /// + /// + Project does not support `allUsers` and `allAuthenticatedUsers` as + /// `members` in a `Binding` of a `Policy`. + /// + /// + The owner role can be granted only to `user` and `serviceAccount`. + /// + /// + Service accounts can be made owners of a project directly + /// without any restrictions. However, to be added as an owner, a user must be + /// invited via Cloud Platform console and must accept the invitation. + /// + /// + A user cannot be granted the owner role using `setIamPolicy()`. The user + /// must be granted the owner role using the Cloud Platform Console and must + /// explicitly accept the invitation. + /// + /// + Invitations to grant the owner role cannot be sent using + /// `setIamPolicy()`; + /// they must be sent only using the Cloud Platform Console. + /// + /// + Membership changes that leave the project without any owners that have + /// accepted the Terms of Service (ToS) will be rejected. + /// + /// + There must be at least one owner who has accepted the Terms of + /// Service (ToS) agreement in the policy. Calling `setIamPolicy()` to + /// to remove the last ToS-accepted owner from the policy will fail. This + /// restriction also applies to legacy projects that no longer have owners + /// who have accepted the ToS. Edits to IAM policies will be rejected until + /// the lack of a ToS-accepting owner is rectified. + /// + /// + Calling this method requires enabling the App Engine Admin API. + /// + /// Note: Removing service accounts from policies or changing their roles + /// can render services completely inoperable. It is important to understand + /// how the service account is being used before removing or updating its + /// roles. /// /// # Arguments /// /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `setIamPolicy` documentation. + /// * `resource` - REQUIRED: The resource for which the policy is being specified. + /// `resource` is usually specified as a path. For example, a Project + /// resource is specified as `projects/{project}`. pub fn set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> ProjectSetIamPolicyCall<'a, C, A> { ProjectSetIamPolicyCall { hub: self.hub, @@ -586,11 +1191,15 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the Project identified by the specified `project_id` (for example, `my-project-123`). The caller must have read permissions for this Project. + /// Retrieves the Project identified by the specified + /// `project_id` (for example, `my-project-123`). + /// + /// The caller must have read permissions for this Project. /// /// # Arguments /// - /// * `projectId` - The Project ID (for example, `my-project-123`). Required. + /// * `projectId` - The Project ID (for example, `my-project-123`). + /// Required. pub fn get(&self, project_id: &str) -> ProjectGetCall<'a, C, A> { ProjectGetCall { hub: self.hub, @@ -603,17 +1212,21 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Returns the IAM access control policy for the specified Project. Permission is denied if the policy or the resource does not exist. + /// Gets a list of ancestors in the resource hierarchy for the Project + /// identified by the specified `project_id` (for example, `my-project-123`). + /// + /// The caller must have read permissions for this Project. /// /// # Arguments /// /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation. - pub fn get_iam_policy(&self, request: GetIamPolicyRequest, resource: &str) -> ProjectGetIamPolicyCall<'a, C, A> { - ProjectGetIamPolicyCall { + /// * `projectId` - The Project ID (for example, `my-project-123`). + /// Required. + pub fn get_ancestry(&self, request: GetAncestryRequest, project_id: &str) -> ProjectGetAncestryCall<'a, C, A> { + ProjectGetAncestryCall { hub: self.hub, _request: request, - _resource: resource.to_string(), + _project_id: project_id.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -622,12 +1235,16 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates the attributes of the Project identified by the specified `project_id` (for example, `my-project-123`). The caller must have modify permissions for this Project. + /// Updates the attributes of the Project identified by the specified + /// `project_id` (for example, `my-project-123`). + /// + /// The caller must have modify permissions for this Project. /// /// # Arguments /// /// * `request` - No description provided. - /// * `projectId` - The project ID (for example, `my-project-123`). Required. + /// * `projectId` - The project ID (for example, `my-project-123`). + /// Required. pub fn update(&self, request: Project, project_id: &str) -> ProjectUpdateCall<'a, C, A> { ProjectUpdateCall { hub: self.hub, @@ -641,11 +1258,57 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Marks the Project identified by the specified `project_id` (for example, `my-project-123`) for deletion. This method will only affect the Project if the following criteria are met: + The Project does not have a billing account associated with it. + The Project has a lifecycle state of ACTIVE. This method changes the Project's lifecycle state from ACTIVE to DELETE_REQUESTED. The deletion starts at an unspecified time, at which point the Project is no longer accessible. Until the deletion completes, you can check the lifecycle state checked by retrieving the Project with GetProject, and the Project remains visible to ListProjects. However, you cannot update the project. After the deletion completes, the Project is not retrievable by the GetProject and ListProjects methods. The caller must have modify permissions for this Project. + /// Returns the IAM access control policy for the specified Project. + /// Permission is denied if the policy or the resource does not exist. /// /// # Arguments /// - /// * `projectId` - The Project ID (for example, `foo-bar-123`). Required. + /// * `request` - No description provided. + /// * `resource` - REQUIRED: The resource for which the policy is being requested. + /// `resource` is usually specified as a path. For example, a Project + /// resource is specified as `projects/{project}`. + pub fn get_iam_policy(&self, request: GetIamPolicyRequest, resource: &str) -> ProjectGetIamPolicyCall<'a, C, A> { + ProjectGetIamPolicyCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Marks the Project identified by the specified + /// `project_id` (for example, `my-project-123`) for deletion. + /// This method will only affect the Project if the following criteria are met: + /// + /// + The Project does not have a billing account associated with it. + /// + The Project has a lifecycle state of + /// ACTIVE. + /// + /// This method changes the Project's lifecycle state from + /// ACTIVE + /// to DELETE_REQUESTED. + /// The deletion starts at an unspecified time, + /// at which point the Project is no longer accessible. + /// + /// Until the deletion completes, you can check the lifecycle state + /// checked by retrieving the Project with GetProject, + /// and the Project remains visible to ListProjects. + /// However, you cannot update the project. + /// + /// After the deletion completes, the Project is not retrievable by + /// the GetProject and + /// ListProjects methods. + /// + /// The caller must have modify permissions for this Project. + /// + /// # Arguments + /// + /// * `projectId` - The Project ID (for example, `foo-bar-123`). + /// Required. pub fn delete(&self, project_id: &str) -> ProjectDeleteCall<'a, C, A> { ProjectDeleteCall { hub: self.hub, @@ -658,7 +1321,33 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists Projects that are visible to the user and satisfy the specified filter. This method returns Projects in an unspecified order. New Projects do not necessarily appear at the end of the list. + /// Request that a new Project be created. The result is an Operation which + /// can be used to track the creation process. It is automatically deleted + /// after a few hours, so there is no need to call DeleteOperation. + /// + /// Our SLO permits Project creation to take up to 30 seconds at the 90th + /// percentile. As of 2016-08-29, we are observing 6 seconds 50th percentile + /// latency. 95th percentile latency is around 11 seconds. We recommend + /// polling at the 5th second with an exponential backoff. + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn create(&self, request: Project) -> ProjectCreateCall<'a, C, A> { + ProjectCreateCall { + hub: self.hub, + _request: request, + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists Projects that are visible to the user and satisfy the + /// specified filter. This method returns Projects in an unspecified order. + /// New Projects do not necessarily appear at the end of the list. pub fn list(&self) -> ProjectListCall<'a, C, A> { ProjectListCall { hub: self.hub, @@ -680,7 +1369,9 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { // CallBuilders ### // ################# -/// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service. +/// Gets the latest state of a long-running operation. Clients can use this +/// method to poll the operation result at intervals as recommended by the API +/// service. /// /// A builder for the *get* method supported by a *operation* resource. /// It is not used directly, but through a `OperationMethods` instance. @@ -925,6 +1616,1333 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: } +/// Sets the access control policy on an Organization resource. Replaces any +/// existing policy. The `resource` field should be the organization's resource +/// name, e.g. "organizations/123". +/// +/// A builder for the *setIamPolicy* method supported by a *organization* resource. +/// It is not used directly, but through a `OrganizationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudresourcemanager1 as cloudresourcemanager1; +/// use cloudresourcemanager1::SetIamPolicyRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudresourcemanager1::CloudResourceManager; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = CloudResourceManager::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = SetIamPolicyRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.organizations().set_iam_policy(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct OrganizationSetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudResourceManager, + _request: SetIamPolicyRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrganizationSetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> OrganizationSetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudresourcemanager.organizations.setIamPolicy", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://cloudresourcemanager.googleapis.com/v1/{+resource}:setIamPolicy".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: SetIamPolicyRequest) -> OrganizationSetIamPolicyCall<'a, C, A> { + self._request = new_value; + self + } + /// REQUIRED: The resource for which the policy is being specified. + /// `resource` is usually specified as a path. For example, a Project + /// resource is specified as `projects/{project}`. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> OrganizationSetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationSetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OrganizationSetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrganizationSetIamPolicyCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets the access control policy for an Organization resource. May be empty +/// if no such policy or resource exists. The `resource` field should be the +/// organization's resource name, e.g. "organizations/123". +/// +/// A builder for the *getIamPolicy* method supported by a *organization* resource. +/// It is not used directly, but through a `OrganizationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudresourcemanager1 as cloudresourcemanager1; +/// use cloudresourcemanager1::GetIamPolicyRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudresourcemanager1::CloudResourceManager; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = CloudResourceManager::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GetIamPolicyRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.organizations().get_iam_policy(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct OrganizationGetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudResourceManager, + _request: GetIamPolicyRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrganizationGetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> OrganizationGetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudresourcemanager.organizations.getIamPolicy", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://cloudresourcemanager.googleapis.com/v1/{+resource}:getIamPolicy".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GetIamPolicyRequest) -> OrganizationGetIamPolicyCall<'a, C, A> { + self._request = new_value; + self + } + /// REQUIRED: The resource for which the policy is being requested. + /// `resource` is usually specified as a path. For example, a Project + /// resource is specified as `projects/{project}`. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> OrganizationGetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationGetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OrganizationGetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrganizationGetIamPolicyCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Returns permissions that a caller has on the specified Organization. +/// The `resource` field should be the organization's resource name, +/// e.g. "organizations/123". +/// +/// A builder for the *testIamPermissions* method supported by a *organization* resource. +/// It is not used directly, but through a `OrganizationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudresourcemanager1 as cloudresourcemanager1; +/// use cloudresourcemanager1::TestIamPermissionsRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudresourcemanager1::CloudResourceManager; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = CloudResourceManager::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = TestIamPermissionsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.organizations().test_iam_permissions(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct OrganizationTestIamPermissionCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudResourceManager, + _request: TestIamPermissionsRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrganizationTestIamPermissionCall<'a, C, A> {} + +impl<'a, C, A> OrganizationTestIamPermissionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, TestIamPermissionsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudresourcemanager.organizations.testIamPermissions", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://cloudresourcemanager.googleapis.com/v1/{+resource}:testIamPermissions".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: TestIamPermissionsRequest) -> OrganizationTestIamPermissionCall<'a, C, A> { + self._request = new_value; + self + } + /// REQUIRED: The resource for which the policy detail is being requested. + /// `resource` is usually specified as a path. For example, a Project + /// resource is specified as `projects/{project}`. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> OrganizationTestIamPermissionCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationTestIamPermissionCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OrganizationTestIamPermissionCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrganizationTestIamPermissionCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Fetches an Organization resource identified by the specified resource name. +/// +/// A builder for the *get* method supported by a *organization* resource. +/// It is not used directly, but through a `OrganizationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudresourcemanager1 as cloudresourcemanager1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudresourcemanager1::CloudResourceManager; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = CloudResourceManager::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.organizations().get("name") +/// .doit(); +/// # } +/// ``` +pub struct OrganizationGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudResourceManager, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrganizationGetCall<'a, C, A> {} + +impl<'a, C, A> OrganizationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Organization)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudresourcemanager.organizations.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://cloudresourcemanager.googleapis.com/v1/{+name}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The resource name of the Organization to fetch, e.g. "organizations/1234". + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> OrganizationGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OrganizationGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrganizationGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Searches Organization resources that are visible to the user and satisfy +/// the specified filter. This method returns Organizations in an unspecified +/// order. New Organizations do not necessarily appear at the end of the +/// results. +/// +/// A builder for the *search* method supported by a *organization* resource. +/// It is not used directly, but through a `OrganizationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudresourcemanager1 as cloudresourcemanager1; +/// use cloudresourcemanager1::SearchOrganizationsRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudresourcemanager1::CloudResourceManager; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = CloudResourceManager::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = SearchOrganizationsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.organizations().search(req) +/// .doit(); +/// # } +/// ``` +pub struct OrganizationSearchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudResourceManager, + _request: SearchOrganizationsRequest, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrganizationSearchCall<'a, C, A> {} + +impl<'a, C, A> OrganizationSearchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, SearchOrganizationsResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudresourcemanager.organizations.search", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + for &field in ["alt"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://cloudresourcemanager.googleapis.com/v1/organizations:search".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: SearchOrganizationsRequest) -> OrganizationSearchCall<'a, C, A> { + self._request = new_value; + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationSearchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OrganizationSearchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrganizationSearchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + /// Returns permissions that a caller has on the specified Project. /// /// A builder for the *testIamPermissions* method supported by a *project* resource. @@ -1129,7 +3147,9 @@ impl<'a, C, A> ProjectTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectUndeleteCall<'a, C, A> where C: BorrowMut, self._request = new_value; self } - /// The project ID (for example, `foo-bar-123`). Required. + /// The project ID (for example, `foo-bar-123`). + /// + /// Required. /// /// Sets the *project id* path property to the given value. /// @@ -1469,7 +3497,44 @@ impl<'a, C, A> ProjectUndeleteCall<'a, C, A> where C: BorrowMut, } -/// Sets the IAM access control policy for the specified Project. Replaces any existing policy. The following constraints apply when using `setIamPolicy()`: + Project does not support `allUsers` and `allAuthenticatedUsers` as `members` in a `Binding` of a `Policy`. + The owner role can be granted only to `user` and `serviceAccount`. + Service accounts can be made owners of a project directly without any restrictions. However, to be added as an owner, a user must be invited via Cloud Platform console and must accept the invitation. + A user cannot be granted the owner role using `setIamPolicy()`. The user must be granted the owner role using the Cloud Platform Console and must explicitly accept the invitation. + Invitations to grant the owner role cannot be sent using `setIamPolicy()`; they must be sent only using the Cloud Platform Console. + Membership changes that leave the project without any owners that have accepted the Terms of Service (ToS) will be rejected. + Members cannot be added to more than one role in the same policy. + There must be at least one owner who has accepted the Terms of Service (ToS) agreement in the policy. Calling `setIamPolicy()` to to remove the last ToS-accepted owner from the policy will fail. This restriction also applies to legacy projects that no longer have owners who have accepted the ToS. Edits to IAM policies will be rejected until the lack of a ToS-accepting owner is rectified. + Calling this method requires enabling the App Engine Admin API. Note: Removing service accounts from policies or changing their roles can render services completely inoperable. It is important to understand how the service account is being used before removing or updating its roles. +/// Sets the IAM access control policy for the specified Project. Replaces +/// any existing policy. +/// +/// The following constraints apply when using `setIamPolicy()`: +/// +/// + Project does not support `allUsers` and `allAuthenticatedUsers` as +/// `members` in a `Binding` of a `Policy`. +/// +/// + The owner role can be granted only to `user` and `serviceAccount`. +/// +/// + Service accounts can be made owners of a project directly +/// without any restrictions. However, to be added as an owner, a user must be +/// invited via Cloud Platform console and must accept the invitation. +/// +/// + A user cannot be granted the owner role using `setIamPolicy()`. The user +/// must be granted the owner role using the Cloud Platform Console and must +/// explicitly accept the invitation. +/// +/// + Invitations to grant the owner role cannot be sent using +/// `setIamPolicy()`; +/// they must be sent only using the Cloud Platform Console. +/// +/// + Membership changes that leave the project without any owners that have +/// accepted the Terms of Service (ToS) will be rejected. +/// +/// + There must be at least one owner who has accepted the Terms of +/// Service (ToS) agreement in the policy. Calling `setIamPolicy()` to +/// to remove the last ToS-accepted owner from the policy will fail. This +/// restriction also applies to legacy projects that no longer have owners +/// who have accepted the ToS. Edits to IAM policies will be rejected until +/// the lack of a ToS-accepting owner is rectified. +/// +/// + Calling this method requires enabling the App Engine Admin API. +/// +/// Note: Removing service accounts from policies or changing their roles +/// can render services completely inoperable. It is important to understand +/// how the service account is being used before removing or updating its +/// roles. /// /// A builder for the *setIamPolicy* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -1673,7 +3738,9 @@ impl<'a, C, A> ProjectSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa } - /// The Project ID (for example, `my-project-123`). Required. + /// The Project ID (for example, `my-project-123`). + /// + /// Required. /// /// Sets the *project id* path property to the given value. /// @@ -1982,9 +4054,12 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa } -/// Returns the IAM access control policy for the specified Project. Permission is denied if the policy or the resource does not exist. +/// Gets a list of ancestors in the resource hierarchy for the Project +/// identified by the specified `project_id` (for example, `my-project-123`). +/// +/// The caller must have read permissions for this Project. /// -/// A builder for the *getIamPolicy* method supported by a *project* resource. +/// A builder for the *getAncestry* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. /// /// # Example @@ -1995,7 +4070,7 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa /// # extern crate hyper; /// # extern crate yup_oauth2 as oauth2; /// # extern crate google_cloudresourcemanager1 as cloudresourcemanager1; -/// use cloudresourcemanager1::GetIamPolicyRequest; +/// use cloudresourcemanager1::GetAncestryRequest; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -2009,33 +4084,33 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa /// // As the method needs a request, you would usually fill it with the desired information /// // into the respective structure. Some of the parts shown here might not be applicable ! /// // Values shown here are possibly random and not representative ! -/// let mut req = GetIamPolicyRequest::default(); +/// let mut req = GetAncestryRequest::default(); /// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().get_iam_policy(req, "resource") +/// let result = hub.projects().get_ancestry(req, "projectId") /// .doit(); /// # } /// ``` -pub struct ProjectGetIamPolicyCall<'a, C, A> +pub struct ProjectGetAncestryCall<'a, C, A> where C: 'a, A: 'a { hub: &'a CloudResourceManager, - _request: GetIamPolicyRequest, - _resource: String, + _request: GetAncestryRequest, + _project_id: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for ProjectGetIamPolicyCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for ProjectGetAncestryCall<'a, C, A> {} -impl<'a, C, A> ProjectGetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> ProjectGetAncestryCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, GetAncestryResponse)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -2043,11 +4118,11 @@ impl<'a, C, A> ProjectGetIamPolicyCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "cloudresourcemanager.projects.getIamPolicy", + dlg.begin(MethodInfo { id: "cloudresourcemanager.projects.getAncestry", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("resource", self._resource.to_string())); - for &field in ["alt", "resource"].iter() { + params.push(("projectId", self._project_id.to_string())); + for &field in ["alt", "projectId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -2059,12 +4134,12 @@ impl<'a, C, A> ProjectGetIamPolicyCall<'a, C, A> where C: BorrowMut = None; for &(name, ref value) in params.iter() { if name == param_name { @@ -2076,7 +4151,7 @@ impl<'a, C, A> ProjectGetIamPolicyCall<'a, C, A> where C: BorrowMut = Vec::with_capacity(1); - for param_name in ["resource"].iter() { + for param_name in ["projectId"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -2182,18 +4257,20 @@ impl<'a, C, A> ProjectGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectGetIamPolicyCall<'a, C, A> { + pub fn request(mut self, new_value: GetAncestryRequest) -> ProjectGetAncestryCall<'a, C, A> { self._request = new_value; self } - /// REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation. + /// The Project ID (for example, `my-project-123`). + /// + /// Required. /// - /// Sets the *resource* path property to the given value. + /// Sets the *project id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn resource(mut self, new_value: &str) -> ProjectGetIamPolicyCall<'a, C, A> { - self._resource = new_value.to_string(); + pub fn project_id(mut self, new_value: &str) -> ProjectGetAncestryCall<'a, C, A> { + self._project_id = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -2202,7 +4279,7 @@ impl<'a, C, A> ProjectGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectGetIamPolicyCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectGetAncestryCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -2229,7 +4306,7 @@ impl<'a, C, A> ProjectGetIamPolicyCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectGetIamPolicyCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> ProjectGetAncestryCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -2246,7 +4323,7 @@ impl<'a, C, A> ProjectGetIamPolicyCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectGetIamPolicyCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectGetAncestryCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2254,7 +4331,10 @@ impl<'a, C, A> ProjectGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectUpdateCall<'a, C, A> where C: BorrowMut, A: self._request = new_value; self } - /// The project ID (for example, `my-project-123`). Required. + /// The project ID (for example, `my-project-123`). + /// + /// Required. /// /// Sets the *project id* path property to the given value. /// @@ -2526,7 +4608,305 @@ impl<'a, C, A> ProjectUpdateCall<'a, C, A> where C: BorrowMut, A: } -/// Marks the Project identified by the specified `project_id` (for example, `my-project-123`) for deletion. This method will only affect the Project if the following criteria are met: + The Project does not have a billing account associated with it. + The Project has a lifecycle state of ACTIVE. This method changes the Project's lifecycle state from ACTIVE to DELETE_REQUESTED. The deletion starts at an unspecified time, at which point the Project is no longer accessible. Until the deletion completes, you can check the lifecycle state checked by retrieving the Project with GetProject, and the Project remains visible to ListProjects. However, you cannot update the project. After the deletion completes, the Project is not retrievable by the GetProject and ListProjects methods. The caller must have modify permissions for this Project. +/// Returns the IAM access control policy for the specified Project. +/// Permission is denied if the policy or the resource does not exist. +/// +/// A builder for the *getIamPolicy* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudresourcemanager1 as cloudresourcemanager1; +/// use cloudresourcemanager1::GetIamPolicyRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudresourcemanager1::CloudResourceManager; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = CloudResourceManager::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GetIamPolicyRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().get_iam_policy(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct ProjectGetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudResourceManager, + _request: GetIamPolicyRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectGetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> ProjectGetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudresourcemanager.projects.getIamPolicy", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://cloudresourcemanager.googleapis.com/v1/projects/{resource}:getIamPolicy".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{resource}", "resource")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GetIamPolicyRequest) -> ProjectGetIamPolicyCall<'a, C, A> { + self._request = new_value; + self + } + /// REQUIRED: The resource for which the policy is being requested. + /// `resource` is usually specified as a path. For example, a Project + /// resource is specified as `projects/{project}`. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectGetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectGetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectGetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectGetIamPolicyCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Marks the Project identified by the specified +/// `project_id` (for example, `my-project-123`) for deletion. +/// This method will only affect the Project if the following criteria are met: +/// +/// + The Project does not have a billing account associated with it. +/// + The Project has a lifecycle state of +/// ACTIVE. +/// +/// This method changes the Project's lifecycle state from +/// ACTIVE +/// to DELETE_REQUESTED. +/// The deletion starts at an unspecified time, +/// at which point the Project is no longer accessible. +/// +/// Until the deletion completes, you can check the lifecycle state +/// checked by retrieving the Project with GetProject, +/// and the Project remains visible to ListProjects. +/// However, you cannot update the project. +/// +/// After the deletion completes, the Project is not retrievable by +/// the GetProject and +/// ListProjects methods. +/// +/// The caller must have modify permissions for this Project. /// /// A builder for the *delete* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -2699,7 +5079,9 @@ impl<'a, C, A> ProjectDeleteCall<'a, C, A> where C: BorrowMut, A: } - /// The Project ID (for example, `foo-bar-123`). Required. + /// The Project ID (for example, `foo-bar-123`). + /// + /// Required. /// /// Sets the *project id* path property to the given value. /// @@ -2767,7 +5149,255 @@ impl<'a, C, A> ProjectDeleteCall<'a, C, A> where C: BorrowMut, A: } -/// Lists Projects that are visible to the user and satisfy the specified filter. This method returns Projects in an unspecified order. New Projects do not necessarily appear at the end of the list. +/// Request that a new Project be created. The result is an Operation which +/// can be used to track the creation process. It is automatically deleted +/// after a few hours, so there is no need to call DeleteOperation. +/// +/// Our SLO permits Project creation to take up to 30 seconds at the 90th +/// percentile. As of 2016-08-29, we are observing 6 seconds 50th percentile +/// latency. 95th percentile latency is around 11 seconds. We recommend +/// polling at the 5th second with an exponential backoff. +/// +/// A builder for the *create* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudresourcemanager1 as cloudresourcemanager1; +/// use cloudresourcemanager1::Project; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudresourcemanager1::CloudResourceManager; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = CloudResourceManager::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Project::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().create(req) +/// .doit(); +/// # } +/// ``` +pub struct ProjectCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudResourceManager, + _request: Project, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectCreateCall<'a, C, A> {} + +impl<'a, C, A> ProjectCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudresourcemanager.projects.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + for &field in ["alt"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://cloudresourcemanager.googleapis.com/v1/projects".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Project) -> ProjectCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectCreateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Lists Projects that are visible to the user and satisfy the +/// specified filter. This method returns Projects in an unspecified order. +/// New Projects do not necessarily appear at the end of the list. /// /// A builder for the *list* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -2794,9 +5424,9 @@ impl<'a, C, A> ProjectDeleteCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().list() -/// .page_token("nonumy") -/// .page_size(-19) -/// .filter("gubergren") +/// .page_token("ea") +/// .page_size(-61) +/// .filter("justo") /// .doit(); /// # } /// ``` @@ -2932,21 +5562,48 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o } - /// A pagination token returned from a previous call to ListProjects that indicates from where listing should continue. Optional. + /// A pagination token returned from a previous call to ListProjects + /// that indicates from where listing should continue. + /// + /// Optional. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> ProjectListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// The maximum number of Projects to return in the response. The server can return fewer Projects than requested. If unspecified, server picks an appropriate default. Optional. + /// The maximum number of Projects to return in the response. + /// The server can return fewer Projects than requested. + /// If unspecified, server picks an appropriate default. + /// + /// Optional. /// /// Sets the *page size* query property to the given value. pub fn page_size(mut self, new_value: i32) -> ProjectListCall<'a, C, A> { self._page_size = Some(new_value); self } - /// An expression for filtering the results of the request. Filter rules are case insensitive. The fields eligible for filtering are: + `name` + `id` + labels.key where *key* is the name of a label Some examples of using labels as filters: |Filter|Description| |------|-----------| |name:*|The project has a name.| |name:Howl|The project's name is `Howl` or `howl`.| |name:HOWL|Equivalent to above.| |NAME:howl|Equivalent to above.| |labels.color:*|The project has the label `color`.| |labels.color:red|The project's label `color` has the value `red`.| |labels.color:red label.size:big|The project's label `color` has the value `red` and its label `size` has the value `big`. Optional. + /// An expression for filtering the results of the request. Filter rules are + /// case insensitive. The fields eligible for filtering are: + /// + /// + `name` + /// + `id` + /// + labels.key where *key* is the name of a label + /// + /// Some examples of using labels as filters: + /// + /// |Filter|Description| + /// |------|-----------| + /// |name:*|The project has a name.| + /// |name:Howl|The project's name is `Howl` or `howl`.| + /// |name:HOWL|Equivalent to above.| + /// |NAME:howl|Equivalent to above.| + /// |labels.color:*|The project has the label `color`.| + /// |labels.color:red|The project's label `color` has the value `red`.| + /// |labels.color:red label.size:big|The project's label `color` has the + /// value `red` and its label `size` has the value `big`. + /// + /// Optional. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> ProjectListCall<'a, C, A> { diff --git a/gen/cloudresourcemanager1_beta1-cli/Cargo.toml b/gen/cloudresourcemanager1_beta1-cli/Cargo.toml index 811c9be048..b05cac301f 100644 --- a/gen/cloudresourcemanager1_beta1-cli/Cargo.toml +++ b/gen/cloudresourcemanager1_beta1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-cloudresourcemanager1_beta1-cli" -version = "1.0.0+20160617" +version = "1.0.0+20161212" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Resource Manager (protocol v1beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudresourcemanager1_beta1-cli" diff --git a/gen/cloudresourcemanager1_beta1-cli/README.md b/gen/cloudresourcemanager1_beta1-cli/README.md index a7040d29c6..86f593ba11 100644 --- a/gen/cloudresourcemanager1_beta1-cli/README.md +++ b/gen/cloudresourcemanager1_beta1-cli/README.md @@ -24,7 +24,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Cloud Resource Manager* API at revision *20160617*. The CLI is at version *1.0.0*. +This documentation was generated from the *Cloud Resource Manager* API at revision *20161212*. The CLI is at version *1.0.0*. ```bash cloudresourcemanager1-beta1 [options] diff --git a/gen/cloudresourcemanager1_beta1-cli/mkdocs.yml b/gen/cloudresourcemanager1_beta1-cli/mkdocs.yml index 664d6a56ee..7d50264279 100644 --- a/gen/cloudresourcemanager1_beta1-cli/mkdocs.yml +++ b/gen/cloudresourcemanager1_beta1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Cloud Resource Manager v1.0.0+20160617 +site_name: Cloud Resource Manager v1.0.0+20161212 site_url: http://byron.github.io/google-apis-rs/google-cloudresourcemanager1_beta1-cli site_description: Write integrating applications with bcore diff --git a/gen/cloudresourcemanager1_beta1-cli/src/main.rs b/gen/cloudresourcemanager1_beta1-cli/src/main.rs index eb6be5cec0..a1e1fee491 100644 --- a/gen/cloudresourcemanager1_beta1-cli/src/main.rs +++ b/gen/cloudresourcemanager1_beta1-cli/src/main.rs @@ -270,8 +270,8 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["etag", "policy", "version"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -536,9 +536,9 @@ impl<'n> Engine<'n> { "parent.id" => Some(("parent.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), - "project-number" => Some(("projectNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "lifecycle-state" => Some(("lifecycleState", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "lifecycle-state" => Some(("lifecycleState", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "project-number" => Some(("projectNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "id", "labels", "lifecycle-state", "name", "parent", "project-id", "project-number", "type"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -554,6 +554,9 @@ impl<'n> Engine<'n> { for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { + "use-legacy-stack" => { + call = call.use_legacy_stack(arg_from_str(value.unwrap_or("false"), err, "use-legacy-stack", "boolean")); + }, _ => { let mut found = false; for param in &self.gp { @@ -567,6 +570,7 @@ impl<'n> Engine<'n> { err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); + v.extend(["use-legacy-stack"].iter().map(|v|*v)); v } )); } } @@ -957,8 +961,8 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["etag", "policy", "version"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -1217,9 +1221,9 @@ impl<'n> Engine<'n> { "parent.id" => Some(("parent.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), - "project-number" => Some(("projectNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "lifecycle-state" => Some(("lifecycleState", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "lifecycle-state" => Some(("lifecycleState", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "project-number" => Some(("projectNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "id", "labels", "lifecycle-state", "name", "parent", "project-id", "project-number", "type"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -1443,7 +1447,7 @@ fn main() { vec![ (Some(r##"name"##), None, - Some(r##"The resource name of the Organization to fetch. Its format is "organizations/[organization_id]". For example, "organizations/1234"."##), + Some(r##"The resource name of the Organization to fetch, e.g. "organizations/1234"."##), Some(true), Some(false)), @@ -1460,12 +1464,16 @@ fn main() { Some(false)), ]), ("get-iam-policy", - Some(r##"Gets the access control policy for an Organization resource. May be empty if no such policy or resource exists. The `resource` field should be the organization's resource name, e.g. "organizations/123". For backward compatibility, the resource provided may also be the organization_id. This will not be supported in v1."##), + Some(r##"Gets the access control policy for an Organization resource. May be empty + if no such policy or resource exists. The `resource` field should be the + organization's resource name, e.g. "organizations/123"."##), "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_beta1_cli/organizations_get-iam-policy", vec![ (Some(r##"resource"##), None, - Some(r##"REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation."##), + Some(r##"REQUIRED: The resource for which the policy is being requested. + `resource` is usually specified as a path. For example, a Project + resource is specified as `projects/{project}`."##), Some(true), Some(false)), @@ -1488,7 +1496,9 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Lists Organization resources that are visible to the user and satisfy the specified filter. This method returns Organizations in an unspecified order. New Organizations do not necessarily appear at the end of the list."##), + Some(r##"Lists Organization resources that are visible to the user and satisfy + the specified filter. This method returns Organizations in an unspecified + order. New Organizations do not necessarily appear at the end of the list."##), "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_beta1_cli/organizations_list", vec![ (Some(r##"v"##), @@ -1504,12 +1514,16 @@ fn main() { Some(false)), ]), ("set-iam-policy", - Some(r##"Sets the access control policy on an Organization resource. Replaces any existing policy. The `resource` field should be the organization's resource name, e.g. "organizations/123". For backward compatibility, the resource provided may also be the organization_id. This will not be supported in v1."##), + Some(r##"Sets the access control policy on an Organization resource. Replaces any + existing policy. The `resource` field should be the organization's resource + name, e.g. "organizations/123"."##), "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_beta1_cli/organizations_set-iam-policy", vec![ (Some(r##"resource"##), None, - Some(r##"REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `setIamPolicy` documentation."##), + Some(r##"REQUIRED: The resource for which the policy is being specified. + `resource` is usually specified as a path. For example, a Project + resource is specified as `projects/{project}`."##), Some(true), Some(false)), @@ -1532,12 +1546,16 @@ fn main() { Some(false)), ]), ("test-iam-permissions", - Some(r##"Returns permissions that a caller has on the specified Organization. The `resource` field should be the organization's resource name, e.g. "organizations/123". For backward compatibility, the resource provided may also be the organization_id. This will not be supported in v1."##), + Some(r##"Returns permissions that a caller has on the specified Organization. + The `resource` field should be the organization's resource name, + e.g. "organizations/123"."##), "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_beta1_cli/organizations_test-iam-permissions", vec![ (Some(r##"resource"##), None, - Some(r##"REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `testIamPermissions` documentation."##), + Some(r##"REQUIRED: The resource for which the policy detail is being requested. + `resource` is usually specified as a path. For example, a Project + resource is specified as `projects/{project}`."##), Some(true), Some(false)), @@ -1565,7 +1583,9 @@ fn main() { vec![ (Some(r##"name"##), None, - Some(r##"Output Only. The resource name of the organization. This is the organization's relative path in the API. Its format is "organizations/[organization_id]". For example, "organizations/1234"."##), + Some(r##"Output Only. The resource name of the organization. This is the + organization's relative path in the API. Its format is + "organizations/[organization_id]". For example, "organizations/1234"."##), Some(true), Some(false)), @@ -1591,7 +1611,14 @@ fn main() { ("projects", "methods: 'create', 'delete', 'get', 'get-ancestry', 'get-iam-policy', 'list', 'set-iam-policy', 'test-iam-permissions', 'undelete' and 'update'", vec![ ("create", - Some(r##"Creates a Project resource. Initially, the Project resource is owned by its creator exclusively. The creator can later grant permission to others to read or update the Project. Several APIs are activated automatically for the Project, including Google Cloud Storage."##), + Some(r##"Creates a Project resource. + + Initially, the Project resource is owned by its creator exclusively. + The creator can later grant permission to others to read or update the + Project. + + Several APIs are activated automatically for the Project, including + Google Cloud Storage."##), "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_beta1_cli/projects_create", vec![ (Some(r##"kv"##), @@ -1613,12 +1640,37 @@ fn main() { Some(false)), ]), ("delete", - Some(r##"Marks the Project identified by the specified `project_id` (for example, `my-project-123`) for deletion. This method will only affect the Project if the following criteria are met: + The Project does not have a billing account associated with it. + The Project has a lifecycle state of ACTIVE. This method changes the Project's lifecycle state from ACTIVE to DELETE_REQUESTED. The deletion starts at an unspecified time, at which point the project is no longer accessible. Until the deletion completes, you can check the lifecycle state checked by retrieving the Project with GetProject, and the Project remains visible to ListProjects. However, you cannot update the project. After the deletion completes, the Project is not retrievable by the GetProject and ListProjects methods. The caller must have modify permissions for this Project."##), + Some(r##"Marks the Project identified by the specified + `project_id` (for example, `my-project-123`) for deletion. + This method will only affect the Project if the following criteria are met: + + + The Project does not have a billing account associated with it. + + The Project has a lifecycle state of + ACTIVE. + + This method changes the Project's lifecycle state from + ACTIVE + to DELETE_REQUESTED. + The deletion starts at an unspecified time, at which point the project is + no longer accessible. + + Until the deletion completes, you can check the lifecycle state + checked by retrieving the Project with GetProject, + and the Project remains visible to ListProjects. + However, you cannot update the project. + + After the deletion completes, the Project is not retrievable by + the GetProject and + ListProjects methods. + + The caller must have modify permissions for this Project."##), "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_beta1_cli/projects_delete", vec![ (Some(r##"project-id"##), None, - Some(r##"The Project ID (for example, `foo-bar-123`). Required."##), + Some(r##"The Project ID (for example, `foo-bar-123`). + + Required."##), Some(true), Some(false)), @@ -1635,12 +1687,17 @@ fn main() { Some(false)), ]), ("get", - Some(r##"Retrieves the Project identified by the specified `project_id` (for example, `my-project-123`). The caller must have read permissions for this Project."##), + Some(r##"Retrieves the Project identified by the specified + `project_id` (for example, `my-project-123`). + + The caller must have read permissions for this Project."##), "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_beta1_cli/projects_get", vec![ (Some(r##"project-id"##), None, - Some(r##"The Project ID (for example, `my-project-123`). Required."##), + Some(r##"The Project ID (for example, `my-project-123`). + + Required."##), Some(true), Some(false)), @@ -1657,12 +1714,17 @@ fn main() { Some(false)), ]), ("get-ancestry", - Some(r##"Gets a list of ancestors in the resource hierarchy for the Project identified by the specified `project_id` (for example, `my-project-123`). The caller must have read permissions for this Project."##), + Some(r##"Gets a list of ancestors in the resource hierarchy for the Project + identified by the specified `project_id` (for example, `my-project-123`). + + The caller must have read permissions for this Project."##), "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_beta1_cli/projects_get-ancestry", vec![ (Some(r##"project-id"##), None, - Some(r##"The Project ID (for example, `my-project-123`). Required."##), + Some(r##"The Project ID (for example, `my-project-123`). + + Required."##), Some(true), Some(false)), @@ -1685,12 +1747,15 @@ fn main() { Some(false)), ]), ("get-iam-policy", - Some(r##"Returns the IAM access control policy for the specified Project. Permission is denied if the policy or the resource does not exist."##), + Some(r##"Returns the IAM access control policy for the specified Project. + Permission is denied if the policy or the resource does not exist."##), "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_beta1_cli/projects_get-iam-policy", vec![ (Some(r##"resource"##), None, - Some(r##"REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation."##), + Some(r##"REQUIRED: The resource for which the policy is being requested. + `resource` is usually specified as a path. For example, a Project + resource is specified as `projects/{project}`."##), Some(true), Some(false)), @@ -1713,7 +1778,9 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Lists Projects that are visible to the user and satisfy the specified filter. This method returns Projects in an unspecified order. New Projects do not necessarily appear at the end of the list."##), + Some(r##"Lists Projects that are visible to the user and satisfy the + specified filter. This method returns Projects in an unspecified order. + New Projects do not necessarily appear at the end of the list."##), "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_beta1_cli/projects_list", vec![ (Some(r##"v"##), @@ -1729,12 +1796,49 @@ fn main() { Some(false)), ]), ("set-iam-policy", - Some(r##"Sets the IAM access control policy for the specified Project. Replaces any existing policy. The following constraints apply when using `setIamPolicy()`: + Project does not support `allUsers` and `allAuthenticatedUsers` as `members` in a `Binding` of a `Policy`. + The owner role can be granted only to `user` and `serviceAccount`. + Service accounts can be made owners of a project directly without any restrictions. However, to be added as an owner, a user must be invited via Cloud Platform console and must accept the invitation. + A user cannot be granted the owner role using `setIamPolicy()`. The user must be granted the owner role using the Cloud Platform Console and must explicitly accept the invitation. + Invitations to grant the owner role cannot be sent using `setIamPolicy()`; they must be sent only using the Cloud Platform Console. + Membership changes that leave the project without any owners that have accepted the Terms of Service (ToS) will be rejected. + Members cannot be added to more than one role in the same policy. + There must be at least one owner who has accepted the Terms of Service (ToS) agreement in the policy. Calling `setIamPolicy()` to to remove the last ToS-accepted owner from the policy will fail. This restriction also applies to legacy projects that no longer have owners who have accepted the ToS. Edits to IAM policies will be rejected until the lack of a ToS-accepting owner is rectified. + Calling this method requires enabling the App Engine Admin API. Note: Removing service accounts from policies or changing their roles can render services completely inoperable. It is important to understand how the service account is being used before removing or updating its roles."##), + Some(r##"Sets the IAM access control policy for the specified Project. Replaces + any existing policy. + + The following constraints apply when using `setIamPolicy()`: + + + Project does not support `allUsers` and `allAuthenticatedUsers` as + `members` in a `Binding` of a `Policy`. + + + The owner role can be granted only to `user` and `serviceAccount`. + + + Service accounts can be made owners of a project directly + without any restrictions. However, to be added as an owner, a user must be + invited via Cloud Platform console and must accept the invitation. + + + A user cannot be granted the owner role using `setIamPolicy()`. The user + must be granted the owner role using the Cloud Platform Console and must + explicitly accept the invitation. + + + Invitations to grant the owner role cannot be sent using `setIamPolicy()`; + they must be sent only using the Cloud Platform Console. + + + Membership changes that leave the project without any owners that have + accepted the Terms of Service (ToS) will be rejected. + + + There must be at least one owner who has accepted the Terms of + Service (ToS) agreement in the policy. Calling `setIamPolicy()` to + to remove the last ToS-accepted owner from the policy will fail. This + restriction also applies to legacy projects that no longer have owners + who have accepted the ToS. Edits to IAM policies will be rejected until + the lack of a ToS-accepting owner is rectified. + + + Calling this method requires enabling the App Engine Admin API. + + Note: Removing service accounts from policies or changing their roles + can render services completely inoperable. It is important to understand + how the service account is being used before removing or updating its roles."##), "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_beta1_cli/projects_set-iam-policy", vec![ (Some(r##"resource"##), None, - Some(r##"REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `setIamPolicy` documentation."##), + Some(r##"REQUIRED: The resource for which the policy is being specified. + `resource` is usually specified as a path. For example, a Project + resource is specified as `projects/{project}`."##), Some(true), Some(false)), @@ -1762,7 +1866,9 @@ fn main() { vec![ (Some(r##"resource"##), None, - Some(r##"REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `testIamPermissions` documentation."##), + Some(r##"REQUIRED: The resource for which the policy detail is being requested. + `resource` is usually specified as a path. For example, a Project + resource is specified as `projects/{project}`."##), Some(true), Some(false)), @@ -1785,12 +1891,20 @@ fn main() { Some(false)), ]), ("undelete", - Some(r##"Restores the Project identified by the specified `project_id` (for example, `my-project-123`). You can only use this method for a Project that has a lifecycle state of DELETE_REQUESTED. After deletion starts, the Project cannot be restored. The caller must have modify permissions for this Project."##), + Some(r##"Restores the Project identified by the specified + `project_id` (for example, `my-project-123`). + You can only use this method for a Project that has a lifecycle state of + DELETE_REQUESTED. + After deletion starts, the Project cannot be restored. + + The caller must have modify permissions for this Project."##), "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_beta1_cli/projects_undelete", vec![ (Some(r##"project-id"##), None, - Some(r##"The project ID (for example, `foo-bar-123`). Required."##), + Some(r##"The project ID (for example, `foo-bar-123`). + + Required."##), Some(true), Some(false)), @@ -1813,12 +1927,17 @@ fn main() { Some(false)), ]), ("update", - Some(r##"Updates the attributes of the Project identified by the specified `project_id` (for example, `my-project-123`). The caller must have modify permissions for this Project."##), + Some(r##"Updates the attributes of the Project identified by the specified + `project_id` (for example, `my-project-123`). + + The caller must have modify permissions for this Project."##), "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_beta1_cli/projects_update", vec![ (Some(r##"project-id"##), None, - Some(r##"The project ID (for example, `my-project-123`). Required."##), + Some(r##"The project ID (for example, `my-project-123`). + + Required."##), Some(true), Some(false)), @@ -1846,7 +1965,7 @@ fn main() { let mut app = App::new("cloudresourcemanager1-beta1") .author("Sebastian Thiel ") - .version("1.0.0+20160617") + .version("1.0.0+20161212") .about("The Google Cloud Resource Manager API provides methods for creating, reading, and updating project metadata.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_beta1_cli") .arg(Arg::with_name("url") diff --git a/gen/cloudresourcemanager1_beta1/Cargo.toml b/gen/cloudresourcemanager1_beta1/Cargo.toml index 7c1324e731..7e496d7587 100644 --- a/gen/cloudresourcemanager1_beta1/Cargo.toml +++ b/gen/cloudresourcemanager1_beta1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-cloudresourcemanager1_beta1" -version = "1.0.0+20160617" +version = "1.0.0+20161212" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Resource Manager (protocol v1beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudresourcemanager1_beta1" diff --git a/gen/cloudresourcemanager1_beta1/README.md b/gen/cloudresourcemanager1_beta1/README.md index d2a91a4289..acfb5aeb05 100644 --- a/gen/cloudresourcemanager1_beta1/README.md +++ b/gen/cloudresourcemanager1_beta1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-cloudresourcemanager1_beta1` library allows access to all features of the *Google Cloud Resource Manager* service. -This documentation was generated from *Cloud Resource Manager* crate version *1.0.0+20160617*, where *20160617* is the exact revision of the *cloudresourcemanager:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *Cloud Resource Manager* crate version *1.0.0+20161212*, where *20161212* is the exact revision of the *cloudresourcemanager:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *Cloud Resource Manager* *v1_beta1* API can be found at the [official documentation site](https://cloud.google.com/resource-manager). diff --git a/gen/cloudresourcemanager1_beta1/src/lib.rs b/gen/cloudresourcemanager1_beta1/src/lib.rs index a0922a0d82..9480f01ae3 100644 --- a/gen/cloudresourcemanager1_beta1/src/lib.rs +++ b/gen/cloudresourcemanager1_beta1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Cloud Resource Manager* crate version *1.0.0+20160617*, where *20160617* is the exact revision of the *cloudresourcemanager:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *Cloud Resource Manager* crate version *1.0.0+20161212*, where *20161212* is the exact revision of the *cloudresourcemanager:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *Cloud Resource Manager* *v1_beta1* API can be found at the //! [official documentation site](https://cloud.google.com/resource-manager). @@ -105,9 +105,9 @@ //! // execute the final call using `doit()`. //! // Values shown here are possibly random and not representative ! //! let result = hub.projects().list() -//! .page_token("ipsum") -//! .page_size(-5) -//! .filter("et") +//! .page_token("Lorem") +//! .page_size(-21) +//! .filter("duo") //! .doit(); //! //! match result { diff --git a/gen/cloudresourcemanager1_beta1/src/lib.rs.in b/gen/cloudresourcemanager1_beta1/src/lib.rs.in index fb82dfbd0f..eab1711b47 100644 --- a/gen/cloudresourcemanager1_beta1/src/lib.rs.in +++ b/gen/cloudresourcemanager1_beta1/src/lib.rs.in @@ -192,7 +192,10 @@ impl RequestValue for GetIamPolicyRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TestIamPermissionsRequest { - /// The set of permissions to check for the `resource`. Permissions with wildcards (such as '*' or 'storage.*') are not allowed. For more information see IAM Overview. + /// The set of permissions to check for the `resource`. Permissions with + /// wildcards (such as '*' or 'storage.*') are not allowed. For more + /// information see + /// [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). pub permissions: Option>, } @@ -211,7 +214,10 @@ impl RequestValue for TestIamPermissionsRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct SetIamPolicyRequest { - /// REQUIRED: The complete policy to be applied to the `resource`. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them. + /// REQUIRED: The complete policy to be applied to the `resource`. The size of + /// the policy is limited to a few 10s of KB. An empty policy is a + /// valid policy but certain Cloud Platform services (such as Projects) + /// might reject them. pub policy: Option, } @@ -229,14 +235,18 @@ impl RequestValue for SetIamPolicyRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GetAncestryResponse { - /// Ancestors are ordered from bottom to top of the resource hierarchy. The first ancestor is the project itself, followed by the project's parent, etc. + /// Ancestors are ordered from bottom to top of the resource hierarchy. The + /// first ancestor is the project itself, followed by the project's parent, + /// etc. pub ancestor: Option>, } impl ResponseResult for GetAncestryResponse {} -/// A Project is a high-level Google Cloud Platform entity. It is a container for ACLs, APIs, AppEngine Apps, VMs, and other Google Cloud Platform resources. +/// A Project is a high-level Google Cloud Platform entity. It is a +/// container for ACLs, APIs, AppEngine Apps, VMs, and other +/// Google Cloud Platform resources. /// /// # Activities /// @@ -256,22 +266,66 @@ impl ResponseResult for GetAncestryResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Project { - /// The user-assigned display name of the Project. It must be 4 to 30 characters. Allowed characters are: lowercase and uppercase letters, numbers, hyphen, single-quote, double-quote, space, and exclamation point. Example: My Project Read-write. + /// The user-assigned display name of the Project. + /// It must be 4 to 30 characters. + /// Allowed characters are: lowercase and uppercase letters, numbers, + /// hyphen, single-quote, double-quote, space, and exclamation point. + /// + /// Example: My Project + /// + /// Read-write. pub name: Option, - /// An optional reference to a parent Resource. The only supported parent type is "organization". Once set, the parent cannot be modified. Read-write. + /// An optional reference to a parent Resource. + /// + /// The only supported parent type is "organization". Once set, the parent + /// cannot be modified. The `parent` can be set on creation or using the + /// `UpdateProject` method; the end user must have the + /// `resourcemanager.projects.create` permission on the parent. + /// + /// Read-write. pub parent: Option, - /// The unique, user-assigned ID of the Project. It must be 6 to 30 lowercase letters, digits, or hyphens. It must start with a letter. Trailing hyphens are prohibited. Example: tokyo-rain-123 Read-only after creation. + /// The unique, user-assigned ID of the Project. + /// It must be 6 to 30 lowercase letters, digits, or hyphens. + /// It must start with a letter. + /// Trailing hyphens are prohibited. + /// + /// Example: tokyo-rain-123 + /// + /// Read-only after creation. #[serde(rename="projectId")] pub project_id: Option, - /// The labels associated with this Project. Label keys must be between 1 and 63 characters long and must conform to the following regular expression: \[a-z\](\[-a-z0-9\]*\[a-z0-9\])?. Label values must be between 0 and 63 characters long and must conform to the regular expression (\[a-z\](\[-a-z0-9\]*\[a-z0-9\])?)?. No more than 256 labels can be associated with a given resource. Clients should store labels in a representation such as JSON that does not depend on specific characters being disallowed. Example: "environment" : "dev" Read-write. + /// The labels associated with this Project. + /// + /// Label keys must be between 1 and 63 characters long and must conform + /// to the following regular expression: \[a-z\](\[-a-z0-9\]*\[a-z0-9\])?. + /// + /// Label values must be between 0 and 63 characters long and must conform + /// to the regular expression (\[a-z\](\[-a-z0-9\]*\[a-z0-9\])?)?. + /// + /// No more than 256 labels can be associated with a given resource. + /// + /// Clients should store labels in a representation such as JSON that does not + /// depend on specific characters being disallowed. + /// + /// Example: "environment" : "dev" + /// + /// Read-write. pub labels: Option>, - /// The number uniquely identifying the project. Example: 415104041262 Read-only. - #[serde(rename="projectNumber")] - pub project_number: Option, - /// Creation time. Read-only. + /// Creation time. + /// + /// Read-only. #[serde(rename="createTime")] pub create_time: Option, - /// The Project lifecycle state. Read-only. + /// The number uniquely identifying the project. + /// + /// Example: 415104041262 + /// + /// Read-only. + #[serde(rename="projectNumber")] + pub project_number: Option, + /// The Project lifecycle state. + /// + /// Read-only. #[serde(rename="lifecycleState")] pub lifecycle_state: Option, } @@ -281,7 +335,9 @@ impl Resource for Project {} impl ResponseResult for Project {} -/// The request sent to the GetAncestry method. +/// The request sent to the +/// GetAncestry +/// method. /// /// # Activities /// @@ -296,7 +352,37 @@ pub struct GetAncestryRequest { _never_set: Option } impl RequestValue for GetAncestryRequest {} -/// Defines an Identity and Access Management (IAM) policy. It is used to specify access control policies for Cloud Platform resources. A `Policy` consists of a list of `bindings`. A `Binding` binds a list of `members` to a `role`, where the members can be user accounts, Google groups, Google domains, and service accounts. A `role` is a named list of permissions defined by IAM. **Example** { "bindings": [ { "role": "roles/owner", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-other-app@appspot.gserviceaccount.com", ] }, { "role": "roles/viewer", "members": ["user:sean@example.com"] } ] } For a description of IAM and its features, see the [IAM developer's guide](https://cloud.google.com/iam). +/// Defines an Identity and Access Management (IAM) policy. It is used to +/// specify access control policies for Cloud Platform resources. +/// +/// +/// A `Policy` consists of a list of `bindings`. A `Binding` binds a list of +/// `members` to a `role`, where the members can be user accounts, Google groups, +/// Google domains, and service accounts. A `role` is a named list of permissions +/// defined by IAM. +/// +/// **Example** +/// +/// { +/// "bindings": [ +/// { +/// "role": "roles/owner", +/// "members": [ +/// "user:mike@example.com", +/// "group:admins@example.com", +/// "domain:google.com", +/// "serviceAccount:my-other-app@appspot.gserviceaccount.com", +/// ] +/// }, +/// { +/// "role": "roles/viewer", +/// "members": ["user:sean@example.com"] +/// } +/// ] +/// } +/// +/// For a description of IAM and its features, see the +/// [IAM developer's guide](https://cloud.google.com/iam). /// /// # Activities /// @@ -310,18 +396,30 @@ impl RequestValue for GetAncestryRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Policy { - /// Associates a list of `members` to a `role`. Multiple `bindings` must not be specified for the same `role`. `bindings` with no members will result in an error. + /// Associates a list of `members` to a `role`. + /// Multiple `bindings` must not be specified for the same `role`. + /// `bindings` with no members will result in an error. pub bindings: Option>, + /// `etag` is used for optimistic concurrency control as a way to help + /// prevent simultaneous updates of a policy from overwriting each other. + /// It is strongly suggested that systems make use of the `etag` in the + /// read-modify-write cycle to perform policy updates in order to avoid race + /// conditions: An `etag` is returned in the response to `getIamPolicy`, and + /// systems are expected to put that etag in the request to `setIamPolicy` to + /// ensure that their change will be applied to the same version of the policy. + /// + /// If no `etag` is provided in the call to `setIamPolicy`, then the existing + /// policy is overwritten blindly. + pub etag: Option, /// Version of the `Policy`. The default version is 0. pub version: Option, - /// `etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other. It is strongly suggested that systems make use of the `etag` in the read-modify-write cycle to perform policy updates in order to avoid race conditions: An `etag` is returned in the response to `getIamPolicy`, and systems are expected to put that etag in the request to `setIamPolicy` to ensure that their change will be applied to the same version of the policy. If no `etag` is provided in the call to `setIamPolicy`, then the existing policy is overwritten blindly. - pub etag: Option, } impl ResponseResult for Policy {} -/// The root node in the resource hierarchy to which a particular entity's (e.g., company) resources belong. +/// The root node in the resource hierarchy to which a particular entity's +/// (e.g., company) resources belong. /// /// # Activities /// @@ -337,20 +435,32 @@ impl ResponseResult for Policy {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Organization { - /// The owner of this Organization. The owner should be specified on creation. Once set, it cannot be changed. This field is required. + /// The owner of this Organization. The owner should be specified on + /// creation. Once set, it cannot be changed. + /// This field is required. pub owner: Option, - /// A friendly string to be used to refer to the Organization in the UI. This field is required. + /// A friendly string to be used to refer to the Organization in the UI. + /// Assigned by the server, set to the firm name of the Google For Work + /// customer that owns this organization. + /// @OutputOnly #[serde(rename="displayName")] pub display_name: Option, - /// Output Only. The resource name of the organization. This is the organization's relative path in the API. Its format is "organizations/[organization_id]". For example, "organizations/1234". + /// Output Only. The resource name of the organization. This is the + /// organization's relative path in the API. Its format is + /// "organizations/[organization_id]". For example, "organizations/1234". pub name: Option, - /// An immutable id for the Organization that is assigned on creation. This should be omitted when creating a new Organization. This field is read-only. This field is deprecated and will be removed in v1. Use name instead. + /// An immutable id for the Organization that is assigned on creation. This + /// should be omitted when creating a new Organization. + /// This field is read-only. + /// This field is deprecated and will be removed in v1. Use name instead. #[serde(rename="organizationId")] pub organization_id: Option, - /// Timestamp when the Organization was created. Assigned by the server. @OutputOnly + /// Timestamp when the Organization was created. Assigned by the server. + /// @OutputOnly #[serde(rename="creationTime")] pub creation_time: Option, - /// The organization's current lifecycle state. Assigned by the server. @OutputOnly + /// The organization's current lifecycle state. Assigned by the server. + /// @OutputOnly #[serde(rename="lifecycleState")] pub lifecycle_state: Option, } @@ -360,7 +470,13 @@ impl Resource for Organization {} impl ResponseResult for Organization {} -/// A page of the response received from the ListProjects method. A paginated response where more pages are available has `next_page_token` set. This token can be used in a subsequent request to retrieve the next request page. +/// A page of the response received from the +/// ListProjects +/// method. +/// +/// A paginated response where more pages are available has +/// `next_page_token` set. This token can be used in a subsequent request to +/// retrieve the next request page. /// /// # Activities /// @@ -371,17 +487,36 @@ impl ResponseResult for Organization {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListProjectsResponse { - /// Pagination token. If the result set is too large to fit in a single response, this token is returned. It encodes the position of the current result cursor. Feeding this value into a new list request with the `page_token` parameter gives the next page of the results. When `next_page_token` is not filled in, there is no next page and the list returned is the last page in the result set. Pagination tokens have a limited lifetime. + /// Pagination token. + /// + /// If the result set is too large to fit in a single response, this token + /// is returned. It encodes the position of the current result cursor. + /// Feeding this value into a new list request with the `page_token` parameter + /// gives the next page of the results. + /// + /// When `next_page_token` is not filled in, there is no next page and + /// the list returned is the last page in the result set. + /// + /// Pagination tokens have a limited lifetime. #[serde(rename="nextPageToken")] pub next_page_token: Option, - /// The list of Projects that matched the list filter. This list can be paginated. + /// The list of Projects that matched the list filter. This list can + /// be paginated. pub projects: Option>, } impl ResponseResult for ListProjectsResponse {} -/// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON representation for `Empty` is empty JSON object `{}`. +/// A generic empty message that you can re-use to avoid defining duplicated +/// empty messages in your APIs. A typical example is to use it as the request +/// or the response type of an API method. For instance: +/// +/// service Foo { +/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); +/// } +/// +/// The JSON representation for `Empty` is empty JSON object `{}`. /// /// # Activities /// @@ -397,7 +532,8 @@ pub struct Empty { _never_set: Option } impl ResponseResult for Empty {} -/// The request sent to the UndeleteProject method. +/// The request sent to the UndeleteProject +/// method. /// /// # Activities /// @@ -423,7 +559,11 @@ impl RequestValue for UndeleteProjectRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListOrganizationsResponse { - /// A pagination token to be used to retrieve the next page of results. If the result is too large to fit within the page size specified in the request, this field will be set with a token that can be used to fetch the next page of results. If this field is empty, it indicates that this response contains the last page of results. + /// A pagination token to be used to retrieve the next page of results. If the + /// result is too large to fit within the page size specified in the request, + /// this field will be set with a token that can be used to fetch the next page + /// of results. If this field is empty, it indicates that this response + /// contains the last page of results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// The list of Organizations that matched the list query, possibly paginated. @@ -445,7 +585,8 @@ impl ResponseResult for ListOrganizationsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TestIamPermissionsResponse { - /// A subset of `TestPermissionsRequest.permissions` that the caller is allowed. + /// A subset of `TestPermissionsRequest.permissions` that the caller is + /// allowed. pub permissions: Option>, } @@ -466,16 +607,21 @@ pub struct Ancestor { impl Part for Ancestor {} -/// A container to reference an id for any resource type. A `resource` in Google Cloud Platform is a generic term for something you (a developer) may want to interact with through one of our API's. Some examples are an AppEngine app, a Compute Engine instance, a Cloud SQL database, and so on. +/// A container to reference an id for any resource type. A `resource` in Google +/// Cloud Platform is a generic term for something you (a developer) may want to +/// interact with through one of our API's. Some examples are an AppEngine app, +/// a Compute Engine instance, a Cloud SQL database, and so on. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ResourceId { - /// Required field representing the resource type this id is for. At present, the valid types are "project" and "organization". + /// Required field representing the resource type this id is for. + /// At present, the valid types are "project" and "organization". #[serde(rename="type")] pub type_: Option, - /// Required field for the type-specific id. This should correspond to the id used in the type-specific API's. + /// Required field for the type-specific id. This should correspond to the id + /// used in the type-specific API's. pub id: Option, } @@ -488,16 +634,43 @@ impl Part for ResourceId {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Binding { - /// Role that is assigned to `members`. For example, `roles/viewer`, `roles/editor`, or `roles/owner`. Required + /// Role that is assigned to `members`. + /// For example, `roles/viewer`, `roles/editor`, or `roles/owner`. + /// Required pub role: Option, - /// Specifies the identities requesting access for a Cloud Platform resource. `members` can have the following values: * `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account. * `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account. * `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@gmail.com` or `joe@example.com`. * `serviceAccount:{emailid}`: An email address that represents a service account. For example, `my-other-app@appspot.gserviceaccount.com`. * `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`. * `domain:{domain}`: A Google Apps domain name that represents all the users of that domain. For example, `google.com` or `example.com`. + /// Specifies the identities requesting access for a Cloud Platform resource. + /// `members` can have the following values: + /// + /// * `allUsers`: A special identifier that represents anyone who is + /// on the internet; with or without a Google account. + /// + /// * `allAuthenticatedUsers`: A special identifier that represents anyone + /// who is authenticated with a Google account or a service account. + /// + /// * `user:{emailid}`: An email address that represents a specific Google + /// account. For example, `alice@gmail.com` or `joe@example.com`. + /// + /// + /// * `serviceAccount:{emailid}`: An email address that represents a service + /// account. For example, `my-other-app@appspot.gserviceaccount.com`. + /// + /// * `group:{emailid}`: An email address that represents a Google group. + /// For example, `admins@example.com`. + /// + /// * `domain:{domain}`: A Google Apps domain name that represents all the + /// users of that domain. For example, `google.com` or `example.com`. + /// + /// pub members: Option>, } impl Part for Binding {} -/// The entity that owns an Organization. The lifetime of the Organization and all of its descendants are bound to the `OrganizationOwner`. If the `OrganizationOwner` is deleted, the Organization and all its descendants will be deleted. +/// The entity that owns an Organization. The lifetime of the Organization and +/// all of its descendants are bound to the `OrganizationOwner`. If the +/// `OrganizationOwner` is deleted, the Organization and all its descendants will +/// be deleted. /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -556,12 +729,16 @@ impl<'a, C, A> OrganizationMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Sets the access control policy on an Organization resource. Replaces any existing policy. The `resource` field should be the organization's resource name, e.g. "organizations/123". For backward compatibility, the resource provided may also be the organization_id. This will not be supported in v1. + /// Sets the access control policy on an Organization resource. Replaces any + /// existing policy. The `resource` field should be the organization's resource + /// name, e.g. "organizations/123". /// /// # Arguments /// /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `setIamPolicy` documentation. + /// * `resource` - REQUIRED: The resource for which the policy is being specified. + /// `resource` is usually specified as a path. For example, a Project + /// resource is specified as `projects/{project}`. pub fn set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> OrganizationSetIamPolicyCall<'a, C, A> { OrganizationSetIamPolicyCall { hub: self.hub, @@ -575,12 +752,16 @@ impl<'a, C, A> OrganizationMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets the access control policy for an Organization resource. May be empty if no such policy or resource exists. The `resource` field should be the organization's resource name, e.g. "organizations/123". For backward compatibility, the resource provided may also be the organization_id. This will not be supported in v1. + /// Gets the access control policy for an Organization resource. May be empty + /// if no such policy or resource exists. The `resource` field should be the + /// organization's resource name, e.g. "organizations/123". /// /// # Arguments /// /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation. + /// * `resource` - REQUIRED: The resource for which the policy is being requested. + /// `resource` is usually specified as a path. For example, a Project + /// resource is specified as `projects/{project}`. pub fn get_iam_policy(&self, request: GetIamPolicyRequest, resource: &str) -> OrganizationGetIamPolicyCall<'a, C, A> { OrganizationGetIamPolicyCall { hub: self.hub, @@ -594,12 +775,16 @@ impl<'a, C, A> OrganizationMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Returns permissions that a caller has on the specified Organization. The `resource` field should be the organization's resource name, e.g. "organizations/123". For backward compatibility, the resource provided may also be the organization_id. This will not be supported in v1. + /// Returns permissions that a caller has on the specified Organization. + /// The `resource` field should be the organization's resource name, + /// e.g. "organizations/123". /// /// # Arguments /// /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `testIamPermissions` documentation. + /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. + /// `resource` is usually specified as a path. For example, a Project + /// resource is specified as `projects/{project}`. pub fn test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> OrganizationTestIamPermissionCall<'a, C, A> { OrganizationTestIamPermissionCall { hub: self.hub, @@ -617,7 +802,7 @@ impl<'a, C, A> OrganizationMethods<'a, C, A> { /// /// # Arguments /// - /// * `name` - The resource name of the Organization to fetch. Its format is "organizations/[organization_id]". For example, "organizations/1234". + /// * `name` - The resource name of the Organization to fetch, e.g. "organizations/1234". pub fn get(&self, name: &str) -> OrganizationGetCall<'a, C, A> { OrganizationGetCall { hub: self.hub, @@ -636,7 +821,9 @@ impl<'a, C, A> OrganizationMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `name` - Output Only. The resource name of the organization. This is the organization's relative path in the API. Its format is "organizations/[organization_id]". For example, "organizations/1234". + /// * `name` - Output Only. The resource name of the organization. This is the + /// organization's relative path in the API. Its format is + /// "organizations/[organization_id]". For example, "organizations/1234". pub fn update(&self, request: Organization, name: &str) -> OrganizationUpdateCall<'a, C, A> { OrganizationUpdateCall { hub: self.hub, @@ -650,7 +837,9 @@ impl<'a, C, A> OrganizationMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists Organization resources that are visible to the user and satisfy the specified filter. This method returns Organizations in an unspecified order. New Organizations do not necessarily appear at the end of the list. + /// Lists Organization resources that are visible to the user and satisfy + /// the specified filter. This method returns Organizations in an unspecified + /// order. New Organizations do not necessarily appear at the end of the list. pub fn list(&self) -> OrganizationListCall<'a, C, A> { OrganizationListCall { hub: self.hub, @@ -711,7 +900,9 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `testIamPermissions` documentation. + /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. + /// `resource` is usually specified as a path. For example, a Project + /// resource is specified as `projects/{project}`. pub fn test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> ProjectTestIamPermissionCall<'a, C, A> { ProjectTestIamPermissionCall { hub: self.hub, @@ -725,12 +916,19 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Restores the Project identified by the specified `project_id` (for example, `my-project-123`). You can only use this method for a Project that has a lifecycle state of DELETE_REQUESTED. After deletion starts, the Project cannot be restored. The caller must have modify permissions for this Project. + /// Restores the Project identified by the specified + /// `project_id` (for example, `my-project-123`). + /// You can only use this method for a Project that has a lifecycle state of + /// DELETE_REQUESTED. + /// After deletion starts, the Project cannot be restored. + /// + /// The caller must have modify permissions for this Project. /// /// # Arguments /// /// * `request` - No description provided. - /// * `projectId` - The project ID (for example, `foo-bar-123`). Required. + /// * `projectId` - The project ID (for example, `foo-bar-123`). + /// Required. pub fn undelete(&self, request: UndeleteProjectRequest, project_id: &str) -> ProjectUndeleteCall<'a, C, A> { ProjectUndeleteCall { hub: self.hub, @@ -744,7 +942,14 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Creates a Project resource. Initially, the Project resource is owned by its creator exclusively. The creator can later grant permission to others to read or update the Project. Several APIs are activated automatically for the Project, including Google Cloud Storage. + /// Creates a Project resource. + /// + /// Initially, the Project resource is owned by its creator exclusively. + /// The creator can later grant permission to others to read or update the + /// Project. + /// + /// Several APIs are activated automatically for the Project, including + /// Google Cloud Storage. /// /// # Arguments /// @@ -753,6 +958,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { ProjectCreateCall { hub: self.hub, _request: request, + _use_legacy_stack: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -761,12 +967,49 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Sets the IAM access control policy for the specified Project. Replaces any existing policy. The following constraints apply when using `setIamPolicy()`: + Project does not support `allUsers` and `allAuthenticatedUsers` as `members` in a `Binding` of a `Policy`. + The owner role can be granted only to `user` and `serviceAccount`. + Service accounts can be made owners of a project directly without any restrictions. However, to be added as an owner, a user must be invited via Cloud Platform console and must accept the invitation. + A user cannot be granted the owner role using `setIamPolicy()`. The user must be granted the owner role using the Cloud Platform Console and must explicitly accept the invitation. + Invitations to grant the owner role cannot be sent using `setIamPolicy()`; they must be sent only using the Cloud Platform Console. + Membership changes that leave the project without any owners that have accepted the Terms of Service (ToS) will be rejected. + Members cannot be added to more than one role in the same policy. + There must be at least one owner who has accepted the Terms of Service (ToS) agreement in the policy. Calling `setIamPolicy()` to to remove the last ToS-accepted owner from the policy will fail. This restriction also applies to legacy projects that no longer have owners who have accepted the ToS. Edits to IAM policies will be rejected until the lack of a ToS-accepting owner is rectified. + Calling this method requires enabling the App Engine Admin API. Note: Removing service accounts from policies or changing their roles can render services completely inoperable. It is important to understand how the service account is being used before removing or updating its roles. + /// Sets the IAM access control policy for the specified Project. Replaces + /// any existing policy. + /// + /// The following constraints apply when using `setIamPolicy()`: + /// + /// + Project does not support `allUsers` and `allAuthenticatedUsers` as + /// `members` in a `Binding` of a `Policy`. + /// + /// + The owner role can be granted only to `user` and `serviceAccount`. + /// + /// + Service accounts can be made owners of a project directly + /// without any restrictions. However, to be added as an owner, a user must be + /// invited via Cloud Platform console and must accept the invitation. + /// + /// + A user cannot be granted the owner role using `setIamPolicy()`. The user + /// must be granted the owner role using the Cloud Platform Console and must + /// explicitly accept the invitation. + /// + /// + Invitations to grant the owner role cannot be sent using `setIamPolicy()`; + /// they must be sent only using the Cloud Platform Console. + /// + /// + Membership changes that leave the project without any owners that have + /// accepted the Terms of Service (ToS) will be rejected. + /// + /// + There must be at least one owner who has accepted the Terms of + /// Service (ToS) agreement in the policy. Calling `setIamPolicy()` to + /// to remove the last ToS-accepted owner from the policy will fail. This + /// restriction also applies to legacy projects that no longer have owners + /// who have accepted the ToS. Edits to IAM policies will be rejected until + /// the lack of a ToS-accepting owner is rectified. + /// + /// + Calling this method requires enabling the App Engine Admin API. + /// + /// Note: Removing service accounts from policies or changing their roles + /// can render services completely inoperable. It is important to understand + /// how the service account is being used before removing or updating its roles. /// /// # Arguments /// /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `setIamPolicy` documentation. + /// * `resource` - REQUIRED: The resource for which the policy is being specified. + /// `resource` is usually specified as a path. For example, a Project + /// resource is specified as `projects/{project}`. pub fn set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> ProjectSetIamPolicyCall<'a, C, A> { ProjectSetIamPolicyCall { hub: self.hub, @@ -780,11 +1023,15 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the Project identified by the specified `project_id` (for example, `my-project-123`). The caller must have read permissions for this Project. + /// Retrieves the Project identified by the specified + /// `project_id` (for example, `my-project-123`). + /// + /// The caller must have read permissions for this Project. /// /// # Arguments /// - /// * `projectId` - The Project ID (for example, `my-project-123`). Required. + /// * `projectId` - The Project ID (for example, `my-project-123`). + /// Required. pub fn get(&self, project_id: &str) -> ProjectGetCall<'a, C, A> { ProjectGetCall { hub: self.hub, @@ -797,12 +1044,16 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets a list of ancestors in the resource hierarchy for the Project identified by the specified `project_id` (for example, `my-project-123`). The caller must have read permissions for this Project. + /// Gets a list of ancestors in the resource hierarchy for the Project + /// identified by the specified `project_id` (for example, `my-project-123`). + /// + /// The caller must have read permissions for this Project. /// /// # Arguments /// /// * `request` - No description provided. - /// * `projectId` - The Project ID (for example, `my-project-123`). Required. + /// * `projectId` - The Project ID (for example, `my-project-123`). + /// Required. pub fn get_ancestry(&self, request: GetAncestryRequest, project_id: &str) -> ProjectGetAncestryCall<'a, C, A> { ProjectGetAncestryCall { hub: self.hub, @@ -816,12 +1067,16 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates the attributes of the Project identified by the specified `project_id` (for example, `my-project-123`). The caller must have modify permissions for this Project. + /// Updates the attributes of the Project identified by the specified + /// `project_id` (for example, `my-project-123`). + /// + /// The caller must have modify permissions for this Project. /// /// # Arguments /// /// * `request` - No description provided. - /// * `projectId` - The project ID (for example, `my-project-123`). Required. + /// * `projectId` - The project ID (for example, `my-project-123`). + /// Required. pub fn update(&self, request: Project, project_id: &str) -> ProjectUpdateCall<'a, C, A> { ProjectUpdateCall { hub: self.hub, @@ -835,12 +1090,15 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Returns the IAM access control policy for the specified Project. Permission is denied if the policy or the resource does not exist. + /// Returns the IAM access control policy for the specified Project. + /// Permission is denied if the policy or the resource does not exist. /// /// # Arguments /// /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation. + /// * `resource` - REQUIRED: The resource for which the policy is being requested. + /// `resource` is usually specified as a path. For example, a Project + /// resource is specified as `projects/{project}`. pub fn get_iam_policy(&self, request: GetIamPolicyRequest, resource: &str) -> ProjectGetIamPolicyCall<'a, C, A> { ProjectGetIamPolicyCall { hub: self.hub, @@ -854,11 +1112,35 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Marks the Project identified by the specified `project_id` (for example, `my-project-123`) for deletion. This method will only affect the Project if the following criteria are met: + The Project does not have a billing account associated with it. + The Project has a lifecycle state of ACTIVE. This method changes the Project's lifecycle state from ACTIVE to DELETE_REQUESTED. The deletion starts at an unspecified time, at which point the project is no longer accessible. Until the deletion completes, you can check the lifecycle state checked by retrieving the Project with GetProject, and the Project remains visible to ListProjects. However, you cannot update the project. After the deletion completes, the Project is not retrievable by the GetProject and ListProjects methods. The caller must have modify permissions for this Project. + /// Marks the Project identified by the specified + /// `project_id` (for example, `my-project-123`) for deletion. + /// This method will only affect the Project if the following criteria are met: + /// + /// + The Project does not have a billing account associated with it. + /// + The Project has a lifecycle state of + /// ACTIVE. + /// + /// This method changes the Project's lifecycle state from + /// ACTIVE + /// to DELETE_REQUESTED. + /// The deletion starts at an unspecified time, at which point the project is + /// no longer accessible. + /// + /// Until the deletion completes, you can check the lifecycle state + /// checked by retrieving the Project with GetProject, + /// and the Project remains visible to ListProjects. + /// However, you cannot update the project. + /// + /// After the deletion completes, the Project is not retrievable by + /// the GetProject and + /// ListProjects methods. + /// + /// The caller must have modify permissions for this Project. /// /// # Arguments /// - /// * `projectId` - The Project ID (for example, `foo-bar-123`). Required. + /// * `projectId` - The Project ID (for example, `foo-bar-123`). + /// Required. pub fn delete(&self, project_id: &str) -> ProjectDeleteCall<'a, C, A> { ProjectDeleteCall { hub: self.hub, @@ -871,7 +1153,9 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists Projects that are visible to the user and satisfy the specified filter. This method returns Projects in an unspecified order. New Projects do not necessarily appear at the end of the list. + /// Lists Projects that are visible to the user and satisfy the + /// specified filter. This method returns Projects in an unspecified order. + /// New Projects do not necessarily appear at the end of the list. pub fn list(&self) -> ProjectListCall<'a, C, A> { ProjectListCall { hub: self.hub, @@ -893,7 +1177,9 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { // CallBuilders ### // ################# -/// Sets the access control policy on an Organization resource. Replaces any existing policy. The `resource` field should be the organization's resource name, e.g. "organizations/123". For backward compatibility, the resource provided may also be the organization_id. This will not be supported in v1. +/// Sets the access control policy on an Organization resource. Replaces any +/// existing policy. The `resource` field should be the organization's resource +/// name, e.g. "organizations/123". /// /// A builder for the *setIamPolicy* method supported by a *organization* resource. /// It is not used directly, but through a `OrganizationMethods` instance. @@ -1101,7 +1387,9 @@ impl<'a, C, A> OrganizationSetIamPolicyCall<'a, C, A> where C: BorrowMut OrganizationSetIamPolicyCall<'a, C, A> where C: BorrowMut OrganizationGetIamPolicyCall<'a, C, A> where C: BorrowMut OrganizationGetIamPolicyCall<'a, C, A> where C: BorrowMut OrganizationTestIamPermissionCall<'a, C, A> where C: BorrowMut OrganizationGetCall<'a, C, A> where C: BorrowMut, } - /// The resource name of the Organization to fetch. Its format is "organizations/[organization_id]". For example, "organizations/1234". + /// The resource name of the Organization to fetch, e.g. "organizations/1234". /// /// Sets the *name* path property to the given value. /// @@ -1913,7 +2209,8 @@ impl<'a, C, A> OrganizationGetCall<'a, C, A> where C: BorrowMut, self._name = new_value.to_string(); self } - /// The id of the Organization resource to fetch. This field is deprecated and will be removed in v1. Use name instead. + /// The id of the Organization resource to fetch. + /// This field is deprecated and will be removed in v1. Use name instead. /// /// Sets the *organization id* query property to the given value. pub fn organization_id(mut self, new_value: &str) -> OrganizationGetCall<'a, C, A> { @@ -2186,7 +2483,9 @@ impl<'a, C, A> OrganizationUpdateCall<'a, C, A> where C: BorrowMut OrganizationUpdateCall<'a, C, A> where C: BorrowMut OrganizationListCall<'a, C, A> where C: BorrowMut, } - /// A pagination token returned from a previous call to `ListOrganizations` that indicates from where listing should continue. This field is optional. + /// A pagination token returned from a previous call to `ListOrganizations` + /// that indicates from where listing should continue. + /// This field is optional. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> OrganizationListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// The maximum number of Organizations to return in the response. This field is optional. + /// The maximum number of Organizations to return in the response. + /// This field is optional. /// /// Sets the *page size* query property to the given value. pub fn page_size(mut self, new_value: i32) -> OrganizationListCall<'a, C, A> { self._page_size = Some(new_value); self } - /// An optional query string used to filter the Organizations to return in the response. Filter rules are case-insensitive. Organizations may be filtered by `owner.directoryCustomerId` or by `domain`, where the domain is a Google for Work domain, for example: |Filter|Description| |------|-----------| |owner.directorycustomerid:123456789|Organizations with `owner.directory_customer_id` equal to `123456789`.| |domain:google.com|Organizations corresponding to the domain `google.com`.| This field is optional. + /// An optional query string used to filter the Organizations to return in + /// the response. Filter rules are case-insensitive. + /// + /// + /// Organizations may be filtered by `owner.directoryCustomerId` or by + /// `domain`, where the domain is a Google for Work domain, for example: + /// + /// |Filter|Description| + /// |------|-----------| + /// |owner.directorycustomerid:123456789|Organizations with `owner.directory_customer_id` equal to `123456789`.| + /// |domain:google.com|Organizations corresponding to the domain `google.com`.| + /// + /// This field is optional. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> OrganizationListCall<'a, C, A> { @@ -2702,7 +3018,9 @@ impl<'a, C, A> ProjectTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectUndeleteCall<'a, C, A> where C: BorrowMut, self._request = new_value; self } - /// The project ID (for example, `foo-bar-123`). Required. + /// The project ID (for example, `foo-bar-123`). + /// + /// Required. /// /// Sets the *project id* path property to the given value. /// @@ -3042,7 +3368,14 @@ impl<'a, C, A> ProjectUndeleteCall<'a, C, A> where C: BorrowMut, } -/// Creates a Project resource. Initially, the Project resource is owned by its creator exclusively. The creator can later grant permission to others to read or update the Project. Several APIs are activated automatically for the Project, including Google Cloud Storage. +/// Creates a Project resource. +/// +/// Initially, the Project resource is owned by its creator exclusively. +/// The creator can later grant permission to others to read or update the +/// Project. +/// +/// Several APIs are activated automatically for the Project, including +/// Google Cloud Storage. /// /// A builder for the *create* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -3075,6 +3408,7 @@ impl<'a, C, A> ProjectUndeleteCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().create(req) +/// .use_legacy_stack(false) /// .doit(); /// # } /// ``` @@ -3083,6 +3417,7 @@ pub struct ProjectCreateCall<'a, C, A> hub: &'a CloudResourceManager, _request: Project, + _use_legacy_stack: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap @@ -3104,8 +3439,11 @@ impl<'a, C, A> ProjectCreateCall<'a, C, A> where C: BorrowMut, A: }; dlg.begin(MethodInfo { id: "cloudresourcemanager.projects.create", http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - for &field in ["alt"].iter() { + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + if let Some(value) = self._use_legacy_stack { + params.push(("useLegacyStack", value.to_string())); + } + for &field in ["alt", "useLegacyStack"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -3223,6 +3561,13 @@ impl<'a, C, A> ProjectCreateCall<'a, C, A> where C: BorrowMut, A: self._request = new_value; self } + /// A safety hatch to opt out of the new reliable project creation process. + /// + /// Sets the *use legacy stack* query property to the given value. + pub fn use_legacy_stack(mut self, new_value: bool) -> ProjectCreateCall<'a, C, A> { + self._use_legacy_stack = Some(new_value); + self + } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// @@ -3281,7 +3626,42 @@ impl<'a, C, A> ProjectCreateCall<'a, C, A> where C: BorrowMut, A: } -/// Sets the IAM access control policy for the specified Project. Replaces any existing policy. The following constraints apply when using `setIamPolicy()`: + Project does not support `allUsers` and `allAuthenticatedUsers` as `members` in a `Binding` of a `Policy`. + The owner role can be granted only to `user` and `serviceAccount`. + Service accounts can be made owners of a project directly without any restrictions. However, to be added as an owner, a user must be invited via Cloud Platform console and must accept the invitation. + A user cannot be granted the owner role using `setIamPolicy()`. The user must be granted the owner role using the Cloud Platform Console and must explicitly accept the invitation. + Invitations to grant the owner role cannot be sent using `setIamPolicy()`; they must be sent only using the Cloud Platform Console. + Membership changes that leave the project without any owners that have accepted the Terms of Service (ToS) will be rejected. + Members cannot be added to more than one role in the same policy. + There must be at least one owner who has accepted the Terms of Service (ToS) agreement in the policy. Calling `setIamPolicy()` to to remove the last ToS-accepted owner from the policy will fail. This restriction also applies to legacy projects that no longer have owners who have accepted the ToS. Edits to IAM policies will be rejected until the lack of a ToS-accepting owner is rectified. + Calling this method requires enabling the App Engine Admin API. Note: Removing service accounts from policies or changing their roles can render services completely inoperable. It is important to understand how the service account is being used before removing or updating its roles. +/// Sets the IAM access control policy for the specified Project. Replaces +/// any existing policy. +/// +/// The following constraints apply when using `setIamPolicy()`: +/// +/// + Project does not support `allUsers` and `allAuthenticatedUsers` as +/// `members` in a `Binding` of a `Policy`. +/// +/// + The owner role can be granted only to `user` and `serviceAccount`. +/// +/// + Service accounts can be made owners of a project directly +/// without any restrictions. However, to be added as an owner, a user must be +/// invited via Cloud Platform console and must accept the invitation. +/// +/// + A user cannot be granted the owner role using `setIamPolicy()`. The user +/// must be granted the owner role using the Cloud Platform Console and must +/// explicitly accept the invitation. +/// +/// + Invitations to grant the owner role cannot be sent using `setIamPolicy()`; +/// they must be sent only using the Cloud Platform Console. +/// +/// + Membership changes that leave the project without any owners that have +/// accepted the Terms of Service (ToS) will be rejected. +/// +/// + There must be at least one owner who has accepted the Terms of +/// Service (ToS) agreement in the policy. Calling `setIamPolicy()` to +/// to remove the last ToS-accepted owner from the policy will fail. This +/// restriction also applies to legacy projects that no longer have owners +/// who have accepted the ToS. Edits to IAM policies will be rejected until +/// the lack of a ToS-accepting owner is rectified. +/// +/// + Calling this method requires enabling the App Engine Admin API. +/// +/// Note: Removing service accounts from policies or changing their roles +/// can render services completely inoperable. It is important to understand +/// how the service account is being used before removing or updating its roles. /// /// A builder for the *setIamPolicy* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -3485,7 +3865,9 @@ impl<'a, C, A> ProjectSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa } - /// The Project ID (for example, `my-project-123`). Required. + /// The Project ID (for example, `my-project-123`). + /// + /// Required. /// /// Sets the *project id* path property to the given value. /// @@ -3794,7 +4181,10 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa } -/// Gets a list of ancestors in the resource hierarchy for the Project identified by the specified `project_id` (for example, `my-project-123`). The caller must have read permissions for this Project. +/// Gets a list of ancestors in the resource hierarchy for the Project +/// identified by the specified `project_id` (for example, `my-project-123`). +/// +/// The caller must have read permissions for this Project. /// /// A builder for the *getAncestry* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -3998,7 +4388,9 @@ impl<'a, C, A> ProjectGetAncestryCall<'a, C, A> where C: BorrowMut ProjectGetAncestryCall<'a, C, A> where C: BorrowMut ProjectUpdateCall<'a, C, A> where C: BorrowMut, A: self._request = new_value; self } - /// The project ID (for example, `my-project-123`). Required. + /// The project ID (for example, `my-project-123`). + /// + /// Required. /// /// Sets the *project id* path property to the given value. /// @@ -4338,7 +4735,8 @@ impl<'a, C, A> ProjectUpdateCall<'a, C, A> where C: BorrowMut, A: } -/// Returns the IAM access control policy for the specified Project. Permission is denied if the policy or the resource does not exist. +/// Returns the IAM access control policy for the specified Project. +/// Permission is denied if the policy or the resource does not exist. /// /// A builder for the *getIamPolicy* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -4542,7 +4940,9 @@ impl<'a, C, A> ProjectGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectDeleteCall<'a, C, A> where C: BorrowMut, A: } - /// The Project ID (for example, `foo-bar-123`). Required. + /// The Project ID (for example, `foo-bar-123`). + /// + /// Required. /// /// Sets the *project id* path property to the given value. /// @@ -4851,7 +5276,9 @@ impl<'a, C, A> ProjectDeleteCall<'a, C, A> where C: BorrowMut, A: } -/// Lists Projects that are visible to the user and satisfy the specified filter. This method returns Projects in an unspecified order. New Projects do not necessarily appear at the end of the list. +/// Lists Projects that are visible to the user and satisfy the +/// specified filter. This method returns Projects in an unspecified order. +/// New Projects do not necessarily appear at the end of the list. /// /// A builder for the *list* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -4879,8 +5306,8 @@ impl<'a, C, A> ProjectDeleteCall<'a, C, A> where C: BorrowMut, A: /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().list() /// .page_token("et") -/// .page_size(-17) -/// .filter("diam") +/// .page_size(-41) +/// .filter("ipsum") /// .doit(); /// # } /// ``` @@ -5016,21 +5443,47 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o } - /// A pagination token returned from a previous call to ListProjects that indicates from where listing should continue. Optional. + /// A pagination token returned from a previous call to ListProjects + /// that indicates from where listing should continue. + /// + /// Optional. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> ProjectListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// The maximum number of Projects to return in the response. The server can return fewer Projects than requested. If unspecified, server picks an appropriate default. Optional. + /// The maximum number of Projects to return in the response. + /// The server can return fewer Projects than requested. + /// If unspecified, server picks an appropriate default. + /// + /// Optional. /// /// Sets the *page size* query property to the given value. pub fn page_size(mut self, new_value: i32) -> ProjectListCall<'a, C, A> { self._page_size = Some(new_value); self } - /// An expression for filtering the results of the request. Filter rules are case insensitive. The fields eligible for filtering are: + `name` + `id` + labels.key where *key* is the name of a label Some examples of using labels as filters: |Filter|Description| |------|-----------| |name:*|The project has a name.| |name:Howl|The project's name is `Howl` or `howl`.| |name:HOWL|Equivalent to above.| |NAME:howl|Equivalent to above.| |labels.color:*|The project has the label `color`.| |labels.color:red|The project's label `color` has the value `red`.| |labels.color:red label.size:big|The project's label `color` has the value `red` and its label `size` has the value `big`. Optional. + /// An expression for filtering the results of the request. Filter rules are + /// case insensitive. The fields eligible for filtering are: + /// + /// + `name` + /// + `id` + /// + labels.key where *key* is the name of a label + /// + /// Some examples of using labels as filters: + /// + /// |Filter|Description| + /// |------|-----------| + /// |name:*|The project has a name.| + /// |name:Howl|The project's name is `Howl` or `howl`.| + /// |name:HOWL|Equivalent to above.| + /// |NAME:howl|Equivalent to above.| + /// |labels.color:*|The project has the label `color`.| + /// |labels.color:red|The project's label `color` has the value `red`.| + /// |labels.color:red label.size:big|The project's label `color` has the value `red` and its label `size` has the value `big`. + /// + /// Optional. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> ProjectListCall<'a, C, A> { diff --git a/gen/content2-cli/Cargo.toml b/gen/content2-cli/Cargo.toml index db89af919c..23aca1860b 100644 --- a/gen/content2-cli/Cargo.toml +++ b/gen/content2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-content2-cli" -version = "1.0.0+20160905" +version = "1.0.0+20161205" authors = ["Sebastian Thiel "] description = "A complete library to interact with Shopping Content (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/content2-cli" diff --git a/gen/content2-cli/README.md b/gen/content2-cli/README.md index 7c2e1a892a..2821728650 100644 --- a/gen/content2-cli/README.md +++ b/gen/content2-cli/README.md @@ -24,7 +24,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Shopping Content* API at revision *20160905*. The CLI is at version *1.0.0*. +This documentation was generated from the *Shopping Content* API at revision *20161205*. The CLI is at version *1.0.0*. ```bash content2 [options] diff --git a/gen/content2-cli/mkdocs.yml b/gen/content2-cli/mkdocs.yml index 498d30a92c..8ef0ddb8a4 100644 --- a/gen/content2-cli/mkdocs.yml +++ b/gen/content2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Shopping Content v1.0.0+20160905 +site_name: Shopping Content v1.0.0+20161205 site_url: http://byron.github.io/google-apis-rs/google-content2-cli site_description: Write integrating applications with bcore diff --git a/gen/content2-cli/src/main.rs b/gen/content2-cli/src/main.rs index 565749032e..7846e063ae 100644 --- a/gen/content2-cli/src/main.rs +++ b/gen/content2-cli/src/main.rs @@ -2466,6 +2466,8 @@ impl<'n> Engine<'n> { "price.currency" => Some(("price.currency", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "price.value" => Some(("price.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "sell-on-google-quantity" => Some(("sellOnGoogleQuantity", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "pickup.pickup-method" => Some(("pickup.pickupMethod", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pickup.pickup-sla" => Some(("pickup.pickupSla", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "sale-price.currency" => Some(("salePrice.currency", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "sale-price.value" => Some(("salePrice.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "availability" => Some(("availability", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2474,7 +2476,7 @@ impl<'n> Engine<'n> { "loyalty-points.points-value" => Some(("loyaltyPoints.pointsValue", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "quantity" => Some(("quantity", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["amount", "availability", "currency", "installment", "loyalty-points", "months", "name", "points-value", "price", "quantity", "ratio", "sale-price", "sale-price-effective-date", "sell-on-google-quantity", "value"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["amount", "availability", "currency", "installment", "loyalty-points", "months", "name", "pickup", "pickup-method", "pickup-sla", "points-value", "price", "quantity", "ratio", "sale-price", "sale-price-effective-date", "sell-on-google-quantity", "value"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -5151,7 +5153,7 @@ fn main() { Some(false)), ]), ("delete", - Some(r##"Deletes a Merchant Center sub-account."##), + Some(r##"Deletes a Merchant Center sub-account. This method can only be called for multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/accounts_delete", vec![ (Some(r##"merchant-id"##), @@ -5173,7 +5175,7 @@ fn main() { Some(true)), ]), ("get", - Some(r##"Retrieves a Merchant Center account."##), + Some(r##"Retrieves a Merchant Center account. This method can only be called for accounts to which the managing account has access: either the managing account itself or sub-accounts if the managing account is a multi-client account."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/accounts_get", vec![ (Some(r##"merchant-id"##), @@ -5201,7 +5203,7 @@ fn main() { Some(false)), ]), ("insert", - Some(r##"Creates a Merchant Center sub-account."##), + Some(r##"Creates a Merchant Center sub-account. This method can only be called for multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/accounts_insert", vec![ (Some(r##"merchant-id"##), @@ -5229,7 +5231,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Lists the sub-accounts in your Merchant Center account."##), + Some(r##"Lists the sub-accounts in your Merchant Center account. This method can only be called for multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/accounts_list", vec![ (Some(r##"merchant-id"##), @@ -5251,7 +5253,7 @@ fn main() { Some(false)), ]), ("patch", - Some(r##"Updates a Merchant Center account. This method supports patch semantics."##), + Some(r##"Updates a Merchant Center account. This method can only be called for multi-client accounts. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/accounts_patch", vec![ (Some(r##"merchant-id"##), @@ -5285,7 +5287,7 @@ fn main() { Some(false)), ]), ("update", - Some(r##"Updates a Merchant Center account."##), + Some(r##"Updates a Merchant Center account. This method can only be called for multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/accounts_update", vec![ (Some(r##"merchant-id"##), @@ -5344,7 +5346,7 @@ fn main() { Some(false)), ]), ("get", - Some(r##"Retrieves the shipping settings of the account."##), + Some(r##"Retrieves the shipping settings of the account. This method can only be called for accounts to which the managing account has access: either the managing account itself or sub-accounts if the managing account is a multi-client account."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/accountshipping_get", vec![ (Some(r##"merchant-id"##), @@ -5372,7 +5374,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Lists the shipping settings of the sub-accounts in your Merchant Center account."##), + Some(r##"Lists the shipping settings of the sub-accounts in your Merchant Center account. This method can only be called for multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/accountshipping_list", vec![ (Some(r##"merchant-id"##), @@ -5394,7 +5396,7 @@ fn main() { Some(false)), ]), ("patch", - Some(r##"Updates the shipping settings of the account. This method supports patch semantics."##), + Some(r##"Updates the shipping settings of the account. This method can only be called for accounts to which the managing account has access: either the managing account itself or sub-accounts if the managing account is a multi-client account. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/accountshipping_patch", vec![ (Some(r##"merchant-id"##), @@ -5428,7 +5430,7 @@ fn main() { Some(false)), ]), ("update", - Some(r##"Updates the shipping settings of the account."##), + Some(r##"Updates the shipping settings of the account. This method can only be called for accounts to which the managing account has access: either the managing account itself or sub-accounts if the managing account is a multi-client account."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/accountshipping_update", vec![ (Some(r##"merchant-id"##), @@ -5487,7 +5489,7 @@ fn main() { Some(false)), ]), ("get", - Some(r##"Retrieves the status of a Merchant Center account."##), + Some(r##"Retrieves the status of a Merchant Center account. This method can only be called for accounts to which the managing account has access: either the managing account itself or sub-accounts if the managing account is a multi-client account."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/accountstatuses_get", vec![ (Some(r##"merchant-id"##), @@ -5515,7 +5517,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Lists the statuses of the sub-accounts in your Merchant Center account."##), + Some(r##"Lists the statuses of the sub-accounts in your Merchant Center account. This method can only be called for multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/accountstatuses_list", vec![ (Some(r##"merchant-id"##), @@ -5562,7 +5564,7 @@ fn main() { Some(false)), ]), ("get", - Some(r##"Retrieves the tax settings of the account."##), + Some(r##"Retrieves the tax settings of the account. This method can only be called for accounts to which the managing account has access: either the managing account itself or sub-accounts if the managing account is a multi-client account."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/accounttax_get", vec![ (Some(r##"merchant-id"##), @@ -5590,7 +5592,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Lists the tax settings of the sub-accounts in your Merchant Center account."##), + Some(r##"Lists the tax settings of the sub-accounts in your Merchant Center account. This method can only be called for multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/accounttax_list", vec![ (Some(r##"merchant-id"##), @@ -5612,7 +5614,7 @@ fn main() { Some(false)), ]), ("patch", - Some(r##"Updates the tax settings of the account. This method supports patch semantics."##), + Some(r##"Updates the tax settings of the account. This method can only be called for accounts to which the managing account has access: either the managing account itself or sub-accounts if the managing account is a multi-client account. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/accounttax_patch", vec![ (Some(r##"merchant-id"##), @@ -5646,7 +5648,7 @@ fn main() { Some(false)), ]), ("update", - Some(r##"Updates the tax settings of the account."##), + Some(r##"Updates the tax settings of the account. This method can only be called for accounts to which the managing account has access: either the managing account itself or sub-accounts if the managing account is a multi-client account."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/accounttax_update", vec![ (Some(r##"merchant-id"##), @@ -5705,7 +5707,7 @@ fn main() { Some(false)), ]), ("delete", - Some(r##"Deletes a datafeed from your Merchant Center account."##), + Some(r##"Deletes a datafeed from your Merchant Center account. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/datafeeds_delete", vec![ (Some(r##"merchant-id"##), @@ -5727,7 +5729,7 @@ fn main() { Some(true)), ]), ("get", - Some(r##"Retrieves a datafeed from your Merchant Center account."##), + Some(r##"Retrieves a datafeed from your Merchant Center account. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/datafeeds_get", vec![ (Some(r##"merchant-id"##), @@ -5755,7 +5757,7 @@ fn main() { Some(false)), ]), ("insert", - Some(r##"Registers a datafeed with your Merchant Center account."##), + Some(r##"Registers a datafeed with your Merchant Center account. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/datafeeds_insert", vec![ (Some(r##"merchant-id"##), @@ -5783,7 +5785,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Lists the datafeeds in your Merchant Center account."##), + Some(r##"Lists the datafeeds in your Merchant Center account. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/datafeeds_list", vec![ (Some(r##"merchant-id"##), @@ -5805,7 +5807,7 @@ fn main() { Some(false)), ]), ("patch", - Some(r##"Updates a datafeed of your Merchant Center account. This method supports patch semantics."##), + Some(r##"Updates a datafeed of your Merchant Center account. This method can only be called for non-multi-client accounts. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/datafeeds_patch", vec![ (Some(r##"merchant-id"##), @@ -5839,7 +5841,7 @@ fn main() { Some(false)), ]), ("update", - Some(r##"Updates a datafeed of your Merchant Center account."##), + Some(r##"Updates a datafeed of your Merchant Center account. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/datafeeds_update", vec![ (Some(r##"merchant-id"##), @@ -5898,7 +5900,7 @@ fn main() { Some(false)), ]), ("get", - Some(r##"Retrieves the status of a datafeed from your Merchant Center account."##), + Some(r##"Retrieves the status of a datafeed from your Merchant Center account. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/datafeedstatuses_get", vec![ (Some(r##"merchant-id"##), @@ -5926,7 +5928,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Lists the statuses of the datafeeds in your Merchant Center account."##), + Some(r##"Lists the statuses of the datafeeds in your Merchant Center account. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/datafeedstatuses_list", vec![ (Some(r##"merchant-id"##), @@ -5951,7 +5953,7 @@ fn main() { ("inventory", "methods: 'custombatch' and 'set'", vec![ ("custombatch", - Some(r##"Updates price and availability for multiple products or stores in a single request. This operation does not update the expiration date of the products."##), + Some(r##"Updates price and availability for multiple products or stores in a single request. This operation does not update the expiration date of the products. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/inventory_custombatch", vec![ (Some(r##"kv"##), @@ -5973,7 +5975,7 @@ fn main() { Some(false)), ]), ("set", - Some(r##"Updates price and availability of a product in your Merchant Center account. This operation does not update the expiration date of the product."##), + Some(r##"Updates price and availability of a product in your Merchant Center account. This operation does not update the expiration date of the product. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/inventory_set", vec![ (Some(r##"merchant-id"##), @@ -6016,7 +6018,7 @@ fn main() { ("orders", "methods: 'acknowledge', 'advancetestorder', 'cancel', 'cancellineitem', 'createtestorder', 'custombatch', 'get', 'getbymerchantorderid', 'gettestordertemplate', 'list', 'refund', 'returnlineitem', 'shiplineitems', 'updatemerchantorderid' and 'updateshipment'", vec![ ("acknowledge", - Some(r##"Marks an order as acknowledged."##), + Some(r##"Marks an order as acknowledged. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/orders_acknowledge", vec![ (Some(r##"merchant-id"##), @@ -6050,7 +6052,7 @@ fn main() { Some(false)), ]), ("advancetestorder", - Some(r##"Sandbox only. Moves a test order from state "inProgress" to state "pendingShipment"."##), + Some(r##"Sandbox only. Moves a test order from state "inProgress" to state "pendingShipment". This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/orders_advancetestorder", vec![ (Some(r##"merchant-id"##), @@ -6078,7 +6080,7 @@ fn main() { Some(false)), ]), ("cancel", - Some(r##"Cancels all line items in an order."##), + Some(r##"Cancels all line items in an order. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/orders_cancel", vec![ (Some(r##"merchant-id"##), @@ -6112,7 +6114,7 @@ fn main() { Some(false)), ]), ("cancellineitem", - Some(r##"Cancels a line item."##), + Some(r##"Cancels a line item. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/orders_cancellineitem", vec![ (Some(r##"merchant-id"##), @@ -6146,7 +6148,7 @@ fn main() { Some(false)), ]), ("createtestorder", - Some(r##"Sandbox only. Creates a test order."##), + Some(r##"Sandbox only. Creates a test order. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/orders_createtestorder", vec![ (Some(r##"merchant-id"##), @@ -6174,7 +6176,7 @@ fn main() { Some(false)), ]), ("custombatch", - Some(r##"Retrieves or modifies multiple orders in a single request."##), + Some(r##"Retrieves or modifies multiple orders in a single request. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/orders_custombatch", vec![ (Some(r##"kv"##), @@ -6196,7 +6198,7 @@ fn main() { Some(false)), ]), ("get", - Some(r##"Retrieves an order from your Merchant Center account."##), + Some(r##"Retrieves an order from your Merchant Center account. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/orders_get", vec![ (Some(r##"merchant-id"##), @@ -6224,7 +6226,7 @@ fn main() { Some(false)), ]), ("getbymerchantorderid", - Some(r##"Retrieves an order using merchant order id."##), + Some(r##"Retrieves an order using merchant order id. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/orders_getbymerchantorderid", vec![ (Some(r##"merchant-id"##), @@ -6252,7 +6254,7 @@ fn main() { Some(false)), ]), ("gettestordertemplate", - Some(r##"Sandbox only. Retrieves an order template that can be used to quickly create a new order in sandbox."##), + Some(r##"Sandbox only. Retrieves an order template that can be used to quickly create a new order in sandbox. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/orders_gettestordertemplate", vec![ (Some(r##"merchant-id"##), @@ -6280,7 +6282,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Lists the orders in your Merchant Center account."##), + Some(r##"Lists the orders in your Merchant Center account. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/orders_list", vec![ (Some(r##"merchant-id"##), @@ -6302,7 +6304,7 @@ fn main() { Some(false)), ]), ("refund", - Some(r##"Refund a portion of the order, up to the full amount paid."##), + Some(r##"Refund a portion of the order, up to the full amount paid. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/orders_refund", vec![ (Some(r##"merchant-id"##), @@ -6336,7 +6338,7 @@ fn main() { Some(false)), ]), ("returnlineitem", - Some(r##"Returns a line item."##), + Some(r##"Returns a line item. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/orders_returnlineitem", vec![ (Some(r##"merchant-id"##), @@ -6370,7 +6372,7 @@ fn main() { Some(false)), ]), ("shiplineitems", - Some(r##"Marks line item(s) as shipped."##), + Some(r##"Marks line item(s) as shipped. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/orders_shiplineitems", vec![ (Some(r##"merchant-id"##), @@ -6404,7 +6406,7 @@ fn main() { Some(false)), ]), ("updatemerchantorderid", - Some(r##"Updates the merchant order ID for a given order."##), + Some(r##"Updates the merchant order ID for a given order. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/orders_updatemerchantorderid", vec![ (Some(r##"merchant-id"##), @@ -6438,7 +6440,7 @@ fn main() { Some(false)), ]), ("updateshipment", - Some(r##"Updates a shipment's status, carrier, and/or tracking ID."##), + Some(r##"Updates a shipment's status, carrier, and/or tracking ID. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/orders_updateshipment", vec![ (Some(r##"merchant-id"##), @@ -6475,7 +6477,7 @@ fn main() { ("products", "methods: 'custombatch', 'delete', 'get', 'insert' and 'list'", vec![ ("custombatch", - Some(r##"Retrieves, inserts, and deletes multiple products in a single request."##), + Some(r##"Retrieves, inserts, and deletes multiple products in a single request. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/products_custombatch", vec![ (Some(r##"kv"##), @@ -6497,7 +6499,7 @@ fn main() { Some(false)), ]), ("delete", - Some(r##"Deletes a product from your Merchant Center account."##), + Some(r##"Deletes a product from your Merchant Center account. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/products_delete", vec![ (Some(r##"merchant-id"##), @@ -6519,7 +6521,7 @@ fn main() { Some(true)), ]), ("get", - Some(r##"Retrieves a product from your Merchant Center account."##), + Some(r##"Retrieves a product from your Merchant Center account. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/products_get", vec![ (Some(r##"merchant-id"##), @@ -6547,7 +6549,7 @@ fn main() { Some(false)), ]), ("insert", - Some(r##"Uploads a product to your Merchant Center account."##), + Some(r##"Uploads a product to your Merchant Center account. If an item with the same channel, contentLanguage, offerId, and targetCountry already exists, this method updates that entry. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/products_insert", vec![ (Some(r##"merchant-id"##), @@ -6575,7 +6577,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Lists the products in your Merchant Center account."##), + Some(r##"Lists the products in your Merchant Center account. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/products_list", vec![ (Some(r##"merchant-id"##), @@ -6600,7 +6602,7 @@ fn main() { ("productstatuses", "methods: 'custombatch', 'get' and 'list'", vec![ ("custombatch", - Some(r##"Gets the statuses of multiple products in a single request."##), + Some(r##"Gets the statuses of multiple products in a single request. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/productstatuses_custombatch", vec![ (Some(r##"kv"##), @@ -6622,7 +6624,7 @@ fn main() { Some(false)), ]), ("get", - Some(r##"Gets the status of a product from your Merchant Center account."##), + Some(r##"Gets the status of a product from your Merchant Center account. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/productstatuses_get", vec![ (Some(r##"merchant-id"##), @@ -6650,7 +6652,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Lists the statuses of the products in your Merchant Center account."##), + Some(r##"Lists the statuses of the products in your Merchant Center account. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/productstatuses_list", vec![ (Some(r##"merchant-id"##), @@ -6697,7 +6699,7 @@ fn main() { Some(false)), ]), ("get", - Some(r##"Retrieves the shipping settings of the account."##), + Some(r##"Retrieves the shipping settings of the account. This method can only be called for accounts to which the managing account has access: either the managing account itself or sub-accounts if the managing account is a multi-client account."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/shippingsettings_get", vec![ (Some(r##"merchant-id"##), @@ -6747,7 +6749,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Lists the shipping settings of the sub-accounts in your Merchant Center account."##), + Some(r##"Lists the shipping settings of the sub-accounts in your Merchant Center account. This method can only be called for multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/shippingsettings_list", vec![ (Some(r##"merchant-id"##), @@ -6769,7 +6771,7 @@ fn main() { Some(false)), ]), ("patch", - Some(r##"Updates the shipping settings of the account. This method supports patch semantics."##), + Some(r##"Updates the shipping settings of the account. This method can only be called for accounts to which the managing account has access: either the managing account itself or sub-accounts if the managing account is a multi-client account. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/shippingsettings_patch", vec![ (Some(r##"merchant-id"##), @@ -6803,7 +6805,7 @@ fn main() { Some(false)), ]), ("update", - Some(r##"Updates the shipping settings of the account."##), + Some(r##"Updates the shipping settings of the account. This method can only be called for accounts to which the managing account has access: either the managing account itself or sub-accounts if the managing account is a multi-client account."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/shippingsettings_update", vec![ (Some(r##"merchant-id"##), @@ -6842,7 +6844,7 @@ fn main() { let mut app = App::new("content2") .author("Sebastian Thiel ") - .version("1.0.0+20160905") + .version("1.0.0+20161205") .about("Manages product items, inventory, and Merchant Center accounts for Google Shopping.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_content2_cli") .arg(Arg::with_name("url") diff --git a/gen/content2/Cargo.toml b/gen/content2/Cargo.toml index ea15fece2d..7e613303d3 100644 --- a/gen/content2/Cargo.toml +++ b/gen/content2/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-content2" -version = "1.0.0+20160905" +version = "1.0.0+20161205" authors = ["Sebastian Thiel "] description = "A complete library to interact with Shopping Content (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/content2" diff --git a/gen/content2/README.md b/gen/content2/README.md index c70c7d652f..d7ed73e572 100644 --- a/gen/content2/README.md +++ b/gen/content2/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-content2` library allows access to all features of the *Google Shopping Content* service. -This documentation was generated from *Shopping Content* crate version *1.0.0+20160905*, where *20160905* is the exact revision of the *content:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *Shopping Content* crate version *1.0.0+20161205*, where *20161205* is the exact revision of the *content:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *Shopping Content* *v2* API can be found at the [official documentation site](https://developers.google.com/shopping-content). diff --git a/gen/content2/src/lib.rs b/gen/content2/src/lib.rs index 4ffe076616..7ed400d06b 100644 --- a/gen/content2/src/lib.rs +++ b/gen/content2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Shopping Content* crate version *1.0.0+20160905*, where *20160905* is the exact revision of the *content:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *Shopping Content* crate version *1.0.0+20161205*, where *20161205* is the exact revision of the *content:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *Shopping Content* *v2* API can be found at the //! [official documentation site](https://developers.google.com/shopping-content). diff --git a/gen/content2/src/lib.rs.in b/gen/content2/src/lib.rs.in index 6ef477a1d0..f9370e3c62 100644 --- a/gen/content2/src/lib.rs.in +++ b/gen/content2/src/lib.rs.in @@ -412,7 +412,7 @@ impl ResponseResult for ProductStatus {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TestOrderCustomer { - /// If set, this indicates the user explicitly chose to opt in or out of providing marketing rights to the merchant. If unset, this indicates the user has already made this choice in a previous purchase, and was thus not shown the marketing right opt in/out checkbox during the Purchases on Google checkout flow. Optional. + /// If set, this indicates the user explicitly chose to opt in or out of providing marketing rights to the merchant. If unset, this indicates the user has already made this choice in a previous purchase, and was thus not shown the marketing right opt in/out checkbox during the checkout flow. Optional. #[serde(rename="explicitMarketingPreference")] pub explicit_marketing_preference: Option, /// Full name of the customer. @@ -912,14 +912,16 @@ impl Part for TestOrderPaymentMethod {} /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ProductCustomGroup { - /// The sub-attributes. - pub attributes: Option>, - /// The name of the group. Underscores will be replaced by spaces upon insertion. - pub name: Option, +pub struct InventoryPickup { + /// Whether store pickup is available for this offer and whether the pickup option should be shown as buy, reserve, or not supported. Only supported for local inventory. Unless the value is "not supported", must be submitted together with pickupSla. + #[serde(rename="pickupMethod")] + pub pickup_method: Option, + /// The expected date that an order will be ready for pickup, relative to when the order is placed. Only supported for local inventory. Must be submitted together with pickupMethod. + #[serde(rename="pickupSla")] + pub pickup_sla: Option, } -impl Part for ProductCustomGroup {} +impl Part for InventoryPickup {} /// There is no detailed description. @@ -1135,6 +1137,8 @@ pub struct Inventory { /// The quantity of the product that is reserved for sell-on-google ads. Supported only for online products. #[serde(rename="sellOnGoogleQuantity")] pub sell_on_google_quantity: Option, + /// Store pickup information. Only supported for local inventory. Not setting pickup means "don't update" while setting it to the empty value ({} in JSON) means "delete". Otherwise, pickupMethod and pickupSla must be set together, unless pickupMethod is "not supported". + pub pickup: Option, /// The sale price of the product. Mandatory if sale_price_effective_date is defined. #[serde(rename="salePrice")] pub sale_price: Option, @@ -2325,7 +2329,7 @@ impl ResponseResult for OrdersCancelLineItemResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct OrderCustomer { - /// If set, this indicates the user explicitly chose to opt in or out of providing marketing rights to the merchant. If unset, this indicates the user has already made this choice in a previous purchase, and was thus not shown the marketing right opt in/out checkbox during the Purchases on Google checkout flow. + /// If set, this indicates the user explicitly chose to opt in or out of providing marketing rights to the merchant. If unset, this indicates the user has already made this choice in a previous purchase, and was thus not shown the marketing right opt in/out checkbox during the checkout flow. #[serde(rename="explicitMarketingPreference")] pub explicit_marketing_preference: Option, /// Full name of the customer. @@ -2357,6 +2361,30 @@ pub struct AccountstatusesCustomBatchResponseEntry { impl Part for AccountstatusesCustomBatchResponseEntry {} +/// The status of an account, i.e., information about its products, which is computed offline and not returned immediately at insertion time. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get accountstatuses](struct.AccountstatuseGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AccountStatus { + /// Identifies what kind of resource this is. Value: the fixed string "content#accountStatus". + pub kind: Option, + /// A list of data quality issues. + #[serde(rename="dataQualityIssues")] + pub data_quality_issues: Option>, + /// The ID of the account for which the status is reported. + #[serde(rename="accountId")] + pub account_id: Option, +} + +impl ResponseResult for AccountStatus {} + + /// There is no detailed description. /// /// # Activities @@ -2859,28 +2887,19 @@ pub struct ProductUnitPricingMeasure { impl Part for ProductUnitPricingMeasure {} -/// The status of an account, i.e., information about its products, which is computed offline and not returned immediately at insertion time. +/// There is no detailed description. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [get accountstatuses](struct.AccountstatuseGetCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AccountStatus { - /// Identifies what kind of resource this is. Value: the fixed string "content#accountStatus". - pub kind: Option, - /// A list of data quality issues. - #[serde(rename="dataQualityIssues")] - pub data_quality_issues: Option>, - /// The ID of the account for which the status is reported. - #[serde(rename="accountId")] - pub account_id: Option, +pub struct ProductCustomGroup { + /// The sub-attributes. + pub attributes: Option>, + /// The name of the group. Underscores will be replaced by spaces upon insertion. + pub name: Option, } -impl ResponseResult for AccountStatus {} +impl Part for ProductCustomGroup {} /// There is no detailed description. @@ -3697,6 +3716,8 @@ pub struct InventorySetRequest { /// The quantity of the product that is reserved for sell-on-google ads. Supported only for online products. #[serde(rename="sellOnGoogleQuantity")] pub sell_on_google_quantity: Option, + /// Store pickup information. Only supported for local inventory. Not setting pickup means "don't update" while setting it to the empty value ({} in JSON) means "delete". Otherwise, pickupMethod and pickupSla must be set together, unless pickupMethod is "not supported". + pub pickup: Option, /// The sale price of the product. Mandatory if sale_price_effective_date is defined. #[serde(rename="salePrice")] pub sale_price: Option, @@ -4323,7 +4344,7 @@ impl<'a, C, A> AccounttaxMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates the tax settings of the account. This method supports patch semantics. + /// Updates the tax settings of the account. This method can only be called for accounts to which the managing account has access: either the managing account itself or sub-accounts if the managing account is a multi-client account. This method supports patch semantics. /// /// # Arguments /// @@ -4345,7 +4366,7 @@ impl<'a, C, A> AccounttaxMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists the tax settings of the sub-accounts in your Merchant Center account. + /// Lists the tax settings of the sub-accounts in your Merchant Center account. This method can only be called for multi-client accounts. /// /// # Arguments /// @@ -4364,7 +4385,7 @@ impl<'a, C, A> AccounttaxMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates the tax settings of the account. + /// Updates the tax settings of the account. This method can only be called for accounts to which the managing account has access: either the managing account itself or sub-accounts if the managing account is a multi-client account. /// /// # Arguments /// @@ -4386,7 +4407,7 @@ impl<'a, C, A> AccounttaxMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the tax settings of the account. + /// Retrieves the tax settings of the account. This method can only be called for accounts to which the managing account has access: either the managing account itself or sub-accounts if the managing account is a multi-client account. /// /// # Arguments /// @@ -4446,7 +4467,7 @@ impl<'a, C, A> DatafeedstatuseMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the status of a datafeed from your Merchant Center account. + /// Retrieves the status of a datafeed from your Merchant Center account. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -4465,7 +4486,7 @@ impl<'a, C, A> DatafeedstatuseMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists the statuses of the datafeeds in your Merchant Center account. + /// Lists the statuses of the datafeeds in your Merchant Center account. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -4539,7 +4560,7 @@ impl<'a, C, A> ShippingsettingMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates the shipping settings of the account. This method supports patch semantics. + /// Updates the shipping settings of the account. This method can only be called for accounts to which the managing account has access: either the managing account itself or sub-accounts if the managing account is a multi-client account. This method supports patch semantics. /// /// # Arguments /// @@ -4578,7 +4599,7 @@ impl<'a, C, A> ShippingsettingMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists the shipping settings of the sub-accounts in your Merchant Center account. + /// Lists the shipping settings of the sub-accounts in your Merchant Center account. This method can only be called for multi-client accounts. /// /// # Arguments /// @@ -4615,7 +4636,7 @@ impl<'a, C, A> ShippingsettingMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates the shipping settings of the account. + /// Updates the shipping settings of the account. This method can only be called for accounts to which the managing account has access: either the managing account itself or sub-accounts if the managing account is a multi-client account. /// /// # Arguments /// @@ -4637,7 +4658,7 @@ impl<'a, C, A> ShippingsettingMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the shipping settings of the account. + /// Retrieves the shipping settings of the account. This method can only be called for accounts to which the managing account has access: either the managing account itself or sub-accounts if the managing account is a multi-client account. /// /// # Arguments /// @@ -4712,7 +4733,7 @@ impl<'a, C, A> DatafeedMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a datafeed from your Merchant Center account. + /// Retrieves a datafeed from your Merchant Center account. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -4731,7 +4752,7 @@ impl<'a, C, A> DatafeedMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates a datafeed of your Merchant Center account. This method supports patch semantics. + /// Updates a datafeed of your Merchant Center account. This method can only be called for non-multi-client accounts. This method supports patch semantics. /// /// # Arguments /// @@ -4753,7 +4774,7 @@ impl<'a, C, A> DatafeedMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Deletes a datafeed from your Merchant Center account. + /// Deletes a datafeed from your Merchant Center account. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -4773,7 +4794,7 @@ impl<'a, C, A> DatafeedMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Registers a datafeed with your Merchant Center account. + /// Registers a datafeed with your Merchant Center account. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -4793,7 +4814,7 @@ impl<'a, C, A> DatafeedMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists the datafeeds in your Merchant Center account. + /// Lists the datafeeds in your Merchant Center account. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -4812,7 +4833,7 @@ impl<'a, C, A> DatafeedMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates a datafeed of your Merchant Center account. + /// Updates a datafeed of your Merchant Center account. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -4875,7 +4896,7 @@ impl<'a, C, A> AccountstatuseMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the status of a Merchant Center account. + /// Retrieves the status of a Merchant Center account. This method can only be called for accounts to which the managing account has access: either the managing account itself or sub-accounts if the managing account is a multi-client account. /// /// # Arguments /// @@ -4908,7 +4929,7 @@ impl<'a, C, A> AccountstatuseMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists the statuses of the sub-accounts in your Merchant Center account. + /// Lists the statuses of the sub-accounts in your Merchant Center account. This method can only be called for multi-client accounts. /// /// # Arguments /// @@ -4968,7 +4989,7 @@ impl<'a, C, A> AccountMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates a Merchant Center account. + /// Updates a Merchant Center account. This method can only be called for multi-client accounts. /// /// # Arguments /// @@ -5002,7 +5023,7 @@ impl<'a, C, A> AccountMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates a Merchant Center account. This method supports patch semantics. + /// Updates a Merchant Center account. This method can only be called for multi-client accounts. This method supports patch semantics. /// /// # Arguments /// @@ -5024,7 +5045,7 @@ impl<'a, C, A> AccountMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists the sub-accounts in your Merchant Center account. + /// Lists the sub-accounts in your Merchant Center account. This method can only be called for multi-client accounts. /// /// # Arguments /// @@ -5043,7 +5064,7 @@ impl<'a, C, A> AccountMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Deletes a Merchant Center sub-account. + /// Deletes a Merchant Center sub-account. This method can only be called for multi-client accounts. /// /// # Arguments /// @@ -5081,7 +5102,7 @@ impl<'a, C, A> AccountMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a Merchant Center account. + /// Retrieves a Merchant Center account. This method can only be called for accounts to which the managing account has access: either the managing account itself or sub-accounts if the managing account is a multi-client account. /// /// # Arguments /// @@ -5100,7 +5121,7 @@ impl<'a, C, A> AccountMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Creates a Merchant Center sub-account. + /// Creates a Merchant Center sub-account. This method can only be called for multi-client accounts. /// /// # Arguments /// @@ -5161,7 +5182,7 @@ impl<'a, C, A> InventoryMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates price and availability for multiple products or stores in a single request. This operation does not update the expiration date of the products. + /// Updates price and availability for multiple products or stores in a single request. This operation does not update the expiration date of the products. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -5179,7 +5200,7 @@ impl<'a, C, A> InventoryMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates price and availability of a product in your Merchant Center account. This operation does not update the expiration date of the product. + /// Updates price and availability of a product in your Merchant Center account. This operation does not update the expiration date of the product. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -5244,7 +5265,7 @@ impl<'a, C, A> ProductstatuseMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets the status of a product from your Merchant Center account. + /// Gets the status of a product from your Merchant Center account. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -5263,7 +5284,7 @@ impl<'a, C, A> ProductstatuseMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists the statuses of the products in your Merchant Center account. + /// Lists the statuses of the products in your Merchant Center account. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -5283,7 +5304,7 @@ impl<'a, C, A> ProductstatuseMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets the statuses of multiple products in a single request. + /// Gets the statuses of multiple products in a single request. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -5341,7 +5362,7 @@ impl<'a, C, A> ProductMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists the products in your Merchant Center account. + /// Lists the products in your Merchant Center account. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -5361,7 +5382,7 @@ impl<'a, C, A> ProductMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a product from your Merchant Center account. + /// Retrieves a product from your Merchant Center account. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -5380,7 +5401,7 @@ impl<'a, C, A> ProductMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Deletes a product from your Merchant Center account. + /// Deletes a product from your Merchant Center account. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -5400,7 +5421,7 @@ impl<'a, C, A> ProductMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves, inserts, and deletes multiple products in a single request. + /// Retrieves, inserts, and deletes multiple products in a single request. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -5418,7 +5439,7 @@ impl<'a, C, A> ProductMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Uploads a product to your Merchant Center account. + /// Uploads a product to your Merchant Center account. If an item with the same channel, contentLanguage, offerId, and targetCountry already exists, this method updates that entry. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -5479,7 +5500,7 @@ impl<'a, C, A> AccountshippingMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists the shipping settings of the sub-accounts in your Merchant Center account. + /// Lists the shipping settings of the sub-accounts in your Merchant Center account. This method can only be called for multi-client accounts. /// /// # Arguments /// @@ -5498,7 +5519,7 @@ impl<'a, C, A> AccountshippingMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates the shipping settings of the account. This method supports patch semantics. + /// Updates the shipping settings of the account. This method can only be called for accounts to which the managing account has access: either the managing account itself or sub-accounts if the managing account is a multi-client account. This method supports patch semantics. /// /// # Arguments /// @@ -5520,7 +5541,7 @@ impl<'a, C, A> AccountshippingMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates the shipping settings of the account. + /// Updates the shipping settings of the account. This method can only be called for accounts to which the managing account has access: either the managing account itself or sub-accounts if the managing account is a multi-client account. /// /// # Arguments /// @@ -5560,7 +5581,7 @@ impl<'a, C, A> AccountshippingMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the shipping settings of the account. + /// Retrieves the shipping settings of the account. This method can only be called for accounts to which the managing account has access: either the managing account itself or sub-accounts if the managing account is a multi-client account. /// /// # Arguments /// @@ -5620,7 +5641,7 @@ impl<'a, C, A> OrderMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists the orders in your Merchant Center account. + /// Lists the orders in your Merchant Center account. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -5644,7 +5665,7 @@ impl<'a, C, A> OrderMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Sandbox only. Retrieves an order template that can be used to quickly create a new order in sandbox. + /// Sandbox only. Retrieves an order template that can be used to quickly create a new order in sandbox. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -5663,7 +5684,7 @@ impl<'a, C, A> OrderMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves an order from your Merchant Center account. + /// Retrieves an order from your Merchant Center account. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -5682,7 +5703,7 @@ impl<'a, C, A> OrderMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Refund a portion of the order, up to the full amount paid. + /// Refund a portion of the order, up to the full amount paid. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -5703,7 +5724,7 @@ impl<'a, C, A> OrderMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Marks an order as acknowledged. + /// Marks an order as acknowledged. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -5724,7 +5745,7 @@ impl<'a, C, A> OrderMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates the merchant order ID for a given order. + /// Updates the merchant order ID for a given order. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -5745,7 +5766,7 @@ impl<'a, C, A> OrderMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Sandbox only. Moves a test order from state "inProgress" to state "pendingShipment". + /// Sandbox only. Moves a test order from state "inProgress" to state "pendingShipment". This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -5764,7 +5785,7 @@ impl<'a, C, A> OrderMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Sandbox only. Creates a test order. + /// Sandbox only. Creates a test order. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -5783,7 +5804,7 @@ impl<'a, C, A> OrderMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Returns a line item. + /// Returns a line item. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -5804,7 +5825,7 @@ impl<'a, C, A> OrderMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves an order using merchant order id. + /// Retrieves an order using merchant order id. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -5823,7 +5844,7 @@ impl<'a, C, A> OrderMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves or modifies multiple orders in a single request. + /// Retrieves or modifies multiple orders in a single request. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -5840,7 +5861,7 @@ impl<'a, C, A> OrderMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Marks line item(s) as shipped. + /// Marks line item(s) as shipped. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -5861,7 +5882,7 @@ impl<'a, C, A> OrderMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates a shipment's status, carrier, and/or tracking ID. + /// Updates a shipment's status, carrier, and/or tracking ID. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -5882,7 +5903,7 @@ impl<'a, C, A> OrderMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Cancels a line item. + /// Cancels a line item. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -5903,7 +5924,7 @@ impl<'a, C, A> OrderMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Cancels all line items in an order. + /// Cancels all line items in an order. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -6176,7 +6197,7 @@ impl<'a, C, A> AccounttaxCustombatchCall<'a, C, A> where C: BorrowMut AccounttaxPatchCall<'a, C, A> where C: BorrowMut, } -/// Lists the tax settings of the sub-accounts in your Merchant Center account. +/// Lists the tax settings of the sub-accounts in your Merchant Center account. This method can only be called for multi-client accounts. /// /// A builder for the *list* method supported by a *accounttax* resource. /// It is not used directly, but through a `AccounttaxMethods` instance. @@ -6725,7 +6746,7 @@ impl<'a, C, A> AccounttaxListCall<'a, C, A> where C: BorrowMut, A } -/// Updates the tax settings of the account. +/// Updates the tax settings of the account. This method can only be called for accounts to which the managing account has access: either the managing account itself or sub-accounts if the managing account is a multi-client account. /// /// A builder for the *update* method supported by a *accounttax* resource. /// It is not used directly, but through a `AccounttaxMethods` instance. @@ -7015,7 +7036,7 @@ impl<'a, C, A> AccounttaxUpdateCall<'a, C, A> where C: BorrowMut, } -/// Retrieves the tax settings of the account. +/// Retrieves the tax settings of the account. This method can only be called for accounts to which the managing account has access: either the managing account itself or sub-accounts if the managing account is a multi-client account. /// /// A builder for the *get* method supported by a *accounttax* resource. /// It is not used directly, but through a `AccounttaxMethods` instance. @@ -7262,7 +7283,7 @@ impl<'a, C, A> AccounttaxGetCall<'a, C, A> where C: BorrowMut, A: } -/// Retrieves the status of a datafeed from your Merchant Center account. +/// Retrieves the status of a datafeed from your Merchant Center account. This method can only be called for non-multi-client accounts. /// /// A builder for the *get* method supported by a *datafeedstatuse* resource. /// It is not used directly, but through a `DatafeedstatuseMethods` instance. @@ -7507,7 +7528,7 @@ impl<'a, C, A> DatafeedstatuseGetCall<'a, C, A> where C: BorrowMut DatafeedstatuseCustombatchCall<'a, C, A> where C: BorrowMut ShippingsettingGetsupportedcarrierCall<'a, C, A> where C: BorrowM } -/// Lists the shipping settings of the sub-accounts in your Merchant Center account. +/// Lists the shipping settings of the sub-accounts in your Merchant Center account. This method can only be called for multi-client accounts. /// /// A builder for the *list* method supported by a *shippingsetting* resource. /// It is not used directly, but through a `ShippingsettingMethods` instance. @@ -9026,7 +9047,7 @@ impl<'a, C, A> ShippingsettingCustombatchCall<'a, C, A> where C: BorrowMut ShippingsettingUpdateCall<'a, C, A> where C: BorrowMut DatafeedCustombatchCall<'a, C, A> where C: BorrowMut DatafeedGetCall<'a, C, A> where C: BorrowMut, A: o } -/// Updates a datafeed of your Merchant Center account. This method supports patch semantics. +/// Updates a datafeed of your Merchant Center account. This method can only be called for non-multi-client accounts. This method supports patch semantics. /// /// A builder for the *patch* method supported by a *datafeed* resource. /// It is not used directly, but through a `DatafeedMethods` instance. @@ -10339,7 +10360,7 @@ impl<'a, C, A> DatafeedPatchCall<'a, C, A> where C: BorrowMut, A: } -/// Deletes a datafeed from your Merchant Center account. +/// Deletes a datafeed from your Merchant Center account. This method can only be called for non-multi-client accounts. /// /// A builder for the *delete* method supported by a *datafeed* resource. /// It is not used directly, but through a `DatafeedMethods` instance. @@ -10585,7 +10606,7 @@ impl<'a, C, A> DatafeedDeleteCall<'a, C, A> where C: BorrowMut, A } -/// Registers a datafeed with your Merchant Center account. +/// Registers a datafeed with your Merchant Center account. This method can only be called for non-multi-client accounts. /// /// A builder for the *insert* method supported by a *datafeed* resource. /// It is not used directly, but through a `DatafeedMethods` instance. @@ -10862,7 +10883,7 @@ impl<'a, C, A> DatafeedInsertCall<'a, C, A> where C: BorrowMut, A } -/// Lists the datafeeds in your Merchant Center account. +/// Lists the datafeeds in your Merchant Center account. This method can only be called for non-multi-client accounts. /// /// A builder for the *list* method supported by a *datafeed* resource. /// It is not used directly, but through a `DatafeedMethods` instance. @@ -11121,7 +11142,7 @@ impl<'a, C, A> DatafeedListCall<'a, C, A> where C: BorrowMut, A: } -/// Updates a datafeed of your Merchant Center account. +/// Updates a datafeed of your Merchant Center account. This method can only be called for non-multi-client accounts. /// /// A builder for the *update* method supported by a *datafeed* resource. /// It is not used directly, but through a `DatafeedMethods` instance. @@ -11409,7 +11430,7 @@ impl<'a, C, A> DatafeedUpdateCall<'a, C, A> where C: BorrowMut, A } -/// Retrieves the status of a Merchant Center account. +/// Retrieves the status of a Merchant Center account. This method can only be called for accounts to which the managing account has access: either the managing account itself or sub-accounts if the managing account is a multi-client account. /// /// A builder for the *get* method supported by a *accountstatuse* resource. /// It is not used directly, but through a `AccountstatuseMethods` instance. @@ -11887,7 +11908,7 @@ impl<'a, C, A> AccountstatuseCustombatchCall<'a, C, A> where C: BorrowMut AccountstatuseListCall<'a, C, A> where C: BorrowMut AccountAuthinfoCall<'a, C, A> where C: BorrowMut, } -/// Updates a Merchant Center account. This method supports patch semantics. +/// Updates a Merchant Center account. This method can only be called for multi-client accounts. This method supports patch semantics. /// /// A builder for the *patch* method supported by a *account* resource. /// It is not used directly, but through a `AccountMethods` instance. @@ -12928,7 +12949,7 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: } -/// Lists the sub-accounts in your Merchant Center account. +/// Lists the sub-accounts in your Merchant Center account. This method can only be called for multi-client accounts. /// /// A builder for the *list* method supported by a *account* resource. /// It is not used directly, but through a `AccountMethods` instance. @@ -13187,7 +13208,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o } -/// Deletes a Merchant Center sub-account. +/// Deletes a Merchant Center sub-account. This method can only be called for multi-client accounts. /// /// A builder for the *delete* method supported by a *account* resource. /// It is not used directly, but through a `AccountMethods` instance. @@ -13680,7 +13701,7 @@ impl<'a, C, A> AccountCustombatchCall<'a, C, A> where C: BorrowMut AccountGetCall<'a, C, A> where C: BorrowMut, A: oa } -/// Creates a Merchant Center sub-account. +/// Creates a Merchant Center sub-account. This method can only be called for multi-client accounts. /// /// A builder for the *insert* method supported by a *account* resource. /// It is not used directly, but through a `AccountMethods` instance. @@ -14205,7 +14226,7 @@ impl<'a, C, A> AccountInsertCall<'a, C, A> where C: BorrowMut, A: } -/// Updates price and availability for multiple products or stores in a single request. This operation does not update the expiration date of the products. +/// Updates price and availability for multiple products or stores in a single request. This operation does not update the expiration date of the products. This method can only be called for non-multi-client accounts. /// /// A builder for the *custombatch* method supported by a *inventory* resource. /// It is not used directly, but through a `InventoryMethods` instance. @@ -14450,7 +14471,7 @@ impl<'a, C, A> InventoryCustombatchCall<'a, C, A> where C: BorrowMut InventorySetCall<'a, C, A> where C: BorrowMut, A: } -/// Gets the status of a product from your Merchant Center account. +/// Gets the status of a product from your Merchant Center account. This method can only be called for non-multi-client accounts. /// /// A builder for the *get* method supported by a *productstatuse* resource. /// It is not used directly, but through a `ProductstatuseMethods` instance. @@ -14999,7 +15020,7 @@ impl<'a, C, A> ProductstatuseGetCall<'a, C, A> where C: BorrowMut } -/// Lists the statuses of the products in your Merchant Center account. +/// Lists the statuses of the products in your Merchant Center account. This method can only be called for non-multi-client accounts. /// /// A builder for the *list* method supported by a *productstatuse* resource. /// It is not used directly, but through a `ProductstatuseMethods` instance. @@ -15270,7 +15291,7 @@ impl<'a, C, A> ProductstatuseListCall<'a, C, A> where C: BorrowMut ProductstatuseCustombatchCall<'a, C, A> where C: BorrowMut ProductListCall<'a, C, A> where C: BorrowMut, A: o } -/// Retrieves a product from your Merchant Center account. +/// Retrieves a product from your Merchant Center account. This method can only be called for non-multi-client accounts. /// /// A builder for the *get* method supported by a *product* resource. /// It is not used directly, but through a `ProductMethods` instance. @@ -16021,7 +16042,7 @@ impl<'a, C, A> ProductGetCall<'a, C, A> where C: BorrowMut, A: oa } -/// Deletes a product from your Merchant Center account. +/// Deletes a product from your Merchant Center account. This method can only be called for non-multi-client accounts. /// /// A builder for the *delete* method supported by a *product* resource. /// It is not used directly, but through a `ProductMethods` instance. @@ -16269,7 +16290,7 @@ impl<'a, C, A> ProductDeleteCall<'a, C, A> where C: BorrowMut, A: } -/// Retrieves, inserts, and deletes multiple products in a single request. +/// Retrieves, inserts, and deletes multiple products in a single request. This method can only be called for non-multi-client accounts. /// /// A builder for the *custombatch* method supported by a *product* resource. /// It is not used directly, but through a `ProductMethods` instance. @@ -16514,7 +16535,7 @@ impl<'a, C, A> ProductCustombatchCall<'a, C, A> where C: BorrowMut ProductInsertCall<'a, C, A> where C: BorrowMut, A: } -/// Lists the shipping settings of the sub-accounts in your Merchant Center account. +/// Lists the shipping settings of the sub-accounts in your Merchant Center account. This method can only be called for multi-client accounts. /// /// A builder for the *list* method supported by a *accountshipping* resource. /// It is not used directly, but through a `AccountshippingMethods` instance. @@ -17051,7 +17072,7 @@ impl<'a, C, A> AccountshippingListCall<'a, C, A> where C: BorrowMut AccountshippingPatchCall<'a, C, A> where C: BorrowMut AccountshippingCustombatchCall<'a, C, A> where C: BorrowMut AccountshippingGetCall<'a, C, A> where C: BorrowMut OrderListCall<'a, C, A> where C: BorrowMut, A: oau } -/// Sandbox only. Retrieves an order template that can be used to quickly create a new order in sandbox. +/// Sandbox only. Retrieves an order template that can be used to quickly create a new order in sandbox. This method can only be called for non-multi-client accounts. /// /// A builder for the *gettestordertemplate* method supported by a *order* resource. /// It is not used directly, but through a `OrderMethods` instance. @@ -18694,7 +18715,7 @@ impl<'a, C, A> OrderGettestordertemplateCall<'a, C, A> where C: BorrowMut OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut } -/// Refund a portion of the order, up to the full amount paid. +/// Refund a portion of the order, up to the full amount paid. This method can only be called for non-multi-client accounts. /// /// A builder for the *refund* method supported by a *order* resource. /// It is not used directly, but through a `OrderMethods` instance. @@ -19219,7 +19240,7 @@ impl<'a, C, A> OrderRefundCall<'a, C, A> where C: BorrowMut, A: o } -/// Marks an order as acknowledged. +/// Marks an order as acknowledged. This method can only be called for non-multi-client accounts. /// /// A builder for the *acknowledge* method supported by a *order* resource. /// It is not used directly, but through a `OrderMethods` instance. @@ -19497,7 +19518,7 @@ impl<'a, C, A> OrderAcknowledgeCall<'a, C, A> where C: BorrowMut, } -/// Updates the merchant order ID for a given order. +/// Updates the merchant order ID for a given order. This method can only be called for non-multi-client accounts. /// /// A builder for the *updatemerchantorderid* method supported by a *order* resource. /// It is not used directly, but through a `OrderMethods` instance. @@ -19775,7 +19796,7 @@ impl<'a, C, A> OrderUpdatemerchantorderidCall<'a, C, A> where C: BorrowMut OrderAdvancetestorderCall<'a, C, A> where C: BorrowMut OrderCreatetestorderCall<'a, C, A> where C: BorrowMut OrderReturnlineitemCall<'a, C, A> where C: BorrowMut OrderGetbymerchantorderidCall<'a, C, A> where C: BorrowMut OrderCustombatchCall<'a, C, A> where C: BorrowMut, } -/// Marks line item(s) as shipped. +/// Marks line item(s) as shipped. This method can only be called for non-multi-client accounts. /// /// A builder for the *shiplineitems* method supported by a *order* resource. /// It is not used directly, but through a `OrderMethods` instance. @@ -21324,7 +21345,7 @@ impl<'a, C, A> OrderShiplineitemCall<'a, C, A> where C: BorrowMut } -/// Updates a shipment's status, carrier, and/or tracking ID. +/// Updates a shipment's status, carrier, and/or tracking ID. This method can only be called for non-multi-client accounts. /// /// A builder for the *updateshipment* method supported by a *order* resource. /// It is not used directly, but through a `OrderMethods` instance. @@ -21602,7 +21623,7 @@ impl<'a, C, A> OrderUpdateshipmentCall<'a, C, A> where C: BorrowMut OrderCancellineitemCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with Shopping Content (protocol v2sandbox)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/content2_sandbox-cli" diff --git a/gen/content2_sandbox-cli/README.md b/gen/content2_sandbox-cli/README.md index 9a382ea875..832dc4c554 100644 --- a/gen/content2_sandbox-cli/README.md +++ b/gen/content2_sandbox-cli/README.md @@ -24,7 +24,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Shopping Content* API at revision *20160905*. The CLI is at version *1.0.0*. +This documentation was generated from the *Shopping Content* API at revision *20161205*. The CLI is at version *1.0.0*. ```bash content2-sandbox [options] diff --git a/gen/content2_sandbox-cli/mkdocs.yml b/gen/content2_sandbox-cli/mkdocs.yml index 51db8e9f65..fc6a66138a 100644 --- a/gen/content2_sandbox-cli/mkdocs.yml +++ b/gen/content2_sandbox-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Shopping Content v1.0.0+20160905 +site_name: Shopping Content v1.0.0+20161205 site_url: http://byron.github.io/google-apis-rs/google-content2_sandbox-cli site_description: Write integrating applications with bcore diff --git a/gen/content2_sandbox-cli/src/main.rs b/gen/content2_sandbox-cli/src/main.rs index 38f1536531..19166787c7 100644 --- a/gen/content2_sandbox-cli/src/main.rs +++ b/gen/content2_sandbox-cli/src/main.rs @@ -1357,7 +1357,7 @@ fn main() { let arg_data = [ ("orders", "methods: 'acknowledge', 'advancetestorder', 'cancel', 'cancellineitem', 'createtestorder', 'custombatch', 'get', 'getbymerchantorderid', 'gettestordertemplate', 'list', 'refund', 'returnlineitem', 'shiplineitems', 'updatemerchantorderid' and 'updateshipment'", vec![ ("acknowledge", - Some(r##"Marks an order as acknowledged."##), + Some(r##"Marks an order as acknowledged. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_sandbox_cli/orders_acknowledge", vec![ (Some(r##"merchant-id"##), @@ -1391,7 +1391,7 @@ fn main() { Some(false)), ]), ("advancetestorder", - Some(r##"Sandbox only. Moves a test order from state "inProgress" to state "pendingShipment"."##), + Some(r##"Sandbox only. Moves a test order from state "inProgress" to state "pendingShipment". This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_sandbox_cli/orders_advancetestorder", vec![ (Some(r##"merchant-id"##), @@ -1419,7 +1419,7 @@ fn main() { Some(false)), ]), ("cancel", - Some(r##"Cancels all line items in an order."##), + Some(r##"Cancels all line items in an order. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_sandbox_cli/orders_cancel", vec![ (Some(r##"merchant-id"##), @@ -1453,7 +1453,7 @@ fn main() { Some(false)), ]), ("cancellineitem", - Some(r##"Cancels a line item."##), + Some(r##"Cancels a line item. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_sandbox_cli/orders_cancellineitem", vec![ (Some(r##"merchant-id"##), @@ -1487,7 +1487,7 @@ fn main() { Some(false)), ]), ("createtestorder", - Some(r##"Sandbox only. Creates a test order."##), + Some(r##"Sandbox only. Creates a test order. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_sandbox_cli/orders_createtestorder", vec![ (Some(r##"merchant-id"##), @@ -1515,7 +1515,7 @@ fn main() { Some(false)), ]), ("custombatch", - Some(r##"Retrieves or modifies multiple orders in a single request."##), + Some(r##"Retrieves or modifies multiple orders in a single request. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_sandbox_cli/orders_custombatch", vec![ (Some(r##"kv"##), @@ -1537,7 +1537,7 @@ fn main() { Some(false)), ]), ("get", - Some(r##"Retrieves an order from your Merchant Center account."##), + Some(r##"Retrieves an order from your Merchant Center account. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_sandbox_cli/orders_get", vec![ (Some(r##"merchant-id"##), @@ -1565,7 +1565,7 @@ fn main() { Some(false)), ]), ("getbymerchantorderid", - Some(r##"Retrieves an order using merchant order id."##), + Some(r##"Retrieves an order using merchant order id. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_sandbox_cli/orders_getbymerchantorderid", vec![ (Some(r##"merchant-id"##), @@ -1593,7 +1593,7 @@ fn main() { Some(false)), ]), ("gettestordertemplate", - Some(r##"Sandbox only. Retrieves an order template that can be used to quickly create a new order in sandbox."##), + Some(r##"Sandbox only. Retrieves an order template that can be used to quickly create a new order in sandbox. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_sandbox_cli/orders_gettestordertemplate", vec![ (Some(r##"merchant-id"##), @@ -1621,7 +1621,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Lists the orders in your Merchant Center account."##), + Some(r##"Lists the orders in your Merchant Center account. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_sandbox_cli/orders_list", vec![ (Some(r##"merchant-id"##), @@ -1643,7 +1643,7 @@ fn main() { Some(false)), ]), ("refund", - Some(r##"Refund a portion of the order, up to the full amount paid."##), + Some(r##"Refund a portion of the order, up to the full amount paid. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_sandbox_cli/orders_refund", vec![ (Some(r##"merchant-id"##), @@ -1677,7 +1677,7 @@ fn main() { Some(false)), ]), ("returnlineitem", - Some(r##"Returns a line item."##), + Some(r##"Returns a line item. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_sandbox_cli/orders_returnlineitem", vec![ (Some(r##"merchant-id"##), @@ -1711,7 +1711,7 @@ fn main() { Some(false)), ]), ("shiplineitems", - Some(r##"Marks line item(s) as shipped."##), + Some(r##"Marks line item(s) as shipped. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_sandbox_cli/orders_shiplineitems", vec![ (Some(r##"merchant-id"##), @@ -1745,7 +1745,7 @@ fn main() { Some(false)), ]), ("updatemerchantorderid", - Some(r##"Updates the merchant order ID for a given order."##), + Some(r##"Updates the merchant order ID for a given order. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_sandbox_cli/orders_updatemerchantorderid", vec![ (Some(r##"merchant-id"##), @@ -1779,7 +1779,7 @@ fn main() { Some(false)), ]), ("updateshipment", - Some(r##"Updates a shipment's status, carrier, and/or tracking ID."##), + Some(r##"Updates a shipment's status, carrier, and/or tracking ID. This method can only be called for non-multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_sandbox_cli/orders_updateshipment", vec![ (Some(r##"merchant-id"##), @@ -1818,7 +1818,7 @@ fn main() { let mut app = App::new("content2-sandbox") .author("Sebastian Thiel ") - .version("1.0.0+20160905") + .version("1.0.0+20161205") .about("Manages product items, inventory, and Merchant Center accounts for Google Shopping.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_content2_sandbox_cli") .arg(Arg::with_name("url") diff --git a/gen/content2_sandbox/Cargo.toml b/gen/content2_sandbox/Cargo.toml index da03297c87..9f6e69d20b 100644 --- a/gen/content2_sandbox/Cargo.toml +++ b/gen/content2_sandbox/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-content2_sandbox" -version = "1.0.0+20160905" +version = "1.0.0+20161205" authors = ["Sebastian Thiel "] description = "A complete library to interact with Shopping Content (protocol v2sandbox)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/content2_sandbox" diff --git a/gen/content2_sandbox/README.md b/gen/content2_sandbox/README.md index 418abb5a6b..b4e470219d 100644 --- a/gen/content2_sandbox/README.md +++ b/gen/content2_sandbox/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-content2_sandbox` library allows access to all features of the *Google Shopping Content* service. -This documentation was generated from *Shopping Content* crate version *1.0.0+20160905*, where *20160905* is the exact revision of the *content:v2sandbox* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *Shopping Content* crate version *1.0.0+20161205*, where *20161205* is the exact revision of the *content:v2sandbox* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *Shopping Content* *v2_sandbox* API can be found at the [official documentation site](https://developers.google.com/shopping-content). diff --git a/gen/content2_sandbox/src/lib.rs b/gen/content2_sandbox/src/lib.rs index 08759495dd..5e163d4222 100644 --- a/gen/content2_sandbox/src/lib.rs +++ b/gen/content2_sandbox/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Shopping Content* crate version *1.0.0+20160905*, where *20160905* is the exact revision of the *content:v2sandbox* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *Shopping Content* crate version *1.0.0+20161205*, where *20161205* is the exact revision of the *content:v2sandbox* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *Shopping Content* *v2_sandbox* API can be found at the //! [official documentation site](https://developers.google.com/shopping-content). diff --git a/gen/content2_sandbox/src/lib.rs.in b/gen/content2_sandbox/src/lib.rs.in index 880a9f99af..ff5a751032 100644 --- a/gen/content2_sandbox/src/lib.rs.in +++ b/gen/content2_sandbox/src/lib.rs.in @@ -981,7 +981,7 @@ impl ResponseResult for OrdersCustomBatchResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct OrderCustomer { - /// If set, this indicates the user explicitly chose to opt in or out of providing marketing rights to the merchant. If unset, this indicates the user has already made this choice in a previous purchase, and was thus not shown the marketing right opt in/out checkbox during the Purchases on Google checkout flow. + /// If set, this indicates the user explicitly chose to opt in or out of providing marketing rights to the merchant. If unset, this indicates the user has already made this choice in a previous purchase, and was thus not shown the marketing right opt in/out checkbox during the checkout flow. #[serde(rename="explicitMarketingPreference")] pub explicit_marketing_preference: Option, /// Full name of the customer. @@ -1130,7 +1130,7 @@ impl RequestValue for OrdersRefundRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TestOrderCustomer { - /// If set, this indicates the user explicitly chose to opt in or out of providing marketing rights to the merchant. If unset, this indicates the user has already made this choice in a previous purchase, and was thus not shown the marketing right opt in/out checkbox during the Purchases on Google checkout flow. Optional. + /// If set, this indicates the user explicitly chose to opt in or out of providing marketing rights to the merchant. If unset, this indicates the user has already made this choice in a previous purchase, and was thus not shown the marketing right opt in/out checkbox during the checkout flow. Optional. #[serde(rename="explicitMarketingPreference")] pub explicit_marketing_preference: Option, /// Full name of the customer. @@ -1655,7 +1655,7 @@ impl<'a, C, A> OrderMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves an order from your Merchant Center account. + /// Retrieves an order from your Merchant Center account. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -1674,7 +1674,7 @@ impl<'a, C, A> OrderMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists the orders in your Merchant Center account. + /// Lists the orders in your Merchant Center account. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -1698,7 +1698,7 @@ impl<'a, C, A> OrderMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates a shipment's status, carrier, and/or tracking ID. + /// Updates a shipment's status, carrier, and/or tracking ID. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -1719,7 +1719,7 @@ impl<'a, C, A> OrderMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Sandbox only. Moves a test order from state "inProgress" to state "pendingShipment". + /// Sandbox only. Moves a test order from state "inProgress" to state "pendingShipment". This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -1738,7 +1738,7 @@ impl<'a, C, A> OrderMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates the merchant order ID for a given order. + /// Updates the merchant order ID for a given order. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -1759,7 +1759,7 @@ impl<'a, C, A> OrderMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Returns a line item. + /// Returns a line item. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -1780,7 +1780,7 @@ impl<'a, C, A> OrderMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Sandbox only. Retrieves an order template that can be used to quickly create a new order in sandbox. + /// Sandbox only. Retrieves an order template that can be used to quickly create a new order in sandbox. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -1799,7 +1799,7 @@ impl<'a, C, A> OrderMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Sandbox only. Creates a test order. + /// Sandbox only. Creates a test order. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -1818,7 +1818,7 @@ impl<'a, C, A> OrderMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Refund a portion of the order, up to the full amount paid. + /// Refund a portion of the order, up to the full amount paid. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -1839,7 +1839,7 @@ impl<'a, C, A> OrderMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves or modifies multiple orders in a single request. + /// Retrieves or modifies multiple orders in a single request. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -1856,7 +1856,7 @@ impl<'a, C, A> OrderMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Cancels a line item. + /// Cancels a line item. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -1877,7 +1877,7 @@ impl<'a, C, A> OrderMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves an order using merchant order id. + /// Retrieves an order using merchant order id. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -1896,7 +1896,7 @@ impl<'a, C, A> OrderMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Marks an order as acknowledged. + /// Marks an order as acknowledged. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -1917,7 +1917,7 @@ impl<'a, C, A> OrderMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Cancels all line items in an order. + /// Cancels all line items in an order. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -1938,7 +1938,7 @@ impl<'a, C, A> OrderMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Marks line item(s) as shipped. + /// Marks line item(s) as shipped. This method can only be called for non-multi-client accounts. /// /// # Arguments /// @@ -1966,7 +1966,7 @@ impl<'a, C, A> OrderMethods<'a, C, A> { // CallBuilders ### // ################# -/// Retrieves an order from your Merchant Center account. +/// Retrieves an order from your Merchant Center account. This method can only be called for non-multi-client accounts. /// /// A builder for the *get* method supported by a *order* resource. /// It is not used directly, but through a `OrderMethods` instance. @@ -2213,7 +2213,7 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut } -/// Lists the orders in your Merchant Center account. +/// Lists the orders in your Merchant Center account. This method can only be called for non-multi-client accounts. /// /// A builder for the *list* method supported by a *order* resource. /// It is not used directly, but through a `OrderMethods` instance. @@ -2537,7 +2537,7 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau } -/// Updates a shipment's status, carrier, and/or tracking ID. +/// Updates a shipment's status, carrier, and/or tracking ID. This method can only be called for non-multi-client accounts. /// /// A builder for the *updateshipment* method supported by a *order* resource. /// It is not used directly, but through a `OrderMethods` instance. @@ -2815,7 +2815,7 @@ impl<'a, C, A> OrderUpdateshipmentCall<'a, C, A> where C: BorrowMut OrderAdvancetestorderCall<'a, C, A> where C: BorrowMut OrderUpdatemerchantorderidCall<'a, C, A> where C: BorrowMut OrderReturnlineitemCall<'a, C, A> where C: BorrowMut OrderGettestordertemplateCall<'a, C, A> where C: BorrowMut OrderCreatetestorderCall<'a, C, A> where C: BorrowMut OrderRefundCall<'a, C, A> where C: BorrowMut, A: o } -/// Retrieves or modifies multiple orders in a single request. +/// Retrieves or modifies multiple orders in a single request. This method can only be called for non-multi-client accounts. /// /// A builder for the *custombatch* method supported by a *order* resource. /// It is not used directly, but through a `OrderMethods` instance. @@ -4642,7 +4642,7 @@ impl<'a, C, A> OrderCustombatchCall<'a, C, A> where C: BorrowMut, } -/// Cancels a line item. +/// Cancels a line item. This method can only be called for non-multi-client accounts. /// /// A builder for the *cancellineitem* method supported by a *order* resource. /// It is not used directly, but through a `OrderMethods` instance. @@ -4920,7 +4920,7 @@ impl<'a, C, A> OrderCancellineitemCall<'a, C, A> where C: BorrowMut OrderGetbymerchantorderidCall<'a, C, A> where C: BorrowMut OrderAcknowledgeCall<'a, C, A> where C: BorrowMut, } -/// Cancels all line items in an order. +/// Cancels all line items in an order. This method can only be called for non-multi-client accounts. /// /// A builder for the *cancel* method supported by a *order* resource. /// It is not used directly, but through a `OrderMethods` instance. @@ -5723,7 +5723,7 @@ impl<'a, C, A> OrderCancelCall<'a, C, A> where C: BorrowMut, A: o } -/// Marks line item(s) as shipped. +/// Marks line item(s) as shipped. This method can only be called for non-multi-client accounts. /// /// A builder for the *shiplineitems* method supported by a *order* resource. /// It is not used directly, but through a `OrderMethods` instance. diff --git a/gen/dataproc1-cli/Cargo.toml b/gen/dataproc1-cli/Cargo.toml index c6d2ff1b6a..107aaa8d58 100644 --- a/gen/dataproc1-cli/Cargo.toml +++ b/gen/dataproc1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-dataproc1-cli" -version = "1.0.0+20160503" +version = "1.0.0+20161102" authors = ["Sebastian Thiel "] description = "A complete library to interact with dataproc (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/dataproc1-cli" diff --git a/gen/dataproc1-cli/README.md b/gen/dataproc1-cli/README.md index 7ae890a523..029faf2e7e 100644 --- a/gen/dataproc1-cli/README.md +++ b/gen/dataproc1-cli/README.md @@ -24,7 +24,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *dataproc* API at revision *20160503*. The CLI is at version *1.0.0*. +This documentation was generated from the *dataproc* API at revision *20161102*. The CLI is at version *1.0.0*. ```bash dataproc1 [options] diff --git a/gen/dataproc1-cli/mkdocs.yml b/gen/dataproc1-cli/mkdocs.yml index be4bfbf927..36904a926b 100644 --- a/gen/dataproc1-cli/mkdocs.yml +++ b/gen/dataproc1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: dataproc v1.0.0+20160503 +site_name: dataproc v1.0.0+20161102 site_url: http://byron.github.io/google-apis-rs/google-dataproc1-cli site_description: Write integrating applications with bcore diff --git a/gen/dataproc1-cli/src/main.rs b/gen/dataproc1-cli/src/main.rs index 53ff89854b..306e851049 100644 --- a/gen/dataproc1-cli/src/main.rs +++ b/gen/dataproc1-cli/src/main.rs @@ -71,10 +71,16 @@ impl<'n> Engine<'n> { "status.state" => Some(("status.state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "status.state-start-time" => Some(("status.stateStartTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "status.detail" => Some(("status.detail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cluster-uuid" => Some(("clusterUuid", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster-name" => Some(("clusterName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "metrics.yarn-metrics" => Some(("metrics.yarnMetrics", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "metrics.hdfs-metrics" => Some(("metrics.hdfsMetrics", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "config.software-config.image-version" => Some(("config.softwareConfig.imageVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.software-config.properties" => Some(("config.softwareConfig.properties", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "config.config-bucket" => Some(("config.configBucket", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "config.gce-cluster-config.internal-ip-only" => Some(("config.gceClusterConfig.internalIpOnly", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "config.gce-cluster-config.network-uri" => Some(("config.gceClusterConfig.networkUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.gce-cluster-config.tags" => Some(("config.gceClusterConfig.tags", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "config.gce-cluster-config.zone-uri" => Some(("config.gceClusterConfig.zoneUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -108,10 +114,8 @@ impl<'n> Engine<'n> { "config.master-config.managed-group-config.instance-group-manager-name" => Some(("config.masterConfig.managedGroupConfig.instanceGroupManagerName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.master-config.num-instances" => Some(("config.masterConfig.numInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "config.master-config.image-uri" => Some(("config.masterConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "cluster-uuid" => Some(("clusterUuid", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["boot-disk-size-gb", "cluster-name", "cluster-uuid", "config", "config-bucket", "detail", "disk-config", "gce-cluster-config", "image-uri", "image-version", "instance-group-manager-name", "instance-names", "instance-template-name", "is-preemptible", "machine-type-uri", "managed-group-config", "master-config", "metadata", "network-uri", "num-instances", "num-local-ssds", "project-id", "properties", "secondary-worker-config", "service-account-scopes", "software-config", "state", "state-start-time", "status", "subnetwork-uri", "tags", "worker-config", "zone-uri"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["boot-disk-size-gb", "cluster-name", "cluster-uuid", "config", "config-bucket", "detail", "disk-config", "gce-cluster-config", "hdfs-metrics", "image-uri", "image-version", "instance-group-manager-name", "instance-names", "instance-template-name", "internal-ip-only", "is-preemptible", "labels", "machine-type-uri", "managed-group-config", "master-config", "metadata", "metrics", "network-uri", "num-instances", "num-local-ssds", "project-id", "properties", "secondary-worker-config", "service-account-scopes", "software-config", "state", "state-start-time", "status", "subnetwork-uri", "tags", "worker-config", "yarn-metrics", "zone-uri"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -371,6 +375,9 @@ impl<'n> Engine<'n> { "page-size" => { call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); }, + "filter" => { + call = call.filter(value.unwrap_or("")); + }, _ => { let mut found = false; for param in &self.gp { @@ -384,7 +391,7 @@ impl<'n> Engine<'n> { err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); - v.extend(["page-token", "page-size"].iter().map(|v|*v)); + v.extend(["filter", "page-token", "page-size"].iter().map(|v|*v)); v } )); } } @@ -444,10 +451,16 @@ impl<'n> Engine<'n> { "status.state" => Some(("status.state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "status.state-start-time" => Some(("status.stateStartTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "status.detail" => Some(("status.detail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cluster-uuid" => Some(("clusterUuid", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster-name" => Some(("clusterName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "metrics.yarn-metrics" => Some(("metrics.yarnMetrics", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "metrics.hdfs-metrics" => Some(("metrics.hdfsMetrics", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "config.software-config.image-version" => Some(("config.softwareConfig.imageVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.software-config.properties" => Some(("config.softwareConfig.properties", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "config.config-bucket" => Some(("config.configBucket", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "config.gce-cluster-config.internal-ip-only" => Some(("config.gceClusterConfig.internalIpOnly", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "config.gce-cluster-config.network-uri" => Some(("config.gceClusterConfig.networkUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.gce-cluster-config.tags" => Some(("config.gceClusterConfig.tags", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "config.gce-cluster-config.zone-uri" => Some(("config.gceClusterConfig.zoneUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -481,10 +494,8 @@ impl<'n> Engine<'n> { "config.master-config.managed-group-config.instance-group-manager-name" => Some(("config.masterConfig.managedGroupConfig.instanceGroupManagerName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.master-config.num-instances" => Some(("config.masterConfig.numInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "config.master-config.image-uri" => Some(("config.masterConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "cluster-uuid" => Some(("clusterUuid", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["boot-disk-size-gb", "cluster-name", "cluster-uuid", "config", "config-bucket", "detail", "disk-config", "gce-cluster-config", "image-uri", "image-version", "instance-group-manager-name", "instance-names", "instance-template-name", "is-preemptible", "machine-type-uri", "managed-group-config", "master-config", "metadata", "network-uri", "num-instances", "num-local-ssds", "project-id", "properties", "secondary-worker-config", "service-account-scopes", "software-config", "state", "state-start-time", "status", "subnetwork-uri", "tags", "worker-config", "zone-uri"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["boot-disk-size-gb", "cluster-name", "cluster-uuid", "config", "config-bucket", "detail", "disk-config", "gce-cluster-config", "hdfs-metrics", "image-uri", "image-version", "instance-group-manager-name", "instance-names", "instance-template-name", "internal-ip-only", "is-preemptible", "labels", "machine-type-uri", "managed-group-config", "master-config", "metadata", "metrics", "network-uri", "num-instances", "num-local-ssds", "project-id", "properties", "secondary-worker-config", "service-account-scopes", "software-config", "state", "state-start-time", "status", "subnetwork-uri", "tags", "worker-config", "yarn-metrics", "zone-uri"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -751,6 +762,9 @@ impl<'n> Engine<'n> { "job-state-matcher" => { call = call.job_state_matcher(value.unwrap_or("")); }, + "filter" => { + call = call.filter(value.unwrap_or("")); + }, "cluster-name" => { call = call.cluster_name(value.unwrap_or("")); }, @@ -767,7 +781,7 @@ impl<'n> Engine<'n> { err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); - v.extend(["cluster-name", "page-token", "job-state-matcher", "page-size"].iter().map(|v|*v)); + v.extend(["filter", "page-token", "cluster-name", "job-state-matcher", "page-size"].iter().map(|v|*v)); v } )); } } @@ -835,6 +849,13 @@ impl<'n> Engine<'n> { "job.hadoop-job.archive-uris" => Some(("job.hadoopJob.archiveUris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "job.hadoop-job.main-jar-file-uri" => Some(("job.hadoopJob.mainJarFileUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.hadoop-job.properties" => Some(("job.hadoopJob.properties", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "job.pig-job.query-file-uri" => Some(("job.pigJob.queryFileUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "job.pig-job.script-variables" => Some(("job.pigJob.scriptVariables", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "job.pig-job.logging-config.driver-log-levels" => Some(("job.pigJob.loggingConfig.driverLogLevels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "job.pig-job.jar-file-uris" => Some(("job.pigJob.jarFileUris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "job.pig-job.query-list.queries" => Some(("job.pigJob.queryList.queries", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "job.pig-job.continue-on-failure" => Some(("job.pigJob.continueOnFailure", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "job.pig-job.properties" => Some(("job.pigJob.properties", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "job.placement.cluster-name" => Some(("job.placement.clusterName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.placement.cluster-uuid" => Some(("job.placement.clusterUuid", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.reference.project-id" => Some(("job.reference.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -845,13 +866,7 @@ impl<'n> Engine<'n> { "job.spark-sql-job.jar-file-uris" => Some(("job.sparkSqlJob.jarFileUris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "job.spark-sql-job.query-list.queries" => Some(("job.sparkSqlJob.queryList.queries", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "job.spark-sql-job.properties" => Some(("job.sparkSqlJob.properties", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), - "job.pig-job.query-file-uri" => Some(("job.pigJob.queryFileUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "job.pig-job.script-variables" => Some(("job.pigJob.scriptVariables", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), - "job.pig-job.logging-config.driver-log-levels" => Some(("job.pigJob.loggingConfig.driverLogLevels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), - "job.pig-job.jar-file-uris" => Some(("job.pigJob.jarFileUris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "job.pig-job.query-list.queries" => Some(("job.pigJob.queryList.queries", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "job.pig-job.continue-on-failure" => Some(("job.pigJob.continueOnFailure", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "job.pig-job.properties" => Some(("job.pigJob.properties", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "job.labels" => Some(("job.labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "job.driver-output-resource-uri" => Some(("job.driverOutputResourceUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.driver-control-files-uri" => Some(("job.driverControlFilesUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.spark-job.args" => Some(("job.sparkJob.args", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -877,7 +892,7 @@ impl<'n> Engine<'n> { "job.hive-job.continue-on-failure" => Some(("job.hiveJob.continueOnFailure", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "job.hive-job.properties" => Some(("job.hiveJob.properties", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["archive-uris", "args", "cluster-name", "cluster-uuid", "continue-on-failure", "details", "driver-control-files-uri", "driver-log-levels", "driver-output-resource-uri", "file-uris", "hadoop-job", "hive-job", "jar-file-uris", "job", "job-id", "logging-config", "main-class", "main-jar-file-uri", "main-python-file-uri", "pig-job", "placement", "project-id", "properties", "pyspark-job", "python-file-uris", "queries", "query-file-uri", "query-list", "reference", "script-variables", "spark-job", "spark-sql-job", "state", "state-start-time", "status"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["archive-uris", "args", "cluster-name", "cluster-uuid", "continue-on-failure", "details", "driver-control-files-uri", "driver-log-levels", "driver-output-resource-uri", "file-uris", "hadoop-job", "hive-job", "jar-file-uris", "job", "job-id", "labels", "logging-config", "main-class", "main-jar-file-uri", "main-python-file-uri", "pig-job", "placement", "project-id", "properties", "pyspark-job", "python-file-uris", "queries", "query-file-uri", "query-list", "reference", "script-variables", "spark-job", "spark-sql-job", "state", "state-start-time", "status"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1681,7 +1696,7 @@ fn main() { Some(false)), ]), ("regions-operations-cancel", - Some(r##"Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation."##), + Some(r##"Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to `Code.CANCELLED`."##), "Details at http://byron.github.io/google-apis-rs/google_dataproc1_cli/projects_regions-operations-cancel", vec![ (Some(r##"name"##), @@ -1774,8 +1789,8 @@ fn main() { let mut app = App::new("dataproc1") .author("Sebastian Thiel ") - .version("1.0.0+20160503") - .about("Manages Hadoop-based clusters and jobs on Google Cloud Platform.") + .version("1.0.0+20161102") + .about("An API for managing Hadoop-based clusters and jobs on Google Cloud Platform.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_dataproc1_cli") .arg(Arg::with_name("url") .long("scope") diff --git a/gen/dataproc1/Cargo.toml b/gen/dataproc1/Cargo.toml index 33d83a80b8..a69b4667a1 100644 --- a/gen/dataproc1/Cargo.toml +++ b/gen/dataproc1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-dataproc1" -version = "1.0.0+20160503" +version = "1.0.0+20161102" authors = ["Sebastian Thiel "] description = "A complete library to interact with dataproc (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/dataproc1" diff --git a/gen/dataproc1/README.md b/gen/dataproc1/README.md index c067ef8c57..088f97b9fd 100644 --- a/gen/dataproc1/README.md +++ b/gen/dataproc1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-dataproc1` library allows access to all features of the *Google dataproc* service. -This documentation was generated from *dataproc* crate version *1.0.0+20160503*, where *20160503* is the exact revision of the *dataproc:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *dataproc* crate version *1.0.0+20161102*, where *20161102* is the exact revision of the *dataproc:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *dataproc* *v1* API can be found at the [official documentation site](https://cloud.google.com/dataproc/). diff --git a/gen/dataproc1/src/lib.rs b/gen/dataproc1/src/lib.rs index fbf83c04da..e61b45e532 100644 --- a/gen/dataproc1/src/lib.rs +++ b/gen/dataproc1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *dataproc* crate version *1.0.0+20160503*, where *20160503* is the exact revision of the *dataproc:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *dataproc* crate version *1.0.0+20161102*, where *20161102* is the exact revision of the *dataproc:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *dataproc* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/dataproc/). diff --git a/gen/dataproc1/src/lib.rs.in b/gen/dataproc1/src/lib.rs.in index 0437ab67a5..4bac810e32 100644 --- a/gen/dataproc1/src/lib.rs.in +++ b/gen/dataproc1/src/lib.rs.in @@ -161,7 +161,7 @@ impl<'a, C, A> Dataproc // ############ // SCHEMAS ### // ########## -/// A Cloud Dataproc job for running Spark SQL queries. +/// A Cloud Dataproc job for running [Apache Spark SQL](http://spark.apache.org/sql/) queries. /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -189,28 +189,28 @@ pub struct SparkSqlJob { impl Part for SparkSqlJob {} -/// The config settings for Google Compute Engine resources in an instance group, such as a master or worker group. +/// [Optional] The config settings for Google Compute Engine resources in an instance group, such as a master or worker group. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct InstanceGroupConfig { - /// The number of VM instances in the instance group. For master instance groups, must be set to 1. + /// [Required] The number of VM instances in the instance group. For master instance groups, must be set to 1. #[serde(rename="numInstances")] pub num_instances: Option, - /// Specifies that this instance group contains Preemptible Instances. + /// [Optional] Specifies that this instance group contains preemptible instances. #[serde(rename="isPreemptible")] pub is_preemptible: Option, /// [Output-only] The config for Google Compute Engine Instance Group Manager that manages this group. This is only used for preemptible instance groups. #[serde(rename="managedGroupConfig")] pub managed_group_config: Option, - /// The Google Compute Engine machine type used for cluster instances. Example: `https://www.googleapis.com/compute/v1/projects/[project_id]/zones/us-east1-a/machineTypes/n1-standard-2`. + /// [Required] The Google Compute Engine machine type used for cluster instances. Example: `https://www.googleapis.com/compute/v1/projects/[project_id]/zones/us-east1-a/machineTypes/n1-standard-2`. #[serde(rename="machineTypeUri")] pub machine_type_uri: Option, - /// Disk option config settings. + /// [Optional] Disk option config settings. #[serde(rename="diskConfig")] pub disk_config: Option, - /// The list of instance names. Cloud Dataproc derives the names from `cluster_name`, `num_instances`, and the instance group if not set by user (recommended practice is to let Cloud Dataproc derive the name). + /// [Optional] The list of instance names. Cloud Dataproc derives the names from `cluster_name`, `num_instances`, and the instance group if not set by user (recommended practice is to let Cloud Dataproc derive the name). #[serde(rename="instanceNames")] pub instance_names: Option>, /// [Output-only] The Google Compute Engine image resource used for cluster instances. Inferred from `SoftwareConfig.image_version`. @@ -221,6 +221,26 @@ pub struct InstanceGroupConfig { impl Part for InstanceGroupConfig {} +/// A YARN application created by a job. Application information is a subset of org.apache.hadoop.yarn.proto.YarnProtos.ApplicationReportProto. **Beta Feature**: This report is available for testing purposes only. It may be changed before final release. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct YarnApplication { + /// [Required] The numerical progress of the application, from 1 to 100. + pub progress: Option, + /// [Required] The application state. + pub state: Option, + /// [Required] The application name. + pub name: Option, + /// [Optional] The HTTP URL of the ApplicationMaster, HistoryServer, or TimelineServer that provides application-specific information. The URL uses the internal hostname, and requires a proxy server for resolution and, possibly, access. + #[serde(rename="trackingUrl")] + pub tracking_url: Option, +} + +impl Part for YarnApplication {} + + /// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON representation for `Empty` is empty JSON object `{}`. /// /// # Activities @@ -264,7 +284,7 @@ pub struct JobReference { /// [Required] The ID of the Google Cloud Platform project that the job belongs to. #[serde(rename="projectId")] pub project_id: Option, - /// [Required] The job ID, which must be unique within the project. The job ID is generated by the server upon job submission or provided by the user as a means to perform retries without creating duplicate jobs. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), or hyphens (-). The maximum length is 512 characters. + /// [Optional] The job ID, which must be unique within the project. The job ID is generated by the server upon job submission or provided by the user as a means to perform retries without creating duplicate jobs. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), or hyphens (-). The maximum length is 512 characters. #[serde(rename="jobId")] pub job_id: Option, } @@ -278,18 +298,21 @@ impl Part for JobReference {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GceClusterConfig { - /// The Google Compute Engine network to be used for machine communications. Cannot be specified with subnetwork_uri. If neither network_uri nor subnetwork_uri is specified, the "default" network of the project is used, if it exists. Cannot be a "Custom Subnet Network" (see https://cloud.google.com/compute/docs/subnetworks for more information). Example: `https://www.googleapis.com/compute/v1/projects/[project_id]/regions/global/default`. + /// [Optional] If true, all instances in the cluster will only have internal IP addresses. By default, clusters are not restricted to internal IP addresses, and will have ephemeral external IP addresses assigned to each instance. This `internal_ip_only` restriction can only be enabled for subnetwork enabled networks, and all off-cluster dependencies must be configured to be accessible without external IP addresses. + #[serde(rename="internalIpOnly")] + pub internal_ip_only: Option, + /// [Optional] The Google Compute Engine network to be used for machine communications. Cannot be specified with subnetwork_uri. If neither `network_uri` nor `subnetwork_uri` is specified, the "default" network of the project is used, if it exists. Cannot be a "Custom Subnet Network" (see [Using Subnetworks](/compute/docs/subnetworks) for more information). Example: `https://www.googleapis.com/compute/v1/projects/[project_id]/regions/global/default`. #[serde(rename="networkUri")] pub network_uri: Option, - /// The Google Compute Engine subnetwork to be used for machine communications. Cannot be specified with network_uri. Example: `https://www.googleapis.com/compute/v1/projects/[project_id]/regions/us-east1/sub0`. + /// [Optional] The Google Compute Engine subnetwork to be used for machine communications. Cannot be specified with network_uri. Example: `https://www.googleapis.com/compute/v1/projects/[project_id]/regions/us-east1/sub0`. #[serde(rename="subnetworkUri")] pub subnetwork_uri: Option, - /// The URIs of service account scopes to be included in Google Compute Engine instances. The following base set of scopes is always included: * https://www.googleapis.com/auth/cloud.useraccounts.readonly * https://www.googleapis.com/auth/devstorage.read_write * https://www.googleapis.com/auth/logging.write If no scopes are specfied, the following defaults are also provided: * https://www.googleapis.com/auth/bigquery * https://www.googleapis.com/auth/bigtable.admin.table * https://www.googleapis.com/auth/bigtable.data * https://www.googleapis.com/auth/devstorage.full_control + /// [Optional] The URIs of service account scopes to be included in Google Compute Engine instances. The following base set of scopes is always included: * https://www.googleapis.com/auth/cloud.useraccounts.readonly * https://www.googleapis.com/auth/devstorage.read_write * https://www.googleapis.com/auth/logging.write If no scopes are specified, the following defaults are also provided: * https://www.googleapis.com/auth/bigquery * https://www.googleapis.com/auth/bigtable.admin.table * https://www.googleapis.com/auth/bigtable.data * https://www.googleapis.com/auth/devstorage.full_control #[serde(rename="serviceAccountScopes")] pub service_account_scopes: Option>, - /// The Google Compute Engine tags to add to all instances. + /// The Google Compute Engine tags to add to all instances (see [Tagging instances](/compute/docs/label-or-tag-resources#tags)). pub tags: Option>, - /// The Google Compute Engine metadata entries to add to all instances. + /// The Google Compute Engine metadata entries to add to all instances (see [Project and instance metadata](https://cloud.google.com/compute/docs/storing-retrieving-metadata#project_and_instance_metadata)). pub metadata: Option>, /// [Required] The zone where the Google Compute Engine cluster will be located. Example: `https://www.googleapis.com/compute/v1/projects/[project_id]/zones/[zone]`. #[serde(rename="zoneUri")] @@ -314,7 +337,7 @@ pub struct ClusterConfig { /// [Required] The shared Google Compute Engine config settings for all instances in a cluster. #[serde(rename="gceClusterConfig")] pub gce_cluster_config: Option, - /// [Optional] Commands to execute on each node after config is completed. By default, executables are run on master and all worker nodes. You can test a node's role metadata to run an executable on a master or worker node, as shown below: ROLE=$(/usr/share/google/get_metadata_value attributes/role) if [[ "${ROLE}" == 'Master' ]]; then ... master specific actions ... else ... worker specific actions ... fi + /// [Optional] Commands to execute on each node after config is completed. By default, executables are run on master and all worker nodes. You can test a node's role metadata to run an executable on a master or worker node, as shown below using `curl` (you can also use `wget`): ROLE=$(curl -H Metadata-Flavor:Google http://metadata/computeMetadata/v1/instance/attributes/dataproc-role) if [[ "${ROLE}" == 'Master' ]]; then ... master specific actions ... else ... worker specific actions ... fi #[serde(rename="initializationActions")] pub initialization_actions: Option>, /// [Optional] The Google Compute Engine config settings for worker instances in a cluster. @@ -368,7 +391,7 @@ impl Part for QueryList {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct DiskConfig { - /// [Optional] Number of attached SSDs, from 0 to 4 (default is 0). If SSDs are not attached, the boot disk is used to store runtime logs and HDFS data. If one or more SSDs are attached, this runtime bulk data is spread across them, and the boot disk contains only basic config and installed binaries. + /// [Optional] Number of attached SSDs, from 0 to 4 (default is 0). If SSDs are not attached, the boot disk is used to store runtime logs and [HDFS](https://hadoop.apache.org/docs/r1.2.1/hdfs_user_guide.html) data. If one or more SSDs are attached, this runtime bulk data is spread across them, and the boot disk contains only basic config and installed binaries. #[serde(rename="numLocalSsds")] pub num_local_ssds: Option, /// [Optional] Size in GB of the boot disk (default is 500GB). @@ -397,9 +420,8 @@ pub struct Job { /// Job is a Hadoop job. #[serde(rename="hadoopJob")] pub hadoop_job: Option, - /// Job is a Pyspark job. - #[serde(rename="pysparkJob")] - pub pyspark_job: Option, + /// [Optional] The labels to associate with this job. Label **keys** must contain 1 to 63 characters, and must conform to [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt). Label **values** may be empty, but, if present, must contain 1 to 63 characters, and must conform to [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be associated with a job. + pub labels: Option>, /// [Required] Job information, including how, when, and where to run the job. pub placement: Option, /// [Optional] The fully qualified reference to the job, which can be used to obtain the equivalent REST path of the job resource. If this property is not specified when a job is created, the server generates a job_id. @@ -413,12 +435,18 @@ pub struct Job { /// [Output-only] A URI pointing to the location of the stdout of the job's driver program. #[serde(rename="driverOutputResourceUri")] pub driver_output_resource_uri: Option, + /// Job is a Pyspark job. + #[serde(rename="pysparkJob")] + pub pyspark_job: Option, /// [Output-only] If present, the location of miscellaneous control files which may be used as part of job setup and handling. If not present, control files may be placed in the same location as `driver_output_uri`. #[serde(rename="driverControlFilesUri")] pub driver_control_files_uri: Option, /// Job is a Spark job. #[serde(rename="sparkJob")] pub spark_job: Option, + /// [Output-only] The collection of YARN applications spun up by this job. **Beta** Feature: This report is available for testing purposes only. It may be changed before final release. + #[serde(rename="yarnApplications")] + pub yarn_applications: Option>, /// [Output-only] The previous job status. #[serde(rename="statusHistory")] pub status_history: Option>, @@ -447,7 +475,7 @@ pub struct ManagedGroupConfig { impl Part for ManagedGroupConfig {} -/// A Cloud Dataproc job for running PySpark applications on YARN. +/// A Cloud Dataproc job for running [Apache PySpark](https://spark.apache.org/docs/0.9.0/python-programming-guide.html) applications on YARN. /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -523,7 +551,7 @@ impl RequestValue for DiagnoseClusterRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListClustersResponse { - /// [Optional] This token is included in the response if there are more results to fetch. To fetch additional results, provide this value as the `page_token` in a subsequent ListClustersRequest. + /// [Output-only] This token is included in the response if there are more results to fetch. To fetch additional results, provide this value as the `page_token` in a subsequent ListClustersRequest. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// [Output-only] The clusters in the project. @@ -560,12 +588,12 @@ impl ResponseResult for ListJobsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct JobStatus { - /// [Required] A state message specifying the overall job state. + /// [Output-only] A state message specifying the overall job state. pub state: Option, /// [Output-only] The time when this state was entered. #[serde(rename="stateStartTime")] pub state_start_time: Option, - /// [Optional] Job state details, such as an error description if the state is ERROR. + /// [Output-only] Optional job state details, such as an error description if the state is ERROR. pub details: Option, } @@ -603,7 +631,24 @@ pub struct LoggingConfig { impl Part for LoggingConfig {} -/// A Cloud Dataproc job for running Hive queries on YARN. +/// Contains cluster daemon metrics, such as HDFS and YARN stats. **Beta Feature**: This report is available for testing purposes only. It may be changed before final release. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ClusterMetrics { + /// The YARN metrics. + #[serde(rename="yarnMetrics")] + pub yarn_metrics: Option>, + /// The HDFS metrics. + #[serde(rename="hdfsMetrics")] + pub hdfs_metrics: Option>, +} + +impl Part for ClusterMetrics {} + + +/// A Cloud Dataproc job for running [Apache Hive](https://hive.apache.org/) queries on YARN. /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -631,7 +676,7 @@ pub struct HiveJob { impl Part for HiveJob {} -/// A Cloud Dataproc job for running Hadoop MapReduce jobs on YARN. +/// A Cloud Dataproc job for running [Apache Hadoop MapReduce](https://hadoop.apache.org/docs/current/hadoop-mapreduce-client/hadoop-mapreduce-client-core/MapReduceTutorial.html) jobs on [Apache Hadoop YARN](https://hadoop.apache.org/docs/r2.7.1/hadoop-yarn/hadoop-yarn-site/YARN.html). /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -701,7 +746,7 @@ pub struct ListOperationsResponse { impl ResponseResult for ListOperationsResponse {} -/// A Cloud Dataproc job for running Pig queries on YARN. +/// A Cloud Dataproc job for running [Apache Pig](https://pig.apache.org/) queries on YARN. /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -756,6 +801,10 @@ pub struct Cluster { /// [Required] The Google Cloud Platform project ID that the cluster belongs to. #[serde(rename="projectId")] pub project_id: Option, + /// [Optional] The labels to associate with this cluster. Label **keys** must contain 1 to 63 characters, and must conform to [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt). Label **values** may be empty, but, if present, must contain 1 to 63 characters, and must conform to [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be associated with a cluster. + pub labels: Option>, + /// Contains cluster daemon metrics such as HDFS and YARN stats. **Beta Feature**: This report is available for testing purposes only. It may be changed before final release. + pub metrics: Option, /// [Output-only] The previous cluster status. #[serde(rename="statusHistory")] pub status_history: Option>, @@ -767,7 +816,7 @@ impl RequestValue for Cluster {} impl ResponseResult for Cluster {} -/// A Cloud Dataproc job for running Spark applications on YARN. +/// A Cloud Dataproc job for running [Apache Spark](http://spark.apache.org/) applications on YARN. /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -806,12 +855,12 @@ impl Part for SparkJob {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ClusterStatus { - /// The cluster's state. + /// [Output-only] The cluster's state. pub state: Option, - /// Time when this state was entered. + /// [Output-only] Time when this state was entered. #[serde(rename="stateStartTime")] pub state_start_time: Option, - /// Optional details of cluster's state. + /// [Output-only] Optional details of cluster's state. pub detail: Option, } @@ -841,7 +890,7 @@ pub struct Operation { pub response: Option>, /// The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should have the format of `operations/some/unique/name`. pub name: Option, - /// The error result of the operation in case of failure. + /// The error result of the operation in case of failure or cancellation. pub error: Option, } @@ -942,6 +991,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { _region: region.to_string(), _page_token: Default::default(), _page_size: Default::default(), + _filter: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -964,6 +1014,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { _page_token: Default::default(), _page_size: Default::default(), _job_state_matcher: Default::default(), + _filter: Default::default(), _cluster_name: Default::default(), _delegate: Default::default(), _scopes: Default::default(), @@ -1018,7 +1069,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. + /// Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to `Code.CANCELLED`. /// /// # Arguments /// @@ -1520,6 +1571,7 @@ impl<'a, C, A> ProjectRegionClusterGetCall<'a, C, A> where C: BorrowMut _region: String, _page_token: Option, _page_size: Option, + _filter: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap @@ -1552,7 +1605,7 @@ impl<'a, C, A> ProjectRegionClusterListCall<'a, C, A> where C: BorrowMut = Vec::with_capacity((6 + self._additional_params.len())); + let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); params.push(("region", self._region.to_string())); if let Some(value) = self._page_token { @@ -1561,7 +1614,10 @@ impl<'a, C, A> ProjectRegionClusterListCall<'a, C, A> where C: BorrowMut ProjectRegionClusterListCall<'a, C, A> where C: BorrowMut ProjectRegionClusterListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// The standard List page size. + /// [Optional] The standard List page size. /// /// Sets the *page size* query property to the given value. pub fn page_size(mut self, new_value: i32) -> ProjectRegionClusterListCall<'a, C, A> { self._page_size = Some(new_value); self } + /// [Optional] A filter constraining the clusters to list. Filters are case-sensitive and have the following syntax: field:value [field:value] ... or field = value [AND [field = value]] ... where **field** is one of `status.state`, `clusterName`, or `labels.[KEY]`, and `[KEY]` is a label key. **value** can be `*` to match all values. `status.state` can be one of the following: `ACTIVE`, `INACTIVE`, `CREATING`, `RUNNING`, `ERROR`, `DELETING`, or `UPDATING`. `ACTIVE` contains the `CREATING`, `UPDATING`, and `RUNNING` states. `INACTIVE` contains the `DELETING` and `ERROR` states. `clusterName` is the name of the cluster provided at creation time. Only the logical `AND` operator is supported; space-separated items are treated as having an implicit `AND` operator. Example valid filters are: status.state:ACTIVE clusterName:mycluster labels.env:staging \ labels.starred:* and status.state = ACTIVE AND clusterName = mycluster \ AND labels.env = staging AND labels.starred = * + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> ProjectRegionClusterListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// @@ -1795,10 +1858,11 @@ impl<'a, C, A> ProjectRegionClusterListCall<'a, C, A> where C: BorrowMut _page_token: Option, _page_size: Option, _job_state_matcher: Option, + _filter: Option, _cluster_name: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, @@ -1833,7 +1898,7 @@ impl<'a, C, A> ProjectRegionJobListCall<'a, C, A> where C: BorrowMut = Vec::with_capacity((8 + self._additional_params.len())); + let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); params.push(("region", self._region.to_string())); if let Some(value) = self._page_token { @@ -1845,10 +1910,13 @@ impl<'a, C, A> ProjectRegionJobListCall<'a, C, A> where C: BorrowMut ProjectRegionJobListCall<'a, C, A> where C: BorrowMut ProjectRegionJobListCall<'a, C, A> { self._job_state_matcher = Some(new_value.to_string()); self } + /// [Optional] A filter constraining the jobs to list. Filters are case-sensitive and have the following syntax: field:value] ... or [field = value] AND [field [= value]] ... where **field** is `status.state` or `labels.[KEY]`, and `[KEY]` is a label key. **value** can be `*` to match all values. `status.state` can be either `ACTIVE` or `INACTIVE`. Only the logical `AND` operator is supported; space-separated items are treated as having an implicit `AND` operator. Example valid filters are: status.state:ACTIVE labels.env:staging labels.starred:* and status.state = ACTIVE AND labels.env = staging AND labels.starred = * + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> ProjectRegionJobListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } /// [Optional] If set, the returned jobs list includes only jobs that were submitted to the named cluster. /// /// Sets the *cluster name* query property to the given value. @@ -2102,7 +2177,7 @@ impl<'a, C, A> ProjectRegionJobListCall<'a, C, A> where C: BorrowMut ProjectRegionJobGetCall<'a, C, A> where C: BorrowMut ProjectRegionOperationDeleteCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with Deployment Manager (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/deploymentmanager2-cli" diff --git a/gen/deploymentmanager2-cli/README.md b/gen/deploymentmanager2-cli/README.md index f8a6d7d201..52d0f91402 100644 --- a/gen/deploymentmanager2-cli/README.md +++ b/gen/deploymentmanager2-cli/README.md @@ -24,7 +24,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Deployment Manager* API at revision *20160901*. The CLI is at version *1.0.0*. +This documentation was generated from the *Deployment Manager* API at revision *20161209*. The CLI is at version *1.0.0*. ```bash deploymentmanager2 [options] @@ -32,10 +32,13 @@ deploymentmanager2 [options] cancel-preview (-r )... [-p ]... [-o ] delete [-p ]... [-o ] get [-p ]... [-o ] + get-iam-policy [-p ]... [-o ] insert (-r )... [-p ]... [-o ] list [-p ]... [-o ] patch (-r )... [-p ]... [-o ] + set-iam-policy (-r )... [-p ]... [-o ] stop (-r )... [-p ]... [-o ] + test-iam-permissions (-r )... [-p ]... [-o ] update (-r )... [-p ]... [-o ] manifests get [-p ]... [-o ] diff --git a/gen/deploymentmanager2-cli/mkdocs.yml b/gen/deploymentmanager2-cli/mkdocs.yml index 342a44f57b..49a9798711 100644 --- a/gen/deploymentmanager2-cli/mkdocs.yml +++ b/gen/deploymentmanager2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Deployment Manager v1.0.0+20160901 +site_name: Deployment Manager v1.0.0+20161209 site_url: http://byron.github.io/google-apis-rs/google-deploymentmanager2-cli site_description: Write integrating applications with bcore @@ -12,10 +12,13 @@ pages: - ['deployments_cancel-preview.md', 'Deployments', 'Cancel Preview'] - ['deployments_delete.md', 'Deployments', 'Delete'] - ['deployments_get.md', 'Deployments', 'Get'] +- ['deployments_get-iam-policy.md', 'Deployments', 'Get Iam Policy'] - ['deployments_insert.md', 'Deployments', 'Insert'] - ['deployments_list.md', 'Deployments', 'List'] - ['deployments_patch.md', 'Deployments', 'Patch'] +- ['deployments_set-iam-policy.md', 'Deployments', 'Set Iam Policy'] - ['deployments_stop.md', 'Deployments', 'Stop'] +- ['deployments_test-iam-permissions.md', 'Deployments', 'Test Iam Permissions'] - ['deployments_update.md', 'Deployments', 'Update'] - ['manifests_get.md', 'Manifests', 'Get'] - ['manifests_list.md', 'Manifests', 'List'] diff --git a/gen/deploymentmanager2-cli/src/main.rs b/gen/deploymentmanager2-cli/src/main.rs index 89399ae944..e024add0fd 100644 --- a/gen/deploymentmanager2-cli/src/main.rs +++ b/gen/deploymentmanager2-cli/src/main.rs @@ -133,6 +133,62 @@ impl<'n> Engine<'n> { fn _deployments_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.deployments().delete(opt.value_of("project").unwrap_or(""), opt.value_of("deployment").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "delete-policy" => { + call = call.delete_policy(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["delete-policy"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _deployments_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.deployments().get(opt.value_of("project").unwrap_or(""), opt.value_of("deployment").unwrap_or("")); for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { @@ -182,9 +238,9 @@ impl<'n> Engine<'n> { } } - fn _deployments_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + fn _deployments_get_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { - let mut call = self.hub.deployments().get(opt.value_of("project").unwrap_or(""), opt.value_of("deployment").unwrap_or("")); + let mut call = self.hub.deployments().get_iam_policy(opt.value_of("project").unwrap_or(""), opt.value_of("resource").unwrap_or("")); for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { @@ -361,6 +417,9 @@ impl<'n> Engine<'n> { "page-token" => { call = call.page_token(value.unwrap_or("")); }, + "order-by" => { + call = call.order_by(value.unwrap_or("")); + }, "max-results" => { call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); }, @@ -380,7 +439,7 @@ impl<'n> Engine<'n> { err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); - v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); + v.extend(["order-by", "page-token", "filter", "max-results"].iter().map(|v|*v)); v } )); } } @@ -538,6 +597,93 @@ impl<'n> Engine<'n> { } } + fn _deployments_set_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "version" => Some(("version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "iam-owned" => Some(("iamOwned", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["etag", "iam-owned", "version"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Policy = json::value::from_value(object).unwrap(); + let mut call = self.hub.deployments().set_iam_policy(request, opt.value_of("project").unwrap_or(""), opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _deployments_stop(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -623,6 +769,91 @@ impl<'n> Engine<'n> { } } + fn _deployments_test_iam_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "permissions" => Some(("permissions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["permissions"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::TestPermissionsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.deployments().test_iam_permissions(request, opt.value_of("project").unwrap_or(""), opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _deployments_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -808,6 +1039,9 @@ impl<'n> Engine<'n> { "page-token" => { call = call.page_token(value.unwrap_or("")); }, + "order-by" => { + call = call.order_by(value.unwrap_or("")); + }, "max-results" => { call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); }, @@ -827,7 +1061,7 @@ impl<'n> Engine<'n> { err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); - v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); + v.extend(["order-by", "page-token", "filter", "max-results"].iter().map(|v|*v)); v } )); } } @@ -922,6 +1156,9 @@ impl<'n> Engine<'n> { "page-token" => { call = call.page_token(value.unwrap_or("")); }, + "order-by" => { + call = call.order_by(value.unwrap_or("")); + }, "max-results" => { call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); }, @@ -941,7 +1178,7 @@ impl<'n> Engine<'n> { err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); - v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); + v.extend(["order-by", "page-token", "filter", "max-results"].iter().map(|v|*v)); v } )); } } @@ -1036,6 +1273,9 @@ impl<'n> Engine<'n> { "page-token" => { call = call.page_token(value.unwrap_or("")); }, + "order-by" => { + call = call.order_by(value.unwrap_or("")); + }, "max-results" => { call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); }, @@ -1055,7 +1295,7 @@ impl<'n> Engine<'n> { err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); - v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); + v.extend(["order-by", "page-token", "filter", "max-results"].iter().map(|v|*v)); v } )); } } @@ -1098,6 +1338,9 @@ impl<'n> Engine<'n> { "page-token" => { call = call.page_token(value.unwrap_or("")); }, + "order-by" => { + call = call.order_by(value.unwrap_or("")); + }, "max-results" => { call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); }, @@ -1117,7 +1360,7 @@ impl<'n> Engine<'n> { err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); - v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); + v.extend(["order-by", "page-token", "filter", "max-results"].iter().map(|v|*v)); v } )); } } @@ -1167,6 +1410,9 @@ impl<'n> Engine<'n> { ("get", Some(opt)) => { call_result = self._deployments_get(opt, dry_run, &mut err); }, + ("get-iam-policy", Some(opt)) => { + call_result = self._deployments_get_iam_policy(opt, dry_run, &mut err); + }, ("insert", Some(opt)) => { call_result = self._deployments_insert(opt, dry_run, &mut err); }, @@ -1176,9 +1422,15 @@ impl<'n> Engine<'n> { ("patch", Some(opt)) => { call_result = self._deployments_patch(opt, dry_run, &mut err); }, + ("set-iam-policy", Some(opt)) => { + call_result = self._deployments_set_iam_policy(opt, dry_run, &mut err); + }, ("stop", Some(opt)) => { call_result = self._deployments_stop(opt, dry_run, &mut err); }, + ("test-iam-permissions", Some(opt)) => { + call_result = self._deployments_test_iam_permissions(opt, dry_run, &mut err); + }, ("update", Some(opt)) => { call_result = self._deployments_update(opt, dry_run, &mut err); }, @@ -1323,7 +1575,7 @@ impl<'n> Engine<'n> { fn main() { let mut exit_status = 0i32; let arg_data = [ - ("deployments", "methods: 'cancel-preview', 'delete', 'get', 'insert', 'list', 'patch', 'stop' and 'update'", vec![ + ("deployments", "methods: 'cancel-preview', 'delete', 'get', 'get-iam-policy', 'insert', 'list', 'patch', 'set-iam-policy', 'stop', 'test-iam-permissions' and 'update'", vec![ ("cancel-preview", Some(r##"Cancels and removes the preview currently associated with the deployment."##), "Details at http://byron.github.io/google-apis-rs/google_deploymentmanager2_cli/deployments_cancel-preview", @@ -1408,6 +1660,34 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("get-iam-policy", + Some(r##"Gets the access control policy for a resource. May be empty if no such policy or resource exists."##), + "Details at http://byron.github.io/google-apis-rs/google_deploymentmanager2_cli/deployments_get-iam-policy", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"resource"##), + None, + Some(r##"Name of the resource for this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -1492,6 +1772,40 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("set-iam-policy", + Some(r##"Sets the access control policy on the specified resource. Replaces any existing policy."##), + "Details at http://byron.github.io/google-apis-rs/google_deploymentmanager2_cli/deployments_set-iam-policy", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"resource"##), + None, + Some(r##"Name of the resource for this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -1526,6 +1840,40 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("test-iam-permissions", + Some(r##"Returns permissions that a caller has on the specified resource."##), + "Details at http://byron.github.io/google-apis-rs/google_deploymentmanager2_cli/deployments_test-iam-permissions", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"resource"##), + None, + Some(r##"Name of the resource for this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -1780,7 +2128,7 @@ fn main() { let mut app = App::new("deploymentmanager2") .author("Sebastian Thiel ") - .version("1.0.0+20160901") + .version("1.0.0+20161209") .about("Declares, configures, and deploys complex solutions on Google Cloud Platform.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_deploymentmanager2_cli") .arg(Arg::with_name("url") diff --git a/gen/deploymentmanager2/Cargo.toml b/gen/deploymentmanager2/Cargo.toml index 2be2d5b885..9f3b41e38d 100644 --- a/gen/deploymentmanager2/Cargo.toml +++ b/gen/deploymentmanager2/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-deploymentmanager2" -version = "1.0.0+20160901" +version = "1.0.0+20161209" authors = ["Sebastian Thiel "] description = "A complete library to interact with Deployment Manager (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/deploymentmanager2" diff --git a/gen/deploymentmanager2/README.md b/gen/deploymentmanager2/README.md index 9875c3f1bd..3a30f8d4d3 100644 --- a/gen/deploymentmanager2/README.md +++ b/gen/deploymentmanager2/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-deploymentmanager2` library allows access to all features of the *Google Deployment Manager* service. -This documentation was generated from *Deployment Manager* crate version *1.0.0+20160901*, where *20160901* is the exact revision of the *deploymentmanager:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *Deployment Manager* crate version *1.0.0+20161209*, where *20161209* is the exact revision of the *deploymentmanager:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *Deployment Manager* *v2* API can be found at the [official documentation site](https://cloud.google.com/deployment-manager/). @@ -14,7 +14,7 @@ Everything else about the *Deployment Manager* *v2* API can be found at the Handle the following *Resources* with ease from the central [hub](http://byron.github.io/google-apis-rs/google_deploymentmanager2/struct.DeploymentManager.html) ... * [deployments](http://byron.github.io/google-apis-rs/google_deploymentmanager2/struct.Deployment.html) - * [*cancel preview*](http://byron.github.io/google-apis-rs/google_deploymentmanager2/struct.DeploymentCancelPreviewCall.html), [*delete*](http://byron.github.io/google-apis-rs/google_deploymentmanager2/struct.DeploymentDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_deploymentmanager2/struct.DeploymentGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_deploymentmanager2/struct.DeploymentInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_deploymentmanager2/struct.DeploymentListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_deploymentmanager2/struct.DeploymentPatchCall.html), [*stop*](http://byron.github.io/google-apis-rs/google_deploymentmanager2/struct.DeploymentStopCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_deploymentmanager2/struct.DeploymentUpdateCall.html) + * [*cancel preview*](http://byron.github.io/google-apis-rs/google_deploymentmanager2/struct.DeploymentCancelPreviewCall.html), [*delete*](http://byron.github.io/google-apis-rs/google_deploymentmanager2/struct.DeploymentDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_deploymentmanager2/struct.DeploymentGetCall.html), [*get iam policy*](http://byron.github.io/google-apis-rs/google_deploymentmanager2/struct.DeploymentGetIamPolicyCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_deploymentmanager2/struct.DeploymentInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_deploymentmanager2/struct.DeploymentListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_deploymentmanager2/struct.DeploymentPatchCall.html), [*set iam policy*](http://byron.github.io/google-apis-rs/google_deploymentmanager2/struct.DeploymentSetIamPolicyCall.html), [*stop*](http://byron.github.io/google-apis-rs/google_deploymentmanager2/struct.DeploymentStopCall.html), [*test iam permissions*](http://byron.github.io/google-apis-rs/google_deploymentmanager2/struct.DeploymentTestIamPermissionCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_deploymentmanager2/struct.DeploymentUpdateCall.html) * [manifests](http://byron.github.io/google-apis-rs/google_deploymentmanager2/struct.Manifest.html) * [*get*](http://byron.github.io/google-apis-rs/google_deploymentmanager2/struct.ManifestGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_deploymentmanager2/struct.ManifestListCall.html) * [operations](http://byron.github.io/google-apis-rs/google_deploymentmanager2/struct.Operation.html) @@ -56,12 +56,15 @@ Or specifically ... ```ignore let r = hub.deployments().update(...).doit() +let r = hub.deployments().get(...).doit() let r = hub.deployments().insert(...).doit() +let r = hub.deployments().test_iam_permissions(...).doit() let r = hub.deployments().cancel_preview(...).doit() -let r = hub.operations().get(...).doit() +let r = hub.deployments().list(...).doit() let r = hub.deployments().patch(...).doit() let r = hub.deployments().stop(...).doit() -let r = hub.operations().list(...).doit() +let r = hub.deployments().get_iam_policy(...).doit() +let r = hub.deployments().set_iam_policy(...).doit() let r = hub.deployments().delete(...).doit() ``` diff --git a/gen/deploymentmanager2/src/lib.rs b/gen/deploymentmanager2/src/lib.rs index 6d9d5bea51..554503a9f7 100644 --- a/gen/deploymentmanager2/src/lib.rs +++ b/gen/deploymentmanager2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Deployment Manager* crate version *1.0.0+20160901*, where *20160901* is the exact revision of the *deploymentmanager:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *Deployment Manager* crate version *1.0.0+20161209*, where *20161209* is the exact revision of the *deploymentmanager:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *Deployment Manager* *v2* API can be found at the //! [official documentation site](https://cloud.google.com/deployment-manager/). @@ -12,7 +12,7 @@ //! Handle the following *Resources* with ease from the central [hub](struct.DeploymentManager.html) ... //! //! * [deployments](struct.Deployment.html) -//! * [*cancel preview*](struct.DeploymentCancelPreviewCall.html), [*delete*](struct.DeploymentDeleteCall.html), [*get*](struct.DeploymentGetCall.html), [*insert*](struct.DeploymentInsertCall.html), [*list*](struct.DeploymentListCall.html), [*patch*](struct.DeploymentPatchCall.html), [*stop*](struct.DeploymentStopCall.html) and [*update*](struct.DeploymentUpdateCall.html) +//! * [*cancel preview*](struct.DeploymentCancelPreviewCall.html), [*delete*](struct.DeploymentDeleteCall.html), [*get*](struct.DeploymentGetCall.html), [*get iam policy*](struct.DeploymentGetIamPolicyCall.html), [*insert*](struct.DeploymentInsertCall.html), [*list*](struct.DeploymentListCall.html), [*patch*](struct.DeploymentPatchCall.html), [*set iam policy*](struct.DeploymentSetIamPolicyCall.html), [*stop*](struct.DeploymentStopCall.html), [*test iam permissions*](struct.DeploymentTestIamPermissionCall.html) and [*update*](struct.DeploymentUpdateCall.html) //! * [manifests](struct.Manifest.html) //! * [*get*](struct.ManifestGetCall.html) and [*list*](struct.ManifestListCall.html) //! * [operations](struct.Operation.html) @@ -56,12 +56,15 @@ //! //! ```ignore //! let r = hub.deployments().update(...).doit() +//! let r = hub.deployments().get(...).doit() //! let r = hub.deployments().insert(...).doit() +//! let r = hub.deployments().test_iam_permissions(...).doit() //! let r = hub.deployments().cancel_preview(...).doit() -//! let r = hub.operations().get(...).doit() +//! let r = hub.deployments().list(...).doit() //! let r = hub.deployments().patch(...).doit() //! let r = hub.deployments().stop(...).doit() -//! let r = hub.operations().list(...).doit() +//! let r = hub.deployments().get_iam_policy(...).doit() +//! let r = hub.deployments().set_iam_policy(...).doit() //! let r = hub.deployments().delete(...).doit() //! ``` //! @@ -115,9 +118,9 @@ //! // execute the final call using `doit()`. //! // Values shown here are possibly random and not representative ! //! let result = hub.deployments().update(req, "project", "deployment") -//! .preview(true) -//! .delete_policy("dolor") -//! .create_policy("et") +//! .preview(false) +//! .delete_policy("consetetur") +//! .create_policy("sadipscing") //! .doit(); //! //! match result { diff --git a/gen/deploymentmanager2/src/lib.rs.in b/gen/deploymentmanager2/src/lib.rs.in index 2b3ceaea81..493a2d3a1d 100644 --- a/gen/deploymentmanager2/src/lib.rs.in +++ b/gen/deploymentmanager2/src/lib.rs.in @@ -187,6 +187,23 @@ impl<'a, C, A> DeploymentManager // ############ // SCHEMAS ### // ########## +/// Provides the configuration for a sub-type of logging. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AuditLogConfig { + /// Specifies the identities that are exempted from this type of logging Follows the same format of Binding.members. + #[serde(rename="exemptedMembers")] + pub exempted_members: Option>, + /// The log type that this config enables. + #[serde(rename="logType")] + pub log_type: Option, +} + +impl Part for AuditLogConfig {} + + /// [Output Only] If warning messages are generated during processing of this resource, this field will be populated. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -218,6 +235,9 @@ impl Part for ResourceWarnings {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ResourceType { + /// The Access Control Policy set on this resource. + #[serde(rename="accessControl")] + pub access_control: Option, /// [Output Only] The evaluated properties of the resource with references expanded. Returned as serialized YAML. #[serde(rename="finalProperties")] pub final_properties: Option, @@ -234,512 +254,22 @@ pub struct ResourceType { pub update: Option, /// [Output Only] URL of the manifest representing the current configuration of this resource. pub manifest: Option, - /// [Output Only] The current properties of the resource before any references have been filled in. Returned as serialized YAML. - pub properties: Option, /// [Output Only] Timestamp when the resource was created or acquired, in RFC3339 text format . #[serde(rename="insertTime")] pub insert_time: Option, + /// [Output Only] Unique identifier for the resource; defined by the server. + pub id: Option, /// [Output Only] The type of the resource, for example compute.v1.instance, or cloudfunctions.v1beta1.function. #[serde(rename="type")] pub type_: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. - pub id: Option, + /// [Output Only] The current properties of the resource before any references have been filled in. Returned as serialized YAML. + pub properties: Option, } impl Resource for ResourceType {} impl ResponseResult for ResourceType {} -/// -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [stop deployments](struct.DeploymentStopCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DeploymentsStopRequest { - /// Specifies a fingerprint for stop() requests. A fingerprint is a randomly generated value that must be provided in stop() requests to perform optimistic locking. This ensures optimistic concurrency so that the deployment does not have conflicting requests (e.g. if someone attempts to make a new update request while another user attempts to stop an ongoing update request, this would prevent a collision). - /// - /// The fingerprint is initially generated by Deployment Manager and changes after every request to modify a deployment. To get the latest fingerprint value, perform a get() request on the deployment. - pub fingerprint: Option, -} - -impl RequestValue for DeploymentsStopRequest {} - - -/// -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [cancel preview deployments](struct.DeploymentCancelPreviewCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DeploymentsCancelPreviewRequest { - /// Specifies a fingerprint for cancelPreview() requests. A fingerprint is a randomly generated value that must be provided in cancelPreview() requests to perform optimistic locking. This ensures optimistic concurrency so that the deployment does not have conflicting requests (e.g. if someone attempts to make a new update request while another user attempts to cancel a preview, this would prevent one of the requests). - /// - /// The fingerprint is initially generated by Deployment Manager and changes after every request to modify a deployment. To get the latest fingerprint value, perform a get() request on the deployment. - pub fingerprint: Option, -} - -impl RequestValue for DeploymentsCancelPreviewRequest {} - - -/// A response containing a partial list of resources and a page token used to build the next request if the request has been truncated. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [list resources](struct.ResourceListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ResourcesListResponse { - /// A token used to continue a truncated list request. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// Resources contained in this list response. - pub resources: Option>, -} - -impl ResponseResult for ResourcesListResponse {} - - -/// [Output Only] Metadata about this warning in key: value format. For example: -/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ResourceUpdateWarningsData { - /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). - pub key: Option, - /// [Output Only] A warning data value corresponding to the key. - pub value: Option, -} - -impl NestedType for ResourceUpdateWarningsData {} -impl Part for ResourceUpdateWarningsData {} - - -/// -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [list manifests](struct.ManifestListCall.html) (none) -/// * [get manifests](struct.ManifestGetCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Manifest { - /// [Output Only] The YAML layout for this manifest. - pub layout: Option, - /// [Output Only] The name of the manifest. - pub name: Option, - /// [Output Only] The fully-expanded configuration file, including any templates and references. - #[serde(rename="expandedConfig")] - pub expanded_config: Option, - /// [Output Only] The imported files for this manifest. - pub imports: Option>, - /// [Output Only] Timestamp when the manifest was created, in RFC3339 text format. - #[serde(rename="insertTime")] - pub insert_time: Option, - /// [Output Only] The YAML configuration for this manifest. - pub config: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. - pub id: Option, - /// [Output Only] Self link for the manifest. - #[serde(rename="selfLink")] - pub self_link: Option, -} - -impl Resource for Manifest {} -impl ResponseResult for Manifest {} - - -/// -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ConfigFile { - /// The contents of the file. - pub content: Option, -} - -impl Part for ConfigFile {} - - -/// A response that returns all Types supported by Deployment Manager -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [list types](struct.TypeListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TypesListResponse { - /// A token used to continue a truncated list request. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// [Output Only] A list of resource types supported by Deployment Manager. - pub types: Option>, -} - -impl ResponseResult for TypesListResponse {} - - -/// -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TargetConfiguration { - /// Specifies any files to import for this configuration. This can be used to import templates or other files. For example, you might import a text file in order to use the file in a template. - pub imports: Option>, - /// The configuration to use for this deployment. - pub config: Option, -} - -impl Part for TargetConfiguration {} - - -/// [Output Only] The array of errors encountered while processing this operation. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct OperationErrorErrors { - /// [Output Only] An optional, human-readable error message. - pub message: Option, - /// [Output Only] The error type identifier for this error. - pub code: Option, - /// [Output Only] Indicates the field in the request that caused the error. This property is optional. - pub location: Option, -} - -impl NestedType for OperationErrorErrors {} -impl Part for OperationErrorErrors {} - - -/// -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ResourceUpdate { - /// [Output Only] The expanded properties of the resource with reference values expanded. Returned as serialized YAML. - #[serde(rename="finalProperties")] - pub final_properties: Option, - /// [Output Only] The state of the resource. - pub state: Option, - /// [Output Only] The intent of the resource: PREVIEW, UPDATE, or CANCEL. - pub intent: Option, - /// [Output Only] If warning messages are generated during processing of this resource, this field will be populated. - pub warnings: Option>, - /// [Output Only] If errors are generated during update of the resource, this field will be populated. - pub error: Option, - /// [Output Only] The set of updated properties for this resource, before references are expanded. Returned as serialized YAML. - pub properties: Option, - /// [Output Only] URL of the manifest representing the update configuration of this resource. - pub manifest: Option, -} - -impl Part for ResourceUpdate {} - - -/// A response containing a partial list of operations and a page token used to build the next request if the request has been truncated. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [list operations](struct.OperationListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct OperationsListResponse { - /// [Output Only] A token used to continue a truncated list request. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// [Output Only] Operations contained in this list response. - pub operations: Option>, -} - -impl ResponseResult for OperationsListResponse {} - - -/// A resource type supported by Deployment Manager. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [list types](struct.TypeListCall.html) (none) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Type { - /// [Output Only] The Operation that most recently ran, or is currently running, on this type. - pub operation: Option, - /// [Output Only] Timestamp when the type was created, in RFC3339 text format. - #[serde(rename="insertTime")] - pub insert_time: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. - pub id: Option, - /// [Output Only] Self link for the type. - #[serde(rename="selfLink")] - pub self_link: Option, - /// Name of the type. - pub name: Option, -} - -impl Resource for Type {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DeploymentUpdateLabelEntry { - /// no description provided - pub key: Option, - /// no description provided - pub value: Option, -} - -impl Part for DeploymentUpdateLabelEntry {} - - -/// [Output Only] The array of errors encountered while processing this operation. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ResourceUpdateErrorErrors { - /// [Output Only] An optional, human-readable error message. - pub message: Option, - /// [Output Only] The error type identifier for this error. - pub code: Option, - /// [Output Only] Indicates the field in the request that caused the error. This property is optional. - pub location: Option, -} - -impl NestedType for ResourceUpdateErrorErrors {} -impl Part for ResourceUpdateErrorErrors {} - - -/// -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ImportFile { - /// The contents of the file. - pub content: Option, - /// The name of the file. - pub name: Option, -} - -impl Part for ImportFile {} - - -/// [Output Only] Metadata about this warning in key: value format. For example: -/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct OperationWarningsData { - /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). - pub key: Option, - /// [Output Only] A warning data value corresponding to the key. - pub value: Option, -} - -impl NestedType for OperationWarningsData {} -impl Part for OperationWarningsData {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DeploymentLabelEntry { - /// no description provided - pub key: Option, - /// no description provided - pub value: Option, -} - -impl Part for DeploymentLabelEntry {} - - -/// [Output Only] If errors are generated during update of the resource, this field will be populated. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ResourceUpdateError { - /// [Output Only] The array of errors encountered while processing this operation. - pub errors: Option>, -} - -impl NestedType for ResourceUpdateError {} -impl Part for ResourceUpdateError {} - - -/// [Output Only] If warning messages are generated during processing of the operation, this field will be populated. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct OperationWarnings { - /// [Output Only] A human-readable description of the warning code. - pub message: Option, - /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. - pub code: Option, - /// [Output Only] Metadata about this warning in key: value format. For example: - /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } - pub data: Option>, -} - -impl NestedType for OperationWarnings {} -impl Part for OperationWarnings {} - - -/// [Output Only] If warning messages are generated during processing of this resource, this field will be populated. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ResourceUpdateWarnings { - /// [Output Only] A human-readable description of the warning code. - pub message: Option, - /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. - pub code: Option, - /// [Output Only] Metadata about this warning in key: value format. For example: - /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } - pub data: Option>, -} - -impl NestedType for ResourceUpdateWarnings {} -impl Part for ResourceUpdateWarnings {} - - -/// -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DeploymentUpdate { - /// [Output Only] Map of labels; provided by the client when the resource is created or updated. Specifically: Label keys must be between 1 and 63 characters long and must conform to the following regular expression: [a-z]([-a-z0-9]*[a-z0-9])? Label values must be between 0 and 63 characters long and must conform to the regular expression ([a-z]([-a-z0-9]*[a-z0-9])?)? - pub labels: Option>, - /// [Output Only] URL of the manifest representing the update configuration of this deployment. - pub manifest: Option, -} - -impl Part for DeploymentUpdate {} - - -/// [Output Only] If errors are generated during processing of the operation, this field will be populated. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct OperationError { - /// [Output Only] The array of errors encountered while processing this operation. - pub errors: Option>, -} - -impl NestedType for OperationError {} -impl Part for OperationError {} - - -/// A response containing a partial list of deployments and a page token used to build the next request if the request has been truncated. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [list deployments](struct.DeploymentListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DeploymentsListResponse { - /// [Output Only] A token used to continue a truncated list request. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// [Output Only] The deployments contained in this response. - pub deployments: Option>, -} - -impl ResponseResult for DeploymentsListResponse {} - - -/// -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [update deployments](struct.DeploymentUpdateCall.html) (request) -/// * [get deployments](struct.DeploymentGetCall.html) (response) -/// * [insert deployments](struct.DeploymentInsertCall.html) (request) -/// * [cancel preview deployments](struct.DeploymentCancelPreviewCall.html) (none) -/// * [list deployments](struct.DeploymentListCall.html) (none) -/// * [patch deployments](struct.DeploymentPatchCall.html) (request) -/// * [stop deployments](struct.DeploymentStopCall.html) (none) -/// * [delete deployments](struct.DeploymentDeleteCall.html) (none) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Deployment { - /// An optional user-provided description of the deployment. - pub description: Option, - /// Name of the resource; provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. - pub name: Option, - /// Map of labels; provided by the client when the resource is created or updated. Specifically: Label keys must be between 1 and 63 characters long and must conform to the following regular expression: [a-z]([-a-z0-9]*[a-z0-9])? Label values must be between 0 and 63 characters long and must conform to the regular expression ([a-z]([-a-z0-9]*[a-z0-9])?)? - pub labels: Option>, - /// [Output Only] If Deployment Manager is currently updating or previewing an update to this deployment, the updated configuration appears here. - pub update: Option, - /// [Output Only] URL of the manifest representing the last manifest that was successfully deployed. - pub manifest: Option, - /// [Output Only] Timestamp when the deployment was created, in RFC3339 text format . - #[serde(rename="insertTime")] - pub insert_time: Option, - /// Provides a fingerprint to use in requests to modify a deployment, such as update(), stop(), and cancelPreview() requests. A fingerprint is a randomly generated value that must be provided with update(), stop(), and cancelPreview() requests to perform optimistic locking. This ensures optimistic concurrency so that only one request happens at a time. - /// - /// The fingerprint is initially generated by Deployment Manager and changes after every request to modify data. To get the latest fingerprint value, perform a get() request to a deployment. - pub fingerprint: Option, - /// [Output Only] The Operation that most recently ran, or is currently running, on this deployment. - pub operation: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. - pub id: Option, - /// [Output Only] Self link for the deployment. - #[serde(rename="selfLink")] - pub self_link: Option, - /// [Input Only] The parameters that define your deployment, including the deployment configuration and relevant templates. - pub target: Option, -} - -impl RequestValue for Deployment {} -impl Resource for Deployment {} -impl ResponseResult for Deployment {} - - /// An Operation resource, used to manage asynchronous API requests. /// /// # Activities @@ -813,7 +343,7 @@ pub struct Operation { /// [Output Only] An optional textual description of the current status of the operation. #[serde(rename="statusMessage")] pub status_message: Option, - /// [Output Only] The URL of the resource that the operation modifies. If creating a persistent disk snapshot, this points to the persistent disk that the snapshot was created from. + /// [Output Only] The URL of the resource that the operation modifies. For operations related to creating a snapshot, this points to the persistent disk that the snapshot was created from. #[serde(rename="targetLink")] pub target_link: Option, } @@ -822,6 +352,577 @@ impl Resource for Operation {} impl ResponseResult for Operation {} +/// [Output Only] Metadata about this warning in key: value format. For example: +/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ResourceUpdateWarningsData { + /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). + pub key: Option, + /// [Output Only] A warning data value corresponding to the key. + pub value: Option, +} + +impl NestedType for ResourceUpdateWarningsData {} +impl Part for ResourceUpdateWarningsData {} + + +/// +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [stop deployments](struct.DeploymentStopCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DeploymentsStopRequest { + /// Specifies a fingerprint for stop() requests. A fingerprint is a randomly generated value that must be provided in stop() requests to perform optimistic locking. This ensures optimistic concurrency so that the deployment does not have conflicting requests (e.g. if someone attempts to make a new update request while another user attempts to stop an ongoing update request, this would prevent a collision). + /// + /// The fingerprint is initially generated by Deployment Manager and changes after every request to modify a deployment. To get the latest fingerprint value, perform a get() request on the deployment. + pub fingerprint: Option, +} + +impl RequestValue for DeploymentsStopRequest {} + + +/// +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [cancel preview deployments](struct.DeploymentCancelPreviewCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DeploymentsCancelPreviewRequest { + /// Specifies a fingerprint for cancelPreview() requests. A fingerprint is a randomly generated value that must be provided in cancelPreview() requests to perform optimistic locking. This ensures optimistic concurrency so that the deployment does not have conflicting requests (e.g. if someone attempts to make a new update request while another user attempts to cancel a preview, this would prevent one of the requests). + /// + /// The fingerprint is initially generated by Deployment Manager and changes after every request to modify a deployment. To get the latest fingerprint value, perform a get() request on the deployment. + pub fingerprint: Option, +} + +impl RequestValue for DeploymentsCancelPreviewRequest {} + + +/// A response containing a partial list of resources and a page token used to build the next request if the request has been truncated. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list resources](struct.ResourceListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ResourcesListResponse { + /// A token used to continue a truncated list request. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Resources contained in this list response. + pub resources: Option>, +} + +impl ResponseResult for ResourcesListResponse {} + + +/// A rule to be applied in a Policy. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Rule { + /// Human-readable description of the rule. + pub description: Option, + /// If one or more 'not_in' clauses are specified, the rule matches if the PRINCIPAL/AUTHORITY_SELECTOR is in none of the entries. + #[serde(rename="notIns")] + pub not_ins: Option>, + /// Required + pub action: Option, + /// A permission is a string of form '..' (e.g., 'storage.buckets.list'). A value of '*' matches all permissions, and a verb part of '*' (e.g., 'storage.buckets.*') matches all verbs. + pub permissions: Option>, + /// If one or more 'in' clauses are specified, the rule matches if the PRINCIPAL/AUTHORITY_SELECTOR is in at least one of these entries. + pub ins: Option>, + /// Additional restrictions that must be met + pub conditions: Option>, + /// The config returned to callers of tech.iam.IAM.CheckPolicy for any entries that match the LOG action. + #[serde(rename="logConfigs")] + pub log_configs: Option>, +} + +impl Part for Rule {} + + +/// +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list manifests](struct.ManifestListCall.html) (none) +/// * [get manifests](struct.ManifestGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Manifest { + /// [Output Only] The YAML layout for this manifest. + pub layout: Option, + /// [Output Only] The name of the manifest. + pub name: Option, + /// [Output Only] The fully-expanded configuration file, including any templates and references. + #[serde(rename="expandedConfig")] + pub expanded_config: Option, + /// [Output Only] The imported files for this manifest. + pub imports: Option>, + /// [Output Only] Timestamp when the manifest was created, in RFC3339 text format. + #[serde(rename="insertTime")] + pub insert_time: Option, + /// [Output Only] The YAML configuration for this manifest. + pub config: Option, + /// [Output Only] Unique identifier for the resource; defined by the server. + pub id: Option, + /// [Output Only] Self link for the manifest. + #[serde(rename="selfLink")] + pub self_link: Option, +} + +impl Resource for Manifest {} +impl ResponseResult for Manifest {} + + +/// +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DeploymentUpdate { + /// [Output Only] Map of labels; provided by the client when the resource is created or updated. Specifically: Label keys must be between 1 and 63 characters long and must conform to the following regular expression: [a-z]([-a-z0-9]*[a-z0-9])? Label values must be between 0 and 63 characters long and must conform to the regular expression ([a-z]([-a-z0-9]*[a-z0-9])?)? + pub labels: Option>, + /// [Output Only] URL of the manifest representing the update configuration of this deployment. + pub manifest: Option, +} + +impl Part for DeploymentUpdate {} + + +/// A response that returns all Types supported by Deployment Manager +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list types](struct.TypeListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TypesListResponse { + /// A token used to continue a truncated list request. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// [Output Only] A list of resource types supported by Deployment Manager. + pub types: Option>, +} + +impl ResponseResult for TypesListResponse {} + + +/// +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TargetConfiguration { + /// Specifies any files to import for this configuration. This can be used to import templates or other files. For example, you might import a text file in order to use the file in a template. + pub imports: Option>, + /// The configuration to use for this deployment. + pub config: Option, +} + +impl Part for TargetConfiguration {} + + +/// [Output Only] The array of errors encountered while processing this operation. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OperationErrorErrors { + /// [Output Only] An optional, human-readable error message. + pub message: Option, + /// [Output Only] The error type identifier for this error. + pub code: Option, + /// [Output Only] Indicates the field in the request that caused the error. This property is optional. + pub location: Option, +} + +impl NestedType for OperationErrorErrors {} +impl Part for OperationErrorErrors {} + + +/// +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ResourceUpdate { + /// The Access Control Policy to set on this resource after updating the resource itself. + #[serde(rename="accessControl")] + pub access_control: Option, + /// [Output Only] The expanded properties of the resource with reference values expanded. Returned as serialized YAML. + #[serde(rename="finalProperties")] + pub final_properties: Option, + /// [Output Only] If warning messages are generated during processing of this resource, this field will be populated. + pub warnings: Option>, + /// [Output Only] URL of the manifest representing the update configuration of this resource. + pub manifest: Option, + /// [Output Only] The state of the resource. + pub state: Option, + /// [Output Only] The intent of the resource: PREVIEW, UPDATE, or CANCEL. + pub intent: Option, + /// [Output Only] If errors are generated during update of the resource, this field will be populated. + pub error: Option, + /// [Output Only] The set of updated properties for this resource, before references are expanded. Returned as serialized YAML. + pub properties: Option, +} + +impl Part for ResourceUpdate {} + + +/// Defines an Identity and Access Management (IAM) policy. It is used to specify access control policies for Cloud Platform resources. +/// +/// +/// +/// A `Policy` consists of a list of `bindings`. A `Binding` binds a list of `members` to a `role`, where the members can be user accounts, Google groups, Google domains, and service accounts. A `role` is a named list of permissions defined by IAM. +/// +/// **Example** +/// +/// { "bindings": [ { "role": "roles/owner", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-other-app@appspot.gserviceaccount.com", ] }, { "role": "roles/viewer", "members": ["user:sean@example.com"] } ] } +/// +/// For a description of IAM and its features, see the [IAM developer's guide](https://cloud.google.com/iam). +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get iam policy deployments](struct.DeploymentGetIamPolicyCall.html) (response) +/// * [set iam policy deployments](struct.DeploymentSetIamPolicyCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Policy { + /// Specifies audit logging configs for "data access". "data access": generally refers to data reads/writes and admin reads. "admin activity": generally refers to admin writes. + /// + /// Note: `AuditConfig` doesn't apply to "admin activity", which always enables audit logging. + #[serde(rename="auditConfigs")] + pub audit_configs: Option>, + /// Version of the `Policy`. The default version is 0. + pub version: Option, + /// `etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other. It is strongly suggested that systems make use of the `etag` in the read-modify-write cycle to perform policy updates in order to avoid race conditions: An `etag` is returned in the response to `getIamPolicy`, and systems are expected to put that etag in the request to `setIamPolicy` to ensure that their change will be applied to the same version of the policy. + /// + /// If no `etag` is provided in the call to `setIamPolicy`, then the existing policy is overwritten blindly. + pub etag: Option, + /// If more than one rule is specified, the rules are applied in the following manner: - All matching LOG rules are always applied. - If any DENY/DENY_WITH_LOG rule matches, permission is denied. Logging will be applied if one or more matching rule requires logging. - Otherwise, if any ALLOW/ALLOW_WITH_LOG rule matches, permission is granted. Logging will be applied if one or more matching rule requires logging. - Otherwise, if no rule applies, permission is denied. + pub rules: Option>, + /// Associates a list of `members` to a `role`. Multiple `bindings` must not be specified for the same `role`. `bindings` with no members will result in an error. + pub bindings: Option>, + /// + #[serde(rename="iamOwned")] + pub iam_owned: Option, +} + +impl RequestValue for Policy {} +impl ResponseResult for Policy {} + + +/// A response containing a partial list of operations and a page token used to build the next request if the request has been truncated. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list operations](struct.OperationListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OperationsListResponse { + /// [Output Only] A token used to continue a truncated list request. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// [Output Only] Operations contained in this list response. + pub operations: Option>, +} + +impl ResponseResult for OperationsListResponse {} + + +/// [Output Only] Metadata about this warning in key: value format. For example: +/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OperationWarningsData { + /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). + pub key: Option, + /// [Output Only] A warning data value corresponding to the key. + pub value: Option, +} + +impl NestedType for OperationWarningsData {} +impl Part for OperationWarningsData {} + + +/// A resource type supported by Deployment Manager. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list types](struct.TypeListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Type { + /// [Output Only] The Operation that most recently ran, or is currently running, on this type. + pub operation: Option, + /// [Output Only] Timestamp when the type was created, in RFC3339 text format. + #[serde(rename="insertTime")] + pub insert_time: Option, + /// [Output Only] Unique identifier for the resource; defined by the server. + pub id: Option, + /// [Output Only] Self link for the type. + #[serde(rename="selfLink")] + pub self_link: Option, + /// Name of the type. + pub name: Option, +} + +impl Resource for Type {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DeploymentUpdateLabelEntry { + /// no description provided + pub key: Option, + /// no description provided + pub value: Option, +} + +impl Part for DeploymentUpdateLabelEntry {} + + +/// Options for counters +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LogConfigCounterOptions { + /// The field value to attribute. + pub field: Option, + /// The metric to update. + pub metric: Option, +} + +impl Part for LogConfigCounterOptions {} + + +/// +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ImportFile { + /// The contents of the file. + pub content: Option, + /// The name of the file. + pub name: Option, +} + +impl Part for ImportFile {} + + +/// The access controls set on the resource. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ResourceAccessControl { + /// The GCP IAM Policy to set on the resource. + #[serde(rename="gcpIamPolicy")] + pub gcp_iam_policy: Option, +} + +impl Part for ResourceAccessControl {} + + +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [test iam permissions deployments](struct.DeploymentTestIamPermissionCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TestPermissionsRequest { + /// The set of permissions to check for the 'resource'. Permissions with wildcards (such as '*' or 'storage.*') are not allowed. + pub permissions: Option>, +} + +impl RequestValue for TestPermissionsRequest {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DeploymentLabelEntry { + /// no description provided + pub key: Option, + /// no description provided + pub value: Option, +} + +impl Part for DeploymentLabelEntry {} + + +/// [Output Only] If errors are generated during update of the resource, this field will be populated. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ResourceUpdateError { + /// [Output Only] The array of errors encountered while processing this operation. + pub errors: Option>, +} + +impl NestedType for ResourceUpdateError {} +impl Part for ResourceUpdateError {} + + +/// [Output Only] If warning messages are generated during processing of the operation, this field will be populated. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OperationWarnings { + /// [Output Only] A human-readable description of the warning code. + pub message: Option, + /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. + pub code: Option, + /// [Output Only] Metadata about this warning in key: value format. For example: + /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } + pub data: Option>, +} + +impl NestedType for OperationWarnings {} +impl Part for OperationWarnings {} + + +/// [Output Only] If warning messages are generated during processing of this resource, this field will be populated. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ResourceUpdateWarnings { + /// [Output Only] A human-readable description of the warning code. + pub message: Option, + /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. + pub code: Option, + /// [Output Only] Metadata about this warning in key: value format. For example: + /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } + pub data: Option>, +} + +impl NestedType for ResourceUpdateWarnings {} +impl Part for ResourceUpdateWarnings {} + + +/// Associates `members` with a `role`. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Binding { + /// Role that is assigned to `members`. For example, `roles/viewer`, `roles/editor`, or `roles/owner`. + pub role: Option, + /// Specifies the identities requesting access for a Cloud Platform resource. `members` can have the following values: + /// + /// * `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account. + /// + /// * `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account. + /// + /// * `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@gmail.com` or `joe@example.com`. + /// + /// + /// + /// * `serviceAccount:{emailid}`: An email address that represents a service account. For example, `my-other-app@appspot.gserviceaccount.com`. + /// + /// * `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`. + /// + /// * `domain:{domain}`: A Google Apps domain name that represents all the users of that domain. For example, `google.com` or `example.com`. + pub members: Option>, +} + +impl Part for Binding {} + + +/// +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ConfigFile { + /// The contents of the file. + pub content: Option, +} + +impl Part for ConfigFile {} + + +/// [Output Only] If errors are generated during processing of the operation, this field will be populated. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OperationError { + /// [Output Only] The array of errors encountered while processing this operation. + pub errors: Option>, +} + +impl NestedType for OperationError {} +impl Part for OperationError {} + + +/// Provides the configuration for non-admin_activity logging for a service. Controls exemptions and specific log sub-types. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AuditConfig { + /// Specifies the identities that are exempted from "data access" audit logging for the `service` specified above. Follows the same format of Binding.members. + #[serde(rename="exemptedMembers")] + pub exempted_members: Option>, + /// The configuration for each type of logging + #[serde(rename="auditLogConfigs")] + pub audit_log_configs: Option>, + /// Specifies a service that will be enabled for audit logging. For example, `resourcemanager`, `storage`, `compute`. `allServices` is a special value that covers all services. + pub service: Option, +} + +impl Part for AuditConfig {} + + /// A response containing a partial list of manifests and a page token used to build the next request if the request has been truncated. /// /// # Activities @@ -843,6 +944,153 @@ pub struct ManifestsListResponse { impl ResponseResult for ManifestsListResponse {} +/// A response containing a partial list of deployments and a page token used to build the next request if the request has been truncated. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list deployments](struct.DeploymentListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DeploymentsListResponse { + /// [Output Only] A token used to continue a truncated list request. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// [Output Only] The deployments contained in this response. + pub deployments: Option>, +} + +impl ResponseResult for DeploymentsListResponse {} + + +/// +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [update deployments](struct.DeploymentUpdateCall.html) (request) +/// * [get deployments](struct.DeploymentGetCall.html) (response) +/// * [insert deployments](struct.DeploymentInsertCall.html) (request) +/// * [test iam permissions deployments](struct.DeploymentTestIamPermissionCall.html) (none) +/// * [cancel preview deployments](struct.DeploymentCancelPreviewCall.html) (none) +/// * [list deployments](struct.DeploymentListCall.html) (none) +/// * [patch deployments](struct.DeploymentPatchCall.html) (request) +/// * [stop deployments](struct.DeploymentStopCall.html) (none) +/// * [get iam policy deployments](struct.DeploymentGetIamPolicyCall.html) (none) +/// * [set iam policy deployments](struct.DeploymentSetIamPolicyCall.html) (none) +/// * [delete deployments](struct.DeploymentDeleteCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Deployment { + /// An optional user-provided description of the deployment. + pub description: Option, + /// Name of the resource; provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. + pub name: Option, + /// Map of labels; provided by the client when the resource is created or updated. Specifically: Label keys must be between 1 and 63 characters long and must conform to the following regular expression: [a-z]([-a-z0-9]*[a-z0-9])? Label values must be between 0 and 63 characters long and must conform to the regular expression ([a-z]([-a-z0-9]*[a-z0-9])?)? + pub labels: Option>, + /// [Output Only] If Deployment Manager is currently updating or previewing an update to this deployment, the updated configuration appears here. + pub update: Option, + /// [Output Only] URL of the manifest representing the last manifest that was successfully deployed. + pub manifest: Option, + /// [Output Only] Timestamp when the deployment was created, in RFC3339 text format . + #[serde(rename="insertTime")] + pub insert_time: Option, + /// Provides a fingerprint to use in requests to modify a deployment, such as update(), stop(), and cancelPreview() requests. A fingerprint is a randomly generated value that must be provided with update(), stop(), and cancelPreview() requests to perform optimistic locking. This ensures optimistic concurrency so that only one request happens at a time. + /// + /// The fingerprint is initially generated by Deployment Manager and changes after every request to modify data. To get the latest fingerprint value, perform a get() request to a deployment. + pub fingerprint: Option, + /// [Output Only] The Operation that most recently ran, or is currently running, on this deployment. + pub operation: Option, + /// [Output Only] Unique identifier for the resource; defined by the server. + pub id: Option, + /// [Output Only] Self link for the deployment. + #[serde(rename="selfLink")] + pub self_link: Option, + /// [Input Only] The parameters that define your deployment, including the deployment configuration and relevant templates. + pub target: Option, +} + +impl RequestValue for Deployment {} +impl Resource for Deployment {} +impl ResponseResult for Deployment {} + + +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [test iam permissions deployments](struct.DeploymentTestIamPermissionCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TestPermissionsResponse { + /// A subset of `TestPermissionsRequest.permissions` that the caller is allowed. + pub permissions: Option>, +} + +impl ResponseResult for TestPermissionsResponse {} + + +/// [Output Only] The array of errors encountered while processing this operation. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ResourceUpdateErrorErrors { + /// [Output Only] An optional, human-readable error message. + pub message: Option, + /// [Output Only] The error type identifier for this error. + pub code: Option, + /// [Output Only] Indicates the field in the request that caused the error. This property is optional. + pub location: Option, +} + +impl NestedType for ResourceUpdateErrorErrors {} +impl Part for ResourceUpdateErrorErrors {} + + +/// Specifies what kind of log the caller must write +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LogConfig { + /// Counter options. + pub counter: Option, +} + +impl Part for LogConfig {} + + +/// A condition to be met. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Condition { + /// Trusted attributes supplied by the IAM system. + pub iam: Option, + /// Trusted attributes supplied by any service that owns resources and uses the IAM system for access control. + pub sys: Option, + /// The objects of the condition. This is mutually exclusive with 'value'. + pub values: Option>, + /// Trusted attributes discharged by the service. + pub svc: Option, + /// DEPRECATED. Use 'values' instead. + pub value: Option, + /// An operator to apply the subject with. + pub op: Option, +} + +impl Part for Condition {} + + /// [Output Only] Metadata about this warning in key: value format. For example: /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } /// @@ -934,6 +1182,7 @@ impl<'a, C, A> OperationMethods<'a, C, A> { hub: self.hub, _project: project.to_string(), _page_token: Default::default(), + _order_by: Default::default(), _max_results: Default::default(), _filter: Default::default(), _delegate: Default::default(), @@ -997,6 +1246,7 @@ impl<'a, C, A> ManifestMethods<'a, C, A> { _project: project.to_string(), _deployment: deployment.to_string(), _page_token: Default::default(), + _order_by: Default::default(), _max_results: Default::default(), _filter: Default::default(), _delegate: Default::default(), @@ -1079,6 +1329,7 @@ impl<'a, C, A> TypeMethods<'a, C, A> { hub: self.hub, _project: project.to_string(), _page_token: Default::default(), + _order_by: Default::default(), _max_results: Default::default(), _filter: Default::default(), _delegate: Default::default(), @@ -1163,6 +1414,7 @@ impl<'a, C, A> ResourceMethods<'a, C, A> { _project: project.to_string(), _deployment: deployment.to_string(), _page_token: Default::default(), + _order_by: Default::default(), _max_results: Default::default(), _filter: Default::default(), _delegate: Default::default(), @@ -1197,7 +1449,7 @@ impl<'a, C, A> ResourceMethods<'a, C, A> { /// ::default(), None); /// let mut hub = DeploymentManager::new(hyper::Client::new(), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `cancel_preview(...)`, `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)`, `stop(...)` and `update(...)` +/// // like `cancel_preview(...)`, `delete(...)`, `get(...)`, `get_iam_policy(...)`, `insert(...)`, `list(...)`, `patch(...)`, `set_iam_policy(...)`, `stop(...)`, `test_iam_permissions(...)` and `update(...)` /// // to build up your call. /// let rb = hub.deployments(); /// # } @@ -1275,6 +1527,46 @@ impl<'a, C, A> DeploymentMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Returns permissions that a caller has on the specified resource. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Project ID for this request. + /// * `resource` - Name of the resource for this request. + pub fn test_iam_permissions(&self, request: TestPermissionsRequest, project: &str, resource: &str) -> DeploymentTestIamPermissionCall<'a, C, A> { + DeploymentTestIamPermissionCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets the access control policy for a resource. May be empty if no such policy or resource exists. + /// + /// # Arguments + /// + /// * `project` - Project ID for this request. + /// * `resource` - Name of the resource for this request. + pub fn get_iam_policy(&self, project: &str, resource: &str) -> DeploymentGetIamPolicyCall<'a, C, A> { + DeploymentGetIamPolicyCall { + hub: self.hub, + _project: project.to_string(), + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Cancels and removes the preview currently associated with the deployment. @@ -1308,6 +1600,7 @@ impl<'a, C, A> DeploymentMethods<'a, C, A> { hub: self.hub, _project: project.to_string(), _page_token: Default::default(), + _order_by: Default::default(), _max_results: Default::default(), _filter: Default::default(), _delegate: Default::default(), @@ -1361,6 +1654,27 @@ impl<'a, C, A> DeploymentMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Sets the access control policy on the specified resource. Replaces any existing policy. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Project ID for this request. + /// * `resource` - Name of the resource for this request. + pub fn set_iam_policy(&self, request: Policy, project: &str, resource: &str) -> DeploymentSetIamPolicyCall<'a, C, A> { + DeploymentSetIamPolicyCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Deletes a deployment and all of the resources in the deployment. @@ -1374,6 +1688,7 @@ impl<'a, C, A> DeploymentMethods<'a, C, A> { hub: self.hub, _project: project.to_string(), _deployment: deployment.to_string(), + _delete_policy: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -1664,8 +1979,9 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: /// // Values shown here are possibly random and not representative ! /// let result = hub.operations().list("project") /// .page_token("sea") -/// .max_results(11) -/// .filter("dolores") +/// .order_by("nonumy") +/// .max_results(82) +/// .filter("gubergren") /// .doit(); /// # } /// ``` @@ -1675,6 +1991,7 @@ pub struct OperationListCall<'a, C, A> hub: &'a DeploymentManager, _project: String, _page_token: Option, + _order_by: Option, _max_results: Option, _filter: Option, _delegate: Option<&'a mut Delegate>, @@ -1698,18 +2015,21 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: }; dlg.begin(MethodInfo { id: "deploymentmanager.operations.list", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("project", self._project.to_string())); if let Some(value) = self._page_token { params.push(("pageToken", value.to_string())); } + if let Some(value) = self._order_by { + params.push(("orderBy", value.to_string())); + } if let Some(value) = self._max_results { params.push(("maxResults", value.to_string())); } if let Some(value) = self._filter { params.push(("filter", value.to_string())); } - for &field in ["alt", "project", "pageToken", "maxResults", "filter"].iter() { + for &field in ["alt", "project", "pageToken", "orderBy", "maxResults", "filter"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -1841,6 +2161,17 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: self._page_token = Some(new_value.to_string()); self } + /// Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. + /// + /// You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. + /// + /// Currently, only sorting by name or creationTimestamp desc is supported. + /// + /// Sets the *order by* query property to the given value. + pub fn order_by(mut self, new_value: &str) -> OperationListCall<'a, C, A> { + self._order_by = Some(new_value.to_string()); + self + } /// The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. @@ -1942,9 +2273,10 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.manifests().list("project", "deployment") -/// .page_token("aliquyam") -/// .max_results(35) -/// .filter("no") +/// .page_token("ea") +/// .order_by("no") +/// .max_results(80) +/// .filter("justo") /// .doit(); /// # } /// ``` @@ -1955,6 +2287,7 @@ pub struct ManifestListCall<'a, C, A> _project: String, _deployment: String, _page_token: Option, + _order_by: Option, _max_results: Option, _filter: Option, _delegate: Option<&'a mut Delegate>, @@ -1978,19 +2311,22 @@ impl<'a, C, A> ManifestListCall<'a, C, A> where C: BorrowMut, A: }; dlg.begin(MethodInfo { id: "deploymentmanager.manifests.list", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); + let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); params.push(("project", self._project.to_string())); params.push(("deployment", self._deployment.to_string())); if let Some(value) = self._page_token { params.push(("pageToken", value.to_string())); } + if let Some(value) = self._order_by { + params.push(("orderBy", value.to_string())); + } if let Some(value) = self._max_results { params.push(("maxResults", value.to_string())); } if let Some(value) = self._filter { params.push(("filter", value.to_string())); } - for &field in ["alt", "project", "deployment", "pageToken", "maxResults", "filter"].iter() { + for &field in ["alt", "project", "deployment", "pageToken", "orderBy", "maxResults", "filter"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -2132,6 +2468,17 @@ impl<'a, C, A> ManifestListCall<'a, C, A> where C: BorrowMut, A: self._page_token = Some(new_value.to_string()); self } + /// Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. + /// + /// You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. + /// + /// Currently, only sorting by name or creationTimestamp desc is supported. + /// + /// Sets the *order by* query property to the given value. + pub fn order_by(mut self, new_value: &str) -> ManifestListCall<'a, C, A> { + self._order_by = Some(new_value.to_string()); + self + } /// The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. @@ -2492,9 +2839,10 @@ impl<'a, C, A> ManifestGetCall<'a, C, A> where C: BorrowMut, A: o /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.types().list("project") -/// .page_token("diam") -/// .max_results(46) -/// .filter("Lorem") +/// .page_token("Lorem") +/// .order_by("et") +/// .max_results(31) +/// .filter("aliquyam") /// .doit(); /// # } /// ``` @@ -2504,6 +2852,7 @@ pub struct TypeListCall<'a, C, A> hub: &'a DeploymentManager, _project: String, _page_token: Option, + _order_by: Option, _max_results: Option, _filter: Option, _delegate: Option<&'a mut Delegate>, @@ -2527,18 +2876,21 @@ impl<'a, C, A> TypeListCall<'a, C, A> where C: BorrowMut, A: oaut }; dlg.begin(MethodInfo { id: "deploymentmanager.types.list", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("project", self._project.to_string())); if let Some(value) = self._page_token { params.push(("pageToken", value.to_string())); } + if let Some(value) = self._order_by { + params.push(("orderBy", value.to_string())); + } if let Some(value) = self._max_results { params.push(("maxResults", value.to_string())); } if let Some(value) = self._filter { params.push(("filter", value.to_string())); } - for &field in ["alt", "project", "pageToken", "maxResults", "filter"].iter() { + for &field in ["alt", "project", "pageToken", "orderBy", "maxResults", "filter"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -2670,6 +3022,17 @@ impl<'a, C, A> TypeListCall<'a, C, A> where C: BorrowMut, A: oaut self._page_token = Some(new_value.to_string()); self } + /// Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. + /// + /// You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. + /// + /// Currently, only sorting by name or creationTimestamp desc is supported. + /// + /// Sets the *order by* query property to the given value. + pub fn order_by(mut self, new_value: &str) -> TypeListCall<'a, C, A> { + self._order_by = Some(new_value.to_string()); + self + } /// The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. @@ -3030,9 +3393,10 @@ impl<'a, C, A> ResourceGetCall<'a, C, A> where C: BorrowMut, A: o /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.resources().list("project", "deployment") -/// .page_token("eos") -/// .max_results(20) -/// .filter("sadipscing") +/// .page_token("dolor") +/// .order_by("eirmod") +/// .max_results(58) +/// .filter("amet") /// .doit(); /// # } /// ``` @@ -3043,6 +3407,7 @@ pub struct ResourceListCall<'a, C, A> _project: String, _deployment: String, _page_token: Option, + _order_by: Option, _max_results: Option, _filter: Option, _delegate: Option<&'a mut Delegate>, @@ -3066,19 +3431,22 @@ impl<'a, C, A> ResourceListCall<'a, C, A> where C: BorrowMut, A: }; dlg.begin(MethodInfo { id: "deploymentmanager.resources.list", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); + let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); params.push(("project", self._project.to_string())); params.push(("deployment", self._deployment.to_string())); if let Some(value) = self._page_token { params.push(("pageToken", value.to_string())); } + if let Some(value) = self._order_by { + params.push(("orderBy", value.to_string())); + } if let Some(value) = self._max_results { params.push(("maxResults", value.to_string())); } if let Some(value) = self._filter { params.push(("filter", value.to_string())); } - for &field in ["alt", "project", "deployment", "pageToken", "maxResults", "filter"].iter() { + for &field in ["alt", "project", "deployment", "pageToken", "orderBy", "maxResults", "filter"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -3220,6 +3588,17 @@ impl<'a, C, A> ResourceListCall<'a, C, A> where C: BorrowMut, A: self._page_token = Some(new_value.to_string()); self } + /// Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. + /// + /// You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. + /// + /// Currently, only sorting by name or creationTimestamp desc is supported. + /// + /// Sets the *order by* query property to the given value. + pub fn order_by(mut self, new_value: &str) -> ResourceListCall<'a, C, A> { + self._order_by = Some(new_value.to_string()); + self + } /// The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. @@ -3328,8 +3707,8 @@ impl<'a, C, A> ResourceListCall<'a, C, A> where C: BorrowMut, A: /// // Values shown here are possibly random and not representative ! /// let result = hub.deployments().update(req, "project", "deployment") /// .preview(true) -/// .delete_policy("amet") -/// .create_policy("no") +/// .delete_policy("dolore") +/// .create_policy("invidunt") /// .doit(); /// # } /// ``` @@ -4133,6 +4512,531 @@ impl<'a, C, A> DeploymentInsertCall<'a, C, A> where C: BorrowMut, } +/// Returns permissions that a caller has on the specified resource. +/// +/// A builder for the *testIamPermissions* method supported by a *deployment* resource. +/// It is not used directly, but through a `DeploymentMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_deploymentmanager2 as deploymentmanager2; +/// use deploymentmanager2::TestPermissionsRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use deploymentmanager2::DeploymentManager; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = DeploymentManager::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = TestPermissionsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.deployments().test_iam_permissions(req, "project", "resource") +/// .doit(); +/// # } +/// ``` +pub struct DeploymentTestIamPermissionCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a DeploymentManager, + _request: TestPermissionsRequest, + _project: String, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for DeploymentTestIamPermissionCall<'a, C, A> {} + +impl<'a, C, A> DeploymentTestIamPermissionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, TestPermissionsResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "deploymentmanager.deployments.testIamPermissions", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("project", self._project.to_string())); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "project", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/deploymentmanager/v2/projects/{project}/global/deployments/{resource}/testIamPermissions".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{resource}", "resource")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["resource", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: TestPermissionsRequest) -> DeploymentTestIamPermissionCall<'a, C, A> { + self._request = new_value; + self + } + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> DeploymentTestIamPermissionCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// Name of the resource for this request. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> DeploymentTestIamPermissionCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> DeploymentTestIamPermissionCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> DeploymentTestIamPermissionCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> DeploymentTestIamPermissionCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets the access control policy for a resource. May be empty if no such policy or resource exists. +/// +/// A builder for the *getIamPolicy* method supported by a *deployment* resource. +/// It is not used directly, but through a `DeploymentMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_deploymentmanager2 as deploymentmanager2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use deploymentmanager2::DeploymentManager; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = DeploymentManager::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.deployments().get_iam_policy("project", "resource") +/// .doit(); +/// # } +/// ``` +pub struct DeploymentGetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a DeploymentManager, + _project: String, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for DeploymentGetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> DeploymentGetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "deploymentmanager.deployments.getIamPolicy", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("project", self._project.to_string())); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "project", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/deploymentmanager/v2/projects/{project}/global/deployments/{resource}/getIamPolicy".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{resource}", "resource")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["resource", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> DeploymentGetIamPolicyCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// Name of the resource for this request. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> DeploymentGetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> DeploymentGetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> DeploymentGetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> DeploymentGetIamPolicyCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + /// Cancels and removes the preview currently associated with the deployment. /// /// A builder for the *cancelPreview* method supported by a *deployment* resource. @@ -4438,9 +5342,10 @@ impl<'a, C, A> DeploymentCancelPreviewCall<'a, C, A> where C: BorrowMut hub: &'a DeploymentManager, _project: String, _page_token: Option, + _order_by: Option, _max_results: Option, _filter: Option, _delegate: Option<&'a mut Delegate>, @@ -4473,18 +5379,21 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A }; dlg.begin(MethodInfo { id: "deploymentmanager.deployments.list", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("project", self._project.to_string())); if let Some(value) = self._page_token { params.push(("pageToken", value.to_string())); } + if let Some(value) = self._order_by { + params.push(("orderBy", value.to_string())); + } if let Some(value) = self._max_results { params.push(("maxResults", value.to_string())); } if let Some(value) = self._filter { params.push(("filter", value.to_string())); } - for &field in ["alt", "project", "pageToken", "maxResults", "filter"].iter() { + for &field in ["alt", "project", "pageToken", "orderBy", "maxResults", "filter"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -4616,6 +5525,17 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A self._page_token = Some(new_value.to_string()); self } + /// Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. + /// + /// You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. + /// + /// Currently, only sorting by name or creationTimestamp desc is supported. + /// + /// Sets the *order by* query property to the given value. + pub fn order_by(mut self, new_value: &str) -> DeploymentListCall<'a, C, A> { + self._order_by = Some(new_value.to_string()); + self + } /// The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. @@ -4723,9 +5643,9 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.deployments().patch(req, "project", "deployment") -/// .preview(false) -/// .delete_policy("et") -/// .create_policy("amet") +/// .preview(true) +/// .delete_policy("dolor") +/// .create_policy("et") /// .doit(); /// # } /// ``` @@ -5282,6 +6202,284 @@ impl<'a, C, A> DeploymentStopCall<'a, C, A> where C: BorrowMut, A } +/// Sets the access control policy on the specified resource. Replaces any existing policy. +/// +/// A builder for the *setIamPolicy* method supported by a *deployment* resource. +/// It is not used directly, but through a `DeploymentMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_deploymentmanager2 as deploymentmanager2; +/// use deploymentmanager2::Policy; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use deploymentmanager2::DeploymentManager; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = DeploymentManager::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Policy::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.deployments().set_iam_policy(req, "project", "resource") +/// .doit(); +/// # } +/// ``` +pub struct DeploymentSetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a DeploymentManager, + _request: Policy, + _project: String, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for DeploymentSetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> DeploymentSetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "deploymentmanager.deployments.setIamPolicy", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("project", self._project.to_string())); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "project", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/deploymentmanager/v2/projects/{project}/global/deployments/{resource}/setIamPolicy".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{resource}", "resource")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["resource", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Policy) -> DeploymentSetIamPolicyCall<'a, C, A> { + self._request = new_value; + self + } + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> DeploymentSetIamPolicyCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// Name of the resource for this request. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> DeploymentSetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> DeploymentSetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> DeploymentSetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> DeploymentSetIamPolicyCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + /// Deletes a deployment and all of the resources in the deployment. /// /// A builder for the *delete* method supported by a *deployment* resource. @@ -5309,6 +6507,7 @@ impl<'a, C, A> DeploymentStopCall<'a, C, A> where C: BorrowMut, A /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.deployments().delete("project", "deployment") +/// .delete_policy("sit") /// .doit(); /// # } /// ``` @@ -5318,6 +6517,7 @@ pub struct DeploymentDeleteCall<'a, C, A> hub: &'a DeploymentManager, _project: String, _deployment: String, + _delete_policy: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap @@ -5339,10 +6539,13 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, }; dlg.begin(MethodInfo { id: "deploymentmanager.deployments.delete", http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); params.push(("deployment", self._deployment.to_string())); - for &field in ["alt", "project", "deployment"].iter() { + if let Some(value) = self._delete_policy { + params.push(("deletePolicy", value.to_string())); + } + for &field in ["alt", "project", "deployment", "deletePolicy"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -5477,6 +6680,13 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, self._deployment = new_value.to_string(); self } + /// Sets the policy to use for deleting resources. + /// + /// Sets the *delete policy* query property to the given value. + pub fn delete_policy(mut self, new_value: &str) -> DeploymentDeleteCall<'a, C, A> { + self._delete_policy = Some(new_value.to_string()); + self + } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// diff --git a/gen/dfareporting2d5-cli/Cargo.toml b/gen/dfareporting2d5-cli/Cargo.toml index 4413f31045..24e6d99710 100644 --- a/gen/dfareporting2d5-cli/Cargo.toml +++ b/gen/dfareporting2d5-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-dfareporting2d5-cli" -version = "1.0.0+20160803" +version = "1.0.0+20161027" authors = ["Sebastian Thiel "] description = "A complete library to interact with dfareporting (protocol v2.5)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/dfareporting2d5-cli" diff --git a/gen/dfareporting2d5-cli/README.md b/gen/dfareporting2d5-cli/README.md index fd8f2982ca..3d568bd81a 100644 --- a/gen/dfareporting2d5-cli/README.md +++ b/gen/dfareporting2d5-cli/README.md @@ -24,7 +24,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *dfareporting* API at revision *20160803*. The CLI is at version *1.0.0*. +This documentation was generated from the *dfareporting* API at revision *20161027*. The CLI is at version *1.0.0*. ```bash dfareporting2d5 [options] diff --git a/gen/dfareporting2d5-cli/mkdocs.yml b/gen/dfareporting2d5-cli/mkdocs.yml index 52eecce6bb..c6e9e67d93 100644 --- a/gen/dfareporting2d5-cli/mkdocs.yml +++ b/gen/dfareporting2d5-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: dfareporting v1.0.0+20160803 +site_name: dfareporting v1.0.0+20161027 site_url: http://byron.github.io/google-apis-rs/google-dfareporting2d5-cli site_description: Write integrating applications with bcore diff --git a/gen/dfareporting2d5-cli/src/main.rs b/gen/dfareporting2d5-cli/src/main.rs index 1b62a1a907..14b1176142 100644 --- a/gen/dfareporting2d5-cli/src/main.rs +++ b/gen/dfareporting2d5-cli/src/main.rs @@ -17308,7 +17308,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of account user profiles, possibly filtered."##), + Some(r##"Retrieves a list of account user profiles, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d5_cli/account-user-profiles_list", vec![ (Some(r##"profile-id"##), @@ -17423,7 +17423,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves the list of accounts, possibly filtered."##), + Some(r##"Retrieves the list of accounts, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d5_cli/accounts_list", vec![ (Some(r##"profile-id"##), @@ -17566,7 +17566,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of ads, possibly filtered."##), + Some(r##"Retrieves a list of ads, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d5_cli/ads_list", vec![ (Some(r##"profile-id"##), @@ -17731,7 +17731,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of advertiser groups, possibly filtered."##), + Some(r##"Retrieves a list of advertiser groups, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d5_cli/advertiser-groups_list", vec![ (Some(r##"profile-id"##), @@ -17874,7 +17874,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of advertisers, possibly filtered."##), + Some(r##"Retrieves a list of advertisers, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d5_cli/advertisers_list", vec![ (Some(r##"profile-id"##), @@ -18020,7 +18020,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves the list of creative IDs associated with the specified campaign."##), + Some(r##"Retrieves the list of creative IDs associated with the specified campaign. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d5_cli/campaign-creative-associations_list", vec![ (Some(r##"profile-id"##), @@ -18119,7 +18119,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of campaigns, possibly filtered."##), + Some(r##"Retrieves a list of campaigns, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d5_cli/campaigns_list", vec![ (Some(r##"profile-id"##), @@ -18234,7 +18234,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of change logs."##), + Some(r##"Retrieves a list of change logs. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d5_cli/change-logs_list", vec![ (Some(r##"profile-id"##), @@ -18415,7 +18415,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of content categories, possibly filtered."##), + Some(r##"Retrieves a list of content categories, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d5_cli/content-categories_list", vec![ (Some(r##"profile-id"##), @@ -18725,7 +18725,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of creative field values, possibly filtered."##), + Some(r##"Retrieves a list of creative field values, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d5_cli/creative-field-values_list", vec![ (Some(r##"profile-id"##), @@ -18908,7 +18908,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of creative fields, possibly filtered."##), + Some(r##"Retrieves a list of creative fields, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d5_cli/creative-fields_list", vec![ (Some(r##"profile-id"##), @@ -19051,7 +19051,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of creative groups, possibly filtered."##), + Some(r##"Retrieves a list of creative groups, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d5_cli/creative-groups_list", vec![ (Some(r##"profile-id"##), @@ -19194,7 +19194,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of creatives, possibly filtered."##), + Some(r##"Retrieves a list of creatives, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d5_cli/creatives_list", vec![ (Some(r##"profile-id"##), @@ -19340,7 +19340,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of directory site contacts, possibly filtered."##), + Some(r##"Retrieves a list of directory site contacts, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d5_cli/directory-site-contacts_list", vec![ (Some(r##"profile-id"##), @@ -19421,7 +19421,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of directory sites, possibly filtered."##), + Some(r##"Retrieves a list of directory sites, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d5_cli/directory-sites_list", vec![ (Some(r##"profile-id"##), @@ -19851,7 +19851,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of floodlight activities, possibly filtered."##), + Some(r##"Retrieves a list of floodlight activities, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d5_cli/floodlight-activities_list", vec![ (Some(r##"profile-id"##), @@ -19994,7 +19994,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of floodlight activity groups, possibly filtered."##), + Some(r##"Retrieves a list of floodlight activity groups, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d5_cli/floodlight-activity-groups_list", vec![ (Some(r##"profile-id"##), @@ -20230,7 +20230,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of inventory items, possibly filtered."##), + Some(r##"Retrieves a list of inventory items, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d5_cli/inventory-items_list", vec![ (Some(r##"profile-id"##), @@ -20680,7 +20680,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of order documents, possibly filtered."##), + Some(r##"Retrieves a list of order documents, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d5_cli/order-documents_list", vec![ (Some(r##"profile-id"##), @@ -20745,7 +20745,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of orders, possibly filtered."##), + Some(r##"Retrieves a list of orders, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d5_cli/orders_list", vec![ (Some(r##"profile-id"##), @@ -20832,7 +20832,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of placement groups, possibly filtered."##), + Some(r##"Retrieves a list of placement groups, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d5_cli/placement-groups_list", vec![ (Some(r##"profile-id"##), @@ -20997,7 +20997,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of placement strategies, possibly filtered."##), + Some(r##"Retrieves a list of placement strategies, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d5_cli/placement-strategies_list", vec![ (Some(r##"profile-id"##), @@ -21162,7 +21162,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of placements, possibly filtered."##), + Some(r##"Retrieves a list of placements, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d5_cli/placements_list", vec![ (Some(r##"profile-id"##), @@ -21383,7 +21383,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of projects, possibly filtered."##), + Some(r##"Retrieves a list of projects, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d5_cli/projects_list", vec![ (Some(r##"profile-id"##), @@ -21582,7 +21582,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of remarketing lists, possibly filtered."##), + Some(r##"Retrieves a list of remarketing lists, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d5_cli/remarketing-lists_list", vec![ (Some(r##"profile-id"##), @@ -22020,7 +22020,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of sites, possibly filtered."##), + Some(r##"Retrieves a list of sites, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d5_cli/sites_list", vec![ (Some(r##"profile-id"##), @@ -22244,7 +22244,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Gets a list of subaccounts, possibly filtered."##), + Some(r##"Gets a list of subaccounts, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d5_cli/subaccounts_list", vec![ (Some(r##"profile-id"##), @@ -22359,7 +22359,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of targetable remarketing lists, possibly filtered."##), + Some(r##"Retrieves a list of targetable remarketing lists, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d5_cli/targetable-remarketing-lists_list", vec![ (Some(r##"profile-id"##), @@ -22615,7 +22615,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of user roles, possibly filtered."##), + Some(r##"Retrieves a list of user roles, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d5_cli/user-roles_list", vec![ (Some(r##"profile-id"##), @@ -22704,7 +22704,7 @@ fn main() { let mut app = App::new("dfareporting2d5") .author("Sebastian Thiel ") - .version("1.0.0+20160803") + .version("1.0.0+20161027") .about("Manages your DoubleClick Campaign Manager ad campaigns and reports.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_dfareporting2d5_cli") .arg(Arg::with_name("url") diff --git a/gen/dfareporting2d5/Cargo.toml b/gen/dfareporting2d5/Cargo.toml index c16ebcd6cb..fb1737f382 100644 --- a/gen/dfareporting2d5/Cargo.toml +++ b/gen/dfareporting2d5/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-dfareporting2d5" -version = "1.0.0+20160803" +version = "1.0.0+20161027" authors = ["Sebastian Thiel "] description = "A complete library to interact with dfareporting (protocol v2.5)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/dfareporting2d5" diff --git a/gen/dfareporting2d5/README.md b/gen/dfareporting2d5/README.md index 80eb77448b..7e79b6fbc2 100644 --- a/gen/dfareporting2d5/README.md +++ b/gen/dfareporting2d5/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-dfareporting2d5` library allows access to all features of the *Google dfareporting* service. -This documentation was generated from *dfareporting* crate version *1.0.0+20160803*, where *20160803* is the exact revision of the *dfareporting:v2.5* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *dfareporting* crate version *1.0.0+20161027*, where *20161027* is the exact revision of the *dfareporting:v2.5* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *dfareporting* *v2d5* API can be found at the [official documentation site](https://developers.google.com/doubleclick-advertisers/reporting/). diff --git a/gen/dfareporting2d5/src/lib.rs b/gen/dfareporting2d5/src/lib.rs index d7dd5b5731..364e918eff 100644 --- a/gen/dfareporting2d5/src/lib.rs +++ b/gen/dfareporting2d5/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *dfareporting* crate version *1.0.0+20160803*, where *20160803* is the exact revision of the *dfareporting:v2.5* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *dfareporting* crate version *1.0.0+20161027*, where *20161027* is the exact revision of the *dfareporting:v2.5* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *dfareporting* *v2d5* API can be found at the //! [official documentation site](https://developers.google.com/doubleclick-advertisers/reporting/). diff --git a/gen/dfareporting2d5/src/lib.rs.in b/gen/dfareporting2d5/src/lib.rs.in index ee7e03699c..21241bea2e 100644 --- a/gen/dfareporting2d5/src/lib.rs.in +++ b/gen/dfareporting2d5/src/lib.rs.in @@ -391,7 +391,7 @@ pub struct Conversion { pub mobile_device_id: Option, /// The value of the conversion. pub value: Option, - /// Whether the user has Limit Ad Tracking set. + /// Whether Limit Ad Tracking is enabled. When set to true, the conversion will be used for reporting but not targeting. This will prevent remarketing. #[serde(rename="limitAdTracking")] pub limit_ad_tracking: Option, /// Floodlight Activity ID of this conversion. This is a required field. @@ -6277,7 +6277,7 @@ pub struct Ad { pub id: Option, /// Size of this ad. Applicable when type is AD_SERVING_DEFAULT_AD. pub size: Option, - /// Whether this ad is archived. + /// Whether this ad is archived. When true, active must be false. pub archived: Option, /// Technology platform targeting information for this ad. This field must be left blank if the ad is using a targeting template. Applicable when type is AD_SERVING_STANDARD_AD. #[serde(rename="technologyTargeting")] @@ -6324,7 +6324,7 @@ pub struct Ad { /// Date and time that this ad should start serving. If creating an ad, this field must be a time in the future. This is a required field on insertion. #[serde(rename="startTime")] pub start_time: Option, - /// Whether this ad is active. + /// Whether this ad is active. When true, archived must be false. pub active: Option, /// Compatibility of this ad. Applicable when type is AD_SERVING_DEFAULT_AD. DISPLAY and DISPLAY_INTERSTITIAL refer to either rendering on desktop or on mobile devices or in mobile apps for regular or interstitial ads, respectively. APP and APP_INTERSTITIAL are only used for existing default ads. New mobile placements must be assigned DISPLAY or DISPLAY_INTERSTITIAL and default ads created for those placements will be limited to those compatibility types. IN_STREAM_VIDEO refers to rendering in-stream video ads developed with the VAST standard. pub compatibility: Option, @@ -7224,7 +7224,7 @@ impl<'a, C, A> CreativeFieldValueMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of creative field values, possibly filtered. + /// Retrieves a list of creative field values, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -7309,7 +7309,7 @@ impl<'a, C, A> CreativeFieldMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of creative fields, possibly filtered. + /// Retrieves a list of creative fields, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -7549,7 +7549,7 @@ impl<'a, C, A> UserRoleMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of user roles, possibly filtered. + /// Retrieves a list of user roles, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -7942,7 +7942,7 @@ impl<'a, C, A> CampaignCreativeAssociationMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the list of creative IDs associated with the specified campaign. + /// Retrieves the list of creative IDs associated with the specified campaign. This method supports paging. /// /// # Arguments /// @@ -8005,7 +8005,7 @@ impl<'a, C, A> ChangeLogMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of change logs. + /// Retrieves a list of change logs. This method supports paging. /// /// # Arguments /// @@ -8477,7 +8477,7 @@ impl<'a, C, A> AdvertiserMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of advertisers, possibly filtered. + /// Retrieves a list of advertisers, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -8687,7 +8687,7 @@ impl<'a, C, A> FloodlightActivityGroupMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of floodlight activity groups, possibly filtered. + /// Retrieves a list of floodlight activity groups, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -8850,7 +8850,7 @@ impl<'a, C, A> OrderMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of orders, possibly filtered. + /// Retrieves a list of orders, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -8957,7 +8957,7 @@ impl<'a, C, A> DirectorySiteContactMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of directory site contacts, possibly filtered. + /// Retrieves a list of directory site contacts, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -9132,7 +9132,7 @@ impl<'a, C, A> AdMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of ads, possibly filtered. + /// Retrieves a list of ads, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -9425,7 +9425,7 @@ impl<'a, C, A> AdvertiserGroupMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of advertiser groups, possibly filtered. + /// Retrieves a list of advertiser groups, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -9605,7 +9605,7 @@ impl<'a, C, A> SiteMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of sites, possibly filtered. + /// Retrieves a list of sites, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -9737,7 +9737,7 @@ impl<'a, C, A> FloodlightActivityMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of floodlight activities, possibly filtered. + /// Retrieves a list of floodlight activities, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -10019,7 +10019,7 @@ impl<'a, C, A> CreativeGroupMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of creative groups, possibly filtered. + /// Retrieves a list of creative groups, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -10106,7 +10106,7 @@ impl<'a, C, A> TargetableRemarketingListMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of targetable remarketing lists, possibly filtered. + /// Retrieves a list of targetable remarketing lists, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -10250,7 +10250,7 @@ impl<'a, C, A> SubaccountMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets a list of subaccounts, possibly filtered. + /// Gets a list of subaccounts, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -10687,7 +10687,7 @@ impl<'a, C, A> PlacementGroupMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of placement groups, possibly filtered. + /// Retrieves a list of placement groups, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -10842,7 +10842,7 @@ impl<'a, C, A> InventoryItemMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of inventory items, possibly filtered. + /// Retrieves a list of inventory items, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -11087,7 +11087,7 @@ impl<'a, C, A> ContentCategoryMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of content categories, possibly filtered. + /// Retrieves a list of content categories, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -11305,7 +11305,7 @@ impl<'a, C, A> CreativeMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of creatives, possibly filtered. + /// Retrieves a list of creatives, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -11482,7 +11482,7 @@ impl<'a, C, A> CampaignMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of campaigns, possibly filtered. + /// Retrieves a list of campaigns, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -11756,7 +11756,7 @@ impl<'a, C, A> RemarketingListMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of remarketing lists, possibly filtered. + /// Retrieves a list of remarketing lists, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -11963,7 +11963,7 @@ impl<'a, C, A> PlacementStrategyMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of placement strategies, possibly filtered. + /// Retrieves a list of placement strategies, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -12086,7 +12086,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of projects, possibly filtered. + /// Retrieves a list of projects, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -12189,7 +12189,7 @@ impl<'a, C, A> DirectorySiteMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of directory sites, possibly filtered. + /// Retrieves a list of directory sites, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -12562,7 +12562,7 @@ impl<'a, C, A> AccountUserProfileMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of account user profiles, possibly filtered. + /// Retrieves a list of account user profiles, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -12786,7 +12786,7 @@ impl<'a, C, A> OrderDocumentMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of order documents, possibly filtered. + /// Retrieves a list of order documents, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -13009,7 +13009,7 @@ impl<'a, C, A> AccountMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the list of accounts, possibly filtered. + /// Retrieves the list of accounts, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -13135,7 +13135,7 @@ impl<'a, C, A> PlacementMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of placements, possibly filtered. + /// Retrieves a list of placements, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -15841,7 +15841,7 @@ impl<'a, C, A> CreativeFieldValueUpdateCall<'a, C, A> where C: BorrowMut CreativeFieldUpdateCall<'a, C, A> where C: BorrowMut UserRolePatchCall<'a, C, A> where C: BorrowMut, A: } -/// Retrieves a list of user roles, possibly filtered. +/// Retrieves a list of user roles, possibly filtered. This method supports paging. /// /// A builder for the *list* method supported by a *userRole* resource. /// It is not used directly, but through a `UserRoleMethods` instance. @@ -22160,7 +22160,7 @@ impl<'a, C, A> CampaignCreativeAssociationInsertCall<'a, C, A> where C: BorrowMu } -/// Retrieves the list of creative IDs associated with the specified campaign. +/// Retrieves the list of creative IDs associated with the specified campaign. This method supports paging. /// /// A builder for the *list* method supported by a *campaignCreativeAssociation* resource. /// It is not used directly, but through a `CampaignCreativeAssociationMethods` instance. @@ -22443,7 +22443,7 @@ impl<'a, C, A> CampaignCreativeAssociationListCall<'a, C, A> where C: BorrowMut< } -/// Retrieves a list of change logs. +/// Retrieves a list of change logs. This method supports paging. /// /// A builder for the *list* method supported by a *changeLog* resource. /// It is not used directly, but through a `ChangeLogMethods` instance. @@ -27089,7 +27089,7 @@ impl<'a, C, A> AdvertiserPatchCall<'a, C, A> where C: BorrowMut, } -/// Retrieves a list of advertisers, possibly filtered. +/// Retrieves a list of advertisers, possibly filtered. This method supports paging. /// /// A builder for the *list* method supported by a *advertiser* resource. /// It is not used directly, but through a `AdvertiserMethods` instance. @@ -28805,7 +28805,7 @@ impl<'a, C, A> FloodlightActivityGroupPatchCall<'a, C, A> where C: BorrowMut MetroListCall<'a, C, A> where C: BorrowMut, A: oau } -/// Retrieves a list of orders, possibly filtered. +/// Retrieves a list of orders, possibly filtered. This method supports paging. /// /// A builder for the *list* method supported by a *order* resource. /// It is not used directly, but through a `OrderMethods` instance. @@ -30761,7 +30761,7 @@ impl<'a, C, A> DirectorySiteContactGetCall<'a, C, A> where C: BorrowMut AdInsertCall<'a, C, A> where C: BorrowMut, A: oaut } -/// Retrieves a list of ads, possibly filtered. +/// Retrieves a list of ads, possibly filtered. This method supports paging. /// /// A builder for the *list* method supported by a *ad* resource. /// It is not used directly, but through a `AdMethods` instance. @@ -34344,7 +34344,7 @@ impl<'a, C, A> AdvertiserGroupGetCall<'a, C, A> where C: BorrowMut SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth } -/// Retrieves a list of sites, possibly filtered. +/// Retrieves a list of sites, possibly filtered. This method supports paging. /// /// A builder for the *list* method supported by a *site* resource. /// It is not used directly, but through a `SiteMethods` instance. @@ -37428,7 +37428,7 @@ impl<'a, C, A> FloodlightActivityGetCall<'a, C, A> where C: BorrowMut CreativeGroupUpdateCall<'a, C, A> where C: BorrowMut CreativeGroupPatchCall<'a, C, A> where C: BorrowMut SubaccountUpdateCall<'a, C, A> where C: BorrowMut, } -/// Gets a list of subaccounts, possibly filtered. +/// Gets a list of subaccounts, possibly filtered. This method supports paging. /// /// A builder for the *list* method supported by a *subaccount* resource. /// It is not used directly, but through a `SubaccountMethods` instance. @@ -45248,7 +45248,7 @@ impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth } -/// Retrieves a list of placement groups, possibly filtered. +/// Retrieves a list of placement groups, possibly filtered. This method supports paging. /// /// A builder for the *list* method supported by a *placementGroup* resource. /// It is not used directly, but through a `PlacementGroupMethods` instance. @@ -46792,7 +46792,7 @@ impl<'a, C, A> PlacementGroupPatchCall<'a, C, A> where C: BorrowMut AccountPermissionGroupGetCall<'a, C, A> where C: BorrowMut CreativeGetCall<'a, C, A> where C: BorrowMut, A: o } -/// Retrieves a list of creatives, possibly filtered. +/// Retrieves a list of creatives, possibly filtered. This method supports paging. /// /// A builder for the *list* method supported by a *creative* resource. /// It is not used directly, but through a `CreativeMethods` instance. @@ -52580,7 +52580,7 @@ impl<'a, C, A> CampaignUpdateCall<'a, C, A> where C: BorrowMut, A } -/// Retrieves a list of campaigns, possibly filtered. +/// Retrieves a list of campaigns, possibly filtered. This method supports paging. /// /// A builder for the *list* method supported by a *campaign* resource. /// It is not used directly, but through a `CampaignMethods` instance. @@ -55150,7 +55150,7 @@ impl<'a, C, A> RemarketingListUpdateCall<'a, C, A> where C: BorrowMut PlacementStrategyGetCall<'a, C, A> where C: BorrowMut PlacementStrategyPatchCall<'a, C, A> where C: BorrowMut DirectorySiteInsertCall<'a, C, A> where C: BorrowMut AccountUserProfileUpdateCall<'a, C, A> where C: BorrowMut OrderDocumentGetCall<'a, C, A> where C: BorrowMut, } -/// Retrieves a list of order documents, possibly filtered. +/// Retrieves a list of order documents, possibly filtered. This method supports paging. /// /// A builder for the *list* method supported by a *orderDocument* resource. /// It is not used directly, but through a `OrderDocumentMethods` instance. @@ -64729,7 +64729,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa } -/// Retrieves the list of accounts, possibly filtered. +/// Retrieves the list of accounts, possibly filtered. This method supports paging. /// /// A builder for the *list* method supported by a *account* resource. /// It is not used directly, but through a `AccountMethods` instance. @@ -65873,7 +65873,7 @@ impl<'a, C, A> PlacementPatchCall<'a, C, A> where C: BorrowMut, A } -/// Retrieves a list of placements, possibly filtered. +/// Retrieves a list of placements, possibly filtered. This method supports paging. /// /// A builder for the *list* method supported by a *placement* resource. /// It is not used directly, but through a `PlacementMethods` instance. diff --git a/gen/dfareporting2d6-cli/Cargo.toml b/gen/dfareporting2d6-cli/Cargo.toml index 62708f5b4b..faa53dfc93 100644 --- a/gen/dfareporting2d6-cli/Cargo.toml +++ b/gen/dfareporting2d6-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-dfareporting2d6-cli" -version = "1.0.0+20160803" +version = "1.0.0+20161027" authors = ["Sebastian Thiel "] description = "A complete library to interact with dfareporting (protocol v2.6)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/dfareporting2d6-cli" diff --git a/gen/dfareporting2d6-cli/README.md b/gen/dfareporting2d6-cli/README.md index d84a343b52..500cd833cc 100644 --- a/gen/dfareporting2d6-cli/README.md +++ b/gen/dfareporting2d6-cli/README.md @@ -24,7 +24,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *dfareporting* API at revision *20160803*. The CLI is at version *1.0.0*. +This documentation was generated from the *dfareporting* API at revision *20161027*. The CLI is at version *1.0.0*. ```bash dfareporting2d6 [options] diff --git a/gen/dfareporting2d6-cli/mkdocs.yml b/gen/dfareporting2d6-cli/mkdocs.yml index 6fde60e762..69ae248667 100644 --- a/gen/dfareporting2d6-cli/mkdocs.yml +++ b/gen/dfareporting2d6-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: dfareporting v1.0.0+20160803 +site_name: dfareporting v1.0.0+20161027 site_url: http://byron.github.io/google-apis-rs/google-dfareporting2d6-cli site_description: Write integrating applications with bcore diff --git a/gen/dfareporting2d6-cli/src/main.rs b/gen/dfareporting2d6-cli/src/main.rs index 68e456ca6e..681d8ec09c 100644 --- a/gen/dfareporting2d6-cli/src/main.rs +++ b/gen/dfareporting2d6-cli/src/main.rs @@ -17839,7 +17839,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of account user profiles, possibly filtered."##), + Some(r##"Retrieves a list of account user profiles, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d6_cli/account-user-profiles_list", vec![ (Some(r##"profile-id"##), @@ -17954,7 +17954,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves the list of accounts, possibly filtered."##), + Some(r##"Retrieves the list of accounts, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d6_cli/accounts_list", vec![ (Some(r##"profile-id"##), @@ -18097,7 +18097,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of ads, possibly filtered."##), + Some(r##"Retrieves a list of ads, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d6_cli/ads_list", vec![ (Some(r##"profile-id"##), @@ -18262,7 +18262,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of advertiser groups, possibly filtered."##), + Some(r##"Retrieves a list of advertiser groups, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d6_cli/advertiser-groups_list", vec![ (Some(r##"profile-id"##), @@ -18405,7 +18405,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of advertisers, possibly filtered."##), + Some(r##"Retrieves a list of advertisers, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d6_cli/advertisers_list", vec![ (Some(r##"profile-id"##), @@ -18551,7 +18551,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves the list of creative IDs associated with the specified campaign."##), + Some(r##"Retrieves the list of creative IDs associated with the specified campaign. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d6_cli/campaign-creative-associations_list", vec![ (Some(r##"profile-id"##), @@ -18650,7 +18650,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of campaigns, possibly filtered."##), + Some(r##"Retrieves a list of campaigns, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d6_cli/campaigns_list", vec![ (Some(r##"profile-id"##), @@ -18765,7 +18765,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of change logs."##), + Some(r##"Retrieves a list of change logs. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d6_cli/change-logs_list", vec![ (Some(r##"profile-id"##), @@ -18946,7 +18946,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of content categories, possibly filtered."##), + Some(r##"Retrieves a list of content categories, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d6_cli/content-categories_list", vec![ (Some(r##"profile-id"##), @@ -19256,7 +19256,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of creative field values, possibly filtered."##), + Some(r##"Retrieves a list of creative field values, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d6_cli/creative-field-values_list", vec![ (Some(r##"profile-id"##), @@ -19439,7 +19439,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of creative fields, possibly filtered."##), + Some(r##"Retrieves a list of creative fields, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d6_cli/creative-fields_list", vec![ (Some(r##"profile-id"##), @@ -19582,7 +19582,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of creative groups, possibly filtered."##), + Some(r##"Retrieves a list of creative groups, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d6_cli/creative-groups_list", vec![ (Some(r##"profile-id"##), @@ -19725,7 +19725,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of creatives, possibly filtered."##), + Some(r##"Retrieves a list of creatives, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d6_cli/creatives_list", vec![ (Some(r##"profile-id"##), @@ -19871,7 +19871,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of directory site contacts, possibly filtered."##), + Some(r##"Retrieves a list of directory site contacts, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d6_cli/directory-site-contacts_list", vec![ (Some(r##"profile-id"##), @@ -19952,7 +19952,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of directory sites, possibly filtered."##), + Some(r##"Retrieves a list of directory sites, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d6_cli/directory-sites_list", vec![ (Some(r##"profile-id"##), @@ -20382,7 +20382,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of floodlight activities, possibly filtered."##), + Some(r##"Retrieves a list of floodlight activities, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d6_cli/floodlight-activities_list", vec![ (Some(r##"profile-id"##), @@ -20525,7 +20525,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of floodlight activity groups, possibly filtered."##), + Some(r##"Retrieves a list of floodlight activity groups, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d6_cli/floodlight-activity-groups_list", vec![ (Some(r##"profile-id"##), @@ -20761,7 +20761,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of inventory items, possibly filtered."##), + Some(r##"Retrieves a list of inventory items, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d6_cli/inventory-items_list", vec![ (Some(r##"profile-id"##), @@ -21236,7 +21236,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of order documents, possibly filtered."##), + Some(r##"Retrieves a list of order documents, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d6_cli/order-documents_list", vec![ (Some(r##"profile-id"##), @@ -21301,7 +21301,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of orders, possibly filtered."##), + Some(r##"Retrieves a list of orders, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d6_cli/orders_list", vec![ (Some(r##"profile-id"##), @@ -21388,7 +21388,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of placement groups, possibly filtered."##), + Some(r##"Retrieves a list of placement groups, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d6_cli/placement-groups_list", vec![ (Some(r##"profile-id"##), @@ -21553,7 +21553,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of placement strategies, possibly filtered."##), + Some(r##"Retrieves a list of placement strategies, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d6_cli/placement-strategies_list", vec![ (Some(r##"profile-id"##), @@ -21718,7 +21718,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of placements, possibly filtered."##), + Some(r##"Retrieves a list of placements, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d6_cli/placements_list", vec![ (Some(r##"profile-id"##), @@ -21939,7 +21939,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of projects, possibly filtered."##), + Some(r##"Retrieves a list of projects, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d6_cli/projects_list", vec![ (Some(r##"profile-id"##), @@ -22138,7 +22138,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of remarketing lists, possibly filtered."##), + Some(r##"Retrieves a list of remarketing lists, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d6_cli/remarketing-lists_list", vec![ (Some(r##"profile-id"##), @@ -22576,7 +22576,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of sites, possibly filtered."##), + Some(r##"Retrieves a list of sites, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d6_cli/sites_list", vec![ (Some(r##"profile-id"##), @@ -22800,7 +22800,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Gets a list of subaccounts, possibly filtered."##), + Some(r##"Gets a list of subaccounts, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d6_cli/subaccounts_list", vec![ (Some(r##"profile-id"##), @@ -22915,7 +22915,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of targetable remarketing lists, possibly filtered."##), + Some(r##"Retrieves a list of targetable remarketing lists, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d6_cli/targetable-remarketing-lists_list", vec![ (Some(r##"profile-id"##), @@ -23002,7 +23002,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of targeting templates, optionally filtered."##), + Some(r##"Retrieves a list of targeting templates, optionally filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d6_cli/targeting-templates_list", vec![ (Some(r##"profile-id"##), @@ -23314,7 +23314,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of user roles, possibly filtered."##), + Some(r##"Retrieves a list of user roles, possibly filtered. This method supports paging."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d6_cli/user-roles_list", vec![ (Some(r##"profile-id"##), @@ -23403,7 +23403,7 @@ fn main() { let mut app = App::new("dfareporting2d6") .author("Sebastian Thiel ") - .version("1.0.0+20160803") + .version("1.0.0+20161027") .about("Manages your DoubleClick Campaign Manager ad campaigns and reports.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_dfareporting2d6_cli") .arg(Arg::with_name("url") diff --git a/gen/dfareporting2d6/Cargo.toml b/gen/dfareporting2d6/Cargo.toml index 626618c9cd..44ab514d9a 100644 --- a/gen/dfareporting2d6/Cargo.toml +++ b/gen/dfareporting2d6/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-dfareporting2d6" -version = "1.0.0+20160803" +version = "1.0.0+20161027" authors = ["Sebastian Thiel "] description = "A complete library to interact with dfareporting (protocol v2.6)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/dfareporting2d6" diff --git a/gen/dfareporting2d6/README.md b/gen/dfareporting2d6/README.md index 24459e0247..1221b0eed5 100644 --- a/gen/dfareporting2d6/README.md +++ b/gen/dfareporting2d6/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-dfareporting2d6` library allows access to all features of the *Google dfareporting* service. -This documentation was generated from *dfareporting* crate version *1.0.0+20160803*, where *20160803* is the exact revision of the *dfareporting:v2.6* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *dfareporting* crate version *1.0.0+20161027*, where *20161027* is the exact revision of the *dfareporting:v2.6* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *dfareporting* *v2d6* API can be found at the [official documentation site](https://developers.google.com/doubleclick-advertisers/). diff --git a/gen/dfareporting2d6/src/lib.rs b/gen/dfareporting2d6/src/lib.rs index e6b122b546..f46f0c8570 100644 --- a/gen/dfareporting2d6/src/lib.rs +++ b/gen/dfareporting2d6/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *dfareporting* crate version *1.0.0+20160803*, where *20160803* is the exact revision of the *dfareporting:v2.6* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *dfareporting* crate version *1.0.0+20161027*, where *20161027* is the exact revision of the *dfareporting:v2.6* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *dfareporting* *v2d6* API can be found at the //! [official documentation site](https://developers.google.com/doubleclick-advertisers/). diff --git a/gen/dfareporting2d6/src/lib.rs.in b/gen/dfareporting2d6/src/lib.rs.in index cd8fa2ce57..88dd0e409d 100644 --- a/gen/dfareporting2d6/src/lib.rs.in +++ b/gen/dfareporting2d6/src/lib.rs.in @@ -397,7 +397,7 @@ pub struct Conversion { pub encrypted_user_id_candidates: Option>, /// The value of the conversion. pub value: Option, - /// Whether the user has Limit Ad Tracking set. + /// Whether Limit Ad Tracking is enabled. When set to true, the conversion will be used for reporting but not targeting. This will prevent remarketing. #[serde(rename="limitAdTracking")] pub limit_ad_tracking: Option, /// The quantity of the conversion. @@ -6504,7 +6504,7 @@ pub struct Ad { pub id: Option, /// Size of this ad. Applicable when type is AD_SERVING_DEFAULT_AD. pub size: Option, - /// Whether this ad is archived. + /// Whether this ad is archived. When true, active must be false. pub archived: Option, /// Targeting template ID, used to apply preconfigured targeting information to this ad. This cannot be set while any of dayPartTargeting, geoTargeting, keyValueTargetingExpression, languageTargeting, remarketingListExpression, or technologyTargeting are set. Applicable when type is AD_SERVING_STANDARD_AD. #[serde(rename="targetingTemplateId")] @@ -6554,7 +6554,7 @@ pub struct Ad { /// Date and time that this ad should start serving. If creating an ad, this field must be a time in the future. This is a required field on insertion. #[serde(rename="startTime")] pub start_time: Option, - /// Whether this ad is active. + /// Whether this ad is active. When true, archived must be false. pub active: Option, /// Compatibility of this ad. Applicable when type is AD_SERVING_DEFAULT_AD. DISPLAY and DISPLAY_INTERSTITIAL refer to either rendering on desktop or on mobile devices or in mobile apps for regular or interstitial ads, respectively. APP and APP_INTERSTITIAL are only used for existing default ads. New mobile placements must be assigned DISPLAY or DISPLAY_INTERSTITIAL and default ads created for those placements will be limited to those compatibility types. IN_STREAM_VIDEO refers to rendering in-stream video ads developed with the VAST standard. pub compatibility: Option, @@ -7346,7 +7346,7 @@ impl<'a, C, A> OrderDocumentMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of order documents, possibly filtered. + /// Retrieves a list of order documents, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -7434,7 +7434,7 @@ impl<'a, C, A> CreativeFieldMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of creative fields, possibly filtered. + /// Retrieves a list of creative fields, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -7674,7 +7674,7 @@ impl<'a, C, A> UserRoleMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of user roles, possibly filtered. + /// Retrieves a list of user roles, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -8067,7 +8067,7 @@ impl<'a, C, A> CampaignCreativeAssociationMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the list of creative IDs associated with the specified campaign. + /// Retrieves the list of creative IDs associated with the specified campaign. This method supports paging. /// /// # Arguments /// @@ -8130,7 +8130,7 @@ impl<'a, C, A> ChangeLogMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of change logs. + /// Retrieves a list of change logs. This method supports paging. /// /// # Arguments /// @@ -8602,7 +8602,7 @@ impl<'a, C, A> AdvertiserMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of advertisers, possibly filtered. + /// Retrieves a list of advertisers, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -8812,7 +8812,7 @@ impl<'a, C, A> FloodlightActivityGroupMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of floodlight activity groups, possibly filtered. + /// Retrieves a list of floodlight activity groups, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -8975,7 +8975,7 @@ impl<'a, C, A> OrderMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of orders, possibly filtered. + /// Retrieves a list of orders, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -9140,7 +9140,7 @@ impl<'a, C, A> DirectorySiteContactMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of directory site contacts, possibly filtered. + /// Retrieves a list of directory site contacts, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -9315,7 +9315,7 @@ impl<'a, C, A> AdMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of ads, possibly filtered. + /// Retrieves a list of ads, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -9589,7 +9589,7 @@ impl<'a, C, A> TargetableRemarketingListMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of targetable remarketing lists, possibly filtered. + /// Retrieves a list of targetable remarketing lists, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -9693,7 +9693,7 @@ impl<'a, C, A> AdvertiserGroupMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of advertiser groups, possibly filtered. + /// Retrieves a list of advertiser groups, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -9873,7 +9873,7 @@ impl<'a, C, A> SiteMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of sites, possibly filtered. + /// Retrieves a list of sites, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -10005,7 +10005,7 @@ impl<'a, C, A> FloodlightActivityMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of floodlight activities, possibly filtered. + /// Retrieves a list of floodlight activities, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -10287,7 +10287,7 @@ impl<'a, C, A> CreativeGroupMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of creative groups, possibly filtered. + /// Retrieves a list of creative groups, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -10395,7 +10395,7 @@ impl<'a, C, A> TargetingTemplateMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of targeting templates, optionally filtered. + /// Retrieves a list of targeting templates, optionally filtered. This method supports paging. /// /// # Arguments /// @@ -10576,7 +10576,7 @@ impl<'a, C, A> SubaccountMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets a list of subaccounts, possibly filtered. + /// Gets a list of subaccounts, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -11013,7 +11013,7 @@ impl<'a, C, A> PlacementGroupMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of placement groups, possibly filtered. + /// Retrieves a list of placement groups, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -11168,7 +11168,7 @@ impl<'a, C, A> InventoryItemMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of inventory items, possibly filtered. + /// Retrieves a list of inventory items, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -11413,7 +11413,7 @@ impl<'a, C, A> ContentCategoryMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of content categories, possibly filtered. + /// Retrieves a list of content categories, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -11631,7 +11631,7 @@ impl<'a, C, A> CreativeMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of creatives, possibly filtered. + /// Retrieves a list of creatives, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -11808,7 +11808,7 @@ impl<'a, C, A> CampaignMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of campaigns, possibly filtered. + /// Retrieves a list of campaigns, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -12082,7 +12082,7 @@ impl<'a, C, A> RemarketingListMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of remarketing lists, possibly filtered. + /// Retrieves a list of remarketing lists, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -12289,7 +12289,7 @@ impl<'a, C, A> PlacementStrategyMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of placement strategies, possibly filtered. + /// Retrieves a list of placement strategies, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -12412,7 +12412,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of projects, possibly filtered. + /// Retrieves a list of projects, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -12515,7 +12515,7 @@ impl<'a, C, A> DirectorySiteMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of directory sites, possibly filtered. + /// Retrieves a list of directory sites, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -12888,7 +12888,7 @@ impl<'a, C, A> AccountUserProfileMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of account user profiles, possibly filtered. + /// Retrieves a list of account user profiles, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -13198,7 +13198,7 @@ impl<'a, C, A> CreativeFieldValueMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of creative field values, possibly filtered. + /// Retrieves a list of creative field values, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -13418,7 +13418,7 @@ impl<'a, C, A> AccountMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the list of accounts, possibly filtered. + /// Retrieves the list of accounts, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -13544,7 +13544,7 @@ impl<'a, C, A> PlacementMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of placements, possibly filtered. + /// Retrieves a list of placements, possibly filtered. This method supports paging. /// /// # Arguments /// @@ -15156,7 +15156,7 @@ impl<'a, C, A> OrderDocumentGetCall<'a, C, A> where C: BorrowMut, } -/// Retrieves a list of order documents, possibly filtered. +/// Retrieves a list of order documents, possibly filtered. This method supports paging. /// /// A builder for the *list* method supported by a *orderDocument* resource. /// It is not used directly, but through a `OrderDocumentMethods` instance. @@ -15786,7 +15786,7 @@ impl<'a, C, A> CreativeFieldUpdateCall<'a, C, A> where C: BorrowMut UserRolePatchCall<'a, C, A> where C: BorrowMut, A: } -/// Retrieves a list of user roles, possibly filtered. +/// Retrieves a list of user roles, possibly filtered. This method supports paging. /// /// A builder for the *list* method supported by a *userRole* resource. /// It is not used directly, but through a `UserRoleMethods` instance. @@ -21517,7 +21517,7 @@ impl<'a, C, A> CampaignCreativeAssociationInsertCall<'a, C, A> where C: BorrowMu } -/// Retrieves the list of creative IDs associated with the specified campaign. +/// Retrieves the list of creative IDs associated with the specified campaign. This method supports paging. /// /// A builder for the *list* method supported by a *campaignCreativeAssociation* resource. /// It is not used directly, but through a `CampaignCreativeAssociationMethods` instance. @@ -21800,7 +21800,7 @@ impl<'a, C, A> CampaignCreativeAssociationListCall<'a, C, A> where C: BorrowMut< } -/// Retrieves a list of change logs. +/// Retrieves a list of change logs. This method supports paging. /// /// A builder for the *list* method supported by a *changeLog* resource. /// It is not used directly, but through a `ChangeLogMethods` instance. @@ -26446,7 +26446,7 @@ impl<'a, C, A> AdvertiserPatchCall<'a, C, A> where C: BorrowMut, } -/// Retrieves a list of advertisers, possibly filtered. +/// Retrieves a list of advertisers, possibly filtered. This method supports paging. /// /// A builder for the *list* method supported by a *advertiser* resource. /// It is not used directly, but through a `AdvertiserMethods` instance. @@ -28162,7 +28162,7 @@ impl<'a, C, A> FloodlightActivityGroupPatchCall<'a, C, A> where C: BorrowMut MetroListCall<'a, C, A> where C: BorrowMut, A: oau } -/// Retrieves a list of orders, possibly filtered. +/// Retrieves a list of orders, possibly filtered. This method supports paging. /// /// A builder for the *list* method supported by a *order* resource. /// It is not used directly, but through a `OrderMethods` instance. @@ -30353,7 +30353,7 @@ impl<'a, C, A> DirectorySiteContactGetCall<'a, C, A> where C: BorrowMut AdInsertCall<'a, C, A> where C: BorrowMut, A: oaut } -/// Retrieves a list of ads, possibly filtered. +/// Retrieves a list of ads, possibly filtered. This method supports paging. /// /// A builder for the *list* method supported by a *ad* resource. /// It is not used directly, but through a `AdMethods` instance. @@ -33689,7 +33689,7 @@ impl<'a, C, A> ConnectionTypeGetCall<'a, C, A> where C: BorrowMut } -/// Retrieves a list of targetable remarketing lists, possibly filtered. +/// Retrieves a list of targetable remarketing lists, possibly filtered. This method supports paging. /// /// A builder for the *list* method supported by a *targetableRemarketingList* resource. /// It is not used directly, but through a `TargetableRemarketingListMethods` instance. @@ -34502,7 +34502,7 @@ impl<'a, C, A> AdvertiserGroupGetCall<'a, C, A> where C: BorrowMut SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth } -/// Retrieves a list of sites, possibly filtered. +/// Retrieves a list of sites, possibly filtered. This method supports paging. /// /// A builder for the *list* method supported by a *site* resource. /// It is not used directly, but through a `SiteMethods` instance. @@ -37586,7 +37586,7 @@ impl<'a, C, A> FloodlightActivityGetCall<'a, C, A> where C: BorrowMut CreativeGroupUpdateCall<'a, C, A> where C: BorrowMut TargetingTemplatePatchCall<'a, C, A> where C: BorrowMut SubaccountUpdateCall<'a, C, A> where C: BorrowMut, } -/// Gets a list of subaccounts, possibly filtered. +/// Gets a list of subaccounts, possibly filtered. This method supports paging. /// /// A builder for the *list* method supported by a *subaccount* resource. /// It is not used directly, but through a `SubaccountMethods` instance. @@ -46219,7 +46219,7 @@ impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth } -/// Retrieves a list of placement groups, possibly filtered. +/// Retrieves a list of placement groups, possibly filtered. This method supports paging. /// /// A builder for the *list* method supported by a *placementGroup* resource. /// It is not used directly, but through a `PlacementGroupMethods` instance. @@ -47763,7 +47763,7 @@ impl<'a, C, A> PlacementGroupPatchCall<'a, C, A> where C: BorrowMut AccountPermissionGroupGetCall<'a, C, A> where C: BorrowMut CreativeGetCall<'a, C, A> where C: BorrowMut, A: o } -/// Retrieves a list of creatives, possibly filtered. +/// Retrieves a list of creatives, possibly filtered. This method supports paging. /// /// A builder for the *list* method supported by a *creative* resource. /// It is not used directly, but through a `CreativeMethods` instance. @@ -53551,7 +53551,7 @@ impl<'a, C, A> CampaignUpdateCall<'a, C, A> where C: BorrowMut, A } -/// Retrieves a list of campaigns, possibly filtered. +/// Retrieves a list of campaigns, possibly filtered. This method supports paging. /// /// A builder for the *list* method supported by a *campaign* resource. /// It is not used directly, but through a `CampaignMethods` instance. @@ -56121,7 +56121,7 @@ impl<'a, C, A> RemarketingListUpdateCall<'a, C, A> where C: BorrowMut PlacementStrategyGetCall<'a, C, A> where C: BorrowMut PlacementStrategyPatchCall<'a, C, A> where C: BorrowMut DirectorySiteInsertCall<'a, C, A> where C: BorrowMut AccountUserProfileUpdateCall<'a, C, A> where C: BorrowMut CreativeFieldValueUpdateCall<'a, C, A> where C: BorrowMut AccountGetCall<'a, C, A> where C: BorrowMut, A: oa } -/// Retrieves the list of accounts, possibly filtered. +/// Retrieves the list of accounts, possibly filtered. This method supports paging. /// /// A builder for the *list* method supported by a *account* resource. /// It is not used directly, but through a `AccountMethods` instance. @@ -67896,7 +67896,7 @@ impl<'a, C, A> PlacementPatchCall<'a, C, A> where C: BorrowMut, A } -/// Retrieves a list of placements, possibly filtered. +/// Retrieves a list of placements, possibly filtered. This method supports paging. /// /// A builder for the *list* method supported by a *placement* resource. /// It is not used directly, but through a `PlacementMethods` instance. diff --git a/gen/dfareporting2d7-cli/Cargo.toml b/gen/dfareporting2d7-cli/Cargo.toml new file mode 100644 index 0000000000..3ab48815b6 --- /dev/null +++ b/gen/dfareporting2d7-cli/Cargo.toml @@ -0,0 +1,43 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-dfareporting2d7-cli" +version = "1.0.0+20161027" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with dfareporting (protocol v2.7)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/dfareporting2d7-cli" +homepage = "https://developers.google.com/doubleclick-advertisers/" +documentation = "http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli" +license = "MIT" +keywords = ["dfareporting", "google", "cli"] + +[[bin]] +name = "dfareporting2d7" + +[dependencies] +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.8" +serde_json = "^ 0.8" +yup-oauth2 = { version = "^ 1.0", optional = true, default-features = false } +serde_derive = { version = "^ 0.8", optional = true } +strsim = "^0.5" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-serde-codegen"] +nightly = ["serde_derive","yup-oauth2/nightly","google-dfareporting2d7/nightly"] +with-serde-codegen = ["serde_codegen","yup-oauth2/with-serde-codegen","google-dfareporting2d7/with-serde-codegen"] + +[build-dependencies] +serde_codegen = { version = "^ 0.8", optional = true } + + +[dependencies.google-dfareporting2d7] +path = "../dfareporting2d7" +version = "1.0.0" +optional = true +default-features = false diff --git a/gen/dfareporting2d7-cli/LICENSE.md b/gen/dfareporting2d7-cli/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/dfareporting2d7-cli/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/dfareporting2d7-cli/README.md b/gen/dfareporting2d7-cli/README.md new file mode 100644 index 0000000000..1d4626c183 --- /dev/null +++ b/gen/dfareporting2d7-cli/README.md @@ -0,0 +1,375 @@ + +The `dfareporting2d7` command-line interface *(CLI)* allows to use most features of the *Google dfareporting* service from the comfort of your terminal. + +By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's +capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero. + +If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. + +Everything else about the *dfareporting* API can be found at the +[official documentation site](https://developers.google.com/doubleclick-advertisers/). + +# Downloads + +You can download the pre-compiled 64bit binaries for the following platforms: + +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/1.0.0/ubuntu/dfareporting2d7.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/1.0.0/osx/dfareporting2d7.tar.gz) + +Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/dfareporting2d7-cli). + +# Usage + +This documentation was generated from the *dfareporting* API at revision *20161027*. The CLI is at version *1.0.0*. + +```bash +dfareporting2d7 [options] + account-active-ad-summaries + get [-p ]... [-o ] + account-permission-groups + get [-p ]... [-o ] + list [-p ]... [-o ] + account-permissions + get [-p ]... [-o ] + list [-p ]... [-o ] + account-user-profiles + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + accounts + get [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + ads + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + advertiser-groups + delete [-p ]... + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + advertisers + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + browsers + list [-p ]... [-o ] + campaign-creative-associations + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + campaigns + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + change-logs + get [-p ]... [-o ] + list [-p ]... [-o ] + cities + list [-p ]... [-o ] + connection-types + get [-p ]... [-o ] + list [-p ]... [-o ] + content-categories + delete [-p ]... + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + conversions + batchinsert (-r )... [-p ]... [-o ] + countries + get [-p ]... [-o ] + list [-p ]... [-o ] + creative-assets + insert (-r )... (-u (simple|resumable) -f [-m ]) [-p ]... [-o ] + creative-field-values + delete [-p ]... + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + creative-fields + delete [-p ]... + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + creative-groups + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + creatives + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + dimension-values + query (-r )... [-p ]... [-o ] + directory-site-contacts + get [-p ]... [-o ] + list [-p ]... [-o ] + directory-sites + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + dynamic-targeting-keys + delete [-p ]... + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + event-tags + delete [-p ]... + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + files + get [-p ]... [-o ] + list [-p ]... [-o ] + floodlight-activities + delete [-p ]... + generatetag [-p ]... [-o ] + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + floodlight-activity-groups + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + floodlight-configurations + get [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + inventory-items + get [-p ]... [-o ] + list [-p ]... [-o ] + landing-pages + delete [-p ]... + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + languages + list [-p ]... [-o ] + metros + list [-p ]... [-o ] + mobile-carriers + get [-p ]... [-o ] + list [-p ]... [-o ] + operating-system-versions + get [-p ]... [-o ] + list [-p ]... [-o ] + operating-systems + get [-p ]... [-o ] + list [-p ]... [-o ] + order-documents + get [-p ]... [-o ] + list [-p ]... [-o ] + orders + get [-p ]... [-o ] + list [-p ]... [-o ] + placement-groups + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + placement-strategies + delete [-p ]... + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + placements + generatetags [-p ]... [-o ] + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + platform-types + get [-p ]... [-o ] + list [-p ]... [-o ] + postal-codes + get [-p ]... [-o ] + list [-p ]... [-o ] + projects + get [-p ]... [-o ] + list [-p ]... [-o ] + regions + list [-p ]... [-o ] + remarketing-list-shares + get [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + remarketing-lists + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + reports + compatible-fields-query (-r )... [-p ]... [-o ] + delete [-p ]... + files-get [-p ]... [-o ] + files-list [-p ]... [-o ] + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + run [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + sites + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + sizes + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + subaccounts + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + targetable-remarketing-lists + get [-p ]... [-o ] + list [-p ]... [-o ] + targeting-templates + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + user-profiles + get [-p ]... [-o ] + list [-p ]... [-o ] + user-role-permission-groups + get [-p ]... [-o ] + list [-p ]... [-o ] + user-role-permissions + get [-p ]... [-o ] + list [-p ]... [-o ] + user-roles + delete [-p ]... + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + video-formats + get [-p ]... [-o ] + list [-p ]... [-o ] + dfareporting2d7 --help + +Configuration: + [--scope ]... + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. + If unset, it defaults to the shortest scope url for a particular method. + --config-dir + A directory into which we will store our persistent data. Defaults to + a user-writable directory that we will create during the first invocation. + [default: ~/.google-service-cli] + --debug + Output all server communication to standard error. `tx` and `rx` are placed + into the same stream. + --debug-auth + Output all communication related to authentication to standard error. `tx` + and `rx` are placed into the same stream. + +``` + +# Configuration + +The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `dfareporting2d7-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis. + +More information about the various kinds of persistent data are given in the following paragraphs. + +# Authentication + +Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the +set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*. + +If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a +method that is read-only, it will ask only for a read-only scope. +You may use the `--scope` flag to specify a scope directly. +All applicable scopes are documented in the respective method's CLI documentation. + +The first time a scope is used, the user is asked for permission. Follow the instructions given +by the CLI to grant permissions, or to decline. + +If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration +directory, e.g. `~/.google-service-cli/dfareporting2d7-token-.json`. No manual management of these tokens +is necessary. + +To revoke granted authentication, please refer to the [official documentation][revoke-access]. + +# Application Secrets + +In order to allow any application to use Google services, it will need to be registered using the +[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it +one by one. Most APIs can be used for free and have a daily quota. + +To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI +comes with a default application secret that is configured accordingly. This also means that heavy usage +all around the world may deplete the daily quota. + +You can workaround this limitation by putting your own secrets file at this location: +`~/.google-service-cli/dfareporting2d7-secret.json`, assuming that the required *dfareporting* API +was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at +*APIs & auth -> Credentials -> Download JSON* and used as is. + +Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new]. + + +# Debugging + +Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know +what exactly led to a particular issue. This is done by allowing all client-server communication to be +output to standard error *as-is*. + +The `--debug` flag will print all client-server communication to standard error, whereas the `--debug-auth` flag +will cause all communication related to authentication to standard error. +If the `--debug` flag is set, error-results will be debug-printed, possibly yielding more information about the +issue at hand. + +You may consider redirecting standard error into a file for ease of use, e.g. `dfareporting2d7 --debug [options] 2>debug.txt`. + + +[scopes]: https://developers.google.com/+/api/oauth#scopes +[revoke-access]: http://webapps.stackexchange.com/a/30849 +[google-dev-console]: https://console.developers.google.com/ +[google-project-new]: https://developers.google.com/console/help/new/ \ No newline at end of file diff --git a/gen/dfareporting2d7-cli/mkdocs.yml b/gen/dfareporting2d7-cli/mkdocs.yml new file mode 100644 index 0000000000..911447272d --- /dev/null +++ b/gen/dfareporting2d7-cli/mkdocs.yml @@ -0,0 +1,220 @@ +site_name: dfareporting v1.0.0+20161027 +site_url: http://byron.github.io/google-apis-rs/google-dfareporting2d7-cli +site_description: Write integrating applications with bcore + +repo_url: https://github.com/Byron/google-apis-rs/tree/master/gen/dfareporting2d7-cli + +docs_dir: docs +site_dir: build_html + +pages: +- ['index.md', 'Home'] +- ['account-active-ad-summaries_get.md', 'Account Active Ad Summaries', 'Get'] +- ['account-permission-groups_get.md', 'Account Permission Groups', 'Get'] +- ['account-permission-groups_list.md', 'Account Permission Groups', 'List'] +- ['account-permissions_get.md', 'Account Permissions', 'Get'] +- ['account-permissions_list.md', 'Account Permissions', 'List'] +- ['account-user-profiles_get.md', 'Account User Profiles', 'Get'] +- ['account-user-profiles_insert.md', 'Account User Profiles', 'Insert'] +- ['account-user-profiles_list.md', 'Account User Profiles', 'List'] +- ['account-user-profiles_patch.md', 'Account User Profiles', 'Patch'] +- ['account-user-profiles_update.md', 'Account User Profiles', 'Update'] +- ['accounts_get.md', 'Accounts', 'Get'] +- ['accounts_list.md', 'Accounts', 'List'] +- ['accounts_patch.md', 'Accounts', 'Patch'] +- ['accounts_update.md', 'Accounts', 'Update'] +- ['ads_get.md', 'Ads', 'Get'] +- ['ads_insert.md', 'Ads', 'Insert'] +- ['ads_list.md', 'Ads', 'List'] +- ['ads_patch.md', 'Ads', 'Patch'] +- ['ads_update.md', 'Ads', 'Update'] +- ['advertiser-groups_delete.md', 'Advertiser Groups', 'Delete'] +- ['advertiser-groups_get.md', 'Advertiser Groups', 'Get'] +- ['advertiser-groups_insert.md', 'Advertiser Groups', 'Insert'] +- ['advertiser-groups_list.md', 'Advertiser Groups', 'List'] +- ['advertiser-groups_patch.md', 'Advertiser Groups', 'Patch'] +- ['advertiser-groups_update.md', 'Advertiser Groups', 'Update'] +- ['advertisers_get.md', 'Advertisers', 'Get'] +- ['advertisers_insert.md', 'Advertisers', 'Insert'] +- ['advertisers_list.md', 'Advertisers', 'List'] +- ['advertisers_patch.md', 'Advertisers', 'Patch'] +- ['advertisers_update.md', 'Advertisers', 'Update'] +- ['browsers_list.md', 'Browsers', 'List'] +- ['campaign-creative-associations_insert.md', 'Campaign Creative Associations', 'Insert'] +- ['campaign-creative-associations_list.md', 'Campaign Creative Associations', 'List'] +- ['campaigns_get.md', 'Campaigns', 'Get'] +- ['campaigns_insert.md', 'Campaigns', 'Insert'] +- ['campaigns_list.md', 'Campaigns', 'List'] +- ['campaigns_patch.md', 'Campaigns', 'Patch'] +- ['campaigns_update.md', 'Campaigns', 'Update'] +- ['change-logs_get.md', 'Change Logs', 'Get'] +- ['change-logs_list.md', 'Change Logs', 'List'] +- ['cities_list.md', 'Cities', 'List'] +- ['connection-types_get.md', 'Connection Types', 'Get'] +- ['connection-types_list.md', 'Connection Types', 'List'] +- ['content-categories_delete.md', 'Content Categories', 'Delete'] +- ['content-categories_get.md', 'Content Categories', 'Get'] +- ['content-categories_insert.md', 'Content Categories', 'Insert'] +- ['content-categories_list.md', 'Content Categories', 'List'] +- ['content-categories_patch.md', 'Content Categories', 'Patch'] +- ['content-categories_update.md', 'Content Categories', 'Update'] +- ['conversions_batchinsert.md', 'Conversions', 'Batchinsert'] +- ['countries_get.md', 'Countries', 'Get'] +- ['countries_list.md', 'Countries', 'List'] +- ['creative-assets_insert.md', 'Creative Assets', 'Insert'] +- ['creative-field-values_delete.md', 'Creative Field Values', 'Delete'] +- ['creative-field-values_get.md', 'Creative Field Values', 'Get'] +- ['creative-field-values_insert.md', 'Creative Field Values', 'Insert'] +- ['creative-field-values_list.md', 'Creative Field Values', 'List'] +- ['creative-field-values_patch.md', 'Creative Field Values', 'Patch'] +- ['creative-field-values_update.md', 'Creative Field Values', 'Update'] +- ['creative-fields_delete.md', 'Creative Fields', 'Delete'] +- ['creative-fields_get.md', 'Creative Fields', 'Get'] +- ['creative-fields_insert.md', 'Creative Fields', 'Insert'] +- ['creative-fields_list.md', 'Creative Fields', 'List'] +- ['creative-fields_patch.md', 'Creative Fields', 'Patch'] +- ['creative-fields_update.md', 'Creative Fields', 'Update'] +- ['creative-groups_get.md', 'Creative Groups', 'Get'] +- ['creative-groups_insert.md', 'Creative Groups', 'Insert'] +- ['creative-groups_list.md', 'Creative Groups', 'List'] +- ['creative-groups_patch.md', 'Creative Groups', 'Patch'] +- ['creative-groups_update.md', 'Creative Groups', 'Update'] +- ['creatives_get.md', 'Creatives', 'Get'] +- ['creatives_insert.md', 'Creatives', 'Insert'] +- ['creatives_list.md', 'Creatives', 'List'] +- ['creatives_patch.md', 'Creatives', 'Patch'] +- ['creatives_update.md', 'Creatives', 'Update'] +- ['dimension-values_query.md', 'Dimension Values', 'Query'] +- ['directory-site-contacts_get.md', 'Directory Site Contacts', 'Get'] +- ['directory-site-contacts_list.md', 'Directory Site Contacts', 'List'] +- ['directory-sites_get.md', 'Directory Sites', 'Get'] +- ['directory-sites_insert.md', 'Directory Sites', 'Insert'] +- ['directory-sites_list.md', 'Directory Sites', 'List'] +- ['dynamic-targeting-keys_delete.md', 'Dynamic Targeting Keys', 'Delete'] +- ['dynamic-targeting-keys_insert.md', 'Dynamic Targeting Keys', 'Insert'] +- ['dynamic-targeting-keys_list.md', 'Dynamic Targeting Keys', 'List'] +- ['event-tags_delete.md', 'Event Tags', 'Delete'] +- ['event-tags_get.md', 'Event Tags', 'Get'] +- ['event-tags_insert.md', 'Event Tags', 'Insert'] +- ['event-tags_list.md', 'Event Tags', 'List'] +- ['event-tags_patch.md', 'Event Tags', 'Patch'] +- ['event-tags_update.md', 'Event Tags', 'Update'] +- ['files_get.md', 'Files', 'Get'] +- ['files_list.md', 'Files', 'List'] +- ['floodlight-activities_delete.md', 'Floodlight Activities', 'Delete'] +- ['floodlight-activities_generatetag.md', 'Floodlight Activities', 'Generatetag'] +- ['floodlight-activities_get.md', 'Floodlight Activities', 'Get'] +- ['floodlight-activities_insert.md', 'Floodlight Activities', 'Insert'] +- ['floodlight-activities_list.md', 'Floodlight Activities', 'List'] +- ['floodlight-activities_patch.md', 'Floodlight Activities', 'Patch'] +- ['floodlight-activities_update.md', 'Floodlight Activities', 'Update'] +- ['floodlight-activity-groups_get.md', 'Floodlight Activity Groups', 'Get'] +- ['floodlight-activity-groups_insert.md', 'Floodlight Activity Groups', 'Insert'] +- ['floodlight-activity-groups_list.md', 'Floodlight Activity Groups', 'List'] +- ['floodlight-activity-groups_patch.md', 'Floodlight Activity Groups', 'Patch'] +- ['floodlight-activity-groups_update.md', 'Floodlight Activity Groups', 'Update'] +- ['floodlight-configurations_get.md', 'Floodlight Configurations', 'Get'] +- ['floodlight-configurations_list.md', 'Floodlight Configurations', 'List'] +- ['floodlight-configurations_patch.md', 'Floodlight Configurations', 'Patch'] +- ['floodlight-configurations_update.md', 'Floodlight Configurations', 'Update'] +- ['inventory-items_get.md', 'Inventory Items', 'Get'] +- ['inventory-items_list.md', 'Inventory Items', 'List'] +- ['landing-pages_delete.md', 'Landing Pages', 'Delete'] +- ['landing-pages_get.md', 'Landing Pages', 'Get'] +- ['landing-pages_insert.md', 'Landing Pages', 'Insert'] +- ['landing-pages_list.md', 'Landing Pages', 'List'] +- ['landing-pages_patch.md', 'Landing Pages', 'Patch'] +- ['landing-pages_update.md', 'Landing Pages', 'Update'] +- ['languages_list.md', 'Languages', 'List'] +- ['metros_list.md', 'Metros', 'List'] +- ['mobile-carriers_get.md', 'Mobile Carriers', 'Get'] +- ['mobile-carriers_list.md', 'Mobile Carriers', 'List'] +- ['operating-system-versions_get.md', 'Operating System Versions', 'Get'] +- ['operating-system-versions_list.md', 'Operating System Versions', 'List'] +- ['operating-systems_get.md', 'Operating Systems', 'Get'] +- ['operating-systems_list.md', 'Operating Systems', 'List'] +- ['order-documents_get.md', 'Order Documents', 'Get'] +- ['order-documents_list.md', 'Order Documents', 'List'] +- ['orders_get.md', 'Orders', 'Get'] +- ['orders_list.md', 'Orders', 'List'] +- ['placement-groups_get.md', 'Placement Groups', 'Get'] +- ['placement-groups_insert.md', 'Placement Groups', 'Insert'] +- ['placement-groups_list.md', 'Placement Groups', 'List'] +- ['placement-groups_patch.md', 'Placement Groups', 'Patch'] +- ['placement-groups_update.md', 'Placement Groups', 'Update'] +- ['placement-strategies_delete.md', 'Placement Strategies', 'Delete'] +- ['placement-strategies_get.md', 'Placement Strategies', 'Get'] +- ['placement-strategies_insert.md', 'Placement Strategies', 'Insert'] +- ['placement-strategies_list.md', 'Placement Strategies', 'List'] +- ['placement-strategies_patch.md', 'Placement Strategies', 'Patch'] +- ['placement-strategies_update.md', 'Placement Strategies', 'Update'] +- ['placements_generatetags.md', 'Placements', 'Generatetags'] +- ['placements_get.md', 'Placements', 'Get'] +- ['placements_insert.md', 'Placements', 'Insert'] +- ['placements_list.md', 'Placements', 'List'] +- ['placements_patch.md', 'Placements', 'Patch'] +- ['placements_update.md', 'Placements', 'Update'] +- ['platform-types_get.md', 'Platform Types', 'Get'] +- ['platform-types_list.md', 'Platform Types', 'List'] +- ['postal-codes_get.md', 'Postal Codes', 'Get'] +- ['postal-codes_list.md', 'Postal Codes', 'List'] +- ['projects_get.md', 'Projects', 'Get'] +- ['projects_list.md', 'Projects', 'List'] +- ['regions_list.md', 'Regions', 'List'] +- ['remarketing-list-shares_get.md', 'Remarketing List Shares', 'Get'] +- ['remarketing-list-shares_patch.md', 'Remarketing List Shares', 'Patch'] +- ['remarketing-list-shares_update.md', 'Remarketing List Shares', 'Update'] +- ['remarketing-lists_get.md', 'Remarketing Lists', 'Get'] +- ['remarketing-lists_insert.md', 'Remarketing Lists', 'Insert'] +- ['remarketing-lists_list.md', 'Remarketing Lists', 'List'] +- ['remarketing-lists_patch.md', 'Remarketing Lists', 'Patch'] +- ['remarketing-lists_update.md', 'Remarketing Lists', 'Update'] +- ['reports_compatible-fields-query.md', 'Reports', 'Compatible Fields Query'] +- ['reports_delete.md', 'Reports', 'Delete'] +- ['reports_files-get.md', 'Reports', 'Files Get'] +- ['reports_files-list.md', 'Reports', 'Files List'] +- ['reports_get.md', 'Reports', 'Get'] +- ['reports_insert.md', 'Reports', 'Insert'] +- ['reports_list.md', 'Reports', 'List'] +- ['reports_patch.md', 'Reports', 'Patch'] +- ['reports_run.md', 'Reports', 'Run'] +- ['reports_update.md', 'Reports', 'Update'] +- ['sites_get.md', 'Sites', 'Get'] +- ['sites_insert.md', 'Sites', 'Insert'] +- ['sites_list.md', 'Sites', 'List'] +- ['sites_patch.md', 'Sites', 'Patch'] +- ['sites_update.md', 'Sites', 'Update'] +- ['sizes_get.md', 'Sizes', 'Get'] +- ['sizes_insert.md', 'Sizes', 'Insert'] +- ['sizes_list.md', 'Sizes', 'List'] +- ['subaccounts_get.md', 'Subaccounts', 'Get'] +- ['subaccounts_insert.md', 'Subaccounts', 'Insert'] +- ['subaccounts_list.md', 'Subaccounts', 'List'] +- ['subaccounts_patch.md', 'Subaccounts', 'Patch'] +- ['subaccounts_update.md', 'Subaccounts', 'Update'] +- ['targetable-remarketing-lists_get.md', 'Targetable Remarketing Lists', 'Get'] +- ['targetable-remarketing-lists_list.md', 'Targetable Remarketing Lists', 'List'] +- ['targeting-templates_get.md', 'Targeting Templates', 'Get'] +- ['targeting-templates_insert.md', 'Targeting Templates', 'Insert'] +- ['targeting-templates_list.md', 'Targeting Templates', 'List'] +- ['targeting-templates_patch.md', 'Targeting Templates', 'Patch'] +- ['targeting-templates_update.md', 'Targeting Templates', 'Update'] +- ['user-profiles_get.md', 'User Profiles', 'Get'] +- ['user-profiles_list.md', 'User Profiles', 'List'] +- ['user-role-permission-groups_get.md', 'User Role Permission Groups', 'Get'] +- ['user-role-permission-groups_list.md', 'User Role Permission Groups', 'List'] +- ['user-role-permissions_get.md', 'User Role Permissions', 'Get'] +- ['user-role-permissions_list.md', 'User Role Permissions', 'List'] +- ['user-roles_delete.md', 'User Roles', 'Delete'] +- ['user-roles_get.md', 'User Roles', 'Get'] +- ['user-roles_insert.md', 'User Roles', 'Insert'] +- ['user-roles_list.md', 'User Roles', 'List'] +- ['user-roles_patch.md', 'User Roles', 'Patch'] +- ['user-roles_update.md', 'User Roles', 'Update'] +- ['video-formats_get.md', 'Video Formats', 'Get'] +- ['video-formats_list.md', 'Video Formats', 'List'] + +theme: readthedocs + +copyright: Copyright © 2015-2016, `Sebastian Thiel` + diff --git a/gen/dfareporting2d7-cli/src/cmn.rs b/gen/dfareporting2d7-cli/src/cmn.rs new file mode 100644 index 0000000000..779c1dc086 --- /dev/null +++ b/gen/dfareporting2d7-cli/src/cmn.rs @@ -0,0 +1,721 @@ +// COPY OF 'src/rust/cli/cmn.rs' +// DO NOT EDIT +use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token}; +use serde_json as json; +use serde_json::value::Value; +use mime::Mime; +use clap::{App, SubCommand}; +use strsim; + +use std::fs; +use std::env; +use std::io; +use std::fmt; +use std::path::{Path, PathBuf}; +use std::str::FromStr; +use std::string::ToString; +use std::io::{Write, Read, stdout}; + +use std::default::Default; + +const FIELD_SEP: char = '.'; + + +pub enum ComplexType { + Pod, + Vec, + Map, +} + + // Null, + // Bool(bool), + // I64(i64), + // U64(u64), + // F64(f64), + // String(String), + +pub enum JsonType { + Boolean, + Int, + Uint, + Float, + String, +} + +pub struct JsonTypeInfo { + pub jtype: JsonType, + pub ctype: ComplexType, +} + +// Based on @erickt user comment. Thanks for the idea ! +// Remove all keys whose values are null from given value (changed in place) +pub fn remove_json_null_values(value: &mut Value) { + match *value { + Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} + +fn did_you_mean<'a>(v: &str, possible_values: &[&'a str]) -> Option<&'a str> { + + let mut candidate: Option<(f64, &str)> = None; + for pv in possible_values { + let confidence = strsim::jaro_winkler(v, pv); + if confidence > 0.8 && (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { + candidate = Some((confidence, pv)); + } + } + match candidate { + None => None, + Some((_, candidate)) => Some(candidate), + } +} + +pub enum CallType { + Upload(UploadProtocol), + Standard, +} + +arg_enum!{ + pub enum UploadProtocol { + Simple, + Resumable + } +} + +impl AsRef for UploadProtocol { + fn as_ref(&self) -> &str { + match *self { + UploadProtocol::Simple => "simple", + UploadProtocol::Resumable => "resumable" + } + } +} + +impl AsRef for CallType { + fn as_ref(&self) -> &str { + match *self { + CallType::Upload(ref proto) => proto.as_ref(), + CallType::Standard => "standard-request" + } + } +} + +#[derive(Clone, Default)] +pub struct FieldCursor(Vec); + +impl ToString for FieldCursor { + fn to_string(&self) -> String { + self.0.join(".") + } +} + +impl From<&'static str> for FieldCursor { + fn from(value: &'static str) -> FieldCursor { + let mut res = FieldCursor::default(); + res.set(value).unwrap(); + res + } +} + +impl FieldCursor { + pub fn set(&mut self, value: &str) -> Result<(), CLIError> { + if value.len() == 0 { + return Err(CLIError::Field(FieldError::Empty)) + } + + let mut first_is_field_sep = false; + let mut char_count: usize = 0; + let mut last_c = FIELD_SEP; + let mut num_conscutive_field_seps = 0; + + let mut field = String::new(); + let mut fields = self.0.clone(); + + let push_field = |fs: &mut Vec, f: &mut String| { + if f.len() > 0 { + fs.push(f.clone()); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + char_count += 1; + + if c == FIELD_SEP { + if cid == 0 { + first_is_field_sep = true; + } + num_conscutive_field_seps += 1; + if cid > 0 && last_c == FIELD_SEP { + if fields.pop().is_none() { + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))) + } + } else { + push_field(&mut fields, &mut field); + } + } else { + num_conscutive_field_seps = 0; + if cid == 1 { + if first_is_field_sep { + fields.truncate(0); + } + } + field.push(c); + } + + last_c = c; + } + + push_field(&mut fields, &mut field); + + if char_count == 1 && first_is_field_sep { + fields.truncate(0); + } + if char_count > 1 && num_conscutive_field_seps == 1 { + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + } + + self.0 = fields; + Ok(()) + } + + pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { + if value.len() == 0 { + return None + } + + let mut last_c = FIELD_SEP; + + let mut field = String::new(); + let mut output = String::new(); + + let push_field = |fs: &mut String, f: &mut String| { + if f.len() > 0 { + fs.push_str( + match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + if c == FIELD_SEP { + if last_c != FIELD_SEP { + push_field(&mut output, &mut field); + } + output.push(c); + } else { + field.push(c); + } + + last_c = c; + } + + push_field(&mut output, &mut field); + + if &output == value { + None + } else { + Some(output) + } + } + + pub fn set_json_value(&self, mut object: &mut Value, + value: &str, type_info: JsonTypeInfo, + err: &mut InvalidOptionsError, + orig_cursor: &FieldCursor) { + assert!(self.0.len() > 0); + + for field in &self.0[..self.0.len()-1] { + let tmp = object; + object = + match *tmp { + Value::Object(ref mut mapping) => { + mapping.entry(field.to_owned()).or_insert( + Value::Object(Default::default()) + ) + }, + _ => panic!("We don't expect non-object Values here ...") + }; + } + + match *object { + Value::Object(ref mut mapping) => { + let field = &self.0[self.0.len()-1]; + let to_jval = + |value: &str, jtype: JsonType, err: &mut InvalidOptionsError| + -> Value { + match jtype { + JsonType::Boolean => + Value::Bool(arg_from_str(value, err, &field, "boolean")), + JsonType::Int => + Value::I64(arg_from_str(value, err, &field, "int")), + JsonType::Uint => + Value::U64(arg_from_str(value, err, &field, "uint")), + JsonType::Float => + Value::F64(arg_from_str(value, err, &field, "float")), + JsonType::String => + Value::String(value.to_owned()), + } + }; + + match type_info.ctype { + ComplexType::Pod => { + if mapping.insert(field.to_owned(), to_jval(value, type_info.jtype, err)).is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + }, + ComplexType::Vec => { + match *mapping.entry(field.to_owned()) + .or_insert(Value::Array(Default::default())) { + Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), + _ => unreachable!() + } + }, + ComplexType::Map => { + let (key, value) = parse_kv_arg(value, err, true); + let jval = to_jval(value.unwrap_or(""), type_info.jtype, err); + + match *mapping.entry(field.to_owned()) + .or_insert(Value::Object(Default::default())) { + Value::Object(ref mut value_map) => { + if value_map.insert(key.to_owned(), jval).is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + _ => unreachable!() + } + } + } + }, + _ => unreachable!() + } + } + + pub fn num_fields(&self) -> usize { + self.0.len() + } +} + +pub fn parse_kv_arg<'a>(kv: &'a str, err: &mut InvalidOptionsError, for_hashmap: bool) + -> (&'a str, Option<&'a str>) { + let mut add_err = || err.issues.push(CLIError::InvalidKeyValueSyntax(kv.to_string(),for_hashmap)); + match kv.find('=') { + None => { + add_err(); + return (kv, None) + }, + Some(pos) => { + let key = &kv[..pos]; + if kv.len() <= pos + 1 { + add_err(); + return (key, Some("")) + } + (key, Some(&kv[pos+1..])) + } + } +} + +pub fn calltype_from_str(name: &str, valid_protocols: Vec, err: &mut InvalidOptionsError) -> CallType { + CallType::Upload( + match UploadProtocol::from_str(name) { + Ok(up) => up, + Err(msg) => { + err.issues.push(CLIError::InvalidUploadProtocol(name.to_string(), valid_protocols)); + UploadProtocol::Simple + } + }) +} + +pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> Option { + match fs::File::open(file_path) { + Ok(f) => Some(f), + Err(io_err) => { + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); + None + } + } +} + +pub fn input_mime_from_opts(mime: &str, err: &mut InvalidOptionsError) -> Option { + match mime.parse() { + Ok(m) => Some(m), + Err(_) => { + err.issues.push(CLIError::Input(InputError::Mime(mime.to_string()))); + None + } + } +} + +pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { + let f = arg.unwrap_or("-"); + match f { + "-" => Ok(Box::new(stdout())), + _ => match fs::OpenOptions::new().create(true).write(true).open(f) { + Ok(f) => Ok(Box::new(f)), + Err(io_err) => Err(io_err), + } + } +} + + +pub fn arg_from_str<'a, T>(arg: &str, err: &mut InvalidOptionsError, + arg_name: &'a str, + arg_type: &'a str) -> T + where T: FromStr + Default, + ::Err: fmt::Display { + match FromStr::from_str(arg) { + Err(perr) => { + err.issues.push( + CLIError::ParseError(arg_name.to_owned(), arg_type.to_owned(), arg.to_string(), format!("{}", perr)) + ); + Default::default() + }, + Ok(v) => v, + } +} + +pub struct JsonTokenStorage { + pub program_name: &'static str, + pub db_dir: String, +} + +impl JsonTokenStorage { + fn path(&self, scope_hash: u64) -> PathBuf { + Path::new(&self.db_dir).join(&format!("{}-token-{}.json", self.program_name, scope_hash)) + } +} + +impl TokenStorage for JsonTokenStorage { + type Error = json::Error; + + // NOTE: logging might be interesting, currently we swallow all errors + fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), json::Error> { + match token { + None => { + match fs::remove_file(self.path(scope_hash)) { + Err(err) => + match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(json::Error::Io(err)) + }, + Ok(_) => Ok(()), + } + } + Some(token) => { + match fs::OpenOptions::new().create(true).write(true).open(&self.path(scope_hash)) { + Ok(mut f) => { + match json::to_writer_pretty(&mut f, &token) { + Ok(_) => Ok(()), + Err(serde_err) => Err(serde_err), + } + }, + Err(io_err) => Err(json::Error::Io(io_err)) + } + } + } + } + + fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result, json::Error> { + match fs::File::open(&self.path(scope_hash)) { + Ok(f) => { + match json::de::from_reader(f) { + Ok(token) => Ok(Some(token)), + Err(err) => Err(err), + } + }, + Err(io_err) => { + match io_err.kind() { + io::ErrorKind::NotFound => Ok(None), + _ => Err(json::Error::Io(io_err)) + } + } + } + } +} + + +#[derive(Debug)] +pub enum ApplicationSecretError { + DecoderError((String, json::Error)), + FormatError(String), +} + +impl fmt::Display for ApplicationSecretError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ApplicationSecretError::DecoderError((ref path, ref err)) + => writeln!(f, "Could not decode file at '{}' with error: {}.", + path, err), + ApplicationSecretError::FormatError(ref path) + => writeln!(f, "'installed' field is unset in secret file at '{}'.", + path), + } + } +} + +#[derive(Debug)] +pub enum ConfigurationError { + DirectoryCreationFailed((String, io::Error)), + DirectoryUnset, + HomeExpansionFailed(String), + Secret(ApplicationSecretError), + Io((String, io::Error)), +} + +impl fmt::Display for ConfigurationError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ConfigurationError::DirectoryCreationFailed((ref dir, ref err)) + => writeln!(f, "Directory '{}' could not be created with error: {}.", dir, err), + ConfigurationError::DirectoryUnset + => writeln!(f, "--config-dir was unset or empty."), + ConfigurationError::HomeExpansionFailed(ref dir) + => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), + ConfigurationError::Secret(ref err) + => writeln!(f, "Secret -> {}", err), + ConfigurationError::Io((ref path, ref err)) + => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + } + } +} + +#[derive(Debug)] +pub enum InputError { + Io((String, io::Error)), + Mime(String), +} + +impl fmt::Display for InputError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + InputError::Io((ref file_path, ref io_err)) + => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), + InputError::Mime(ref mime) + => writeln!(f, "'{}' is not a known mime-type.", mime), + } + } +} + +#[derive(Debug)] +pub enum FieldError { + PopOnEmpty(String), + TrailingFieldSep(String), + Unknown(String, Option, Option), + Duplicate(String), + Empty, +} + + +impl fmt::Display for FieldError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + FieldError::PopOnEmpty(ref field) + => writeln!(f, "'{}': Cannot move up on empty field cursor.", field), + FieldError::TrailingFieldSep(ref field) + => writeln!(f, "'{}': Single field separator may not be last character.", field), + FieldError::Unknown(ref field, ref suggestion, ref value) => { + let suffix = + match *suggestion { + Some(ref s) => { + let kv = + match *value { + Some(ref v) => format!("{}={}", s, v), + None => s.clone(), + }; + format!(" Did you mean '{}' ?", kv) + }, + None => String::new(), + }; + writeln!(f, "Field '{}' does not exist.{}", field, suffix) + }, + FieldError::Duplicate(ref cursor) + => writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty + => writeln!(f, "Field names must not be empty."), + } + } +} + + +#[derive(Debug)] +pub enum CLIError { + Configuration(ConfigurationError), + ParseError(String, String, String, String), + UnknownParameter(String, Vec<&'static str>), + InvalidUploadProtocol(String, Vec), + InvalidKeyValueSyntax(String, bool), + Input(InputError), + Field(FieldError), + MissingCommandError, + MissingMethodError(String), +} + +impl fmt::Display for CLIError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + CLIError::Configuration(ref err) => write!(f, "Configuration -> {}", err), + CLIError::Input(ref err) => write!(f, "Input -> {}", err), + CLIError::Field(ref err) => write!(f, "Field -> {}", err), + CLIError::InvalidUploadProtocol(ref proto_name, ref valid_names) + => writeln!(f, "'{}' is not a valid upload protocol. Choose from one of {}.", proto_name, valid_names.join(", ")), + CLIError::ParseError(ref arg_name, ref type_name, ref value, ref err_desc) + => writeln!(f, "Failed to parse argument '{}' with value '{}' as {} with error: {}.", + arg_name, value, type_name, err_desc), + CLIError::UnknownParameter(ref param_name, ref possible_values) => { + let suffix = + match did_you_mean(param_name, &possible_values) { + Some(v) => format!(" Did you mean '{}' ?", v), + None => String::new(), + }; + write!(f, "Parameter '{}' is unknown.{}\n", param_name, suffix) + }, + CLIError::InvalidKeyValueSyntax(ref kv, is_hashmap) => { + let hashmap_info = if is_hashmap { "hashmap " } else { "" }; + writeln!(f, "'{}' does not match {}pattern =.", kv, hashmap_info) + }, + CLIError::MissingCommandError => writeln!(f, "Please specify the main sub-command."), + CLIError::MissingMethodError(ref cmd) => writeln!(f, "Please specify the method to call on the '{}' command.", cmd), + } + } +} + +#[derive(Debug)] +pub struct InvalidOptionsError { + pub issues: Vec, + pub exit_code: i32, +} + +impl fmt::Display for InvalidOptionsError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + for issue in &self.issues { + try!(issue.fmt(f)); + } + Ok(()) + } +} + +impl InvalidOptionsError { + pub fn single(err: CLIError, exit_code: i32) -> InvalidOptionsError { + InvalidOptionsError { + issues: vec![err], + exit_code: exit_code, + } + } + + pub fn new() -> InvalidOptionsError { + InvalidOptionsError { + issues: Vec::new(), + exit_code: 1, + } + } +} + +pub fn assure_config_dir_exists(dir: &str) -> Result { + let trdir = dir.trim(); + if trdir.len() == 0 { + return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + } + + let expanded_config_dir = + if trdir.as_bytes()[0] == b'~' { + match env::var("HOME").ok().or(env::var("UserProfile").ok()) { + None => return Err(CLIError::Configuration(ConfigurationError::HomeExpansionFailed(trdir.to_string()))), + Some(mut user) => { + user.push_str(&trdir[1..]); + user + } + } + } else { + trdir.to_string() + }; + + if let Err(err) = fs::create_dir(&expanded_config_dir) { + if err.kind() != io::ErrorKind::AlreadyExists { + return Err(CLIError::Configuration( + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))) + } + } + + Ok(expanded_config_dir) +} + +pub fn application_secret_from_directory(dir: &str, + secret_basename: &str, + json_console_secret: &str) + -> Result { + let secret_path = Path::new(dir).join(secret_basename); + let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); + let secret_io_error = |io_err: io::Error| { + Err(CLIError::Configuration(ConfigurationError::Io( + (secret_str(), io_err) + ))) + }; + + for _ in 0..2 { + match fs::File::open(&secret_path) { + Err(mut err) => { + if err.kind() == io::ErrorKind::NotFound { + // Write our built-in one - user may adjust the written file at will + + err = match fs::OpenOptions::new().create(true).write(true).open(&secret_path) { + Err(cfe) => cfe, + Ok(mut f) => { + // Assure we convert 'ugly' json string into pretty one + let console_secret: ConsoleApplicationSecret + = json::from_str(json_console_secret).unwrap(); + match json::to_writer_pretty(&mut f, &console_secret) { + Err(serde_err) => match serde_err { + json::Error::Io(err) => err, + _ => panic!("Unexpected serde error: {:#?}", serde_err) + }, + Ok(_) => continue, + } + } + }; + // fall through to IO error handling + } + return secret_io_error(err) + }, + Ok(f) => { + match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { + Err(json::Error::Io(err)) => + return secret_io_error(err), + Err(json_err) => + return Err(CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::DecoderError( + (secret_str(), json_err) + )))), + Ok(console_secret) => + match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( + CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::FormatError(secret_str()) + ))) + }, + } + } + } + } + unreachable!(); +} diff --git a/gen/dfareporting2d7-cli/src/main.rs b/gen/dfareporting2d7-cli/src/main.rs new file mode 100644 index 0000000000..4f1ccd2bd5 --- /dev/null +++ b/gen/dfareporting2d7-cli/src/main.rs @@ -0,0 +1,23736 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/cli/main.rs.mako' +// DO NOT EDIT ! +#![allow(unused_variables, unused_imports, dead_code, unused_mut)] + +#[macro_use] +extern crate clap; +extern crate yup_oauth2 as oauth2; +extern crate yup_hyper_mock as mock; +extern crate serde; +extern crate serde_json; +extern crate hyper; +extern crate mime; +extern crate strsim; +extern crate google_dfareporting2d7 as api; + +use std::env; +use std::io::{self, Write}; +use clap::{App, SubCommand, Arg}; + +mod cmn; + +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, + input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, + calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; + +use std::default::Default; +use std::str::FromStr; + +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; +use serde_json as json; +use clap::ArgMatches; + +enum DoitError { + IoError(String, io::Error), + ApiError(api::Error), +} + +struct Engine<'n> { + opt: ArgMatches<'n>, + hub: api::Dfareporting>, + gp: Vec<&'static str>, + gpm: Vec<(&'static str, &'static str)>, +} + + +impl<'n> Engine<'n> { + fn _account_active_ad_summaries_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.account_active_ad_summaries().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("summary-account-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _account_permission_groups_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.account_permission_groups().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _account_permission_groups_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.account_permission_groups().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _account_permissions_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.account_permissions().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _account_permissions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.account_permissions().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _account_user_profiles_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.account_user_profiles().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _account_user_profiles_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-role-filter.object-ids" => Some(("userRoleFilter.objectIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "user-role-filter.status" => Some(("userRoleFilter.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-role-filter.kind" => Some(("userRoleFilter.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "locale" => Some(("locale", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-filter.object-ids" => Some(("siteFilter.objectIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "site-filter.status" => Some(("siteFilter.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-filter.kind" => Some(("siteFilter.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "comments" => Some(("comments", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "trafficker-type" => Some(("traffickerType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-filter.object-ids" => Some(("advertiserFilter.objectIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "advertiser-filter.status" => Some(("advertiserFilter.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-filter.kind" => Some(("advertiserFilter.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-filter.object-ids" => Some(("campaignFilter.objectIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "campaign-filter.status" => Some(("campaignFilter.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-filter.kind" => Some(("campaignFilter.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "email" => Some(("email", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-role-id" => Some(("userRoleId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-access-type" => Some(("userAccessType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "advertiser-filter", "campaign-filter", "comments", "email", "id", "kind", "locale", "name", "object-ids", "site-filter", "status", "subaccount-id", "trafficker-type", "user-access-type", "user-role-filter", "user-role-id"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::AccountUserProfile = json::value::from_value(object).unwrap(); + let mut call = self.hub.account_user_profiles().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _account_user_profiles_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.account_user_profiles().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "user-role-id" => { + call = call.user_role_id(value.unwrap_or("")); + }, + "subaccount-id" => { + call = call.subaccount_id(value.unwrap_or("")); + }, + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "active" => { + call = call.active(arg_from_str(value.unwrap_or("false"), err, "active", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "subaccount-id", "sort-field", "ids", "max-results", "page-token", "user-role-id", "sort-order", "active"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _account_user_profiles_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-role-filter.object-ids" => Some(("userRoleFilter.objectIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "user-role-filter.status" => Some(("userRoleFilter.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-role-filter.kind" => Some(("userRoleFilter.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "locale" => Some(("locale", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-filter.object-ids" => Some(("siteFilter.objectIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "site-filter.status" => Some(("siteFilter.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-filter.kind" => Some(("siteFilter.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "comments" => Some(("comments", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "trafficker-type" => Some(("traffickerType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-filter.object-ids" => Some(("advertiserFilter.objectIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "advertiser-filter.status" => Some(("advertiserFilter.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-filter.kind" => Some(("advertiserFilter.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-filter.object-ids" => Some(("campaignFilter.objectIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "campaign-filter.status" => Some(("campaignFilter.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-filter.kind" => Some(("campaignFilter.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "email" => Some(("email", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-role-id" => Some(("userRoleId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-access-type" => Some(("userAccessType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "advertiser-filter", "campaign-filter", "comments", "email", "id", "kind", "locale", "name", "object-ids", "site-filter", "status", "subaccount-id", "trafficker-type", "user-access-type", "user-role-filter", "user-role-id"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::AccountUserProfile = json::value::from_value(object).unwrap(); + let mut call = self.hub.account_user_profiles().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _account_user_profiles_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-role-filter.object-ids" => Some(("userRoleFilter.objectIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "user-role-filter.status" => Some(("userRoleFilter.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-role-filter.kind" => Some(("userRoleFilter.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "locale" => Some(("locale", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-filter.object-ids" => Some(("siteFilter.objectIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "site-filter.status" => Some(("siteFilter.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-filter.kind" => Some(("siteFilter.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "comments" => Some(("comments", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "trafficker-type" => Some(("traffickerType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-filter.object-ids" => Some(("advertiserFilter.objectIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "advertiser-filter.status" => Some(("advertiserFilter.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-filter.kind" => Some(("advertiserFilter.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-filter.object-ids" => Some(("campaignFilter.objectIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "campaign-filter.status" => Some(("campaignFilter.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-filter.kind" => Some(("campaignFilter.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "email" => Some(("email", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-role-id" => Some(("userRoleId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-access-type" => Some(("userAccessType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "advertiser-filter", "campaign-filter", "comments", "email", "id", "kind", "locale", "name", "object-ids", "site-filter", "status", "subaccount-id", "trafficker-type", "user-access-type", "user-role-filter", "user-role-id"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::AccountUserProfile = json::value::from_value(object).unwrap(); + let mut call = self.hub.account_user_profiles().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _accounts_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.accounts().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _accounts_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.accounts().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "active" => { + call = call.active(arg_from_str(value.unwrap_or("false"), err, "active", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "sort-field", "ids", "max-results", "page-token", "sort-order", "active"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _accounts_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "teaser-size-limit" => Some(("teaserSizeLimit", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "available-permission-ids" => Some(("availablePermissionIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "maximum-image-size" => Some(("maximumImageSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "locale" => Some(("locale", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-creative-size-id" => Some(("defaultCreativeSizeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-permission-ids" => Some(("accountPermissionIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "account-profile" => Some(("accountProfile", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "nielsen-ocr-enabled" => Some(("nielsenOcrEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "reports-configuration.report-generation-time-zone-id" => Some(("reportsConfiguration.reportGenerationTimeZoneId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reports-configuration.exposure-to-conversion-enabled" => Some(("reportsConfiguration.exposureToConversionEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "reports-configuration.lookback-configuration.click-duration" => Some(("reportsConfiguration.lookbackConfiguration.clickDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "reports-configuration.lookback-configuration.post-impression-activities-duration" => Some(("reportsConfiguration.lookbackConfiguration.postImpressionActivitiesDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "currency-id" => Some(("currencyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "active-view-opt-out" => Some(("activeViewOptOut", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "active-ads-limit-tier" => Some(("activeAdsLimitTier", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "share-reports-with-twitter" => Some(("shareReportsWithTwitter", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "country-id" => Some(("countryId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-permission-ids", "account-profile", "active", "active-ads-limit-tier", "active-view-opt-out", "available-permission-ids", "click-duration", "country-id", "currency-id", "default-creative-size-id", "description", "exposure-to-conversion-enabled", "id", "kind", "locale", "lookback-configuration", "maximum-image-size", "name", "nielsen-ocr-enabled", "post-impression-activities-duration", "report-generation-time-zone-id", "reports-configuration", "share-reports-with-twitter", "teaser-size-limit"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Account = json::value::from_value(object).unwrap(); + let mut call = self.hub.accounts().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _accounts_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "teaser-size-limit" => Some(("teaserSizeLimit", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "available-permission-ids" => Some(("availablePermissionIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "maximum-image-size" => Some(("maximumImageSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "locale" => Some(("locale", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-creative-size-id" => Some(("defaultCreativeSizeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-permission-ids" => Some(("accountPermissionIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "account-profile" => Some(("accountProfile", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "nielsen-ocr-enabled" => Some(("nielsenOcrEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "reports-configuration.report-generation-time-zone-id" => Some(("reportsConfiguration.reportGenerationTimeZoneId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reports-configuration.exposure-to-conversion-enabled" => Some(("reportsConfiguration.exposureToConversionEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "reports-configuration.lookback-configuration.click-duration" => Some(("reportsConfiguration.lookbackConfiguration.clickDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "reports-configuration.lookback-configuration.post-impression-activities-duration" => Some(("reportsConfiguration.lookbackConfiguration.postImpressionActivitiesDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "currency-id" => Some(("currencyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "active-view-opt-out" => Some(("activeViewOptOut", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "active-ads-limit-tier" => Some(("activeAdsLimitTier", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "share-reports-with-twitter" => Some(("shareReportsWithTwitter", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "country-id" => Some(("countryId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-permission-ids", "account-profile", "active", "active-ads-limit-tier", "active-view-opt-out", "available-permission-ids", "click-duration", "country-id", "currency-id", "default-creative-size-id", "description", "exposure-to-conversion-enabled", "id", "kind", "locale", "lookback-configuration", "maximum-image-size", "name", "nielsen-ocr-enabled", "post-impression-activities-duration", "report-generation-time-zone-id", "reports-configuration", "share-reports-with-twitter", "teaser-size-limit"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Account = json::value::from_value(object).unwrap(); + let mut call = self.hub.accounts().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _ads_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.ads().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _ads_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "click-through-url-suffix-properties.click-through-url-suffix" => Some(("clickThroughUrlSuffixProperties.clickThroughUrlSuffix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url-suffix-properties.override-inherited-suffix" => Some(("clickThroughUrlSuffixProperties.overrideInheritedSuffix", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "campaign-id" => Some(("campaignId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "geo-targeting.exclude-countries" => Some(("geoTargeting.excludeCountries", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "delivery-schedule.priority" => Some(("deliverySchedule.priority", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery-schedule.hard-cutoff" => Some(("deliverySchedule.hardCutoff", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "delivery-schedule.frequency-cap.duration" => Some(("deliverySchedule.frequencyCap.duration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery-schedule.frequency-cap.impressions" => Some(("deliverySchedule.frequencyCap.impressions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery-schedule.impression-ratio" => Some(("deliverySchedule.impressionRatio", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "targeting-template-id" => Some(("targetingTemplateId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-rotation.weight-calculation-strategy" => Some(("creativeRotation.weightCalculationStrategy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-rotation.creative-optimization-configuration-id" => Some(("creativeRotation.creativeOptimizationConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-rotation.type" => Some(("creativeRotation.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url.computed-click-through-url" => Some(("clickThroughUrl.computedClickThroughUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url.custom-click-through-url" => Some(("clickThroughUrl.customClickThroughUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url.landing-page-id" => Some(("clickThroughUrl.landingPageId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url.default-landing-page" => Some(("clickThroughUrl.defaultLandingPage", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "comments" => Some(("comments", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "remarketing-list-expression.expression" => Some(("remarketingListExpression.expression", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.width" => Some(("size.width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "size.kind" => Some(("size.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.iab" => Some(("size.iab", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "size.id" => Some(("size.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.height" => Some(("size.height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-required" => Some(("sslRequired", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "audience-segment-id" => Some(("audienceSegmentId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "key-value-targeting-expression.expression" => Some(("keyValueTargetingExpression.expression", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.kind" => Some(("campaignIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.value" => Some(("campaignIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.dimension-name" => Some(("campaignIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.etag" => Some(("campaignIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.match-type" => Some(("campaignIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.id" => Some(("campaignIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-click-through-event-tag-properties.override-inherited-event-tag" => Some(("defaultClickThroughEventTagProperties.overrideInheritedEventTag", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "default-click-through-event-tag-properties.default-click-through-event-tag-id" => Some(("defaultClickThroughEventTagProperties.defaultClickThroughEventTagId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-info.time" => Some(("createInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "start-time" => Some(("startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "compatibility" => Some(("compatibility", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "day-part-targeting.user-local-time" => Some(("dayPartTargeting.userLocalTime", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "day-part-targeting.hours-of-day" => Some(("dayPartTargeting.hoursOfDay", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), + "day-part-targeting.days-of-week" => Some(("dayPartTargeting.daysOfWeek", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-compliant" => Some(("sslCompliant", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "end-time" => Some(("endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "dynamic-click-tracker" => Some(("dynamicClickTracker", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "advertiser-id", "advertiser-id-dimension-value", "archived", "audience-segment-id", "campaign-id", "campaign-id-dimension-value", "click-through-url", "click-through-url-suffix", "click-through-url-suffix-properties", "comments", "compatibility", "computed-click-through-url", "create-info", "creative-optimization-configuration-id", "creative-rotation", "custom-click-through-url", "day-part-targeting", "days-of-week", "default-click-through-event-tag-id", "default-click-through-event-tag-properties", "default-landing-page", "delivery-schedule", "dimension-name", "duration", "dynamic-click-tracker", "end-time", "etag", "exclude-countries", "expression", "frequency-cap", "geo-targeting", "hard-cutoff", "height", "hours-of-day", "iab", "id", "id-dimension-value", "impression-ratio", "impressions", "key-value-targeting-expression", "kind", "landing-page-id", "last-modified-info", "match-type", "name", "override-inherited-event-tag", "override-inherited-suffix", "priority", "remarketing-list-expression", "size", "ssl-compliant", "ssl-required", "start-time", "subaccount-id", "targeting-template-id", "time", "type", "user-local-time", "value", "weight-calculation-strategy", "width"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Ad = json::value::from_value(object).unwrap(); + let mut call = self.hub.ads().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _ads_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.ads().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "type" => { + call = call.add_type(value.unwrap_or("")); + }, + "ssl-required" => { + call = call.ssl_required(arg_from_str(value.unwrap_or("false"), err, "ssl-required", "boolean")); + }, + "ssl-compliant" => { + call = call.ssl_compliant(arg_from_str(value.unwrap_or("false"), err, "ssl-compliant", "boolean")); + }, + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "size-ids" => { + call = call.add_size_ids(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "remarketing-list-ids" => { + call = call.add_remarketing_list_ids(value.unwrap_or("")); + }, + "placement-ids" => { + call = call.add_placement_ids(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "overridden-event-tag-id" => { + call = call.overridden_event_tag_id(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "landing-page-ids" => { + call = call.add_landing_page_ids(value.unwrap_or("")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "dynamic-click-tracker" => { + call = call.dynamic_click_tracker(arg_from_str(value.unwrap_or("false"), err, "dynamic-click-tracker", "boolean")); + }, + "creative-optimization-configuration-ids" => { + call = call.add_creative_optimization_configuration_ids(value.unwrap_or("")); + }, + "creative-ids" => { + call = call.add_creative_ids(value.unwrap_or("")); + }, + "compatibility" => { + call = call.compatibility(value.unwrap_or("")); + }, + "campaign-ids" => { + call = call.add_campaign_ids(value.unwrap_or("")); + }, + "audience-segment-ids" => { + call = call.add_audience_segment_ids(value.unwrap_or("")); + }, + "archived" => { + call = call.archived(arg_from_str(value.unwrap_or("false"), err, "archived", "boolean")); + }, + "advertiser-id" => { + call = call.advertiser_id(value.unwrap_or("")); + }, + "active" => { + call = call.active(arg_from_str(value.unwrap_or("false"), err, "active", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["landing-page-ids", "overridden-event-tag-id", "campaign-ids", "archived", "creative-optimization-configuration-ids", "ssl-compliant", "size-ids", "page-token", "sort-order", "type", "ssl-required", "creative-ids", "max-results", "placement-ids", "active", "compatibility", "advertiser-id", "search-string", "sort-field", "audience-segment-ids", "ids", "remarketing-list-ids", "dynamic-click-tracker"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _ads_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "click-through-url-suffix-properties.click-through-url-suffix" => Some(("clickThroughUrlSuffixProperties.clickThroughUrlSuffix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url-suffix-properties.override-inherited-suffix" => Some(("clickThroughUrlSuffixProperties.overrideInheritedSuffix", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "campaign-id" => Some(("campaignId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "geo-targeting.exclude-countries" => Some(("geoTargeting.excludeCountries", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "delivery-schedule.priority" => Some(("deliverySchedule.priority", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery-schedule.hard-cutoff" => Some(("deliverySchedule.hardCutoff", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "delivery-schedule.frequency-cap.duration" => Some(("deliverySchedule.frequencyCap.duration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery-schedule.frequency-cap.impressions" => Some(("deliverySchedule.frequencyCap.impressions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery-schedule.impression-ratio" => Some(("deliverySchedule.impressionRatio", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "targeting-template-id" => Some(("targetingTemplateId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-rotation.weight-calculation-strategy" => Some(("creativeRotation.weightCalculationStrategy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-rotation.creative-optimization-configuration-id" => Some(("creativeRotation.creativeOptimizationConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-rotation.type" => Some(("creativeRotation.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url.computed-click-through-url" => Some(("clickThroughUrl.computedClickThroughUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url.custom-click-through-url" => Some(("clickThroughUrl.customClickThroughUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url.landing-page-id" => Some(("clickThroughUrl.landingPageId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url.default-landing-page" => Some(("clickThroughUrl.defaultLandingPage", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "comments" => Some(("comments", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "remarketing-list-expression.expression" => Some(("remarketingListExpression.expression", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.width" => Some(("size.width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "size.kind" => Some(("size.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.iab" => Some(("size.iab", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "size.id" => Some(("size.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.height" => Some(("size.height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-required" => Some(("sslRequired", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "audience-segment-id" => Some(("audienceSegmentId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "key-value-targeting-expression.expression" => Some(("keyValueTargetingExpression.expression", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.kind" => Some(("campaignIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.value" => Some(("campaignIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.dimension-name" => Some(("campaignIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.etag" => Some(("campaignIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.match-type" => Some(("campaignIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.id" => Some(("campaignIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-click-through-event-tag-properties.override-inherited-event-tag" => Some(("defaultClickThroughEventTagProperties.overrideInheritedEventTag", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "default-click-through-event-tag-properties.default-click-through-event-tag-id" => Some(("defaultClickThroughEventTagProperties.defaultClickThroughEventTagId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-info.time" => Some(("createInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "start-time" => Some(("startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "compatibility" => Some(("compatibility", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "day-part-targeting.user-local-time" => Some(("dayPartTargeting.userLocalTime", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "day-part-targeting.hours-of-day" => Some(("dayPartTargeting.hoursOfDay", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), + "day-part-targeting.days-of-week" => Some(("dayPartTargeting.daysOfWeek", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-compliant" => Some(("sslCompliant", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "end-time" => Some(("endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "dynamic-click-tracker" => Some(("dynamicClickTracker", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "advertiser-id", "advertiser-id-dimension-value", "archived", "audience-segment-id", "campaign-id", "campaign-id-dimension-value", "click-through-url", "click-through-url-suffix", "click-through-url-suffix-properties", "comments", "compatibility", "computed-click-through-url", "create-info", "creative-optimization-configuration-id", "creative-rotation", "custom-click-through-url", "day-part-targeting", "days-of-week", "default-click-through-event-tag-id", "default-click-through-event-tag-properties", "default-landing-page", "delivery-schedule", "dimension-name", "duration", "dynamic-click-tracker", "end-time", "etag", "exclude-countries", "expression", "frequency-cap", "geo-targeting", "hard-cutoff", "height", "hours-of-day", "iab", "id", "id-dimension-value", "impression-ratio", "impressions", "key-value-targeting-expression", "kind", "landing-page-id", "last-modified-info", "match-type", "name", "override-inherited-event-tag", "override-inherited-suffix", "priority", "remarketing-list-expression", "size", "ssl-compliant", "ssl-required", "start-time", "subaccount-id", "targeting-template-id", "time", "type", "user-local-time", "value", "weight-calculation-strategy", "width"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Ad = json::value::from_value(object).unwrap(); + let mut call = self.hub.ads().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _ads_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "click-through-url-suffix-properties.click-through-url-suffix" => Some(("clickThroughUrlSuffixProperties.clickThroughUrlSuffix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url-suffix-properties.override-inherited-suffix" => Some(("clickThroughUrlSuffixProperties.overrideInheritedSuffix", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "campaign-id" => Some(("campaignId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "geo-targeting.exclude-countries" => Some(("geoTargeting.excludeCountries", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "delivery-schedule.priority" => Some(("deliverySchedule.priority", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery-schedule.hard-cutoff" => Some(("deliverySchedule.hardCutoff", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "delivery-schedule.frequency-cap.duration" => Some(("deliverySchedule.frequencyCap.duration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery-schedule.frequency-cap.impressions" => Some(("deliverySchedule.frequencyCap.impressions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery-schedule.impression-ratio" => Some(("deliverySchedule.impressionRatio", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "targeting-template-id" => Some(("targetingTemplateId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-rotation.weight-calculation-strategy" => Some(("creativeRotation.weightCalculationStrategy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-rotation.creative-optimization-configuration-id" => Some(("creativeRotation.creativeOptimizationConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-rotation.type" => Some(("creativeRotation.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url.computed-click-through-url" => Some(("clickThroughUrl.computedClickThroughUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url.custom-click-through-url" => Some(("clickThroughUrl.customClickThroughUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url.landing-page-id" => Some(("clickThroughUrl.landingPageId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url.default-landing-page" => Some(("clickThroughUrl.defaultLandingPage", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "comments" => Some(("comments", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "remarketing-list-expression.expression" => Some(("remarketingListExpression.expression", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.width" => Some(("size.width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "size.kind" => Some(("size.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.iab" => Some(("size.iab", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "size.id" => Some(("size.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.height" => Some(("size.height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-required" => Some(("sslRequired", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "audience-segment-id" => Some(("audienceSegmentId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "key-value-targeting-expression.expression" => Some(("keyValueTargetingExpression.expression", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.kind" => Some(("campaignIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.value" => Some(("campaignIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.dimension-name" => Some(("campaignIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.etag" => Some(("campaignIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.match-type" => Some(("campaignIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.id" => Some(("campaignIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-click-through-event-tag-properties.override-inherited-event-tag" => Some(("defaultClickThroughEventTagProperties.overrideInheritedEventTag", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "default-click-through-event-tag-properties.default-click-through-event-tag-id" => Some(("defaultClickThroughEventTagProperties.defaultClickThroughEventTagId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-info.time" => Some(("createInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "start-time" => Some(("startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "compatibility" => Some(("compatibility", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "day-part-targeting.user-local-time" => Some(("dayPartTargeting.userLocalTime", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "day-part-targeting.hours-of-day" => Some(("dayPartTargeting.hoursOfDay", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), + "day-part-targeting.days-of-week" => Some(("dayPartTargeting.daysOfWeek", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-compliant" => Some(("sslCompliant", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "end-time" => Some(("endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "dynamic-click-tracker" => Some(("dynamicClickTracker", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "advertiser-id", "advertiser-id-dimension-value", "archived", "audience-segment-id", "campaign-id", "campaign-id-dimension-value", "click-through-url", "click-through-url-suffix", "click-through-url-suffix-properties", "comments", "compatibility", "computed-click-through-url", "create-info", "creative-optimization-configuration-id", "creative-rotation", "custom-click-through-url", "day-part-targeting", "days-of-week", "default-click-through-event-tag-id", "default-click-through-event-tag-properties", "default-landing-page", "delivery-schedule", "dimension-name", "duration", "dynamic-click-tracker", "end-time", "etag", "exclude-countries", "expression", "frequency-cap", "geo-targeting", "hard-cutoff", "height", "hours-of-day", "iab", "id", "id-dimension-value", "impression-ratio", "impressions", "key-value-targeting-expression", "kind", "landing-page-id", "last-modified-info", "match-type", "name", "override-inherited-event-tag", "override-inherited-suffix", "priority", "remarketing-list-expression", "size", "ssl-compliant", "ssl-required", "start-time", "subaccount-id", "targeting-template-id", "time", "type", "user-local-time", "value", "weight-calculation-strategy", "width"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Ad = json::value::from_value(object).unwrap(); + let mut call = self.hub.ads().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _advertiser_groups_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.advertiser_groups().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _advertiser_groups_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.advertiser_groups().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _advertiser_groups_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "id", "kind", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::AdvertiserGroup = json::value::from_value(object).unwrap(); + let mut call = self.hub.advertiser_groups().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _advertiser_groups_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.advertiser_groups().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "sort-field", "ids", "max-results", "page-token", "sort-order"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _advertiser_groups_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "id", "kind", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::AdvertiserGroup = json::value::from_value(object).unwrap(); + let mut call = self.hub.advertiser_groups().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _advertiser_groups_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "id", "kind", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::AdvertiserGroup = json::value::from_value(object).unwrap(); + let mut call = self.hub.advertiser_groups().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _advertisers_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.advertisers().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _advertisers_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-click-through-event-tag-id" => Some(("defaultClickThroughEventTagId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "original-floodlight-configuration-id" => Some(("originalFloodlightConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url-suffix" => Some(("clickThroughUrlSuffix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id" => Some(("floodlightConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "suspended" => Some(("suspended", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.kind" => Some(("floodlightConfigurationIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.value" => Some(("floodlightConfigurationIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.dimension-name" => Some(("floodlightConfigurationIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.etag" => Some(("floodlightConfigurationIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.match-type" => Some(("floodlightConfigurationIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.id" => Some(("floodlightConfigurationIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-group-id" => Some(("advertiserGroupId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-email" => Some(("defaultEmail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-group-id", "click-through-url-suffix", "default-click-through-event-tag-id", "default-email", "dimension-name", "etag", "floodlight-configuration-id", "floodlight-configuration-id-dimension-value", "id", "id-dimension-value", "kind", "match-type", "name", "original-floodlight-configuration-id", "status", "subaccount-id", "suspended", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Advertiser = json::value::from_value(object).unwrap(); + let mut call = self.hub.advertisers().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _advertisers_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.advertisers().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "subaccount-id" => { + call = call.subaccount_id(value.unwrap_or("")); + }, + "status" => { + call = call.status(value.unwrap_or("")); + }, + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "only-parent" => { + call = call.only_parent(arg_from_str(value.unwrap_or("false"), err, "only-parent", "boolean")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "include-advertisers-without-groups-only" => { + call = call.include_advertisers_without_groups_only(arg_from_str(value.unwrap_or("false"), err, "include-advertisers-without-groups-only", "boolean")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "floodlight-configuration-ids" => { + call = call.add_floodlight_configuration_ids(value.unwrap_or("")); + }, + "advertiser-group-ids" => { + call = call.add_advertiser_group_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["status", "search-string", "subaccount-id", "include-advertisers-without-groups-only", "sort-field", "ids", "max-results", "page-token", "only-parent", "sort-order", "floodlight-configuration-ids", "advertiser-group-ids"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _advertisers_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-click-through-event-tag-id" => Some(("defaultClickThroughEventTagId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "original-floodlight-configuration-id" => Some(("originalFloodlightConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url-suffix" => Some(("clickThroughUrlSuffix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id" => Some(("floodlightConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "suspended" => Some(("suspended", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.kind" => Some(("floodlightConfigurationIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.value" => Some(("floodlightConfigurationIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.dimension-name" => Some(("floodlightConfigurationIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.etag" => Some(("floodlightConfigurationIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.match-type" => Some(("floodlightConfigurationIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.id" => Some(("floodlightConfigurationIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-group-id" => Some(("advertiserGroupId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-email" => Some(("defaultEmail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-group-id", "click-through-url-suffix", "default-click-through-event-tag-id", "default-email", "dimension-name", "etag", "floodlight-configuration-id", "floodlight-configuration-id-dimension-value", "id", "id-dimension-value", "kind", "match-type", "name", "original-floodlight-configuration-id", "status", "subaccount-id", "suspended", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Advertiser = json::value::from_value(object).unwrap(); + let mut call = self.hub.advertisers().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _advertisers_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-click-through-event-tag-id" => Some(("defaultClickThroughEventTagId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "original-floodlight-configuration-id" => Some(("originalFloodlightConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url-suffix" => Some(("clickThroughUrlSuffix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id" => Some(("floodlightConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "suspended" => Some(("suspended", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.kind" => Some(("floodlightConfigurationIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.value" => Some(("floodlightConfigurationIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.dimension-name" => Some(("floodlightConfigurationIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.etag" => Some(("floodlightConfigurationIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.match-type" => Some(("floodlightConfigurationIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.id" => Some(("floodlightConfigurationIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-group-id" => Some(("advertiserGroupId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-email" => Some(("defaultEmail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-group-id", "click-through-url-suffix", "default-click-through-event-tag-id", "default-email", "dimension-name", "etag", "floodlight-configuration-id", "floodlight-configuration-id-dimension-value", "id", "id-dimension-value", "kind", "match-type", "name", "original-floodlight-configuration-id", "status", "subaccount-id", "suspended", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Advertiser = json::value::from_value(object).unwrap(); + let mut call = self.hub.advertisers().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _browsers_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.browsers().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _campaign_creative_associations_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "creative-id" => Some(("creativeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["creative-id", "kind"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CampaignCreativeAssociation = json::value::from_value(object).unwrap(); + let mut call = self.hub.campaign_creative_associations().insert(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("campaign-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _campaign_creative_associations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.campaign_creative_associations().list(opt.value_of("profile-id").unwrap_or(""), opt.value_of("campaign-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "sort-order", "max-results"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _campaigns_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.campaigns().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _campaigns_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "start-date" => Some(("startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "end-date" => Some(("endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url-suffix-properties.click-through-url-suffix" => Some(("clickThroughUrlSuffixProperties.clickThroughUrlSuffix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url-suffix-properties.override-inherited-suffix" => Some(("clickThroughUrlSuffixProperties.overrideInheritedSuffix", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-optimization-configuration.optimization-model" => Some(("creativeOptimizationConfiguration.optimizationModel", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-optimization-configuration.id" => Some(("creativeOptimizationConfiguration.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-optimization-configuration.name" => Some(("creativeOptimizationConfiguration.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "trafficker-emails" => Some(("traffickerEmails", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "external-id" => Some(("externalId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-group-id" => Some(("advertiserGroupId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "billing-invoice-code" => Some(("billingInvoiceCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-group-ids" => Some(("creativeGroupIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "default-click-through-event-tag-properties.override-inherited-event-tag" => Some(("defaultClickThroughEventTagProperties.overrideInheritedEventTag", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "default-click-through-event-tag-properties.default-click-through-event-tag-id" => Some(("defaultClickThroughEventTagProperties.defaultClickThroughEventTagId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-info.time" => Some(("createInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "lookback-configuration.click-duration" => Some(("lookbackConfiguration.clickDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "lookback-configuration.post-impression-activities-duration" => Some(("lookbackConfiguration.postImpressionActivitiesDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "nielsen-ocr-enabled" => Some(("nielsenOcrEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-group-id", "advertiser-id", "advertiser-id-dimension-value", "archived", "billing-invoice-code", "click-duration", "click-through-url-suffix", "click-through-url-suffix-properties", "comment", "create-info", "creative-group-ids", "creative-optimization-configuration", "default-click-through-event-tag-id", "default-click-through-event-tag-properties", "dimension-name", "end-date", "etag", "external-id", "id", "id-dimension-value", "kind", "last-modified-info", "lookback-configuration", "match-type", "name", "nielsen-ocr-enabled", "optimization-model", "override-inherited-event-tag", "override-inherited-suffix", "post-impression-activities-duration", "start-date", "subaccount-id", "time", "trafficker-emails", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Campaign = json::value::from_value(object).unwrap(); + let mut call = self.hub.campaigns().insert(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("default-landing-page-name").unwrap_or(""), opt.value_of("default-landing-page-url").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _campaigns_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.campaigns().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "subaccount-id" => { + call = call.subaccount_id(value.unwrap_or("")); + }, + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "overridden-event-tag-id" => { + call = call.overridden_event_tag_id(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "excluded-ids" => { + call = call.add_excluded_ids(value.unwrap_or("")); + }, + "at-least-one-optimization-activity" => { + call = call.at_least_one_optimization_activity(arg_from_str(value.unwrap_or("false"), err, "at-least-one-optimization-activity", "boolean")); + }, + "archived" => { + call = call.archived(arg_from_str(value.unwrap_or("false"), err, "archived", "boolean")); + }, + "advertiser-ids" => { + call = call.add_advertiser_ids(value.unwrap_or("")); + }, + "advertiser-group-ids" => { + call = call.add_advertiser_group_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["archived", "search-string", "subaccount-id", "sort-field", "advertiser-ids", "ids", "max-results", "excluded-ids", "page-token", "advertiser-group-ids", "sort-order", "overridden-event-tag-id", "at-least-one-optimization-activity"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _campaigns_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "start-date" => Some(("startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "end-date" => Some(("endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url-suffix-properties.click-through-url-suffix" => Some(("clickThroughUrlSuffixProperties.clickThroughUrlSuffix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url-suffix-properties.override-inherited-suffix" => Some(("clickThroughUrlSuffixProperties.overrideInheritedSuffix", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-optimization-configuration.optimization-model" => Some(("creativeOptimizationConfiguration.optimizationModel", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-optimization-configuration.id" => Some(("creativeOptimizationConfiguration.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-optimization-configuration.name" => Some(("creativeOptimizationConfiguration.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "trafficker-emails" => Some(("traffickerEmails", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "external-id" => Some(("externalId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-group-id" => Some(("advertiserGroupId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "billing-invoice-code" => Some(("billingInvoiceCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-group-ids" => Some(("creativeGroupIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "default-click-through-event-tag-properties.override-inherited-event-tag" => Some(("defaultClickThroughEventTagProperties.overrideInheritedEventTag", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "default-click-through-event-tag-properties.default-click-through-event-tag-id" => Some(("defaultClickThroughEventTagProperties.defaultClickThroughEventTagId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-info.time" => Some(("createInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "lookback-configuration.click-duration" => Some(("lookbackConfiguration.clickDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "lookback-configuration.post-impression-activities-duration" => Some(("lookbackConfiguration.postImpressionActivitiesDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "nielsen-ocr-enabled" => Some(("nielsenOcrEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-group-id", "advertiser-id", "advertiser-id-dimension-value", "archived", "billing-invoice-code", "click-duration", "click-through-url-suffix", "click-through-url-suffix-properties", "comment", "create-info", "creative-group-ids", "creative-optimization-configuration", "default-click-through-event-tag-id", "default-click-through-event-tag-properties", "dimension-name", "end-date", "etag", "external-id", "id", "id-dimension-value", "kind", "last-modified-info", "lookback-configuration", "match-type", "name", "nielsen-ocr-enabled", "optimization-model", "override-inherited-event-tag", "override-inherited-suffix", "post-impression-activities-duration", "start-date", "subaccount-id", "time", "trafficker-emails", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Campaign = json::value::from_value(object).unwrap(); + let mut call = self.hub.campaigns().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _campaigns_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "start-date" => Some(("startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "end-date" => Some(("endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url-suffix-properties.click-through-url-suffix" => Some(("clickThroughUrlSuffixProperties.clickThroughUrlSuffix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url-suffix-properties.override-inherited-suffix" => Some(("clickThroughUrlSuffixProperties.overrideInheritedSuffix", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-optimization-configuration.optimization-model" => Some(("creativeOptimizationConfiguration.optimizationModel", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-optimization-configuration.id" => Some(("creativeOptimizationConfiguration.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-optimization-configuration.name" => Some(("creativeOptimizationConfiguration.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "trafficker-emails" => Some(("traffickerEmails", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "external-id" => Some(("externalId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-group-id" => Some(("advertiserGroupId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "billing-invoice-code" => Some(("billingInvoiceCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-group-ids" => Some(("creativeGroupIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "default-click-through-event-tag-properties.override-inherited-event-tag" => Some(("defaultClickThroughEventTagProperties.overrideInheritedEventTag", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "default-click-through-event-tag-properties.default-click-through-event-tag-id" => Some(("defaultClickThroughEventTagProperties.defaultClickThroughEventTagId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-info.time" => Some(("createInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "lookback-configuration.click-duration" => Some(("lookbackConfiguration.clickDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "lookback-configuration.post-impression-activities-duration" => Some(("lookbackConfiguration.postImpressionActivitiesDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "nielsen-ocr-enabled" => Some(("nielsenOcrEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-group-id", "advertiser-id", "advertiser-id-dimension-value", "archived", "billing-invoice-code", "click-duration", "click-through-url-suffix", "click-through-url-suffix-properties", "comment", "create-info", "creative-group-ids", "creative-optimization-configuration", "default-click-through-event-tag-id", "default-click-through-event-tag-properties", "dimension-name", "end-date", "etag", "external-id", "id", "id-dimension-value", "kind", "last-modified-info", "lookback-configuration", "match-type", "name", "nielsen-ocr-enabled", "optimization-model", "override-inherited-event-tag", "override-inherited-suffix", "post-impression-activities-duration", "start-date", "subaccount-id", "time", "trafficker-emails", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Campaign = json::value::from_value(object).unwrap(); + let mut call = self.hub.campaigns().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _change_logs_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.change_logs().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _change_logs_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.change_logs().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "user-profile-ids" => { + call = call.add_user_profile_ids(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "object-type" => { + call = call.object_type(value.unwrap_or("")); + }, + "object-ids" => { + call = call.add_object_ids(value.unwrap_or("")); + }, + "min-change-time" => { + call = call.min_change_time(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "max-change-time" => { + call = call.max_change_time(value.unwrap_or("")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "action" => { + call = call.action(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["min-change-time", "search-string", "max-change-time", "user-profile-ids", "ids", "max-results", "object-ids", "page-token", "action", "object-type"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _cities_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.cities().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "region-dart-ids" => { + call = call.add_region_dart_ids(value.unwrap_or("")); + }, + "name-prefix" => { + call = call.name_prefix(value.unwrap_or("")); + }, + "dart-ids" => { + call = call.add_dart_ids(value.unwrap_or("")); + }, + "country-dart-ids" => { + call = call.add_country_dart_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["dart-ids", "country-dart-ids", "region-dart-ids", "name-prefix"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _connection_types_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.connection_types().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _connection_types_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.connection_types().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _content_categories_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.content_categories().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _content_categories_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.content_categories().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _content_categories_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "id", "kind", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::ContentCategory = json::value::from_value(object).unwrap(); + let mut call = self.hub.content_categories().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _content_categories_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.content_categories().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "sort-field", "ids", "max-results", "page-token", "sort-order"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _content_categories_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "id", "kind", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::ContentCategory = json::value::from_value(object).unwrap(); + let mut call = self.hub.content_categories().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _content_categories_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "id", "kind", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::ContentCategory = json::value::from_value(object).unwrap(); + let mut call = self.hub.content_categories().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _conversions_batchinsert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "encryption-info.kind" => Some(("encryptionInfo.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "encryption-info.encryption-entity-id" => Some(("encryptionInfo.encryptionEntityId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "encryption-info.encryption-source" => Some(("encryptionInfo.encryptionSource", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "encryption-info.encryption-entity-type" => Some(("encryptionInfo.encryptionEntityType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["encryption-entity-id", "encryption-entity-type", "encryption-info", "encryption-source", "kind"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::ConversionsBatchInsertRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.conversions().batchinsert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _countries_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.countries().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("dart-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _countries_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.countries().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_assets_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "detected-features" => Some(("detectedFeatures", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "asset-identifier.type" => Some(("assetIdentifier.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "asset-identifier.name" => Some(("assetIdentifier.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "warned-validation-rules" => Some(("warnedValidationRules", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["asset-identifier", "detected-features", "dimension-name", "etag", "id", "id-dimension-value", "kind", "match-type", "name", "type", "value", "warned-validation-rules"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CreativeAssetMetadata = json::value::from_value(object).unwrap(); + let mut call = self.hub.creative_assets().insert(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("advertiser-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let vals = opt.values_of("mode").unwrap().collect::>(); + let protocol = calltype_from_str(vals[0], ["simple", "resumable"].iter().map(|&v| v.to_string()).collect(), err); + let mut input_file = input_file_from_opts(vals[1], err); + let mime_type = input_mime_from_opts(opt.value_of("mime").unwrap_or("application/octet-stream"), err); + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Upload(UploadProtocol::Simple) => call.upload(input_file.unwrap(), mime_type.unwrap()), + CallType::Upload(UploadProtocol::Resumable) => call.upload_resumable(input_file.unwrap(), mime_type.unwrap()), + CallType::Standard => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_field_values_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.creative_field_values().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("creative-field-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _creative_field_values_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.creative_field_values().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("creative-field-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_field_values_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "value" => Some(("value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["id", "kind", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CreativeFieldValue = json::value::from_value(object).unwrap(); + let mut call = self.hub.creative_field_values().insert(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("creative-field-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_field_values_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.creative_field_values().list(opt.value_of("profile-id").unwrap_or(""), opt.value_of("creative-field-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "sort-field", "ids", "max-results", "page-token", "sort-order"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_field_values_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "value" => Some(("value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["id", "kind", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CreativeFieldValue = json::value::from_value(object).unwrap(); + let mut call = self.hub.creative_field_values().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("creative-field-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_field_values_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "value" => Some(("value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["id", "kind", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CreativeFieldValue = json::value::from_value(object).unwrap(); + let mut call = self.hub.creative_field_values().update(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("creative-field-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_fields_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.creative_fields().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _creative_fields_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.creative_fields().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_fields_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "dimension-name", "etag", "id", "kind", "match-type", "name", "subaccount-id", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CreativeField = json::value::from_value(object).unwrap(); + let mut call = self.hub.creative_fields().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_fields_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.creative_fields().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "advertiser-ids" => { + call = call.add_advertiser_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "sort-field", "advertiser-ids", "ids", "max-results", "page-token", "sort-order"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_fields_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "dimension-name", "etag", "id", "kind", "match-type", "name", "subaccount-id", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CreativeField = json::value::from_value(object).unwrap(); + let mut call = self.hub.creative_fields().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_fields_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "dimension-name", "etag", "id", "kind", "match-type", "name", "subaccount-id", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CreativeField = json::value::from_value(object).unwrap(); + let mut call = self.hub.creative_fields().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_groups_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.creative_groups().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_groups_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "group-number" => Some(("groupNumber", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "dimension-name", "etag", "group-number", "id", "kind", "match-type", "name", "subaccount-id", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CreativeGroup = json::value::from_value(object).unwrap(); + let mut call = self.hub.creative_groups().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_groups_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.creative_groups().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "group-number" => { + call = call.group_number(arg_from_str(value.unwrap_or("-0"), err, "group-number", "integer")); + }, + "advertiser-ids" => { + call = call.add_advertiser_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "sort-field", "advertiser-ids", "ids", "max-results", "group-number", "page-token", "sort-order"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_groups_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "group-number" => Some(("groupNumber", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "dimension-name", "etag", "group-number", "id", "kind", "match-type", "name", "subaccount-id", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CreativeGroup = json::value::from_value(object).unwrap(); + let mut call = self.hub.creative_groups().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_groups_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "group-number" => Some(("groupNumber", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "dimension-name", "etag", "group-number", "id", "kind", "match-type", "name", "subaccount-id", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CreativeGroup = json::value::from_value(object).unwrap(); + let mut call = self.hub.creative_groups().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creatives_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.creatives().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creatives_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "artwork-type" => Some(("artworkType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "latest-trafficked-creative-id" => Some(("latestTraffickedCreativeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "required-flash-plugin-version" => Some(("requiredFlashPluginVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "fs-command.window-height" => Some(("fsCommand.windowHeight", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "fs-command.top" => Some(("fsCommand.top", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "fs-command.window-width" => Some(("fsCommand.windowWidth", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "fs-command.position-option" => Some(("fsCommand.positionOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "fs-command.left" => Some(("fsCommand.left", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.kind" => Some(("renderingIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.value" => Some(("renderingIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.dimension-name" => Some(("renderingIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.etag" => Some(("renderingIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.match-type" => Some(("renderingIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.id" => Some(("renderingIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "dynamic-asset-selection" => Some(("dynamicAssetSelection", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "progress-offset.offset-percentage" => Some(("progressOffset.offsetPercentage", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "progress-offset.offset-seconds" => Some(("progressOffset.offsetSeconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "studio-trafficked-creative-id" => Some(("studioTraffickedCreativeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "override-css" => Some(("overrideCss", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "authoring-source" => Some(("authoringSource", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "required-flash-version" => Some(("requiredFlashVersion", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "rendering-id" => Some(("renderingId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-description" => Some(("videoDescription", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "skip-offset.offset-percentage" => Some(("skipOffset.offsetPercentage", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "skip-offset.offset-seconds" => Some(("skipOffset.offsetSeconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "third-party-backup-image-impressions-url" => Some(("thirdPartyBackupImageImpressionsUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "version" => Some(("version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "background-color" => Some(("backgroundColor", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "custom-key-values" => Some(("customKeyValues", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "html-code" => Some(("htmlCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.width" => Some(("size.width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "size.kind" => Some(("size.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.iab" => Some(("size.iab", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "size.id" => Some(("size.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.height" => Some(("size.height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "total-file-size" => Some(("totalFileSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "third-party-rich-media-impressions-url" => Some(("thirdPartyRichMediaImpressionsUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "studio-advertiser-id" => Some(("studioAdvertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-duration" => Some(("videoDuration", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "redirect-url" => Some(("redirectUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "commercial-id" => Some(("commercialId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "backup-image-reporting-label" => Some(("backupImageReportingLabel", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "compatibility" => Some(("compatibility", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "ad-parameters" => Some(("adParameters", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "html-code-locked" => Some(("htmlCodeLocked", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ad-tag-keys" => Some(("adTagKeys", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "convert-flash-to-html5" => Some(("convertFlashToHtml5", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "ssl-override" => Some(("sslOverride", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "backup-image-click-through-url" => Some(("backupImageClickThroughUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-compliant" => Some(("sslCompliant", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "studio-creative-id" => Some(("studioCreativeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "authoring-tool" => Some(("authoringTool", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "allow-script-access" => Some(("allowScriptAccess", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "companion-creatives" => Some(("companionCreatives", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "creative-asset-selection.default-asset-id" => Some(("creativeAssetSelection.defaultAssetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "auto-advance-images" => Some(("auto_advance_images", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "backup-image-features" => Some(("backupImageFeatures", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "backup-image-target-window.custom-html" => Some(("backupImageTargetWindow.customHtml", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "backup-image-target-window.target-window-option" => Some(("backupImageTargetWindow.targetWindowOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "skippable" => Some(("skippable", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "ad-parameters", "ad-tag-keys", "advertiser-id", "allow-script-access", "archived", "artwork-type", "authoring-source", "authoring-tool", "auto-advance-images", "background-color", "backup-image-click-through-url", "backup-image-features", "backup-image-reporting-label", "backup-image-target-window", "commercial-id", "companion-creatives", "compatibility", "convert-flash-to-html5", "creative-asset-selection", "custom-html", "custom-key-values", "default-asset-id", "dimension-name", "dynamic-asset-selection", "etag", "fs-command", "height", "html-code", "html-code-locked", "iab", "id", "id-dimension-value", "kind", "last-modified-info", "latest-trafficked-creative-id", "left", "match-type", "name", "offset-percentage", "offset-seconds", "override-css", "position-option", "progress-offset", "redirect-url", "rendering-id", "rendering-id-dimension-value", "required-flash-plugin-version", "required-flash-version", "size", "skip-offset", "skippable", "ssl-compliant", "ssl-override", "studio-advertiser-id", "studio-creative-id", "studio-trafficked-creative-id", "subaccount-id", "target-window-option", "third-party-backup-image-impressions-url", "third-party-rich-media-impressions-url", "time", "top", "total-file-size", "type", "value", "version", "video-description", "video-duration", "width", "window-height", "window-width"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Creative = json::value::from_value(object).unwrap(); + let mut call = self.hub.creatives().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creatives_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.creatives().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "types" => { + call = call.add_types(value.unwrap_or("")); + }, + "studio-creative-id" => { + call = call.studio_creative_id(value.unwrap_or("")); + }, + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "size-ids" => { + call = call.add_size_ids(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "rendering-ids" => { + call = call.add_rendering_ids(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "creative-field-ids" => { + call = call.add_creative_field_ids(value.unwrap_or("")); + }, + "companion-creative-ids" => { + call = call.add_companion_creative_ids(value.unwrap_or("")); + }, + "campaign-id" => { + call = call.campaign_id(value.unwrap_or("")); + }, + "archived" => { + call = call.archived(arg_from_str(value.unwrap_or("false"), err, "archived", "boolean")); + }, + "advertiser-id" => { + call = call.advertiser_id(value.unwrap_or("")); + }, + "active" => { + call = call.active(arg_from_str(value.unwrap_or("false"), err, "active", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["advertiser-id", "archived", "search-string", "max-results", "campaign-id", "sort-field", "rendering-ids", "ids", "studio-creative-id", "size-ids", "page-token", "sort-order", "companion-creative-ids", "active", "creative-field-ids", "types"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creatives_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "artwork-type" => Some(("artworkType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "latest-trafficked-creative-id" => Some(("latestTraffickedCreativeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "required-flash-plugin-version" => Some(("requiredFlashPluginVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "fs-command.window-height" => Some(("fsCommand.windowHeight", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "fs-command.top" => Some(("fsCommand.top", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "fs-command.window-width" => Some(("fsCommand.windowWidth", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "fs-command.position-option" => Some(("fsCommand.positionOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "fs-command.left" => Some(("fsCommand.left", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.kind" => Some(("renderingIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.value" => Some(("renderingIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.dimension-name" => Some(("renderingIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.etag" => Some(("renderingIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.match-type" => Some(("renderingIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.id" => Some(("renderingIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "dynamic-asset-selection" => Some(("dynamicAssetSelection", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "progress-offset.offset-percentage" => Some(("progressOffset.offsetPercentage", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "progress-offset.offset-seconds" => Some(("progressOffset.offsetSeconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "studio-trafficked-creative-id" => Some(("studioTraffickedCreativeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "override-css" => Some(("overrideCss", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "authoring-source" => Some(("authoringSource", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "required-flash-version" => Some(("requiredFlashVersion", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "rendering-id" => Some(("renderingId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-description" => Some(("videoDescription", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "skip-offset.offset-percentage" => Some(("skipOffset.offsetPercentage", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "skip-offset.offset-seconds" => Some(("skipOffset.offsetSeconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "third-party-backup-image-impressions-url" => Some(("thirdPartyBackupImageImpressionsUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "version" => Some(("version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "background-color" => Some(("backgroundColor", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "custom-key-values" => Some(("customKeyValues", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "html-code" => Some(("htmlCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.width" => Some(("size.width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "size.kind" => Some(("size.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.iab" => Some(("size.iab", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "size.id" => Some(("size.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.height" => Some(("size.height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "total-file-size" => Some(("totalFileSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "third-party-rich-media-impressions-url" => Some(("thirdPartyRichMediaImpressionsUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "studio-advertiser-id" => Some(("studioAdvertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-duration" => Some(("videoDuration", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "redirect-url" => Some(("redirectUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "commercial-id" => Some(("commercialId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "backup-image-reporting-label" => Some(("backupImageReportingLabel", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "compatibility" => Some(("compatibility", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "ad-parameters" => Some(("adParameters", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "html-code-locked" => Some(("htmlCodeLocked", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ad-tag-keys" => Some(("adTagKeys", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "convert-flash-to-html5" => Some(("convertFlashToHtml5", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "ssl-override" => Some(("sslOverride", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "backup-image-click-through-url" => Some(("backupImageClickThroughUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-compliant" => Some(("sslCompliant", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "studio-creative-id" => Some(("studioCreativeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "authoring-tool" => Some(("authoringTool", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "allow-script-access" => Some(("allowScriptAccess", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "companion-creatives" => Some(("companionCreatives", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "creative-asset-selection.default-asset-id" => Some(("creativeAssetSelection.defaultAssetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "auto-advance-images" => Some(("auto_advance_images", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "backup-image-features" => Some(("backupImageFeatures", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "backup-image-target-window.custom-html" => Some(("backupImageTargetWindow.customHtml", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "backup-image-target-window.target-window-option" => Some(("backupImageTargetWindow.targetWindowOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "skippable" => Some(("skippable", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "ad-parameters", "ad-tag-keys", "advertiser-id", "allow-script-access", "archived", "artwork-type", "authoring-source", "authoring-tool", "auto-advance-images", "background-color", "backup-image-click-through-url", "backup-image-features", "backup-image-reporting-label", "backup-image-target-window", "commercial-id", "companion-creatives", "compatibility", "convert-flash-to-html5", "creative-asset-selection", "custom-html", "custom-key-values", "default-asset-id", "dimension-name", "dynamic-asset-selection", "etag", "fs-command", "height", "html-code", "html-code-locked", "iab", "id", "id-dimension-value", "kind", "last-modified-info", "latest-trafficked-creative-id", "left", "match-type", "name", "offset-percentage", "offset-seconds", "override-css", "position-option", "progress-offset", "redirect-url", "rendering-id", "rendering-id-dimension-value", "required-flash-plugin-version", "required-flash-version", "size", "skip-offset", "skippable", "ssl-compliant", "ssl-override", "studio-advertiser-id", "studio-creative-id", "studio-trafficked-creative-id", "subaccount-id", "target-window-option", "third-party-backup-image-impressions-url", "third-party-rich-media-impressions-url", "time", "top", "total-file-size", "type", "value", "version", "video-description", "video-duration", "width", "window-height", "window-width"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Creative = json::value::from_value(object).unwrap(); + let mut call = self.hub.creatives().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creatives_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "artwork-type" => Some(("artworkType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "latest-trafficked-creative-id" => Some(("latestTraffickedCreativeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "required-flash-plugin-version" => Some(("requiredFlashPluginVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "fs-command.window-height" => Some(("fsCommand.windowHeight", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "fs-command.top" => Some(("fsCommand.top", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "fs-command.window-width" => Some(("fsCommand.windowWidth", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "fs-command.position-option" => Some(("fsCommand.positionOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "fs-command.left" => Some(("fsCommand.left", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.kind" => Some(("renderingIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.value" => Some(("renderingIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.dimension-name" => Some(("renderingIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.etag" => Some(("renderingIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.match-type" => Some(("renderingIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.id" => Some(("renderingIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "dynamic-asset-selection" => Some(("dynamicAssetSelection", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "progress-offset.offset-percentage" => Some(("progressOffset.offsetPercentage", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "progress-offset.offset-seconds" => Some(("progressOffset.offsetSeconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "studio-trafficked-creative-id" => Some(("studioTraffickedCreativeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "override-css" => Some(("overrideCss", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "authoring-source" => Some(("authoringSource", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "required-flash-version" => Some(("requiredFlashVersion", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "rendering-id" => Some(("renderingId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-description" => Some(("videoDescription", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "skip-offset.offset-percentage" => Some(("skipOffset.offsetPercentage", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "skip-offset.offset-seconds" => Some(("skipOffset.offsetSeconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "third-party-backup-image-impressions-url" => Some(("thirdPartyBackupImageImpressionsUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "version" => Some(("version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "background-color" => Some(("backgroundColor", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "custom-key-values" => Some(("customKeyValues", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "html-code" => Some(("htmlCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.width" => Some(("size.width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "size.kind" => Some(("size.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.iab" => Some(("size.iab", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "size.id" => Some(("size.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.height" => Some(("size.height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "total-file-size" => Some(("totalFileSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "third-party-rich-media-impressions-url" => Some(("thirdPartyRichMediaImpressionsUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "studio-advertiser-id" => Some(("studioAdvertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-duration" => Some(("videoDuration", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "redirect-url" => Some(("redirectUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "commercial-id" => Some(("commercialId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "backup-image-reporting-label" => Some(("backupImageReportingLabel", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "compatibility" => Some(("compatibility", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "ad-parameters" => Some(("adParameters", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "html-code-locked" => Some(("htmlCodeLocked", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ad-tag-keys" => Some(("adTagKeys", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "convert-flash-to-html5" => Some(("convertFlashToHtml5", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "ssl-override" => Some(("sslOverride", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "backup-image-click-through-url" => Some(("backupImageClickThroughUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-compliant" => Some(("sslCompliant", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "studio-creative-id" => Some(("studioCreativeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "authoring-tool" => Some(("authoringTool", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "allow-script-access" => Some(("allowScriptAccess", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "companion-creatives" => Some(("companionCreatives", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "creative-asset-selection.default-asset-id" => Some(("creativeAssetSelection.defaultAssetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "auto-advance-images" => Some(("auto_advance_images", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "backup-image-features" => Some(("backupImageFeatures", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "backup-image-target-window.custom-html" => Some(("backupImageTargetWindow.customHtml", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "backup-image-target-window.target-window-option" => Some(("backupImageTargetWindow.targetWindowOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "skippable" => Some(("skippable", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "ad-parameters", "ad-tag-keys", "advertiser-id", "allow-script-access", "archived", "artwork-type", "authoring-source", "authoring-tool", "auto-advance-images", "background-color", "backup-image-click-through-url", "backup-image-features", "backup-image-reporting-label", "backup-image-target-window", "commercial-id", "companion-creatives", "compatibility", "convert-flash-to-html5", "creative-asset-selection", "custom-html", "custom-key-values", "default-asset-id", "dimension-name", "dynamic-asset-selection", "etag", "fs-command", "height", "html-code", "html-code-locked", "iab", "id", "id-dimension-value", "kind", "last-modified-info", "latest-trafficked-creative-id", "left", "match-type", "name", "offset-percentage", "offset-seconds", "override-css", "position-option", "progress-offset", "redirect-url", "rendering-id", "rendering-id-dimension-value", "required-flash-plugin-version", "required-flash-version", "size", "skip-offset", "skippable", "ssl-compliant", "ssl-override", "studio-advertiser-id", "studio-creative-id", "studio-trafficked-creative-id", "subaccount-id", "target-window-option", "third-party-backup-image-impressions-url", "third-party-rich-media-impressions-url", "time", "top", "total-file-size", "type", "value", "version", "video-description", "video-duration", "width", "window-height", "window-width"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Creative = json::value::from_value(object).unwrap(); + let mut call = self.hub.creatives().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _dimension_values_query(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "dimension-name" => Some(("dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "start-date" => Some(("startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "end-date" => Some(("endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["dimension-name", "end-date", "kind", "start-date"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::DimensionValueRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.dimension_values().query(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "max-results"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _directory_site_contacts_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.directory_site_contacts().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _directory_site_contacts_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.directory_site_contacts().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "directory-site-ids" => { + call = call.add_directory_site_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "directory-site-ids", "sort-field", "ids", "max-results", "page-token", "sort-order"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _directory_sites_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.directory_sites().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _directory_sites_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "country-id" => Some(("countryId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "settings.nielsen-ocr-opt-out" => Some(("settings.nielsenOcrOptOut", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "settings.active-view-opt-out" => Some(("settings.activeViewOptOut", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "settings.dfp-settings.dfp-network-name" => Some(("settings.dfp_settings.dfp_network_name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "settings.dfp-settings.publisher-portal-only" => Some(("settings.dfp_settings.publisherPortalOnly", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "settings.dfp-settings.programmatic-placement-accepted" => Some(("settings.dfp_settings.programmaticPlacementAccepted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "settings.dfp-settings.pub-paid-placement-accepted" => Some(("settings.dfp_settings.pubPaidPlacementAccepted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "settings.dfp-settings.dfp-network-code" => Some(("settings.dfp_settings.dfp_network_code", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "settings.verification-tag-opt-out" => Some(("settings.verificationTagOptOut", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "settings.instream-video-placement-accepted" => Some(("settings.instream_video_placement_accepted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "settings.interstitial-placement-accepted" => Some(("settings.interstitialPlacementAccepted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "settings.video-active-view-opt-out" => Some(("settings.videoActiveViewOptOut", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "currency-id" => Some(("currencyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "inpage-tag-formats" => Some(("inpageTagFormats", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "url" => Some(("url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "parent-id" => Some(("parentId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "interstitial-tag-formats" => Some(("interstitialTagFormats", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["active", "active-view-opt-out", "country-id", "currency-id", "description", "dfp-network-code", "dfp-network-name", "dfp-settings", "dimension-name", "etag", "id", "id-dimension-value", "inpage-tag-formats", "instream-video-placement-accepted", "interstitial-placement-accepted", "interstitial-tag-formats", "kind", "match-type", "name", "nielsen-ocr-opt-out", "parent-id", "programmatic-placement-accepted", "pub-paid-placement-accepted", "publisher-portal-only", "settings", "url", "value", "verification-tag-opt-out", "video-active-view-opt-out"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::DirectorySite = json::value::from_value(object).unwrap(); + let mut call = self.hub.directory_sites().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _directory_sites_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.directory_sites().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "parent-id" => { + call = call.parent_id(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "dfp-network-code" => { + call = call.dfp_network_code(value.unwrap_or("")); + }, + "country-id" => { + call = call.country_id(value.unwrap_or("")); + }, + "active" => { + call = call.active(arg_from_str(value.unwrap_or("false"), err, "active", "boolean")); + }, + "accepts-publisher-paid-placements" => { + call = call.accepts_publisher_paid_placements(arg_from_str(value.unwrap_or("false"), err, "accepts-publisher-paid-placements", "boolean")); + }, + "accepts-interstitial-placements" => { + call = call.accepts_interstitial_placements(arg_from_str(value.unwrap_or("false"), err, "accepts-interstitial-placements", "boolean")); + }, + "accepts-in-stream-video-placements" => { + call = call.accepts_in_stream_video_placements(arg_from_str(value.unwrap_or("false"), err, "accepts-in-stream-video-placements", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["accepts-interstitial-placements", "accepts-publisher-paid-placements", "search-string", "country-id", "accepts-in-stream-video-placements", "sort-field", "ids", "max-results", "page-token", "sort-order", "parent-id", "active", "dfp-network-code"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _dynamic_targeting_keys_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.dynamic_targeting_keys().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("object-id").unwrap_or(""), opt.value_of("name").unwrap_or(""), opt.value_of("object-type").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _dynamic_targeting_keys_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "object-id" => Some(("objectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "object-type" => Some(("objectType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["kind", "name", "object-id", "object-type"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::DynamicTargetingKey = json::value::from_value(object).unwrap(); + let mut call = self.hub.dynamic_targeting_keys().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _dynamic_targeting_keys_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.dynamic_targeting_keys().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "object-type" => { + call = call.object_type(value.unwrap_or("")); + }, + "object-id" => { + call = call.object_id(value.unwrap_or("")); + }, + "names" => { + call = call.add_names(value.unwrap_or("")); + }, + "advertiser-id" => { + call = call.advertiser_id(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["advertiser-id", "names", "object-id", "object-type"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _event_tags_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.event_tags().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _event_tags_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.event_tags().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _event_tags_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-ids" => Some(("siteIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id" => Some(("campaignId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "url" => Some(("url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-compliant" => Some(("sslCompliant", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "url-escape-levels" => Some(("urlEscapeLevels", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.kind" => Some(("campaignIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.value" => Some(("campaignIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.dimension-name" => Some(("campaignIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.etag" => Some(("campaignIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.match-type" => Some(("campaignIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.id" => Some(("campaignIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "enabled-by-default" => Some(("enabledByDefault", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-filter-type" => Some(("siteFilterType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "exclude-from-adx-requests" => Some(("excludeFromAdxRequests", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "campaign-id", "campaign-id-dimension-value", "dimension-name", "enabled-by-default", "etag", "exclude-from-adx-requests", "id", "kind", "match-type", "name", "site-filter-type", "site-ids", "ssl-compliant", "status", "subaccount-id", "type", "url", "url-escape-levels", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::EventTag = json::value::from_value(object).unwrap(); + let mut call = self.hub.event_tags().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _event_tags_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.event_tags().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "event-tag-types" => { + call = call.add_event_tag_types(value.unwrap_or("")); + }, + "enabled" => { + call = call.enabled(arg_from_str(value.unwrap_or("false"), err, "enabled", "boolean")); + }, + "definitions-only" => { + call = call.definitions_only(arg_from_str(value.unwrap_or("false"), err, "definitions-only", "boolean")); + }, + "campaign-id" => { + call = call.campaign_id(value.unwrap_or("")); + }, + "advertiser-id" => { + call = call.advertiser_id(value.unwrap_or("")); + }, + "ad-id" => { + call = call.ad_id(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "campaign-id", "sort-field", "enabled", "ids", "advertiser-id", "ad-id", "sort-order", "event-tag-types", "definitions-only"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _event_tags_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-ids" => Some(("siteIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id" => Some(("campaignId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "url" => Some(("url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-compliant" => Some(("sslCompliant", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "url-escape-levels" => Some(("urlEscapeLevels", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.kind" => Some(("campaignIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.value" => Some(("campaignIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.dimension-name" => Some(("campaignIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.etag" => Some(("campaignIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.match-type" => Some(("campaignIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.id" => Some(("campaignIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "enabled-by-default" => Some(("enabledByDefault", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-filter-type" => Some(("siteFilterType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "exclude-from-adx-requests" => Some(("excludeFromAdxRequests", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "campaign-id", "campaign-id-dimension-value", "dimension-name", "enabled-by-default", "etag", "exclude-from-adx-requests", "id", "kind", "match-type", "name", "site-filter-type", "site-ids", "ssl-compliant", "status", "subaccount-id", "type", "url", "url-escape-levels", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::EventTag = json::value::from_value(object).unwrap(); + let mut call = self.hub.event_tags().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _event_tags_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-ids" => Some(("siteIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id" => Some(("campaignId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "url" => Some(("url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-compliant" => Some(("sslCompliant", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "url-escape-levels" => Some(("urlEscapeLevels", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.kind" => Some(("campaignIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.value" => Some(("campaignIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.dimension-name" => Some(("campaignIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.etag" => Some(("campaignIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.match-type" => Some(("campaignIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.id" => Some(("campaignIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "enabled-by-default" => Some(("enabledByDefault", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-filter-type" => Some(("siteFilterType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "exclude-from-adx-requests" => Some(("excludeFromAdxRequests", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "campaign-id", "campaign-id-dimension-value", "dimension-name", "enabled-by-default", "etag", "exclude-from-adx-requests", "id", "kind", "match-type", "name", "site-filter-type", "site-ids", "ssl-compliant", "status", "subaccount-id", "type", "url", "url-escape-levels", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::EventTag = json::value::from_value(object).unwrap(); + let mut call = self.hub.event_tags().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _files_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut download_mode = false; + let mut call = self.hub.files().get(opt.value_of("report-id").unwrap_or(""), opt.value_of("file-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + if key == "alt" && value.unwrap_or("unset") == "media" { + download_mode = true; + } + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + if !download_mode { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + } else { + io::copy(&mut response, &mut ostream).unwrap(); + ostream.flush().unwrap(); + } + Ok(()) + } + } + } + } + + fn _files_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.files().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "scope" => { + call = call.scope(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["sort-field", "max-results", "sort-order", "page-token", "scope"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_activities_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.floodlight_activities().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _floodlight_activities_generatetag(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.floodlight_activities().generatetag(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "floodlight-activity-id" => { + call = call.floodlight_activity_id(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["floodlight-activity-id"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_activities_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.floodlight_activities().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_activities_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "tag-string" => Some(("tagString", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "secure" => Some(("secure", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-activity-group-name" => Some(("floodlightActivityGroupName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "image-tag-enabled" => Some(("imageTagEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-activity-group-id" => Some(("floodlightActivityGroupId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-activity-group-tag-string" => Some(("floodlightActivityGroupTagString", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-compliant" => Some(("sslCompliant", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.kind" => Some(("floodlightConfigurationIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.value" => Some(("floodlightConfigurationIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.dimension-name" => Some(("floodlightConfigurationIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.etag" => Some(("floodlightConfigurationIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.match-type" => Some(("floodlightConfigurationIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.id" => Some(("floodlightConfigurationIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cache-busting-type" => Some(("cacheBustingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "hidden" => Some(("hidden", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-required" => Some(("sslRequired", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "expected-url" => Some(("expectedUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tag-format" => Some(("tagFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "notes" => Some(("notes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id" => Some(("floodlightConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-defined-variable-types" => Some(("userDefinedVariableTypes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "counting-method" => Some(("countingMethod", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-activity-group-type" => Some(("floodlightActivityGroupType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "cache-busting-type", "counting-method", "dimension-name", "etag", "expected-url", "floodlight-activity-group-id", "floodlight-activity-group-name", "floodlight-activity-group-tag-string", "floodlight-activity-group-type", "floodlight-configuration-id", "floodlight-configuration-id-dimension-value", "hidden", "id", "id-dimension-value", "image-tag-enabled", "kind", "match-type", "name", "notes", "secure", "ssl-compliant", "ssl-required", "subaccount-id", "tag-format", "tag-string", "user-defined-variable-types", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::FloodlightActivity = json::value::from_value(object).unwrap(); + let mut call = self.hub.floodlight_activities().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_activities_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.floodlight_activities().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "tag-string" => { + call = call.tag_string(value.unwrap_or("")); + }, + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "floodlight-configuration-id" => { + call = call.floodlight_configuration_id(value.unwrap_or("")); + }, + "floodlight-activity-group-type" => { + call = call.floodlight_activity_group_type(value.unwrap_or("")); + }, + "floodlight-activity-group-tag-string" => { + call = call.floodlight_activity_group_tag_string(value.unwrap_or("")); + }, + "floodlight-activity-group-name" => { + call = call.floodlight_activity_group_name(value.unwrap_or("")); + }, + "floodlight-activity-group-ids" => { + call = call.add_floodlight_activity_group_ids(value.unwrap_or("")); + }, + "advertiser-id" => { + call = call.advertiser_id(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["floodlight-activity-group-ids", "search-string", "floodlight-activity-group-name", "sort-field", "floodlight-configuration-id", "ids", "max-results", "advertiser-id", "page-token", "sort-order", "tag-string", "floodlight-activity-group-tag-string", "floodlight-activity-group-type"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_activities_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "tag-string" => Some(("tagString", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "secure" => Some(("secure", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-activity-group-name" => Some(("floodlightActivityGroupName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "image-tag-enabled" => Some(("imageTagEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-activity-group-id" => Some(("floodlightActivityGroupId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-activity-group-tag-string" => Some(("floodlightActivityGroupTagString", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-compliant" => Some(("sslCompliant", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.kind" => Some(("floodlightConfigurationIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.value" => Some(("floodlightConfigurationIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.dimension-name" => Some(("floodlightConfigurationIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.etag" => Some(("floodlightConfigurationIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.match-type" => Some(("floodlightConfigurationIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.id" => Some(("floodlightConfigurationIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cache-busting-type" => Some(("cacheBustingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "hidden" => Some(("hidden", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-required" => Some(("sslRequired", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "expected-url" => Some(("expectedUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tag-format" => Some(("tagFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "notes" => Some(("notes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id" => Some(("floodlightConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-defined-variable-types" => Some(("userDefinedVariableTypes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "counting-method" => Some(("countingMethod", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-activity-group-type" => Some(("floodlightActivityGroupType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "cache-busting-type", "counting-method", "dimension-name", "etag", "expected-url", "floodlight-activity-group-id", "floodlight-activity-group-name", "floodlight-activity-group-tag-string", "floodlight-activity-group-type", "floodlight-configuration-id", "floodlight-configuration-id-dimension-value", "hidden", "id", "id-dimension-value", "image-tag-enabled", "kind", "match-type", "name", "notes", "secure", "ssl-compliant", "ssl-required", "subaccount-id", "tag-format", "tag-string", "user-defined-variable-types", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::FloodlightActivity = json::value::from_value(object).unwrap(); + let mut call = self.hub.floodlight_activities().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_activities_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "tag-string" => Some(("tagString", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "secure" => Some(("secure", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-activity-group-name" => Some(("floodlightActivityGroupName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "image-tag-enabled" => Some(("imageTagEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-activity-group-id" => Some(("floodlightActivityGroupId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-activity-group-tag-string" => Some(("floodlightActivityGroupTagString", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-compliant" => Some(("sslCompliant", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.kind" => Some(("floodlightConfigurationIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.value" => Some(("floodlightConfigurationIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.dimension-name" => Some(("floodlightConfigurationIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.etag" => Some(("floodlightConfigurationIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.match-type" => Some(("floodlightConfigurationIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.id" => Some(("floodlightConfigurationIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cache-busting-type" => Some(("cacheBustingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "hidden" => Some(("hidden", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-required" => Some(("sslRequired", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "expected-url" => Some(("expectedUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tag-format" => Some(("tagFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "notes" => Some(("notes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id" => Some(("floodlightConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-defined-variable-types" => Some(("userDefinedVariableTypes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "counting-method" => Some(("countingMethod", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-activity-group-type" => Some(("floodlightActivityGroupType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "cache-busting-type", "counting-method", "dimension-name", "etag", "expected-url", "floodlight-activity-group-id", "floodlight-activity-group-name", "floodlight-activity-group-tag-string", "floodlight-activity-group-type", "floodlight-configuration-id", "floodlight-configuration-id-dimension-value", "hidden", "id", "id-dimension-value", "image-tag-enabled", "kind", "match-type", "name", "notes", "secure", "ssl-compliant", "ssl-required", "subaccount-id", "tag-format", "tag-string", "user-defined-variable-types", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::FloodlightActivity = json::value::from_value(object).unwrap(); + let mut call = self.hub.floodlight_activities().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_activity_groups_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.floodlight_activity_groups().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_activity_groups_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id" => Some(("floodlightConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.kind" => Some(("floodlightConfigurationIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.value" => Some(("floodlightConfigurationIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.dimension-name" => Some(("floodlightConfigurationIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.etag" => Some(("floodlightConfigurationIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.match-type" => Some(("floodlightConfigurationIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.id" => Some(("floodlightConfigurationIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tag-string" => Some(("tagString", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "dimension-name", "etag", "floodlight-configuration-id", "floodlight-configuration-id-dimension-value", "id", "id-dimension-value", "kind", "match-type", "name", "subaccount-id", "tag-string", "type", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::FloodlightActivityGroup = json::value::from_value(object).unwrap(); + let mut call = self.hub.floodlight_activity_groups().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_activity_groups_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.floodlight_activity_groups().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "type" => { + call = call.type_(value.unwrap_or("")); + }, + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "floodlight-configuration-id" => { + call = call.floodlight_configuration_id(value.unwrap_or("")); + }, + "advertiser-id" => { + call = call.advertiser_id(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "sort-field", "floodlight-configuration-id", "ids", "max-results", "advertiser-id", "page-token", "sort-order", "type"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_activity_groups_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id" => Some(("floodlightConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.kind" => Some(("floodlightConfigurationIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.value" => Some(("floodlightConfigurationIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.dimension-name" => Some(("floodlightConfigurationIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.etag" => Some(("floodlightConfigurationIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.match-type" => Some(("floodlightConfigurationIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.id" => Some(("floodlightConfigurationIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tag-string" => Some(("tagString", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "dimension-name", "etag", "floodlight-configuration-id", "floodlight-configuration-id-dimension-value", "id", "id-dimension-value", "kind", "match-type", "name", "subaccount-id", "tag-string", "type", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::FloodlightActivityGroup = json::value::from_value(object).unwrap(); + let mut call = self.hub.floodlight_activity_groups().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_activity_groups_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id" => Some(("floodlightConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.kind" => Some(("floodlightConfigurationIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.value" => Some(("floodlightConfigurationIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.dimension-name" => Some(("floodlightConfigurationIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.etag" => Some(("floodlightConfigurationIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.match-type" => Some(("floodlightConfigurationIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.id" => Some(("floodlightConfigurationIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tag-string" => Some(("tagString", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "dimension-name", "etag", "floodlight-configuration-id", "floodlight-configuration-id-dimension-value", "id", "id-dimension-value", "kind", "match-type", "name", "subaccount-id", "tag-string", "type", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::FloodlightActivityGroup = json::value::from_value(object).unwrap(); + let mut call = self.hub.floodlight_activity_groups().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_configurations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.floodlight_configurations().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_configurations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.floodlight_configurations().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["ids"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_configurations_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "natural-search-conversion-attribution-option" => Some(("naturalSearchConversionAttributionOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "exposure-to-conversion-enabled" => Some(("exposureToConversionEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "analytics-data-sharing-enabled" => Some(("analyticsDataSharingEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "lookback-configuration.click-duration" => Some(("lookbackConfiguration.clickDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "lookback-configuration.post-impression-activities-duration" => Some(("lookbackConfiguration.postImpressionActivitiesDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "first-day-of-week" => Some(("firstDayOfWeek", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "standard-variable-types" => Some(("standardVariableTypes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "omniture-settings.omniture-cost-data-enabled" => Some(("omnitureSettings.omnitureCostDataEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "omniture-settings.omniture-integration-enabled" => Some(("omnitureSettings.omnitureIntegrationEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tag-settings.dynamic-tag-enabled" => Some(("tagSettings.dynamicTagEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "tag-settings.image-tag-enabled" => Some(("tagSettings.imageTagEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "in-app-attribution-tracking-enabled" => Some(("inAppAttributionTrackingEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "analytics-data-sharing-enabled", "click-duration", "dimension-name", "dynamic-tag-enabled", "etag", "exposure-to-conversion-enabled", "first-day-of-week", "id", "id-dimension-value", "image-tag-enabled", "in-app-attribution-tracking-enabled", "kind", "lookback-configuration", "match-type", "natural-search-conversion-attribution-option", "omniture-cost-data-enabled", "omniture-integration-enabled", "omniture-settings", "post-impression-activities-duration", "standard-variable-types", "subaccount-id", "tag-settings", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::FloodlightConfiguration = json::value::from_value(object).unwrap(); + let mut call = self.hub.floodlight_configurations().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_configurations_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "natural-search-conversion-attribution-option" => Some(("naturalSearchConversionAttributionOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "exposure-to-conversion-enabled" => Some(("exposureToConversionEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "analytics-data-sharing-enabled" => Some(("analyticsDataSharingEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "lookback-configuration.click-duration" => Some(("lookbackConfiguration.clickDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "lookback-configuration.post-impression-activities-duration" => Some(("lookbackConfiguration.postImpressionActivitiesDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "first-day-of-week" => Some(("firstDayOfWeek", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "standard-variable-types" => Some(("standardVariableTypes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "omniture-settings.omniture-cost-data-enabled" => Some(("omnitureSettings.omnitureCostDataEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "omniture-settings.omniture-integration-enabled" => Some(("omnitureSettings.omnitureIntegrationEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tag-settings.dynamic-tag-enabled" => Some(("tagSettings.dynamicTagEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "tag-settings.image-tag-enabled" => Some(("tagSettings.imageTagEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "in-app-attribution-tracking-enabled" => Some(("inAppAttributionTrackingEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "analytics-data-sharing-enabled", "click-duration", "dimension-name", "dynamic-tag-enabled", "etag", "exposure-to-conversion-enabled", "first-day-of-week", "id", "id-dimension-value", "image-tag-enabled", "in-app-attribution-tracking-enabled", "kind", "lookback-configuration", "match-type", "natural-search-conversion-attribution-option", "omniture-cost-data-enabled", "omniture-integration-enabled", "omniture-settings", "post-impression-activities-duration", "standard-variable-types", "subaccount-id", "tag-settings", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::FloodlightConfiguration = json::value::from_value(object).unwrap(); + let mut call = self.hub.floodlight_configurations().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _inventory_items_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.inventory_items().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("project-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _inventory_items_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.inventory_items().list(opt.value_of("profile-id").unwrap_or(""), opt.value_of("project-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "type" => { + call = call.type_(value.unwrap_or("")); + }, + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "site-id" => { + call = call.add_site_id(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "order-id" => { + call = call.add_order_id(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "in-plan" => { + call = call.in_plan(arg_from_str(value.unwrap_or("false"), err, "in-plan", "boolean")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["order-id", "sort-field", "ids", "max-results", "page-token", "in-plan", "site-id", "sort-order", "type"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _landing_pages_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.landing_pages().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("campaign-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _landing_pages_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.landing_pages().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("campaign-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _landing_pages_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "default" => Some(("default", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "url" => Some(("url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["default", "id", "kind", "name", "url"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::LandingPage = json::value::from_value(object).unwrap(); + let mut call = self.hub.landing_pages().insert(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("campaign-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _landing_pages_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.landing_pages().list(opt.value_of("profile-id").unwrap_or(""), opt.value_of("campaign-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _landing_pages_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "default" => Some(("default", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "url" => Some(("url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["default", "id", "kind", "name", "url"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::LandingPage = json::value::from_value(object).unwrap(); + let mut call = self.hub.landing_pages().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("campaign-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _landing_pages_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "default" => Some(("default", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "url" => Some(("url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["default", "id", "kind", "name", "url"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::LandingPage = json::value::from_value(object).unwrap(); + let mut call = self.hub.landing_pages().update(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("campaign-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _languages_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.languages().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _metros_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.metros().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _mobile_carriers_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.mobile_carriers().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _mobile_carriers_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.mobile_carriers().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _operating_system_versions_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.operating_system_versions().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _operating_system_versions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.operating_system_versions().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _operating_systems_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.operating_systems().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("dart-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _operating_systems_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.operating_systems().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _order_documents_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.order_documents().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("project-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _order_documents_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.order_documents().list(opt.value_of("profile-id").unwrap_or(""), opt.value_of("project-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "site-id" => { + call = call.add_site_id(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "order-id" => { + call = call.add_order_id(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "approved" => { + call = call.approved(arg_from_str(value.unwrap_or("false"), err, "approved", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["order-id", "search-string", "sort-field", "ids", "max-results", "page-token", "site-id", "sort-order", "approved"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _orders_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.orders().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("project-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _orders_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.orders().list(opt.value_of("profile-id").unwrap_or(""), opt.value_of("project-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "site-id" => { + call = call.add_site_id(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "sort-field", "ids", "max-results", "page-token", "site-id", "sort-order"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placement_groups_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.placement_groups().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placement_groups_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id" => Some(("primaryPlacementId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id" => Some(("campaignId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.kind" => Some(("directorySiteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.value" => Some(("directorySiteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.dimension-name" => Some(("directorySiteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.etag" => Some(("directorySiteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.match-type" => Some(("directorySiteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.id" => Some(("directorySiteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id" => Some(("directorySiteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-type" => Some(("placementGroupType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "child-placement-ids" => Some(("childPlacementIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "content-category-id" => Some(("contentCategoryId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "external-id" => Some(("externalId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.kind" => Some(("primaryPlacementIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.value" => Some(("primaryPlacementIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.dimension-name" => Some(("primaryPlacementIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.etag" => Some(("primaryPlacementIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.match-type" => Some(("primaryPlacementIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.id" => Some(("primaryPlacementIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.kind" => Some(("campaignIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.value" => Some(("campaignIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.dimension-name" => Some(("campaignIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.etag" => Some(("campaignIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.match-type" => Some(("campaignIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.id" => Some(("campaignIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-info.time" => Some(("createInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id" => Some(("siteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.kind" => Some(("siteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.value" => Some(("siteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.dimension-name" => Some(("siteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.etag" => Some(("siteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.match-type" => Some(("siteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.id" => Some(("siteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-strategy-id" => Some(("placementStrategyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.start-date" => Some(("pricingSchedule.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.end-date" => Some(("pricingSchedule.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.flighted" => Some(("pricingSchedule.flighted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "pricing-schedule.disregard-overdelivery" => Some(("pricingSchedule.disregardOverdelivery", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "pricing-schedule.pricing-type" => Some(("pricingSchedule.pricingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.cap-cost-option" => Some(("pricingSchedule.capCostOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.testing-start-date" => Some(("pricingSchedule.testingStartDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.floodlight-activity-id" => Some(("pricingSchedule.floodlightActivityId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "archived", "campaign-id", "campaign-id-dimension-value", "cap-cost-option", "child-placement-ids", "comment", "content-category-id", "create-info", "dimension-name", "directory-site-id", "directory-site-id-dimension-value", "disregard-overdelivery", "end-date", "etag", "external-id", "flighted", "floodlight-activity-id", "id", "id-dimension-value", "kind", "last-modified-info", "match-type", "name", "placement-group-type", "placement-strategy-id", "pricing-schedule", "pricing-type", "primary-placement-id", "primary-placement-id-dimension-value", "site-id", "site-id-dimension-value", "start-date", "subaccount-id", "testing-start-date", "time", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::PlacementGroup = json::value::from_value(object).unwrap(); + let mut call = self.hub.placement_groups().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placement_groups_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.placement_groups().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "site-ids" => { + call = call.add_site_ids(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "pricing-types" => { + call = call.add_pricing_types(value.unwrap_or("")); + }, + "placement-strategy-ids" => { + call = call.add_placement_strategy_ids(value.unwrap_or("")); + }, + "placement-group-type" => { + call = call.placement_group_type(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "min-start-date" => { + call = call.min_start_date(value.unwrap_or("")); + }, + "min-end-date" => { + call = call.min_end_date(value.unwrap_or("")); + }, + "max-start-date" => { + call = call.max_start_date(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "max-end-date" => { + call = call.max_end_date(value.unwrap_or("")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "directory-site-ids" => { + call = call.add_directory_site_ids(value.unwrap_or("")); + }, + "content-category-ids" => { + call = call.add_content_category_ids(value.unwrap_or("")); + }, + "campaign-ids" => { + call = call.add_campaign_ids(value.unwrap_or("")); + }, + "archived" => { + call = call.archived(arg_from_str(value.unwrap_or("false"), err, "archived", "boolean")); + }, + "advertiser-ids" => { + call = call.add_advertiser_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["placement-strategy-ids", "site-ids", "search-string", "min-end-date", "directory-site-ids", "sort-field", "advertiser-ids", "archived", "ids", "max-results", "min-start-date", "page-token", "max-start-date", "sort-order", "placement-group-type", "pricing-types", "content-category-ids", "campaign-ids", "max-end-date"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placement_groups_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id" => Some(("primaryPlacementId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id" => Some(("campaignId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.kind" => Some(("directorySiteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.value" => Some(("directorySiteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.dimension-name" => Some(("directorySiteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.etag" => Some(("directorySiteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.match-type" => Some(("directorySiteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.id" => Some(("directorySiteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id" => Some(("directorySiteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-type" => Some(("placementGroupType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "child-placement-ids" => Some(("childPlacementIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "content-category-id" => Some(("contentCategoryId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "external-id" => Some(("externalId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.kind" => Some(("primaryPlacementIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.value" => Some(("primaryPlacementIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.dimension-name" => Some(("primaryPlacementIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.etag" => Some(("primaryPlacementIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.match-type" => Some(("primaryPlacementIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.id" => Some(("primaryPlacementIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.kind" => Some(("campaignIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.value" => Some(("campaignIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.dimension-name" => Some(("campaignIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.etag" => Some(("campaignIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.match-type" => Some(("campaignIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.id" => Some(("campaignIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-info.time" => Some(("createInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id" => Some(("siteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.kind" => Some(("siteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.value" => Some(("siteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.dimension-name" => Some(("siteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.etag" => Some(("siteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.match-type" => Some(("siteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.id" => Some(("siteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-strategy-id" => Some(("placementStrategyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.start-date" => Some(("pricingSchedule.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.end-date" => Some(("pricingSchedule.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.flighted" => Some(("pricingSchedule.flighted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "pricing-schedule.disregard-overdelivery" => Some(("pricingSchedule.disregardOverdelivery", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "pricing-schedule.pricing-type" => Some(("pricingSchedule.pricingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.cap-cost-option" => Some(("pricingSchedule.capCostOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.testing-start-date" => Some(("pricingSchedule.testingStartDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.floodlight-activity-id" => Some(("pricingSchedule.floodlightActivityId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "archived", "campaign-id", "campaign-id-dimension-value", "cap-cost-option", "child-placement-ids", "comment", "content-category-id", "create-info", "dimension-name", "directory-site-id", "directory-site-id-dimension-value", "disregard-overdelivery", "end-date", "etag", "external-id", "flighted", "floodlight-activity-id", "id", "id-dimension-value", "kind", "last-modified-info", "match-type", "name", "placement-group-type", "placement-strategy-id", "pricing-schedule", "pricing-type", "primary-placement-id", "primary-placement-id-dimension-value", "site-id", "site-id-dimension-value", "start-date", "subaccount-id", "testing-start-date", "time", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::PlacementGroup = json::value::from_value(object).unwrap(); + let mut call = self.hub.placement_groups().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placement_groups_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id" => Some(("primaryPlacementId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id" => Some(("campaignId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.kind" => Some(("directorySiteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.value" => Some(("directorySiteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.dimension-name" => Some(("directorySiteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.etag" => Some(("directorySiteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.match-type" => Some(("directorySiteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.id" => Some(("directorySiteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id" => Some(("directorySiteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-type" => Some(("placementGroupType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "child-placement-ids" => Some(("childPlacementIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "content-category-id" => Some(("contentCategoryId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "external-id" => Some(("externalId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.kind" => Some(("primaryPlacementIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.value" => Some(("primaryPlacementIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.dimension-name" => Some(("primaryPlacementIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.etag" => Some(("primaryPlacementIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.match-type" => Some(("primaryPlacementIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.id" => Some(("primaryPlacementIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.kind" => Some(("campaignIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.value" => Some(("campaignIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.dimension-name" => Some(("campaignIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.etag" => Some(("campaignIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.match-type" => Some(("campaignIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.id" => Some(("campaignIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-info.time" => Some(("createInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id" => Some(("siteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.kind" => Some(("siteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.value" => Some(("siteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.dimension-name" => Some(("siteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.etag" => Some(("siteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.match-type" => Some(("siteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.id" => Some(("siteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-strategy-id" => Some(("placementStrategyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.start-date" => Some(("pricingSchedule.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.end-date" => Some(("pricingSchedule.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.flighted" => Some(("pricingSchedule.flighted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "pricing-schedule.disregard-overdelivery" => Some(("pricingSchedule.disregardOverdelivery", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "pricing-schedule.pricing-type" => Some(("pricingSchedule.pricingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.cap-cost-option" => Some(("pricingSchedule.capCostOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.testing-start-date" => Some(("pricingSchedule.testingStartDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.floodlight-activity-id" => Some(("pricingSchedule.floodlightActivityId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "archived", "campaign-id", "campaign-id-dimension-value", "cap-cost-option", "child-placement-ids", "comment", "content-category-id", "create-info", "dimension-name", "directory-site-id", "directory-site-id-dimension-value", "disregard-overdelivery", "end-date", "etag", "external-id", "flighted", "floodlight-activity-id", "id", "id-dimension-value", "kind", "last-modified-info", "match-type", "name", "placement-group-type", "placement-strategy-id", "pricing-schedule", "pricing-type", "primary-placement-id", "primary-placement-id-dimension-value", "site-id", "site-id-dimension-value", "start-date", "subaccount-id", "testing-start-date", "time", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::PlacementGroup = json::value::from_value(object).unwrap(); + let mut call = self.hub.placement_groups().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placement_strategies_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.placement_strategies().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _placement_strategies_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.placement_strategies().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placement_strategies_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "id", "kind", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::PlacementStrategy = json::value::from_value(object).unwrap(); + let mut call = self.hub.placement_strategies().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placement_strategies_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.placement_strategies().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "sort-field", "ids", "max-results", "page-token", "sort-order"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placement_strategies_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "id", "kind", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::PlacementStrategy = json::value::from_value(object).unwrap(); + let mut call = self.hub.placement_strategies().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placement_strategies_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "id", "kind", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::PlacementStrategy = json::value::from_value(object).unwrap(); + let mut call = self.hub.placement_strategies().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placements_generatetags(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.placements().generatetags(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "tag-formats" => { + call = call.add_tag_formats(value.unwrap_or("")); + }, + "placement-ids" => { + call = call.add_placement_ids(value.unwrap_or("")); + }, + "campaign-id" => { + call = call.campaign_id(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["tag-formats", "placement-ids", "campaign-id"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placements_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.placements().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placements_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-active-view-opt-out" => Some(("videoActiveViewOptOut", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "campaign-id" => Some(("campaignId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "payment-source" => Some(("paymentSource", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.kind" => Some(("directorySiteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.value" => Some(("directorySiteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.dimension-name" => Some(("directorySiteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.etag" => Some(("directorySiteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.match-type" => Some(("directorySiteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.id" => Some(("directorySiteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "key-name" => Some(("keyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id" => Some(("directorySiteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.kind" => Some(("videoSettings.skippableSettings.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.skippable" => Some(("videoSettings.skippableSettings.skippable", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.skip-offset.offset-percentage" => Some(("videoSettings.skippableSettings.skipOffset.offsetPercentage", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.skip-offset.offset-seconds" => Some(("videoSettings.skippableSettings.skipOffset.offsetSeconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.progress-offset.offset-percentage" => Some(("videoSettings.skippableSettings.progressOffset.offsetPercentage", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.progress-offset.offset-seconds" => Some(("videoSettings.skippableSettings.progressOffset.offsetSeconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "video-settings.kind" => Some(("videoSettings.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.companion-settings.kind" => Some(("videoSettings.companionSettings.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.companion-settings.companions-disabled" => Some(("videoSettings.companionSettings.companionsDisabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "video-settings.companion-settings.image-only" => Some(("videoSettings.companionSettings.imageOnly", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "video-settings.transcode-settings.kind" => Some(("videoSettings.transcodeSettings.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.transcode-settings.enabled-video-formats" => Some(("videoSettings.transcodeSettings.enabledVideoFormats", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), + "publisher-update-info.time" => Some(("publisherUpdateInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tag-formats" => Some(("tagFormats", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "payment-approved" => Some(("paymentApproved", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "tag-setting.include-click-through-urls" => Some(("tagSetting.includeClickThroughUrls", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "tag-setting.include-click-tracking" => Some(("tagSetting.includeClickTracking", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "tag-setting.additional-key-values" => Some(("tagSetting.additionalKeyValues", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tag-setting.keyword-option" => Some(("tagSetting.keywordOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "content-category-id" => Some(("contentCategoryId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "external-id" => Some(("externalId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.width" => Some(("size.width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "size.kind" => Some(("size.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.iab" => Some(("size.iab", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "size.id" => Some(("size.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.height" => Some(("size.height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "ssl-required" => Some(("sslRequired", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.kind" => Some(("campaignIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.value" => Some(("campaignIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.dimension-name" => Some(("campaignIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.etag" => Some(("campaignIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.match-type" => Some(("campaignIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.id" => Some(("campaignIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary" => Some(("primary", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "placement-group-id" => Some(("placementGroupId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-info.time" => Some(("createInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id" => Some(("siteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.kind" => Some(("siteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.value" => Some(("siteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.dimension-name" => Some(("siteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.etag" => Some(("siteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.match-type" => Some(("siteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.id" => Some(("siteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "compatibility" => Some(("compatibility", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-strategy-id" => Some(("placementStrategyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.kind" => Some(("placementGroupIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.value" => Some(("placementGroupIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.dimension-name" => Some(("placementGroupIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.etag" => Some(("placementGroupIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.match-type" => Some(("placementGroupIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.id" => Some(("placementGroupIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "lookback-configuration.click-duration" => Some(("lookbackConfiguration.clickDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "lookback-configuration.post-impression-activities-duration" => Some(("lookbackConfiguration.postImpressionActivitiesDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.start-date" => Some(("pricingSchedule.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.end-date" => Some(("pricingSchedule.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.flighted" => Some(("pricingSchedule.flighted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "pricing-schedule.disregard-overdelivery" => Some(("pricingSchedule.disregardOverdelivery", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "pricing-schedule.pricing-type" => Some(("pricingSchedule.pricingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.cap-cost-option" => Some(("pricingSchedule.capCostOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.testing-start-date" => Some(("pricingSchedule.testingStartDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.floodlight-activity-id" => Some(("pricingSchedule.floodlightActivityId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "vpaid-adapter-choice" => Some(("vpaidAdapterChoice", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "additional-key-values", "advertiser-id", "advertiser-id-dimension-value", "archived", "campaign-id", "campaign-id-dimension-value", "cap-cost-option", "click-duration", "comment", "companion-settings", "companions-disabled", "compatibility", "content-category-id", "create-info", "dimension-name", "directory-site-id", "directory-site-id-dimension-value", "disregard-overdelivery", "enabled-video-formats", "end-date", "etag", "external-id", "flighted", "floodlight-activity-id", "height", "iab", "id", "id-dimension-value", "image-only", "include-click-through-urls", "include-click-tracking", "key-name", "keyword-option", "kind", "last-modified-info", "lookback-configuration", "match-type", "name", "offset-percentage", "offset-seconds", "payment-approved", "payment-source", "placement-group-id", "placement-group-id-dimension-value", "placement-strategy-id", "post-impression-activities-duration", "pricing-schedule", "pricing-type", "primary", "progress-offset", "publisher-update-info", "site-id", "site-id-dimension-value", "size", "skip-offset", "skippable", "skippable-settings", "ssl-required", "start-date", "status", "subaccount-id", "tag-formats", "tag-setting", "testing-start-date", "time", "transcode-settings", "value", "video-active-view-opt-out", "video-settings", "vpaid-adapter-choice", "width"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Placement = json::value::from_value(object).unwrap(); + let mut call = self.hub.placements().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placements_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.placements().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "size-ids" => { + call = call.add_size_ids(value.unwrap_or("")); + }, + "site-ids" => { + call = call.add_site_ids(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "pricing-types" => { + call = call.add_pricing_types(value.unwrap_or("")); + }, + "placement-strategy-ids" => { + call = call.add_placement_strategy_ids(value.unwrap_or("")); + }, + "payment-source" => { + call = call.payment_source(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "min-start-date" => { + call = call.min_start_date(value.unwrap_or("")); + }, + "min-end-date" => { + call = call.min_end_date(value.unwrap_or("")); + }, + "max-start-date" => { + call = call.max_start_date(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "max-end-date" => { + call = call.max_end_date(value.unwrap_or("")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "group-ids" => { + call = call.add_group_ids(value.unwrap_or("")); + }, + "directory-site-ids" => { + call = call.add_directory_site_ids(value.unwrap_or("")); + }, + "content-category-ids" => { + call = call.add_content_category_ids(value.unwrap_or("")); + }, + "compatibilities" => { + call = call.add_compatibilities(value.unwrap_or("")); + }, + "campaign-ids" => { + call = call.add_campaign_ids(value.unwrap_or("")); + }, + "archived" => { + call = call.archived(arg_from_str(value.unwrap_or("false"), err, "archived", "boolean")); + }, + "advertiser-ids" => { + call = call.add_advertiser_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["site-ids", "payment-source", "pricing-types", "campaign-ids", "archived", "advertiser-ids", "size-ids", "page-token", "max-start-date", "sort-order", "max-end-date", "placement-strategy-ids", "content-category-ids", "max-results", "min-start-date", "compatibilities", "search-string", "min-end-date", "directory-site-ids", "sort-field", "ids", "group-ids"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placements_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-active-view-opt-out" => Some(("videoActiveViewOptOut", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "campaign-id" => Some(("campaignId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "payment-source" => Some(("paymentSource", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.kind" => Some(("directorySiteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.value" => Some(("directorySiteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.dimension-name" => Some(("directorySiteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.etag" => Some(("directorySiteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.match-type" => Some(("directorySiteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.id" => Some(("directorySiteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "key-name" => Some(("keyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id" => Some(("directorySiteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.kind" => Some(("videoSettings.skippableSettings.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.skippable" => Some(("videoSettings.skippableSettings.skippable", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.skip-offset.offset-percentage" => Some(("videoSettings.skippableSettings.skipOffset.offsetPercentage", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.skip-offset.offset-seconds" => Some(("videoSettings.skippableSettings.skipOffset.offsetSeconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.progress-offset.offset-percentage" => Some(("videoSettings.skippableSettings.progressOffset.offsetPercentage", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.progress-offset.offset-seconds" => Some(("videoSettings.skippableSettings.progressOffset.offsetSeconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "video-settings.kind" => Some(("videoSettings.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.companion-settings.kind" => Some(("videoSettings.companionSettings.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.companion-settings.companions-disabled" => Some(("videoSettings.companionSettings.companionsDisabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "video-settings.companion-settings.image-only" => Some(("videoSettings.companionSettings.imageOnly", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "video-settings.transcode-settings.kind" => Some(("videoSettings.transcodeSettings.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.transcode-settings.enabled-video-formats" => Some(("videoSettings.transcodeSettings.enabledVideoFormats", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), + "publisher-update-info.time" => Some(("publisherUpdateInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tag-formats" => Some(("tagFormats", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "payment-approved" => Some(("paymentApproved", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "tag-setting.include-click-through-urls" => Some(("tagSetting.includeClickThroughUrls", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "tag-setting.include-click-tracking" => Some(("tagSetting.includeClickTracking", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "tag-setting.additional-key-values" => Some(("tagSetting.additionalKeyValues", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tag-setting.keyword-option" => Some(("tagSetting.keywordOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "content-category-id" => Some(("contentCategoryId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "external-id" => Some(("externalId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.width" => Some(("size.width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "size.kind" => Some(("size.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.iab" => Some(("size.iab", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "size.id" => Some(("size.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.height" => Some(("size.height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "ssl-required" => Some(("sslRequired", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.kind" => Some(("campaignIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.value" => Some(("campaignIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.dimension-name" => Some(("campaignIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.etag" => Some(("campaignIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.match-type" => Some(("campaignIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.id" => Some(("campaignIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary" => Some(("primary", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "placement-group-id" => Some(("placementGroupId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-info.time" => Some(("createInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id" => Some(("siteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.kind" => Some(("siteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.value" => Some(("siteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.dimension-name" => Some(("siteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.etag" => Some(("siteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.match-type" => Some(("siteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.id" => Some(("siteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "compatibility" => Some(("compatibility", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-strategy-id" => Some(("placementStrategyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.kind" => Some(("placementGroupIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.value" => Some(("placementGroupIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.dimension-name" => Some(("placementGroupIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.etag" => Some(("placementGroupIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.match-type" => Some(("placementGroupIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.id" => Some(("placementGroupIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "lookback-configuration.click-duration" => Some(("lookbackConfiguration.clickDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "lookback-configuration.post-impression-activities-duration" => Some(("lookbackConfiguration.postImpressionActivitiesDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.start-date" => Some(("pricingSchedule.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.end-date" => Some(("pricingSchedule.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.flighted" => Some(("pricingSchedule.flighted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "pricing-schedule.disregard-overdelivery" => Some(("pricingSchedule.disregardOverdelivery", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "pricing-schedule.pricing-type" => Some(("pricingSchedule.pricingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.cap-cost-option" => Some(("pricingSchedule.capCostOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.testing-start-date" => Some(("pricingSchedule.testingStartDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.floodlight-activity-id" => Some(("pricingSchedule.floodlightActivityId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "vpaid-adapter-choice" => Some(("vpaidAdapterChoice", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "additional-key-values", "advertiser-id", "advertiser-id-dimension-value", "archived", "campaign-id", "campaign-id-dimension-value", "cap-cost-option", "click-duration", "comment", "companion-settings", "companions-disabled", "compatibility", "content-category-id", "create-info", "dimension-name", "directory-site-id", "directory-site-id-dimension-value", "disregard-overdelivery", "enabled-video-formats", "end-date", "etag", "external-id", "flighted", "floodlight-activity-id", "height", "iab", "id", "id-dimension-value", "image-only", "include-click-through-urls", "include-click-tracking", "key-name", "keyword-option", "kind", "last-modified-info", "lookback-configuration", "match-type", "name", "offset-percentage", "offset-seconds", "payment-approved", "payment-source", "placement-group-id", "placement-group-id-dimension-value", "placement-strategy-id", "post-impression-activities-duration", "pricing-schedule", "pricing-type", "primary", "progress-offset", "publisher-update-info", "site-id", "site-id-dimension-value", "size", "skip-offset", "skippable", "skippable-settings", "ssl-required", "start-date", "status", "subaccount-id", "tag-formats", "tag-setting", "testing-start-date", "time", "transcode-settings", "value", "video-active-view-opt-out", "video-settings", "vpaid-adapter-choice", "width"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Placement = json::value::from_value(object).unwrap(); + let mut call = self.hub.placements().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placements_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-active-view-opt-out" => Some(("videoActiveViewOptOut", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "campaign-id" => Some(("campaignId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "payment-source" => Some(("paymentSource", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.kind" => Some(("directorySiteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.value" => Some(("directorySiteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.dimension-name" => Some(("directorySiteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.etag" => Some(("directorySiteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.match-type" => Some(("directorySiteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.id" => Some(("directorySiteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "key-name" => Some(("keyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id" => Some(("directorySiteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.kind" => Some(("videoSettings.skippableSettings.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.skippable" => Some(("videoSettings.skippableSettings.skippable", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.skip-offset.offset-percentage" => Some(("videoSettings.skippableSettings.skipOffset.offsetPercentage", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.skip-offset.offset-seconds" => Some(("videoSettings.skippableSettings.skipOffset.offsetSeconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.progress-offset.offset-percentage" => Some(("videoSettings.skippableSettings.progressOffset.offsetPercentage", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.progress-offset.offset-seconds" => Some(("videoSettings.skippableSettings.progressOffset.offsetSeconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "video-settings.kind" => Some(("videoSettings.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.companion-settings.kind" => Some(("videoSettings.companionSettings.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.companion-settings.companions-disabled" => Some(("videoSettings.companionSettings.companionsDisabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "video-settings.companion-settings.image-only" => Some(("videoSettings.companionSettings.imageOnly", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "video-settings.transcode-settings.kind" => Some(("videoSettings.transcodeSettings.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.transcode-settings.enabled-video-formats" => Some(("videoSettings.transcodeSettings.enabledVideoFormats", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), + "publisher-update-info.time" => Some(("publisherUpdateInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tag-formats" => Some(("tagFormats", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "payment-approved" => Some(("paymentApproved", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "tag-setting.include-click-through-urls" => Some(("tagSetting.includeClickThroughUrls", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "tag-setting.include-click-tracking" => Some(("tagSetting.includeClickTracking", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "tag-setting.additional-key-values" => Some(("tagSetting.additionalKeyValues", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tag-setting.keyword-option" => Some(("tagSetting.keywordOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "content-category-id" => Some(("contentCategoryId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "external-id" => Some(("externalId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.width" => Some(("size.width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "size.kind" => Some(("size.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.iab" => Some(("size.iab", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "size.id" => Some(("size.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.height" => Some(("size.height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "ssl-required" => Some(("sslRequired", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.kind" => Some(("campaignIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.value" => Some(("campaignIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.dimension-name" => Some(("campaignIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.etag" => Some(("campaignIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.match-type" => Some(("campaignIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.id" => Some(("campaignIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary" => Some(("primary", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "placement-group-id" => Some(("placementGroupId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-info.time" => Some(("createInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id" => Some(("siteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.kind" => Some(("siteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.value" => Some(("siteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.dimension-name" => Some(("siteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.etag" => Some(("siteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.match-type" => Some(("siteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.id" => Some(("siteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "compatibility" => Some(("compatibility", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-strategy-id" => Some(("placementStrategyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.kind" => Some(("placementGroupIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.value" => Some(("placementGroupIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.dimension-name" => Some(("placementGroupIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.etag" => Some(("placementGroupIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.match-type" => Some(("placementGroupIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.id" => Some(("placementGroupIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "lookback-configuration.click-duration" => Some(("lookbackConfiguration.clickDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "lookback-configuration.post-impression-activities-duration" => Some(("lookbackConfiguration.postImpressionActivitiesDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.start-date" => Some(("pricingSchedule.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.end-date" => Some(("pricingSchedule.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.flighted" => Some(("pricingSchedule.flighted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "pricing-schedule.disregard-overdelivery" => Some(("pricingSchedule.disregardOverdelivery", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "pricing-schedule.pricing-type" => Some(("pricingSchedule.pricingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.cap-cost-option" => Some(("pricingSchedule.capCostOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.testing-start-date" => Some(("pricingSchedule.testingStartDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.floodlight-activity-id" => Some(("pricingSchedule.floodlightActivityId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "vpaid-adapter-choice" => Some(("vpaidAdapterChoice", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "additional-key-values", "advertiser-id", "advertiser-id-dimension-value", "archived", "campaign-id", "campaign-id-dimension-value", "cap-cost-option", "click-duration", "comment", "companion-settings", "companions-disabled", "compatibility", "content-category-id", "create-info", "dimension-name", "directory-site-id", "directory-site-id-dimension-value", "disregard-overdelivery", "enabled-video-formats", "end-date", "etag", "external-id", "flighted", "floodlight-activity-id", "height", "iab", "id", "id-dimension-value", "image-only", "include-click-through-urls", "include-click-tracking", "key-name", "keyword-option", "kind", "last-modified-info", "lookback-configuration", "match-type", "name", "offset-percentage", "offset-seconds", "payment-approved", "payment-source", "placement-group-id", "placement-group-id-dimension-value", "placement-strategy-id", "post-impression-activities-duration", "pricing-schedule", "pricing-type", "primary", "progress-offset", "publisher-update-info", "site-id", "site-id-dimension-value", "size", "skip-offset", "skippable", "skippable-settings", "ssl-required", "start-date", "status", "subaccount-id", "tag-formats", "tag-setting", "testing-start-date", "time", "transcode-settings", "value", "video-active-view-opt-out", "video-settings", "vpaid-adapter-choice", "width"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Placement = json::value::from_value(object).unwrap(); + let mut call = self.hub.placements().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _platform_types_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.platform_types().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _platform_types_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.platform_types().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _postal_codes_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.postal_codes().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("code").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _postal_codes_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.postal_codes().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "advertiser-ids" => { + call = call.add_advertiser_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "sort-field", "advertiser-ids", "ids", "max-results", "page-token", "sort-order"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _regions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.regions().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _remarketing_list_shares_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.remarketing_list_shares().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("remarketing-list-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _remarketing_list_shares_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "shared-advertiser-ids" => Some(("sharedAdvertiserIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "remarketing-list-id" => Some(("remarketingListId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "shared-account-ids" => Some(("sharedAccountIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["kind", "remarketing-list-id", "shared-account-ids", "shared-advertiser-ids"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::RemarketingListShare = json::value::from_value(object).unwrap(); + let mut call = self.hub.remarketing_list_shares().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("remarketing-list-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _remarketing_list_shares_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "shared-advertiser-ids" => Some(("sharedAdvertiserIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "remarketing-list-id" => Some(("remarketingListId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "shared-account-ids" => Some(("sharedAccountIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["kind", "remarketing-list-id", "shared-account-ids", "shared-advertiser-ids"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::RemarketingListShare = json::value::from_value(object).unwrap(); + let mut call = self.hub.remarketing_list_shares().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _remarketing_lists_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.remarketing_lists().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _remarketing_lists_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "list-population-rule.floodlight-activity-name" => Some(("listPopulationRule.floodlightActivityName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "list-population-rule.floodlight-activity-id" => Some(("listPopulationRule.floodlightActivityId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "list-size" => Some(("listSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "life-span" => Some(("lifeSpan", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "list-source" => Some(("listSource", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "advertiser-id", "advertiser-id-dimension-value", "description", "dimension-name", "etag", "floodlight-activity-id", "floodlight-activity-name", "id", "kind", "life-span", "list-population-rule", "list-size", "list-source", "match-type", "name", "subaccount-id", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::RemarketingList = json::value::from_value(object).unwrap(); + let mut call = self.hub.remarketing_lists().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _remarketing_lists_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.remarketing_lists().list(opt.value_of("profile-id").unwrap_or(""), opt.value_of("advertiser-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "name" => { + call = call.name(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "floodlight-activity-id" => { + call = call.floodlight_activity_id(value.unwrap_or("")); + }, + "active" => { + call = call.active(arg_from_str(value.unwrap_or("false"), err, "active", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["name", "sort-field", "max-results", "page-token", "sort-order", "active", "floodlight-activity-id"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _remarketing_lists_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "list-population-rule.floodlight-activity-name" => Some(("listPopulationRule.floodlightActivityName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "list-population-rule.floodlight-activity-id" => Some(("listPopulationRule.floodlightActivityId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "list-size" => Some(("listSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "life-span" => Some(("lifeSpan", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "list-source" => Some(("listSource", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "advertiser-id", "advertiser-id-dimension-value", "description", "dimension-name", "etag", "floodlight-activity-id", "floodlight-activity-name", "id", "kind", "life-span", "list-population-rule", "list-size", "list-source", "match-type", "name", "subaccount-id", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::RemarketingList = json::value::from_value(object).unwrap(); + let mut call = self.hub.remarketing_lists().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _remarketing_lists_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "list-population-rule.floodlight-activity-name" => Some(("listPopulationRule.floodlightActivityName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "list-population-rule.floodlight-activity-id" => Some(("listPopulationRule.floodlightActivityId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "list-size" => Some(("listSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "life-span" => Some(("lifeSpan", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "list-source" => Some(("listSource", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "advertiser-id", "advertiser-id-dimension-value", "description", "dimension-name", "etag", "floodlight-activity-id", "floodlight-activity-name", "id", "kind", "life-span", "list-population-rule", "list-size", "list-source", "match-type", "name", "subaccount-id", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::RemarketingList = json::value::from_value(object).unwrap(); + let mut call = self.hub.remarketing_lists().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _reports_compatible_fields_query(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "criteria.activities.kind" => Some(("criteria.activities.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.activities.metric-names" => Some(("criteria.activities.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "criteria.date-range.start-date" => Some(("criteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.date-range.kind" => Some(("criteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.date-range.end-date" => Some(("criteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.date-range.relative-date-range" => Some(("criteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.custom-rich-media-events.kind" => Some(("criteria.customRichMediaEvents.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.metric-names" => Some(("criteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "sub-account-id" => Some(("subAccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.start-date" => Some(("schedule.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.runs-on-day-of-month" => Some(("schedule.runsOnDayOfMonth", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.every" => Some(("schedule.every", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "schedule.expiration-date" => Some(("schedule.expirationDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.active" => Some(("schedule.active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "schedule.repeats" => Some(("schedule.repeats", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.repeats-on-week-days" => Some(("schedule.repeatsOnWeekDays", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "path-to-conversion-criteria.date-range.start-date" => Some(("pathToConversionCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.date-range.kind" => Some(("pathToConversionCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.date-range.end-date" => Some(("pathToConversionCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.date-range.relative-date-range" => Some(("pathToConversionCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.kind" => Some(("pathToConversionCriteria.floodlightConfigId.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.value" => Some(("pathToConversionCriteria.floodlightConfigId.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.dimension-name" => Some(("pathToConversionCriteria.floodlightConfigId.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.etag" => Some(("pathToConversionCriteria.floodlightConfigId.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.match-type" => Some(("pathToConversionCriteria.floodlightConfigId.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.id" => Some(("pathToConversionCriteria.floodlightConfigId.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.clicks-lookback-window" => Some(("pathToConversionCriteria.reportProperties.clicksLookbackWindow", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.pivot-on-interaction-path" => Some(("pathToConversionCriteria.reportProperties.pivotOnInteractionPath", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.impressions-lookback-window" => Some(("pathToConversionCriteria.reportProperties.impressionsLookbackWindow", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.include-unattributed-ip-conversions" => Some(("pathToConversionCriteria.reportProperties.includeUnattributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.include-unattributed-cookie-conversions" => Some(("pathToConversionCriteria.reportProperties.includeUnattributedCookieConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.maximum-interaction-gap" => Some(("pathToConversionCriteria.reportProperties.maximumInteractionGap", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.include-attributed-ip-conversions" => Some(("pathToConversionCriteria.reportProperties.includeAttributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.maximum-click-interactions" => Some(("pathToConversionCriteria.reportProperties.maximumClickInteractions", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.maximum-impression-interactions" => Some(("pathToConversionCriteria.reportProperties.maximumImpressionInteractions", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.metric-names" => Some(("pathToConversionCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "format" => Some(("format", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.activities.kind" => Some(("reachCriteria.activities.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.activities.metric-names" => Some(("reachCriteria.activities.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "reach-criteria.metric-names" => Some(("reachCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "reach-criteria.date-range.start-date" => Some(("reachCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.date-range.kind" => Some(("reachCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.date-range.end-date" => Some(("reachCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.date-range.relative-date-range" => Some(("reachCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.reach-by-frequency-metric-names" => Some(("reachCriteria.reachByFrequencyMetricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "reach-criteria.custom-rich-media-events.kind" => Some(("reachCriteria.customRichMediaEvents.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.enable-all-dimension-combinations" => Some(("reachCriteria.enableAllDimensionCombinations", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "file-name" => Some(("fileName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery.message" => Some(("delivery.message", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery.email-owner-delivery-type" => Some(("delivery.emailOwnerDeliveryType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery.email-owner" => Some(("delivery.emailOwner", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "owner-profile-id" => Some(("ownerProfileId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-modified-time" => Some(("lastModifiedTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.start-date" => Some(("floodlightCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.kind" => Some(("floodlightCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.end-date" => Some(("floodlightCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.relative-date-range" => Some(("floodlightCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.kind" => Some(("floodlightCriteria.floodlightConfigId.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.value" => Some(("floodlightCriteria.floodlightConfigId.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.dimension-name" => Some(("floodlightCriteria.floodlightConfigId.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.etag" => Some(("floodlightCriteria.floodlightConfigId.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.match-type" => Some(("floodlightCriteria.floodlightConfigId.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.id" => Some(("floodlightCriteria.floodlightConfigId.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.report-properties.include-unattributed-ip-conversions" => Some(("floodlightCriteria.reportProperties.includeUnattributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-criteria.report-properties.include-unattributed-cookie-conversions" => Some(("floodlightCriteria.reportProperties.includeUnattributedCookieConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-criteria.report-properties.include-attributed-ip-conversions" => Some(("floodlightCriteria.reportProperties.includeAttributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-criteria.metric-names" => Some(("floodlightCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "cross-dimension-reach-criteria.pivoted" => Some(("crossDimensionReachCriteria.pivoted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.start-date" => Some(("crossDimensionReachCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.kind" => Some(("crossDimensionReachCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.end-date" => Some(("crossDimensionReachCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.relative-date-range" => Some(("crossDimensionReachCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.dimension" => Some(("crossDimensionReachCriteria.dimension", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.overlap-metric-names" => Some(("crossDimensionReachCriteria.overlapMetricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "cross-dimension-reach-criteria.metric-names" => Some(("crossDimensionReachCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "activities", "clicks-lookback-window", "criteria", "cross-dimension-reach-criteria", "custom-rich-media-events", "date-range", "delivery", "dimension", "dimension-name", "email-owner", "email-owner-delivery-type", "enable-all-dimension-combinations", "end-date", "etag", "every", "expiration-date", "file-name", "floodlight-config-id", "floodlight-criteria", "format", "id", "impressions-lookback-window", "include-attributed-ip-conversions", "include-unattributed-cookie-conversions", "include-unattributed-ip-conversions", "kind", "last-modified-time", "match-type", "maximum-click-interactions", "maximum-impression-interactions", "maximum-interaction-gap", "message", "metric-names", "name", "overlap-metric-names", "owner-profile-id", "path-to-conversion-criteria", "pivot-on-interaction-path", "pivoted", "reach-by-frequency-metric-names", "reach-criteria", "relative-date-range", "repeats", "repeats-on-week-days", "report-properties", "runs-on-day-of-month", "schedule", "start-date", "sub-account-id", "type", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Report = json::value::from_value(object).unwrap(); + let mut call = self.hub.reports().compatible_fields_query(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _reports_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.reports().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("report-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _reports_files_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut download_mode = false; + let mut call = self.hub.reports().files_get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("report-id").unwrap_or(""), opt.value_of("file-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + if key == "alt" && value.unwrap_or("unset") == "media" { + download_mode = true; + } + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + if !download_mode { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + } else { + io::copy(&mut response, &mut ostream).unwrap(); + ostream.flush().unwrap(); + } + Ok(()) + } + } + } + } + + fn _reports_files_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.reports().files_list(opt.value_of("profile-id").unwrap_or(""), opt.value_of("report-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["sort-field", "sort-order", "max-results", "page-token"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _reports_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.reports().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("report-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _reports_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "criteria.activities.kind" => Some(("criteria.activities.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.activities.metric-names" => Some(("criteria.activities.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "criteria.date-range.start-date" => Some(("criteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.date-range.kind" => Some(("criteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.date-range.end-date" => Some(("criteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.date-range.relative-date-range" => Some(("criteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.custom-rich-media-events.kind" => Some(("criteria.customRichMediaEvents.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.metric-names" => Some(("criteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "sub-account-id" => Some(("subAccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.start-date" => Some(("schedule.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.runs-on-day-of-month" => Some(("schedule.runsOnDayOfMonth", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.every" => Some(("schedule.every", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "schedule.expiration-date" => Some(("schedule.expirationDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.active" => Some(("schedule.active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "schedule.repeats" => Some(("schedule.repeats", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.repeats-on-week-days" => Some(("schedule.repeatsOnWeekDays", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "path-to-conversion-criteria.date-range.start-date" => Some(("pathToConversionCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.date-range.kind" => Some(("pathToConversionCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.date-range.end-date" => Some(("pathToConversionCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.date-range.relative-date-range" => Some(("pathToConversionCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.kind" => Some(("pathToConversionCriteria.floodlightConfigId.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.value" => Some(("pathToConversionCriteria.floodlightConfigId.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.dimension-name" => Some(("pathToConversionCriteria.floodlightConfigId.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.etag" => Some(("pathToConversionCriteria.floodlightConfigId.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.match-type" => Some(("pathToConversionCriteria.floodlightConfigId.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.id" => Some(("pathToConversionCriteria.floodlightConfigId.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.clicks-lookback-window" => Some(("pathToConversionCriteria.reportProperties.clicksLookbackWindow", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.pivot-on-interaction-path" => Some(("pathToConversionCriteria.reportProperties.pivotOnInteractionPath", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.impressions-lookback-window" => Some(("pathToConversionCriteria.reportProperties.impressionsLookbackWindow", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.include-unattributed-ip-conversions" => Some(("pathToConversionCriteria.reportProperties.includeUnattributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.include-unattributed-cookie-conversions" => Some(("pathToConversionCriteria.reportProperties.includeUnattributedCookieConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.maximum-interaction-gap" => Some(("pathToConversionCriteria.reportProperties.maximumInteractionGap", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.include-attributed-ip-conversions" => Some(("pathToConversionCriteria.reportProperties.includeAttributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.maximum-click-interactions" => Some(("pathToConversionCriteria.reportProperties.maximumClickInteractions", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.maximum-impression-interactions" => Some(("pathToConversionCriteria.reportProperties.maximumImpressionInteractions", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.metric-names" => Some(("pathToConversionCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "format" => Some(("format", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.activities.kind" => Some(("reachCriteria.activities.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.activities.metric-names" => Some(("reachCriteria.activities.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "reach-criteria.metric-names" => Some(("reachCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "reach-criteria.date-range.start-date" => Some(("reachCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.date-range.kind" => Some(("reachCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.date-range.end-date" => Some(("reachCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.date-range.relative-date-range" => Some(("reachCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.reach-by-frequency-metric-names" => Some(("reachCriteria.reachByFrequencyMetricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "reach-criteria.custom-rich-media-events.kind" => Some(("reachCriteria.customRichMediaEvents.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.enable-all-dimension-combinations" => Some(("reachCriteria.enableAllDimensionCombinations", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "file-name" => Some(("fileName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery.message" => Some(("delivery.message", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery.email-owner-delivery-type" => Some(("delivery.emailOwnerDeliveryType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery.email-owner" => Some(("delivery.emailOwner", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "owner-profile-id" => Some(("ownerProfileId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-modified-time" => Some(("lastModifiedTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.start-date" => Some(("floodlightCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.kind" => Some(("floodlightCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.end-date" => Some(("floodlightCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.relative-date-range" => Some(("floodlightCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.kind" => Some(("floodlightCriteria.floodlightConfigId.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.value" => Some(("floodlightCriteria.floodlightConfigId.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.dimension-name" => Some(("floodlightCriteria.floodlightConfigId.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.etag" => Some(("floodlightCriteria.floodlightConfigId.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.match-type" => Some(("floodlightCriteria.floodlightConfigId.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.id" => Some(("floodlightCriteria.floodlightConfigId.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.report-properties.include-unattributed-ip-conversions" => Some(("floodlightCriteria.reportProperties.includeUnattributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-criteria.report-properties.include-unattributed-cookie-conversions" => Some(("floodlightCriteria.reportProperties.includeUnattributedCookieConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-criteria.report-properties.include-attributed-ip-conversions" => Some(("floodlightCriteria.reportProperties.includeAttributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-criteria.metric-names" => Some(("floodlightCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "cross-dimension-reach-criteria.pivoted" => Some(("crossDimensionReachCriteria.pivoted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.start-date" => Some(("crossDimensionReachCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.kind" => Some(("crossDimensionReachCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.end-date" => Some(("crossDimensionReachCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.relative-date-range" => Some(("crossDimensionReachCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.dimension" => Some(("crossDimensionReachCriteria.dimension", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.overlap-metric-names" => Some(("crossDimensionReachCriteria.overlapMetricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "cross-dimension-reach-criteria.metric-names" => Some(("crossDimensionReachCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "activities", "clicks-lookback-window", "criteria", "cross-dimension-reach-criteria", "custom-rich-media-events", "date-range", "delivery", "dimension", "dimension-name", "email-owner", "email-owner-delivery-type", "enable-all-dimension-combinations", "end-date", "etag", "every", "expiration-date", "file-name", "floodlight-config-id", "floodlight-criteria", "format", "id", "impressions-lookback-window", "include-attributed-ip-conversions", "include-unattributed-cookie-conversions", "include-unattributed-ip-conversions", "kind", "last-modified-time", "match-type", "maximum-click-interactions", "maximum-impression-interactions", "maximum-interaction-gap", "message", "metric-names", "name", "overlap-metric-names", "owner-profile-id", "path-to-conversion-criteria", "pivot-on-interaction-path", "pivoted", "reach-by-frequency-metric-names", "reach-criteria", "relative-date-range", "repeats", "repeats-on-week-days", "report-properties", "runs-on-day-of-month", "schedule", "start-date", "sub-account-id", "type", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Report = json::value::from_value(object).unwrap(); + let mut call = self.hub.reports().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _reports_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.reports().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "scope" => { + call = call.scope(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["sort-field", "max-results", "sort-order", "page-token", "scope"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _reports_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "criteria.activities.kind" => Some(("criteria.activities.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.activities.metric-names" => Some(("criteria.activities.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "criteria.date-range.start-date" => Some(("criteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.date-range.kind" => Some(("criteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.date-range.end-date" => Some(("criteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.date-range.relative-date-range" => Some(("criteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.custom-rich-media-events.kind" => Some(("criteria.customRichMediaEvents.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.metric-names" => Some(("criteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "sub-account-id" => Some(("subAccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.start-date" => Some(("schedule.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.runs-on-day-of-month" => Some(("schedule.runsOnDayOfMonth", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.every" => Some(("schedule.every", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "schedule.expiration-date" => Some(("schedule.expirationDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.active" => Some(("schedule.active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "schedule.repeats" => Some(("schedule.repeats", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.repeats-on-week-days" => Some(("schedule.repeatsOnWeekDays", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "path-to-conversion-criteria.date-range.start-date" => Some(("pathToConversionCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.date-range.kind" => Some(("pathToConversionCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.date-range.end-date" => Some(("pathToConversionCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.date-range.relative-date-range" => Some(("pathToConversionCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.kind" => Some(("pathToConversionCriteria.floodlightConfigId.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.value" => Some(("pathToConversionCriteria.floodlightConfigId.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.dimension-name" => Some(("pathToConversionCriteria.floodlightConfigId.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.etag" => Some(("pathToConversionCriteria.floodlightConfigId.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.match-type" => Some(("pathToConversionCriteria.floodlightConfigId.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.id" => Some(("pathToConversionCriteria.floodlightConfigId.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.clicks-lookback-window" => Some(("pathToConversionCriteria.reportProperties.clicksLookbackWindow", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.pivot-on-interaction-path" => Some(("pathToConversionCriteria.reportProperties.pivotOnInteractionPath", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.impressions-lookback-window" => Some(("pathToConversionCriteria.reportProperties.impressionsLookbackWindow", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.include-unattributed-ip-conversions" => Some(("pathToConversionCriteria.reportProperties.includeUnattributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.include-unattributed-cookie-conversions" => Some(("pathToConversionCriteria.reportProperties.includeUnattributedCookieConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.maximum-interaction-gap" => Some(("pathToConversionCriteria.reportProperties.maximumInteractionGap", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.include-attributed-ip-conversions" => Some(("pathToConversionCriteria.reportProperties.includeAttributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.maximum-click-interactions" => Some(("pathToConversionCriteria.reportProperties.maximumClickInteractions", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.maximum-impression-interactions" => Some(("pathToConversionCriteria.reportProperties.maximumImpressionInteractions", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.metric-names" => Some(("pathToConversionCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "format" => Some(("format", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.activities.kind" => Some(("reachCriteria.activities.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.activities.metric-names" => Some(("reachCriteria.activities.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "reach-criteria.metric-names" => Some(("reachCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "reach-criteria.date-range.start-date" => Some(("reachCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.date-range.kind" => Some(("reachCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.date-range.end-date" => Some(("reachCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.date-range.relative-date-range" => Some(("reachCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.reach-by-frequency-metric-names" => Some(("reachCriteria.reachByFrequencyMetricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "reach-criteria.custom-rich-media-events.kind" => Some(("reachCriteria.customRichMediaEvents.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.enable-all-dimension-combinations" => Some(("reachCriteria.enableAllDimensionCombinations", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "file-name" => Some(("fileName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery.message" => Some(("delivery.message", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery.email-owner-delivery-type" => Some(("delivery.emailOwnerDeliveryType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery.email-owner" => Some(("delivery.emailOwner", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "owner-profile-id" => Some(("ownerProfileId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-modified-time" => Some(("lastModifiedTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.start-date" => Some(("floodlightCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.kind" => Some(("floodlightCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.end-date" => Some(("floodlightCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.relative-date-range" => Some(("floodlightCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.kind" => Some(("floodlightCriteria.floodlightConfigId.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.value" => Some(("floodlightCriteria.floodlightConfigId.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.dimension-name" => Some(("floodlightCriteria.floodlightConfigId.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.etag" => Some(("floodlightCriteria.floodlightConfigId.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.match-type" => Some(("floodlightCriteria.floodlightConfigId.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.id" => Some(("floodlightCriteria.floodlightConfigId.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.report-properties.include-unattributed-ip-conversions" => Some(("floodlightCriteria.reportProperties.includeUnattributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-criteria.report-properties.include-unattributed-cookie-conversions" => Some(("floodlightCriteria.reportProperties.includeUnattributedCookieConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-criteria.report-properties.include-attributed-ip-conversions" => Some(("floodlightCriteria.reportProperties.includeAttributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-criteria.metric-names" => Some(("floodlightCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "cross-dimension-reach-criteria.pivoted" => Some(("crossDimensionReachCriteria.pivoted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.start-date" => Some(("crossDimensionReachCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.kind" => Some(("crossDimensionReachCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.end-date" => Some(("crossDimensionReachCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.relative-date-range" => Some(("crossDimensionReachCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.dimension" => Some(("crossDimensionReachCriteria.dimension", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.overlap-metric-names" => Some(("crossDimensionReachCriteria.overlapMetricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "cross-dimension-reach-criteria.metric-names" => Some(("crossDimensionReachCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "activities", "clicks-lookback-window", "criteria", "cross-dimension-reach-criteria", "custom-rich-media-events", "date-range", "delivery", "dimension", "dimension-name", "email-owner", "email-owner-delivery-type", "enable-all-dimension-combinations", "end-date", "etag", "every", "expiration-date", "file-name", "floodlight-config-id", "floodlight-criteria", "format", "id", "impressions-lookback-window", "include-attributed-ip-conversions", "include-unattributed-cookie-conversions", "include-unattributed-ip-conversions", "kind", "last-modified-time", "match-type", "maximum-click-interactions", "maximum-impression-interactions", "maximum-interaction-gap", "message", "metric-names", "name", "overlap-metric-names", "owner-profile-id", "path-to-conversion-criteria", "pivot-on-interaction-path", "pivoted", "reach-by-frequency-metric-names", "reach-criteria", "relative-date-range", "repeats", "repeats-on-week-days", "report-properties", "runs-on-day-of-month", "schedule", "start-date", "sub-account-id", "type", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Report = json::value::from_value(object).unwrap(); + let mut call = self.hub.reports().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("report-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _reports_run(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.reports().run(opt.value_of("profile-id").unwrap_or(""), opt.value_of("report-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "synchronous" => { + call = call.synchronous(arg_from_str(value.unwrap_or("false"), err, "synchronous", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["synchronous"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _reports_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "criteria.activities.kind" => Some(("criteria.activities.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.activities.metric-names" => Some(("criteria.activities.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "criteria.date-range.start-date" => Some(("criteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.date-range.kind" => Some(("criteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.date-range.end-date" => Some(("criteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.date-range.relative-date-range" => Some(("criteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.custom-rich-media-events.kind" => Some(("criteria.customRichMediaEvents.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.metric-names" => Some(("criteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "sub-account-id" => Some(("subAccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.start-date" => Some(("schedule.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.runs-on-day-of-month" => Some(("schedule.runsOnDayOfMonth", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.every" => Some(("schedule.every", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "schedule.expiration-date" => Some(("schedule.expirationDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.active" => Some(("schedule.active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "schedule.repeats" => Some(("schedule.repeats", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.repeats-on-week-days" => Some(("schedule.repeatsOnWeekDays", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "path-to-conversion-criteria.date-range.start-date" => Some(("pathToConversionCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.date-range.kind" => Some(("pathToConversionCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.date-range.end-date" => Some(("pathToConversionCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.date-range.relative-date-range" => Some(("pathToConversionCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.kind" => Some(("pathToConversionCriteria.floodlightConfigId.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.value" => Some(("pathToConversionCriteria.floodlightConfigId.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.dimension-name" => Some(("pathToConversionCriteria.floodlightConfigId.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.etag" => Some(("pathToConversionCriteria.floodlightConfigId.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.match-type" => Some(("pathToConversionCriteria.floodlightConfigId.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.id" => Some(("pathToConversionCriteria.floodlightConfigId.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.clicks-lookback-window" => Some(("pathToConversionCriteria.reportProperties.clicksLookbackWindow", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.pivot-on-interaction-path" => Some(("pathToConversionCriteria.reportProperties.pivotOnInteractionPath", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.impressions-lookback-window" => Some(("pathToConversionCriteria.reportProperties.impressionsLookbackWindow", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.include-unattributed-ip-conversions" => Some(("pathToConversionCriteria.reportProperties.includeUnattributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.include-unattributed-cookie-conversions" => Some(("pathToConversionCriteria.reportProperties.includeUnattributedCookieConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.maximum-interaction-gap" => Some(("pathToConversionCriteria.reportProperties.maximumInteractionGap", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.include-attributed-ip-conversions" => Some(("pathToConversionCriteria.reportProperties.includeAttributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.maximum-click-interactions" => Some(("pathToConversionCriteria.reportProperties.maximumClickInteractions", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.maximum-impression-interactions" => Some(("pathToConversionCriteria.reportProperties.maximumImpressionInteractions", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.metric-names" => Some(("pathToConversionCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "format" => Some(("format", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.activities.kind" => Some(("reachCriteria.activities.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.activities.metric-names" => Some(("reachCriteria.activities.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "reach-criteria.metric-names" => Some(("reachCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "reach-criteria.date-range.start-date" => Some(("reachCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.date-range.kind" => Some(("reachCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.date-range.end-date" => Some(("reachCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.date-range.relative-date-range" => Some(("reachCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.reach-by-frequency-metric-names" => Some(("reachCriteria.reachByFrequencyMetricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "reach-criteria.custom-rich-media-events.kind" => Some(("reachCriteria.customRichMediaEvents.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.enable-all-dimension-combinations" => Some(("reachCriteria.enableAllDimensionCombinations", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "file-name" => Some(("fileName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery.message" => Some(("delivery.message", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery.email-owner-delivery-type" => Some(("delivery.emailOwnerDeliveryType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery.email-owner" => Some(("delivery.emailOwner", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "owner-profile-id" => Some(("ownerProfileId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-modified-time" => Some(("lastModifiedTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.start-date" => Some(("floodlightCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.kind" => Some(("floodlightCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.end-date" => Some(("floodlightCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.relative-date-range" => Some(("floodlightCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.kind" => Some(("floodlightCriteria.floodlightConfigId.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.value" => Some(("floodlightCriteria.floodlightConfigId.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.dimension-name" => Some(("floodlightCriteria.floodlightConfigId.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.etag" => Some(("floodlightCriteria.floodlightConfigId.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.match-type" => Some(("floodlightCriteria.floodlightConfigId.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.id" => Some(("floodlightCriteria.floodlightConfigId.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.report-properties.include-unattributed-ip-conversions" => Some(("floodlightCriteria.reportProperties.includeUnattributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-criteria.report-properties.include-unattributed-cookie-conversions" => Some(("floodlightCriteria.reportProperties.includeUnattributedCookieConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-criteria.report-properties.include-attributed-ip-conversions" => Some(("floodlightCriteria.reportProperties.includeAttributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-criteria.metric-names" => Some(("floodlightCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "cross-dimension-reach-criteria.pivoted" => Some(("crossDimensionReachCriteria.pivoted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.start-date" => Some(("crossDimensionReachCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.kind" => Some(("crossDimensionReachCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.end-date" => Some(("crossDimensionReachCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.relative-date-range" => Some(("crossDimensionReachCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.dimension" => Some(("crossDimensionReachCriteria.dimension", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.overlap-metric-names" => Some(("crossDimensionReachCriteria.overlapMetricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "cross-dimension-reach-criteria.metric-names" => Some(("crossDimensionReachCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "activities", "clicks-lookback-window", "criteria", "cross-dimension-reach-criteria", "custom-rich-media-events", "date-range", "delivery", "dimension", "dimension-name", "email-owner", "email-owner-delivery-type", "enable-all-dimension-combinations", "end-date", "etag", "every", "expiration-date", "file-name", "floodlight-config-id", "floodlight-criteria", "format", "id", "impressions-lookback-window", "include-attributed-ip-conversions", "include-unattributed-cookie-conversions", "include-unattributed-ip-conversions", "kind", "last-modified-time", "match-type", "maximum-click-interactions", "maximum-impression-interactions", "maximum-interaction-gap", "message", "metric-names", "name", "overlap-metric-names", "owner-profile-id", "path-to-conversion-criteria", "pivot-on-interaction-path", "pivoted", "reach-by-frequency-metric-names", "reach-criteria", "relative-date-range", "repeats", "repeats-on-week-days", "report-properties", "runs-on-day-of-month", "schedule", "start-date", "sub-account-id", "type", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Report = json::value::from_value(object).unwrap(); + let mut call = self.hub.reports().update(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("report-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _sites_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.sites().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _sites_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.kind" => Some(("directorySiteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.value" => Some(("directorySiteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.dimension-name" => Some(("directorySiteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.etag" => Some(("directorySiteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.match-type" => Some(("directorySiteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.id" => Some(("directorySiteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-settings.disable-brand-safe-ads" => Some(("siteSettings.disableBrandSafeAds", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.active-view-opt-out" => Some(("siteSettings.activeViewOptOut", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.video-active-view-opt-out-template" => Some(("siteSettings.videoActiveViewOptOutTemplate", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.lookback-configuration.click-duration" => Some(("siteSettings.lookbackConfiguration.clickDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "site-settings.lookback-configuration.post-impression-activities-duration" => Some(("siteSettings.lookbackConfiguration.postImpressionActivitiesDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "site-settings.disable-new-cookie" => Some(("siteSettings.disableNewCookie", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.tag-setting.include-click-through-urls" => Some(("siteSettings.tagSetting.includeClickThroughUrls", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.tag-setting.include-click-tracking" => Some(("siteSettings.tagSetting.includeClickTracking", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.tag-setting.additional-key-values" => Some(("siteSettings.tagSetting.additionalKeyValues", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-settings.tag-setting.keyword-option" => Some(("siteSettings.tagSetting.keywordOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-settings.vpaid-adapter-choice-template" => Some(("siteSettings.vpaidAdapterChoiceTemplate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-settings.creative-settings.i-frame-header" => Some(("siteSettings.creativeSettings.iFrameHeader", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-settings.creative-settings.i-frame-footer" => Some(("siteSettings.creativeSettings.iFrameFooter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "approved" => Some(("approved", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "key-name" => Some(("keyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id" => Some(("directorySiteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active-view-opt-out", "additional-key-values", "approved", "click-duration", "creative-settings", "dimension-name", "directory-site-id", "directory-site-id-dimension-value", "disable-brand-safe-ads", "disable-new-cookie", "etag", "i-frame-footer", "i-frame-header", "id", "id-dimension-value", "include-click-through-urls", "include-click-tracking", "key-name", "keyword-option", "kind", "lookback-configuration", "match-type", "name", "post-impression-activities-duration", "site-settings", "subaccount-id", "tag-setting", "value", "video-active-view-opt-out-template", "vpaid-adapter-choice-template"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Site = json::value::from_value(object).unwrap(); + let mut call = self.hub.sites().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _sites_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.sites().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "unmapped-site" => { + call = call.unmapped_site(arg_from_str(value.unwrap_or("false"), err, "unmapped-site", "boolean")); + }, + "subaccount-id" => { + call = call.subaccount_id(value.unwrap_or("")); + }, + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "directory-site-ids" => { + call = call.add_directory_site_ids(value.unwrap_or("")); + }, + "campaign-ids" => { + call = call.add_campaign_ids(value.unwrap_or("")); + }, + "approved" => { + call = call.approved(arg_from_str(value.unwrap_or("false"), err, "approved", "boolean")); + }, + "ad-words-site" => { + call = call.ad_words_site(arg_from_str(value.unwrap_or("false"), err, "ad-words-site", "boolean")); + }, + "accepts-publisher-paid-placements" => { + call = call.accepts_publisher_paid_placements(arg_from_str(value.unwrap_or("false"), err, "accepts-publisher-paid-placements", "boolean")); + }, + "accepts-interstitial-placements" => { + call = call.accepts_interstitial_placements(arg_from_str(value.unwrap_or("false"), err, "accepts-interstitial-placements", "boolean")); + }, + "accepts-in-stream-video-placements" => { + call = call.accepts_in_stream_video_placements(arg_from_str(value.unwrap_or("false"), err, "accepts-in-stream-video-placements", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["accepts-interstitial-placements", "accepts-publisher-paid-placements", "search-string", "subaccount-id", "directory-site-ids", "sort-field", "ids", "max-results", "page-token", "unmapped-site", "accepts-in-stream-video-placements", "ad-words-site", "campaign-ids", "approved", "sort-order"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _sites_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.kind" => Some(("directorySiteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.value" => Some(("directorySiteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.dimension-name" => Some(("directorySiteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.etag" => Some(("directorySiteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.match-type" => Some(("directorySiteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.id" => Some(("directorySiteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-settings.disable-brand-safe-ads" => Some(("siteSettings.disableBrandSafeAds", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.active-view-opt-out" => Some(("siteSettings.activeViewOptOut", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.video-active-view-opt-out-template" => Some(("siteSettings.videoActiveViewOptOutTemplate", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.lookback-configuration.click-duration" => Some(("siteSettings.lookbackConfiguration.clickDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "site-settings.lookback-configuration.post-impression-activities-duration" => Some(("siteSettings.lookbackConfiguration.postImpressionActivitiesDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "site-settings.disable-new-cookie" => Some(("siteSettings.disableNewCookie", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.tag-setting.include-click-through-urls" => Some(("siteSettings.tagSetting.includeClickThroughUrls", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.tag-setting.include-click-tracking" => Some(("siteSettings.tagSetting.includeClickTracking", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.tag-setting.additional-key-values" => Some(("siteSettings.tagSetting.additionalKeyValues", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-settings.tag-setting.keyword-option" => Some(("siteSettings.tagSetting.keywordOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-settings.vpaid-adapter-choice-template" => Some(("siteSettings.vpaidAdapterChoiceTemplate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-settings.creative-settings.i-frame-header" => Some(("siteSettings.creativeSettings.iFrameHeader", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-settings.creative-settings.i-frame-footer" => Some(("siteSettings.creativeSettings.iFrameFooter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "approved" => Some(("approved", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "key-name" => Some(("keyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id" => Some(("directorySiteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active-view-opt-out", "additional-key-values", "approved", "click-duration", "creative-settings", "dimension-name", "directory-site-id", "directory-site-id-dimension-value", "disable-brand-safe-ads", "disable-new-cookie", "etag", "i-frame-footer", "i-frame-header", "id", "id-dimension-value", "include-click-through-urls", "include-click-tracking", "key-name", "keyword-option", "kind", "lookback-configuration", "match-type", "name", "post-impression-activities-duration", "site-settings", "subaccount-id", "tag-setting", "value", "video-active-view-opt-out-template", "vpaid-adapter-choice-template"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Site = json::value::from_value(object).unwrap(); + let mut call = self.hub.sites().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _sites_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.kind" => Some(("directorySiteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.value" => Some(("directorySiteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.dimension-name" => Some(("directorySiteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.etag" => Some(("directorySiteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.match-type" => Some(("directorySiteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.id" => Some(("directorySiteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-settings.disable-brand-safe-ads" => Some(("siteSettings.disableBrandSafeAds", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.active-view-opt-out" => Some(("siteSettings.activeViewOptOut", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.video-active-view-opt-out-template" => Some(("siteSettings.videoActiveViewOptOutTemplate", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.lookback-configuration.click-duration" => Some(("siteSettings.lookbackConfiguration.clickDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "site-settings.lookback-configuration.post-impression-activities-duration" => Some(("siteSettings.lookbackConfiguration.postImpressionActivitiesDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "site-settings.disable-new-cookie" => Some(("siteSettings.disableNewCookie", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.tag-setting.include-click-through-urls" => Some(("siteSettings.tagSetting.includeClickThroughUrls", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.tag-setting.include-click-tracking" => Some(("siteSettings.tagSetting.includeClickTracking", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.tag-setting.additional-key-values" => Some(("siteSettings.tagSetting.additionalKeyValues", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-settings.tag-setting.keyword-option" => Some(("siteSettings.tagSetting.keywordOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-settings.vpaid-adapter-choice-template" => Some(("siteSettings.vpaidAdapterChoiceTemplate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-settings.creative-settings.i-frame-header" => Some(("siteSettings.creativeSettings.iFrameHeader", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-settings.creative-settings.i-frame-footer" => Some(("siteSettings.creativeSettings.iFrameFooter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "approved" => Some(("approved", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "key-name" => Some(("keyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id" => Some(("directorySiteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active-view-opt-out", "additional-key-values", "approved", "click-duration", "creative-settings", "dimension-name", "directory-site-id", "directory-site-id-dimension-value", "disable-brand-safe-ads", "disable-new-cookie", "etag", "i-frame-footer", "i-frame-header", "id", "id-dimension-value", "include-click-through-urls", "include-click-tracking", "key-name", "keyword-option", "kind", "lookback-configuration", "match-type", "name", "post-impression-activities-duration", "site-settings", "subaccount-id", "tag-setting", "value", "video-active-view-opt-out-template", "vpaid-adapter-choice-template"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Site = json::value::from_value(object).unwrap(); + let mut call = self.hub.sites().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _sizes_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.sizes().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _sizes_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "width" => Some(("width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "iab" => Some(("iab", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "height" => Some(("height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["height", "iab", "id", "kind", "width"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Size = json::value::from_value(object).unwrap(); + let mut call = self.hub.sizes().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _sizes_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.sizes().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "width" => { + call = call.width(arg_from_str(value.unwrap_or("-0"), err, "width", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "iab-standard" => { + call = call.iab_standard(arg_from_str(value.unwrap_or("false"), err, "iab-standard", "boolean")); + }, + "height" => { + call = call.height(arg_from_str(value.unwrap_or("-0"), err, "height", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["iab-standard", "width", "ids", "height"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _subaccounts_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.subaccounts().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _subaccounts_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "available-permission-ids" => Some(("availablePermissionIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "available-permission-ids", "id", "kind", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Subaccount = json::value::from_value(object).unwrap(); + let mut call = self.hub.subaccounts().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _subaccounts_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.subaccounts().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "sort-field", "ids", "max-results", "page-token", "sort-order"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _subaccounts_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "available-permission-ids" => Some(("availablePermissionIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "available-permission-ids", "id", "kind", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Subaccount = json::value::from_value(object).unwrap(); + let mut call = self.hub.subaccounts().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _subaccounts_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "available-permission-ids" => Some(("availablePermissionIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "available-permission-ids", "id", "kind", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Subaccount = json::value::from_value(object).unwrap(); + let mut call = self.hub.subaccounts().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _targetable_remarketing_lists_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.targetable_remarketing_lists().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _targetable_remarketing_lists_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.targetable_remarketing_lists().list(opt.value_of("profile-id").unwrap_or(""), opt.value_of("advertiser-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "name" => { + call = call.name(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "active" => { + call = call.active(arg_from_str(value.unwrap_or("false"), err, "active", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["name", "sort-field", "max-results", "page-token", "sort-order", "active"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _targeting_templates_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.targeting_templates().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _targeting_templates_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "day-part-targeting.user-local-time" => Some(("dayPartTargeting.userLocalTime", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "day-part-targeting.hours-of-day" => Some(("dayPartTargeting.hoursOfDay", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), + "day-part-targeting.days-of-week" => Some(("dayPartTargeting.daysOfWeek", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "list-targeting-expression.expression" => Some(("listTargetingExpression.expression", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "key-value-targeting-expression.expression" => Some(("keyValueTargetingExpression.expression", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "geo-targeting.exclude-countries" => Some(("geoTargeting.excludeCountries", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "day-part-targeting", "days-of-week", "dimension-name", "etag", "exclude-countries", "expression", "geo-targeting", "hours-of-day", "id", "key-value-targeting-expression", "kind", "list-targeting-expression", "match-type", "name", "subaccount-id", "user-local-time", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::TargetingTemplate = json::value::from_value(object).unwrap(); + let mut call = self.hub.targeting_templates().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _targeting_templates_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.targeting_templates().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "advertiser-id" => { + call = call.advertiser_id(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "sort-field", "ids", "max-results", "advertiser-id", "page-token", "sort-order"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _targeting_templates_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "day-part-targeting.user-local-time" => Some(("dayPartTargeting.userLocalTime", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "day-part-targeting.hours-of-day" => Some(("dayPartTargeting.hoursOfDay", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), + "day-part-targeting.days-of-week" => Some(("dayPartTargeting.daysOfWeek", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "list-targeting-expression.expression" => Some(("listTargetingExpression.expression", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "key-value-targeting-expression.expression" => Some(("keyValueTargetingExpression.expression", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "geo-targeting.exclude-countries" => Some(("geoTargeting.excludeCountries", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "day-part-targeting", "days-of-week", "dimension-name", "etag", "exclude-countries", "expression", "geo-targeting", "hours-of-day", "id", "key-value-targeting-expression", "kind", "list-targeting-expression", "match-type", "name", "subaccount-id", "user-local-time", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::TargetingTemplate = json::value::from_value(object).unwrap(); + let mut call = self.hub.targeting_templates().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _targeting_templates_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "day-part-targeting.user-local-time" => Some(("dayPartTargeting.userLocalTime", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "day-part-targeting.hours-of-day" => Some(("dayPartTargeting.hoursOfDay", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), + "day-part-targeting.days-of-week" => Some(("dayPartTargeting.daysOfWeek", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "list-targeting-expression.expression" => Some(("listTargetingExpression.expression", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "key-value-targeting-expression.expression" => Some(("keyValueTargetingExpression.expression", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "geo-targeting.exclude-countries" => Some(("geoTargeting.excludeCountries", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "day-part-targeting", "days-of-week", "dimension-name", "etag", "exclude-countries", "expression", "geo-targeting", "hours-of-day", "id", "key-value-targeting-expression", "kind", "list-targeting-expression", "match-type", "name", "subaccount-id", "user-local-time", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::TargetingTemplate = json::value::from_value(object).unwrap(); + let mut call = self.hub.targeting_templates().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _user_profiles_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.user_profiles().get(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _user_profiles_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.user_profiles().list(); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _user_role_permission_groups_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.user_role_permission_groups().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _user_role_permission_groups_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.user_role_permission_groups().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _user_role_permissions_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.user_role_permissions().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _user_role_permissions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.user_role_permissions().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["ids"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _user_roles_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.user_roles().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _user_roles_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.user_roles().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _user_roles_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "default-user-role" => Some(("defaultUserRole", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "parent-user-role-id" => Some(("parentUserRoleId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "default-user-role", "id", "kind", "name", "parent-user-role-id", "subaccount-id"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::UserRole = json::value::from_value(object).unwrap(); + let mut call = self.hub.user_roles().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _user_roles_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.user_roles().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "subaccount-id" => { + call = call.subaccount_id(value.unwrap_or("")); + }, + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "account-user-role-only" => { + call = call.account_user_role_only(arg_from_str(value.unwrap_or("false"), err, "account-user-role-only", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "subaccount-id", "sort-field", "ids", "max-results", "page-token", "sort-order", "account-user-role-only"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _user_roles_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "default-user-role" => Some(("defaultUserRole", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "parent-user-role-id" => Some(("parentUserRoleId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "default-user-role", "id", "kind", "name", "parent-user-role-id", "subaccount-id"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::UserRole = json::value::from_value(object).unwrap(); + let mut call = self.hub.user_roles().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _user_roles_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "default-user-role" => Some(("defaultUserRole", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "parent-user-role-id" => Some(("parentUserRoleId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "default-user-role", "id", "kind", "name", "parent-user-role-id", "subaccount-id"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::UserRole = json::value::from_value(object).unwrap(); + let mut call = self.hub.user_roles().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _video_formats_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let id: i32 = arg_from_str(&opt.value_of("id").unwrap_or(""), err, "", "integer"); + let mut call = self.hub.video_formats().get(opt.value_of("profile-id").unwrap_or(""), id); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _video_formats_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.video_formats().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _doit(&self, dry_run: bool) -> Result, Option> { + let mut err = InvalidOptionsError::new(); + let mut call_result: Result<(), DoitError> = Ok(()); + let mut err_opt: Option = None; + match self.opt.subcommand() { + ("account-active-ad-summaries", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._account_active_ad_summaries_get(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("account-active-ad-summaries".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("account-permission-groups", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._account_permission_groups_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._account_permission_groups_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("account-permission-groups".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("account-permissions", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._account_permissions_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._account_permissions_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("account-permissions".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("account-user-profiles", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._account_user_profiles_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._account_user_profiles_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._account_user_profiles_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._account_user_profiles_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._account_user_profiles_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("account-user-profiles".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("accounts", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._accounts_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._accounts_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._accounts_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._accounts_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("accounts".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("ads", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._ads_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._ads_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._ads_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._ads_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._ads_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("ads".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("advertiser-groups", Some(opt)) => { + match opt.subcommand() { + ("delete", Some(opt)) => { + call_result = self._advertiser_groups_delete(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._advertiser_groups_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._advertiser_groups_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._advertiser_groups_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._advertiser_groups_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._advertiser_groups_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("advertiser-groups".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("advertisers", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._advertisers_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._advertisers_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._advertisers_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._advertisers_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._advertisers_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("advertisers".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("browsers", Some(opt)) => { + match opt.subcommand() { + ("list", Some(opt)) => { + call_result = self._browsers_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("browsers".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("campaign-creative-associations", Some(opt)) => { + match opt.subcommand() { + ("insert", Some(opt)) => { + call_result = self._campaign_creative_associations_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._campaign_creative_associations_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("campaign-creative-associations".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("campaigns", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._campaigns_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._campaigns_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._campaigns_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._campaigns_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._campaigns_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("campaigns".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("change-logs", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._change_logs_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._change_logs_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("change-logs".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("cities", Some(opt)) => { + match opt.subcommand() { + ("list", Some(opt)) => { + call_result = self._cities_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("cities".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("connection-types", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._connection_types_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._connection_types_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("connection-types".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("content-categories", Some(opt)) => { + match opt.subcommand() { + ("delete", Some(opt)) => { + call_result = self._content_categories_delete(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._content_categories_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._content_categories_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._content_categories_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._content_categories_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._content_categories_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("content-categories".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("conversions", Some(opt)) => { + match opt.subcommand() { + ("batchinsert", Some(opt)) => { + call_result = self._conversions_batchinsert(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("conversions".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("countries", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._countries_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._countries_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("countries".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("creative-assets", Some(opt)) => { + match opt.subcommand() { + ("insert", Some(opt)) => { + call_result = self._creative_assets_insert(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("creative-assets".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("creative-field-values", Some(opt)) => { + match opt.subcommand() { + ("delete", Some(opt)) => { + call_result = self._creative_field_values_delete(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._creative_field_values_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._creative_field_values_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._creative_field_values_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._creative_field_values_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._creative_field_values_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("creative-field-values".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("creative-fields", Some(opt)) => { + match opt.subcommand() { + ("delete", Some(opt)) => { + call_result = self._creative_fields_delete(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._creative_fields_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._creative_fields_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._creative_fields_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._creative_fields_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._creative_fields_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("creative-fields".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("creative-groups", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._creative_groups_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._creative_groups_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._creative_groups_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._creative_groups_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._creative_groups_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("creative-groups".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("creatives", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._creatives_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._creatives_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._creatives_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._creatives_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._creatives_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("creatives".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("dimension-values", Some(opt)) => { + match opt.subcommand() { + ("query", Some(opt)) => { + call_result = self._dimension_values_query(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("dimension-values".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("directory-site-contacts", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._directory_site_contacts_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._directory_site_contacts_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("directory-site-contacts".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("directory-sites", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._directory_sites_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._directory_sites_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._directory_sites_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("directory-sites".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("dynamic-targeting-keys", Some(opt)) => { + match opt.subcommand() { + ("delete", Some(opt)) => { + call_result = self._dynamic_targeting_keys_delete(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._dynamic_targeting_keys_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._dynamic_targeting_keys_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("dynamic-targeting-keys".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("event-tags", Some(opt)) => { + match opt.subcommand() { + ("delete", Some(opt)) => { + call_result = self._event_tags_delete(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._event_tags_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._event_tags_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._event_tags_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._event_tags_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._event_tags_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("event-tags".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("files", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._files_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._files_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("files".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("floodlight-activities", Some(opt)) => { + match opt.subcommand() { + ("delete", Some(opt)) => { + call_result = self._floodlight_activities_delete(opt, dry_run, &mut err); + }, + ("generatetag", Some(opt)) => { + call_result = self._floodlight_activities_generatetag(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._floodlight_activities_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._floodlight_activities_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._floodlight_activities_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._floodlight_activities_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._floodlight_activities_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("floodlight-activities".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("floodlight-activity-groups", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._floodlight_activity_groups_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._floodlight_activity_groups_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._floodlight_activity_groups_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._floodlight_activity_groups_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._floodlight_activity_groups_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("floodlight-activity-groups".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("floodlight-configurations", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._floodlight_configurations_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._floodlight_configurations_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._floodlight_configurations_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._floodlight_configurations_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("floodlight-configurations".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("inventory-items", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._inventory_items_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._inventory_items_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("inventory-items".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("landing-pages", Some(opt)) => { + match opt.subcommand() { + ("delete", Some(opt)) => { + call_result = self._landing_pages_delete(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._landing_pages_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._landing_pages_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._landing_pages_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._landing_pages_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._landing_pages_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("landing-pages".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("languages", Some(opt)) => { + match opt.subcommand() { + ("list", Some(opt)) => { + call_result = self._languages_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("languages".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("metros", Some(opt)) => { + match opt.subcommand() { + ("list", Some(opt)) => { + call_result = self._metros_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("metros".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("mobile-carriers", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._mobile_carriers_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._mobile_carriers_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("mobile-carriers".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("operating-system-versions", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._operating_system_versions_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._operating_system_versions_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("operating-system-versions".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("operating-systems", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._operating_systems_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._operating_systems_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("operating-systems".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("order-documents", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._order_documents_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._order_documents_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("order-documents".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("orders", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._orders_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._orders_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("orders".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("placement-groups", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._placement_groups_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._placement_groups_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._placement_groups_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._placement_groups_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._placement_groups_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("placement-groups".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("placement-strategies", Some(opt)) => { + match opt.subcommand() { + ("delete", Some(opt)) => { + call_result = self._placement_strategies_delete(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._placement_strategies_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._placement_strategies_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._placement_strategies_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._placement_strategies_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._placement_strategies_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("placement-strategies".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("placements", Some(opt)) => { + match opt.subcommand() { + ("generatetags", Some(opt)) => { + call_result = self._placements_generatetags(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._placements_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._placements_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._placements_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._placements_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._placements_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("placements".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("platform-types", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._platform_types_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._platform_types_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("platform-types".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("postal-codes", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._postal_codes_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._postal_codes_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("postal-codes".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("projects", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._projects_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._projects_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("projects".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("regions", Some(opt)) => { + match opt.subcommand() { + ("list", Some(opt)) => { + call_result = self._regions_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("regions".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("remarketing-list-shares", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._remarketing_list_shares_get(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._remarketing_list_shares_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._remarketing_list_shares_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("remarketing-list-shares".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("remarketing-lists", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._remarketing_lists_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._remarketing_lists_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._remarketing_lists_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._remarketing_lists_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._remarketing_lists_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("remarketing-lists".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("reports", Some(opt)) => { + match opt.subcommand() { + ("compatible-fields-query", Some(opt)) => { + call_result = self._reports_compatible_fields_query(opt, dry_run, &mut err); + }, + ("delete", Some(opt)) => { + call_result = self._reports_delete(opt, dry_run, &mut err); + }, + ("files-get", Some(opt)) => { + call_result = self._reports_files_get(opt, dry_run, &mut err); + }, + ("files-list", Some(opt)) => { + call_result = self._reports_files_list(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._reports_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._reports_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._reports_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._reports_patch(opt, dry_run, &mut err); + }, + ("run", Some(opt)) => { + call_result = self._reports_run(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._reports_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("reports".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("sites", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._sites_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._sites_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._sites_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._sites_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._sites_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("sites".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("sizes", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._sizes_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._sizes_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._sizes_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("sizes".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("subaccounts", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._subaccounts_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._subaccounts_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._subaccounts_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._subaccounts_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._subaccounts_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("subaccounts".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("targetable-remarketing-lists", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._targetable_remarketing_lists_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._targetable_remarketing_lists_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("targetable-remarketing-lists".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("targeting-templates", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._targeting_templates_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._targeting_templates_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._targeting_templates_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._targeting_templates_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._targeting_templates_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("targeting-templates".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("user-profiles", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._user_profiles_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._user_profiles_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("user-profiles".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("user-role-permission-groups", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._user_role_permission_groups_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._user_role_permission_groups_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("user-role-permission-groups".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("user-role-permissions", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._user_role_permissions_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._user_role_permissions_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("user-role-permissions".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("user-roles", Some(opt)) => { + match opt.subcommand() { + ("delete", Some(opt)) => { + call_result = self._user_roles_delete(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._user_roles_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._user_roles_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._user_roles_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._user_roles_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._user_roles_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("user-roles".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("video-formats", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._video_formats_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._video_formats_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("video-formats".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + _ => { + err.issues.push(CLIError::MissingCommandError); + writeln!(io::stderr(), "{}\n", self.opt.usage()).ok(); + } + } + + if dry_run { + if err.issues.len() > 0 { + err_opt = Some(err); + } + Err(err_opt) + } else { + Ok(call_result) + } + } + + // Please note that this call will fail if any part of the opt can't be handled + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { + let (config_dir, secret) = { + let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { + Err(e) => return Err(InvalidOptionsError::single(e, 3)), + Ok(p) => p, + }; + + match cmn::application_secret_from_directory(&config_dir, "dfareporting2d7-secret.json", + "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { + Ok(secret) => (config_dir, secret), + Err(e) => return Err(InvalidOptionsError::single(e, 4)) + } + }; + + let auth = Authenticator::new( &secret, DefaultAuthenticatorDelegate, + if opt.is_present("debug-auth") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::::default() + }) + } else { + hyper::Client::new() + }, + JsonTokenStorage { + program_name: "dfareporting2d7", + db_dir: config_dir.clone(), + }, Some(FlowType::InstalledRedirect(54324))); + + let client = + if opt.is_present("debug") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::::default() + }) + } else { + hyper::Client::new() + }; + let engine = Engine { + opt: opt, + hub: api::Dfareporting::new(client, auth), + gp: vec!["alt", "fields", "key", "oauth-token", "pretty-print", "quota-user", "user-ip"], + gpm: vec![ + ("oauth-token", "oauth_token"), + ("pretty-print", "prettyPrint"), + ("quota-user", "quotaUser"), + ("user-ip", "userIp"), + ] + }; + + match engine._doit(true) { + Err(Some(err)) => Err(err), + Err(None) => Ok(engine), + Ok(_) => unreachable!(), + } + } + + fn doit(&self) -> Result<(), DoitError> { + match self._doit(false) { + Ok(res) => res, + Err(_) => unreachable!(), + } + } +} + +fn main() { + let mut exit_status = 0i32; + let upload_value_names = ["mode", "file"]; + let arg_data = [ + ("account-active-ad-summaries", "methods: 'get'", vec![ + ("get", + Some(r##"Gets the account's active ad summary by account ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/account-active-ad-summaries_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"summary-account-id"##), + None, + Some(r##"Account ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("account-permission-groups", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one account permission group by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/account-permission-groups_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Account permission group ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves the list of account permission groups."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/account-permission-groups_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("account-permissions", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one account permission by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/account-permissions_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Account permission ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves the list of account permissions."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/account-permissions_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("account-user-profiles", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one account user profile by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/account-user-profiles_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"User profile ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new account user profile."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/account-user-profiles_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of account user profiles, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/account-user-profiles_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing account user profile. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/account-user-profiles_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"User profile ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing account user profile."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/account-user-profiles_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("accounts", "methods: 'get', 'list', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one account by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/accounts_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Account ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves the list of accounts, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/accounts_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing account. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/accounts_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Account ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing account."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/accounts_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("ads", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one ad by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/ads_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Ad ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new ad."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/ads_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of ads, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/ads_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing ad. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/ads_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Ad ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing ad."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/ads_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("advertiser-groups", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("delete", + Some(r##"Deletes an existing advertiser group."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/advertiser-groups_delete", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Advertiser group ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("get", + Some(r##"Gets one advertiser group by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/advertiser-groups_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Advertiser group ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new advertiser group."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/advertiser-groups_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of advertiser groups, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/advertiser-groups_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing advertiser group. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/advertiser-groups_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Advertiser group ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing advertiser group."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/advertiser-groups_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("advertisers", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one advertiser by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/advertisers_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Advertiser ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new advertiser."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/advertisers_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of advertisers, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/advertisers_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing advertiser. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/advertisers_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Advertiser ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing advertiser."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/advertisers_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("browsers", "methods: 'list'", vec![ + ("list", + Some(r##"Retrieves a list of browsers."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/browsers_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("campaign-creative-associations", "methods: 'insert' and 'list'", vec![ + ("insert", + Some(r##"Associates a creative with the specified campaign. This method creates a default ad with dimensions matching the creative in the campaign if such a default ad does not exist already."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/campaign-creative-associations_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"campaign-id"##), + None, + Some(r##"Campaign ID in this association."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves the list of creative IDs associated with the specified campaign. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/campaign-creative-associations_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"campaign-id"##), + None, + Some(r##"Campaign ID in this association."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("campaigns", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one campaign by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/campaigns_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Campaign ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new campaign."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/campaigns_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"default-landing-page-name"##), + None, + Some(r##"Default landing page name for this new campaign. Must be less than 256 characters long."##), + Some(true), + Some(false)), + + (Some(r##"default-landing-page-url"##), + None, + Some(r##"Default landing page URL for this new campaign."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of campaigns, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/campaigns_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing campaign. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/campaigns_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Campaign ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing campaign."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/campaigns_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("change-logs", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one change log by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/change-logs_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Change log ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of change logs. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/change-logs_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("cities", "methods: 'list'", vec![ + ("list", + Some(r##"Retrieves a list of cities, possibly filtered."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/cities_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("connection-types", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one connection type by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/connection-types_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Connection type ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of connection types."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/connection-types_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("content-categories", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("delete", + Some(r##"Deletes an existing content category."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/content-categories_delete", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Content category ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("get", + Some(r##"Gets one content category by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/content-categories_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Content category ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new content category."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/content-categories_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of content categories, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/content-categories_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing content category. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/content-categories_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Content category ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing content category."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/content-categories_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("conversions", "methods: 'batchinsert'", vec![ + ("batchinsert", + Some(r##"Inserts conversions."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/conversions_batchinsert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("countries", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one country by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/countries_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"dart-id"##), + None, + Some(r##"Country DART ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of countries."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/countries_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("creative-assets", "methods: 'insert'", vec![ + ("insert", + Some(r##"Inserts a new creative asset."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/creative-assets_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"advertiser-id"##), + None, + Some(r##"Advertiser ID of this creative. This is a required field."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"mode"##), + Some(r##"u"##), + Some(r##"Specify the upload protocol (simple|resumable) and the file to upload"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("creative-field-values", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("delete", + Some(r##"Deletes an existing creative field value."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/creative-field-values_delete", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"creative-field-id"##), + None, + Some(r##"Creative field ID for this creative field value."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Creative Field Value ID"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("get", + Some(r##"Gets one creative field value by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/creative-field-values_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"creative-field-id"##), + None, + Some(r##"Creative field ID for this creative field value."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Creative Field Value ID"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new creative field value."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/creative-field-values_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"creative-field-id"##), + None, + Some(r##"Creative field ID for this creative field value."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of creative field values, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/creative-field-values_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"creative-field-id"##), + None, + Some(r##"Creative field ID for this creative field value."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing creative field value. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/creative-field-values_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"creative-field-id"##), + None, + Some(r##"Creative field ID for this creative field value."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Creative Field Value ID"##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing creative field value."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/creative-field-values_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"creative-field-id"##), + None, + Some(r##"Creative field ID for this creative field value."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("creative-fields", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("delete", + Some(r##"Deletes an existing creative field."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/creative-fields_delete", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Creative Field ID"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("get", + Some(r##"Gets one creative field by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/creative-fields_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Creative Field ID"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new creative field."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/creative-fields_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of creative fields, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/creative-fields_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing creative field. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/creative-fields_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Creative Field ID"##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing creative field."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/creative-fields_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("creative-groups", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one creative group by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/creative-groups_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Creative group ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new creative group."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/creative-groups_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of creative groups, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/creative-groups_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing creative group. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/creative-groups_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Creative group ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing creative group."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/creative-groups_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("creatives", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one creative by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/creatives_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Creative ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new creative."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/creatives_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of creatives, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/creatives_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing creative. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/creatives_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Creative ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing creative."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/creatives_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("dimension-values", "methods: 'query'", vec![ + ("query", + Some(r##"Retrieves list of report dimension values for a list of filters."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/dimension-values_query", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"The DFA user profile ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("directory-site-contacts", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one directory site contact by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/directory-site-contacts_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Directory site contact ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of directory site contacts, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/directory-site-contacts_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("directory-sites", "methods: 'get', 'insert' and 'list'", vec![ + ("get", + Some(r##"Gets one directory site by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/directory-sites_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Directory site ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new directory site."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/directory-sites_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of directory sites, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/directory-sites_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("dynamic-targeting-keys", "methods: 'delete', 'insert' and 'list'", vec![ + ("delete", + Some(r##"Deletes an existing dynamic targeting key."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/dynamic-targeting-keys_delete", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"object-id"##), + None, + Some(r##"ID of the object of this dynamic targeting key. This is a required field."##), + Some(true), + Some(false)), + + (Some(r##"name"##), + None, + Some(r##"Name of this dynamic targeting key. This is a required field. Must be less than 256 characters long and cannot contain commas. All characters are converted to lowercase."##), + Some(true), + Some(false)), + + (Some(r##"object-type"##), + None, + Some(r##"Type of the object of this dynamic targeting key. This is a required field."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("insert", + Some(r##"Inserts a new dynamic targeting key. Keys must be created at the advertiser level before being assigned to the advertiser's ads, creatives, or placements. There is a maximum of 1000 keys per advertiser, out of which a maximum of 20 keys can be assigned per ad, creative, or placement."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/dynamic-targeting-keys_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of dynamic targeting keys."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/dynamic-targeting-keys_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("event-tags", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("delete", + Some(r##"Deletes an existing event tag."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/event-tags_delete", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Event tag ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("get", + Some(r##"Gets one event tag by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/event-tags_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Event tag ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new event tag."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/event-tags_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of event tags, possibly filtered."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/event-tags_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing event tag. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/event-tags_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Event tag ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing event tag."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/event-tags_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("files", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Retrieves a report file by its report ID and file ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/files_get", + vec![ + (Some(r##"report-id"##), + None, + Some(r##"The ID of the report."##), + Some(true), + Some(false)), + + (Some(r##"file-id"##), + None, + Some(r##"The ID of the report file."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Lists files for a user profile."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/files_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"The DFA profile ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("floodlight-activities", "methods: 'delete', 'generatetag', 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("delete", + Some(r##"Deletes an existing floodlight activity."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/floodlight-activities_delete", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Floodlight activity ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("generatetag", + Some(r##"Generates a tag for a floodlight activity."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/floodlight-activities_generatetag", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("get", + Some(r##"Gets one floodlight activity by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/floodlight-activities_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Floodlight activity ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new floodlight activity."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/floodlight-activities_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of floodlight activities, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/floodlight-activities_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing floodlight activity. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/floodlight-activities_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Floodlight activity ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing floodlight activity."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/floodlight-activities_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("floodlight-activity-groups", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one floodlight activity group by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/floodlight-activity-groups_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Floodlight activity Group ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new floodlight activity group."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/floodlight-activity-groups_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of floodlight activity groups, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/floodlight-activity-groups_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing floodlight activity group. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/floodlight-activity-groups_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Floodlight activity Group ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing floodlight activity group."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/floodlight-activity-groups_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("floodlight-configurations", "methods: 'get', 'list', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one floodlight configuration by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/floodlight-configurations_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Floodlight configuration ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of floodlight configurations, possibly filtered."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/floodlight-configurations_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing floodlight configuration. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/floodlight-configurations_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Floodlight configuration ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing floodlight configuration."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/floodlight-configurations_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("inventory-items", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one inventory item by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/inventory-items_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"project-id"##), + None, + Some(r##"Project ID for order documents."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Inventory item ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of inventory items, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/inventory-items_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"project-id"##), + None, + Some(r##"Project ID for order documents."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("landing-pages", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("delete", + Some(r##"Deletes an existing campaign landing page."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/landing-pages_delete", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"campaign-id"##), + None, + Some(r##"Landing page campaign ID."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Landing page ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("get", + Some(r##"Gets one campaign landing page by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/landing-pages_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"campaign-id"##), + None, + Some(r##"Landing page campaign ID."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Landing page ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new landing page for the specified campaign."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/landing-pages_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"campaign-id"##), + None, + Some(r##"Landing page campaign ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves the list of landing pages for the specified campaign."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/landing-pages_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"campaign-id"##), + None, + Some(r##"Landing page campaign ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing campaign landing page. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/landing-pages_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"campaign-id"##), + None, + Some(r##"Landing page campaign ID."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Landing page ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing campaign landing page."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/landing-pages_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"campaign-id"##), + None, + Some(r##"Landing page campaign ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("languages", "methods: 'list'", vec![ + ("list", + Some(r##"Retrieves a list of languages."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/languages_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("metros", "methods: 'list'", vec![ + ("list", + Some(r##"Retrieves a list of metros."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/metros_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("mobile-carriers", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one mobile carrier by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/mobile-carriers_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Mobile carrier ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of mobile carriers."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/mobile-carriers_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("operating-system-versions", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one operating system version by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/operating-system-versions_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Operating system version ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of operating system versions."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/operating-system-versions_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("operating-systems", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one operating system by DART ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/operating-systems_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"dart-id"##), + None, + Some(r##"Operating system DART ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of operating systems."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/operating-systems_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("order-documents", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one order document by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/order-documents_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"project-id"##), + None, + Some(r##"Project ID for order documents."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Order document ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of order documents, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/order-documents_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"project-id"##), + None, + Some(r##"Project ID for order documents."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("orders", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one order by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/orders_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"project-id"##), + None, + Some(r##"Project ID for orders."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Order ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of orders, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/orders_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"project-id"##), + None, + Some(r##"Project ID for orders."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("placement-groups", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one placement group by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/placement-groups_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Placement group ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new placement group."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/placement-groups_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of placement groups, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/placement-groups_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing placement group. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/placement-groups_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Placement group ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing placement group."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/placement-groups_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("placement-strategies", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("delete", + Some(r##"Deletes an existing placement strategy."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/placement-strategies_delete", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Placement strategy ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("get", + Some(r##"Gets one placement strategy by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/placement-strategies_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Placement strategy ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new placement strategy."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/placement-strategies_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of placement strategies, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/placement-strategies_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing placement strategy. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/placement-strategies_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Placement strategy ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing placement strategy."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/placement-strategies_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("placements", "methods: 'generatetags', 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("generatetags", + Some(r##"Generates tags for a placement."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/placements_generatetags", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("get", + Some(r##"Gets one placement by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/placements_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Placement ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new placement."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/placements_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of placements, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/placements_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing placement. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/placements_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Placement ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing placement."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/placements_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("platform-types", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one platform type by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/platform-types_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Platform type ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of platform types."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/platform-types_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("postal-codes", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one postal code by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/postal-codes_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"code"##), + None, + Some(r##"Postal code ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of postal codes."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/postal-codes_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("projects", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one project by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/projects_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Project ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of projects, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/projects_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("regions", "methods: 'list'", vec![ + ("list", + Some(r##"Retrieves a list of regions."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/regions_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("remarketing-list-shares", "methods: 'get', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one remarketing list share by remarketing list ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/remarketing-list-shares_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"remarketing-list-id"##), + None, + Some(r##"Remarketing list ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing remarketing list share. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/remarketing-list-shares_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"remarketing-list-id"##), + None, + Some(r##"Remarketing list ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing remarketing list share."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/remarketing-list-shares_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("remarketing-lists", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one remarketing list by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/remarketing-lists_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Remarketing list ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new remarketing list."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/remarketing-lists_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of remarketing lists, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/remarketing-lists_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"advertiser-id"##), + None, + Some(r##"Select only remarketing lists owned by this advertiser."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing remarketing list. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/remarketing-lists_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Remarketing list ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing remarketing list."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/remarketing-lists_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("reports", "methods: 'compatible-fields-query', 'delete', 'files-get', 'files-list', 'get', 'insert', 'list', 'patch', 'run' and 'update'", vec![ + ("compatible-fields-query", + Some(r##"Returns the fields that are compatible to be selected in the respective sections of a report criteria, given the fields already selected in the input report and user permissions."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/reports_compatible-fields-query", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"The DFA user profile ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("delete", + Some(r##"Deletes a report by its ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/reports_delete", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"The DFA user profile ID."##), + Some(true), + Some(false)), + + (Some(r##"report-id"##), + None, + Some(r##"The ID of the report."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("files-get", + Some(r##"Retrieves a report file."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/reports_files-get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"The DFA profile ID."##), + Some(true), + Some(false)), + + (Some(r##"report-id"##), + None, + Some(r##"The ID of the report."##), + Some(true), + Some(false)), + + (Some(r##"file-id"##), + None, + Some(r##"The ID of the report file."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("files-list", + Some(r##"Lists files for a report."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/reports_files-list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"The DFA profile ID."##), + Some(true), + Some(false)), + + (Some(r##"report-id"##), + None, + Some(r##"The ID of the parent report."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("get", + Some(r##"Retrieves a report by its ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/reports_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"The DFA user profile ID."##), + Some(true), + Some(false)), + + (Some(r##"report-id"##), + None, + Some(r##"The ID of the report."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Creates a report."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/reports_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"The DFA user profile ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves list of reports."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/reports_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"The DFA user profile ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates a report. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/reports_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"The DFA user profile ID."##), + Some(true), + Some(false)), + + (Some(r##"report-id"##), + None, + Some(r##"The ID of the report."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("run", + Some(r##"Runs a report."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/reports_run", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"The DFA profile ID."##), + Some(true), + Some(false)), + + (Some(r##"report-id"##), + None, + Some(r##"The ID of the report."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates a report."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/reports_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"The DFA user profile ID."##), + Some(true), + Some(false)), + + (Some(r##"report-id"##), + None, + Some(r##"The ID of the report."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("sites", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one site by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/sites_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Site ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new site."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/sites_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of sites, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/sites_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing site. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/sites_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Site ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing site."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/sites_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("sizes", "methods: 'get', 'insert' and 'list'", vec![ + ("get", + Some(r##"Gets one size by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/sizes_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Size ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new size."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/sizes_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of sizes, possibly filtered."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/sizes_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("subaccounts", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one subaccount by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/subaccounts_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Subaccount ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new subaccount."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/subaccounts_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Gets a list of subaccounts, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/subaccounts_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing subaccount. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/subaccounts_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Subaccount ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing subaccount."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/subaccounts_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("targetable-remarketing-lists", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one remarketing list by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/targetable-remarketing-lists_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Remarketing list ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of targetable remarketing lists, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/targetable-remarketing-lists_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"advertiser-id"##), + None, + Some(r##"Select only targetable remarketing lists targetable by these advertisers."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("targeting-templates", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one targeting template by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/targeting-templates_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Targeting template ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new targeting template."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/targeting-templates_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of targeting templates, optionally filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/targeting-templates_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing targeting template. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/targeting-templates_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Targeting template ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing targeting template."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/targeting-templates_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("user-profiles", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one user profile by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/user-profiles_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"The user profile ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves list of user profiles for a user."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/user-profiles_list", + vec![ + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("user-role-permission-groups", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one user role permission group by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/user-role-permission-groups_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"User role permission group ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Gets a list of all supported user role permission groups."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/user-role-permission-groups_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("user-role-permissions", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one user role permission by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/user-role-permissions_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"User role permission ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Gets a list of user role permissions, possibly filtered."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/user-role-permissions_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("user-roles", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("delete", + Some(r##"Deletes an existing user role."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/user-roles_delete", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"User role ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("get", + Some(r##"Gets one user role by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/user-roles_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"User role ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new user role."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/user-roles_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of user roles, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/user-roles_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing user role. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/user-roles_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"User role ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing user role."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/user-roles_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("video-formats", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one video format by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/video-formats_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Video format ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Lists available video formats."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli/video-formats_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ]; + + let mut app = App::new("dfareporting2d7") + .author("Sebastian Thiel ") + .version("1.0.0+20161027") + .about("Manages your DoubleClick Campaign Manager ad campaigns and reports.") + .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_dfareporting2d7_cli") + .arg(Arg::with_name("url") + .long("scope") + .help("Specify the authentication a method should be executed in. Each scope requires the user to grant this application permission to use it.If unset, it defaults to the shortest scope url for a particular method.") + .multiple(true) + .takes_value(true)) + .arg(Arg::with_name("folder") + .long("config-dir") + .help("A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation.[default: ~/.google-service-cli") + .multiple(false) + .takes_value(true)) + .arg(Arg::with_name("debug") + .long("debug") + .help("Output all server communication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)) + .arg(Arg::with_name("debug-auth") + .long("debug-auth") + .help("Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)); + + for &(main_command_name, about, ref subcommands) in arg_data.iter() { + let mut mcmd = SubCommand::with_name(main_command_name).about(about); + + for &(sub_command_name, ref desc, url_info, ref args) in subcommands { + let mut scmd = SubCommand::with_name(sub_command_name); + if let &Some(desc) = desc { + scmd = scmd.about(desc); + } + scmd = scmd.after_help(url_info); + + for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { + let arg_name_str = + match (arg_name, flag) { + (&Some(an), _ ) => an, + (_ , &Some(f)) => f, + _ => unreachable!(), + }; + let mut arg = Arg::with_name(arg_name_str) + .empty_values(false); + if let &Some(short_flag) = flag { + arg = arg.short(short_flag); + } + if let &Some(desc) = desc { + arg = arg.help(desc); + } + if arg_name.is_some() && flag.is_some() { + arg = arg.takes_value(true); + } + if let &Some(required) = required { + arg = arg.required(required); + } + if let &Some(multi) = multi { + arg = arg.multiple(multi); + } + if arg_name_str == "mode" { + arg = arg.number_of_values(2); + arg = arg.value_names(&upload_value_names); + + scmd = scmd.arg(Arg::with_name("mime") + .short("m") + .requires("mode") + .required(false) + .help("The file's mime time, like 'application/octet-stream'") + .takes_value(true)); + } + scmd = scmd.arg(arg); + } + mcmd = mcmd.subcommand(scmd); + } + app = app.subcommand(mcmd); + } + + let matches = app.get_matches(); + + let debug = matches.is_present("debug"); + match Engine::new(matches) { + Err(err) => { + exit_status = err.exit_code; + writeln!(io::stderr(), "{}", err).ok(); + }, + Ok(engine) => { + if let Err(doit_err) = engine.doit() { + exit_status = 1; + match doit_err { + DoitError::IoError(path, err) => { + writeln!(io::stderr(), "Failed to open output file '{}': {}", path, err).ok(); + }, + DoitError::ApiError(err) => { + if debug { + writeln!(io::stderr(), "{:#?}", err).ok(); + } else { + writeln!(io::stderr(), "{}", err).ok(); + } + } + } + } + } + } + + std::process::exit(exit_status); +} \ No newline at end of file diff --git a/gen/dfareporting2d7/Cargo.toml b/gen/dfareporting2d7/Cargo.toml new file mode 100644 index 0000000000..3e8650009f --- /dev/null +++ b/gen/dfareporting2d7/Cargo.toml @@ -0,0 +1,34 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-dfareporting2d7" +version = "1.0.0+20161027" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with dfareporting (protocol v2.7)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/dfareporting2d7" +homepage = "https://developers.google.com/doubleclick-advertisers/" +documentation = "http://byron.github.io/google-apis-rs/google_dfareporting2d7" +license = "MIT" +keywords = ["dfareporting", "google", "protocol", "web", "api"] +build = "src/build.rs" + + +[dependencies] +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.8" +serde_json = "^ 0.8" +yup-oauth2 = { version = "^ 1.0", optional = true, default-features = false } +serde_derive = { version = "^ 0.8", optional = true } +url = "= 0.5" + +[features] +default = ["with-serde-codegen"] +nightly = ["serde_derive","yup-oauth2/nightly"] +with-serde-codegen = ["serde_codegen","yup-oauth2/with-serde-codegen"] + +[build-dependencies] +serde_codegen = { version = "^ 0.8", optional = true } + diff --git a/gen/dfareporting2d7/LICENSE.md b/gen/dfareporting2d7/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/dfareporting2d7/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/dfareporting2d7/README.md b/gen/dfareporting2d7/README.md new file mode 100644 index 0000000000..05d605b85b --- /dev/null +++ b/gen/dfareporting2d7/README.md @@ -0,0 +1,314 @@ + +The `google-dfareporting2d7` library allows access to all features of the *Google dfareporting* service. + +This documentation was generated from *dfareporting* crate version *1.0.0+20161027*, where *20161027* is the exact revision of the *dfareporting:v2.7* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. + +Everything else about the *dfareporting* *v2d7* API can be found at the +[official documentation site](https://developers.google.com/doubleclick-advertisers/). +# Features + +Handle the following *Resources* with ease from the central [hub](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.Dfareporting.html) ... + +* [account active ad summaries](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.AccountActiveAdSummary.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.AccountActiveAdSummaryGetCall.html) +* [account permission groups](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.AccountPermissionGroup.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.AccountPermissionGroupGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.AccountPermissionGroupListCall.html) +* [account permissions](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.AccountPermission.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.AccountPermissionGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.AccountPermissionListCall.html) +* [account user profiles](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.AccountUserProfile.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.AccountUserProfileGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.AccountUserProfileInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.AccountUserProfileListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.AccountUserProfilePatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.AccountUserProfileUpdateCall.html) +* [accounts](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.Account.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.AccountGetCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.AccountListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.AccountPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.AccountUpdateCall.html) +* [ads](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.Ad.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.AdGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.AdInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.AdListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.AdPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.AdUpdateCall.html) +* [advertiser groups](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.AdvertiserGroup.html) + * [*delete*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.AdvertiserGroupDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.AdvertiserGroupGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.AdvertiserGroupInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.AdvertiserGroupListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.AdvertiserGroupPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.AdvertiserGroupUpdateCall.html) +* [advertisers](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.Advertiser.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.AdvertiserGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.AdvertiserInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.AdvertiserListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.AdvertiserPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.AdvertiserUpdateCall.html) +* [browsers](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.Browser.html) + * [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.BrowserListCall.html) +* [campaign creative associations](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.CampaignCreativeAssociation.html) + * [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.CampaignCreativeAssociationInsertCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.CampaignCreativeAssociationListCall.html) +* [campaigns](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.Campaign.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.CampaignGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.CampaignInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.CampaignListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.CampaignPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.CampaignUpdateCall.html) +* [change logs](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.ChangeLog.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.ChangeLogGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.ChangeLogListCall.html) +* [cities](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.City.html) + * [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.CityListCall.html) +* [connection types](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.ConnectionType.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.ConnectionTypeGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.ConnectionTypeListCall.html) +* [content categories](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.ContentCategory.html) + * [*delete*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.ContentCategoryDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.ContentCategoryGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.ContentCategoryInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.ContentCategoryListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.ContentCategoryPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.ContentCategoryUpdateCall.html) +* [conversions](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.Conversion.html) + * [*batchinsert*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.ConversionBatchinsertCall.html) +* [countries](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.Country.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.CountryGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.CountryListCall.html) +* [creative assets](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.CreativeAsset.html) + * [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.CreativeAssetInsertCall.html) +* [creative field values](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.CreativeFieldValue.html) + * [*delete*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.CreativeFieldValueDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.CreativeFieldValueGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.CreativeFieldValueInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.CreativeFieldValueListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.CreativeFieldValuePatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.CreativeFieldValueUpdateCall.html) +* [creative fields](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.CreativeField.html) + * [*delete*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.CreativeFieldDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.CreativeFieldGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.CreativeFieldInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.CreativeFieldListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.CreativeFieldPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.CreativeFieldUpdateCall.html) +* [creative groups](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.CreativeGroup.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.CreativeGroupGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.CreativeGroupInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.CreativeGroupListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.CreativeGroupPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.CreativeGroupUpdateCall.html) +* [creatives](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.Creative.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.CreativeGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.CreativeInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.CreativeListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.CreativePatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.CreativeUpdateCall.html) +* [dimension values](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.DimensionValue.html) + * [*query*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.DimensionValueQueryCall.html) +* [directory site contacts](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.DirectorySiteContact.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.DirectorySiteContactGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.DirectorySiteContactListCall.html) +* [directory sites](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.DirectorySite.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.DirectorySiteGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.DirectorySiteInsertCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.DirectorySiteListCall.html) +* [dynamic targeting keys](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.DynamicTargetingKey.html) + * [*delete*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.DynamicTargetingKeyDeleteCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.DynamicTargetingKeyInsertCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.DynamicTargetingKeyListCall.html) +* [event tags](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.EventTag.html) + * [*delete*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.EventTagDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.EventTagGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.EventTagInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.EventTagListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.EventTagPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.EventTagUpdateCall.html) +* [files](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.File.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.FileGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.FileListCall.html) +* [floodlight activities](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.FloodlightActivity.html) + * [*delete*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.FloodlightActivityDeleteCall.html), [*generatetag*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.FloodlightActivityGeneratetagCall.html), [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.FloodlightActivityGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.FloodlightActivityInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.FloodlightActivityListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.FloodlightActivityPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.FloodlightActivityUpdateCall.html) +* [floodlight activity groups](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.FloodlightActivityGroup.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.FloodlightActivityGroupGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.FloodlightActivityGroupInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.FloodlightActivityGroupListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.FloodlightActivityGroupPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.FloodlightActivityGroupUpdateCall.html) +* [floodlight configurations](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.FloodlightConfiguration.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.FloodlightConfigurationGetCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.FloodlightConfigurationListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.FloodlightConfigurationPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.FloodlightConfigurationUpdateCall.html) +* [inventory items](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.InventoryItem.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.InventoryItemGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.InventoryItemListCall.html) +* [landing pages](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.LandingPage.html) + * [*delete*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.LandingPageDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.LandingPageGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.LandingPageInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.LandingPageListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.LandingPagePatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.LandingPageUpdateCall.html) +* [languages](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.Language.html) + * [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.LanguageListCall.html) +* [metros](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.Metro.html) + * [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.MetroListCall.html) +* [mobile carriers](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.MobileCarrier.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.MobileCarrierGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.MobileCarrierListCall.html) +* [operating system versions](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.OperatingSystemVersion.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.OperatingSystemVersionGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.OperatingSystemVersionListCall.html) +* [operating systems](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.OperatingSystem.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.OperatingSystemGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.OperatingSystemListCall.html) +* [order documents](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.OrderDocument.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.OrderDocumentGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.OrderDocumentListCall.html) +* [orders](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.Order.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.OrderGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.OrderListCall.html) +* [placement groups](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.PlacementGroup.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.PlacementGroupGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.PlacementGroupInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.PlacementGroupListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.PlacementGroupPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.PlacementGroupUpdateCall.html) +* [placement strategies](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.PlacementStrategy.html) + * [*delete*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.PlacementStrategyDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.PlacementStrategyGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.PlacementStrategyInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.PlacementStrategyListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.PlacementStrategyPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.PlacementStrategyUpdateCall.html) +* [placements](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.Placement.html) + * [*generatetags*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.PlacementGeneratetagCall.html), [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.PlacementGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.PlacementInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.PlacementListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.PlacementPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.PlacementUpdateCall.html) +* [platform types](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.PlatformType.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.PlatformTypeGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.PlatformTypeListCall.html) +* [postal codes](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.PostalCode.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.PostalCodeGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.PostalCodeListCall.html) +* [projects](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.Project.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.ProjectGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.ProjectListCall.html) +* [regions](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.Region.html) + * [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.RegionListCall.html) +* [remarketing list shares](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.RemarketingListShare.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.RemarketingListShareGetCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.RemarketingListSharePatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.RemarketingListShareUpdateCall.html) +* [remarketing lists](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.RemarketingList.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.RemarketingListGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.RemarketingListInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.RemarketingListListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.RemarketingListPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.RemarketingListUpdateCall.html) +* [reports](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.Report.html) + * [*compatible fields query*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.ReportCompatibleFieldQueryCall.html), [*delete*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.ReportDeleteCall.html), [*files get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.ReportFileGetCall.html), [*files list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.ReportFileListCall.html), [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.ReportGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.ReportInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.ReportListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.ReportPatchCall.html), [*run*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.ReportRunCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.ReportUpdateCall.html) +* [sites](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.Site.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.SiteGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.SiteInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.SiteListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.SitePatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.SiteUpdateCall.html) +* [sizes](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.Size.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.SizeGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.SizeInsertCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.SizeListCall.html) +* [subaccounts](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.Subaccount.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.SubaccountGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.SubaccountInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.SubaccountListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.SubaccountPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.SubaccountUpdateCall.html) +* [targetable remarketing lists](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.TargetableRemarketingList.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.TargetableRemarketingListGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.TargetableRemarketingListListCall.html) +* [targeting templates](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.TargetingTemplate.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.TargetingTemplateGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.TargetingTemplateInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.TargetingTemplateListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.TargetingTemplatePatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.TargetingTemplateUpdateCall.html) +* [user profiles](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.UserProfile.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.UserProfileGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.UserProfileListCall.html) +* [user role permission groups](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.UserRolePermissionGroup.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.UserRolePermissionGroupGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.UserRolePermissionGroupListCall.html) +* [user role permissions](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.UserRolePermission.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.UserRolePermissionGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.UserRolePermissionListCall.html) +* [user roles](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.UserRole.html) + * [*delete*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.UserRoleDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.UserRoleGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.UserRoleInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.UserRoleListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.UserRolePatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.UserRoleUpdateCall.html) +* [video formats](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.VideoFormat.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.VideoFormatGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.VideoFormatListCall.html) + + +Upload supported by ... + +* [*insert creative assets*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.CreativeAssetInsertCall.html) + +Download supported by ... + +* [*get files*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.FileGetCall.html) +* [*files get reports*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.ReportFileGetCall.html) + + + +# Structure of this Library + +The API is structured into the following primary items: + +* **[Hub](http://byron.github.io/google-apis-rs/google_dfareporting2d7/struct.Dfareporting.html)** + * a central object to maintain state and allow accessing all *Activities* + * creates [*Method Builders*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](http://byron.github.io/google-apis-rs/google_dfareporting2d7/trait.CallBuilder.html) +* **[Resources](http://byron.github.io/google-apis-rs/google_dfareporting2d7/trait.Resource.html)** + * primary types that you can apply *Activities* to + * a collection of properties and *Parts* + * **[Parts](http://byron.github.io/google-apis-rs/google_dfareporting2d7/trait.Part.html)** + * a collection of properties + * never directly used in *Activities* +* **[Activities](http://byron.github.io/google-apis-rs/google_dfareporting2d7/trait.CallBuilder.html)** + * operations to apply to *Resources* + +All *structures* are marked with applicable traits to further categorize them and ease browsing. + +Generally speaking, you can invoke *Activities* like this: + +```Rust,ignore +let r = hub.resource().activity(...).doit() +``` + +Or specifically ... + +```ignore +let r = hub.reports().run(...).doit() +let r = hub.reports().get(...).doit() +let r = hub.reports().list(...).doit() +let r = hub.reports().delete(...).doit() +let r = hub.reports().files_list(...).doit() +let r = hub.reports().insert(...).doit() +let r = hub.reports().patch(...).doit() +let r = hub.reports().compatible_fields_query(...).doit() +let r = hub.reports().update(...).doit() +let r = hub.reports().files_get(...).doit() +``` + +The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +The `doit()` method performs the actual communication with the server and returns the respective result. + +# Usage + +## Setting up your Project + +To use this library, you would put the following lines into your `Cargo.toml` file: + +```toml +[dependencies] +google-dfareporting2d7 = "*" +``` + +## A complete example + +```Rust +extern crate hyper; +extern crate yup_oauth2 as oauth2; +extern crate google_dfareporting2d7 as dfareporting2d7; +use dfareporting2d7::{Result, Error}; +use std::default::Default; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +use dfareporting2d7::Dfareporting; + +// Get an ApplicationSecret instance by some means. It contains the `client_id` and +// `client_secret`, among other things. +let secret: ApplicationSecret = Default::default(); +// Instantiate the authenticator. It will choose a suitable authentication flow for you, +// unless you replace `None` with the desired Flow. +// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +// retrieve them from storage. +let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, + hyper::Client::new(), + ::default(), None); +let mut hub = Dfareporting::new(hyper::Client::new(), auth); +// You can configure optional parameters by calling the respective setters at will, and +// execute the final call using `doit()`. +// Values shown here are possibly random and not representative ! +let result = hub.reports().list("profileId") + .sort_order("sit") + .sort_field("Stet") + .scope("sed") + .page_token("et") + .max_results(-18) + .doit(); + +match result { + Err(e) => match e { + // The Error enum provides details about what exactly happened. + // You can also just use its `Debug`, `Display` or `Error` traits + Error::HttpError(_) + |Error::MissingAPIKey + |Error::MissingToken(_) + |Error::Cancelled + |Error::UploadSizeLimitExceeded(_, _) + |Error::Failure(_) + |Error::BadRequest(_) + |Error::FieldClash(_) + |Error::JsonDecodeError(_, _) => println!("{}", e), + }, + Ok(res) => println!("Success: {:?}", res), +} + +``` +## Handling Errors + +All errors produced by the system are provided either as [Result](http://byron.github.io/google-apis-rs/google_dfareporting2d7/enum.Result.html) enumeration as return value of +the doit() methods, or handed as possibly intermediate results to either the +[Hub Delegate](http://byron.github.io/google-apis-rs/google_dfareporting2d7/trait.Delegate.html), or the [Authenticator Delegate](http://byron.github.io/google-apis-rs/google_dfareporting2d7/../yup-oauth2/trait.AuthenticatorDelegate.html). + +When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +makes the system potentially resilient to all kinds of errors. + +## Uploads and Downloads +If a method supports downloads, the response body, which is part of the [Result](http://byron.github.io/google-apis-rs/google_dfareporting2d7/enum.Result.html), should be +read by you to obtain the media. +If such a method also supports a [Response Result](http://byron.github.io/google-apis-rs/google_dfareporting2d7/trait.ResponseResult.html), it will return that by default. +You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +this call: `.param("alt", "media")`. + +Methods supporting uploads can do so using up to 2 different protocols: +*simple* and *resumable*. The distinctiveness of each is represented by customized +`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. + +## Customization and Callbacks + +You may alter the way an `doit()` method is called by providing a [delegate](http://byron.github.io/google-apis-rs/google_dfareporting2d7/trait.Delegate.html) to the +[Method Builder](http://byron.github.io/google-apis-rs/google_dfareporting2d7/trait.CallBuilder.html) before making the final `doit()` call. +Respective methods will be called to provide progress information, as well as determine whether the system should +retry on failure. + +The [delegate trait](http://byron.github.io/google-apis-rs/google_dfareporting2d7/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. + +## Optional Parts in Server-Requests + +All structures provided by this library are made to be [enocodable](http://byron.github.io/google-apis-rs/google_dfareporting2d7/trait.RequestValue.html) and +[decodable](http://byron.github.io/google-apis-rs/google_dfareporting2d7/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +are valid. +Most optionals are are considered [Parts](http://byron.github.io/google-apis-rs/google_dfareporting2d7/trait.Part.html) which are identifiable by name, which will be sent to +the server to indicate either the set parts of the request or the desired parts in the response. + +## Builder Arguments + +Using [method builders](http://byron.github.io/google-apis-rs/google_dfareporting2d7/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +These will always take a single argument, for which the following statements are true. + +* [PODs][wiki-pod] are handed by copy +* strings are passed as `&str` +* [request values](http://byron.github.io/google-apis-rs/google_dfareporting2d7/trait.RequestValue.html) are moved + +Arguments will always be copied or cloned into the builder, to make them independent of their original life times. + +[wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +[google-go-api]: https://github.com/google/google-api-go-client + +# License +The **dfareporting2d7** library was generated by Sebastian Thiel, and is placed +under the *MIT* license. +You can read the full text at the repository's [license file][repo-license]. + +[repo-license]: https://github.com/Byron/google-apis-rs/LICENSE.md diff --git a/gen/dfareporting2d7/src/build.rs b/gen/dfareporting2d7/src/build.rs new file mode 100644 index 0000000000..0bebaf0bf0 --- /dev/null +++ b/gen/dfareporting2d7/src/build.rs @@ -0,0 +1,25 @@ +#[cfg(feature = "with-serde-codegen")] +mod inner { + extern crate serde_codegen; + + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + serde_codegen::expand(&src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-serde-codegen"))] +mod inner { + pub fn main() {} +} + +pub fn main() { + inner::main() +} \ No newline at end of file diff --git a/gen/dfareporting2d7/src/cmn.rs b/gen/dfareporting2d7/src/cmn.rs new file mode 100644 index 0000000000..d75063e466 --- /dev/null +++ b/gen/dfareporting2d7/src/cmn.rs @@ -0,0 +1,753 @@ +// COPY OF 'src/rust/api/cmn.rs' +// DO NOT EDIT +use std::io::{self, Read, Seek, Cursor, Write, SeekFrom}; +use std; +use std::fmt::{self, Display}; +use std::str::FromStr; +use std::error; +use std::thread::sleep; +use std::time::Duration; + +use mime::{Mime, TopLevel, SubLevel, Attr, Value}; +use oauth2::{TokenType, Retry, self}; +use hyper; +use hyper::header::{ContentType, ContentLength, Headers, UserAgent, Authorization, Header, + HeaderFormat, Bearer}; +use hyper::http::h1::LINE_ENDING; +use hyper::method::Method; +use hyper::status::StatusCode; + +use serde_json as json; + +/// Identifies the Hub. There is only one per library, this trait is supposed +/// to make intended use more explicit. +/// The hub allows to access all resource methods more easily. +pub trait Hub {} + +/// Identifies types for building methods of a particular resource type +pub trait MethodsBuilder {} + +/// Identifies types which represent builders for a particular resource method +pub trait CallBuilder {} + +/// Identifies types which can be inserted and deleted. +/// Types with this trait are most commonly used by clients of this API. +pub trait Resource {} + +/// Identifies types which are used in API responses. +pub trait ResponseResult {} + +/// Identifies types which are used in API requests. +pub trait RequestValue {} + +/// Identifies types which are not actually used by the API +/// This might be a bug within the google API schema. +pub trait UnusedType {} + +/// Identifies types which are only used as part of other types, which +/// usually are carrying the `Resource` trait. +pub trait Part {} + +/// Identifies types which are only used by other types internally. +/// They have no special meaning, this trait just marks them for completeness. +pub trait NestedType {} + +/// A utility to specify reader types which provide seeking capabilities too +pub trait ReadSeek: Seek + Read {} +impl ReadSeek for T {} + +/// A trait for all types that can convert themselves into a *parts* string +pub trait ToParts { + fn to_parts(&self) -> String; +} + +/// A utility type which can decode a server response that indicates error +#[derive(Deserialize)] +pub struct JsonServerError { + pub error: String, + pub error_description: Option +} + +/// A utility to represent detailed errors we might see in case there are BadRequests. +/// The latter happen if the sent parameters or request structures are unsound +#[derive(Deserialize, Serialize, Debug)] +pub struct ErrorResponse { + error: ServerError, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerError { + errors: Vec, + code: u16, + message: String, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerMessage { + domain: String, + reason: String, + message: String, + #[serde(rename="locationType")] + location_type: Option, + location: Option +} + +#[derive(Copy, Clone)] +pub struct DummyNetworkStream; + +impl Read for DummyNetworkStream { + fn read(&mut self, _: &mut [u8]) -> io::Result { + Ok(0) + } +} + +impl Write for DummyNetworkStream { + fn write(&mut self, _: &[u8]) -> io::Result { + Ok(0) + } + + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} + +impl hyper::net::NetworkStream for DummyNetworkStream { + fn peer_addr(&mut self) -> io::Result { + Ok("127.0.0.1:1337".parse().unwrap()) + } + + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } + + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } +} + + +/// A trait specifying functionality to help controlling any request performed by the API. +/// The trait has a conservative default implementation. +/// +/// It contains methods to deal with all common issues, as well with the ones related to +/// uploading media +pub trait Delegate { + + /// Called at the beginning of any API request. The delegate should store the method + /// information if he is interesting in knowing more context when further calls to it + /// are made. + /// The matching `finished()` call will always be made, no matter whether or not the API + /// request was successful. That way, the delegate may easily maintain a clean state + /// between various API calls. + fn begin(&mut self, MethodInfo) {} + + /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + /// + /// Return retry information. + fn http_error(&mut self, &hyper::Error) -> Retry { + Retry::Abort + } + + /// Called whenever there is the need for your applications API key after + /// the official authenticator implementation didn't provide one, for some reason. + /// If this method returns None as well, the underlying operation will fail + fn api_key(&mut self) -> Option { + None + } + + /// Called whenever the Authenticator didn't yield a token. The delegate + /// may attempt to provide one, or just take it as a general information about the + /// impending failure. + /// The given Error provides information about why the token couldn't be acquired in the + /// first place + fn token(&mut self, err: &error::Error) -> Option { + let _ = err; + None + } + + /// Called during resumable uploads to provide a URL for the impending upload. + /// It was saved after a previous call to `store_upload_url(...)`, and if not None, + /// will be used instead of asking the server for a new upload URL. + /// This is useful in case a previous resumable upload was aborted/canceled, but should now + /// be resumed. + /// The returned URL will be used exactly once - if it fails again and the delegate allows + /// to retry, we will ask the server for a new upload URL. + fn upload_url(&mut self) -> Option { + None + } + + /// Called after we have retrieved a new upload URL for a resumable upload to store it + /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// see `upload_url()`. + /// It will also be called with None after a successful upload, which allows the delegate + /// to forget the URL. That way, we will not attempt to resume an upload that has already + /// finished. + fn store_upload_url(&mut self, url: Option<&str>) { + let _ = url; + } + + /// Called whenever a server response could not be decoded from json. + /// It's for informational purposes only, the caller will return with an error + /// accordingly. + /// + /// # Arguments + /// + /// * `json_encoded_value` - The json-encoded value which failed to decode. + /// * `json_decode_error` - The decoder error + fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &json::Error) { + let _ = json_encoded_value; + let _ = json_decode_error; + } + + /// Called whenever the http request returns with a non-success status code. + /// This can involve authentication issues, or anything else that very much + /// depends on the used API method. + /// The delegate should check the status, header and decoded json error to decide + /// whether to retry or not. In the latter case, the underlying call will fail. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + fn http_failure(&mut self, _: &hyper::client::Response, Option, _: Option) -> Retry { + Retry::Abort + } + + /// Called prior to sending the main request of the given method. It can be used to time + /// the call or to print progress information. + /// It's also useful as you can be sure that a request will definitely be made. + fn pre_request(&mut self) { } + + /// Return the size of each chunk of a resumable upload. + /// Must be a power of two, with 1<<18 being the smallest allowed chunk size. + /// Will be called once before starting any resumable upload. + fn chunk_size(&mut self) -> u64 { + 1 << 23 + } + + /// Called before the given chunk is uploaded to the server. + /// If true is returned, the upload will be interrupted. + /// However, it may be resumable if you stored the upload URL in a previous call + /// to `store_upload_url()` + fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { + let _ = chunk; + false + } + + /// Called before the API request method returns, in every case. It can be used to clean up + /// internal state between calls to the API. + /// This call always has a matching call to `begin(...)`. + /// + /// # Arguments + /// + /// * `is_success` - a true value indicates the operation was successful. If false, you should + /// discard all values stored during `store_upload_url`. + fn finished(&mut self, is_success: bool) { + let _ = is_success; + } +} + +/// A delegate with a conservative default implementation, which is used if no other delegate is +/// set. +#[derive(Default)] +pub struct DefaultDelegate; + +impl Delegate for DefaultDelegate {} + + +#[derive(Debug)] +pub enum Error { + /// The http connection failed + HttpError(hyper::Error), + + /// An attempt was made to upload a resource with size stored in field `.0` + /// even though the maximum upload size is what is stored in field `.1`. + UploadSizeLimitExceeded(u64, u64), + + /// Represents information about a request that was not understood by the server. + /// Details are included. + BadRequest(ErrorResponse), + + /// We needed an API key for authentication, but didn't obtain one. + /// Neither through the authenticator, nor through the Delegate. + MissingAPIKey, + + /// We required a Token, but didn't get one from the Authenticator + MissingToken(Box), + + /// The delgate instructed to cancel the operation + Cancelled, + + /// An additional, free form field clashed with one of the built-in optional ones + FieldClash(&'static str), + + /// Shows that we failed to decode the server response. + /// This can happen if the protocol changes in conjunction with strict json decoding. + JsonDecodeError(String, json::Error), + + /// Indicates an HTTP repsonse with a non-success status code + Failure(hyper::client::Response), +} + + +impl Display for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + Error::HttpError(ref err) => err.fmt(f), + Error::UploadSizeLimitExceeded(ref resource_size, ref max_size) => + writeln!(f, "The media size {} exceeds the maximum allowed upload size of {}" + , resource_size, max_size), + Error::MissingAPIKey => { + (writeln!(f, "The application's API key was not found in the configuration")).ok(); + writeln!(f, "It is used as there are no Scopes defined for this method.") + }, + Error::BadRequest(ref err) => { + try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); + for err in err.error.errors.iter() { + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, + err.reason, + match &err.location { + &Some(ref loc) => format!("@{}", loc), + &None => String::new(), + })); + } + Ok(()) + }, + Error::MissingToken(ref err) => + writeln!(f, "Token retrieval failed with error: {}", err), + Error::Cancelled => + writeln!(f, "Operation cancelled by delegate"), + Error::FieldClash(field) => + writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), + Error::JsonDecodeError(ref json_str, ref err) + => writeln!(f, "{}: {}", err, json_str), + Error::Failure(ref response) => + writeln!(f, "Http status indicates failure: {:?}", response), + } + } +} + +impl error::Error for Error { + fn description(&self) -> &str { + match *self { + Error::HttpError(ref err) => err.description(), + Error::JsonDecodeError(_, ref err) => err.description(), + _ => "NO DESCRIPTION POSSIBLE - use `Display.fmt()` instead" + } + } + + fn cause(&self) -> Option<&error::Error> { + match *self { + Error::HttpError(ref err) => err.cause(), + Error::JsonDecodeError(_, ref err) => err.cause(), + _ => None + } + } +} + +/// A universal result type used as return for all calls. +pub type Result = std::result::Result; + +/// Contains information about an API request. +pub struct MethodInfo { + pub id: &'static str, + pub http_method: Method, +} + +const BOUNDARY: &'static str = "MDuXWGyeE33QFXGchb2VFWc4Z7945d"; + +/// Provides a `Read` interface that converts multiple parts into the protocol +/// identified by [RFC2387](https://tools.ietf.org/html/rfc2387). +/// **Note**: This implementation is just as rich as it needs to be to perform uploads +/// to google APIs, and might not be a fully-featured implementation. +#[derive(Default)] +pub struct MultiPartReader<'a> { + raw_parts: Vec<(Headers, &'a mut Read)>, + current_part: Option<(Cursor>, &'a mut Read)>, + last_part_boundary: Option>>, +} + +impl<'a> MultiPartReader<'a> { + + /// Reserve memory for exactly the given amount of parts + pub fn reserve_exact(&mut self, cap: usize) { + self.raw_parts.reserve_exact(cap); + } + + /// Add a new part to the queue of parts to be read on the first `read` call. + /// + /// # Arguments + /// + /// `headers` - identifying the body of the part. It's similar to the header + /// in an ordinary single-part call, and should thus contain the + /// same information. + /// `reader` - a reader providing the part's body + /// `size` - the amount of bytes provided by the reader. It will be put onto the header as + /// content-size. + /// `mime` - It will be put onto the content type + pub fn add_part(&mut self, reader: &'a mut Read, size: u64, mime_type: Mime) -> &mut MultiPartReader<'a> { + let mut headers = Headers::new(); + headers.set(ContentType(mime_type)); + headers.set(ContentLength(size)); + self.raw_parts.push((headers, reader)); + self + } + + /// Returns the mime-type representing our multi-part message. + /// Use it with the ContentType header. + pub fn mime_type(&self) -> Mime { + Mime( + TopLevel::Multipart, + SubLevel::Ext("Related".to_string()), + vec![(Attr::Ext("boundary".to_string()), Value::Ext(BOUNDARY.to_string()))], + ) + } + + /// Returns true if we are totally used + fn is_depleted(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_none() && self.last_part_boundary.is_none() + } + + /// Returns true if we are handling our last part + fn is_last_part(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_some() + } +} + +impl<'a> Read for MultiPartReader<'a> { + fn read(&mut self, buf: &mut [u8]) -> io::Result { + match (self.raw_parts.len(), + self.current_part.is_none(), + self.last_part_boundary.is_none()) { + (_, _, false) => { + let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); + if br < buf.len() { + self.last_part_boundary = None; + } + return Ok(br) + }, + (0, true, true) => return Ok(0), + (n, true, _) if n > 0 => { + let (headers, reader) = self.raw_parts.remove(0); + let mut c = Cursor::new(Vec::::new()); + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + headers, LINE_ENDING)).unwrap(); + c.seek(SeekFrom::Start(0)).unwrap(); + self.current_part = Some((c, reader)); + } + _ => {}, + } + + // read headers as long as possible + let (hb, rr) = { + let &mut (ref mut c, ref mut reader) = self.current_part.as_mut().unwrap(); + let b = c.read(buf).unwrap_or(0); + (b, reader.read(&mut buf[b..])) + }; + + match rr { + Ok(bytes_read) => { + if hb < buf.len() && bytes_read == 0 { + if self.is_last_part() { + // before clearing the last part, we will add the boundary that + // will be written last + self.last_part_boundary = Some(Cursor::new( + format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) + } + // We are depleted - this can trigger the next part to come in + self.current_part = None; + } + let mut total_bytes_read = hb + bytes_read; + while total_bytes_read < buf.len() && !self.is_depleted() { + match self.read(&mut buf[total_bytes_read ..]) { + Ok(br) => total_bytes_read += br, + Err(err) => return Err(err), + } + } + Ok(total_bytes_read) + } + Err(err) => { + // fail permanently + self.current_part = None; + self.last_part_boundary = None; + self.raw_parts.clear(); + Err(err) + } + } + } +} + +/// The `X-Upload-Content-Type` header. +/// +/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// processed to be more readable. +#[derive(PartialEq, Debug, Clone)] +pub struct XUploadContentType(pub Mime); + +impl ::std::ops::Deref for XUploadContentType { + type Target = Mime; + fn deref<'a>(&'a self) -> &'a Mime { &self.0 } +} +impl ::std::ops::DerefMut for XUploadContentType { + fn deref_mut<'a>(&'a mut self) -> &'a mut Mime { &mut self.0 } +} +impl Header for XUploadContentType { + fn header_name() -> &'static str { "X-Upload-Content-Type" } + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + hyper::header::parsing::from_one_raw_str(raw).map(XUploadContentType) + } +} +impl HeaderFormat for XUploadContentType { + fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result { + Display::fmt(&**self, f) + } +} +impl Display for XUploadContentType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(&**self, f) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct Chunk { + pub first: u64, + pub last: u64 +} + +impl fmt::Display for Chunk { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + (write!(fmt, "{}-{}", self.first, self.last)).ok(); + Ok(()) + } +} + +impl FromStr for Chunk { + type Err = &'static str; + + /// NOTE: only implements `%i-%i`, not `*` + fn from_str(s: &str) -> std::result::Result { + let parts: Vec<&str> = s.split('-').collect(); + if parts.len() != 2 { + return Err("Expected two parts: %i-%i") + } + Ok( + Chunk { + first: match FromStr::from_str(parts[0]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'first' as digit") + }, + last: match FromStr::from_str(parts[1]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'last' as digit") + } + } + ) + } +} + +/// Implements the Content-Range header, for serialization only +#[derive(Clone, PartialEq, Debug)] +pub struct ContentRange { + pub range: Option, + pub total_length: u64, +} + +impl Header for ContentRange { + fn header_name() -> &'static str { + "Content-Range" + } + + /// We are not parsable, as parsing is done by the `Range` header + fn parse_header(_: &[Vec]) -> hyper::error::Result { + Err(hyper::error::Error::Method) + } +} + + +impl HeaderFormat for ContentRange { + fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + try!(fmt.write_str("bytes ")); + match self.range { + Some(ref c) => try!(c.fmt(fmt)), + None => try!(fmt.write_str("*")) + } + (write!(fmt, "/{}", self.total_length)).ok(); + Ok(()) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct RangeResponseHeader(pub Chunk); + +impl Header for RangeResponseHeader { + fn header_name() -> &'static str { + "Range" + } + + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + if raw.len() > 0 { + let v = &raw[0]; + if let Ok(s) = std::str::from_utf8(v) { + const PREFIX: &'static str = "bytes "; + if s.starts_with(PREFIX) { + if let Ok(c) = ::from_str(&s[PREFIX.len()..]) { + return Ok(RangeResponseHeader(c)) + } + } + } + } + Err(hyper::error::Error::Method) + } +} + +impl HeaderFormat for RangeResponseHeader { + /// No implmentation necessary, we just need to parse + fn fmt_header(&self, _: &mut fmt::Formatter) -> fmt::Result { + Err(fmt::Error) + } +} + +/// A utility type to perform a resumable upload from start to end. +pub struct ResumableUploadHelper<'a, A: 'a> { + pub client: &'a mut hyper::client::Client, + pub delegate: &'a mut Delegate, + pub start_at: Option, + pub auth: &'a mut A, + pub user_agent: &'a str, + pub auth_header: Authorization, + pub url: &'a str, + pub reader: &'a mut ReadSeek, + pub media_type: Mime, + pub content_length: u64 +} + +impl<'a, A> ResumableUploadHelper<'a, A> + where A: oauth2::GetToken { + + fn query_transfer_status(&mut self) -> std::result::Result> { + loop { + match self.client.post(self.url) + .header(UserAgent(self.user_agent.to_string())) + .header(ContentRange { range: None, total_length: self.content_length }) + .header(self.auth_header.clone()) + .send() { + Ok(r) => { + // 308 = resume-incomplete == PermanentRedirect + let headers = r.headers.clone(); + let h: &RangeResponseHeader = match headers.get() { + Some(hh) if r.status == StatusCode::PermanentRedirect => hh, + None|Some(_) => { + if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { + sleep(d); + continue; + } + return Err(Ok(r)) + } + }; + return Ok(h.0.last) + } + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Err(Err(err)) + } + } + } + } + + /// returns None if operation was cancelled by delegate, or the HttpResult. + /// It can be that we return the result just because we didn't understand the status code - + /// caller should check for status himself before assuming it's OK to use + pub fn upload(&mut self) -> Option> { + let mut start = match self.start_at { + Some(s) => s, + None => match self.query_transfer_status() { + Ok(s) => s, + Err(result) => return Some(result) + } + }; + + const MIN_CHUNK_SIZE: u64 = 1 << 18; + let chunk_size = match self.delegate.chunk_size() { + cs if cs > MIN_CHUNK_SIZE => cs, + _ => MIN_CHUNK_SIZE + }; + + self.reader.seek(SeekFrom::Start(start)).unwrap(); + loop { + let request_size = match self.content_length - start { + rs if rs > chunk_size => chunk_size, + rs => rs + }; + + let mut section_reader = self.reader.take(request_size); + let range_header = ContentRange { + range: Some(Chunk {first: start, last: start + request_size - 1}), + total_length: self.content_length + }; + start += request_size; + if self.delegate.cancel_chunk_upload(&range_header) { + return None + } + let res = self.client.post(self.url) + .header(range_header) + .header(ContentType(self.media_type.clone())) + .header(UserAgent(self.user_agent.to_string())) + .body(&mut section_reader) + .send(); + match res { + Ok(mut res) => { + if res.status == StatusCode::PermanentRedirect { + continue + } + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let Retry::After(d) = self.delegate.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + } + return Some(Ok(res)) + }, + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Some(Err(err)) + } + } + } + } +} + +// Copy of src/rust/cli/cmn.rs +// TODO(ST): Allow sharing common code between program types +pub fn remove_json_null_values(value: &mut json::value::Value) { + match *value { + json::value::Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} diff --git a/gen/dfareporting2d7/src/lib.rs b/gen/dfareporting2d7/src/lib.rs new file mode 100644 index 0000000000..1211bd79ef --- /dev/null +++ b/gen/dfareporting2d7/src/lib.rs @@ -0,0 +1,323 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +//! This documentation was generated from *dfareporting* crate version *1.0.0+20161027*, where *20161027* is the exact revision of the *dfareporting:v2.7* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! +//! Everything else about the *dfareporting* *v2d7* API can be found at the +//! [official documentation site](https://developers.google.com/doubleclick-advertisers/). +//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/dfareporting2d7). +//! # Features +//! +//! Handle the following *Resources* with ease from the central [hub](struct.Dfareporting.html) ... +//! +//! * [account active ad summaries](struct.AccountActiveAdSummary.html) +//! * [*get*](struct.AccountActiveAdSummaryGetCall.html) +//! * [account permission groups](struct.AccountPermissionGroup.html) +//! * [*get*](struct.AccountPermissionGroupGetCall.html) and [*list*](struct.AccountPermissionGroupListCall.html) +//! * [account permissions](struct.AccountPermission.html) +//! * [*get*](struct.AccountPermissionGetCall.html) and [*list*](struct.AccountPermissionListCall.html) +//! * [account user profiles](struct.AccountUserProfile.html) +//! * [*get*](struct.AccountUserProfileGetCall.html), [*insert*](struct.AccountUserProfileInsertCall.html), [*list*](struct.AccountUserProfileListCall.html), [*patch*](struct.AccountUserProfilePatchCall.html) and [*update*](struct.AccountUserProfileUpdateCall.html) +//! * [accounts](struct.Account.html) +//! * [*get*](struct.AccountGetCall.html), [*list*](struct.AccountListCall.html), [*patch*](struct.AccountPatchCall.html) and [*update*](struct.AccountUpdateCall.html) +//! * [ads](struct.Ad.html) +//! * [*get*](struct.AdGetCall.html), [*insert*](struct.AdInsertCall.html), [*list*](struct.AdListCall.html), [*patch*](struct.AdPatchCall.html) and [*update*](struct.AdUpdateCall.html) +//! * [advertiser groups](struct.AdvertiserGroup.html) +//! * [*delete*](struct.AdvertiserGroupDeleteCall.html), [*get*](struct.AdvertiserGroupGetCall.html), [*insert*](struct.AdvertiserGroupInsertCall.html), [*list*](struct.AdvertiserGroupListCall.html), [*patch*](struct.AdvertiserGroupPatchCall.html) and [*update*](struct.AdvertiserGroupUpdateCall.html) +//! * [advertisers](struct.Advertiser.html) +//! * [*get*](struct.AdvertiserGetCall.html), [*insert*](struct.AdvertiserInsertCall.html), [*list*](struct.AdvertiserListCall.html), [*patch*](struct.AdvertiserPatchCall.html) and [*update*](struct.AdvertiserUpdateCall.html) +//! * [browsers](struct.Browser.html) +//! * [*list*](struct.BrowserListCall.html) +//! * [campaign creative associations](struct.CampaignCreativeAssociation.html) +//! * [*insert*](struct.CampaignCreativeAssociationInsertCall.html) and [*list*](struct.CampaignCreativeAssociationListCall.html) +//! * [campaigns](struct.Campaign.html) +//! * [*get*](struct.CampaignGetCall.html), [*insert*](struct.CampaignInsertCall.html), [*list*](struct.CampaignListCall.html), [*patch*](struct.CampaignPatchCall.html) and [*update*](struct.CampaignUpdateCall.html) +//! * [change logs](struct.ChangeLog.html) +//! * [*get*](struct.ChangeLogGetCall.html) and [*list*](struct.ChangeLogListCall.html) +//! * [cities](struct.City.html) +//! * [*list*](struct.CityListCall.html) +//! * [connection types](struct.ConnectionType.html) +//! * [*get*](struct.ConnectionTypeGetCall.html) and [*list*](struct.ConnectionTypeListCall.html) +//! * [content categories](struct.ContentCategory.html) +//! * [*delete*](struct.ContentCategoryDeleteCall.html), [*get*](struct.ContentCategoryGetCall.html), [*insert*](struct.ContentCategoryInsertCall.html), [*list*](struct.ContentCategoryListCall.html), [*patch*](struct.ContentCategoryPatchCall.html) and [*update*](struct.ContentCategoryUpdateCall.html) +//! * [conversions](struct.Conversion.html) +//! * [*batchinsert*](struct.ConversionBatchinsertCall.html) +//! * [countries](struct.Country.html) +//! * [*get*](struct.CountryGetCall.html) and [*list*](struct.CountryListCall.html) +//! * [creative assets](struct.CreativeAsset.html) +//! * [*insert*](struct.CreativeAssetInsertCall.html) +//! * [creative field values](struct.CreativeFieldValue.html) +//! * [*delete*](struct.CreativeFieldValueDeleteCall.html), [*get*](struct.CreativeFieldValueGetCall.html), [*insert*](struct.CreativeFieldValueInsertCall.html), [*list*](struct.CreativeFieldValueListCall.html), [*patch*](struct.CreativeFieldValuePatchCall.html) and [*update*](struct.CreativeFieldValueUpdateCall.html) +//! * [creative fields](struct.CreativeField.html) +//! * [*delete*](struct.CreativeFieldDeleteCall.html), [*get*](struct.CreativeFieldGetCall.html), [*insert*](struct.CreativeFieldInsertCall.html), [*list*](struct.CreativeFieldListCall.html), [*patch*](struct.CreativeFieldPatchCall.html) and [*update*](struct.CreativeFieldUpdateCall.html) +//! * [creative groups](struct.CreativeGroup.html) +//! * [*get*](struct.CreativeGroupGetCall.html), [*insert*](struct.CreativeGroupInsertCall.html), [*list*](struct.CreativeGroupListCall.html), [*patch*](struct.CreativeGroupPatchCall.html) and [*update*](struct.CreativeGroupUpdateCall.html) +//! * [creatives](struct.Creative.html) +//! * [*get*](struct.CreativeGetCall.html), [*insert*](struct.CreativeInsertCall.html), [*list*](struct.CreativeListCall.html), [*patch*](struct.CreativePatchCall.html) and [*update*](struct.CreativeUpdateCall.html) +//! * [dimension values](struct.DimensionValue.html) +//! * [*query*](struct.DimensionValueQueryCall.html) +//! * [directory site contacts](struct.DirectorySiteContact.html) +//! * [*get*](struct.DirectorySiteContactGetCall.html) and [*list*](struct.DirectorySiteContactListCall.html) +//! * [directory sites](struct.DirectorySite.html) +//! * [*get*](struct.DirectorySiteGetCall.html), [*insert*](struct.DirectorySiteInsertCall.html) and [*list*](struct.DirectorySiteListCall.html) +//! * [dynamic targeting keys](struct.DynamicTargetingKey.html) +//! * [*delete*](struct.DynamicTargetingKeyDeleteCall.html), [*insert*](struct.DynamicTargetingKeyInsertCall.html) and [*list*](struct.DynamicTargetingKeyListCall.html) +//! * [event tags](struct.EventTag.html) +//! * [*delete*](struct.EventTagDeleteCall.html), [*get*](struct.EventTagGetCall.html), [*insert*](struct.EventTagInsertCall.html), [*list*](struct.EventTagListCall.html), [*patch*](struct.EventTagPatchCall.html) and [*update*](struct.EventTagUpdateCall.html) +//! * [files](struct.File.html) +//! * [*get*](struct.FileGetCall.html) and [*list*](struct.FileListCall.html) +//! * [floodlight activities](struct.FloodlightActivity.html) +//! * [*delete*](struct.FloodlightActivityDeleteCall.html), [*generatetag*](struct.FloodlightActivityGeneratetagCall.html), [*get*](struct.FloodlightActivityGetCall.html), [*insert*](struct.FloodlightActivityInsertCall.html), [*list*](struct.FloodlightActivityListCall.html), [*patch*](struct.FloodlightActivityPatchCall.html) and [*update*](struct.FloodlightActivityUpdateCall.html) +//! * [floodlight activity groups](struct.FloodlightActivityGroup.html) +//! * [*get*](struct.FloodlightActivityGroupGetCall.html), [*insert*](struct.FloodlightActivityGroupInsertCall.html), [*list*](struct.FloodlightActivityGroupListCall.html), [*patch*](struct.FloodlightActivityGroupPatchCall.html) and [*update*](struct.FloodlightActivityGroupUpdateCall.html) +//! * [floodlight configurations](struct.FloodlightConfiguration.html) +//! * [*get*](struct.FloodlightConfigurationGetCall.html), [*list*](struct.FloodlightConfigurationListCall.html), [*patch*](struct.FloodlightConfigurationPatchCall.html) and [*update*](struct.FloodlightConfigurationUpdateCall.html) +//! * [inventory items](struct.InventoryItem.html) +//! * [*get*](struct.InventoryItemGetCall.html) and [*list*](struct.InventoryItemListCall.html) +//! * [landing pages](struct.LandingPage.html) +//! * [*delete*](struct.LandingPageDeleteCall.html), [*get*](struct.LandingPageGetCall.html), [*insert*](struct.LandingPageInsertCall.html), [*list*](struct.LandingPageListCall.html), [*patch*](struct.LandingPagePatchCall.html) and [*update*](struct.LandingPageUpdateCall.html) +//! * [languages](struct.Language.html) +//! * [*list*](struct.LanguageListCall.html) +//! * [metros](struct.Metro.html) +//! * [*list*](struct.MetroListCall.html) +//! * [mobile carriers](struct.MobileCarrier.html) +//! * [*get*](struct.MobileCarrierGetCall.html) and [*list*](struct.MobileCarrierListCall.html) +//! * [operating system versions](struct.OperatingSystemVersion.html) +//! * [*get*](struct.OperatingSystemVersionGetCall.html) and [*list*](struct.OperatingSystemVersionListCall.html) +//! * [operating systems](struct.OperatingSystem.html) +//! * [*get*](struct.OperatingSystemGetCall.html) and [*list*](struct.OperatingSystemListCall.html) +//! * [order documents](struct.OrderDocument.html) +//! * [*get*](struct.OrderDocumentGetCall.html) and [*list*](struct.OrderDocumentListCall.html) +//! * [orders](struct.Order.html) +//! * [*get*](struct.OrderGetCall.html) and [*list*](struct.OrderListCall.html) +//! * [placement groups](struct.PlacementGroup.html) +//! * [*get*](struct.PlacementGroupGetCall.html), [*insert*](struct.PlacementGroupInsertCall.html), [*list*](struct.PlacementGroupListCall.html), [*patch*](struct.PlacementGroupPatchCall.html) and [*update*](struct.PlacementGroupUpdateCall.html) +//! * [placement strategies](struct.PlacementStrategy.html) +//! * [*delete*](struct.PlacementStrategyDeleteCall.html), [*get*](struct.PlacementStrategyGetCall.html), [*insert*](struct.PlacementStrategyInsertCall.html), [*list*](struct.PlacementStrategyListCall.html), [*patch*](struct.PlacementStrategyPatchCall.html) and [*update*](struct.PlacementStrategyUpdateCall.html) +//! * [placements](struct.Placement.html) +//! * [*generatetags*](struct.PlacementGeneratetagCall.html), [*get*](struct.PlacementGetCall.html), [*insert*](struct.PlacementInsertCall.html), [*list*](struct.PlacementListCall.html), [*patch*](struct.PlacementPatchCall.html) and [*update*](struct.PlacementUpdateCall.html) +//! * [platform types](struct.PlatformType.html) +//! * [*get*](struct.PlatformTypeGetCall.html) and [*list*](struct.PlatformTypeListCall.html) +//! * [postal codes](struct.PostalCode.html) +//! * [*get*](struct.PostalCodeGetCall.html) and [*list*](struct.PostalCodeListCall.html) +//! * [projects](struct.Project.html) +//! * [*get*](struct.ProjectGetCall.html) and [*list*](struct.ProjectListCall.html) +//! * [regions](struct.Region.html) +//! * [*list*](struct.RegionListCall.html) +//! * [remarketing list shares](struct.RemarketingListShare.html) +//! * [*get*](struct.RemarketingListShareGetCall.html), [*patch*](struct.RemarketingListSharePatchCall.html) and [*update*](struct.RemarketingListShareUpdateCall.html) +//! * [remarketing lists](struct.RemarketingList.html) +//! * [*get*](struct.RemarketingListGetCall.html), [*insert*](struct.RemarketingListInsertCall.html), [*list*](struct.RemarketingListListCall.html), [*patch*](struct.RemarketingListPatchCall.html) and [*update*](struct.RemarketingListUpdateCall.html) +//! * [reports](struct.Report.html) +//! * [*compatible fields query*](struct.ReportCompatibleFieldQueryCall.html), [*delete*](struct.ReportDeleteCall.html), [*files get*](struct.ReportFileGetCall.html), [*files list*](struct.ReportFileListCall.html), [*get*](struct.ReportGetCall.html), [*insert*](struct.ReportInsertCall.html), [*list*](struct.ReportListCall.html), [*patch*](struct.ReportPatchCall.html), [*run*](struct.ReportRunCall.html) and [*update*](struct.ReportUpdateCall.html) +//! * [sites](struct.Site.html) +//! * [*get*](struct.SiteGetCall.html), [*insert*](struct.SiteInsertCall.html), [*list*](struct.SiteListCall.html), [*patch*](struct.SitePatchCall.html) and [*update*](struct.SiteUpdateCall.html) +//! * [sizes](struct.Size.html) +//! * [*get*](struct.SizeGetCall.html), [*insert*](struct.SizeInsertCall.html) and [*list*](struct.SizeListCall.html) +//! * [subaccounts](struct.Subaccount.html) +//! * [*get*](struct.SubaccountGetCall.html), [*insert*](struct.SubaccountInsertCall.html), [*list*](struct.SubaccountListCall.html), [*patch*](struct.SubaccountPatchCall.html) and [*update*](struct.SubaccountUpdateCall.html) +//! * [targetable remarketing lists](struct.TargetableRemarketingList.html) +//! * [*get*](struct.TargetableRemarketingListGetCall.html) and [*list*](struct.TargetableRemarketingListListCall.html) +//! * [targeting templates](struct.TargetingTemplate.html) +//! * [*get*](struct.TargetingTemplateGetCall.html), [*insert*](struct.TargetingTemplateInsertCall.html), [*list*](struct.TargetingTemplateListCall.html), [*patch*](struct.TargetingTemplatePatchCall.html) and [*update*](struct.TargetingTemplateUpdateCall.html) +//! * [user profiles](struct.UserProfile.html) +//! * [*get*](struct.UserProfileGetCall.html) and [*list*](struct.UserProfileListCall.html) +//! * [user role permission groups](struct.UserRolePermissionGroup.html) +//! * [*get*](struct.UserRolePermissionGroupGetCall.html) and [*list*](struct.UserRolePermissionGroupListCall.html) +//! * [user role permissions](struct.UserRolePermission.html) +//! * [*get*](struct.UserRolePermissionGetCall.html) and [*list*](struct.UserRolePermissionListCall.html) +//! * [user roles](struct.UserRole.html) +//! * [*delete*](struct.UserRoleDeleteCall.html), [*get*](struct.UserRoleGetCall.html), [*insert*](struct.UserRoleInsertCall.html), [*list*](struct.UserRoleListCall.html), [*patch*](struct.UserRolePatchCall.html) and [*update*](struct.UserRoleUpdateCall.html) +//! * [video formats](struct.VideoFormat.html) +//! * [*get*](struct.VideoFormatGetCall.html) and [*list*](struct.VideoFormatListCall.html) +//! +//! +//! Upload supported by ... +//! +//! * [*insert creative assets*](struct.CreativeAssetInsertCall.html) +//! +//! Download supported by ... +//! +//! * [*get files*](struct.FileGetCall.html) +//! * [*files get reports*](struct.ReportFileGetCall.html) +//! +//! +//! +//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](../index.html). +//! +//! # Structure of this Library +//! +//! The API is structured into the following primary items: +//! +//! * **[Hub](struct.Dfareporting.html)** +//! * a central object to maintain state and allow accessing all *Activities* +//! * creates [*Method Builders*](trait.MethodsBuilder.html) which in turn +//! allow access to individual [*Call Builders*](trait.CallBuilder.html) +//! * **[Resources](trait.Resource.html)** +//! * primary types that you can apply *Activities* to +//! * a collection of properties and *Parts* +//! * **[Parts](trait.Part.html)** +//! * a collection of properties +//! * never directly used in *Activities* +//! * **[Activities](trait.CallBuilder.html)** +//! * operations to apply to *Resources* +//! +//! All *structures* are marked with applicable traits to further categorize them and ease browsing. +//! +//! Generally speaking, you can invoke *Activities* like this: +//! +//! ```Rust,ignore +//! let r = hub.resource().activity(...).doit() +//! ``` +//! +//! Or specifically ... +//! +//! ```ignore +//! let r = hub.reports().run(...).doit() +//! let r = hub.reports().get(...).doit() +//! let r = hub.reports().list(...).doit() +//! let r = hub.reports().delete(...).doit() +//! let r = hub.reports().files_list(...).doit() +//! let r = hub.reports().insert(...).doit() +//! let r = hub.reports().patch(...).doit() +//! let r = hub.reports().compatible_fields_query(...).doit() +//! let r = hub.reports().update(...).doit() +//! let r = hub.reports().files_get(...).doit() +//! ``` +//! +//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +//! The `doit()` method performs the actual communication with the server and returns the respective result. +//! +//! # Usage +//! +//! ## Setting up your Project +//! +//! To use this library, you would put the following lines into your `Cargo.toml` file: +//! +//! ```toml +//! [dependencies] +//! google-dfareporting2d7 = "*" +//! ``` +//! +//! ## A complete example +//! +//! ```test_harness,no_run +//! extern crate hyper; +//! extern crate yup_oauth2 as oauth2; +//! extern crate google_dfareporting2d7 as dfareporting2d7; +//! use dfareporting2d7::{Result, Error}; +//! # #[test] fn egal() { +//! use std::default::Default; +//! use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +//! use dfareporting2d7::Dfareporting; +//! +//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and +//! // `client_secret`, among other things. +//! let secret: ApplicationSecret = Default::default(); +//! // Instantiate the authenticator. It will choose a suitable authentication flow for you, +//! // unless you replace `None` with the desired Flow. +//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +//! // retrieve them from storage. +//! let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +//! hyper::Client::new(), +//! ::default(), None); +//! let mut hub = Dfareporting::new(hyper::Client::new(), auth); +//! // You can configure optional parameters by calling the respective setters at will, and +//! // execute the final call using `doit()`. +//! // Values shown here are possibly random and not representative ! +//! let result = hub.reports().list("profileId") +//! .sort_order("ipsum") +//! .sort_field("gubergren") +//! .scope("aliquyam") +//! .page_token("Lorem") +//! .max_results(-69) +//! .doit(); +//! +//! match result { +//! Err(e) => match e { +//! // The Error enum provides details about what exactly happened. +//! // You can also just use its `Debug`, `Display` or `Error` traits +//! Error::HttpError(_) +//! |Error::MissingAPIKey +//! |Error::MissingToken(_) +//! |Error::Cancelled +//! |Error::UploadSizeLimitExceeded(_, _) +//! |Error::Failure(_) +//! |Error::BadRequest(_) +//! |Error::FieldClash(_) +//! |Error::JsonDecodeError(_, _) => println!("{}", e), +//! }, +//! Ok(res) => println!("Success: {:?}", res), +//! } +//! # } +//! ``` +//! ## Handling Errors +//! +//! All errors produced by the system are provided either as [Result](enum.Result.html) enumeration as return value of +//! the doit() methods, or handed as possibly intermediate results to either the +//! [Hub Delegate](trait.Delegate.html), or the [Authenticator Delegate](../yup-oauth2/trait.AuthenticatorDelegate.html). +//! +//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +//! makes the system potentially resilient to all kinds of errors. +//! +//! ## Uploads and Downloads +//! If a method supports downloads, the response body, which is part of the [Result](enum.Result.html), should be +//! read by you to obtain the media. +//! If such a method also supports a [Response Result](trait.ResponseResult.html), it will return that by default. +//! You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +//! this call: `.param("alt", "media")`. +//! +//! Methods supporting uploads can do so using up to 2 different protocols: +//! *simple* and *resumable*. The distinctiveness of each is represented by customized +//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. +//! +//! ## Customization and Callbacks +//! +//! You may alter the way an `doit()` method is called by providing a [delegate](trait.Delegate.html) to the +//! [Method Builder](trait.CallBuilder.html) before making the final `doit()` call. +//! Respective methods will be called to provide progress information, as well as determine whether the system should +//! retry on failure. +//! +//! The [delegate trait](trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +//! +//! ## Optional Parts in Server-Requests +//! +//! All structures provided by this library are made to be [enocodable](trait.RequestValue.html) and +//! [decodable](trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +//! are valid. +//! Most optionals are are considered [Parts](trait.Part.html) which are identifiable by name, which will be sent to +//! the server to indicate either the set parts of the request or the desired parts in the response. +//! +//! ## Builder Arguments +//! +//! Using [method builders](trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +//! These will always take a single argument, for which the following statements are true. +//! +//! * [PODs][wiki-pod] are handed by copy +//! * strings are passed as `&str` +//! * [request values](trait.RequestValue.html) are moved +//! +//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times. +//! +//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +//! [google-go-api]: https://github.com/google/google-api-go-client +//! +//! + +// Unused attributes happen thanks to defined, but unused structures +// We don't warn about this, as depending on the API, some data structures or facilities are never used. +// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any +// unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(proc_macro))] +#![allow(unused_imports, unused_mut, dead_code)] + +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-serde-codegen")] +include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/dfareporting2d7/src/lib.rs.in b/gen/dfareporting2d7/src/lib.rs.in new file mode 100644 index 0000000000..f4a9dca987 --- /dev/null +++ b/gen/dfareporting2d7/src/lib.rs.in @@ -0,0 +1,70202 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.in.mako' +// DO NOT EDIT ! + +#[cfg(feature = "nightly")] +#[macro_use] +extern crate serde_derive; + +extern crate hyper; +extern crate serde; +extern crate serde_json; +extern crate yup_oauth2 as oauth2; +extern crate mime; +extern crate url; + +mod cmn; + +use std::collections::HashMap; +use std::cell::RefCell; +use std::borrow::BorrowMut; +use std::default::Default; +use std::collections::BTreeMap; +use serde_json as json; +use std::io; +use std::fs; +use std::thread::sleep; +use std::time::Duration; + +pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + Resource, ErrorResponse, remove_json_null_values}; + + +// ############## +// UTILITIES ### +// ############ + +/// Identifies the an OAuth2 authorization scope. +/// A scope is needed when requesting an +/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). +#[derive(PartialEq, Eq, Hash)] +pub enum Scope { + /// View and manage your DoubleClick Campaign Manager's (DCM) display ad campaigns + Dfatrafficking, + + /// View and manage DoubleClick for Advertisers reports + Full, + + /// Manage DoubleClick Digital Marketing conversions + Ddmconversion, +} + +impl AsRef for Scope { + fn as_ref(&self) -> &str { + match *self { + Scope::Dfatrafficking => "https://www.googleapis.com/auth/dfatrafficking", + Scope::Full => "https://www.googleapis.com/auth/dfareporting", + Scope::Ddmconversion => "https://www.googleapis.com/auth/ddmconversions", + } + } +} + +impl Default for Scope { + fn default() -> Scope { + Scope::Full + } +} + + + +// ######## +// HUB ### +// ###### + +/// Central instance to access all Dfareporting related resource activities +/// +/// # Examples +/// +/// Instantiate a new hub +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::{Result, Error}; +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and +/// // `client_secret`, among other things. +/// let secret: ApplicationSecret = Default::default(); +/// // Instantiate the authenticator. It will choose a suitable authentication flow for you, +/// // unless you replace `None` with the desired Flow. +/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +/// // retrieve them from storage. +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.reports().list("profileId") +/// .sort_order("accusam") +/// .sort_field("takimata") +/// .scope("justo") +/// .page_token("amet.") +/// .max_results(-81) +/// .doit(); +/// +/// match result { +/// Err(e) => match e { +/// // The Error enum provides details about what exactly happened. +/// // You can also just use its `Debug`, `Display` or `Error` traits +/// Error::HttpError(_) +/// |Error::MissingAPIKey +/// |Error::MissingToken(_) +/// |Error::Cancelled +/// |Error::UploadSizeLimitExceeded(_, _) +/// |Error::Failure(_) +/// |Error::BadRequest(_) +/// |Error::FieldClash(_) +/// |Error::JsonDecodeError(_, _) => println!("{}", e), +/// }, +/// Ok(res) => println!("Success: {:?}", res), +/// } +/// # } +/// ``` +pub struct Dfareporting { + client: RefCell, + auth: RefCell, + _user_agent: String, +} + +impl<'a, C, A> Hub for Dfareporting {} + +impl<'a, C, A> Dfareporting + where C: BorrowMut, A: oauth2::GetToken { + + pub fn new(client: C, authenticator: A) -> Dfareporting { + Dfareporting { + client: RefCell::new(client), + auth: RefCell::new(authenticator), + _user_agent: "google-api-rust-client/1.0.0".to_string(), + } + } + + pub fn account_active_ad_summaries(&'a self) -> AccountActiveAdSummaryMethods<'a, C, A> { + AccountActiveAdSummaryMethods { hub: &self } + } + pub fn account_permission_groups(&'a self) -> AccountPermissionGroupMethods<'a, C, A> { + AccountPermissionGroupMethods { hub: &self } + } + pub fn account_permissions(&'a self) -> AccountPermissionMethods<'a, C, A> { + AccountPermissionMethods { hub: &self } + } + pub fn account_user_profiles(&'a self) -> AccountUserProfileMethods<'a, C, A> { + AccountUserProfileMethods { hub: &self } + } + pub fn accounts(&'a self) -> AccountMethods<'a, C, A> { + AccountMethods { hub: &self } + } + pub fn ads(&'a self) -> AdMethods<'a, C, A> { + AdMethods { hub: &self } + } + pub fn advertiser_groups(&'a self) -> AdvertiserGroupMethods<'a, C, A> { + AdvertiserGroupMethods { hub: &self } + } + pub fn advertisers(&'a self) -> AdvertiserMethods<'a, C, A> { + AdvertiserMethods { hub: &self } + } + pub fn browsers(&'a self) -> BrowserMethods<'a, C, A> { + BrowserMethods { hub: &self } + } + pub fn campaign_creative_associations(&'a self) -> CampaignCreativeAssociationMethods<'a, C, A> { + CampaignCreativeAssociationMethods { hub: &self } + } + pub fn campaigns(&'a self) -> CampaignMethods<'a, C, A> { + CampaignMethods { hub: &self } + } + pub fn change_logs(&'a self) -> ChangeLogMethods<'a, C, A> { + ChangeLogMethods { hub: &self } + } + pub fn cities(&'a self) -> CityMethods<'a, C, A> { + CityMethods { hub: &self } + } + pub fn connection_types(&'a self) -> ConnectionTypeMethods<'a, C, A> { + ConnectionTypeMethods { hub: &self } + } + pub fn content_categories(&'a self) -> ContentCategoryMethods<'a, C, A> { + ContentCategoryMethods { hub: &self } + } + pub fn conversions(&'a self) -> ConversionMethods<'a, C, A> { + ConversionMethods { hub: &self } + } + pub fn countries(&'a self) -> CountryMethods<'a, C, A> { + CountryMethods { hub: &self } + } + pub fn creative_assets(&'a self) -> CreativeAssetMethods<'a, C, A> { + CreativeAssetMethods { hub: &self } + } + pub fn creative_field_values(&'a self) -> CreativeFieldValueMethods<'a, C, A> { + CreativeFieldValueMethods { hub: &self } + } + pub fn creative_fields(&'a self) -> CreativeFieldMethods<'a, C, A> { + CreativeFieldMethods { hub: &self } + } + pub fn creative_groups(&'a self) -> CreativeGroupMethods<'a, C, A> { + CreativeGroupMethods { hub: &self } + } + pub fn creatives(&'a self) -> CreativeMethods<'a, C, A> { + CreativeMethods { hub: &self } + } + pub fn dimension_values(&'a self) -> DimensionValueMethods<'a, C, A> { + DimensionValueMethods { hub: &self } + } + pub fn directory_site_contacts(&'a self) -> DirectorySiteContactMethods<'a, C, A> { + DirectorySiteContactMethods { hub: &self } + } + pub fn directory_sites(&'a self) -> DirectorySiteMethods<'a, C, A> { + DirectorySiteMethods { hub: &self } + } + pub fn dynamic_targeting_keys(&'a self) -> DynamicTargetingKeyMethods<'a, C, A> { + DynamicTargetingKeyMethods { hub: &self } + } + pub fn event_tags(&'a self) -> EventTagMethods<'a, C, A> { + EventTagMethods { hub: &self } + } + pub fn files(&'a self) -> FileMethods<'a, C, A> { + FileMethods { hub: &self } + } + pub fn floodlight_activities(&'a self) -> FloodlightActivityMethods<'a, C, A> { + FloodlightActivityMethods { hub: &self } + } + pub fn floodlight_activity_groups(&'a self) -> FloodlightActivityGroupMethods<'a, C, A> { + FloodlightActivityGroupMethods { hub: &self } + } + pub fn floodlight_configurations(&'a self) -> FloodlightConfigurationMethods<'a, C, A> { + FloodlightConfigurationMethods { hub: &self } + } + pub fn inventory_items(&'a self) -> InventoryItemMethods<'a, C, A> { + InventoryItemMethods { hub: &self } + } + pub fn landing_pages(&'a self) -> LandingPageMethods<'a, C, A> { + LandingPageMethods { hub: &self } + } + pub fn languages(&'a self) -> LanguageMethods<'a, C, A> { + LanguageMethods { hub: &self } + } + pub fn metros(&'a self) -> MetroMethods<'a, C, A> { + MetroMethods { hub: &self } + } + pub fn mobile_carriers(&'a self) -> MobileCarrierMethods<'a, C, A> { + MobileCarrierMethods { hub: &self } + } + pub fn operating_system_versions(&'a self) -> OperatingSystemVersionMethods<'a, C, A> { + OperatingSystemVersionMethods { hub: &self } + } + pub fn operating_systems(&'a self) -> OperatingSystemMethods<'a, C, A> { + OperatingSystemMethods { hub: &self } + } + pub fn order_documents(&'a self) -> OrderDocumentMethods<'a, C, A> { + OrderDocumentMethods { hub: &self } + } + pub fn orders(&'a self) -> OrderMethods<'a, C, A> { + OrderMethods { hub: &self } + } + pub fn placement_groups(&'a self) -> PlacementGroupMethods<'a, C, A> { + PlacementGroupMethods { hub: &self } + } + pub fn placement_strategies(&'a self) -> PlacementStrategyMethods<'a, C, A> { + PlacementStrategyMethods { hub: &self } + } + pub fn placements(&'a self) -> PlacementMethods<'a, C, A> { + PlacementMethods { hub: &self } + } + pub fn platform_types(&'a self) -> PlatformTypeMethods<'a, C, A> { + PlatformTypeMethods { hub: &self } + } + pub fn postal_codes(&'a self) -> PostalCodeMethods<'a, C, A> { + PostalCodeMethods { hub: &self } + } + pub fn projects(&'a self) -> ProjectMethods<'a, C, A> { + ProjectMethods { hub: &self } + } + pub fn regions(&'a self) -> RegionMethods<'a, C, A> { + RegionMethods { hub: &self } + } + pub fn remarketing_list_shares(&'a self) -> RemarketingListShareMethods<'a, C, A> { + RemarketingListShareMethods { hub: &self } + } + pub fn remarketing_lists(&'a self) -> RemarketingListMethods<'a, C, A> { + RemarketingListMethods { hub: &self } + } + pub fn reports(&'a self) -> ReportMethods<'a, C, A> { + ReportMethods { hub: &self } + } + pub fn sites(&'a self) -> SiteMethods<'a, C, A> { + SiteMethods { hub: &self } + } + pub fn sizes(&'a self) -> SizeMethods<'a, C, A> { + SizeMethods { hub: &self } + } + pub fn subaccounts(&'a self) -> SubaccountMethods<'a, C, A> { + SubaccountMethods { hub: &self } + } + pub fn targetable_remarketing_lists(&'a self) -> TargetableRemarketingListMethods<'a, C, A> { + TargetableRemarketingListMethods { hub: &self } + } + pub fn targeting_templates(&'a self) -> TargetingTemplateMethods<'a, C, A> { + TargetingTemplateMethods { hub: &self } + } + pub fn user_profiles(&'a self) -> UserProfileMethods<'a, C, A> { + UserProfileMethods { hub: &self } + } + pub fn user_role_permission_groups(&'a self) -> UserRolePermissionGroupMethods<'a, C, A> { + UserRolePermissionGroupMethods { hub: &self } + } + pub fn user_role_permissions(&'a self) -> UserRolePermissionMethods<'a, C, A> { + UserRolePermissionMethods { hub: &self } + } + pub fn user_roles(&'a self) -> UserRoleMethods<'a, C, A> { + UserRoleMethods { hub: &self } + } + pub fn video_formats(&'a self) -> VideoFormatMethods<'a, C, A> { + VideoFormatMethods { hub: &self } + } + + /// Set the user-agent header field to use in all requests to the server. + /// It defaults to `google-api-rust-client/1.0.0`. + /// + /// Returns the previously set user-agent. + pub fn user_agent(&mut self, agent_name: String) -> String { + let prev = self._user_agent.clone(); + self._user_agent = agent_name; + prev + } +} + + +// ############ +// SCHEMAS ### +// ########## +/// Operating System List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list operating systems](struct.OperatingSystemListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OperatingSystemsListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#operatingSystemsListResponse". + pub kind: Option, + /// Operating system collection. + #[serde(rename="operatingSystems")] + pub operating_systems: Option>, +} + +impl ResponseResult for OperatingSystemsListResponse {} + + +/// A Conversion represents when a user successfully performs a desired action after seeing an ad. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [batchinsert conversions](struct.ConversionBatchinsertCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Conversion { + /// The ordinal of the conversion. Use this field to control how conversions of the same user and day are de-duplicated. This is a required field. + pub ordinal: Option, + /// The timestamp of conversion, in Unix epoch micros. This is a required field. + #[serde(rename="timestampMicros")] + pub timestamp_micros: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#conversion". + pub kind: Option, + /// Whether the conversion was directed toward children. + #[serde(rename="childDirectedTreatment")] + pub child_directed_treatment: Option, + /// The alphanumeric encrypted user ID. When set, encryptionInfo should also be specified. This field is mutually exclusive with encryptedUserIdCandidates[] and mobileDeviceId. This or encryptedUserIdCandidates[] or mobileDeviceId is a required field. + #[serde(rename="encryptedUserId")] + pub encrypted_user_id: Option, + /// Custom floodlight variables. + #[serde(rename="customVariables")] + pub custom_variables: Option>, + /// Floodlight Configuration ID of this conversion. This is a required field. + #[serde(rename="floodlightConfigurationId")] + pub floodlight_configuration_id: Option, + /// A list of the alphanumeric encrypted user IDs. Any user ID with exposure prior to the conversion timestamp will be used in the inserted conversion. If no such user ID is found then the conversion will be rejected with NO_COOKIE_MATCH_FOUND error. When set, encryptionInfo should also be specified. This field should only be used when calling conversions.batchinsert. This field is mutually exclusive with encryptedUserId and mobileDeviceId. This or encryptedUserId or mobileDeviceId is a required field. + #[serde(rename="encryptedUserIdCandidates")] + pub encrypted_user_id_candidates: Option>, + /// The value of the conversion. + pub value: Option, + /// Whether Limit Ad Tracking is enabled. When set to true, the conversion will be used for reporting but not targeting. This will prevent remarketing. + #[serde(rename="limitAdTracking")] + pub limit_ad_tracking: Option, + /// The quantity of the conversion. + pub quantity: Option, + /// Floodlight Activity ID of this conversion. This is a required field. + #[serde(rename="floodlightActivityId")] + pub floodlight_activity_id: Option, + /// The mobile device ID. This field is mutually exclusive with encryptedUserId and encryptedUserIdCandidates[]. This or encryptedUserId or encryptedUserIdCandidates[] is a required field. + #[serde(rename="mobileDeviceId")] + pub mobile_device_id: Option, +} + +impl Resource for Conversion {} + + +/// Contains information about a mobile carrier that can be targeted by ads. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list mobile carriers](struct.MobileCarrierListCall.html) (none) +/// * [get mobile carriers](struct.MobileCarrierGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct MobileCarrier { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#mobileCarrier". + pub kind: Option, + /// DART ID of the country to which this mobile carrier belongs. + #[serde(rename="countryDartId")] + pub country_dart_id: Option, + /// ID of this mobile carrier. + pub id: Option, + /// Country code of the country to which this mobile carrier belongs. + #[serde(rename="countryCode")] + pub country_code: Option, + /// Name of this mobile carrier. + pub name: Option, +} + +impl Resource for MobileCarrier {} +impl ResponseResult for MobileCarrier {} + + +/// Contains properties of a DCM subaccount. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get subaccounts](struct.SubaccountGetCall.html) (response) +/// * [update subaccounts](struct.SubaccountUpdateCall.html) (request|response) +/// * [patch subaccounts](struct.SubaccountPatchCall.html) (request|response) +/// * [list subaccounts](struct.SubaccountListCall.html) (none) +/// * [insert subaccounts](struct.SubaccountInsertCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Subaccount { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#subaccount". + pub kind: Option, + /// ID of the account that contains this subaccount. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, + /// IDs of the available user role permissions for this subaccount. + #[serde(rename="availablePermissionIds")] + pub available_permission_ids: Option>, + /// ID of this subaccount. This is a read-only, auto-generated field. + pub id: Option, + /// Name of this subaccount. This is a required field. Must be less than 128 characters long and be unique among subaccounts of the same account. + pub name: Option, +} + +impl RequestValue for Subaccount {} +impl Resource for Subaccount {} +impl ResponseResult for Subaccount {} + + +/// AccountPermissionGroups contains a mapping of permission group IDs to names. A permission group is a grouping of account permissions. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list account permission groups](struct.AccountPermissionGroupListCall.html) (none) +/// * [get account permission groups](struct.AccountPermissionGroupGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AccountPermissionGroup { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#accountPermissionGroup". + pub kind: Option, + /// ID of this account permission group. + pub id: Option, + /// Name of this account permission group. + pub name: Option, +} + +impl Resource for AccountPermissionGroup {} +impl ResponseResult for AccountPermissionGroup {} + + +/// Represents the list of DimensionValue resources. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [query dimension values](struct.DimensionValueQueryCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DimensionValueList { + /// Continuation token used to page through dimension values. To retrieve the next page of results, set the next request's "pageToken" to the value of this field. The page token is only valid for a limited amount of time and should not be persisted. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The dimension values returned in this response. + pub items: Option>, + /// The kind of list this is, in this case dfareporting#dimensionValueList. + pub kind: Option, + /// The eTag of this response for caching purposes. + pub etag: Option, +} + +impl ResponseResult for DimensionValueList {} + + +/// Campaign Creative Association List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list campaign creative associations](struct.CampaignCreativeAssociationListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CampaignCreativeAssociationsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Campaign creative association collection + #[serde(rename="campaignCreativeAssociations")] + pub campaign_creative_associations: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#campaignCreativeAssociationsListResponse". + pub kind: Option, +} + +impl ResponseResult for CampaignCreativeAssociationsListResponse {} + + +/// Directory Site Settings +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DirectorySiteSettings { + /// Whether this site accepts interstitial ads. + #[serde(rename="interstitialPlacementAccepted")] + pub interstitial_placement_accepted: Option, + /// Whether this directory site has disabled Nielsen OCR reach ratings. + #[serde(rename="nielsenOcrOptOut")] + pub nielsen_ocr_opt_out: Option, + /// Whether this directory site has disabled active view creatives. + #[serde(rename="activeViewOptOut")] + pub active_view_opt_out: Option, + /// Whether this directory site has disabled active view for in-stream video creatives. + #[serde(rename="videoActiveViewOptOut")] + pub video_active_view_opt_out: Option, + /// Directory site DFP settings. + pub dfp_settings: Option, + /// Whether this directory site has disabled generation of Verification ins tags. + #[serde(rename="verificationTagOptOut")] + pub verification_tag_opt_out: Option, + /// Whether this site accepts in-stream video ads. + pub instream_video_placement_accepted: Option, +} + +impl Part for DirectorySiteSettings {} + + +/// User Role Permission Group List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list user role permission groups](struct.UserRolePermissionGroupListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UserRolePermissionGroupsListResponse { + /// User role permission group collection. + #[serde(rename="userRolePermissionGroups")] + pub user_role_permission_groups: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#userRolePermissionGroupsListResponse". + pub kind: Option, +} + +impl ResponseResult for UserRolePermissionGroupsListResponse {} + + +/// Represents the list of File resources. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list files](struct.FileListCall.html) (response) +/// * [files list reports](struct.ReportFileListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FileList { + /// Continuation token used to page through files. To retrieve the next page of results, set the next request's "pageToken" to the value of this field. The page token is only valid for a limited amount of time and should not be persisted. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The files returned in this response. + pub items: Option>, + /// The kind of list this is, in this case dfareporting#fileList. + pub kind: Option, + /// The eTag of this response for caching purposes. + pub etag: Option, +} + +impl ResponseResult for FileList {} + + +/// Represents a Custom Rich Media Events group. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CustomRichMediaEvents { + /// The kind of resource this is, in this case dfareporting#customRichMediaEvents. + pub kind: Option, + /// List of custom rich media event IDs. Dimension values must be all of type dfa:richMediaEventTypeIdAndName. + #[serde(rename="filteredEventIds")] + pub filtered_event_ids: Option>, +} + +impl Part for CustomRichMediaEvents {} + + +/// Event tag override information. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct EventTagOverride { + /// Whether this override is enabled. + pub enabled: Option, + /// ID of this event tag override. This is a read-only, auto-generated field. + pub id: Option, +} + +impl Part for EventTagOverride {} + + +/// Video Offset +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct VideoOffset { + /// Duration, as a percentage of video duration. Do not set when offsetSeconds is set. + #[serde(rename="offsetPercentage")] + pub offset_percentage: Option, + /// Duration, in seconds. Do not set when offsetPercentage is set. + #[serde(rename="offsetSeconds")] + pub offset_seconds: Option, +} + +impl Part for VideoOffset {} + + +/// Change Log List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list change logs](struct.ChangeLogListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ChangeLogsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#changeLogsListResponse". + pub kind: Option, + /// Change log collection. + #[serde(rename="changeLogs")] + pub change_logs: Option>, +} + +impl ResponseResult for ChangeLogsListResponse {} + + +/// Gets a summary of active ads in an account. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get account active ad summaries](struct.AccountActiveAdSummaryGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AccountActiveAdSummary { + /// Ads that can be activated for the account. + #[serde(rename="availableAds")] + pub available_ads: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#accountActiveAdSummary". + pub kind: Option, + /// ID of the account. + #[serde(rename="accountId")] + pub account_id: Option, + /// Ads that have been activated for the account + #[serde(rename="activeAds")] + pub active_ads: Option, + /// Maximum number of active ads allowed for the account. + #[serde(rename="activeAdsLimitTier")] + pub active_ads_limit_tier: Option, +} + +impl ResponseResult for AccountActiveAdSummary {} + + +/// Lookback configuration settings. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LookbackConfiguration { + /// Lookback window, in days, from the last time a given user clicked on one of your ads. If you enter 0, clicks will not be considered as triggering events for floodlight tracking. If you leave this field blank, the default value for your account will be used. + #[serde(rename="clickDuration")] + pub click_duration: Option, + /// Lookback window, in days, from the last time a given user viewed one of your ads. If you enter 0, impressions will not be considered as triggering events for floodlight tracking. If you leave this field blank, the default value for your account will be used. + #[serde(rename="postImpressionActivitiesDuration")] + pub post_impression_activities_duration: Option, +} + +impl Part for LookbackConfiguration {} + + +/// Floodlight Activity GenerateTag Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [generatetag floodlight activities](struct.FloodlightActivityGeneratetagCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FloodlightActivitiesGenerateTagResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#floodlightActivitiesGenerateTagResponse". + pub kind: Option, + /// Generated tag for this floodlight activity. + #[serde(rename="floodlightActivityTag")] + pub floodlight_activity_tag: Option, +} + +impl ResponseResult for FloodlightActivitiesGenerateTagResponse {} + + +/// Remarketing List Population Rule Term. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListPopulationTerm { + /// ID of the list in question. This field is only relevant when type is set to LIST_MEMBERSHIP_TERM. + #[serde(rename="remarketingListId")] + pub remarketing_list_id: Option, + /// Will be true if the term should check if the user is in the list and false if the term should check if the user is not in the list. This field is only relevant when type is set to LIST_MEMBERSHIP_TERM. False by default. + pub contains: Option, + /// Whether to negate the comparison result of this term during rule evaluation. This field is only relevant when type is left unset or set to CUSTOM_VARIABLE_TERM or REFERRER_TERM. + pub negation: Option, + /// Literal to compare the variable to. This field is only relevant when type is left unset or set to CUSTOM_VARIABLE_TERM or REFERRER_TERM. + pub value: Option, + /// Friendly name of this term's variable. This is a read-only, auto-generated field. This field is only relevant when type is left unset or set to CUSTOM_VARIABLE_TERM. + #[serde(rename="variableFriendlyName")] + pub variable_friendly_name: Option, + /// Comparison operator of this term. This field is only relevant when type is left unset or set to CUSTOM_VARIABLE_TERM or REFERRER_TERM. + pub operator: Option, + /// List population term type determines the applicable fields in this object. If left unset or set to CUSTOM_VARIABLE_TERM, then variableName, variableFriendlyName, operator, value, and negation are applicable. If set to LIST_MEMBERSHIP_TERM then remarketingListId and contains are applicable. If set to REFERRER_TERM then operator, value, and negation are applicable. + #[serde(rename="type")] + pub type_: Option, + /// Name of the variable (U1, U2, etc.) being compared in this term. This field is only relevant when type is set to null, CUSTOM_VARIABLE_TERM or REFERRER_TERM. + #[serde(rename="variableName")] + pub variable_name: Option, +} + +impl Part for ListPopulationTerm {} + + +/// Site Settings +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SiteSettings { + /// Whether brand safe ads are disabled for this site. + #[serde(rename="disableBrandSafeAds")] + pub disable_brand_safe_ads: Option, + /// Whether active view creatives are disabled for this site. + #[serde(rename="activeViewOptOut")] + pub active_view_opt_out: Option, + /// Whether Verification and ActiveView for in-stream video creatives are disabled by default for new placements created under this site. This value will be used to populate the placement.videoActiveViewOptOut field, when no value is specified for the new placement. + #[serde(rename="videoActiveViewOptOutTemplate")] + pub video_active_view_opt_out_template: Option, + /// Lookback window settings for this site. + #[serde(rename="lookbackConfiguration")] + pub lookback_configuration: Option, + /// Whether new cookies are disabled for this site. + #[serde(rename="disableNewCookie")] + pub disable_new_cookie: Option, + /// Configuration settings for dynamic and image floodlight tags. + #[serde(rename="tagSetting")] + pub tag_setting: Option, + /// Default VPAID adapter setting for new placements created under this site. This value will be used to populate the placements.vpaidAdapterChoice field, when no value is specified for the new placement. Controls which VPAID format the measurement adapter will use for in-stream video creatives assigned to the placement. The publisher's specifications will typically determine this setting. For VPAID creatives, the adapter format will match the VPAID format (HTML5 VPAID creatives use the HTML5 adapter, and Flash VPAID creatives use the Flash adapter). + #[serde(rename="vpaidAdapterChoiceTemplate")] + pub vpaid_adapter_choice_template: Option, + /// Site-wide creative settings. + #[serde(rename="creativeSettings")] + pub creative_settings: Option, +} + +impl Part for SiteSettings {} + + +/// AccountUserProfiles contains properties of a DCM user profile. This resource is specifically for managing user profiles, whereas UserProfiles is for accessing the API. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [patch account user profiles](struct.AccountUserProfilePatchCall.html) (request|response) +/// * [list account user profiles](struct.AccountUserProfileListCall.html) (none) +/// * [insert account user profiles](struct.AccountUserProfileInsertCall.html) (request|response) +/// * [get account user profiles](struct.AccountUserProfileGetCall.html) (response) +/// * [update account user profiles](struct.AccountUserProfileUpdateCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AccountUserProfile { + /// Locale of the user profile. This is a required field. + /// Acceptable values are: + /// - "cs" (Czech) + /// - "de" (German) + /// - "en" (English) + /// - "en-GB" (English United Kingdom) + /// - "es" (Spanish) + /// - "fr" (French) + /// - "it" (Italian) + /// - "ja" (Japanese) + /// - "ko" (Korean) + /// - "pl" (Polish) + /// - "pt-BR" (Portuguese Brazil) + /// - "ru" (Russian) + /// - "sv" (Swedish) + /// - "tr" (Turkish) + /// - "zh-CN" (Chinese Simplified) + /// - "zh-TW" (Chinese Traditional) + pub locale: Option, + /// Filter that describes which sites are visible to the user profile. + #[serde(rename="siteFilter")] + pub site_filter: Option, + /// Filter that describes which campaigns are visible to the user profile. + #[serde(rename="campaignFilter")] + pub campaign_filter: Option, + /// User role ID of the user profile. This is a required field. + #[serde(rename="userRoleId")] + pub user_role_id: Option, + /// User type of the user profile. This is a read-only field that can be left blank. + #[serde(rename="userAccessType")] + pub user_access_type: Option, + /// Whether this user profile is active. This defaults to false, and must be set true on insert for the user profile to be usable. + pub active: Option, + /// ID of the user profile. This is a read-only, auto-generated field. + pub id: Option, + /// Account ID of the user profile. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#accountUserProfile". + pub kind: Option, + /// Subaccount ID of the user profile. This is a read-only field that can be left blank. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Filter that describes which user roles are visible to the user profile. + #[serde(rename="userRoleFilter")] + pub user_role_filter: Option, + /// Trafficker type of this user profile. + #[serde(rename="traffickerType")] + pub trafficker_type: Option, + /// Comments for this user profile. + pub comments: Option, + /// Name of the user profile. This is a required field. Must be less than 64 characters long, must be globally unique, and cannot contain whitespace or any of the following characters: "&;"#%,". + pub name: Option, + /// Filter that describes which advertisers are visible to the user profile. + #[serde(rename="advertiserFilter")] + pub advertiser_filter: Option, + /// Email of the user profile. The email addresss must be linked to a Google Account. This field is required on insertion and is read-only after insertion. + pub email: Option, +} + +impl RequestValue for AccountUserProfile {} +impl Resource for AccountUserProfile {} +impl ResponseResult for AccountUserProfile {} + + +/// Dynamic and Image Tag Settings. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TagSettings { + /// Whether dynamic floodlight tags are enabled. + #[serde(rename="dynamicTagEnabled")] + pub dynamic_tag_enabled: Option, + /// Whether image tags are enabled. + #[serde(rename="imageTagEnabled")] + pub image_tag_enabled: Option, +} + +impl Part for TagSettings {} + + +/// Contains properties of a targetable remarketing list. Remarketing enables you to create lists of users who have performed specific actions on a site, then target ads to members of those lists. This resource is a read-only view of a remarketing list to be used to faciliate targeting ads to specific lists. Remarketing lists that are owned by your advertisers and those that are shared to your advertisers or account are accessible via this resource. To manage remarketing lists that are owned by your advertisers, use the RemarketingLists resource. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list targetable remarketing lists](struct.TargetableRemarketingListListCall.html) (none) +/// * [get targetable remarketing lists](struct.TargetableRemarketingListGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TargetableRemarketingList { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#targetableRemarketingList". + pub kind: Option, + /// Subaccount ID of this remarketing list. This is a read-only, auto-generated field that is only returned in GET requests. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Targetable remarketing list description. + pub description: Option, + /// Number of users currently in the list. This is a read-only field. + #[serde(rename="listSize")] + pub list_size: Option, + /// Number of days that a user should remain in the targetable remarketing list without an impression. + #[serde(rename="lifeSpan")] + pub life_span: Option, + /// Dimension value for the advertiser ID that owns this targetable remarketing list. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Product from which this targetable remarketing list was originated. + #[serde(rename="listSource")] + pub list_source: Option, + /// Whether this targetable remarketing list is active. + pub active: Option, + /// Dimension value for the ID of the advertiser. + #[serde(rename="advertiserIdDimensionValue")] + pub advertiser_id_dimension_value: Option, + /// Account ID of this remarketing list. This is a read-only, auto-generated field that is only returned in GET requests. + #[serde(rename="accountId")] + pub account_id: Option, + /// Targetable remarketing list ID. + pub id: Option, + /// Name of the targetable remarketing list. Is no greater than 128 characters long. + pub name: Option, +} + +impl Resource for TargetableRemarketingList {} +impl ResponseResult for TargetableRemarketingList {} + + +/// Contains information about a particular version of an operating system that can be targeted by ads. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get operating system versions](struct.OperatingSystemVersionGetCall.html) (response) +/// * [list operating system versions](struct.OperatingSystemVersionListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OperatingSystemVersion { + /// Major version (leftmost number) of this operating system version. + #[serde(rename="majorVersion")] + pub major_version: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#operatingSystemVersion". + pub kind: Option, + /// Minor version (number after the first dot) of this operating system version. + #[serde(rename="minorVersion")] + pub minor_version: Option, + /// Name of this operating system version. + pub name: Option, + /// Operating system of this operating system version. + #[serde(rename="operatingSystem")] + pub operating_system: Option, + /// ID of this operating system version. + pub id: Option, +} + +impl Resource for OperatingSystemVersion {} +impl ResponseResult for OperatingSystemVersion {} + + +/// Remarketing list response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list remarketing lists](struct.RemarketingListListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RemarketingListsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Remarketing list collection. + #[serde(rename="remarketingLists")] + pub remarketing_lists: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#remarketingListsListResponse". + pub kind: Option, +} + +impl ResponseResult for RemarketingListsListResponse {} + + +/// Creative Field Assignment. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeFieldAssignment { + /// ID of the creative field. + #[serde(rename="creativeFieldId")] + pub creative_field_id: Option, + /// ID of the creative field value. + #[serde(rename="creativeFieldValueId")] + pub creative_field_value_id: Option, +} + +impl Part for CreativeFieldAssignment {} + + +/// Remarketing List Population Rule. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListPopulationRule { + /// Floodlight activity ID associated with this rule. This field can be left blank. + #[serde(rename="floodlightActivityId")] + pub floodlight_activity_id: Option, + /// Name of floodlight activity associated with this rule. This is a read-only, auto-generated field. + #[serde(rename="floodlightActivityName")] + pub floodlight_activity_name: Option, + /// Clauses that make up this list population rule. Clauses are joined by ANDs, and the clauses themselves are made up of list population terms which are joined by ORs. + #[serde(rename="listPopulationClauses")] + pub list_population_clauses: Option>, +} + +impl Part for ListPopulationRule {} + + +/// Contains properties of a DCM account. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [update accounts](struct.AccountUpdateCall.html) (request|response) +/// * [list accounts](struct.AccountListCall.html) (none) +/// * [get accounts](struct.AccountGetCall.html) (response) +/// * [patch accounts](struct.AccountPatchCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Account { + /// File size limit in kilobytes of Rich Media teaser creatives. Must be between 1 and 10240. + #[serde(rename="teaserSizeLimit")] + pub teaser_size_limit: Option, + /// User role permissions available to the user roles of this account. + #[serde(rename="availablePermissionIds")] + pub available_permission_ids: Option>, + /// Description of this account. + pub description: Option, + /// Locale of this account. + /// Acceptable values are: + /// - "cs" (Czech) + /// - "de" (German) + /// - "en" (English) + /// - "en-GB" (English United Kingdom) + /// - "es" (Spanish) + /// - "fr" (French) + /// - "it" (Italian) + /// - "ja" (Japanese) + /// - "ko" (Korean) + /// - "pl" (Polish) + /// - "pt-BR" (Portuguese Brazil) + /// - "ru" (Russian) + /// - "sv" (Swedish) + /// - "tr" (Turkish) + /// - "zh-CN" (Chinese Simplified) + /// - "zh-TW" (Chinese Traditional) + pub locale: Option, + /// Profile for this account. This is a read-only field that can be left blank. + #[serde(rename="accountProfile")] + pub account_profile: Option, + /// Whether this account is active. + pub active: Option, + /// Whether to serve creatives with Active View tags. If disabled, viewability data will not be available for any impressions. + #[serde(rename="activeViewOptOut")] + pub active_view_opt_out: Option, + /// Share Path to Conversion reports with Twitter. + #[serde(rename="shareReportsWithTwitter")] + pub share_reports_with_twitter: Option, + /// ID of this account. This is a read-only, auto-generated field. + pub id: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#account". + pub kind: Option, + /// ID of the country associated with this account. + #[serde(rename="countryId")] + pub country_id: Option, + /// Name of this account. This is a required field, and must be less than 128 characters long and be globally unique. + pub name: Option, + /// Maximum image size allowed for this account. + #[serde(rename="maximumImageSize")] + pub maximum_image_size: Option, + /// Whether campaigns created in this account will be enabled for Nielsen OCR reach ratings by default. + #[serde(rename="nielsenOcrEnabled")] + pub nielsen_ocr_enabled: Option, + /// Default placement dimensions for this account. + #[serde(rename="defaultCreativeSizeId")] + pub default_creative_size_id: Option, + /// Account permissions assigned to this account. + #[serde(rename="accountPermissionIds")] + pub account_permission_ids: Option>, + /// ID of currency associated with this account. This is a required field. + /// Acceptable values are: + /// - "1" for USD + /// - "2" for GBP + /// - "3" for ESP + /// - "4" for SEK + /// - "5" for CAD + /// - "6" for JPY + /// - "7" for DEM + /// - "8" for AUD + /// - "9" for FRF + /// - "10" for ITL + /// - "11" for DKK + /// - "12" for NOK + /// - "13" for FIM + /// - "14" for ZAR + /// - "15" for IEP + /// - "16" for NLG + /// - "17" for EUR + /// - "18" for KRW + /// - "19" for TWD + /// - "20" for SGD + /// - "21" for CNY + /// - "22" for HKD + /// - "23" for NZD + /// - "24" for MYR + /// - "25" for BRL + /// - "26" for PTE + /// - "27" for MXP + /// - "28" for CLP + /// - "29" for TRY + /// - "30" for ARS + /// - "31" for PEN + /// - "32" for ILS + /// - "33" for CHF + /// - "34" for VEF + /// - "35" for COP + /// - "36" for GTQ + /// - "37" for PLN + /// - "39" for INR + /// - "40" for THB + /// - "41" for IDR + /// - "42" for CZK + /// - "43" for RON + /// - "44" for HUF + /// - "45" for RUB + /// - "46" for AED + /// - "47" for BGN + /// - "48" for HRK + #[serde(rename="currencyId")] + pub currency_id: Option, + /// Reporting configuration of this account. + #[serde(rename="reportsConfiguration")] + pub reports_configuration: Option, + /// Maximum number of active ads allowed for this account. + #[serde(rename="activeAdsLimitTier")] + pub active_ads_limit_tier: Option, +} + +impl RequestValue for Account {} +impl Resource for Account {} +impl ResponseResult for Account {} + + +/// Day Part Targeting. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DayPartTargeting { + /// Days of the week when the ad will serve. + /// + /// Acceptable values are: + /// - "SUNDAY" + /// - "MONDAY" + /// - "TUESDAY" + /// - "WEDNESDAY" + /// - "THURSDAY" + /// - "FRIDAY" + /// - "SATURDAY" + #[serde(rename="daysOfWeek")] + pub days_of_week: Option>, + /// Hours of the day when the ad will serve. Must be an integer between 0 and 23 (inclusive), where 0 is midnight to 1 AM, and 23 is 11 PM to midnight. Can be specified with days of week, in which case the ad would serve during these hours on the specified days. For example, if Monday, Wednesday, Friday are the days of week specified and 9-10am, 3-5pm (hours 9, 15, and 16) is specified, the ad would serve Monday, Wednesdays, and Fridays at 9-10am and 3-5pm. + #[serde(rename="hoursOfDay")] + pub hours_of_day: Option>, + /// Whether or not to use the user's local time. If false, the America/New York time zone applies. + #[serde(rename="userLocalTime")] + pub user_local_time: Option, +} + +impl Part for DayPartTargeting {} + + +/// Represents a response to the queryCompatibleFields method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [compatible fields query reports](struct.ReportCompatibleFieldQueryCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CompatibleFields { + /// The kind of resource this is, in this case dfareporting#compatibleFields. + pub kind: Option, + /// Contains items that are compatible to be selected for a report of type "CROSS_DIMENSION_REACH". + #[serde(rename="crossDimensionReachReportCompatibleFields")] + pub cross_dimension_reach_report_compatible_fields: Option, + /// Contains items that are compatible to be selected for a report of type "REACH". + #[serde(rename="reachReportCompatibleFields")] + pub reach_report_compatible_fields: Option, + /// Contains items that are compatible to be selected for a report of type "PATH_TO_CONVERSION". + #[serde(rename="pathToConversionReportCompatibleFields")] + pub path_to_conversion_report_compatible_fields: Option, + /// Contains items that are compatible to be selected for a report of type "FLOODLIGHT". + #[serde(rename="floodlightReportCompatibleFields")] + pub floodlight_report_compatible_fields: Option, + /// Contains items that are compatible to be selected for a report of type "STANDARD". + #[serde(rename="reportCompatibleFields")] + pub report_compatible_fields: Option, +} + +impl ResponseResult for CompatibleFields {} + + +/// Contains information about a region that can be targeted by ads. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list regions](struct.RegionListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Region { + /// Region code. + #[serde(rename="regionCode")] + pub region_code: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#region". + pub kind: Option, + /// DART ID of the country to which this region belongs. + #[serde(rename="countryDartId")] + pub country_dart_id: Option, + /// Name of this region. + pub name: Option, + /// Country code of the country to which this region belongs. + #[serde(rename="countryCode")] + pub country_code: Option, + /// DART ID of this region. + #[serde(rename="dartId")] + pub dart_id: Option, +} + +impl Resource for Region {} + + +/// The report criteria for a report of type "STANDARD". +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReportCriteria { + /// Activity group. + pub activities: Option, + /// The list of standard dimensions the report should include. + pub dimensions: Option>, + /// The list of names of metrics the report should include. + #[serde(rename="metricNames")] + pub metric_names: Option>, + /// The date range for which this report should be run. + #[serde(rename="dateRange")] + pub date_range: Option, + /// Custom Rich Media Events group. + #[serde(rename="customRichMediaEvents")] + pub custom_rich_media_events: Option, + /// The list of filters on which dimensions are filtered. + /// Filters for different dimensions are ANDed, filters for the same dimension are grouped together and ORed. + #[serde(rename="dimensionFilters")] + pub dimension_filters: Option>, +} + +impl NestedType for ReportCriteria {} +impl Part for ReportCriteria {} + + +/// Order List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list orders](struct.OrderListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OrdersListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#ordersListResponse". + pub kind: Option, + /// Order collection. + pub orders: Option>, +} + +impl ResponseResult for OrdersListResponse {} + + +/// Represents fields that are compatible to be selected for a report of type "CROSS_DIMENSION_REACH". +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CrossDimensionReachReportCompatibleFields { + /// Dimensions which are compatible to be selected in the "breakdown" section of the report. + pub breakdown: Option>, + /// Metrics which are compatible to be selected in the "metricNames" section of the report. + pub metrics: Option>, + /// The kind of resource this is, in this case dfareporting#crossDimensionReachReportCompatibleFields. + pub kind: Option, + /// Metrics which are compatible to be selected in the "overlapMetricNames" section of the report. + #[serde(rename="overlapMetrics")] + pub overlap_metrics: Option>, + /// Dimensions which are compatible to be selected in the "dimensionFilters" section of the report. + #[serde(rename="dimensionFilters")] + pub dimension_filters: Option>, +} + +impl Part for CrossDimensionReachReportCompatibleFields {} + + +/// The error code and description for a conversion that failed to insert or update. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ConversionError { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#conversionError". + pub kind: Option, + /// The error code. + pub code: Option, + /// A description of the error. + pub message: Option, +} + +impl Part for ConversionError {} + + +/// Event Tag List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list event tags](struct.EventTagListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct EventTagsListResponse { + /// Event tag collection. + #[serde(rename="eventTags")] + pub event_tags: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#eventTagsListResponse". + pub kind: Option, +} + +impl ResponseResult for EventTagsListResponse {} + + +/// Contains properties of a Floodlight activity group. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list floodlight activity groups](struct.FloodlightActivityGroupListCall.html) (none) +/// * [get floodlight activity groups](struct.FloodlightActivityGroupGetCall.html) (response) +/// * [insert floodlight activity groups](struct.FloodlightActivityGroupInsertCall.html) (request|response) +/// * [patch floodlight activity groups](struct.FloodlightActivityGroupPatchCall.html) (request|response) +/// * [update floodlight activity groups](struct.FloodlightActivityGroupUpdateCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FloodlightActivityGroup { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#floodlightActivityGroup". + pub kind: Option, + /// Subaccount ID of this floodlight activity group. This is a read-only field that can be left blank. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of this floodlight activity group. This is a required field. Must be less than 65 characters long and cannot contain quotes. + pub name: Option, + /// Floodlight configuration ID of this floodlight activity group. This is a required field. + #[serde(rename="floodlightConfigurationId")] + pub floodlight_configuration_id: Option, + /// Advertiser ID of this floodlight activity group. If this field is left blank, the value will be copied over either from the floodlight configuration's advertiser or from the existing activity group's advertiser. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Dimension value for the ID of the floodlight configuration. This is a read-only, auto-generated field. + #[serde(rename="floodlightConfigurationIdDimensionValue")] + pub floodlight_configuration_id_dimension_value: Option, + /// Dimension value for the ID of this floodlight activity group. This is a read-only, auto-generated field. + #[serde(rename="idDimensionValue")] + pub id_dimension_value: Option, + /// Dimension value for the ID of the advertiser. This is a read-only, auto-generated field. + #[serde(rename="advertiserIdDimensionValue")] + pub advertiser_id_dimension_value: Option, + /// Value of the type= parameter in the floodlight tag, which the ad servers use to identify the activity group that the activity belongs to. This is optional: if empty, a new tag string will be generated for you. This string must be 1 to 8 characters long, with valid characters being [a-z][A-Z][0-9][-][ _ ]. This tag string must also be unique among activity groups of the same floodlight configuration. This field is read-only after insertion. + #[serde(rename="tagString")] + pub tag_string: Option, + /// Type of the floodlight activity group. This is a required field that is read-only after insertion. + #[serde(rename="type")] + pub type_: Option, + /// ID of this floodlight activity group. This is a read-only, auto-generated field. + pub id: Option, + /// Account ID of this floodlight activity group. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, +} + +impl RequestValue for FloodlightActivityGroup {} +impl Resource for FloodlightActivityGroup {} +impl ResponseResult for FloodlightActivityGroup {} + + +/// Audience Segment. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AudienceSegment { + /// Weight allocated to this segment. Must be between 1 and 1000. The weight assigned will be understood in proportion to the weights assigned to other segments in the same segment group. + pub allocation: Option, + /// ID of this audience segment. This is a read-only, auto-generated field. + pub id: Option, + /// Name of this audience segment. This is a required field and must be less than 65 characters long. + pub name: Option, +} + +impl Part for AudienceSegment {} + + +/// Contains properties of a DCM campaign. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [insert campaigns](struct.CampaignInsertCall.html) (request|response) +/// * [update campaigns](struct.CampaignUpdateCall.html) (request|response) +/// * [patch campaigns](struct.CampaignPatchCall.html) (request|response) +/// * [get campaigns](struct.CampaignGetCall.html) (response) +/// * [list campaigns](struct.CampaignListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Campaign { + /// Arbitrary comments about this campaign. Must be less than 256 characters long. + pub comment: Option, + /// Date on which the campaign starts running. The start date can be any date. The hours, minutes, and seconds of the start date should not be set, as doing so will result in an error. This is a required field. + #[serde(rename="startDate")] + pub start_date: Option, + /// Date on which the campaign will stop running. On insert, the end date must be today or a future date. The end date must be later than or be the same as the start date. If, for example, you set 6/25/2015 as both the start and end dates, the effective campaign run date is just that day only, 6/25/2015. The hours, minutes, and seconds of the end date should not be set, as doing so will result in an error. This is a required field. + #[serde(rename="endDate")] + pub end_date: Option, + /// Click-through URL suffix override properties for this campaign. + #[serde(rename="clickThroughUrlSuffixProperties")] + pub click_through_url_suffix_properties: Option, + /// Whether this campaign has been archived. + pub archived: Option, + /// Additional creative optimization configurations for the campaign. + #[serde(rename="additionalCreativeOptimizationConfigurations")] + pub additional_creative_optimization_configurations: Option>, + /// Advertiser ID of this campaign. This is a required field. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Audience segment groups assigned to this campaign. Cannot have more than 300 segment groups. + #[serde(rename="audienceSegmentGroups")] + pub audience_segment_groups: Option>, + /// Information about the creation of this campaign. This is a read-only field. + #[serde(rename="createInfo")] + pub create_info: Option, + /// Click-through event tag ID override properties for this campaign. + #[serde(rename="defaultClickThroughEventTagProperties")] + pub default_click_through_event_tag_properties: Option, + /// Dimension value for the advertiser ID of this campaign. This is a read-only, auto-generated field. + #[serde(rename="advertiserIdDimensionValue")] + pub advertiser_id_dimension_value: Option, + /// Overrides that can be used to activate or deactivate advertiser event tags. + #[serde(rename="eventTagOverrides")] + pub event_tag_overrides: Option>, + /// Creative optimization configuration for the campaign. + #[serde(rename="creativeOptimizationConfiguration")] + pub creative_optimization_configuration: Option, + /// ID of this campaign. This is a read-only auto-generated field. + pub id: Option, + /// Account ID of this campaign. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, + /// Campaign trafficker contact emails. + #[serde(rename="traffickerEmails")] + pub trafficker_emails: Option>, + /// List of creative group IDs that are assigned to the campaign. + #[serde(rename="creativeGroupIds")] + pub creative_group_ids: Option>, + /// Subaccount ID of this campaign. This is a read-only field that can be left blank. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of this campaign. This is a required field and must be less than 256 characters long and unique among campaigns of the same advertiser. + pub name: Option, + /// Lookback window settings for the campaign. + #[serde(rename="lookbackConfiguration")] + pub lookback_configuration: Option, + /// Whether Nielsen reports are enabled for this campaign. + #[serde(rename="nielsenOcrEnabled")] + pub nielsen_ocr_enabled: Option, + /// Information about the most recent modification of this campaign. This is a read-only field. + #[serde(rename="lastModifiedInfo")] + pub last_modified_info: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#campaign". + pub kind: Option, + /// External ID for this campaign. + #[serde(rename="externalId")] + pub external_id: Option, + /// Advertiser group ID of the associated advertiser. + #[serde(rename="advertiserGroupId")] + pub advertiser_group_id: Option, + /// Dimension value for the ID of this campaign. This is a read-only, auto-generated field. + #[serde(rename="idDimensionValue")] + pub id_dimension_value: Option, + /// Billing invoice code included in the DCM client billing invoices associated with the campaign. + #[serde(rename="billingInvoiceCode")] + pub billing_invoice_code: Option, +} + +impl RequestValue for Campaign {} +impl Resource for Campaign {} +impl ResponseResult for Campaign {} + + +/// Describes a change that a user has made to a resource. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list change logs](struct.ChangeLogListCall.html) (none) +/// * [get change logs](struct.ChangeLogGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ChangeLog { + /// Time when the object was modified. + #[serde(rename="changeTime")] + pub change_time: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#changeLog". + pub kind: Option, + /// Subaccount ID of the modified object. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Old value of the object field. + #[serde(rename="oldValue")] + pub old_value: Option, + /// ID of the object of this change log. The object could be a campaign, placement, ad, or other type. + #[serde(rename="objectId")] + pub object_id: Option, + /// ID of this change log. + pub id: Option, + /// User profile name of the user who modified the object. + #[serde(rename="userProfileName")] + pub user_profile_name: Option, + /// Field name of the object which changed. + #[serde(rename="fieldName")] + pub field_name: Option, + /// ID of the user who modified the object. + #[serde(rename="userProfileId")] + pub user_profile_id: Option, + /// Action which caused the change. + pub action: Option, + /// Transaction ID of this change log. When a single API call results in many changes, each change will have a separate ID in the change log but will share the same transactionId. + #[serde(rename="transactionId")] + pub transaction_id: Option, + /// Account ID of the modified object. + #[serde(rename="accountId")] + pub account_id: Option, + /// New value of the object field. + #[serde(rename="newValue")] + pub new_value: Option, + /// Object type of the change log. + #[serde(rename="objectType")] + pub object_type: Option, +} + +impl Resource for ChangeLog {} +impl ResponseResult for ChangeLog {} + + +/// Tag Settings +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TagSetting { + /// Whether static landing page URLs should be included in the tags. This setting applies only to placements. + #[serde(rename="includeClickThroughUrls")] + pub include_click_through_urls: Option, + /// Whether click-tracking string should be included in the tags. + #[serde(rename="includeClickTracking")] + pub include_click_tracking: Option, + /// Additional key-values to be included in tags. Each key-value pair must be of the form key=value, and pairs must be separated by a semicolon (;). Keys and values must not contain commas. For example, id=2;color=red is a valid value for this field. + #[serde(rename="additionalKeyValues")] + pub additional_key_values: Option, + /// Option specifying how keywords are embedded in ad tags. This setting can be used to specify whether keyword placeholders are inserted in placement tags for this site. Publishers can then add keywords to those placeholders. + #[serde(rename="keywordOption")] + pub keyword_option: Option, +} + +impl Part for TagSetting {} + + +/// Represents a File resource. A file contains the metadata for a report run. It shows the status of the run and holds the URLs to the generated report data if the run is finished and the status is "REPORT_AVAILABLE". +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get files](struct.FileGetCall.html) (response) +/// * [list files](struct.FileListCall.html) (none) +/// * [files get reports](struct.ReportFileGetCall.html) (response) +/// * [run reports](struct.ReportRunCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct File { + /// The status of the report file. + pub status: Option, + /// The kind of resource this is, in this case dfareporting#file. + pub kind: Option, + /// The output format of the report. Only available once the file is available. + pub format: Option, + /// The date range for which the file has report data. The date range will always be the absolute date range for which the report is run. + #[serde(rename="dateRange")] + pub date_range: Option, + /// The filename of the file. + #[serde(rename="fileName")] + pub file_name: Option, + /// The eTag of this response for caching purposes. + pub etag: Option, + /// The ID of the report this file was generated from. + #[serde(rename="reportId")] + pub report_id: Option, + /// The URLs where the completed report file can be downloaded. + pub urls: Option, + /// The timestamp in milliseconds since epoch when this file was last modified. + #[serde(rename="lastModifiedTime")] + pub last_modified_time: Option, + /// The unique ID of this report file. + pub id: Option, +} + +impl Resource for File {} +impl ResponseResult for File {} + + +/// Key Value Targeting Expression. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct KeyValueTargetingExpression { + /// Keyword expression being targeted by the ad. + pub expression: Option, +} + +impl Part for KeyValueTargetingExpression {} + + +/// Transcode Settings +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TranscodeSetting { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#transcodeSetting". + pub kind: Option, + /// Whitelist of video formats to be served to this placement. Set this list to null or empty to serve all video formats. + #[serde(rename="enabledVideoFormats")] + pub enabled_video_formats: Option>, +} + +impl Part for TranscodeSetting {} + + +/// The report criteria for a report of type "CROSS_DIMENSION_REACH". +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReportCrossDimensionReachCriteria { + /// The list of dimensions the report should include. + pub breakdown: Option>, + /// Whether the report is pivoted or not. Defaults to true. + pub pivoted: Option, + /// The list of names of overlap metrics the report should include. + #[serde(rename="overlapMetricNames")] + pub overlap_metric_names: Option>, + /// The list of names of metrics the report should include. + #[serde(rename="metricNames")] + pub metric_names: Option>, + /// The date range this report should be run for. + #[serde(rename="dateRange")] + pub date_range: Option, + /// The list of filters on which dimensions are filtered. + #[serde(rename="dimensionFilters")] + pub dimension_filters: Option>, + /// The dimension option. + pub dimension: Option, +} + +impl NestedType for ReportCrossDimensionReachCriteria {} +impl Part for ReportCrossDimensionReachCriteria {} + + +/// Contains properties of a placement. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [generatetags placements](struct.PlacementGeneratetagCall.html) (none) +/// * [insert placements](struct.PlacementInsertCall.html) (request|response) +/// * [update placements](struct.PlacementUpdateCall.html) (request|response) +/// * [list placements](struct.PlacementListCall.html) (none) +/// * [get placements](struct.PlacementGetCall.html) (response) +/// * [patch placements](struct.PlacementPatchCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Placement { + /// Comments for this placement. + pub comment: Option, + /// Whether Verification and ActiveView are disabled for in-stream video creatives for this placement. The same setting videoActiveViewOptOut exists on the site level -- the opt out occurs if either of these settings are true. These settings are distinct from DirectorySites.settings.activeViewOptOut or Sites.siteSettings.activeViewOptOut which only apply to display ads. However, Accounts.activeViewOptOut opts out both video traffic, as well as display ads, from Verification and ActiveView. + #[serde(rename="videoActiveViewOptOut")] + pub video_active_view_opt_out: Option, + /// Campaign ID of this placement. This field is a required field on insertion. + #[serde(rename="campaignId")] + pub campaign_id: Option, + /// Payment source for this placement. This is a required field that is read-only after insertion. + #[serde(rename="paymentSource")] + pub payment_source: Option, + /// Dimension value for the ID of the directory site. This is a read-only, auto-generated field. + #[serde(rename="directorySiteIdDimensionValue")] + pub directory_site_id_dimension_value: Option, + /// Advertiser ID of this placement. This field can be left blank. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Key name of this placement. This is a read-only, auto-generated field. + #[serde(rename="keyName")] + pub key_name: Option, + /// Directory site ID of this placement. On insert, you must set either this field or the siteId field to specify the site associated with this placement. This is a required field that is read-only after insertion. + #[serde(rename="directorySiteId")] + pub directory_site_id: Option, + /// Dimension value for the ID of the advertiser. This is a read-only, auto-generated field. + #[serde(rename="advertiserIdDimensionValue")] + pub advertiser_id_dimension_value: Option, + /// ID of the content category assigned to this placement. + #[serde(rename="contentCategoryId")] + pub content_category_id: Option, + /// Size associated with this placement. When inserting or updating a placement, only the size ID field is used. This field is required on insertion. + pub size: Option, + /// Whether this placement is archived. + pub archived: Option, + /// A collection of settings which affect video creatives served through this placement. Applicable to placements with IN_STREAM_VIDEO compatibility. + #[serde(rename="videoSettings")] + pub video_settings: Option, + /// Information about the last publisher update. This is a read-only field. + #[serde(rename="publisherUpdateInfo")] + pub publisher_update_info: Option, + /// Tag formats to generate for this placement. This field is required on insertion. + /// Acceptable values are: + /// - "PLACEMENT_TAG_STANDARD" + /// - "PLACEMENT_TAG_IFRAME_JAVASCRIPT" + /// - "PLACEMENT_TAG_IFRAME_ILAYER" + /// - "PLACEMENT_TAG_INTERNAL_REDIRECT" + /// - "PLACEMENT_TAG_JAVASCRIPT" + /// - "PLACEMENT_TAG_INTERSTITIAL_IFRAME_JAVASCRIPT" + /// - "PLACEMENT_TAG_INTERSTITIAL_INTERNAL_REDIRECT" + /// - "PLACEMENT_TAG_INTERSTITIAL_JAVASCRIPT" + /// - "PLACEMENT_TAG_CLICK_COMMANDS" + /// - "PLACEMENT_TAG_INSTREAM_VIDEO_PREFETCH" + /// - "PLACEMENT_TAG_TRACKING" + /// - "PLACEMENT_TAG_TRACKING_IFRAME" + /// - "PLACEMENT_TAG_TRACKING_JAVASCRIPT" + #[serde(rename="tagFormats")] + pub tag_formats: Option>, + /// Whether payment was approved for this placement. This is a read-only field relevant only to publisher-paid placements. + #[serde(rename="paymentApproved")] + pub payment_approved: Option, + /// Tag settings for this placement. + #[serde(rename="tagSetting")] + pub tag_setting: Option, + /// ID of this placement. This is a read-only, auto-generated field. + pub id: Option, + /// External ID for this placement. + #[serde(rename="externalId")] + pub external_id: Option, + /// Dimension value for the ID of this placement. This is a read-only, auto-generated field. + #[serde(rename="idDimensionValue")] + pub id_dimension_value: Option, + /// Account ID of this placement. This field can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, + /// Whether creatives assigned to this placement must be SSL-compliant. + #[serde(rename="sslRequired")] + pub ssl_required: Option, + /// Third-party placement status. + pub status: Option, + /// Dimension value for the ID of the campaign. This is a read-only, auto-generated field. + #[serde(rename="campaignIdDimensionValue")] + pub campaign_id_dimension_value: Option, + /// Whether this placement is the primary placement of a roadblock (placement group). You cannot change this field from true to false. Setting this field to true will automatically set the primary field on the original primary placement of the roadblock to false, and it will automatically set the roadblock's primaryPlacementId field to the ID of this placement. + pub primary: Option, + /// ID of this placement's group, if applicable. + #[serde(rename="placementGroupId")] + pub placement_group_id: Option, + /// Information about the creation of this placement. This is a read-only field. + #[serde(rename="createInfo")] + pub create_info: Option, + /// Site ID associated with this placement. On insert, you must set either this field or the directorySiteId field to specify the site associated with this placement. This is a required field that is read-only after insertion. + #[serde(rename="siteId")] + pub site_id: Option, + /// Dimension value for the ID of the site. This is a read-only, auto-generated field. + #[serde(rename="siteIdDimensionValue")] + pub site_id_dimension_value: Option, + /// Placement compatibility. DISPLAY and DISPLAY_INTERSTITIAL refer to rendering on desktop, on mobile devices or in mobile apps for regular or interstitial ads respectively. APP and APP_INTERSTITIAL are no longer allowed for new placement insertions. Instead, use DISPLAY or DISPLAY_INTERSTITIAL. IN_STREAM_VIDEO refers to rendering in in-stream video ads developed with the VAST standard. This field is required on insertion. + pub compatibility: Option, + /// ID of the placement strategy assigned to this placement. + #[serde(rename="placementStrategyId")] + pub placement_strategy_id: Option, + /// Dimension value for the ID of the placement group. This is a read-only, auto-generated field. + #[serde(rename="placementGroupIdDimensionValue")] + pub placement_group_id_dimension_value: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#placement". + pub kind: Option, + /// Subaccount ID of this placement. This field can be left blank. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of this placement.This is a required field and must be less than 256 characters long. + pub name: Option, + /// Lookback window settings for this placement. + #[serde(rename="lookbackConfiguration")] + pub lookback_configuration: Option, + /// Information about the most recent modification of this placement. This is a read-only field. + #[serde(rename="lastModifiedInfo")] + pub last_modified_info: Option, + /// Pricing schedule of this placement. This field is required on insertion, specifically subfields startDate, endDate and pricingType. + #[serde(rename="pricingSchedule")] + pub pricing_schedule: Option, + /// VPAID adapter setting for this placement. Controls which VPAID format the measurement adapter will use for in-stream video creatives assigned to this placement. + #[serde(rename="vpaidAdapterChoice")] + pub vpaid_adapter_choice: Option, +} + +impl RequestValue for Placement {} +impl Resource for Placement {} +impl ResponseResult for Placement {} + + +/// Inventory item List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list inventory items](struct.InventoryItemListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct InventoryItemsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#inventoryItemsListResponse". + pub kind: Option, + /// Inventory item collection + #[serde(rename="inventoryItems")] + pub inventory_items: Option>, +} + +impl ResponseResult for InventoryItemsListResponse {} + + +/// Audience Segment Group. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AudienceSegmentGroup { + /// Audience segments assigned to this group. The number of segments must be between 2 and 100. + #[serde(rename="audienceSegments")] + pub audience_segments: Option>, + /// ID of this audience segment group. This is a read-only, auto-generated field. + pub id: Option, + /// Name of this audience segment group. This is a required field and must be less than 65 characters long. + pub name: Option, +} + +impl Part for AudienceSegmentGroup {} + + +/// Contains properties of a placement strategy. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [patch placement strategies](struct.PlacementStrategyPatchCall.html) (request|response) +/// * [insert placement strategies](struct.PlacementStrategyInsertCall.html) (request|response) +/// * [get placement strategies](struct.PlacementStrategyGetCall.html) (response) +/// * [update placement strategies](struct.PlacementStrategyUpdateCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PlacementStrategy { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#placementStrategy". + pub kind: Option, + /// Account ID of this placement strategy.This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, + /// ID of this placement strategy. This is a read-only, auto-generated field. + pub id: Option, + /// Name of this placement strategy. This is a required field. It must be less than 256 characters long and unique among placement strategies of the same account. + pub name: Option, +} + +impl RequestValue for PlacementStrategy {} +impl ResponseResult for PlacementStrategy {} + + +/// Creative optimization activity. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OptimizationActivity { + /// Floodlight activity ID of this optimization activity. This is a required field. + #[serde(rename="floodlightActivityId")] + pub floodlight_activity_id: Option, + /// Dimension value for the ID of the floodlight activity. This is a read-only, auto-generated field. + #[serde(rename="floodlightActivityIdDimensionValue")] + pub floodlight_activity_id_dimension_value: Option, + /// Weight associated with this optimization. Must be greater than 1. The weight assigned will be understood in proportion to the weights assigned to the other optimization activities. + pub weight: Option, +} + +impl Part for OptimizationActivity {} + + +/// Placement Tag +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PlacementTag { + /// Tags generated for this placement. + #[serde(rename="tagDatas")] + pub tag_datas: Option>, + /// Placement ID + #[serde(rename="placementId")] + pub placement_id: Option, +} + +impl Part for PlacementTag {} + + +/// Country List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list countries](struct.CountryListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CountriesListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#countriesListResponse". + pub kind: Option, + /// Country collection. + pub countries: Option>, +} + +impl ResponseResult for CountriesListResponse {} + + +/// Click-through URL +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ClickThroughUrl { + /// Read-only convenience field representing the actual URL that will be used for this click-through. The URL is computed as follows: + /// - If defaultLandingPage is enabled then the campaign's default landing page URL is assigned to this field. + /// - If defaultLandingPage is not enabled and a landingPageId is specified then that landing page's URL is assigned to this field. + /// - If neither of the above cases apply, then the customClickThroughUrl is assigned to this field. + #[serde(rename="computedClickThroughUrl")] + pub computed_click_through_url: Option, + /// Custom click-through URL. Applicable if the defaultLandingPage field is set to false and the landingPageId field is left unset. + #[serde(rename="customClickThroughUrl")] + pub custom_click_through_url: Option, + /// ID of the landing page for the click-through URL. Applicable if the defaultLandingPage field is set to false. + #[serde(rename="landingPageId")] + pub landing_page_id: Option, + /// Whether the campaign default landing page is used. + #[serde(rename="defaultLandingPage")] + pub default_landing_page: Option, +} + +impl Part for ClickThroughUrl {} + + +/// Companion Click-through override. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CompanionClickThroughOverride { + /// Click-through URL of this companion click-through override. + #[serde(rename="clickThroughUrl")] + pub click_through_url: Option, + /// ID of the creative for this companion click-through override. + #[serde(rename="creativeId")] + pub creative_id: Option, +} + +impl Part for CompanionClickThroughOverride {} + + +/// Frequency Cap. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FrequencyCap { + /// Duration of time, in seconds, for this frequency cap. The maximum duration is 90 days in seconds, or 7,776,000. + pub duration: Option, + /// Number of times an individual user can be served the ad within the specified duration. The maximum allowed is 15. + pub impressions: Option, +} + +impl Part for FrequencyCap {} + + +/// Identifies a creative which has been associated with a given campaign. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list campaign creative associations](struct.CampaignCreativeAssociationListCall.html) (none) +/// * [insert campaign creative associations](struct.CampaignCreativeAssociationInsertCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CampaignCreativeAssociation { + /// ID of the creative associated with the campaign. This is a required field. + #[serde(rename="creativeId")] + pub creative_id: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#campaignCreativeAssociation". + pub kind: Option, +} + +impl RequestValue for CampaignCreativeAssociation {} +impl Resource for CampaignCreativeAssociation {} +impl ResponseResult for CampaignCreativeAssociation {} + + +/// Contains properties of a remarketing list's sharing information. Sharing allows other accounts or advertisers to target to your remarketing lists. This resource can be used to manage remarketing list sharing to other accounts and advertisers. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get remarketing list shares](struct.RemarketingListShareGetCall.html) (response) +/// * [patch remarketing list shares](struct.RemarketingListSharePatchCall.html) (request|response) +/// * [update remarketing list shares](struct.RemarketingListShareUpdateCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RemarketingListShare { + /// Advertisers that the remarketing list is shared with. + #[serde(rename="sharedAdvertiserIds")] + pub shared_advertiser_ids: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#remarketingListShare". + pub kind: Option, + /// Remarketing list ID. This is a read-only, auto-generated field. + #[serde(rename="remarketingListId")] + pub remarketing_list_id: Option, + /// Accounts that the remarketing list is shared with. + #[serde(rename="sharedAccountIds")] + pub shared_account_ids: Option>, +} + +impl RequestValue for RemarketingListShare {} +impl Resource for RemarketingListShare {} +impl ResponseResult for RemarketingListShare {} + + +/// Operating System Version List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list operating system versions](struct.OperatingSystemVersionListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OperatingSystemVersionsListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#operatingSystemVersionsListResponse". + pub kind: Option, + /// Operating system version collection. + #[serde(rename="operatingSystemVersions")] + pub operating_system_versions: Option>, +} + +impl ResponseResult for OperatingSystemVersionsListResponse {} + + +/// Organizes placements according to the contents of their associated webpages. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [patch content categories](struct.ContentCategoryPatchCall.html) (request|response) +/// * [insert content categories](struct.ContentCategoryInsertCall.html) (request|response) +/// * [update content categories](struct.ContentCategoryUpdateCall.html) (request|response) +/// * [get content categories](struct.ContentCategoryGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ContentCategory { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#contentCategory". + pub kind: Option, + /// Account ID of this content category. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, + /// ID of this content category. This is a read-only, auto-generated field. + pub id: Option, + /// Name of this content category. This is a required field and must be less than 256 characters long and unique among content categories of the same account. + pub name: Option, +} + +impl RequestValue for ContentCategory {} +impl ResponseResult for ContentCategory {} + + +/// Targetable remarketing list response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list targetable remarketing lists](struct.TargetableRemarketingListListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TargetableRemarketingListsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#targetableRemarketingListsListResponse". + pub kind: Option, + /// Targetable remarketing list collection. + #[serde(rename="targetableRemarketingLists")] + pub targetable_remarketing_lists: Option>, +} + +impl ResponseResult for TargetableRemarketingListsListResponse {} + + +/// Represents a buy from the DoubleClick Planning inventory store. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get inventory items](struct.InventoryItemGetCall.html) (response) +/// * [list inventory items](struct.InventoryItemListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct InventoryItem { + /// Order ID of this inventory item. + #[serde(rename="orderId")] + pub order_id: Option, + /// Advertiser ID of this inventory item. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// ID of the site this inventory item is associated with. + #[serde(rename="siteId")] + pub site_id: Option, + /// Ad slots of this inventory item. If this inventory item represents a standalone placement, there will be exactly one ad slot. If this inventory item represents a placement group, there will be more than one ad slot, each representing one child placement in that placement group. + #[serde(rename="adSlots")] + pub ad_slots: Option>, + /// RFP ID of this inventory item. + #[serde(rename="rfpId")] + pub rfp_id: Option, + /// Content category ID of this inventory item. + #[serde(rename="contentCategoryId")] + pub content_category_id: Option, + /// Placement strategy ID of this inventory item. + #[serde(rename="placementStrategyId")] + pub placement_strategy_id: Option, + /// Account ID of this inventory item. + #[serde(rename="accountId")] + pub account_id: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#inventoryItem". + pub kind: Option, + /// Negotiation channel ID of this inventory item. + #[serde(rename="negotiationChannelId")] + pub negotiation_channel_id: Option, + /// Subaccount ID of this inventory item. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of this inventory item. For standalone inventory items, this is the same name as that of its only ad slot. For group inventory items, this can differ from the name of any of its ad slots. + pub name: Option, + /// Estimated click-through rate of this inventory item. + #[serde(rename="estimatedClickThroughRate")] + pub estimated_click_through_rate: Option, + /// Information about the most recent modification of this inventory item. + #[serde(rename="lastModifiedInfo")] + pub last_modified_info: Option, + /// Estimated conversion rate of this inventory item. + #[serde(rename="estimatedConversionRate")] + pub estimated_conversion_rate: Option, + /// Whether this inventory item is in plan. + #[serde(rename="inPlan")] + pub in_plan: Option, + /// ID of this inventory item. + pub id: Option, + /// Project ID of this inventory item. + #[serde(rename="projectId")] + pub project_id: Option, + /// Type of inventory item. + #[serde(rename="type")] + pub type_: Option, + /// Pricing of this inventory item. + pub pricing: Option, +} + +impl Resource for InventoryItem {} +impl ResponseResult for InventoryItem {} + + +/// Represents fields that are compatible to be selected for a report of type "FlOODLIGHT". +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FloodlightReportCompatibleFields { + /// Metrics which are compatible to be selected in the "metricNames" section of the report. + pub metrics: Option>, + /// The kind of resource this is, in this case dfareporting#floodlightReportCompatibleFields. + pub kind: Option, + /// Dimensions which are compatible to be selected in the "dimensionFilters" section of the report. + #[serde(rename="dimensionFilters")] + pub dimension_filters: Option>, + /// Dimensions which are compatible to be selected in the "dimensions" section of the report. + pub dimensions: Option>, +} + +impl Part for FloodlightReportCompatibleFields {} + + +/// Creative Asset ID. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeAssetId { + /// Type of asset to upload. This is a required field. FLASH and IMAGE are no longer supported for new uploads. All image assets should use HTML_IMAGE. + #[serde(rename="type")] + pub type_: Option, + /// Name of the creative asset. This is a required field while inserting an asset. After insertion, this assetIdentifier is used to identify the uploaded asset. Characters in the name must be alphanumeric or one of the following: ".-_ ". Spaces are allowed. + pub name: Option, +} + +impl Part for CreativeAssetId {} + + +/// Directory Site Contact Assignment +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DirectorySiteContactAssignment { + /// ID of this directory site contact. This is a read-only, auto-generated field. + #[serde(rename="contactId")] + pub contact_id: Option, + /// Visibility of this directory site contact assignment. When set to PUBLIC this contact assignment is visible to all account and agency users; when set to PRIVATE it is visible only to the site. + pub visibility: Option, +} + +impl Part for DirectorySiteContactAssignment {} + + +/// Creative Assignment. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeAssignment { + /// Weight of the creative assignment, applicable when the rotation type is CREATIVE_ROTATION_TYPE_RANDOM. + pub weight: Option, + /// Sequence number of the creative assignment, applicable when the rotation type is CREATIVE_ROTATION_TYPE_SEQUENTIAL. + pub sequence: Option, + /// Click-through URL of the creative assignment. + #[serde(rename="clickThroughUrl")] + pub click_through_url: Option, + /// Rich media exit overrides for this creative assignment. + /// Applicable when the creative type is any of the following: + /// - RICH_MEDIA_INPAGE + /// - RICH_MEDIA_INPAGE_FLOATING + /// - RICH_MEDIA_IM_EXPAND + /// - RICH_MEDIA_EXPANDING + /// - RICH_MEDIA_INTERSTITIAL_FLOAT + /// - RICH_MEDIA_MOBILE_IN_APP + /// - RICH_MEDIA_MULTI_FLOATING + /// - RICH_MEDIA_PEEL_DOWN + /// - ADVANCED_BANNER + /// - VPAID_LINEAR + /// - VPAID_NON_LINEAR + #[serde(rename="richMediaExitOverrides")] + pub rich_media_exit_overrides: Option>, + /// Whether applicable event tags should fire when this creative assignment is rendered. If this value is unset when the ad is inserted or updated, it will default to true for all creative types EXCEPT for INTERNAL_REDIRECT, INTERSTITIAL_INTERNAL_REDIRECT, and INSTREAM_VIDEO. + #[serde(rename="applyEventTags")] + pub apply_event_tags: Option, + /// Creative group assignments for this creative assignment. Only one assignment per creative group number is allowed for a maximum of two assignments. + #[serde(rename="creativeGroupAssignments")] + pub creative_group_assignments: Option>, + /// Companion creative overrides for this creative assignment. Applicable to video ads. + #[serde(rename="companionCreativeOverrides")] + pub companion_creative_overrides: Option>, + /// Date and time that the assigned creative should start serving. + #[serde(rename="startTime")] + pub start_time: Option, + /// Whether the creative to be assigned is SSL-compliant. This is a read-only field that is auto-generated when the ad is inserted or updated. + #[serde(rename="sslCompliant")] + pub ssl_compliant: Option, + /// Whether this creative assignment is active. When true, the creative will be included in the ad's rotation. + pub active: Option, + /// ID of the creative to be assigned. This is a required field. + #[serde(rename="creativeId")] + pub creative_id: Option, + /// Date and time that the assigned creative should stop serving. Must be later than the start time. + #[serde(rename="endTime")] + pub end_time: Option, + /// Dimension value for the ID of the creative. This is a read-only, auto-generated field. + #[serde(rename="creativeIdDimensionValue")] + pub creative_id_dimension_value: Option, +} + +impl Part for CreativeAssignment {} + + +/// Represents a DimensionValuesRequest. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [query dimension values](struct.DimensionValueQueryCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DimensionValueRequest { + /// The name of the dimension for which values should be requested. + #[serde(rename="dimensionName")] + pub dimension_name: Option, + /// The start date of the date range for which to retrieve dimension values. A string of the format "yyyy-MM-dd". + #[serde(rename="startDate")] + pub start_date: Option, + /// The kind of request this is, in this case dfareporting#dimensionValueRequest. + pub kind: Option, + /// The end date of the date range for which to retrieve dimension values. A string of the format "yyyy-MM-dd". + #[serde(rename="endDate")] + pub end_date: Option, + /// The list of filters by which to filter values. The filters are ANDed. + pub filters: Option>, +} + +impl RequestValue for DimensionValueRequest {} + + +/// Ad Slot +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AdSlot { + /// Comment for this ad slot. + pub comment: Option, + /// ID of the placement from an external platform that is linked to this ad slot. + #[serde(rename="linkedPlacementId")] + pub linked_placement_id: Option, + /// Name of this ad slot. + pub name: Option, + /// Primary ad slot of a roadblock inventory item. + pub primary: Option, + /// Height of this ad slot. + pub height: Option, + /// Width of this ad slot. + pub width: Option, + /// Payment source type of this ad slot. + #[serde(rename="paymentSourceType")] + pub payment_source_type: Option, + /// Ad slot compatibility. DISPLAY and DISPLAY_INTERSTITIAL refer to rendering either on desktop, mobile devices or in mobile apps for regular or interstitial ads respectively. APP and APP_INTERSTITIAL are for rendering in mobile apps. IN_STREAM_VIDEO refers to rendering in in-stream video ads developed with the VAST standard. + pub compatibility: Option, +} + +impl Part for AdSlot {} + + +/// Properties of inheriting and overriding the default click-through event tag. A campaign may override the event tag defined at the advertiser level, and an ad may also override the campaign's setting further. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DefaultClickThroughEventTagProperties { + /// Whether this entity should override the inherited default click-through event tag with its own defined value. + #[serde(rename="overrideInheritedEventTag")] + pub override_inherited_event_tag: Option, + /// ID of the click-through event tag to apply to all ads in this entity's scope. + #[serde(rename="defaultClickThroughEventTagId")] + pub default_click_through_event_tag_id: Option, +} + +impl Part for DefaultClickThroughEventTagProperties {} + + +/// Represents the list of user profiles. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list user profiles](struct.UserProfileListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UserProfileList { + /// The user profiles returned in this response. + pub items: Option>, + /// The kind of list this is, in this case dfareporting#userProfileList. + pub kind: Option, + /// The eTag of this response for caching purposes. + pub etag: Option, +} + +impl ResponseResult for UserProfileList {} + + +/// Subaccount List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list subaccounts](struct.SubaccountListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SubaccountsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#subaccountsListResponse". + pub kind: Option, + /// Subaccount collection. + pub subaccounts: Option>, +} + +impl ResponseResult for SubaccountsListResponse {} + + +/// Contains properties of a DoubleClick Planning order document. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get order documents](struct.OrderDocumentGetCall.html) (response) +/// * [list order documents](struct.OrderDocumentListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OrderDocument { + /// ID of the order from which this order document is created. + #[serde(rename="orderId")] + pub order_id: Option, + /// Timestamp of the last email sent with this order document. + #[serde(rename="lastSentTime")] + pub last_sent_time: Option, + /// The amended order document ID of this order document. An order document can be created by optionally amending another order document so that the change history can be preserved. + #[serde(rename="amendedOrderDocumentId")] + pub amended_order_document_id: Option, + /// List of email addresses that received the last sent document. + #[serde(rename="lastSentRecipients")] + pub last_sent_recipients: Option>, + /// IDs of users who have approved this order document. + #[serde(rename="approvedByUserProfileIds")] + pub approved_by_user_profile_ids: Option>, + /// ID of this order document. + pub id: Option, + /// Account ID of this order document. + #[serde(rename="accountId")] + pub account_id: Option, + /// Advertiser ID of this order document. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#orderDocument". + pub kind: Option, + /// Subaccount ID of this order document. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Effective date of this order document. + #[serde(rename="effectiveDate")] + pub effective_date: Option, + /// Title of this order document. + pub title: Option, + /// Project ID of this order document. + #[serde(rename="projectId")] + pub project_id: Option, + /// Whether this order document has been signed. + pub signed: Option, + /// Information about the creation of this order document. + #[serde(rename="createdInfo")] + pub created_info: Option, + /// Whether this order document is cancelled. + pub cancelled: Option, + /// Type of this order document + #[serde(rename="type")] + pub type_: Option, +} + +impl Resource for OrderDocument {} +impl ResponseResult for OrderDocument {} + + +/// Represents a Report resource. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [run reports](struct.ReportRunCall.html) (none) +/// * [get reports](struct.ReportGetCall.html) (response) +/// * [list reports](struct.ReportListCall.html) (none) +/// * [delete reports](struct.ReportDeleteCall.html) (none) +/// * [files list reports](struct.ReportFileListCall.html) (none) +/// * [insert reports](struct.ReportInsertCall.html) (request|response) +/// * [patch reports](struct.ReportPatchCall.html) (request|response) +/// * [compatible fields query reports](struct.ReportCompatibleFieldQueryCall.html) (request) +/// * [update reports](struct.ReportUpdateCall.html) (request|response) +/// * [files get reports](struct.ReportFileGetCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Report { + /// The user profile id of the owner of this report. + #[serde(rename="ownerProfileId")] + pub owner_profile_id: Option, + /// The subaccount ID to which this report belongs if applicable. + #[serde(rename="subAccountId")] + pub sub_account_id: Option, + /// The report's schedule. Can only be set if the report's 'dateRange' is a relative date range and the relative date range is not "TODAY". + pub schedule: Option, + /// The report criteria for a report of type "PATH_TO_CONVERSION". + #[serde(rename="pathToConversionCriteria")] + pub path_to_conversion_criteria: Option, + /// The report criteria for a report of type "REACH". + #[serde(rename="reachCriteria")] + pub reach_criteria: Option, + /// The report criteria for a report of type "FLOODLIGHT". + #[serde(rename="floodlightCriteria")] + pub floodlight_criteria: Option, + /// The filename used when generating report files for this report. + #[serde(rename="fileName")] + pub file_name: Option, + /// The report's email delivery settings. + pub delivery: Option, + /// The timestamp (in milliseconds since epoch) of when this report was last modified. + #[serde(rename="lastModifiedTime")] + pub last_modified_time: Option, + /// The report criteria for a report of type "CROSS_DIMENSION_REACH". + #[serde(rename="crossDimensionReachCriteria")] + pub cross_dimension_reach_criteria: Option, + /// The account ID to which this report belongs. + #[serde(rename="accountId")] + pub account_id: Option, + /// The kind of resource this is, in this case dfareporting#report. + pub kind: Option, + /// The name of the report. + pub name: Option, + /// The output format of the report. If not specified, default format is "CSV". Note that the actual format in the completed report file might differ if for instance the report's size exceeds the format's capabilities. "CSV" will then be the fallback format. + pub format: Option, + /// The unique ID identifying this report resource. + pub id: Option, + /// The eTag of this response for caching purposes. + pub etag: Option, + /// The report criteria for a report of type "STANDARD". + pub criteria: Option, + /// The type of the report. + #[serde(rename="type")] + pub type_: Option, +} + +impl RequestValue for Report {} +impl Resource for Report {} +impl ResponseResult for Report {} + + +/// Contains information about a platform type that can be targeted by ads. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get platform types](struct.PlatformTypeGetCall.html) (response) +/// * [list platform types](struct.PlatformTypeListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PlatformType { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#platformType". + pub kind: Option, + /// ID of this platform type. + pub id: Option, + /// Name of this platform type. + pub name: Option, +} + +impl Resource for PlatformType {} +impl ResponseResult for PlatformType {} + + +/// Advertiser List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list advertisers](struct.AdvertiserListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AdvertisersListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Advertiser collection. + pub advertisers: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#advertisersListResponse". + pub kind: Option, +} + +impl ResponseResult for AdvertisersListResponse {} + + +/// Creative Asset. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [insert creative assets](struct.CreativeAssetInsertCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeAsset { + /// Detected MIME type for video asset. This is a read-only field. Applicable to the following creative types: INSTREAM_VIDEO and all VPAID. + #[serde(rename="mimeType")] + pub mime_type: Option, + /// Artwork type of rich media creative. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="artworkType")] + pub artwork_type: Option, + /// Offset left unit for an asset. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="positionLeftUnit")] + pub position_left_unit: Option, + /// Size of an asset when collapsed. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA and all VPAID. Additionally, applicable to assets whose displayType is ASSET_DISPLAY_TYPE_EXPANDING or ASSET_DISPLAY_TYPE_PEEL_DOWN. + #[serde(rename="collapsedSize")] + pub collapsed_size: Option, + /// Flash version of the asset. This is a read-only field. Applicable to the following creative types: FLASH_INPAGE, all RICH_MEDIA, and all VPAID. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE. + #[serde(rename="flashVersion")] + pub flash_version: Option, + /// Whether the asset pushes down other content. Applicable to the following creative types: all RICH_MEDIA. Additionally, only applicable when the asset offsets are 0, the collapsedSize.width matches size.width, and the collapsedSize.height is less than size.height. + pub pushdown: Option, + /// Whether to hide Flash objects flag for an asset. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="hideFlashObjects")] + pub hide_flash_objects: Option, + /// List of feature dependencies for the creative asset that are detected by DCM. Feature dependencies are features that a browser must be able to support in order to render your HTML5 creative correctly. This is a read-only, auto-generated field. Applicable to the following creative types: HTML5_BANNER. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE. + #[serde(rename="detectedFeatures")] + pub detected_features: Option>, + /// List of companion creatives assigned to an in-stream video creative asset. Acceptable values include IDs of existing flash and image creatives. Applicable to INSTREAM_VIDEO creative type with dynamicAssetSelection set to true. + #[serde(rename="companionCreativeIds")] + pub companion_creative_ids: Option>, + /// Duration in seconds for which an asset will be displayed. Applicable to the following creative types: INSTREAM_VIDEO and VPAID_LINEAR_VIDEO. + pub duration: Option, + /// Offset top unit for an asset. This is a read-only field if the asset displayType is ASSET_DISPLAY_TYPE_OVERLAY. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="positionTopUnit")] + pub position_top_unit: Option, + /// Numeric ID of this creative asset. This is a required field and should not be modified. Applicable to all but the following creative types: all REDIRECT and TRACKING_TEXT. + pub id: Option, + /// Possible alignments for an asset. This is a read-only field. Applicable to the following creative types: RICH_MEDIA_DISPLAY_MULTI_FLOATING_INTERSTITIAL. + pub alignment: Option, + /// Size associated with this creative asset. This is a required field when applicable; however for IMAGE and FLASH_INPAGE, creatives if left blank, this field will be automatically set using the actual size of the associated image asset. Applicable to the following creative types: DISPLAY_IMAGE_GALLERY, FLASH_INPAGE, HTML5_BANNER, IMAGE, and all RICH_MEDIA. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE. + pub size: Option, + /// Whether the asset is horizontally locked. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="horizontallyLocked")] + pub horizontally_locked: Option, + /// Initial wait time type before making the asset visible. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="startTimeType")] + pub start_time_type: Option, + /// Type of rich media asset. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="displayType")] + pub display_type: Option, + /// Detected expanded dimension for video asset. This is a read-only field. Applicable to the following creative types: INSTREAM_VIDEO and all VPAID. + #[serde(rename="expandedDimension")] + pub expanded_dimension: Option, + /// Whether the asset is vertically locked. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="verticallyLocked")] + pub vertically_locked: Option, + /// Dimension value for the ID of the asset. This is a read-only, auto-generated field. + #[serde(rename="idDimensionValue")] + pub id_dimension_value: Option, + /// Role of the asset in relation to creative. Applicable to all but the following creative types: all REDIRECT and TRACKING_TEXT. This is a required field. + /// PRIMARY applies to DISPLAY, FLASH_INPAGE, HTML5_BANNER, IMAGE, DISPLAY_IMAGE_GALLERY, all RICH_MEDIA (which may contain multiple primary assets), and all VPAID creatives. + /// BACKUP_IMAGE applies to FLASH_INPAGE, HTML5_BANNER, all RICH_MEDIA, and all VPAID creatives. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE. + /// ADDITIONAL_IMAGE and ADDITIONAL_FLASH apply to FLASH_INPAGE creatives. + /// OTHER refers to assets from sources other than DCM, such as Studio uploaded assets, applicable to all RICH_MEDIA and all VPAID creatives. + /// PARENT_VIDEO refers to videos uploaded by the user in DCM and is applicable to INSTREAM_VIDEO and VPAID_LINEAR_VIDEO creatives. + /// TRANSCODED_VIDEO refers to videos transcoded by DCM from PARENT_VIDEO assets and is applicable to INSTREAM_VIDEO and VPAID_LINEAR_VIDEO creatives. + /// ALTERNATE_VIDEO refers to the DCM representation of child asset videos from Studio, and is applicable to VPAID_LINEAR_VIDEO creatives. These cannot be added or removed within DCM. + /// For VPAID_LINEAR_VIDEO creatives, PARENT_VIDEO, TRANSCODED_VIDEO and ALTERNATE_VIDEO assets that are marked active serve as backup in case the VPAID creative cannot be served. Only PARENT_VIDEO assets can be added or removed for an INSTREAM_VIDEO or VPAID_LINEAR_VIDEO creative. + pub role: Option, + /// Size of zip file. This is a read-only field. Applicable to the following creative types: HTML5_BANNER. + #[serde(rename="zipFilesize")] + pub zip_filesize: Option, + /// Detected bit-rate for video asset. This is a read-only field. Applicable to the following creative types: INSTREAM_VIDEO and all VPAID. + #[serde(rename="bitRate")] + pub bit_rate: Option, + /// Window mode options for flash assets. Applicable to the following creative types: FLASH_INPAGE, RICH_MEDIA_DISPLAY_EXPANDING, RICH_MEDIA_IM_EXPAND, RICH_MEDIA_DISPLAY_BANNER, and RICH_MEDIA_INPAGE_FLOATING. + #[serde(rename="windowMode")] + pub window_mode: Option, + /// Progressive URL for video asset. This is a read-only field. Applicable to the following creative types: INSTREAM_VIDEO and all VPAID. + #[serde(rename="progressiveServingUrl")] + pub progressive_serving_url: Option, + /// Duration type for which an asset will be displayed. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="durationType")] + pub duration_type: Option, + /// Detected video duration for video asset. This is a read-only field. Applicable to the following creative types: INSTREAM_VIDEO and all VPAID. + #[serde(rename="videoDuration")] + pub video_duration: Option, + /// File size associated with this creative asset. This is a read-only field. Applicable to all but the following creative types: all REDIRECT and TRACKING_TEXT. + #[serde(rename="fileSize")] + pub file_size: Option, + /// Offset position for an asset in collapsed mode. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA and all VPAID. Additionally, only applicable to assets whose displayType is ASSET_DISPLAY_TYPE_EXPANDING or ASSET_DISPLAY_TYPE_PEEL_DOWN. + pub offset: Option, + /// Whether the video asset is active. This is a read-only field for VPAID_NON_LINEAR_VIDEO assets. Applicable to the following creative types: INSTREAM_VIDEO and all VPAID. + pub active: Option, + /// Whether the backup asset is original or changed by the user in DCM. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="originalBackup")] + pub original_backup: Option, + /// Whether to hide selection boxes flag for an asset. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="hideSelectionBoxes")] + pub hide_selection_boxes: Option, + /// Streaming URL for video asset. This is a read-only field. Applicable to the following creative types: INSTREAM_VIDEO and all VPAID. + #[serde(rename="streamingServingUrl")] + pub streaming_serving_url: Option, + /// zIndex value of an asset. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA.Additionally, only applicable to assets whose displayType is NOT one of the following types: ASSET_DISPLAY_TYPE_INPAGE or ASSET_DISPLAY_TYPE_OVERLAY. + #[serde(rename="zIndex")] + pub z_index: Option, + /// Rich media child asset type. This is a read-only field. Applicable to the following creative types: all VPAID. + #[serde(rename="childAssetType")] + pub child_asset_type: Option, + /// Exit event configured for the backup image. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="backupImageExit")] + pub backup_image_exit: Option, + /// Whether ActionScript3 is enabled for the flash asset. This is a read-only field. Applicable to the following creative type: FLASH_INPAGE. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE. + #[serde(rename="actionScript3")] + pub action_script3: Option, + /// Pushdown duration in seconds for an asset. Must be between 0 and 9.99. Applicable to the following creative types: all RICH_MEDIA.Additionally, only applicable when the asset pushdown field is true, the offsets are 0, the collapsedSize.width matches size.width, and the collapsedSize.height is less than size.height. + #[serde(rename="pushdownDuration")] + pub pushdown_duration: Option, + /// Identifier of this asset. This is the same identifier returned during creative asset insert operation. This is a required field. Applicable to all but the following creative types: all REDIRECT and TRACKING_TEXT. + #[serde(rename="assetIdentifier")] + pub asset_identifier: Option, + /// Whether the asset is transparent. Applicable to the following creative types: all RICH_MEDIA. Additionally, only applicable to HTML5 assets. + pub transparency: Option, + /// Whether the asset is SSL-compliant. This is a read-only field. Applicable to all but the following creative types: all REDIRECT and TRACKING_TEXT. + #[serde(rename="sslCompliant")] + pub ssl_compliant: Option, + /// Offset position for an asset. Applicable to the following creative types: all RICH_MEDIA. + pub position: Option, + /// Custom start time in seconds for making the asset visible. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="customStartTimeValue")] + pub custom_start_time_value: Option, + /// File name of zip file. This is a read-only field. Applicable to the following creative types: HTML5_BANNER. + #[serde(rename="zipFilename")] + pub zip_filename: Option, +} + +impl Resource for CreativeAsset {} + + +/// Video Settings +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct VideoSettings { + /// Settings for the skippability of video creatives served to this placement. If this object is provided, the creative-level skippable settings will be overridden. + #[serde(rename="skippableSettings")] + pub skippable_settings: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#videoSettings". + pub kind: Option, + /// Settings for the companion creatives of video creatives served to this placement. + #[serde(rename="companionSettings")] + pub companion_settings: Option, + /// Settings for the transcodes of video creatives served to this placement. If this object is provided, the creative-level transcode settings will be overridden. + #[serde(rename="transcodeSettings")] + pub transcode_settings: Option, +} + +impl Part for VideoSettings {} + + +/// Directory Site List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list directory sites](struct.DirectorySiteListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DirectorySitesListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#directorySitesListResponse". + pub kind: Option, + /// Directory site collection. + #[serde(rename="directorySites")] + pub directory_sites: Option>, +} + +impl ResponseResult for DirectorySitesListResponse {} + + +/// Modification timestamp. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LastModifiedInfo { + /// Timestamp of the last change in milliseconds since epoch. + pub time: Option, +} + +impl Part for LastModifiedInfo {} + + +/// Region List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list regions](struct.RegionListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RegionsListResponse { + /// Region collection. + pub regions: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#regionsListResponse". + pub kind: Option, +} + +impl ResponseResult for RegionsListResponse {} + + +/// Represents a grouping of related user role permissions. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list user role permission groups](struct.UserRolePermissionGroupListCall.html) (none) +/// * [get user role permission groups](struct.UserRolePermissionGroupGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UserRolePermissionGroup { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#userRolePermissionGroup". + pub kind: Option, + /// ID of this user role permission. + pub id: Option, + /// Name of this user role permission group. + pub name: Option, +} + +impl Resource for UserRolePermissionGroup {} +impl ResponseResult for UserRolePermissionGroup {} + + +/// Creative Click Tag. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ClickTag { + /// Advertiser event name associated with the click tag. This field is used by DISPLAY_IMAGE_GALLERY and HTML5_BANNER creatives. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE. + #[serde(rename="eventName")] + pub event_name: Option, + /// Parameter name for the specified click tag. For DISPLAY_IMAGE_GALLERY creative assets, this field must match the value of the creative asset's creativeAssetId.name field. + pub name: Option, + /// Parameter value for the specified click tag. This field contains a click-through url. + pub value: Option, +} + +impl Part for ClickTag {} + + +/// Contains information about an internet connection type that can be targeted by ads. Clients can use the connection type to target mobile vs. broadband users. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get connection types](struct.ConnectionTypeGetCall.html) (response) +/// * [list connection types](struct.ConnectionTypeListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ConnectionType { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#connectionType". + pub kind: Option, + /// ID of this connection type. + pub id: Option, + /// Name of this connection type. + pub name: Option, +} + +impl Resource for ConnectionType {} +impl ResponseResult for ConnectionType {} + + +/// Browser List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list browsers](struct.BrowserListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BrowsersListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#browsersListResponse". + pub kind: Option, + /// Browser collection. + pub browsers: Option>, +} + +impl ResponseResult for BrowsersListResponse {} + + +/// Object Filter. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ObjectFilter { + /// Applicable when status is ASSIGNED. The user has access to objects with these object IDs. + #[serde(rename="objectIds")] + pub object_ids: Option>, + /// Status of the filter. NONE means the user has access to none of the objects. ALL means the user has access to all objects. ASSIGNED means the user has access to the objects with IDs in the objectIds list. + pub status: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#objectFilter". + pub kind: Option, +} + +impl Part for ObjectFilter {} + + +/// Creative Settings +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeSettings { + /// Header text for iFrames for this site. Must be less than or equal to 2000 characters long. + #[serde(rename="iFrameHeader")] + pub i_frame_header: Option, + /// Header text for iFrames for this site. Must be less than or equal to 2000 characters long. + #[serde(rename="iFrameFooter")] + pub i_frame_footer: Option, +} + +impl Part for CreativeSettings {} + + +/// Represents a dimension. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Dimension { + /// The kind of resource this is, in this case dfareporting#dimension. + pub kind: Option, + /// The dimension name, e.g. dfa:advertiser + pub name: Option, +} + +impl Part for Dimension {} + + +/// Contains information about supported video formats. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list video formats](struct.VideoFormatListCall.html) (none) +/// * [get video formats](struct.VideoFormatGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct VideoFormat { + /// File type of the video format. + #[serde(rename="fileType")] + pub file_type: Option, + /// The resolution of this video format. + pub resolution: Option, + /// ID of the video format. + pub id: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#videoFormat". + pub kind: Option, + /// The target bit rate of this video format. + #[serde(rename="targetBitRate")] + pub target_bit_rate: Option, +} + +impl Resource for VideoFormat {} +impl ResponseResult for VideoFormat {} + + +/// Contact of an order. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OrderContact { + /// Type of this contact. + #[serde(rename="contactType")] + pub contact_type: Option, + /// Title of this contact. + #[serde(rename="contactTitle")] + pub contact_title: Option, + /// Free-form information about this contact. It could be any information related to this contact in addition to type, title, name, and signature user profile ID. + #[serde(rename="contactInfo")] + pub contact_info: Option, + /// Name of this contact. + #[serde(rename="contactName")] + pub contact_name: Option, + /// ID of the user profile containing the signature that will be embedded into order documents. + #[serde(rename="signatureUserProfileId")] + pub signature_user_profile_id: Option, +} + +impl Part for OrderContact {} + + +/// DirectorySites contains properties of a website from the Site Directory. Sites need to be added to an account via the Sites resource before they can be assigned to a placement. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get directory sites](struct.DirectorySiteGetCall.html) (response) +/// * [list directory sites](struct.DirectorySiteListCall.html) (none) +/// * [insert directory sites](struct.DirectorySiteInsertCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DirectorySite { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#directorySite". + pub kind: Option, + /// Country ID of this directory site. + #[serde(rename="countryId")] + pub country_id: Option, + /// Description of this directory site. + pub description: Option, + /// Directory site settings. + pub settings: Option, + /// Currency ID of this directory site. + /// Possible values are: + /// - "1" for USD + /// - "2" for GBP + /// - "3" for ESP + /// - "4" for SEK + /// - "5" for CAD + /// - "6" for JPY + /// - "7" for DEM + /// - "8" for AUD + /// - "9" for FRF + /// - "10" for ITL + /// - "11" for DKK + /// - "12" for NOK + /// - "13" for FIM + /// - "14" for ZAR + /// - "15" for IEP + /// - "16" for NLG + /// - "17" for EUR + /// - "18" for KRW + /// - "19" for TWD + /// - "20" for SGD + /// - "21" for CNY + /// - "22" for HKD + /// - "23" for NZD + /// - "24" for MYR + /// - "25" for BRL + /// - "26" for PTE + /// - "27" for MXP + /// - "28" for CLP + /// - "29" for TRY + /// - "30" for ARS + /// - "31" for PEN + /// - "32" for ILS + /// - "33" for CHF + /// - "34" for VEF + /// - "35" for COP + /// - "36" for GTQ + /// - "37" for PLN + /// - "39" for INR + /// - "40" for THB + /// - "41" for IDR + /// - "42" for CZK + /// - "43" for RON + /// - "44" for HUF + /// - "45" for RUB + /// - "46" for AED + /// - "47" for BGN + /// - "48" for HRK + #[serde(rename="currencyId")] + pub currency_id: Option, + /// Tag types for regular placements. + /// + /// Acceptable values are: + /// - "STANDARD" + /// - "IFRAME_JAVASCRIPT_INPAGE" + /// - "INTERNAL_REDIRECT_INPAGE" + /// - "JAVASCRIPT_INPAGE" + #[serde(rename="inpageTagFormats")] + pub inpage_tag_formats: Option>, + /// URL of this directory site. + pub url: Option, + /// Directory site contacts. + #[serde(rename="contactAssignments")] + pub contact_assignments: Option>, + /// Parent directory site ID. + #[serde(rename="parentId")] + pub parent_id: Option, + /// Tag types for interstitial placements. + /// + /// Acceptable values are: + /// - "IFRAME_JAVASCRIPT_INTERSTITIAL" + /// - "INTERNAL_REDIRECT_INTERSTITIAL" + /// - "JAVASCRIPT_INTERSTITIAL" + #[serde(rename="interstitialTagFormats")] + pub interstitial_tag_formats: Option>, + /// Dimension value for the ID of this directory site. This is a read-only, auto-generated field. + #[serde(rename="idDimensionValue")] + pub id_dimension_value: Option, + /// Whether this directory site is active. + pub active: Option, + /// ID of this directory site. This is a read-only, auto-generated field. + pub id: Option, + /// Name of this directory site. + pub name: Option, +} + +impl RequestValue for DirectorySite {} +impl Resource for DirectorySite {} +impl ResponseResult for DirectorySite {} + + +/// City List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list cities](struct.CityListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CitiesListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#citiesListResponse". + pub kind: Option, + /// City collection. + pub cities: Option>, +} + +impl ResponseResult for CitiesListResponse {} + + +/// Publisher Dynamic Tag +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FloodlightActivityPublisherDynamicTag { + /// Whether this tag is applicable only for view-throughs. + #[serde(rename="viewThrough")] + pub view_through: Option, + /// Site ID of this dynamic tag. + #[serde(rename="siteId")] + pub site_id: Option, + /// Whether this tag is applicable only for click-throughs. + #[serde(rename="clickThrough")] + pub click_through: Option, + /// Directory site ID of this dynamic tag. This is a write-only field that can be used as an alternative to the siteId field. When this resource is retrieved, only the siteId field will be populated. + #[serde(rename="directorySiteId")] + pub directory_site_id: Option, + /// Dimension value for the ID of the site. This is a read-only, auto-generated field. + #[serde(rename="siteIdDimensionValue")] + pub site_id_dimension_value: Option, + /// Dynamic floodlight tag. + #[serde(rename="dynamicTag")] + pub dynamic_tag: Option, +} + +impl Part for FloodlightActivityPublisherDynamicTag {} + + +/// Represents a metric. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Metric { + /// The kind of resource this is, in this case dfareporting#metric. + pub kind: Option, + /// The metric name, e.g. dfa:impressions + pub name: Option, +} + +impl Part for Metric {} + + +/// Rich Media Exit Override. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RichMediaExitOverride { + /// Click-through URL of this rich media exit override. Applicable if the enabled field is set to true. + #[serde(rename="clickThroughUrl")] + pub click_through_url: Option, + /// Whether to use the clickThroughUrl. If false, the creative-level exit will be used. + pub enabled: Option, + /// ID for the override to refer to a specific exit in the creative. + #[serde(rename="exitId")] + pub exit_id: Option, +} + +impl Part for RichMediaExitOverride {} + + +/// Account Permission List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list account permissions](struct.AccountPermissionListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AccountPermissionsListResponse { + /// Account permission collection. + #[serde(rename="accountPermissions")] + pub account_permissions: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#accountPermissionsListResponse". + pub kind: Option, +} + +impl ResponseResult for AccountPermissionsListResponse {} + + +/// Placement GenerateTags Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [generatetags placements](struct.PlacementGeneratetagCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PlacementsGenerateTagsResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#placementsGenerateTagsResponse". + pub kind: Option, + /// Set of generated tags for the specified placements. + #[serde(rename="placementTags")] + pub placement_tags: Option>, +} + +impl ResponseResult for PlacementsGenerateTagsResponse {} + + +/// Contains properties of a creative field value. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [insert creative field values](struct.CreativeFieldValueInsertCall.html) (request|response) +/// * [get creative field values](struct.CreativeFieldValueGetCall.html) (response) +/// * [update creative field values](struct.CreativeFieldValueUpdateCall.html) (request|response) +/// * [patch creative field values](struct.CreativeFieldValuePatchCall.html) (request|response) +/// * [list creative field values](struct.CreativeFieldValueListCall.html) (none) +/// * [delete creative field values](struct.CreativeFieldValueDeleteCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeFieldValue { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#creativeFieldValue". + pub kind: Option, + /// ID of this creative field value. This is a read-only, auto-generated field. + pub id: Option, + /// Value of this creative field value. It needs to be less than 256 characters in length and unique per creative field. + pub value: Option, +} + +impl RequestValue for CreativeFieldValue {} +impl Resource for CreativeFieldValue {} +impl ResponseResult for CreativeFieldValue {} + + +/// Floodlight Activity Group List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list floodlight activity groups](struct.FloodlightActivityGroupListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FloodlightActivityGroupsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#floodlightActivityGroupsListResponse". + pub kind: Option, + /// Floodlight activity group collection. + #[serde(rename="floodlightActivityGroups")] + pub floodlight_activity_groups: Option>, +} + +impl ResponseResult for FloodlightActivityGroupsListResponse {} + + +/// Directory Site Contact List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list directory site contacts](struct.DirectorySiteContactListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DirectorySiteContactsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Directory site contact collection + #[serde(rename="directorySiteContacts")] + pub directory_site_contacts: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#directorySiteContactsListResponse". + pub kind: Option, +} + +impl ResponseResult for DirectorySiteContactsListResponse {} + + +/// Creative Custom Event. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeCustomEvent { + /// Target type used by the event. + #[serde(rename="targetType")] + pub target_type: Option, + /// Artwork type used by the creative.This is a read-only field. + #[serde(rename="artworkType")] + pub artwork_type: Option, + /// Video reporting ID, used to differentiate multiple videos in a single creative. This is a read-only field. + #[serde(rename="videoReportingId")] + pub video_reporting_id: Option, + /// Properties for rich media popup windows. This field is used only for exit events. + #[serde(rename="popupWindowProperties")] + pub popup_window_properties: Option, + /// Unique ID of this event used by DDM Reporting and Data Transfer. This is a read-only field. + #[serde(rename="advertiserCustomEventId")] + pub advertiser_custom_event_id: Option, + /// Artwork label column, used to link events in DCM back to events in Studio. This is a required field and should not be modified after insertion. + #[serde(rename="artworkLabel")] + pub artwork_label: Option, + /// Type of the event. This is a read-only field. + #[serde(rename="advertiserCustomEventType")] + pub advertiser_custom_event_type: Option, + /// Exit URL of the event. This field is used only for exit events. + #[serde(rename="exitUrl")] + pub exit_url: Option, + /// ID of this event. This is a required field and should not be modified after insertion. + pub id: Option, + /// User-entered name for the event. + #[serde(rename="advertiserCustomEventName")] + pub advertiser_custom_event_name: Option, +} + +impl Part for CreativeCustomEvent {} + + +/// Creative List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list creatives](struct.CreativeListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativesListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#creativesListResponse". + pub kind: Option, + /// Creative collection. + pub creatives: Option>, +} + +impl ResponseResult for CreativesListResponse {} + + +/// Omniture Integration Settings. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OmnitureSettings { + /// Whether placement cost data will be sent to Omniture. This property can be enabled only if omnitureIntegrationEnabled is true. + #[serde(rename="omnitureCostDataEnabled")] + pub omniture_cost_data_enabled: Option, + /// Whether Omniture integration is enabled. This property can be enabled only when the "Advanced Ad Serving" account setting is enabled. + #[serde(rename="omnitureIntegrationEnabled")] + pub omniture_integration_enabled: Option, +} + +impl Part for OmnitureSettings {} + + +/// Represents fields that are compatible to be selected for a report of type "PATH_TO_CONVERSION". +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PathToConversionReportCompatibleFields { + /// Metrics which are compatible to be selected in the "metricNames" section of the report. + pub metrics: Option>, + /// Per-interaction dimensions which are compatible to be selected in the "perInteractionDimensions" section of the report. + #[serde(rename="perInteractionDimensions")] + pub per_interaction_dimensions: Option>, + /// The kind of resource this is, in this case dfareporting#pathToConversionReportCompatibleFields. + pub kind: Option, + /// Conversion dimensions which are compatible to be selected in the "conversionDimensions" section of the report. + #[serde(rename="conversionDimensions")] + pub conversion_dimensions: Option>, + /// Custom floodlight variables which are compatible to be selected in the "customFloodlightVariables" section of the report. + #[serde(rename="customFloodlightVariables")] + pub custom_floodlight_variables: Option>, +} + +impl Part for PathToConversionReportCompatibleFields {} + + +/// Mobile Carrier List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list mobile carriers](struct.MobileCarrierListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct MobileCarriersListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#mobileCarriersListResponse". + pub kind: Option, + /// Mobile carrier collection. + #[serde(rename="mobileCarriers")] + pub mobile_carriers: Option>, +} + +impl ResponseResult for MobileCarriersListResponse {} + + +/// Dynamic Targeting Key List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list dynamic targeting keys](struct.DynamicTargetingKeyListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DynamicTargetingKeysListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#dynamicTargetingKeysListResponse". + pub kind: Option, + /// Dynamic targeting key collection. + #[serde(rename="dynamicTargetingKeys")] + pub dynamic_targeting_keys: Option>, +} + +impl ResponseResult for DynamicTargetingKeysListResponse {} + + +/// Dynamic Tag +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FloodlightActivityDynamicTag { + /// Tag code. + pub tag: Option, + /// ID of this dynamic tag. This is a read-only, auto-generated field. + pub id: Option, + /// Name of this tag. + pub name: Option, +} + +impl Part for FloodlightActivityDynamicTag {} + + +/// Contains properties of a Creative. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [insert creatives](struct.CreativeInsertCall.html) (request|response) +/// * [get creatives](struct.CreativeGetCall.html) (response) +/// * [list creatives](struct.CreativeListCall.html) (none) +/// * [update creatives](struct.CreativeUpdateCall.html) (request|response) +/// * [patch creatives](struct.CreativePatchCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Creative { + /// Type of artwork used for the creative. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA, and all VPAID. + #[serde(rename="artworkType")] + pub artwork_type: Option, + /// Latest Studio trafficked creative ID associated with rich media and VPAID creatives. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA, and all VPAID. + #[serde(rename="latestTraffickedCreativeId")] + pub latest_trafficked_creative_id: Option, + /// List of counter events configured for the creative. For DISPLAY_IMAGE_GALLERY creatives, these are read-only and auto-generated from clickTags. Applicable to the following creative types: DISPLAY_IMAGE_GALLERY, all RICH_MEDIA, and all VPAID. + #[serde(rename="counterCustomEvents")] + pub counter_custom_events: Option>, + /// Advertiser ID of this creative. This is a required field. Applicable to all creative types. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Whether the creative is active. Applicable to all creative types. + pub active: Option, + /// List of timer events configured for the creative. For DISPLAY_IMAGE_GALLERY creatives, these are read-only and auto-generated from clickTags. Applicable to the following creative types: DISPLAY_IMAGE_GALLERY, all RICH_MEDIA, and all VPAID. Applicable to DISPLAY when the primary asset is not HTML_IMAGE. + #[serde(rename="timerCustomEvents")] + pub timer_custom_events: Option>, + /// Dimension value for the rendering ID of this creative. This is a read-only field. Applicable to all creative types. + #[serde(rename="renderingIdDimensionValue")] + pub rendering_id_dimension_value: Option, + /// OpenWindow FSCommand of this creative. This lets the SWF file communicate with either Flash Player or the program hosting Flash Player, such as a web browser. This is only triggered if allowScriptAccess field is true. Applicable to the following creative types: FLASH_INPAGE. + #[serde(rename="fsCommand")] + pub fs_command: Option, + /// Set this to true to enable the use of rules to target individual assets in this creative. When set to true creativeAssetSelection must be set. This also controls asset-level companions. When this is true, companion creatives should be assigned to creative assets. Learn more. Applicable to INSTREAM_VIDEO creatives. + #[serde(rename="dynamicAssetSelection")] + pub dynamic_asset_selection: Option, + /// ID of this creative. This is a read-only, auto-generated field. Applicable to all creative types. + pub id: Option, + /// Amount of time to play the video before counting a view. Applicable to the following creative types: all INSTREAM_VIDEO. + #[serde(rename="progressOffset")] + pub progress_offset: Option, + /// Account ID of this creative. This field, if left unset, will be auto-generated for both insert and update operations. Applicable to all creative types. + #[serde(rename="accountId")] + pub account_id: Option, + /// Studio trafficked creative ID associated with rich media and VPAID creatives. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA, and all VPAID. + #[serde(rename="studioTraffickedCreativeId")] + pub studio_trafficked_creative_id: Option, + /// Whether the creative is archived. Applicable to all creative types. + pub archived: Option, + /// Override CSS value for rich media creatives. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="overrideCss")] + pub override_css: Option, + /// Source application where creative was authored. Presently, only DBM authored creatives will have this field set. Applicable to all creative types. + #[serde(rename="authoringSource")] + pub authoring_source: Option, + /// The internal Flash version for this creative as calculated by DoubleClick Studio. This is a read-only field. Applicable to the following creative types: FLASH_INPAGE all RICH_MEDIA, and all VPAID. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE. + #[serde(rename="requiredFlashVersion")] + pub required_flash_version: Option, + /// List of exit events configured for the creative. For DISPLAY and DISPLAY_IMAGE_GALLERY creatives, these are read-only and auto-generated from clickTags, For DISPLAY, an event is also created from the backupImageReportingLabel. Applicable to the following creative types: DISPLAY_IMAGE_GALLERY, all RICH_MEDIA, and all VPAID. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE. + #[serde(rename="exitCustomEvents")] + pub exit_custom_events: Option>, + /// ID of current rendering version. This is a read-only field. Applicable to all creative types. + #[serde(rename="renderingId")] + pub rendering_id: Option, + /// Description of the video ad. Applicable to the following creative types: all INSTREAM_VIDEO and all VPAID. + #[serde(rename="videoDescription")] + pub video_description: Option, + /// Amount of time to play the video before the skip button appears. Applicable to the following creative types: all INSTREAM_VIDEO. + #[serde(rename="skipOffset")] + pub skip_offset: Option, + /// Third-party URL used to record backup image impressions. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="thirdPartyBackupImageImpressionsUrl")] + pub third_party_backup_image_impressions_url: Option, + /// The version number helps you keep track of multiple versions of your creative in your reports. The version number will always be auto-generated during insert operations to start at 1. For tracking creatives the version cannot be incremented and will always remain at 1. For all other creative types the version can be incremented only by 1 during update operations. In addition, the version will be automatically incremented by 1 when undergoing Rich Media creative merging. Applicable to all creative types. + pub version: Option, + /// Creative field assignments for this creative. Applicable to all creative types. + #[serde(rename="creativeFieldAssignments")] + pub creative_field_assignments: Option>, + /// The 6-character HTML color code, beginning with #, for the background of the window area where the Flash file is displayed. Default is white. Applicable to the following creative types: FLASH_INPAGE. + #[serde(rename="backgroundColor")] + pub background_color: Option, + /// Custom key-values for a Rich Media creative. Key-values let you customize the creative settings of a Rich Media ad running on your site without having to contact the advertiser. You can use key-values to dynamically change the look or functionality of a creative. Applicable to the following creative types: all RICH_MEDIA, and all VPAID. + #[serde(rename="customKeyValues")] + pub custom_key_values: Option>, + /// Dimension value for the ID of this creative. This is a read-only field. Applicable to all creative types. + #[serde(rename="idDimensionValue")] + pub id_dimension_value: Option, + /// Whether images are automatically advanced for image gallery creatives. Applicable to the following creative types: DISPLAY_IMAGE_GALLERY. + pub auto_advance_images: Option, + /// Size associated with this creative. When inserting or updating a creative either the size ID field or size width and height fields can be used. This is a required field when applicable; however for IMAGE, FLASH_INPAGE creatives, and for DISPLAY creatives with a primary asset of type HTML_IMAGE, if left blank, this field will be automatically set using the actual size of the associated image assets. Applicable to the following creative types: DISPLAY, DISPLAY_IMAGE_GALLERY, FLASH_INPAGE, HTML5_BANNER, IMAGE, and all RICH_MEDIA. + pub size: Option, + /// Type of this creative. This is a required field. Applicable to all creative types. + /// + /// Note: FLASH_INPAGE, HTML5_BANNER, and IMAGE are only used for existing creatives. New creatives should use DISPLAY as a replacement for these types. + #[serde(rename="type")] + pub type_: Option, + /// Combined size of all creative assets. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA, and all VPAID. + #[serde(rename="totalFileSize")] + pub total_file_size: Option, + /// Third-party URL used to record rich media impressions. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="thirdPartyRichMediaImpressionsUrl")] + pub third_party_rich_media_impressions_url: Option, + /// Studio advertiser ID associated with rich media and VPAID creatives. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA, and all VPAID. + #[serde(rename="studioAdvertiserId")] + pub studio_advertiser_id: Option, + /// Assets associated with a creative. Applicable to all but the following creative types: INTERNAL_REDIRECT, INTERSTITIAL_INTERNAL_REDIRECT, and REDIRECT + #[serde(rename="creativeAssets")] + pub creative_assets: Option>, + /// List of feature dependencies that will cause a backup image to be served if the browser that serves the ad does not support them. Feature dependencies are features that a browser must be able to support in order to render your HTML5 creative asset correctly. This field is initially auto-generated to contain all features detected by DCM for all the assets of this creative and can then be modified by the client. To reset this field, copy over all the creativeAssets' detected features. Applicable to the following creative types: HTML5_BANNER. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE. + #[serde(rename="backupImageFeatures")] + pub backup_image_features: Option>, + /// Creative video duration in seconds. This is a read-only field. Applicable to the following creative types: INSTREAM_VIDEO, all RICH_MEDIA, and all VPAID. + #[serde(rename="videoDuration")] + pub video_duration: Option, + /// URL of hosted image or hosted video or another ad tag. For INSTREAM_VIDEO_REDIRECT creatives this is the in-stream video redirect URL. The standard for a VAST (Video Ad Serving Template) ad response allows for a redirect link to another VAST 2.0 or 3.0 call. This is a required field when applicable. Applicable to the following creative types: DISPLAY_REDIRECT, INTERNAL_REDIRECT, INTERSTITIAL_INTERNAL_REDIRECT, and INSTREAM_VIDEO_REDIRECT + #[serde(rename="redirectUrl")] + pub redirect_url: Option, + /// Click tags of the creative. For DISPLAY, FLASH_INPAGE, and HTML5_BANNER creatives, this is a subset of detected click tags for the assets associated with this creative. After creating a flash asset, detected click tags will be returned in the creativeAssetMetadata. When inserting the creative, populate the creative clickTags field using the creativeAssetMetadata.clickTags field. For DISPLAY_IMAGE_GALLERY creatives, there should be exactly one entry in this list for each image creative asset. A click tag is matched with a corresponding creative asset by matching the clickTag.name field with the creativeAsset.assetIdentifier.name field. Applicable to the following creative types: DISPLAY_IMAGE_GALLERY, FLASH_INPAGE, HTML5_BANNER. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE. + #[serde(rename="clickTags")] + pub click_tags: Option>, + /// Target window for backup image. Applicable to the following creative types: FLASH_INPAGE and HTML5_BANNER. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE. + #[serde(rename="backupImageTargetWindow")] + pub backup_image_target_window: Option, + /// The minimum required Flash plugin version for this creative. For example, 11.2.202.235. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA, and all VPAID. + #[serde(rename="requiredFlashPluginVersion")] + pub required_flash_plugin_version: Option, + /// Reporting label used for HTML5 banner backup image. Applicable to the following creative types: DISPLAY when the primary asset type is not HTML_IMAGE. + #[serde(rename="backupImageReportingLabel")] + pub backup_image_reporting_label: Option, + /// Compatibilities associated with this creative. This is a read-only field. DISPLAY and DISPLAY_INTERSTITIAL refer to rendering either on desktop or on mobile devices or in mobile apps for regular or interstitial ads, respectively. APP and APP_INTERSTITIAL are for rendering in mobile apps. Only pre-existing creatives may have these compatibilities since new creatives will either be assigned DISPLAY or DISPLAY_INTERSTITIAL instead. IN_STREAM_VIDEO refers to rendering in in-stream video ads developed with the VAST standard. Applicable to all creative types. + /// + /// Acceptable values are: + /// - "APP" + /// - "APP_INTERSTITIAL" + /// - "IN_STREAM_VIDEO" + /// - "DISPLAY" + /// - "DISPLAY_INTERSTITIAL" + pub compatibility: Option>, + /// Ad parameters user for VPAID creative. This is a read-only field. Applicable to the following creative types: all VPAID. + #[serde(rename="adParameters")] + pub ad_parameters: Option, + /// Whether HTML code is DCM-generated or manually entered. Set to true to ignore changes to htmlCode. Applicable to the following creative types: FLASH_INPAGE and HTML5_BANNER. + #[serde(rename="htmlCodeLocked")] + pub html_code_locked: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#creative". + pub kind: Option, + /// Subaccount ID of this creative. This field, if left unset, will be auto-generated for both insert and update operations. Applicable to all creative types. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of the creative. This is a required field and must be less than 256 characters long. Applicable to all creative types. + pub name: Option, + /// Keywords for a Rich Media creative. Keywords let you customize the creative settings of a Rich Media ad running on your site without having to contact the advertiser. You can use keywords to dynamically change the look or functionality of a creative. Applicable to the following creative types: all RICH_MEDIA, and all VPAID. + #[serde(rename="adTagKeys")] + pub ad_tag_keys: Option>, + /// Whether Flash assets associated with the creative need to be automatically converted to HTML5. This flag is enabled by default and users can choose to disable it if they don't want the system to generate and use HTML5 asset for this creative. Applicable to the following creative type: FLASH_INPAGE. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE. + #[serde(rename="convertFlashToHtml5")] + pub convert_flash_to_html5: Option, + /// Whether creative should be treated as SSL compliant even if the system scan shows it's not. Applicable to all creative types. + #[serde(rename="sslOverride")] + pub ssl_override: Option, + /// Creative last modification information. This is a read-only field. Applicable to all creative types. + #[serde(rename="lastModifiedInfo")] + pub last_modified_info: Option, + /// Click-through URL for backup image. Applicable to the following creative types: FLASH_INPAGE and HTML5_BANNER. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE. + #[serde(rename="backupImageClickThroughUrl")] + pub backup_image_click_through_url: Option, + /// Studio creative ID associated with rich media and VPAID creatives. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA, and all VPAID. + #[serde(rename="studioCreativeId")] + pub studio_creative_id: Option, + /// Authoring tool for HTML5 banner creatives. This is a read-only field. Applicable to the following creative types: HTML5_BANNER. + #[serde(rename="authoringTool")] + pub authoring_tool: Option, + /// Third-party URLs for tracking in-stream video creative events. Applicable to the following creative types: all INSTREAM_VIDEO and all VPAID. + #[serde(rename="thirdPartyUrls")] + pub third_party_urls: Option>, + /// List of companion creatives assigned to an in-Stream videocreative. Acceptable values include IDs of existing flash and image creatives. Applicable to the following creative types: all VPAID and all INSTREAM_VIDEO with dynamicAssetSelection set to false. + #[serde(rename="companionCreatives")] + pub companion_creatives: Option>, + /// Required if dynamicAssetSelection is true. + #[serde(rename="creativeAssetSelection")] + pub creative_asset_selection: Option, + /// HTML code for the creative. This is a required field when applicable. This field is ignored if htmlCodeLocked is false. Applicable to the following creative types: all CUSTOM, FLASH_INPAGE, and HTML5_BANNER, and all RICH_MEDIA. + #[serde(rename="htmlCode")] + pub html_code: Option, + /// Whether the creative is SSL-compliant. This is a read-only field. Applicable to all creative types. + #[serde(rename="sslCompliant")] + pub ssl_compliant: Option, + /// Industry standard ID assigned to creative for reach and frequency. Applicable to the following creative types: all INSTREAM_VIDEO and all VPAID. + #[serde(rename="commercialId")] + pub commercial_id: Option, + /// Whether the user can choose to skip the creative. Applicable to the following creative types: all INSTREAM_VIDEO and all VPAID. + pub skippable: Option, + /// Whether script access is allowed for this creative. This is a read-only and deprecated field which will automatically be set to true on update. Applicable to the following creative types: FLASH_INPAGE. + #[serde(rename="allowScriptAccess")] + pub allow_script_access: Option, +} + +impl RequestValue for Creative {} +impl Resource for Creative {} +impl ResponseResult for Creative {} + + +/// Reporting Configuration +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReportsConfiguration { + /// Whether the exposure to conversion report is enabled. This report shows detailed pathway information on up to 10 of the most recent ad exposures seen by a user before converting. + #[serde(rename="exposureToConversionEnabled")] + pub exposure_to_conversion_enabled: Option, + /// Report generation time zone ID of this account. This is a required field that can only be changed by a superuser. + /// Acceptable values are: + /// + /// - "1" for "America/New_York" + /// - "2" for "Europe/London" + /// - "3" for "Europe/Paris" + /// - "4" for "Africa/Johannesburg" + /// - "5" for "Asia/Jerusalem" + /// - "6" for "Asia/Shanghai" + /// - "7" for "Asia/Hong_Kong" + /// - "8" for "Asia/Tokyo" + /// - "9" for "Australia/Sydney" + /// - "10" for "Asia/Dubai" + /// - "11" for "America/Los_Angeles" + /// - "12" for "Pacific/Auckland" + /// - "13" for "America/Sao_Paulo" + #[serde(rename="reportGenerationTimeZoneId")] + pub report_generation_time_zone_id: Option, + /// Default lookback windows for new advertisers in this account. + #[serde(rename="lookbackConfiguration")] + pub lookback_configuration: Option, +} + +impl Part for ReportsConfiguration {} + + +/// Campaign List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list campaigns](struct.CampaignListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CampaignsListResponse { + /// Campaign collection. + pub campaigns: Option>, + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#campaignsListResponse". + pub kind: Option, +} + +impl ResponseResult for CampaignsListResponse {} + + +/// User Role Permission List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list user role permissions](struct.UserRolePermissionListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UserRolePermissionsListResponse { + /// User role permission collection. + #[serde(rename="userRolePermissions")] + pub user_role_permissions: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#userRolePermissionsListResponse". + pub kind: Option, +} + +impl ResponseResult for UserRolePermissionsListResponse {} + + +/// Represents a UserProfile resource. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list user profiles](struct.UserProfileListCall.html) (none) +/// * [get user profiles](struct.UserProfileGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UserProfile { + /// The user name. + #[serde(rename="userName")] + pub user_name: Option, + /// The kind of resource this is, in this case dfareporting#userProfile. + pub kind: Option, + /// The sub account ID this profile belongs to if applicable. + #[serde(rename="subAccountId")] + pub sub_account_id: Option, + /// The account name this profile belongs to. + #[serde(rename="accountName")] + pub account_name: Option, + /// The eTag of this response for caching purposes. + pub etag: Option, + /// The sub account name this profile belongs to if applicable. + #[serde(rename="subAccountName")] + pub sub_account_name: Option, + /// The unique ID of the user profile. + #[serde(rename="profileId")] + pub profile_id: Option, + /// The account ID to which this profile belongs. + #[serde(rename="accountId")] + pub account_id: Option, +} + +impl Resource for UserProfile {} +impl ResponseResult for UserProfile {} + + +/// Creative Group Assignment. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeGroupAssignment { + /// ID of the creative group to be assigned. + #[serde(rename="creativeGroupId")] + pub creative_group_id: Option, + /// Creative group number of the creative group assignment. + #[serde(rename="creativeGroupNumber")] + pub creative_group_number: Option, +} + +impl Part for CreativeGroupAssignment {} + + +/// The report criteria for a report of type "PATH_TO_CONVERSION". +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReportPathToConversionCriteria { + /// The list of conversion dimensions the report should include. + #[serde(rename="conversionDimensions")] + pub conversion_dimensions: Option>, + /// The list of names of metrics the report should include. + #[serde(rename="metricNames")] + pub metric_names: Option>, + /// The date range this report should be run for. + #[serde(rename="dateRange")] + pub date_range: Option, + /// The list of custom floodlight variables the report should include. + #[serde(rename="customFloodlightVariables")] + pub custom_floodlight_variables: Option>, + /// The list of 'dfa:activity' values to filter on. + #[serde(rename="activityFilters")] + pub activity_filters: Option>, + /// The list of custom rich media events to include. + #[serde(rename="customRichMediaEvents")] + pub custom_rich_media_events: Option>, + /// The list of per interaction dimensions the report should include. + #[serde(rename="perInteractionDimensions")] + pub per_interaction_dimensions: Option>, + /// The properties of the report. + #[serde(rename="reportProperties")] + pub report_properties: Option, + /// The floodlight ID for which to show data in this report. All advertisers associated with that ID will automatically be added. The dimension of the value needs to be 'dfa:floodlightConfigId'. + #[serde(rename="floodlightConfigId")] + pub floodlight_config_id: Option, +} + +impl NestedType for ReportPathToConversionCriteria {} +impl Part for ReportPathToConversionCriteria {} + + +/// Creative Field List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list creative fields](struct.CreativeFieldListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeFieldsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Creative field collection. + #[serde(rename="creativeFields")] + pub creative_fields: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#creativeFieldsListResponse". + pub kind: Option, +} + +impl ResponseResult for CreativeFieldsListResponse {} + + +/// The report's email delivery settings. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReportDelivery { + /// The message to be sent with each email. + pub message: Option, + /// The type of delivery for the owner to receive, if enabled. + #[serde(rename="emailOwnerDeliveryType")] + pub email_owner_delivery_type: Option, + /// The list of recipients to which to email the report. + pub recipients: Option>, + /// Whether the report should be emailed to the report owner. + #[serde(rename="emailOwner")] + pub email_owner: Option, +} + +impl NestedType for ReportDelivery {} +impl Part for ReportDelivery {} + + +/// Companion Settings +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CompanionSetting { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#companionSetting". + pub kind: Option, + /// Whether companions are disabled for this placement. + #[serde(rename="companionsDisabled")] + pub companions_disabled: Option, + /// Whether to serve only static images as companions. + #[serde(rename="imageOnly")] + pub image_only: Option, + /// Whitelist of companion sizes to be served to this placement. Set this list to null or empty to serve all companion sizes. + #[serde(rename="enabledSizes")] + pub enabled_sizes: Option>, +} + +impl Part for CompanionSetting {} + + +/// Project List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list projects](struct.ProjectListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ProjectsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#projectsListResponse". + pub kind: Option, + /// Project collection. + pub projects: Option>, +} + +impl ResponseResult for ProjectsListResponse {} + + +/// Contains properties of a dynamic targeting key. Dynamic targeting keys are unique, user-friendly labels, created at the advertiser level in DCM, that can be assigned to ads, creatives, and placements and used for targeting with DoubleClick Studio dynamic creatives. Use these labels instead of numeric DCM IDs (such as placement IDs) to save time and avoid errors in your dynamic feeds. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list dynamic targeting keys](struct.DynamicTargetingKeyListCall.html) (none) +/// * [delete dynamic targeting keys](struct.DynamicTargetingKeyDeleteCall.html) (none) +/// * [insert dynamic targeting keys](struct.DynamicTargetingKeyInsertCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DynamicTargetingKey { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#dynamicTargetingKey". + pub kind: Option, + /// Name of this dynamic targeting key. This is a required field. Must be less than 256 characters long and cannot contain commas. All characters are converted to lowercase. + pub name: Option, + /// ID of the object of this dynamic targeting key. This is a required field. + #[serde(rename="objectId")] + pub object_id: Option, + /// Type of the object of this dynamic targeting key. This is a required field. + #[serde(rename="objectType")] + pub object_type: Option, +} + +impl RequestValue for DynamicTargetingKey {} +impl Resource for DynamicTargetingKey {} +impl ResponseResult for DynamicTargetingKey {} + + +/// Geographical Targeting. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GeoTargeting { + /// Regions to be targeted. For each region only dartId is required. The other fields are populated automatically when the ad is inserted or updated. If targeting a region, do not target or exclude the country of the region. + pub regions: Option>, + /// Countries to be targeted or excluded from targeting, depending on the setting of the excludeCountries field. For each country only dartId is required. The other fields are populated automatically when the ad is inserted or updated. If targeting or excluding a country, do not target regions, cities, metros, or postal codes in the same country. + pub countries: Option>, + /// Metros to be targeted. For each metro only dmaId is required. The other fields are populated automatically when the ad is inserted or updated. If targeting a metro, do not target or exclude the country of the metro. + pub metros: Option>, + /// Cities to be targeted. For each city only dartId is required. The other fields are populated automatically when the ad is inserted or updated. If targeting a city, do not target or exclude the country of the city, and do not target the metro or region of the city. + pub cities: Option>, + /// Whether or not to exclude the countries in the countries field from targeting. If false, the countries field refers to countries which will be targeted by the ad. + #[serde(rename="excludeCountries")] + pub exclude_countries: Option, + /// Postal codes to be targeted. For each postal code only id is required. The other fields are populated automatically when the ad is inserted or updated. If targeting a postal code, do not target or exclude the country of the postal code. + #[serde(rename="postalCodes")] + pub postal_codes: Option>, +} + +impl Part for GeoTargeting {} + + +/// Contains properties of a targeting template. A targeting template encapsulates targeting information which can be reused across multiple ads. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [insert targeting templates](struct.TargetingTemplateInsertCall.html) (request|response) +/// * [update targeting templates](struct.TargetingTemplateUpdateCall.html) (request|response) +/// * [get targeting templates](struct.TargetingTemplateGetCall.html) (response) +/// * [list targeting templates](struct.TargetingTemplateListCall.html) (none) +/// * [patch targeting templates](struct.TargetingTemplatePatchCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TargetingTemplate { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#targetingTemplate". + pub kind: Option, + /// Subaccount ID of this targeting template. This field, if left unset, will be auto-generated on insert and is read-only after insert. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of this targeting template. This field is required. It must be less than 256 characters long and unique within an advertiser. + pub name: Option, + /// Time and day targeting criteria. + #[serde(rename="dayPartTargeting")] + pub day_part_targeting: Option, + /// Key-value targeting criteria. + #[serde(rename="keyValueTargetingExpression")] + pub key_value_targeting_expression: Option, + /// Remarketing list targeting criteria. + #[serde(rename="listTargetingExpression")] + pub list_targeting_expression: Option, + /// Language targeting criteria. + #[serde(rename="languageTargeting")] + pub language_targeting: Option, + /// Advertiser ID of this targeting template. This is a required field on insert and is read-only after insert. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Geographical targeting criteria. + #[serde(rename="geoTargeting")] + pub geo_targeting: Option, + /// Dimension value for the ID of the advertiser. This is a read-only, auto-generated field. + #[serde(rename="advertiserIdDimensionValue")] + pub advertiser_id_dimension_value: Option, + /// Technology platform targeting criteria. + #[serde(rename="technologyTargeting")] + pub technology_targeting: Option, + /// ID of this targeting template. This is a read-only, auto-generated field. + pub id: Option, + /// Account ID of this targeting template. This field, if left unset, will be auto-generated on insert and is read-only after insert. + #[serde(rename="accountId")] + pub account_id: Option, +} + +impl RequestValue for TargetingTemplate {} +impl Resource for TargetingTemplate {} +impl ResponseResult for TargetingTemplate {} + + +/// Delivery Schedule. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DeliverySchedule { + /// Serving priority of an ad, with respect to other ads. The lower the priority number, the greater the priority with which it is served. + pub priority: Option, + /// Whether or not hard cutoff is enabled. If true, the ad will not serve after the end date and time. Otherwise the ad will continue to be served until it has reached its delivery goals. + #[serde(rename="hardCutoff")] + pub hard_cutoff: Option, + /// Limit on the number of times an individual user can be served the ad within a specified period of time. + #[serde(rename="frequencyCap")] + pub frequency_cap: Option, + /// Impression ratio for this ad. This ratio determines how often each ad is served relative to the others. For example, if ad A has an impression ratio of 1 and ad B has an impression ratio of 3, then DCM will serve ad B three times as often as ad A. Must be between 1 and 10. + #[serde(rename="impressionRatio")] + pub impression_ratio: Option, +} + +impl Part for DeliverySchedule {} + + +/// The report's schedule. Can only be set if the report's 'dateRange' is a relative date range and the relative date range is not "TODAY". +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReportSchedule { + /// Start date of date range for which scheduled reports should be run. + #[serde(rename="startDate")] + pub start_date: Option, + /// Enum to define for "MONTHLY" scheduled reports whether reports should be repeated on the same day of the month as "startDate" or the same day of the week of the month. + /// Example: If 'startDate' is Monday, April 2nd 2012 (2012-04-02), "DAY_OF_MONTH" would run subsequent reports on the 2nd of every Month, and "WEEK_OF_MONTH" would run subsequent reports on the first Monday of the month. + #[serde(rename="runsOnDayOfMonth")] + pub runs_on_day_of_month: Option, + /// The expiration date when the scheduled report stops running. + #[serde(rename="expirationDate")] + pub expiration_date: Option, + /// Whether the schedule is active or not. Must be set to either true or false. + pub active: Option, + /// Defines every how many days, weeks or months the report should be run. Needs to be set when "repeats" is either "DAILY", "WEEKLY" or "MONTHLY". + pub every: Option, + /// The interval for which the report is repeated. Note: + /// - "DAILY" also requires field "every" to be set. + /// - "WEEKLY" also requires fields "every" and "repeatsOnWeekDays" to be set. + /// - "MONTHLY" also requires fields "every" and "runsOnDayOfMonth" to be set. + pub repeats: Option, + /// List of week days "WEEKLY" on which scheduled reports should run. + #[serde(rename="repeatsOnWeekDays")] + pub repeats_on_week_days: Option>, +} + +impl NestedType for ReportSchedule {} +impl Part for ReportSchedule {} + + +/// Represents a recipient. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Recipient { + /// The kind of resource this is, in this case dfareporting#recipient. + pub kind: Option, + /// The delivery type for the recipient. + #[serde(rename="deliveryType")] + pub delivery_type: Option, + /// The email address of the recipient. + pub email: Option, +} + +impl Part for Recipient {} + + +/// Represents fields that are compatible to be selected for a report of type "STANDARD". +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReportCompatibleFields { + /// Metrics which are compatible to be selected in the "metricNames" section of the report. + pub metrics: Option>, + /// The kind of resource this is, in this case dfareporting#reportCompatibleFields. + pub kind: Option, + /// Metrics which are compatible to be selected as activity metrics to pivot on in the "activities" section of the report. + #[serde(rename="pivotedActivityMetrics")] + pub pivoted_activity_metrics: Option>, + /// Dimensions which are compatible to be selected in the "dimensions" section of the report. + pub dimensions: Option>, + /// Dimensions which are compatible to be selected in the "dimensionFilters" section of the report. + #[serde(rename="dimensionFilters")] + pub dimension_filters: Option>, +} + +impl Part for ReportCompatibleFields {} + + +/// Advertiser Group List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list advertiser groups](struct.AdvertiserGroupListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AdvertiserGroupsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#advertiserGroupsListResponse". + pub kind: Option, + /// Advertiser group collection. + #[serde(rename="advertiserGroups")] + pub advertiser_groups: Option>, +} + +impl ResponseResult for AdvertiserGroupsListResponse {} + + +/// Placement Group List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list placement groups](struct.PlacementGroupListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PlacementGroupsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#placementGroupsListResponse". + pub kind: Option, + /// Placement group collection. + #[serde(rename="placementGroups")] + pub placement_groups: Option>, +} + +impl ResponseResult for PlacementGroupsListResponse {} + + +/// The properties of the report. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReportPathToConversionCriteriaReportProperties { + /// DFA checks to see if a click interaction occurred within the specified period of time before a conversion. By default the value is pulled from Floodlight or you can manually enter a custom value. Valid values: 1-90. + #[serde(rename="clicksLookbackWindow")] + pub clicks_lookback_window: Option, + /// Enable pivoting on interaction path. + #[serde(rename="pivotOnInteractionPath")] + pub pivot_on_interaction_path: Option, + /// DFA checks to see if an impression interaction occurred within the specified period of time before a conversion. By default the value is pulled from Floodlight or you can manually enter a custom value. Valid values: 1-90. + #[serde(rename="impressionsLookbackWindow")] + pub impressions_lookback_window: Option, + /// Include conversions that have no associated cookies and no exposures. It’s therefore impossible to know how the user was exposed to your ads during the lookback window prior to a conversion. + #[serde(rename="includeUnattributedIPConversions")] + pub include_unattributed_ip_conversions: Option, + /// Include conversions of users with a DoubleClick cookie but without an exposure. That means the user did not click or see an ad from the advertiser within the Floodlight group, or that the interaction happened outside the lookback window. + #[serde(rename="includeUnattributedCookieConversions")] + pub include_unattributed_cookie_conversions: Option, + /// The maximum amount of time that can take place between interactions (clicks or impressions) by the same user. Valid values: 1-90. + #[serde(rename="maximumInteractionGap")] + pub maximum_interaction_gap: Option, + /// Deprecated: has no effect. + #[serde(rename="includeAttributedIPConversions")] + pub include_attributed_ip_conversions: Option, + /// The maximum number of click interactions to include in the report. Advertisers currently paying for E2C reports get up to 200 (100 clicks, 100 impressions). If another advertiser in your network is paying for E2C, you can have up to 5 total exposures per report. + #[serde(rename="maximumClickInteractions")] + pub maximum_click_interactions: Option, + /// The maximum number of click interactions to include in the report. Advertisers currently paying for E2C reports get up to 200 (100 clicks, 100 impressions). If another advertiser in your network is paying for E2C, you can have up to 5 total exposures per report. + #[serde(rename="maximumImpressionInteractions")] + pub maximum_impression_interactions: Option, +} + +impl NestedType for ReportPathToConversionCriteriaReportProperties {} +impl Part for ReportPathToConversionCriteriaReportProperties {} + + +/// Technology Targeting. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TechnologyTargeting { + /// Browsers that this ad targets. For each browser either set browserVersionId or dartId along with the version numbers. If both are specified, only browserVersionId will be used. The other fields are populated automatically when the ad is inserted or updated. + pub browsers: Option>, + /// Operating systems that this ad targets. To target specific versions, use operatingSystemVersions. For each operating system only dartId is required. The other fields are populated automatically when the ad is inserted or updated. If targeting an operating system, do not set targeting for operating system versions for the same operating system. + #[serde(rename="operatingSystems")] + pub operating_systems: Option>, + /// Mobile carriers that this ad targets. For each mobile carrier only id is required, and the other fields are populated automatically when the ad is inserted or updated. If targeting a mobile carrier, do not set targeting for any zip codes. + #[serde(rename="mobileCarriers")] + pub mobile_carriers: Option>, + /// Connection types that this ad targets. For each connection type only id is required. The other fields are populated automatically when the ad is inserted or updated. + #[serde(rename="connectionTypes")] + pub connection_types: Option>, + /// Platform types that this ad targets. For example, desktop, mobile, or tablet. For each platform type, only id is required, and the other fields are populated automatically when the ad is inserted or updated. + #[serde(rename="platformTypes")] + pub platform_types: Option>, + /// Operating system versions that this ad targets. To target all versions, use operatingSystems. For each operating system version, only id is required. The other fields are populated automatically when the ad is inserted or updated. If targeting an operating system version, do not set targeting for the corresponding operating system in operatingSystems. + #[serde(rename="operatingSystemVersions")] + pub operating_system_versions: Option>, +} + +impl Part for TechnologyTargeting {} + + +/// Language List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list languages](struct.LanguageListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LanguagesListResponse { + /// Language collection. + pub languages: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#languagesListResponse". + pub kind: Option, +} + +impl ResponseResult for LanguagesListResponse {} + + +/// Contains information about a language that can be targeted by ads. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list languages](struct.LanguageListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Language { + /// Format of language code is an ISO 639 two-letter language code optionally followed by an underscore followed by an ISO 3166 code. Examples are "en" for English or "zh_CN" for Simplified Chinese. + #[serde(rename="languageCode")] + pub language_code: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#language". + pub kind: Option, + /// Language ID of this language. This is the ID used for targeting and generating reports. + pub id: Option, + /// Name of this language. + pub name: Option, +} + +impl Resource for Language {} + + +/// Represents the list of reports. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list reports](struct.ReportListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReportList { + /// Continuation token used to page through reports. To retrieve the next page of results, set the next request's "pageToken" to the value of this field. The page token is only valid for a limited amount of time and should not be persisted. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The reports returned in this response. + pub items: Option>, + /// The kind of list this is, in this case dfareporting#reportList. + pub kind: Option, + /// The eTag of this response for caching purposes. + pub etag: Option, +} + +impl ResponseResult for ReportList {} + + +/// Remarketing List Targeting Expression. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListTargetingExpression { + /// Expression describing which lists are being targeted by the ad. + pub expression: Option, +} + +impl Part for ListTargetingExpression {} + + +/// CreativeAssets contains properties of a creative asset file which will be uploaded or has already been uploaded. Refer to the creative sample code for how to upload assets and insert a creative. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [insert creative assets](struct.CreativeAssetInsertCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeAssetMetadata { + /// Dimension value for the numeric ID of the asset. This is a read-only, auto-generated field. + #[serde(rename="idDimensionValue")] + pub id_dimension_value: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#creativeAssetMetadata". + pub kind: Option, + /// List of feature dependencies for the creative asset that are detected by DCM. Feature dependencies are features that a browser must be able to support in order to render your HTML5 creative correctly. This is a read-only, auto-generated field. + #[serde(rename="detectedFeatures")] + pub detected_features: Option>, + /// List of detected click tags for assets. This is a read-only auto-generated field. + #[serde(rename="clickTags")] + pub click_tags: Option>, + /// Rules validated during code generation that generated a warning. This is a read-only, auto-generated field. + /// + /// Possible values are: + /// - "ADMOB_REFERENCED" + /// - "ASSET_FORMAT_UNSUPPORTED_DCM" + /// - "ASSET_INVALID" + /// - "CLICK_TAG_HARD_CODED" + /// - "CLICK_TAG_INVALID" + /// - "CLICK_TAG_IN_GWD" + /// - "CLICK_TAG_MISSING" + /// - "CLICK_TAG_MORE_THAN_ONE" + /// - "CLICK_TAG_NON_TOP_LEVEL" + /// - "COMPONENT_UNSUPPORTED_DCM" + /// - "ENABLER_UNSUPPORTED_METHOD_DCM" + /// - "EXTERNAL_FILE_REFERENCED" + /// - "FILE_DETAIL_EMPTY" + /// - "FILE_TYPE_INVALID" + /// - "GWD_PROPERTIES_INVALID" + /// - "HTML5_FEATURE_UNSUPPORTED" + /// - "LINKED_FILE_NOT_FOUND" + /// - "MAX_FLASH_VERSION_11" + /// - "MRAID_REFERENCED" + /// - "NOT_SSL_COMPLIANT" + /// - "ORPHANED_ASSET" + /// - "PRIMARY_HTML_MISSING" + /// - "SVG_INVALID" + /// - "ZIP_INVALID" + #[serde(rename="warnedValidationRules")] + pub warned_validation_rules: Option>, + /// ID of the creative asset. This is a required field. + #[serde(rename="assetIdentifier")] + pub asset_identifier: Option, + /// Numeric ID of the asset. This is a read-only, auto-generated field. + pub id: Option, +} + +impl RequestValue for CreativeAssetMetadata {} +impl ResponseResult for CreativeAssetMetadata {} + + +/// A rule associates an asset with a targeting template for asset-level targeting. Applicable to INSTREAM_VIDEO creatives. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Rule { + /// A creativeAssets[].id. This should refer to one of the parent assets in this creative. This is a required field. + #[serde(rename="assetId")] + pub asset_id: Option, + /// A targeting template ID. The targeting from the targeting template will be used to determine whether this asset should be served. This is a required field. + #[serde(rename="targetingTemplateId")] + pub targeting_template_id: Option, + /// A user-friendly name for this rule. This is a required field. + pub name: Option, +} + +impl Part for Rule {} + + +/// Placement Tag Data +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TagData { + /// Tag string to record a click. + #[serde(rename="clickTag")] + pub click_tag: Option, + /// Tag string for serving an ad. + #[serde(rename="impressionTag")] + pub impression_tag: Option, + /// Creative associated with this placement tag. + #[serde(rename="creativeId")] + pub creative_id: Option, + /// Ad associated with this placement tag. + #[serde(rename="adId")] + pub ad_id: Option, + /// TagData tag format of this tag. + pub format: Option, +} + +impl Part for TagData {} + + +/// The report criteria for a report of type "FLOODLIGHT". +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReportFloodlightCriteria { + /// The floodlight ID for which to show data in this report. All advertisers associated with that ID will automatically be added. The dimension of the value needs to be 'dfa:floodlightConfigId'. + #[serde(rename="floodlightConfigId")] + pub floodlight_config_id: Option, + /// The list of dimensions the report should include. + pub dimensions: Option>, + /// The list of names of metrics the report should include. + #[serde(rename="metricNames")] + pub metric_names: Option>, + /// The date range this report should be run for. + #[serde(rename="dateRange")] + pub date_range: Option, + /// The list of custom rich media events to include. + #[serde(rename="customRichMediaEvents")] + pub custom_rich_media_events: Option>, + /// The list of filters on which dimensions are filtered. + /// Filters for different dimensions are ANDed, filters for the same dimension are grouped together and ORed. + #[serde(rename="dimensionFilters")] + pub dimension_filters: Option>, + /// The properties of the report. + #[serde(rename="reportProperties")] + pub report_properties: Option, +} + +impl NestedType for ReportFloodlightCriteria {} +impl Part for ReportFloodlightCriteria {} + + +/// Landing Page List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list landing pages](struct.LandingPageListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LandingPagesListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#landingPagesListResponse". + pub kind: Option, + /// Landing page collection + #[serde(rename="landingPages")] + pub landing_pages: Option>, +} + +impl ResponseResult for LandingPagesListResponse {} + + +/// Encapsulates the list of rules for asset selection and a default asset in case none of the rules match. Applicable to INSTREAM_VIDEO creatives. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeAssetSelection { + /// Rules determine which asset will be served to a viewer. Rules will be evaluated in the order in which they are stored in this list. This list must contain at least one rule. Applicable to INSTREAM_VIDEO creatives. + pub rules: Option>, + /// A creativeAssets[].id. This should refer to one of the parent assets in this creative, and will be served if none of the rules match. This is a required field. + #[serde(rename="defaultAssetId")] + pub default_asset_id: Option, +} + +impl Part for CreativeAssetSelection {} + + +/// Site List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list sites](struct.SiteListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SitesListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#sitesListResponse". + pub kind: Option, + /// Site collection. + pub sites: Option>, +} + +impl ResponseResult for SitesListResponse {} + + +/// Represents a dimension filter. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DimensionFilter { + /// The name of the dimension to filter. + #[serde(rename="dimensionName")] + pub dimension_name: Option, + /// The kind of resource this is, in this case dfareporting#dimensionFilter. + pub kind: Option, + /// The value of the dimension to filter. + pub value: Option, +} + +impl Part for DimensionFilter {} + + +/// Contains information about a postal code that can be targeted by ads. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get postal codes](struct.PostalCodeGetCall.html) (response) +/// * [list postal codes](struct.PostalCodeListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PostalCode { + /// Postal code. This is equivalent to the id field. + pub code: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#postalCode". + pub kind: Option, + /// DART ID of the country to which this postal code belongs. + #[serde(rename="countryDartId")] + pub country_dart_id: Option, + /// ID of this postal code. + pub id: Option, + /// Country code of the country to which this postal code belongs. + #[serde(rename="countryCode")] + pub country_code: Option, +} + +impl Resource for PostalCode {} +impl ResponseResult for PostalCode {} + + +/// Contains properties of a remarketing list. Remarketing enables you to create lists of users who have performed specific actions on a site, then target ads to members of those lists. This resource can be used to manage remarketing lists that are owned by your advertisers. To see all remarketing lists that are visible to your advertisers, including those that are shared to your advertiser or account, use the TargetableRemarketingLists resource. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [insert remarketing lists](struct.RemarketingListInsertCall.html) (request|response) +/// * [get remarketing lists](struct.RemarketingListGetCall.html) (response) +/// * [update remarketing lists](struct.RemarketingListUpdateCall.html) (request|response) +/// * [list remarketing lists](struct.RemarketingListListCall.html) (none) +/// * [patch remarketing lists](struct.RemarketingListPatchCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RemarketingList { + /// Rule used to populate the remarketing list with users. + #[serde(rename="listPopulationRule")] + pub list_population_rule: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#remarketingList". + pub kind: Option, + /// Subaccount ID of this remarketing list. This is a read-only, auto-generated field that is only returned in GET requests. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Remarketing list description. + pub description: Option, + /// Number of users currently in the list. This is a read-only field. + #[serde(rename="listSize")] + pub list_size: Option, + /// Number of days that a user should remain in the remarketing list without an impression. + #[serde(rename="lifeSpan")] + pub life_span: Option, + /// Dimension value for the advertiser ID that owns this remarketing list. This is a required field. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Product from which this remarketing list was originated. + #[serde(rename="listSource")] + pub list_source: Option, + /// Whether this remarketing list is active. + pub active: Option, + /// Dimension value for the ID of the advertiser. This is a read-only, auto-generated field. + #[serde(rename="advertiserIdDimensionValue")] + pub advertiser_id_dimension_value: Option, + /// Account ID of this remarketing list. This is a read-only, auto-generated field that is only returned in GET requests. + #[serde(rename="accountId")] + pub account_id: Option, + /// Remarketing list ID. This is a read-only, auto-generated field. + pub id: Option, + /// Name of the remarketing list. This is a required field. Must be no greater than 128 characters long. + pub name: Option, +} + +impl RequestValue for RemarketingList {} +impl Resource for RemarketingList {} +impl ResponseResult for RemarketingList {} + + +/// Contains properties of a Floodlight activity. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get floodlight activities](struct.FloodlightActivityGetCall.html) (response) +/// * [insert floodlight activities](struct.FloodlightActivityInsertCall.html) (request|response) +/// * [patch floodlight activities](struct.FloodlightActivityPatchCall.html) (request|response) +/// * [update floodlight activities](struct.FloodlightActivityUpdateCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FloodlightActivity { + /// Whether this tag should use SSL. + pub secure: Option, + /// Dimension value for the ID of this floodlight activity. This is a read-only, auto-generated field. + #[serde(rename="idDimensionValue")] + pub id_dimension_value: Option, + /// Name of the associated floodlight activity group. This is a read-only field. + #[serde(rename="floodlightActivityGroupName")] + pub floodlight_activity_group_name: Option, + /// Whether the image tag is enabled for this activity. + #[serde(rename="imageTagEnabled")] + pub image_tag_enabled: Option, + /// Advertiser ID of this floodlight activity. If this field is left blank, the value will be copied over either from the activity group's advertiser or the existing activity's advertiser. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Code type used for cache busting in the generated tag. + #[serde(rename="cacheBustingType")] + pub cache_busting_type: Option, + /// Dimension value for the ID of the advertiser. This is a read-only, auto-generated field. + #[serde(rename="advertiserIdDimensionValue")] + pub advertiser_id_dimension_value: Option, + /// Floodlight activity group ID of this floodlight activity. This is a required field. + #[serde(rename="floodlightActivityGroupId")] + pub floodlight_activity_group_id: Option, + /// List of the user-defined variables used by this conversion tag. These map to the "u[1-20]=" in the tags. Each of these can have a user defined type. + /// Acceptable values are: + /// - "U1" + /// - "U2" + /// - "U3" + /// - "U4" + /// - "U5" + /// - "U6" + /// - "U7" + /// - "U8" + /// - "U9" + /// - "U10" + /// - "U11" + /// - "U12" + /// - "U13" + /// - "U14" + /// - "U15" + /// - "U16" + /// - "U17" + /// - "U18" + /// - "U19" + /// - "U20" + #[serde(rename="userDefinedVariableTypes")] + pub user_defined_variable_types: Option>, + /// Value of the cat= paramter in the floodlight tag, which the ad servers use to identify the activity. This is optional: if empty, a new tag string will be generated for you. This string must be 1 to 8 characters long, with valid characters being [a-z][A-Z][0-9][-][ _ ]. This tag string must also be unique among activities of the same activity group. This field is read-only after insertion. + #[serde(rename="tagString")] + pub tag_string: Option, + /// Tag string of the associated floodlight activity group. This is a read-only field. + #[serde(rename="floodlightActivityGroupTagString")] + pub floodlight_activity_group_tag_string: Option, + /// URL where this tag will be deployed. If specified, must be less than 256 characters long. + #[serde(rename="expectedUrl")] + pub expected_url: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#floodlightActivity". + pub kind: Option, + /// Subaccount ID of this floodlight activity. This is a read-only field that can be left blank. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of this floodlight activity. This is a required field. Must be less than 129 characters long and cannot contain quotes. + pub name: Option, + /// Publisher dynamic floodlight tags. + #[serde(rename="publisherTags")] + pub publisher_tags: Option>, + /// Whether the floodlight activity is SSL-compliant. This is a read-only field, its value detected by the system from the floodlight tags. + #[serde(rename="sslCompliant")] + pub ssl_compliant: Option, + /// General notes or implementation instructions for the tag. + pub notes: Option, + /// Floodlight configuration ID of this floodlight activity. If this field is left blank, the value will be copied over either from the activity group's floodlight configuration or from the existing activity's floodlight configuration. + #[serde(rename="floodlightConfigurationId")] + pub floodlight_configuration_id: Option, + /// ID of this floodlight activity. This is a read-only, auto-generated field. + pub id: Option, + /// Counting method for conversions for this floodlight activity. This is a required field. + #[serde(rename="countingMethod")] + pub counting_method: Option, + /// Dynamic floodlight tags. + #[serde(rename="defaultTags")] + pub default_tags: Option>, + /// Dimension value for the ID of the floodlight configuration. This is a read-only, auto-generated field. + #[serde(rename="floodlightConfigurationIdDimensionValue")] + pub floodlight_configuration_id_dimension_value: Option, + /// Tag format type for the floodlight activity. If left blank, the tag format will default to HTML. + #[serde(rename="tagFormat")] + pub tag_format: Option, + /// Whether this activity is archived. + pub hidden: Option, + /// Account ID of this floodlight activity. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, + /// Whether this floodlight activity must be SSL-compliant. + #[serde(rename="sslRequired")] + pub ssl_required: Option, + /// Type of the associated floodlight activity group. This is a read-only field. + #[serde(rename="floodlightActivityGroupType")] + pub floodlight_activity_group_type: Option, +} + +impl RequestValue for FloodlightActivity {} +impl ResponseResult for FloodlightActivity {} + + +/// Contains information about a browser that can be targeted by ads. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list browsers](struct.BrowserListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Browser { + /// Major version number (leftmost number) of this browser. For example, for Chrome 5.0.376.86 beta, this field should be set to 5. An asterisk (*) may be used to target any version number, and a question mark (?) may be used to target cases where the version number cannot be identified. For example, Chrome *.* targets any version of Chrome: 1.2, 2.5, 3.5, and so on. Chrome 3.* targets Chrome 3.1, 3.5, but not 4.0. Firefox ?.? targets cases where the ad server knows the browser is Firefox but can't tell which version it is. + #[serde(rename="majorVersion")] + pub major_version: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#browser". + pub kind: Option, + /// ID referring to this grouping of browser and version numbers. This is the ID used for targeting. + #[serde(rename="browserVersionId")] + pub browser_version_id: Option, + /// Name of this browser. + pub name: Option, + /// DART ID of this browser. This is the ID used when generating reports. + #[serde(rename="dartId")] + pub dart_id: Option, + /// Minor version number (number after first dot on left) of this browser. For example, for Chrome 5.0.375.86 beta, this field should be set to 0. An asterisk (*) may be used to target any version number, and a question mark (?) may be used to target cases where the version number cannot be identified. For example, Chrome *.* targets any version of Chrome: 1.2, 2.5, 3.5, and so on. Chrome 3.* targets Chrome 3.1, 3.5, but not 4.0. Firefox ?.? targets cases where the ad server knows the browser is Firefox but can't tell which version it is. + #[serde(rename="minorVersion")] + pub minor_version: Option, +} + +impl Resource for Browser {} + + +/// Account User Profile List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list account user profiles](struct.AccountUserProfileListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AccountUserProfilesListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Account user profile collection. + #[serde(rename="accountUserProfiles")] + pub account_user_profiles: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#accountUserProfilesListResponse". + pub kind: Option, +} + +impl ResponseResult for AccountUserProfilesListResponse {} + + +/// Contains properties of a DCM advertiser. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get advertisers](struct.AdvertiserGetCall.html) (response) +/// * [update advertisers](struct.AdvertiserUpdateCall.html) (request|response) +/// * [patch advertisers](struct.AdvertiserPatchCall.html) (request|response) +/// * [list advertisers](struct.AdvertiserListCall.html) (none) +/// * [insert advertisers](struct.AdvertiserInsertCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Advertiser { + /// Status of this advertiser. + pub status: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#advertiser". + pub kind: Option, + /// Subaccount ID of this advertiser.This is a read-only field that can be left blank. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of this advertiser. This is a required field and must be less than 256 characters long and unique among advertisers of the same account. + pub name: Option, + /// ID of the click-through event tag to apply by default to the landing pages of this advertiser's campaigns. + #[serde(rename="defaultClickThroughEventTagId")] + pub default_click_through_event_tag_id: Option, + /// Original floodlight configuration before any sharing occurred. Set the floodlightConfigurationId of this advertiser to originalFloodlightConfigurationId to unshare the advertiser's current floodlight configuration. You cannot unshare an advertiser's floodlight configuration if the shared configuration has activities associated with any campaign or placement. + #[serde(rename="originalFloodlightConfigurationId")] + pub original_floodlight_configuration_id: Option, + /// Suffix added to click-through URL of ad creative associations under this advertiser. Must be less than 129 characters long. + #[serde(rename="clickThroughUrlSuffix")] + pub click_through_url_suffix: Option, + /// Floodlight configuration ID of this advertiser. The floodlight configuration ID will be created automatically, so on insert this field should be left blank. This field can be set to another advertiser's floodlight configuration ID in order to share that advertiser's floodlight configuration with this advertiser, so long as: + /// - This advertiser's original floodlight configuration is not already associated with floodlight activities or floodlight activity groups. + /// - This advertiser's original floodlight configuration is not already shared with another advertiser. + #[serde(rename="floodlightConfigurationId")] + pub floodlight_configuration_id: Option, + /// ID of the advertiser group this advertiser belongs to. You can group advertisers for reporting purposes, allowing you to see aggregated information for all advertisers in each group. + #[serde(rename="advertiserGroupId")] + pub advertiser_group_id: Option, + /// Dimension value for the ID of the floodlight configuration. This is a read-only, auto-generated field. + #[serde(rename="floodlightConfigurationIdDimensionValue")] + pub floodlight_configuration_id_dimension_value: Option, + /// Suspension status of this advertiser. + pub suspended: Option, + /// Dimension value for the ID of this advertiser. This is a read-only, auto-generated field. + #[serde(rename="idDimensionValue")] + pub id_dimension_value: Option, + /// Default email address used in sender field for tag emails. + #[serde(rename="defaultEmail")] + pub default_email: Option, + /// ID of this advertiser. This is a read-only, auto-generated field. + pub id: Option, + /// Account ID of this advertiser.This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, +} + +impl RequestValue for Advertiser {} +impl Resource for Advertiser {} +impl ResponseResult for Advertiser {} + + +/// Platform Type List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list platform types](struct.PlatformTypeListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PlatformTypesListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#platformTypesListResponse". + pub kind: Option, + /// Platform type collection. + #[serde(rename="platformTypes")] + pub platform_types: Option>, +} + +impl ResponseResult for PlatformTypesListResponse {} + + +/// A description of how user IDs are encrypted. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct EncryptionInfo { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#encryptionInfo". + pub kind: Option, + /// The encryption entity ID. This should match the encryption configuration for ad serving or Data Transfer. + #[serde(rename="encryptionEntityId")] + pub encryption_entity_id: Option, + /// Describes whether the encrypted cookie was received from ad serving (the %m macro) or from Data Transfer. + #[serde(rename="encryptionSource")] + pub encryption_source: Option, + /// The encryption entity type. This should match the encryption configuration for ad serving or Data Transfer. + #[serde(rename="encryptionEntityType")] + pub encryption_entity_type: Option, +} + +impl Part for EncryptionInfo {} + + +/// Placement List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list placements](struct.PlacementListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PlacementsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#placementsListResponse". + pub kind: Option, + /// Placement collection. + pub placements: Option>, +} + +impl ResponseResult for PlacementsListResponse {} + + +/// Ad List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list ads](struct.AdListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AdsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#adsListResponse". + pub kind: Option, + /// Ad collection. + pub ads: Option>, +} + +impl ResponseResult for AdsListResponse {} + + +/// The report criteria for a report of type "REACH". +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReportReachCriteria { + /// Activity group. + pub activities: Option, + /// The list of dimensions the report should include. + pub dimensions: Option>, + /// The list of names of metrics the report should include. + #[serde(rename="metricNames")] + pub metric_names: Option>, + /// The date range this report should be run for. + #[serde(rename="dateRange")] + pub date_range: Option, + /// The list of filters on which dimensions are filtered. + /// Filters for different dimensions are ANDed, filters for the same dimension are grouped together and ORed. + #[serde(rename="dimensionFilters")] + pub dimension_filters: Option>, + /// The list of names of Reach By Frequency metrics the report should include. + #[serde(rename="reachByFrequencyMetricNames")] + pub reach_by_frequency_metric_names: Option>, + /// Custom Rich Media Events group. + #[serde(rename="customRichMediaEvents")] + pub custom_rich_media_events: Option, + /// Whether to enable all reach dimension combinations in the report. Defaults to false. If enabled, the date range of the report should be within the last three months. + #[serde(rename="enableAllDimensionCombinations")] + pub enable_all_dimension_combinations: Option, +} + +impl NestedType for ReportReachCriteria {} +impl Part for ReportReachCriteria {} + + +/// The URLs where the completed report file can be downloaded. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FileUrls { + /// The URL for downloading the report data through a browser. + #[serde(rename="browserUrl")] + pub browser_url: Option, + /// The URL for downloading the report data through the API. + #[serde(rename="apiUrl")] + pub api_url: Option, +} + +impl NestedType for FileUrls {} +impl Part for FileUrls {} + + +/// Order document List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list order documents](struct.OrderDocumentListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OrderDocumentsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#orderDocumentsListResponse". + pub kind: Option, + /// Order document collection + #[serde(rename="orderDocuments")] + pub order_documents: Option>, +} + +impl ResponseResult for OrderDocumentsListResponse {} + + +/// User Defined Variable configuration. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UserDefinedVariableConfiguration { + /// Data type for the variable. This is a required field. + #[serde(rename="dataType")] + pub data_type: Option, + /// User-friendly name for the variable which will appear in reports. This is a required field, must be less than 64 characters long, and cannot contain the following characters: ""<>". + #[serde(rename="reportName")] + pub report_name: Option, + /// Variable name in the tag. This is a required field. + #[serde(rename="variableType")] + pub variable_type: Option, +} + +impl Part for UserDefinedVariableConfiguration {} + + +/// Pricing Information +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Pricing { + /// Group type of this inventory item if it represents a placement group. Is null otherwise. There are two type of placement groups: PLANNING_PLACEMENT_GROUP_TYPE_PACKAGE is a simple group of inventory items that acts as a single pricing point for a group of tags. PLANNING_PLACEMENT_GROUP_TYPE_ROADBLOCK is a group of inventory items that not only acts as a single pricing point, but also assumes that all the tags in it will be served at the same time. A roadblock requires one of its assigned inventory items to be marked as primary. + #[serde(rename="groupType")] + pub group_type: Option, + /// Start date of this inventory item. + #[serde(rename="startDate")] + pub start_date: Option, + /// Flights of this inventory item. A flight (a.k.a. pricing period) represents the inventory item pricing information for a specific period of time. + pub flights: Option>, + /// End date of this inventory item. + #[serde(rename="endDate")] + pub end_date: Option, + /// Pricing type of this inventory item. + #[serde(rename="pricingType")] + pub pricing_type: Option, + /// Cap cost type of this inventory item. + #[serde(rename="capCostType")] + pub cap_cost_type: Option, +} + +impl Part for Pricing {} + + +/// Skippable Settings +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SkippableSetting { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#skippableSetting". + pub kind: Option, + /// Amount of time to play videos served to this placement before the skip button should appear. Applicable when skippable is true. + #[serde(rename="skipOffset")] + pub skip_offset: Option, + /// Whether the user can skip creatives served to this placement. + pub skippable: Option, + /// Amount of time to play videos served to this placement before counting a view. Applicable when skippable is true. + #[serde(rename="progressOffset")] + pub progress_offset: Option, +} + +impl Part for SkippableSetting {} + + +/// Contains information about where a user's browser is taken after the user clicks an ad. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [update landing pages](struct.LandingPageUpdateCall.html) (request|response) +/// * [list landing pages](struct.LandingPageListCall.html) (none) +/// * [patch landing pages](struct.LandingPagePatchCall.html) (request|response) +/// * [insert landing pages](struct.LandingPageInsertCall.html) (request|response) +/// * [delete landing pages](struct.LandingPageDeleteCall.html) (none) +/// * [get landing pages](struct.LandingPageGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LandingPage { + /// Whether or not this landing page will be assigned to any ads or creatives that do not have a landing page assigned explicitly. Only one default landing page is allowed per campaign. + pub default: Option, + /// URL of this landing page. This is a required field. + pub url: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#landingPage". + pub kind: Option, + /// ID of this landing page. This is a read-only, auto-generated field. + pub id: Option, + /// Name of this landing page. This is a required field. It must be less than 256 characters long, and must be unique among landing pages of the same campaign. + pub name: Option, +} + +impl RequestValue for LandingPage {} +impl Resource for LandingPage {} +impl ResponseResult for LandingPage {} + + +/// Represents the dimensions of ads, placements, creatives, or creative assets. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [insert sizes](struct.SizeInsertCall.html) (request|response) +/// * [get sizes](struct.SizeGetCall.html) (response) +/// * [list sizes](struct.SizeListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Size { + /// Width of this size. + pub width: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#size". + pub kind: Option, + /// Height of this size. + pub height: Option, + /// ID of this size. This is a read-only, auto-generated field. + pub id: Option, + /// IAB standard size. This is a read-only, auto-generated field. + pub iab: Option, +} + +impl RequestValue for Size {} +impl Resource for Size {} +impl ResponseResult for Size {} + + +/// Contains information about a city that can be targeted by ads. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct City { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#city". + pub kind: Option, + /// DART ID of the country to which this city belongs. + #[serde(rename="countryDartId")] + pub country_dart_id: Option, + /// Name of this city. + pub name: Option, + /// Country code of the country to which this city belongs. + #[serde(rename="countryCode")] + pub country_code: Option, + /// Metro region code of the metro region (DMA) to which this city belongs. + #[serde(rename="metroCode")] + pub metro_code: Option, + /// Region code of the region to which this city belongs. + #[serde(rename="regionCode")] + pub region_code: Option, + /// ID of the metro region (DMA) to which this city belongs. + #[serde(rename="metroDmaId")] + pub metro_dma_id: Option, + /// DART ID of this city. This is the ID used for targeting and generating reports. + #[serde(rename="dartId")] + pub dart_id: Option, + /// DART ID of the region to which this city belongs. + #[serde(rename="regionDartId")] + pub region_dart_id: Option, +} + +impl Part for City {} + + +/// Click Through URL Suffix settings. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ClickThroughUrlSuffixProperties { + /// Click-through URL suffix to apply to all ads in this entity's scope. Must be less than 128 characters long. + #[serde(rename="clickThroughUrlSuffix")] + pub click_through_url_suffix: Option, + /// Whether this entity should override the inherited click-through URL suffix with its own defined value. + #[serde(rename="overrideInheritedSuffix")] + pub override_inherited_suffix: Option, +} + +impl Part for ClickThroughUrlSuffixProperties {} + + +/// Contains properties of a package or roadblock. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [update placement groups](struct.PlacementGroupUpdateCall.html) (request|response) +/// * [patch placement groups](struct.PlacementGroupPatchCall.html) (request|response) +/// * [get placement groups](struct.PlacementGroupGetCall.html) (response) +/// * [insert placement groups](struct.PlacementGroupInsertCall.html) (request|response) +/// * [list placement groups](struct.PlacementGroupListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PlacementGroup { + /// Comments for this placement group. + pub comment: Option, + /// ID of the primary placement, used to calculate the media cost of a roadblock (placement group). Modifying this field will automatically modify the primary field on all affected roadblock child placements. + #[serde(rename="primaryPlacementId")] + pub primary_placement_id: Option, + /// Campaign ID of this placement group. This field is required on insertion. + #[serde(rename="campaignId")] + pub campaign_id: Option, + /// Dimension value for the ID of the primary placement. This is a read-only, auto-generated field. + #[serde(rename="primaryPlacementIdDimensionValue")] + pub primary_placement_id_dimension_value: Option, + /// Dimension value for the ID of the directory site. This is a read-only, auto-generated field. + #[serde(rename="directorySiteIdDimensionValue")] + pub directory_site_id_dimension_value: Option, + /// Advertiser ID of this placement group. This is a required field on insertion. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Directory site ID associated with this placement group. On insert, you must set either this field or the site_id field to specify the site associated with this placement group. This is a required field that is read-only after insertion. + #[serde(rename="directorySiteId")] + pub directory_site_id: Option, + /// Information about the creation of this placement group. This is a read-only field. + #[serde(rename="createInfo")] + pub create_info: Option, + /// Site ID associated with this placement group. On insert, you must set either this field or the directorySiteId field to specify the site associated with this placement group. This is a required field that is read-only after insertion. + #[serde(rename="siteId")] + pub site_id: Option, + /// Pricing schedule of this placement group. This field is required on insertion. + #[serde(rename="pricingSchedule")] + pub pricing_schedule: Option, + /// Dimension value for the ID of the site. This is a read-only, auto-generated field. + #[serde(rename="siteIdDimensionValue")] + pub site_id_dimension_value: Option, + /// Type of this placement group. A package is a simple group of placements that acts as a single pricing point for a group of tags. A roadblock is a group of placements that not only acts as a single pricing point, but also assumes that all the tags in it will be served at the same time. A roadblock requires one of its assigned placements to be marked as primary for reporting. This field is required on insertion. + #[serde(rename="placementGroupType")] + pub placement_group_type: Option, + /// Dimension value for the ID of the advertiser. This is a read-only, auto-generated field. + #[serde(rename="advertiserIdDimensionValue")] + pub advertiser_id_dimension_value: Option, + /// Whether this placement group is archived. + pub archived: Option, + /// ID of this placement group. This is a read-only, auto-generated field. + pub id: Option, + /// ID of the placement strategy assigned to this placement group. + #[serde(rename="placementStrategyId")] + pub placement_strategy_id: Option, + /// Account ID of this placement group. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, + /// Dimension value for the ID of the campaign. This is a read-only, auto-generated field. + #[serde(rename="campaignIdDimensionValue")] + pub campaign_id_dimension_value: Option, + /// Subaccount ID of this placement group. This is a read-only field that can be left blank. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of this placement group. This is a required field and must be less than 256 characters long. + pub name: Option, + /// IDs of placements which are assigned to this placement group. This is a read-only, auto-generated field. + #[serde(rename="childPlacementIds")] + pub child_placement_ids: Option>, + /// Information about the most recent modification of this placement group. This is a read-only field. + #[serde(rename="lastModifiedInfo")] + pub last_modified_info: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#placementGroup". + pub kind: Option, + /// ID of the content category assigned to this placement group. + #[serde(rename="contentCategoryId")] + pub content_category_id: Option, + /// External ID for this placement. + #[serde(rename="externalId")] + pub external_id: Option, + /// Dimension value for the ID of this placement group. This is a read-only, auto-generated field. + #[serde(rename="idDimensionValue")] + pub id_dimension_value: Option, +} + +impl RequestValue for PlacementGroup {} +impl Resource for PlacementGroup {} +impl ResponseResult for PlacementGroup {} + + +/// Third-party Tracking URL. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ThirdPartyTrackingUrl { + /// URL for the specified third-party URL type. + pub url: Option, + /// Third-party URL type for in-stream video creatives. + #[serde(rename="thirdPartyUrlType")] + pub third_party_url_type: Option, +} + +impl Part for ThirdPartyTrackingUrl {} + + +/// Represents a date range. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DateRange { + /// The start date of the date range, inclusive. A string of the format: "yyyy-MM-dd". + #[serde(rename="startDate")] + pub start_date: Option, + /// The kind of resource this is, in this case dfareporting#dateRange. + pub kind: Option, + /// The end date of the date range, inclusive. A string of the format: "yyyy-MM-dd". + #[serde(rename="endDate")] + pub end_date: Option, + /// The date range relative to the date of when the report is run. + #[serde(rename="relativeDateRange")] + pub relative_date_range: Option, +} + +impl Part for DateRange {} + + +/// Metro List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list metros](struct.MetroListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct MetrosListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#metrosListResponse". + pub kind: Option, + /// Metro collection. + pub metros: Option>, +} + +impl ResponseResult for MetrosListResponse {} + + +/// Pricing Schedule +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PricingSchedule { + /// Placement start date. This date must be later than, or the same day as, the campaign start date. The hours, minutes, and seconds of the start date should not be set, as doing so will result in an error. This field is required on insertion. + #[serde(rename="startDate")] + pub start_date: Option, + /// Placement end date. This date must be later than, or the same day as, the placement start date, but not later than the campaign end date. If, for example, you set 6/25/2015 as both the start and end dates, the effective placement date is just that day only, 6/25/2015. The hours, minutes, and seconds of the end date should not be set, as doing so will result in an error. This field is required on insertion. + #[serde(rename="endDate")] + pub end_date: Option, + /// Whether this placement is flighted. If true, pricing periods will be computed automatically. + pub flighted: Option, + /// Whether cap costs are ignored by ad serving. + #[serde(rename="disregardOverdelivery")] + pub disregard_overdelivery: Option, + /// Placement cap cost option. + #[serde(rename="capCostOption")] + pub cap_cost_option: Option, + /// Pricing periods for this placement. + #[serde(rename="pricingPeriods")] + pub pricing_periods: Option>, + /// Placement pricing type. This field is required on insertion. + #[serde(rename="pricingType")] + pub pricing_type: Option, + /// Testing start date of this placement. The hours, minutes, and seconds of the start date should not be set, as doing so will result in an error. + #[serde(rename="testingStartDate")] + pub testing_start_date: Option, + /// Floodlight activity ID associated with this placement. This field should be set when placement pricing type is set to PRICING_TYPE_CPA. + #[serde(rename="floodlightActivityId")] + pub floodlight_activity_id: Option, +} + +impl Part for PricingSchedule {} + + +/// Account List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list accounts](struct.AccountListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AccountsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#accountsListResponse". + pub kind: Option, + /// Account collection. + pub accounts: Option>, +} + +impl ResponseResult for AccountsListResponse {} + + +/// Targeting Template List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list targeting templates](struct.TargetingTemplateListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TargetingTemplatesListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#targetingTemplatesListResponse". + pub kind: Option, + /// Targeting template collection. + #[serde(rename="targetingTemplates")] + pub targeting_templates: Option>, +} + +impl ResponseResult for TargetingTemplatesListResponse {} + + +/// Contains properties of a creative group. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get creative groups](struct.CreativeGroupGetCall.html) (response) +/// * [update creative groups](struct.CreativeGroupUpdateCall.html) (request|response) +/// * [patch creative groups](struct.CreativeGroupPatchCall.html) (request|response) +/// * [list creative groups](struct.CreativeGroupListCall.html) (none) +/// * [insert creative groups](struct.CreativeGroupInsertCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeGroup { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#creativeGroup". + pub kind: Option, + /// Subaccount ID of this creative group. This is a read-only field that can be left blank. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of this creative group. This is a required field and must be less than 256 characters long and unique among creative groups of the same advertiser. + pub name: Option, + /// Subgroup of the creative group. Assign your creative groups to one of the following subgroups in order to filter or manage them more easily. This field is required on insertion and is read-only after insertion. + /// Acceptable values are: + /// - 1 + /// - 2 + #[serde(rename="groupNumber")] + pub group_number: Option, + /// Advertiser ID of this creative group. This is a required field on insertion. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Dimension value for the ID of the advertiser. This is a read-only, auto-generated field. + #[serde(rename="advertiserIdDimensionValue")] + pub advertiser_id_dimension_value: Option, + /// ID of this creative group. This is a read-only, auto-generated field. + pub id: Option, + /// Account ID of this creative group. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, +} + +impl RequestValue for CreativeGroup {} +impl Resource for CreativeGroup {} +impl ResponseResult for CreativeGroup {} + + +/// Contains information about an operating system that can be targeted by ads. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get operating systems](struct.OperatingSystemGetCall.html) (response) +/// * [list operating systems](struct.OperatingSystemListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OperatingSystem { + /// Whether this operating system is for mobile. + pub mobile: Option, + /// DART ID of this operating system. This is the ID used for targeting. + #[serde(rename="dartId")] + pub dart_id: Option, + /// Whether this operating system is for desktop. + pub desktop: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#operatingSystem". + pub kind: Option, + /// Name of this operating system. + pub name: Option, +} + +impl Resource for OperatingSystem {} +impl ResponseResult for OperatingSystem {} + + +/// The original conversion that was inserted or updated and whether there were any errors. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ConversionStatus { + /// The original conversion that was inserted or updated. + pub conversion: Option, + /// A list of errors related to this conversion. + pub errors: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#conversionStatus". + pub kind: Option, +} + +impl Part for ConversionStatus {} + + +/// Represents an activity group. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Activities { + /// The kind of resource this is, in this case dfareporting#activities. + pub kind: Option, + /// List of activity filters. The dimension values need to be all either of type "dfa:activity" or "dfa:activityGroup". + pub filters: Option>, + /// List of names of floodlight activity metrics. + #[serde(rename="metricNames")] + pub metric_names: Option>, +} + +impl Part for Activities {} + + +/// A group clause made up of list population terms representing constraints joined by ORs. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListPopulationClause { + /// Terms of this list population clause. Each clause is made up of list population terms representing constraints and are joined by ORs. + pub terms: Option>, +} + +impl Part for ListPopulationClause {} + + +/// Flight +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Flight { + /// Rate or cost of this flight. + #[serde(rename="rateOrCost")] + pub rate_or_cost: Option, + /// Inventory item flight start date. + #[serde(rename="startDate")] + pub start_date: Option, + /// Units of this flight. + pub units: Option, + /// Inventory item flight end date. + #[serde(rename="endDate")] + pub end_date: Option, +} + +impl Part for Flight {} + + +/// Represents a sorted dimension. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SortedDimension { + /// The kind of resource this is, in this case dfareporting#sortedDimension. + pub kind: Option, + /// The name of the dimension. + pub name: Option, + /// An optional sort order for the dimension column. + #[serde(rename="sortOrder")] + pub sort_order: Option, +} + +impl Part for SortedDimension {} + + +/// Placement Strategy List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list placement strategies](struct.PlacementStrategyListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PlacementStrategiesListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#placementStrategiesListResponse". + pub kind: Option, + /// Placement strategy collection. + #[serde(rename="placementStrategies")] + pub placement_strategies: Option>, +} + +impl ResponseResult for PlacementStrategiesListResponse {} + + +/// Language Targeting. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LanguageTargeting { + /// Languages that this ad targets. For each language only languageId is required. The other fields are populated automatically when the ad is inserted or updated. + pub languages: Option>, +} + +impl Part for LanguageTargeting {} + + +/// Third Party Authentication Token +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ThirdPartyAuthenticationToken { + /// Name of the third-party authentication token. + pub name: Option, + /// Value of the third-party authentication token. This is a read-only, auto-generated field. + pub value: Option, +} + +impl Part for ThirdPartyAuthenticationToken {} + + +/// Groups advertisers together so that reports can be generated for the entire group at once. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [delete advertiser groups](struct.AdvertiserGroupDeleteCall.html) (none) +/// * [get advertiser groups](struct.AdvertiserGroupGetCall.html) (response) +/// * [update advertiser groups](struct.AdvertiserGroupUpdateCall.html) (request|response) +/// * [list advertiser groups](struct.AdvertiserGroupListCall.html) (none) +/// * [patch advertiser groups](struct.AdvertiserGroupPatchCall.html) (request|response) +/// * [insert advertiser groups](struct.AdvertiserGroupInsertCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AdvertiserGroup { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#advertiserGroup". + pub kind: Option, + /// Account ID of this advertiser group. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, + /// ID of this advertiser group. This is a read-only, auto-generated field. + pub id: Option, + /// Name of this advertiser group. This is a required field and must be less than 256 characters long and unique among advertiser groups of the same account. + pub name: Option, +} + +impl RequestValue for AdvertiserGroup {} +impl Resource for AdvertiserGroup {} +impl ResponseResult for AdvertiserGroup {} + + +/// FsCommand. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FsCommand { + /// Height of the window. + #[serde(rename="windowHeight")] + pub window_height: Option, + /// Distance from the top of the browser. Applicable when positionOption is DISTANCE_FROM_TOP_LEFT_CORNER. + pub top: Option, + /// Width of the window. + #[serde(rename="windowWidth")] + pub window_width: Option, + /// Position in the browser where the window will open. + #[serde(rename="positionOption")] + pub position_option: Option, + /// Distance from the left of the browser.Applicable when positionOption is DISTANCE_FROM_TOP_LEFT_CORNER. + pub left: Option, +} + +impl Part for FsCommand {} + + +/// Creative optimization settings. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeOptimizationConfiguration { + /// List of optimization activities associated with this configuration. + #[serde(rename="optimizationActivitys")] + pub optimization_activitys: Option>, + /// ID of this creative optimization config. This field is auto-generated when the campaign is inserted or updated. It can be null for existing campaigns. + pub id: Option, + /// Name of this creative optimization config. This is a required field and must be less than 129 characters long. + pub name: Option, + /// Optimization model for this configuration. + #[serde(rename="optimizationModel")] + pub optimization_model: Option, +} + +impl Part for CreativeOptimizationConfiguration {} + + +/// Creative Group List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list creative groups](struct.CreativeGroupListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeGroupsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Creative group collection. + #[serde(rename="creativeGroups")] + pub creative_groups: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#creativeGroupsListResponse". + pub kind: Option, +} + +impl ResponseResult for CreativeGroupsListResponse {} + + +/// Offset Position. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OffsetPosition { + /// Offset distance from top side of an asset or a window. + pub top: Option, + /// Offset distance from left side of an asset or a window. + pub left: Option, +} + +impl Part for OffsetPosition {} + + +/// Target Window. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TargetWindow { + /// User-entered value. + #[serde(rename="customHtml")] + pub custom_html: Option, + /// Type of browser window for which the backup image of the flash creative can be displayed. + #[serde(rename="targetWindowOption")] + pub target_window_option: Option, +} + +impl Part for TargetWindow {} + + +/// Contains properties of a user role permission. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get user role permissions](struct.UserRolePermissionGetCall.html) (response) +/// * [list user role permissions](struct.UserRolePermissionListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UserRolePermission { + /// ID of the permission group that this user role permission belongs to. + #[serde(rename="permissionGroupId")] + pub permission_group_id: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#userRolePermission". + pub kind: Option, + /// Levels of availability for a user role permission. + pub availability: Option, + /// ID of this user role permission. + pub id: Option, + /// Name of this user role permission. + pub name: Option, +} + +impl Resource for UserRolePermission {} +impl ResponseResult for UserRolePermission {} + + +/// Site Contact +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SiteContact { + /// First name of this site contact. + #[serde(rename="firstName")] + pub first_name: Option, + /// Title or designation of this site contact. + pub title: Option, + /// Last name of this site contact. + #[serde(rename="lastName")] + pub last_name: Option, + /// Site contact type. + #[serde(rename="contactType")] + pub contact_type: Option, + /// ID of this site contact. This is a read-only, auto-generated field. + pub id: Option, + /// Primary phone number of this site contact. + pub phone: Option, + /// Address of this site contact. + pub address: Option, + /// Email address of this site contact. This is a required field. + pub email: Option, +} + +impl Part for SiteContact {} + + +/// Creative Rotation. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeRotation { + /// Creative assignments in this creative rotation. + #[serde(rename="creativeAssignments")] + pub creative_assignments: Option>, + /// Strategy for calculating weights. Used with CREATIVE_ROTATION_TYPE_RANDOM. + #[serde(rename="weightCalculationStrategy")] + pub weight_calculation_strategy: Option, + /// Creative optimization configuration that is used by this ad. It should refer to one of the existing optimization configurations in the ad's campaign. If it is unset or set to 0, then the campaign's default optimization configuration will be used for this ad. + #[serde(rename="creativeOptimizationConfigurationId")] + pub creative_optimization_configuration_id: Option, + /// Type of creative rotation. Can be used to specify whether to use sequential or random rotation. + #[serde(rename="type")] + pub type_: Option, +} + +impl Part for CreativeRotation {} + + +/// Contains information about a metro region that can be targeted by ads. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list metros](struct.MetroListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Metro { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#metro". + pub kind: Option, + /// DART ID of the country to which this metro region belongs. + #[serde(rename="countryDartId")] + pub country_dart_id: Option, + /// Name of this metro region. + pub name: Option, + /// Country code of the country to which this metro region belongs. + #[serde(rename="countryCode")] + pub country_code: Option, + /// Metro code of this metro region. This is equivalent to dma_id. + #[serde(rename="metroCode")] + pub metro_code: Option, + /// DART ID of this metro region. + #[serde(rename="dartId")] + pub dart_id: Option, + /// DMA ID of this metro region. This is the ID used for targeting and generating reports, and is equivalent to metro_code. + #[serde(rename="dmaId")] + pub dma_id: Option, +} + +impl Resource for Metro {} + + +/// Contains information about a country that can be targeted by ads. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get countries](struct.CountryGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Country { + /// DART ID of this country. This is the ID used for targeting and generating reports. + #[serde(rename="dartId")] + pub dart_id: Option, + /// Whether ad serving supports secure servers in this country. + #[serde(rename="sslEnabled")] + pub ssl_enabled: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#country". + pub kind: Option, + /// Country code. + #[serde(rename="countryCode")] + pub country_code: Option, + /// Name of this country. + pub name: Option, +} + +impl ResponseResult for Country {} + + +/// Postal Code List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list postal codes](struct.PostalCodeListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PostalCodesListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#postalCodesListResponse". + pub kind: Option, + /// Postal code collection. + #[serde(rename="postalCodes")] + pub postal_codes: Option>, +} + +impl ResponseResult for PostalCodesListResponse {} + + +/// Video Format List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list video formats](struct.VideoFormatListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct VideoFormatsListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#videoFormatsListResponse". + pub kind: Option, + /// Video format collection. + #[serde(rename="videoFormats")] + pub video_formats: Option>, +} + +impl ResponseResult for VideoFormatsListResponse {} + + +/// Contains properties of a creative field. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list creative fields](struct.CreativeFieldListCall.html) (none) +/// * [update creative fields](struct.CreativeFieldUpdateCall.html) (request|response) +/// * [get creative fields](struct.CreativeFieldGetCall.html) (response) +/// * [insert creative fields](struct.CreativeFieldInsertCall.html) (request|response) +/// * [delete creative fields](struct.CreativeFieldDeleteCall.html) (none) +/// * [patch creative fields](struct.CreativeFieldPatchCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeField { + /// Advertiser ID of this creative field. This is a required field on insertion. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#creativeField". + pub kind: Option, + /// Subaccount ID of this creative field. This is a read-only field that can be left blank. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of this creative field. This is a required field and must be less than 256 characters long and unique among creative fields of the same advertiser. + pub name: Option, + /// Dimension value for the ID of the advertiser. This is a read-only, auto-generated field. + #[serde(rename="advertiserIdDimensionValue")] + pub advertiser_id_dimension_value: Option, + /// ID of this creative field. This is a read-only, auto-generated field. + pub id: Option, + /// Account ID of this creative field. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, +} + +impl RequestValue for CreativeField {} +impl Resource for CreativeField {} +impl ResponseResult for CreativeField {} + + +/// Creative Field Value List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list creative field values](struct.CreativeFieldValueListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeFieldValuesListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#creativeFieldValuesListResponse". + pub kind: Option, + /// Creative field value collection. + #[serde(rename="creativeFieldValues")] + pub creative_field_values: Option>, +} + +impl ResponseResult for CreativeFieldValuesListResponse {} + + +/// The properties of the report. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReportFloodlightCriteriaReportProperties { + /// Include conversions that have no associated cookies and no exposures. It’s therefore impossible to know how the user was exposed to your ads during the lookback window prior to a conversion. + #[serde(rename="includeUnattributedIPConversions")] + pub include_unattributed_ip_conversions: Option, + /// Include conversions of users with a DoubleClick cookie but without an exposure. That means the user did not click or see an ad from the advertiser within the Floodlight group, or that the interaction happened outside the lookback window. + #[serde(rename="includeUnattributedCookieConversions")] + pub include_unattributed_cookie_conversions: Option, + /// Include conversions that have no cookie, but do have an exposure path. + #[serde(rename="includeAttributedIPConversions")] + pub include_attributed_ip_conversions: Option, +} + +impl NestedType for ReportFloodlightCriteriaReportProperties {} +impl Part for ReportFloodlightCriteriaReportProperties {} + + +/// Insert Conversions Response. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [batchinsert conversions](struct.ConversionBatchinsertCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ConversionsBatchInsertResponse { + /// The status of each conversion's insertion status. The status is returned in the same order that conversions are inserted. + pub status: Option>, + /// Indicates that some or all conversions failed to insert. + #[serde(rename="hasFailures")] + pub has_failures: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#conversionsBatchInsertResponse". + pub kind: Option, +} + +impl ResponseResult for ConversionsBatchInsertResponse {} + + +/// Contains properties of a Site Directory contact. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get directory site contacts](struct.DirectorySiteContactGetCall.html) (response) +/// * [list directory site contacts](struct.DirectorySiteContactListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DirectorySiteContact { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#directorySiteContact". + pub kind: Option, + /// First name of this directory site contact. + #[serde(rename="firstName")] + pub first_name: Option, + /// Title or designation of this directory site contact. + pub title: Option, + /// Last name of this directory site contact. + #[serde(rename="lastName")] + pub last_name: Option, + /// ID of this directory site contact. This is a read-only, auto-generated field. + pub id: Option, + /// Phone number of this directory site contact. + pub phone: Option, + /// Directory site contact role. + pub role: Option, + /// Address of this directory site contact. + pub address: Option, + /// Directory site contact type. + #[serde(rename="type")] + pub type_: Option, + /// Email address of this directory site contact. + pub email: Option, +} + +impl Resource for DirectorySiteContact {} +impl ResponseResult for DirectorySiteContact {} + + +/// Represents a DimensionValue resource. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [query dimension values](struct.DimensionValueQueryCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DimensionValue { + /// The name of the dimension. + #[serde(rename="dimensionName")] + pub dimension_name: Option, + /// The kind of resource this is, in this case dfareporting#dimensionValue. + pub kind: Option, + /// The eTag of this response for caching purposes. + pub etag: Option, + /// Determines how the 'value' field is matched when filtering. If not specified, defaults to EXACT. If set to WILDCARD_EXPRESSION, '*' is allowed as a placeholder for variable length character sequences, and it can be escaped with a backslash. Note, only paid search dimensions ('dfa:paidSearch*') allow a matchType other than EXACT. + #[serde(rename="matchType")] + pub match_type: Option, + /// The ID associated with the value if available. + pub id: Option, + /// The value of the dimension. + pub value: Option, +} + +impl Resource for DimensionValue {} + + +/// Content Category List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list content categories](struct.ContentCategoryListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ContentCategoriesListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#contentCategoriesListResponse". + pub kind: Option, + /// Content category collection. + #[serde(rename="contentCategories")] + pub content_categories: Option>, +} + +impl ResponseResult for ContentCategoriesListResponse {} + + +/// Floodlight Configuration List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list floodlight configurations](struct.FloodlightConfigurationListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FloodlightConfigurationsListResponse { + /// Floodlight configuration collection. + #[serde(rename="floodlightConfigurations")] + pub floodlight_configurations: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#floodlightConfigurationsListResponse". + pub kind: Option, +} + +impl ResponseResult for FloodlightConfigurationsListResponse {} + + +/// Describes properties of a DoubleClick Planning order. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list orders](struct.OrderListCall.html) (none) +/// * [get orders](struct.OrderGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Order { + /// Terms and conditions of this order. + #[serde(rename="termsAndConditions")] + pub terms_and_conditions: Option, + /// Name of the buyer organization. + #[serde(rename="buyerOrganizationName")] + pub buyer_organization_name: Option, + /// Advertiser ID of this order. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Site IDs this order is associated with. + #[serde(rename="siteId")] + pub site_id: Option>, + /// Buyer invoice ID associated with this order. + #[serde(rename="buyerInvoiceId")] + pub buyer_invoice_id: Option, + /// ID of the terms and conditions template used in this order. + #[serde(rename="planningTermId")] + pub planning_term_id: Option, + /// ID of this order. This is a read-only, auto-generated field. + pub id: Option, + /// Account ID of this order. + #[serde(rename="accountId")] + pub account_id: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#order". + pub kind: Option, + /// Subaccount ID of this order. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of this order. + pub name: Option, + /// Contacts for this order. + pub contacts: Option>, + /// Information about the most recent modification of this order. + #[serde(rename="lastModifiedInfo")] + pub last_modified_info: Option, + /// Notes of this order. + pub notes: Option, + /// Name of the seller organization. + #[serde(rename="sellerOrganizationName")] + pub seller_organization_name: Option, + /// Comments in this order. + pub comments: Option, + /// IDs for users that have to approve documents created for this order. + #[serde(rename="approverUserProfileIds")] + pub approver_user_profile_ids: Option>, + /// Seller order ID associated with this order. + #[serde(rename="sellerOrderId")] + pub seller_order_id: Option, + /// Project ID of this order. + #[serde(rename="projectId")] + pub project_id: Option, + /// Free-form site names this order is associated with. + #[serde(rename="siteNames")] + pub site_names: Option>, +} + +impl Resource for Order {} +impl ResponseResult for Order {} + + +/// A custom floodlight variable. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CustomFloodlightVariable { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#customFloodlightVariable". + pub kind: Option, + /// The type of custom floodlight variable to supply a value for. These map to the "u[1-20]=" in the tags. + #[serde(rename="type")] + pub type_: Option, + /// The value of the custom floodlight variable. The length of string must not exceed 50 characters. + pub value: Option, +} + +impl Part for CustomFloodlightVariable {} + + +/// AccountPermissions contains information about a particular account permission. Some features of DCM require an account permission to be present in the account. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list account permissions](struct.AccountPermissionListCall.html) (none) +/// * [get account permissions](struct.AccountPermissionGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AccountPermission { + /// Permission group of this account permission. + #[serde(rename="permissionGroupId")] + pub permission_group_id: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#accountPermission". + pub kind: Option, + /// Name of this account permission. + pub name: Option, + /// Administrative level required to enable this account permission. + pub level: Option, + /// Account profiles associated with this account permission. + /// + /// Possible values are: + /// - "ACCOUNT_PROFILE_BASIC" + /// - "ACCOUNT_PROFILE_STANDARD" + #[serde(rename="accountProfiles")] + pub account_profiles: Option>, + /// ID of this account permission. + pub id: Option, +} + +impl Resource for AccountPermission {} +impl ResponseResult for AccountPermission {} + + +/// Contains properties of a DoubleClick Planning project. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get projects](struct.ProjectGetCall.html) (response) +/// * [list projects](struct.ProjectListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Project { + /// Start date of the project. + #[serde(rename="startDate")] + pub start_date: Option, + /// CPM that the advertiser is targeting. + #[serde(rename="targetCpmNanos")] + pub target_cpm_nanos: Option, + /// End date of the project. + #[serde(rename="endDate")] + pub end_date: Option, + /// Client billing code of this project. + #[serde(rename="clientBillingCode")] + pub client_billing_code: Option, + /// Overview of this project. + pub overview: Option, + /// Number of clicks that the advertiser is targeting. + #[serde(rename="targetClicks")] + pub target_clicks: Option, + /// CPA that the advertiser is targeting. + #[serde(rename="targetCpaNanos")] + pub target_cpa_nanos: Option, + /// Advertiser ID of this project. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Number of impressions that the advertiser is targeting. + #[serde(rename="targetImpressions")] + pub target_impressions: Option, + /// Subaccount ID of this project. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Audience gender of this project. + #[serde(rename="audienceGender")] + pub audience_gender: Option, + /// ID of this project. This is a read-only, auto-generated field. + pub id: Option, + /// Account ID of this project. + #[serde(rename="accountId")] + pub account_id: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#project". + pub kind: Option, + /// CPC that the advertiser is targeting. + #[serde(rename="targetCpcNanos")] + pub target_cpc_nanos: Option, + /// Name of this project. + pub name: Option, + /// vCPM from Active View that the advertiser is targeting. + #[serde(rename="targetCpmActiveViewNanos")] + pub target_cpm_active_view_nanos: Option, + /// Information about the most recent modification of this project. + #[serde(rename="lastModifiedInfo")] + pub last_modified_info: Option, + /// Budget of this project in the currency specified by the current account. The value stored in this field represents only the non-fractional amount. For example, for USD, the smallest value that can be represented by this field is 1 US dollar. + pub budget: Option, + /// Audience age group of this project. + #[serde(rename="audienceAgeGroup")] + pub audience_age_group: Option, + /// Number of conversions that the advertiser is targeting. + #[serde(rename="targetConversions")] + pub target_conversions: Option, + /// Name of the project client. + #[serde(rename="clientName")] + pub client_name: Option, +} + +impl Resource for Project {} +impl ResponseResult for Project {} + + +/// Popup Window Properties. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PopupWindowProperties { + /// Whether to display the browser status bar. + #[serde(rename="showStatusBar")] + pub show_status_bar: Option, + /// Whether to display the browser scroll bar. + #[serde(rename="showScrollBar")] + pub show_scroll_bar: Option, + /// Whether to display the browser address bar. + #[serde(rename="showAddressBar")] + pub show_address_bar: Option, + /// Whether to display the browser menu bar. + #[serde(rename="showMenuBar")] + pub show_menu_bar: Option, + /// Title of popup window. + pub title: Option, + /// Upper-left corner coordinates of the popup window. Applicable if positionType is COORDINATES. + pub offset: Option, + /// Popup window position either centered or at specific coordinate. + #[serde(rename="positionType")] + pub position_type: Option, + /// Whether to display the browser tool bar. + #[serde(rename="showToolBar")] + pub show_tool_bar: Option, + /// Popup dimension for a creative. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA and all VPAID + pub dimension: Option, +} + +impl Part for PopupWindowProperties {} + + +/// Contains properties of a DCM ad. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [patch ads](struct.AdPatchCall.html) (request|response) +/// * [list ads](struct.AdListCall.html) (none) +/// * [insert ads](struct.AdInsertCall.html) (request|response) +/// * [get ads](struct.AdGetCall.html) (response) +/// * [update ads](struct.AdUpdateCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Ad { + /// Click-through URL suffix properties for this ad. Applies to the URL in the ad or (if overriding ad properties) the URL in the creative. + #[serde(rename="clickThroughUrlSuffixProperties")] + pub click_through_url_suffix_properties: Option, + /// Campaign ID of this ad. This is a required field on insertion. + #[serde(rename="campaignId")] + pub campaign_id: Option, + /// Language targeting information for this ad. This field must be left blank if the ad is using a targeting template. Applicable when type is AD_SERVING_STANDARD_AD. + #[serde(rename="languageTargeting")] + pub language_targeting: Option, + /// Advertiser ID of this ad. This is a required field on insertion. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Geographical targeting information for this ad. This field must be left blank if the ad is using a targeting template. Applicable when type is AD_SERVING_STANDARD_AD. + #[serde(rename="geoTargeting")] + pub geo_targeting: Option, + /// Comments for this ad. + pub comments: Option, + /// Delivery schedule information for this ad. Applicable when type is AD_SERVING_STANDARD_AD or AD_SERVING_TRACKING. This field along with subfields priority and impressionRatio are required on insertion when type is AD_SERVING_STANDARD_AD. + #[serde(rename="deliverySchedule")] + pub delivery_schedule: Option, + /// Dimension value for the ID of the advertiser. This is a read-only, auto-generated field. + #[serde(rename="advertiserIdDimensionValue")] + pub advertiser_id_dimension_value: Option, + /// Event tag overrides for this ad. + #[serde(rename="eventTagOverrides")] + pub event_tag_overrides: Option>, + /// ID of this ad. This is a read-only, auto-generated field. + pub id: Option, + /// Size of this ad. Applicable when type is AD_SERVING_DEFAULT_AD. + pub size: Option, + /// Whether this ad is archived. When true, active must be false. + pub archived: Option, + /// Targeting template ID, used to apply preconfigured targeting information to this ad. This cannot be set while any of dayPartTargeting, geoTargeting, keyValueTargetingExpression, languageTargeting, remarketingListExpression, or technologyTargeting are set. Applicable when type is AD_SERVING_STANDARD_AD. + #[serde(rename="targetingTemplateId")] + pub targeting_template_id: Option, + /// Technology platform targeting information for this ad. This field must be left blank if the ad is using a targeting template. Applicable when type is AD_SERVING_STANDARD_AD. + #[serde(rename="technologyTargeting")] + pub technology_targeting: Option, + /// Creative rotation for this ad. Applicable when type is AD_SERVING_DEFAULT_AD, AD_SERVING_STANDARD_AD, or AD_SERVING_TRACKING. When type is AD_SERVING_DEFAULT_AD, this field should have exactly one creativeAssignment. + #[serde(rename="creativeRotation")] + pub creative_rotation: Option, + /// Click-through URL for this ad. This is a required field on insertion. Applicable when type is AD_SERVING_CLICK_TRACKER. + #[serde(rename="clickThroughUrl")] + pub click_through_url: Option, + /// Creative group assignments for this ad. Applicable when type is AD_SERVING_CLICK_TRACKER. Only one assignment per creative group number is allowed for a maximum of two assignments. + #[serde(rename="creativeGroupAssignments")] + pub creative_group_assignments: Option>, + /// Remarketing list targeting expression for this ad. This field must be left blank if the ad is using a targeting template. Applicable when type is AD_SERVING_STANDARD_AD. + #[serde(rename="remarketingListExpression")] + pub remarketing_list_expression: Option, + /// Dimension value for the ID of this ad. This is a read-only, auto-generated field. + #[serde(rename="idDimensionValue")] + pub id_dimension_value: Option, + /// Account ID of this ad. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, + /// Type of ad. This is a required field on insertion. Note that default ads (AD_SERVING_DEFAULT_AD) cannot be created directly (see Creative resource). + #[serde(rename="type")] + pub type_: Option, + /// Whether this ad requires ssl. This is a read-only field that is auto-generated when the ad is inserted or updated. + #[serde(rename="sslRequired")] + pub ssl_required: Option, + /// Audience segment ID that is being targeted for this ad. Applicable when type is AD_SERVING_STANDARD_AD. + #[serde(rename="audienceSegmentId")] + pub audience_segment_id: Option, + /// Key-value targeting information for this ad. This field must be left blank if the ad is using a targeting template. Applicable when type is AD_SERVING_STANDARD_AD. + #[serde(rename="keyValueTargetingExpression")] + pub key_value_targeting_expression: Option, + /// Dimension value for the ID of the campaign. This is a read-only, auto-generated field. + #[serde(rename="campaignIdDimensionValue")] + pub campaign_id_dimension_value: Option, + /// Default click-through event tag properties for this ad. + #[serde(rename="defaultClickThroughEventTagProperties")] + pub default_click_through_event_tag_properties: Option, + /// Information about the creation of this ad. This is a read-only field. + #[serde(rename="createInfo")] + pub create_info: Option, + /// Date and time that this ad should start serving. If creating an ad, this field must be a time in the future. This is a required field on insertion. + #[serde(rename="startTime")] + pub start_time: Option, + /// Whether this ad is active. When true, archived must be false. + pub active: Option, + /// Compatibility of this ad. Applicable when type is AD_SERVING_DEFAULT_AD. DISPLAY and DISPLAY_INTERSTITIAL refer to either rendering on desktop or on mobile devices or in mobile apps for regular or interstitial ads, respectively. APP and APP_INTERSTITIAL are only used for existing default ads. New mobile placements must be assigned DISPLAY or DISPLAY_INTERSTITIAL and default ads created for those placements will be limited to those compatibility types. IN_STREAM_VIDEO refers to rendering in-stream video ads developed with the VAST standard. + pub compatibility: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#ad". + pub kind: Option, + /// Subaccount ID of this ad. This is a read-only field that can be left blank. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of this ad. This is a required field and must be less than 256 characters long. + pub name: Option, + /// Time and day targeting information for this ad. This field must be left blank if the ad is using a targeting template. Applicable when type is AD_SERVING_STANDARD_AD. + #[serde(rename="dayPartTargeting")] + pub day_part_targeting: Option, + /// Information about the most recent modification of this ad. This is a read-only field. + #[serde(rename="lastModifiedInfo")] + pub last_modified_info: Option, + /// Whether this ad is ssl compliant. This is a read-only field that is auto-generated when the ad is inserted or updated. + #[serde(rename="sslCompliant")] + pub ssl_compliant: Option, + /// Date and time that this ad should stop serving. Must be later than the start time. This is a required field on insertion. + #[serde(rename="endTime")] + pub end_time: Option, + /// Whether this ad is a dynamic click tracker. Applicable when type is AD_SERVING_CLICK_TRACKER. This is a required field on insert, and is read-only after insert. + #[serde(rename="dynamicClickTracker")] + pub dynamic_click_tracker: Option, + /// Placement assignments for this ad. + #[serde(rename="placementAssignments")] + pub placement_assignments: Option>, +} + +impl RequestValue for Ad {} +impl Resource for Ad {} +impl ResponseResult for Ad {} + + +/// Pricing Period +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PricingSchedulePricingPeriod { + /// Units of this pricing period. + pub units: Option, + /// Pricing period start date. This date must be later than, or the same day as, the placement start date. The hours, minutes, and seconds of the start date should not be set, as doing so will result in an error. + #[serde(rename="startDate")] + pub start_date: Option, + /// Rate or cost of this pricing period. + #[serde(rename="rateOrCostNanos")] + pub rate_or_cost_nanos: Option, + /// Pricing period end date. This date must be later than, or the same day as, the pricing period start date, but not later than the placement end date. The period end date can be the same date as the period start date. If, for example, you set 6/25/2015 as both the start and end dates, the effective pricing period date is just that day only, 6/25/2015. The hours, minutes, and seconds of the end date should not be set, as doing so will result in an error. + #[serde(rename="endDate")] + pub end_date: Option, + /// Comments for this pricing period. + #[serde(rename="pricingComment")] + pub pricing_comment: Option, +} + +impl Part for PricingSchedulePricingPeriod {} + + +/// Contains properties of an event tag. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [delete event tags](struct.EventTagDeleteCall.html) (none) +/// * [patch event tags](struct.EventTagPatchCall.html) (request|response) +/// * [list event tags](struct.EventTagListCall.html) (none) +/// * [update event tags](struct.EventTagUpdateCall.html) (request|response) +/// * [insert event tags](struct.EventTagInsertCall.html) (request|response) +/// * [get event tags](struct.EventTagGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct EventTag { + /// Status of this event tag. Must be ENABLED for this event tag to fire. This is a required field. + pub status: Option, + /// Filter list of site IDs associated with this event tag. The siteFilterType determines whether this is a whitelist or blacklist filter. + #[serde(rename="siteIds")] + pub site_ids: Option>, + /// Campaign ID of this event tag. This field or the advertiserId field is required on insertion. + #[serde(rename="campaignId")] + pub campaign_id: Option, + /// Dimension value for the ID of the campaign. This is a read-only, auto-generated field. + #[serde(rename="campaignIdDimensionValue")] + pub campaign_id_dimension_value: Option, + /// Whether this event tag should be automatically enabled for all of the advertiser's campaigns and ads. + #[serde(rename="enabledByDefault")] + pub enabled_by_default: Option, + /// Advertiser ID of this event tag. This field or the campaignId field is required on insertion. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Site filter type for this event tag. If no type is specified then the event tag will be applied to all sites. + #[serde(rename="siteFilterType")] + pub site_filter_type: Option, + /// Event tag type. Can be used to specify whether to use a third-party pixel, a third-party JavaScript URL, or a third-party click-through URL for either impression or click tracking. This is a required field. + #[serde(rename="type")] + pub type_: Option, + /// Dimension value for the ID of the advertiser. This is a read-only, auto-generated field. + #[serde(rename="advertiserIdDimensionValue")] + pub advertiser_id_dimension_value: Option, + /// ID of this event tag. This is a read-only, auto-generated field. + pub id: Option, + /// Account ID of this event tag. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#eventTag". + pub kind: Option, + /// Subaccount ID of this event tag. This is a read-only field that can be left blank. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of this event tag. This is a required field and must be less than 256 characters long. + pub name: Option, + /// Payload URL for this event tag. The URL on a click-through event tag should have a landing page URL appended to the end of it. This field is required on insertion. + pub url: Option, + /// Whether this tag is SSL-compliant or not. This is a read-only field. + #[serde(rename="sslCompliant")] + pub ssl_compliant: Option, + /// Whether to remove this event tag from ads that are trafficked through DoubleClick Bid Manager to Ad Exchange. This may be useful if the event tag uses a pixel that is unapproved for Ad Exchange bids on one or more networks, such as the Google Display Network. + #[serde(rename="excludeFromAdxRequests")] + pub exclude_from_adx_requests: Option, + /// Number of times the landing page URL should be URL-escaped before being appended to the click-through event tag URL. Only applies to click-through event tags as specified by the event tag type. + #[serde(rename="urlEscapeLevels")] + pub url_escape_levels: Option, +} + +impl RequestValue for EventTag {} +impl Resource for EventTag {} +impl ResponseResult for EventTag {} + + +/// Placement Assignment. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PlacementAssignment { + /// Whether this placement assignment is active. When true, the placement will be included in the ad's rotation. + pub active: Option, + /// Dimension value for the ID of the placement. This is a read-only, auto-generated field. + #[serde(rename="placementIdDimensionValue")] + pub placement_id_dimension_value: Option, + /// ID of the placement to be assigned. This is a required field. + #[serde(rename="placementId")] + pub placement_id: Option, + /// Whether the placement to be assigned requires SSL. This is a read-only field that is auto-generated when the ad is inserted or updated. + #[serde(rename="sslRequired")] + pub ssl_required: Option, +} + +impl Part for PlacementAssignment {} + + +/// Represents fields that are compatible to be selected for a report of type "REACH". +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReachReportCompatibleFields { + /// Metrics which are compatible to be selected in the "metricNames" section of the report. + pub metrics: Option>, + /// The kind of resource this is, in this case dfareporting#reachReportCompatibleFields. + pub kind: Option, + /// Dimensions which are compatible to be selected in the "dimensions" section of the report. + pub dimensions: Option>, + /// Metrics which are compatible to be selected in the "reachByFrequencyMetricNames" section of the report. + #[serde(rename="reachByFrequencyMetrics")] + pub reach_by_frequency_metrics: Option>, + /// Dimensions which are compatible to be selected in the "dimensionFilters" section of the report. + #[serde(rename="dimensionFilters")] + pub dimension_filters: Option>, + /// Metrics which are compatible to be selected as activity metrics to pivot on in the "activities" section of the report. + #[serde(rename="pivotedActivityMetrics")] + pub pivoted_activity_metrics: Option>, +} + +impl Part for ReachReportCompatibleFields {} + + +/// Insert Conversions Request. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [batchinsert conversions](struct.ConversionBatchinsertCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ConversionsBatchInsertRequest { + /// The set of conversions to insert. + pub conversions: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#conversionsBatchInsertRequest". + pub kind: Option, + /// Describes how encryptedUserId or encryptedUserIdCandidates[] is encrypted. This is a required field if encryptedUserId or encryptedUserIdCandidates[] is used. + #[serde(rename="encryptionInfo")] + pub encryption_info: Option, +} + +impl RequestValue for ConversionsBatchInsertRequest {} + + +/// Contains properties of a site. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [update sites](struct.SiteUpdateCall.html) (request|response) +/// * [list sites](struct.SiteListCall.html) (none) +/// * [insert sites](struct.SiteInsertCall.html) (request|response) +/// * [get sites](struct.SiteGetCall.html) (response) +/// * [patch sites](struct.SitePatchCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Site { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#site". + pub kind: Option, + /// Subaccount ID of this site. This is a read-only field that can be left blank. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of this site.This is a required field. Must be less than 128 characters long. If this site is under a subaccount, the name must be unique among sites of the same subaccount. Otherwise, this site is a top-level site, and the name must be unique among top-level sites of the same account. + pub name: Option, + /// Dimension value for the ID of the directory site. This is a read-only, auto-generated field. + #[serde(rename="directorySiteIdDimensionValue")] + pub directory_site_id_dimension_value: Option, + /// Site-wide settings. + #[serde(rename="siteSettings")] + pub site_settings: Option, + /// ID of this site. This is a read-only, auto-generated field. + pub id: Option, + /// Directory site associated with this site. This is a required field that is read-only after insertion. + #[serde(rename="directorySiteId")] + pub directory_site_id: Option, + /// Site contacts. + #[serde(rename="siteContacts")] + pub site_contacts: Option>, + /// Key name of this site. This is a read-only, auto-generated field. + #[serde(rename="keyName")] + pub key_name: Option, + /// Dimension value for the ID of this site. This is a read-only, auto-generated field. + #[serde(rename="idDimensionValue")] + pub id_dimension_value: Option, + /// Whether this site is approved. + pub approved: Option, + /// Account ID of this site. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, +} + +impl RequestValue for Site {} +impl Resource for Site {} +impl ResponseResult for Site {} + + +/// DFP Settings +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DfpSettings { + /// DFP network name for this directory site. + pub dfp_network_name: Option, + /// DFP network code for this directory site. + pub dfp_network_code: Option, + /// Whether this directory site is available only via DoubleClick Publisher Portal. + #[serde(rename="publisherPortalOnly")] + pub publisher_portal_only: Option, + /// Whether this directory site accepts programmatic placements. + #[serde(rename="programmaticPlacementAccepted")] + pub programmatic_placement_accepted: Option, + /// Whether this directory site accepts publisher-paid tags. + #[serde(rename="pubPaidPlacementAccepted")] + pub pub_paid_placement_accepted: Option, +} + +impl Part for DfpSettings {} + + +/// Connection Type List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list connection types](struct.ConnectionTypeListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ConnectionTypesListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#connectionTypesListResponse". + pub kind: Option, + /// Collection of connection types such as broadband and mobile. + #[serde(rename="connectionTypes")] + pub connection_types: Option>, +} + +impl ResponseResult for ConnectionTypesListResponse {} + + +/// Contains properties of a Floodlight configuration. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get floodlight configurations](struct.FloodlightConfigurationGetCall.html) (response) +/// * [update floodlight configurations](struct.FloodlightConfigurationUpdateCall.html) (request|response) +/// * [patch floodlight configurations](struct.FloodlightConfigurationPatchCall.html) (request|response) +/// * [list floodlight configurations](struct.FloodlightConfigurationListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FloodlightConfiguration { + /// List of user defined variables enabled for this configuration. + #[serde(rename="userDefinedVariableConfigurations")] + pub user_defined_variable_configurations: Option>, + /// List of third-party authentication tokens enabled for this configuration. + #[serde(rename="thirdPartyAuthenticationTokens")] + pub third_party_authentication_tokens: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#floodlightConfiguration". + pub kind: Option, + /// Advertiser ID of the parent advertiser of this floodlight configuration. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Configuration settings for dynamic and image floodlight tags. + #[serde(rename="tagSettings")] + pub tag_settings: Option, + /// Whether in-app attribution tracking is enabled. + #[serde(rename="inAppAttributionTrackingEnabled")] + pub in_app_attribution_tracking_enabled: Option, + /// Dimension value for the ID of the advertiser. This is a read-only, auto-generated field. + #[serde(rename="advertiserIdDimensionValue")] + pub advertiser_id_dimension_value: Option, + /// Subaccount ID of this floodlight configuration. This is a read-only field that can be left blank. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// ID of this floodlight configuration. This is a read-only, auto-generated field. + pub id: Option, + /// Account ID of this floodlight configuration. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, + /// Types of attribution options for natural search conversions. + #[serde(rename="naturalSearchConversionAttributionOption")] + pub natural_search_conversion_attribution_option: Option, + /// Settings for DCM Omniture integration. + #[serde(rename="omnitureSettings")] + pub omniture_settings: Option, + /// Whether the exposure-to-conversion report is enabled. This report shows detailed pathway information on up to 10 of the most recent ad exposures seen by a user before converting. + #[serde(rename="exposureToConversionEnabled")] + pub exposure_to_conversion_enabled: Option, + /// Lookback window settings for this floodlight configuration. + #[serde(rename="lookbackConfiguration")] + pub lookback_configuration: Option, + /// Day that will be counted as the first day of the week in reports. This is a required field. + #[serde(rename="firstDayOfWeek")] + pub first_day_of_week: Option, + /// List of standard variables enabled for this configuration. + /// + /// Acceptable values are: + /// - "ORD" + /// - "NUM" + #[serde(rename="standardVariableTypes")] + pub standard_variable_types: Option>, + /// Whether advertiser data is shared with Google Analytics. + #[serde(rename="analyticsDataSharingEnabled")] + pub analytics_data_sharing_enabled: Option, + /// Dimension value for the ID of this floodlight configuration. This is a read-only, auto-generated field. + #[serde(rename="idDimensionValue")] + pub id_dimension_value: Option, +} + +impl RequestValue for FloodlightConfiguration {} +impl Resource for FloodlightConfiguration {} +impl ResponseResult for FloodlightConfiguration {} + + +/// Account Permission Group List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list account permission groups](struct.AccountPermissionGroupListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AccountPermissionGroupsListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#accountPermissionGroupsListResponse". + pub kind: Option, + /// Account permission group collection. + #[serde(rename="accountPermissionGroups")] + pub account_permission_groups: Option>, +} + +impl ResponseResult for AccountPermissionGroupsListResponse {} + + +/// Size List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list sizes](struct.SizeListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SizesListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#sizesListResponse". + pub kind: Option, + /// Size collection. + pub sizes: Option>, +} + +impl ResponseResult for SizesListResponse {} + + +/// User Role List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list user roles](struct.UserRoleListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UserRolesListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#userRolesListResponse". + pub kind: Option, + /// User role collection. + #[serde(rename="userRoles")] + pub user_roles: Option>, +} + +impl ResponseResult for UserRolesListResponse {} + + +/// Floodlight Activity List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list floodlight activities](struct.FloodlightActivityListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FloodlightActivitiesListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#floodlightActivitiesListResponse". + pub kind: Option, + /// Floodlight activity collection. + #[serde(rename="floodlightActivities")] + pub floodlight_activities: Option>, +} + +impl ResponseResult for FloodlightActivitiesListResponse {} + + +/// Contains properties of auser role, which is used to manage user access. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [insert user roles](struct.UserRoleInsertCall.html) (request|response) +/// * [update user roles](struct.UserRoleUpdateCall.html) (request|response) +/// * [delete user roles](struct.UserRoleDeleteCall.html) (none) +/// * [patch user roles](struct.UserRolePatchCall.html) (request|response) +/// * [list user roles](struct.UserRoleListCall.html) (none) +/// * [get user roles](struct.UserRoleGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UserRole { + /// Whether this is a default user role. Default user roles are created by the system for the account/subaccount and cannot be modified or deleted. Each default user role comes with a basic set of preassigned permissions. + #[serde(rename="defaultUserRole")] + pub default_user_role: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#userRole". + pub kind: Option, + /// Subaccount ID of this user role. This is a read-only field that can be left blank. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of this user role. This is a required field. Must be less than 256 characters long. If this user role is under a subaccount, the name must be unique among sites of the same subaccount. Otherwise, this user role is a top-level user role, and the name must be unique among top-level user roles of the same account. + pub name: Option, + /// ID of the user role that this user role is based on or copied from. This is a required field. + #[serde(rename="parentUserRoleId")] + pub parent_user_role_id: Option, + /// Account ID of this user role. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, + /// ID of this user role. This is a read-only, auto-generated field. + pub id: Option, + /// List of permissions associated with this user role. + pub permissions: Option>, +} + +impl RequestValue for UserRole {} +impl Resource for UserRole {} +impl ResponseResult for UserRole {} + + + +// ################### +// MethodBuilders ### +// ################# + +/// A builder providing access to all methods supported on *conversion* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `batchinsert(...)` +/// // to build up your call. +/// let rb = hub.conversions(); +/// # } +/// ``` +pub struct ConversionMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for ConversionMethods<'a, C, A> {} + +impl<'a, C, A> ConversionMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Inserts conversions. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn batchinsert(&self, request: ConversionsBatchInsertRequest, profile_id: &str) -> ConversionBatchinsertCall<'a, C, A> { + ConversionBatchinsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *userRolePermissionGroup* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.user_role_permission_groups(); +/// # } +/// ``` +pub struct UserRolePermissionGroupMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for UserRolePermissionGroupMethods<'a, C, A> {} + +impl<'a, C, A> UserRolePermissionGroupMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one user role permission group by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - User role permission group ID. + pub fn get(&self, profile_id: &str, id: &str) -> UserRolePermissionGroupGetCall<'a, C, A> { + UserRolePermissionGroupGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets a list of all supported user role permission groups. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> UserRolePermissionGroupListCall<'a, C, A> { + UserRolePermissionGroupListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *platformType* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.platform_types(); +/// # } +/// ``` +pub struct PlatformTypeMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for PlatformTypeMethods<'a, C, A> {} + +impl<'a, C, A> PlatformTypeMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one platform type by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Platform type ID. + pub fn get(&self, profile_id: &str, id: &str) -> PlatformTypeGetCall<'a, C, A> { + PlatformTypeGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of platform types. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> PlatformTypeListCall<'a, C, A> { + PlatformTypeListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *orderDocument* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.order_documents(); +/// # } +/// ``` +pub struct OrderDocumentMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for OrderDocumentMethods<'a, C, A> {} + +impl<'a, C, A> OrderDocumentMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one order document by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `projectId` - Project ID for order documents. + /// * `id` - Order document ID. + pub fn get(&self, profile_id: &str, project_id: &str, id: &str) -> OrderDocumentGetCall<'a, C, A> { + OrderDocumentGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _project_id: project_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of order documents, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `projectId` - Project ID for order documents. + pub fn list(&self, profile_id: &str, project_id: &str) -> OrderDocumentListCall<'a, C, A> { + OrderDocumentListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _project_id: project_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _site_id: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _order_id: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _approved: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *creativeField* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.creative_fields(); +/// # } +/// ``` +pub struct CreativeFieldMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for CreativeFieldMethods<'a, C, A> {} + +impl<'a, C, A> CreativeFieldMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing creative field. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: CreativeField, profile_id: &str) -> CreativeFieldUpdateCall<'a, C, A> { + CreativeFieldUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of creative fields, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> CreativeFieldListCall<'a, C, A> { + CreativeFieldListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _advertiser_ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes an existing creative field. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Creative Field ID + pub fn delete(&self, profile_id: &str, id: &str) -> CreativeFieldDeleteCall<'a, C, A> { + CreativeFieldDeleteCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one creative field by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Creative Field ID + pub fn get(&self, profile_id: &str, id: &str) -> CreativeFieldGetCall<'a, C, A> { + CreativeFieldGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new creative field. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: CreativeField, profile_id: &str) -> CreativeFieldInsertCall<'a, C, A> { + CreativeFieldInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing creative field. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Creative Field ID + pub fn patch(&self, request: CreativeField, profile_id: &str, id: &str) -> CreativeFieldPatchCall<'a, C, A> { + CreativeFieldPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *userRole* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.user_roles(); +/// # } +/// ``` +pub struct UserRoleMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for UserRoleMethods<'a, C, A> {} + +impl<'a, C, A> UserRoleMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new user role. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: UserRole, profile_id: &str) -> UserRoleInsertCall<'a, C, A> { + UserRoleInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one user role by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - User role ID. + pub fn get(&self, profile_id: &str, id: &str) -> UserRoleGetCall<'a, C, A> { + UserRoleGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing user role. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: UserRole, profile_id: &str) -> UserRoleUpdateCall<'a, C, A> { + UserRoleUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes an existing user role. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - User role ID. + pub fn delete(&self, profile_id: &str, id: &str) -> UserRoleDeleteCall<'a, C, A> { + UserRoleDeleteCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing user role. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - User role ID. + pub fn patch(&self, request: UserRole, profile_id: &str, id: &str) -> UserRolePatchCall<'a, C, A> { + UserRolePatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of user roles, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> UserRoleListCall<'a, C, A> { + UserRoleListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _subaccount_id: Default::default(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _account_user_role_only: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *operatingSystemVersion* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.operating_system_versions(); +/// # } +/// ``` +pub struct OperatingSystemVersionMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for OperatingSystemVersionMethods<'a, C, A> {} + +impl<'a, C, A> OperatingSystemVersionMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one operating system version by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Operating system version ID. + pub fn get(&self, profile_id: &str, id: &str) -> OperatingSystemVersionGetCall<'a, C, A> { + OperatingSystemVersionGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of operating system versions. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> OperatingSystemVersionListCall<'a, C, A> { + OperatingSystemVersionListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *landingPage* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.landing_pages(); +/// # } +/// ``` +pub struct LandingPageMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for LandingPageMethods<'a, C, A> {} + +impl<'a, C, A> LandingPageMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one campaign landing page by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `campaignId` - Landing page campaign ID. + /// * `id` - Landing page ID. + pub fn get(&self, profile_id: &str, campaign_id: &str, id: &str) -> LandingPageGetCall<'a, C, A> { + LandingPageGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _campaign_id: campaign_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing campaign landing page. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `campaignId` - Landing page campaign ID. + pub fn update(&self, request: LandingPage, profile_id: &str, campaign_id: &str) -> LandingPageUpdateCall<'a, C, A> { + LandingPageUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _campaign_id: campaign_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves the list of landing pages for the specified campaign. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `campaignId` - Landing page campaign ID. + pub fn list(&self, profile_id: &str, campaign_id: &str) -> LandingPageListCall<'a, C, A> { + LandingPageListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _campaign_id: campaign_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new landing page for the specified campaign. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `campaignId` - Landing page campaign ID. + pub fn insert(&self, request: LandingPage, profile_id: &str, campaign_id: &str) -> LandingPageInsertCall<'a, C, A> { + LandingPageInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _campaign_id: campaign_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing campaign landing page. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `campaignId` - Landing page campaign ID. + /// * `id` - Landing page ID. + pub fn patch(&self, request: LandingPage, profile_id: &str, campaign_id: &str, id: &str) -> LandingPagePatchCall<'a, C, A> { + LandingPagePatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _campaign_id: campaign_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes an existing campaign landing page. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `campaignId` - Landing page campaign ID. + /// * `id` - Landing page ID. + pub fn delete(&self, profile_id: &str, campaign_id: &str, id: &str) -> LandingPageDeleteCall<'a, C, A> { + LandingPageDeleteCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _campaign_id: campaign_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *creativeAsset* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `insert(...)` +/// // to build up your call. +/// let rb = hub.creative_assets(); +/// # } +/// ``` +pub struct CreativeAssetMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for CreativeAssetMethods<'a, C, A> {} + +impl<'a, C, A> CreativeAssetMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new creative asset. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `advertiserId` - Advertiser ID of this creative. This is a required field. + pub fn insert(&self, request: CreativeAssetMetadata, profile_id: &str, advertiser_id: &str) -> CreativeAssetInsertCall<'a, C, A> { + CreativeAssetInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _advertiser_id: advertiser_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *campaignCreativeAssociation* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `insert(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.campaign_creative_associations(); +/// # } +/// ``` +pub struct CampaignCreativeAssociationMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for CampaignCreativeAssociationMethods<'a, C, A> {} + +impl<'a, C, A> CampaignCreativeAssociationMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Associates a creative with the specified campaign. This method creates a default ad with dimensions matching the creative in the campaign if such a default ad does not exist already. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `campaignId` - Campaign ID in this association. + pub fn insert(&self, request: CampaignCreativeAssociation, profile_id: &str, campaign_id: &str) -> CampaignCreativeAssociationInsertCall<'a, C, A> { + CampaignCreativeAssociationInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _campaign_id: campaign_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves the list of creative IDs associated with the specified campaign. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `campaignId` - Campaign ID in this association. + pub fn list(&self, profile_id: &str, campaign_id: &str) -> CampaignCreativeAssociationListCall<'a, C, A> { + CampaignCreativeAssociationListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _campaign_id: campaign_id.to_string(), + _sort_order: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *changeLog* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.change_logs(); +/// # } +/// ``` +pub struct ChangeLogMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for ChangeLogMethods<'a, C, A> {} + +impl<'a, C, A> ChangeLogMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of change logs. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> ChangeLogListCall<'a, C, A> { + ChangeLogListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _user_profile_ids: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _object_type: Default::default(), + _object_ids: Default::default(), + _min_change_time: Default::default(), + _max_results: Default::default(), + _max_change_time: Default::default(), + _ids: Default::default(), + _action: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one change log by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Change log ID. + pub fn get(&self, profile_id: &str, id: &str) -> ChangeLogGetCall<'a, C, A> { + ChangeLogGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *remarketingListShare* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.remarketing_list_shares(); +/// # } +/// ``` +pub struct RemarketingListShareMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for RemarketingListShareMethods<'a, C, A> {} + +impl<'a, C, A> RemarketingListShareMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one remarketing list share by remarketing list ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `remarketingListId` - Remarketing list ID. + pub fn get(&self, profile_id: &str, remarketing_list_id: &str) -> RemarketingListShareGetCall<'a, C, A> { + RemarketingListShareGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _remarketing_list_id: remarketing_list_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing remarketing list share. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `remarketingListId` - Remarketing list ID. + pub fn patch(&self, request: RemarketingListShare, profile_id: &str, remarketing_list_id: &str) -> RemarketingListSharePatchCall<'a, C, A> { + RemarketingListSharePatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _remarketing_list_id: remarketing_list_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing remarketing list share. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: RemarketingListShare, profile_id: &str) -> RemarketingListShareUpdateCall<'a, C, A> { + RemarketingListShareUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *report* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `compatible_fields_query(...)`, `delete(...)`, `files_get(...)`, `files_list(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)`, `run(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.reports(); +/// # } +/// ``` +pub struct ReportMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for ReportMethods<'a, C, A> {} + +impl<'a, C, A> ReportMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Runs a report. + /// + /// # Arguments + /// + /// * `profileId` - The DFA profile ID. + /// * `reportId` - The ID of the report. + pub fn run(&self, profile_id: &str, report_id: &str) -> ReportRunCall<'a, C, A> { + ReportRunCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _report_id: report_id.to_string(), + _synchronous: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates a report. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - The DFA user profile ID. + /// * `reportId` - The ID of the report. + pub fn patch(&self, request: Report, profile_id: &str, report_id: &str) -> ReportPatchCall<'a, C, A> { + ReportPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _report_id: report_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists files for a report. + /// + /// # Arguments + /// + /// * `profileId` - The DFA profile ID. + /// * `reportId` - The ID of the parent report. + pub fn files_list(&self, profile_id: &str, report_id: &str) -> ReportFileListCall<'a, C, A> { + ReportFileListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _report_id: report_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a report. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - The DFA user profile ID. + pub fn insert(&self, request: Report, profile_id: &str) -> ReportInsertCall<'a, C, A> { + ReportInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Returns the fields that are compatible to be selected in the respective sections of a report criteria, given the fields already selected in the input report and user permissions. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - The DFA user profile ID. + pub fn compatible_fields_query(&self, request: Report, profile_id: &str) -> ReportCompatibleFieldQueryCall<'a, C, A> { + ReportCompatibleFieldQueryCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a report by its ID. + /// + /// # Arguments + /// + /// * `profileId` - The DFA user profile ID. + /// * `reportId` - The ID of the report. + pub fn get(&self, profile_id: &str, report_id: &str) -> ReportGetCall<'a, C, A> { + ReportGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _report_id: report_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a report file. + /// + /// # Arguments + /// + /// * `profileId` - The DFA profile ID. + /// * `reportId` - The ID of the report. + /// * `fileId` - The ID of the report file. + pub fn files_get(&self, profile_id: &str, report_id: &str, file_id: &str) -> ReportFileGetCall<'a, C, A> { + ReportFileGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _report_id: report_id.to_string(), + _file_id: file_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a report by its ID. + /// + /// # Arguments + /// + /// * `profileId` - The DFA user profile ID. + /// * `reportId` - The ID of the report. + pub fn delete(&self, profile_id: &str, report_id: &str) -> ReportDeleteCall<'a, C, A> { + ReportDeleteCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _report_id: report_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates a report. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - The DFA user profile ID. + /// * `reportId` - The ID of the report. + pub fn update(&self, request: Report, profile_id: &str, report_id: &str) -> ReportUpdateCall<'a, C, A> { + ReportUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _report_id: report_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves list of reports. + /// + /// # Arguments + /// + /// * `profileId` - The DFA user profile ID. + pub fn list(&self, profile_id: &str) -> ReportListCall<'a, C, A> { + ReportListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _scope: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *advertiser* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.advertisers(); +/// # } +/// ``` +pub struct AdvertiserMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for AdvertiserMethods<'a, C, A> {} + +impl<'a, C, A> AdvertiserMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new advertiser. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: Advertiser, profile_id: &str) -> AdvertiserInsertCall<'a, C, A> { + AdvertiserInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing advertiser. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Advertiser ID. + pub fn patch(&self, request: Advertiser, profile_id: &str, id: &str) -> AdvertiserPatchCall<'a, C, A> { + AdvertiserPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of advertisers, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> AdvertiserListCall<'a, C, A> { + AdvertiserListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _subaccount_id: Default::default(), + _status: Default::default(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _only_parent: Default::default(), + _max_results: Default::default(), + _include_advertisers_without_groups_only: Default::default(), + _ids: Default::default(), + _floodlight_configuration_ids: Default::default(), + _advertiser_group_ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing advertiser. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: Advertiser, profile_id: &str) -> AdvertiserUpdateCall<'a, C, A> { + AdvertiserUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one advertiser by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Advertiser ID. + pub fn get(&self, profile_id: &str, id: &str) -> AdvertiserGetCall<'a, C, A> { + AdvertiserGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *dimensionValue* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `query(...)` +/// // to build up your call. +/// let rb = hub.dimension_values(); +/// # } +/// ``` +pub struct DimensionValueMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for DimensionValueMethods<'a, C, A> {} + +impl<'a, C, A> DimensionValueMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves list of report dimension values for a list of filters. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - The DFA user profile ID. + pub fn query(&self, request: DimensionValueRequest, profile_id: &str) -> DimensionValueQueryCall<'a, C, A> { + DimensionValueQueryCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _page_token: Default::default(), + _max_results: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *floodlightActivityGroup* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.floodlight_activity_groups(); +/// # } +/// ``` +pub struct FloodlightActivityGroupMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for FloodlightActivityGroupMethods<'a, C, A> {} + +impl<'a, C, A> FloodlightActivityGroupMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one floodlight activity group by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Floodlight activity Group ID. + pub fn get(&self, profile_id: &str, id: &str) -> FloodlightActivityGroupGetCall<'a, C, A> { + FloodlightActivityGroupGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing floodlight activity group. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Floodlight activity Group ID. + pub fn patch(&self, request: FloodlightActivityGroup, profile_id: &str, id: &str) -> FloodlightActivityGroupPatchCall<'a, C, A> { + FloodlightActivityGroupPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of floodlight activity groups, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> FloodlightActivityGroupListCall<'a, C, A> { + FloodlightActivityGroupListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _type_: Default::default(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _floodlight_configuration_id: Default::default(), + _advertiser_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new floodlight activity group. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: FloodlightActivityGroup, profile_id: &str) -> FloodlightActivityGroupInsertCall<'a, C, A> { + FloodlightActivityGroupInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing floodlight activity group. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: FloodlightActivityGroup, profile_id: &str) -> FloodlightActivityGroupUpdateCall<'a, C, A> { + FloodlightActivityGroupUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *metro* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `list(...)` +/// // to build up your call. +/// let rb = hub.metros(); +/// # } +/// ``` +pub struct MetroMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for MetroMethods<'a, C, A> {} + +impl<'a, C, A> MetroMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of metros. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> MetroListCall<'a, C, A> { + MetroListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *order* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.orders(); +/// # } +/// ``` +pub struct OrderMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for OrderMethods<'a, C, A> {} + +impl<'a, C, A> OrderMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of orders, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `projectId` - Project ID for orders. + pub fn list(&self, profile_id: &str, project_id: &str) -> OrderListCall<'a, C, A> { + OrderListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _project_id: project_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _site_id: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one order by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `projectId` - Project ID for orders. + /// * `id` - Order ID. + pub fn get(&self, profile_id: &str, project_id: &str, id: &str) -> OrderGetCall<'a, C, A> { + OrderGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _project_id: project_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *language* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `list(...)` +/// // to build up your call. +/// let rb = hub.languages(); +/// # } +/// ``` +pub struct LanguageMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for LanguageMethods<'a, C, A> {} + +impl<'a, C, A> LanguageMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of languages. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> LanguageListCall<'a, C, A> { + LanguageListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *directorySiteContact* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.directory_site_contacts(); +/// # } +/// ``` +pub struct DirectorySiteContactMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for DirectorySiteContactMethods<'a, C, A> {} + +impl<'a, C, A> DirectorySiteContactMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one directory site contact by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Directory site contact ID. + pub fn get(&self, profile_id: &str, id: &str) -> DirectorySiteContactGetCall<'a, C, A> { + DirectorySiteContactGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of directory site contacts, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> DirectorySiteContactListCall<'a, C, A> { + DirectorySiteContactListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _directory_site_ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *userProfile* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.user_profiles(); +/// # } +/// ``` +pub struct UserProfileMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for UserProfileMethods<'a, C, A> {} + +impl<'a, C, A> UserProfileMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves list of user profiles for a user. + pub fn list(&self) -> UserProfileListCall<'a, C, A> { + UserProfileListCall { + hub: self.hub, + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one user profile by ID. + /// + /// # Arguments + /// + /// * `profileId` - The user profile ID. + pub fn get(&self, profile_id: &str) -> UserProfileGetCall<'a, C, A> { + UserProfileGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *ad* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.ads(); +/// # } +/// ``` +pub struct AdMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for AdMethods<'a, C, A> {} + +impl<'a, C, A> AdMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing ad. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Ad ID. + pub fn patch(&self, request: Ad, profile_id: &str, id: &str) -> AdPatchCall<'a, C, A> { + AdPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new ad. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: Ad, profile_id: &str) -> AdInsertCall<'a, C, A> { + AdInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of ads, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> AdListCall<'a, C, A> { + AdListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _type_: Default::default(), + _ssl_required: Default::default(), + _ssl_compliant: Default::default(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _size_ids: Default::default(), + _search_string: Default::default(), + _remarketing_list_ids: Default::default(), + _placement_ids: Default::default(), + _page_token: Default::default(), + _overridden_event_tag_id: Default::default(), + _max_results: Default::default(), + _landing_page_ids: Default::default(), + _ids: Default::default(), + _dynamic_click_tracker: Default::default(), + _creative_optimization_configuration_ids: Default::default(), + _creative_ids: Default::default(), + _compatibility: Default::default(), + _campaign_ids: Default::default(), + _audience_segment_ids: Default::default(), + _archived: Default::default(), + _advertiser_id: Default::default(), + _active: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one ad by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Ad ID. + pub fn get(&self, profile_id: &str, id: &str) -> AdGetCall<'a, C, A> { + AdGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing ad. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: Ad, profile_id: &str) -> AdUpdateCall<'a, C, A> { + AdUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *accountPermission* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.account_permissions(); +/// # } +/// ``` +pub struct AccountPermissionMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for AccountPermissionMethods<'a, C, A> {} + +impl<'a, C, A> AccountPermissionMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one account permission by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Account permission ID. + pub fn get(&self, profile_id: &str, id: &str) -> AccountPermissionGetCall<'a, C, A> { + AccountPermissionGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves the list of account permissions. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> AccountPermissionListCall<'a, C, A> { + AccountPermissionListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *connectionType* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.connection_types(); +/// # } +/// ``` +pub struct ConnectionTypeMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for ConnectionTypeMethods<'a, C, A> {} + +impl<'a, C, A> ConnectionTypeMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of connection types. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> ConnectionTypeListCall<'a, C, A> { + ConnectionTypeListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one connection type by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Connection type ID. + pub fn get(&self, profile_id: &str, id: &str) -> ConnectionTypeGetCall<'a, C, A> { + ConnectionTypeGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *targetableRemarketingList* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.targetable_remarketing_lists(); +/// # } +/// ``` +pub struct TargetableRemarketingListMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for TargetableRemarketingListMethods<'a, C, A> {} + +impl<'a, C, A> TargetableRemarketingListMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of targetable remarketing lists, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `advertiserId` - Select only targetable remarketing lists targetable by these advertisers. + pub fn list(&self, profile_id: &str, advertiser_id: &str) -> TargetableRemarketingListListCall<'a, C, A> { + TargetableRemarketingListListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _advertiser_id: advertiser_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _page_token: Default::default(), + _name: Default::default(), + _max_results: Default::default(), + _active: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one remarketing list by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Remarketing list ID. + pub fn get(&self, profile_id: &str, id: &str) -> TargetableRemarketingListGetCall<'a, C, A> { + TargetableRemarketingListGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *advertiserGroup* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.advertiser_groups(); +/// # } +/// ``` +pub struct AdvertiserGroupMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for AdvertiserGroupMethods<'a, C, A> {} + +impl<'a, C, A> AdvertiserGroupMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one advertiser group by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Advertiser group ID. + pub fn get(&self, profile_id: &str, id: &str) -> AdvertiserGroupGetCall<'a, C, A> { + AdvertiserGroupGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of advertiser groups, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> AdvertiserGroupListCall<'a, C, A> { + AdvertiserGroupListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new advertiser group. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: AdvertiserGroup, profile_id: &str) -> AdvertiserGroupInsertCall<'a, C, A> { + AdvertiserGroupInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing advertiser group. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: AdvertiserGroup, profile_id: &str) -> AdvertiserGroupUpdateCall<'a, C, A> { + AdvertiserGroupUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing advertiser group. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Advertiser group ID. + pub fn patch(&self, request: AdvertiserGroup, profile_id: &str, id: &str) -> AdvertiserGroupPatchCall<'a, C, A> { + AdvertiserGroupPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes an existing advertiser group. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Advertiser group ID. + pub fn delete(&self, profile_id: &str, id: &str) -> AdvertiserGroupDeleteCall<'a, C, A> { + AdvertiserGroupDeleteCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *site* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.sites(); +/// # } +/// ``` +pub struct SiteMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for SiteMethods<'a, C, A> {} + +impl<'a, C, A> SiteMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new site. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: Site, profile_id: &str) -> SiteInsertCall<'a, C, A> { + SiteInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one site by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Site ID. + pub fn get(&self, profile_id: &str, id: &str) -> SiteGetCall<'a, C, A> { + SiteGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of sites, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> SiteListCall<'a, C, A> { + SiteListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _unmapped_site: Default::default(), + _subaccount_id: Default::default(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _directory_site_ids: Default::default(), + _campaign_ids: Default::default(), + _approved: Default::default(), + _ad_words_site: Default::default(), + _accepts_publisher_paid_placements: Default::default(), + _accepts_interstitial_placements: Default::default(), + _accepts_in_stream_video_placements: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing site. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: Site, profile_id: &str) -> SiteUpdateCall<'a, C, A> { + SiteUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing site. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Site ID. + pub fn patch(&self, request: Site, profile_id: &str, id: &str) -> SitePatchCall<'a, C, A> { + SitePatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *floodlightActivity* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `delete(...)`, `generatetag(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.floodlight_activities(); +/// # } +/// ``` +pub struct FloodlightActivityMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for FloodlightActivityMethods<'a, C, A> {} + +impl<'a, C, A> FloodlightActivityMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one floodlight activity by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Floodlight activity ID. + pub fn get(&self, profile_id: &str, id: &str) -> FloodlightActivityGetCall<'a, C, A> { + FloodlightActivityGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of floodlight activities, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> FloodlightActivityListCall<'a, C, A> { + FloodlightActivityListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _tag_string: Default::default(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _floodlight_configuration_id: Default::default(), + _floodlight_activity_group_type: Default::default(), + _floodlight_activity_group_tag_string: Default::default(), + _floodlight_activity_group_name: Default::default(), + _floodlight_activity_group_ids: Default::default(), + _advertiser_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new floodlight activity. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: FloodlightActivity, profile_id: &str) -> FloodlightActivityInsertCall<'a, C, A> { + FloodlightActivityInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes an existing floodlight activity. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Floodlight activity ID. + pub fn delete(&self, profile_id: &str, id: &str) -> FloodlightActivityDeleteCall<'a, C, A> { + FloodlightActivityDeleteCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing floodlight activity. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Floodlight activity ID. + pub fn patch(&self, request: FloodlightActivity, profile_id: &str, id: &str) -> FloodlightActivityPatchCall<'a, C, A> { + FloodlightActivityPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Generates a tag for a floodlight activity. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn generatetag(&self, profile_id: &str) -> FloodlightActivityGeneratetagCall<'a, C, A> { + FloodlightActivityGeneratetagCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _floodlight_activity_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing floodlight activity. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: FloodlightActivity, profile_id: &str) -> FloodlightActivityUpdateCall<'a, C, A> { + FloodlightActivityUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *region* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `list(...)` +/// // to build up your call. +/// let rb = hub.regions(); +/// # } +/// ``` +pub struct RegionMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for RegionMethods<'a, C, A> {} + +impl<'a, C, A> RegionMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of regions. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> RegionListCall<'a, C, A> { + RegionListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *creativeGroup* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.creative_groups(); +/// # } +/// ``` +pub struct CreativeGroupMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for CreativeGroupMethods<'a, C, A> {} + +impl<'a, C, A> CreativeGroupMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new creative group. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: CreativeGroup, profile_id: &str) -> CreativeGroupInsertCall<'a, C, A> { + CreativeGroupInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one creative group by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Creative group ID. + pub fn get(&self, profile_id: &str, id: &str) -> CreativeGroupGetCall<'a, C, A> { + CreativeGroupGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing creative group. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: CreativeGroup, profile_id: &str) -> CreativeGroupUpdateCall<'a, C, A> { + CreativeGroupUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of creative groups, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> CreativeGroupListCall<'a, C, A> { + CreativeGroupListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _group_number: Default::default(), + _advertiser_ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing creative group. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Creative group ID. + pub fn patch(&self, request: CreativeGroup, profile_id: &str, id: &str) -> CreativeGroupPatchCall<'a, C, A> { + CreativeGroupPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *targetingTemplate* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.targeting_templates(); +/// # } +/// ``` +pub struct TargetingTemplateMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for TargetingTemplateMethods<'a, C, A> {} + +impl<'a, C, A> TargetingTemplateMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing targeting template. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Targeting template ID. + pub fn patch(&self, request: TargetingTemplate, profile_id: &str, id: &str) -> TargetingTemplatePatchCall<'a, C, A> { + TargetingTemplatePatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of targeting templates, optionally filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> TargetingTemplateListCall<'a, C, A> { + TargetingTemplateListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _advertiser_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one targeting template by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Targeting template ID. + pub fn get(&self, profile_id: &str, id: &str) -> TargetingTemplateGetCall<'a, C, A> { + TargetingTemplateGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new targeting template. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: TargetingTemplate, profile_id: &str) -> TargetingTemplateInsertCall<'a, C, A> { + TargetingTemplateInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing targeting template. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: TargetingTemplate, profile_id: &str) -> TargetingTemplateUpdateCall<'a, C, A> { + TargetingTemplateUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *subaccount* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.subaccounts(); +/// # } +/// ``` +pub struct SubaccountMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for SubaccountMethods<'a, C, A> {} + +impl<'a, C, A> SubaccountMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing subaccount. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Subaccount ID. + pub fn patch(&self, request: Subaccount, profile_id: &str, id: &str) -> SubaccountPatchCall<'a, C, A> { + SubaccountPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new subaccount. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: Subaccount, profile_id: &str) -> SubaccountInsertCall<'a, C, A> { + SubaccountInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing subaccount. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: Subaccount, profile_id: &str) -> SubaccountUpdateCall<'a, C, A> { + SubaccountUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets a list of subaccounts, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> SubaccountListCall<'a, C, A> { + SubaccountListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one subaccount by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Subaccount ID. + pub fn get(&self, profile_id: &str, id: &str) -> SubaccountGetCall<'a, C, A> { + SubaccountGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *mobileCarrier* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.mobile_carriers(); +/// # } +/// ``` +pub struct MobileCarrierMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for MobileCarrierMethods<'a, C, A> {} + +impl<'a, C, A> MobileCarrierMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one mobile carrier by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Mobile carrier ID. + pub fn get(&self, profile_id: &str, id: &str) -> MobileCarrierGetCall<'a, C, A> { + MobileCarrierGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of mobile carriers. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> MobileCarrierListCall<'a, C, A> { + MobileCarrierListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *floodlightConfiguration* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.floodlight_configurations(); +/// # } +/// ``` +pub struct FloodlightConfigurationMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for FloodlightConfigurationMethods<'a, C, A> {} + +impl<'a, C, A> FloodlightConfigurationMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one floodlight configuration by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Floodlight configuration ID. + pub fn get(&self, profile_id: &str, id: &str) -> FloodlightConfigurationGetCall<'a, C, A> { + FloodlightConfigurationGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing floodlight configuration. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: FloodlightConfiguration, profile_id: &str) -> FloodlightConfigurationUpdateCall<'a, C, A> { + FloodlightConfigurationUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing floodlight configuration. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Floodlight configuration ID. + pub fn patch(&self, request: FloodlightConfiguration, profile_id: &str, id: &str) -> FloodlightConfigurationPatchCall<'a, C, A> { + FloodlightConfigurationPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of floodlight configurations, possibly filtered. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> FloodlightConfigurationListCall<'a, C, A> { + FloodlightConfigurationListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *operatingSystem* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.operating_systems(); +/// # } +/// ``` +pub struct OperatingSystemMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for OperatingSystemMethods<'a, C, A> {} + +impl<'a, C, A> OperatingSystemMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of operating systems. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> OperatingSystemListCall<'a, C, A> { + OperatingSystemListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one operating system by DART ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `dartId` - Operating system DART ID. + pub fn get(&self, profile_id: &str, dart_id: &str) -> OperatingSystemGetCall<'a, C, A> { + OperatingSystemGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _dart_id: dart_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *file* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.files(); +/// # } +/// ``` +pub struct FileMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for FileMethods<'a, C, A> {} + +impl<'a, C, A> FileMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Lists files for a user profile. + /// + /// # Arguments + /// + /// * `profileId` - The DFA profile ID. + pub fn list(&self, profile_id: &str) -> FileListCall<'a, C, A> { + FileListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _scope: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a report file by its report ID and file ID. + /// + /// # Arguments + /// + /// * `reportId` - The ID of the report. + /// * `fileId` - The ID of the report file. + pub fn get(&self, report_id: &str, file_id: &str) -> FileGetCall<'a, C, A> { + FileGetCall { + hub: self.hub, + _report_id: report_id.to_string(), + _file_id: file_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *placementGroup* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.placement_groups(); +/// # } +/// ``` +pub struct PlacementGroupMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for PlacementGroupMethods<'a, C, A> {} + +impl<'a, C, A> PlacementGroupMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of placement groups, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> PlacementGroupListCall<'a, C, A> { + PlacementGroupListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _site_ids: Default::default(), + _search_string: Default::default(), + _pricing_types: Default::default(), + _placement_strategy_ids: Default::default(), + _placement_group_type: Default::default(), + _page_token: Default::default(), + _min_start_date: Default::default(), + _min_end_date: Default::default(), + _max_start_date: Default::default(), + _max_results: Default::default(), + _max_end_date: Default::default(), + _ids: Default::default(), + _directory_site_ids: Default::default(), + _content_category_ids: Default::default(), + _campaign_ids: Default::default(), + _archived: Default::default(), + _advertiser_ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing placement group. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: PlacementGroup, profile_id: &str) -> PlacementGroupUpdateCall<'a, C, A> { + PlacementGroupUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new placement group. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: PlacementGroup, profile_id: &str) -> PlacementGroupInsertCall<'a, C, A> { + PlacementGroupInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one placement group by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Placement group ID. + pub fn get(&self, profile_id: &str, id: &str) -> PlacementGroupGetCall<'a, C, A> { + PlacementGroupGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing placement group. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Placement group ID. + pub fn patch(&self, request: PlacementGroup, profile_id: &str, id: &str) -> PlacementGroupPatchCall<'a, C, A> { + PlacementGroupPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *inventoryItem* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.inventory_items(); +/// # } +/// ``` +pub struct InventoryItemMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for InventoryItemMethods<'a, C, A> {} + +impl<'a, C, A> InventoryItemMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of inventory items, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `projectId` - Project ID for order documents. + pub fn list(&self, profile_id: &str, project_id: &str) -> InventoryItemListCall<'a, C, A> { + InventoryItemListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _project_id: project_id.to_string(), + _type_: Default::default(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _site_id: Default::default(), + _page_token: Default::default(), + _order_id: Default::default(), + _max_results: Default::default(), + _in_plan: Default::default(), + _ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one inventory item by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `projectId` - Project ID for order documents. + /// * `id` - Inventory item ID. + pub fn get(&self, profile_id: &str, project_id: &str, id: &str) -> InventoryItemGetCall<'a, C, A> { + InventoryItemGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _project_id: project_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *userRolePermission* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.user_role_permissions(); +/// # } +/// ``` +pub struct UserRolePermissionMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for UserRolePermissionMethods<'a, C, A> {} + +impl<'a, C, A> UserRolePermissionMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one user role permission by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - User role permission ID. + pub fn get(&self, profile_id: &str, id: &str) -> UserRolePermissionGetCall<'a, C, A> { + UserRolePermissionGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets a list of user role permissions, possibly filtered. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> UserRolePermissionListCall<'a, C, A> { + UserRolePermissionListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *accountPermissionGroup* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.account_permission_groups(); +/// # } +/// ``` +pub struct AccountPermissionGroupMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for AccountPermissionGroupMethods<'a, C, A> {} + +impl<'a, C, A> AccountPermissionGroupMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves the list of account permission groups. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> AccountPermissionGroupListCall<'a, C, A> { + AccountPermissionGroupListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one account permission group by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Account permission group ID. + pub fn get(&self, profile_id: &str, id: &str) -> AccountPermissionGroupGetCall<'a, C, A> { + AccountPermissionGroupGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *contentCategory* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.content_categories(); +/// # } +/// ``` +pub struct ContentCategoryMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for ContentCategoryMethods<'a, C, A> {} + +impl<'a, C, A> ContentCategoryMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of content categories, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> ContentCategoryListCall<'a, C, A> { + ContentCategoryListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing content category. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: ContentCategory, profile_id: &str) -> ContentCategoryUpdateCall<'a, C, A> { + ContentCategoryUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new content category. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: ContentCategory, profile_id: &str) -> ContentCategoryInsertCall<'a, C, A> { + ContentCategoryInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes an existing content category. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Content category ID. + pub fn delete(&self, profile_id: &str, id: &str) -> ContentCategoryDeleteCall<'a, C, A> { + ContentCategoryDeleteCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one content category by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Content category ID. + pub fn get(&self, profile_id: &str, id: &str) -> ContentCategoryGetCall<'a, C, A> { + ContentCategoryGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing content category. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Content category ID. + pub fn patch(&self, request: ContentCategory, profile_id: &str, id: &str) -> ContentCategoryPatchCall<'a, C, A> { + ContentCategoryPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *creative* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.creatives(); +/// # } +/// ``` +pub struct CreativeMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for CreativeMethods<'a, C, A> {} + +impl<'a, C, A> CreativeMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing creative. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: Creative, profile_id: &str) -> CreativeUpdateCall<'a, C, A> { + CreativeUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new creative. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: Creative, profile_id: &str) -> CreativeInsertCall<'a, C, A> { + CreativeInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one creative by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Creative ID. + pub fn get(&self, profile_id: &str, id: &str) -> CreativeGetCall<'a, C, A> { + CreativeGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of creatives, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> CreativeListCall<'a, C, A> { + CreativeListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _types: Default::default(), + _studio_creative_id: Default::default(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _size_ids: Default::default(), + _search_string: Default::default(), + _rendering_ids: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _creative_field_ids: Default::default(), + _companion_creative_ids: Default::default(), + _campaign_id: Default::default(), + _archived: Default::default(), + _advertiser_id: Default::default(), + _active: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing creative. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Creative ID. + pub fn patch(&self, request: Creative, profile_id: &str, id: &str) -> CreativePatchCall<'a, C, A> { + CreativePatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *campaign* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.campaigns(); +/// # } +/// ``` +pub struct CampaignMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for CampaignMethods<'a, C, A> {} + +impl<'a, C, A> CampaignMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one campaign by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Campaign ID. + pub fn get(&self, profile_id: &str, id: &str) -> CampaignGetCall<'a, C, A> { + CampaignGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new campaign. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `defaultLandingPageName` - Default landing page name for this new campaign. Must be less than 256 characters long. + /// * `defaultLandingPageUrl` - Default landing page URL for this new campaign. + pub fn insert(&self, request: Campaign, profile_id: &str, default_landing_page_name: &str, default_landing_page_url: &str) -> CampaignInsertCall<'a, C, A> { + CampaignInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _default_landing_page_name: default_landing_page_name.to_string(), + _default_landing_page_url: default_landing_page_url.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing campaign. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Campaign ID. + pub fn patch(&self, request: Campaign, profile_id: &str, id: &str) -> CampaignPatchCall<'a, C, A> { + CampaignPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing campaign. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: Campaign, profile_id: &str) -> CampaignUpdateCall<'a, C, A> { + CampaignUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of campaigns, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> CampaignListCall<'a, C, A> { + CampaignListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _subaccount_id: Default::default(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _overridden_event_tag_id: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _excluded_ids: Default::default(), + _at_least_one_optimization_activity: Default::default(), + _archived: Default::default(), + _advertiser_ids: Default::default(), + _advertiser_group_ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *eventTag* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.event_tags(); +/// # } +/// ``` +pub struct EventTagMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for EventTagMethods<'a, C, A> {} + +impl<'a, C, A> EventTagMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Deletes an existing event tag. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Event tag ID. + pub fn delete(&self, profile_id: &str, id: &str) -> EventTagDeleteCall<'a, C, A> { + EventTagDeleteCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of event tags, possibly filtered. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> EventTagListCall<'a, C, A> { + EventTagListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _ids: Default::default(), + _event_tag_types: Default::default(), + _enabled: Default::default(), + _definitions_only: Default::default(), + _campaign_id: Default::default(), + _advertiser_id: Default::default(), + _ad_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new event tag. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: EventTag, profile_id: &str) -> EventTagInsertCall<'a, C, A> { + EventTagInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing event tag. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Event tag ID. + pub fn patch(&self, request: EventTag, profile_id: &str, id: &str) -> EventTagPatchCall<'a, C, A> { + EventTagPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing event tag. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: EventTag, profile_id: &str) -> EventTagUpdateCall<'a, C, A> { + EventTagUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one event tag by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Event tag ID. + pub fn get(&self, profile_id: &str, id: &str) -> EventTagGetCall<'a, C, A> { + EventTagGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *remarketingList* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.remarketing_lists(); +/// # } +/// ``` +pub struct RemarketingListMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for RemarketingListMethods<'a, C, A> {} + +impl<'a, C, A> RemarketingListMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one remarketing list by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Remarketing list ID. + pub fn get(&self, profile_id: &str, id: &str) -> RemarketingListGetCall<'a, C, A> { + RemarketingListGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing remarketing list. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: RemarketingList, profile_id: &str) -> RemarketingListUpdateCall<'a, C, A> { + RemarketingListUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of remarketing lists, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `advertiserId` - Select only remarketing lists owned by this advertiser. + pub fn list(&self, profile_id: &str, advertiser_id: &str) -> RemarketingListListCall<'a, C, A> { + RemarketingListListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _advertiser_id: advertiser_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _page_token: Default::default(), + _name: Default::default(), + _max_results: Default::default(), + _floodlight_activity_id: Default::default(), + _active: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing remarketing list. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Remarketing list ID. + pub fn patch(&self, request: RemarketingList, profile_id: &str, id: &str) -> RemarketingListPatchCall<'a, C, A> { + RemarketingListPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new remarketing list. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: RemarketingList, profile_id: &str) -> RemarketingListInsertCall<'a, C, A> { + RemarketingListInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *city* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `list(...)` +/// // to build up your call. +/// let rb = hub.cities(); +/// # } +/// ``` +pub struct CityMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for CityMethods<'a, C, A> {} + +impl<'a, C, A> CityMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of cities, possibly filtered. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> CityListCall<'a, C, A> { + CityListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _region_dart_ids: Default::default(), + _name_prefix: Default::default(), + _dart_ids: Default::default(), + _country_dart_ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *placementStrategy* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.placement_strategies(); +/// # } +/// ``` +pub struct PlacementStrategyMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for PlacementStrategyMethods<'a, C, A> {} + +impl<'a, C, A> PlacementStrategyMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing placement strategy. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: PlacementStrategy, profile_id: &str) -> PlacementStrategyUpdateCall<'a, C, A> { + PlacementStrategyUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one placement strategy by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Placement strategy ID. + pub fn get(&self, profile_id: &str, id: &str) -> PlacementStrategyGetCall<'a, C, A> { + PlacementStrategyGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of placement strategies, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> PlacementStrategyListCall<'a, C, A> { + PlacementStrategyListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes an existing placement strategy. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Placement strategy ID. + pub fn delete(&self, profile_id: &str, id: &str) -> PlacementStrategyDeleteCall<'a, C, A> { + PlacementStrategyDeleteCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new placement strategy. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: PlacementStrategy, profile_id: &str) -> PlacementStrategyInsertCall<'a, C, A> { + PlacementStrategyInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing placement strategy. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Placement strategy ID. + pub fn patch(&self, request: PlacementStrategy, profile_id: &str, id: &str) -> PlacementStrategyPatchCall<'a, C, A> { + PlacementStrategyPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *project* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.projects(); +/// # } +/// ``` +pub struct ProjectMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for ProjectMethods<'a, C, A> {} + +impl<'a, C, A> ProjectMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of projects, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> ProjectListCall<'a, C, A> { + ProjectListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _advertiser_ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one project by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Project ID. + pub fn get(&self, profile_id: &str, id: &str) -> ProjectGetCall<'a, C, A> { + ProjectGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *directorySite* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `insert(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.directory_sites(); +/// # } +/// ``` +pub struct DirectorySiteMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for DirectorySiteMethods<'a, C, A> {} + +impl<'a, C, A> DirectorySiteMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new directory site. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: DirectorySite, profile_id: &str) -> DirectorySiteInsertCall<'a, C, A> { + DirectorySiteInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of directory sites, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> DirectorySiteListCall<'a, C, A> { + DirectorySiteListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _parent_id: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _dfp_network_code: Default::default(), + _country_id: Default::default(), + _active: Default::default(), + _accepts_publisher_paid_placements: Default::default(), + _accepts_interstitial_placements: Default::default(), + _accepts_in_stream_video_placements: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one directory site by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Directory site ID. + pub fn get(&self, profile_id: &str, id: &str) -> DirectorySiteGetCall<'a, C, A> { + DirectorySiteGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *videoFormat* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.video_formats(); +/// # } +/// ``` +pub struct VideoFormatMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for VideoFormatMethods<'a, C, A> {} + +impl<'a, C, A> VideoFormatMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one video format by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Video format ID. + pub fn get(&self, profile_id: &str, id: i32) -> VideoFormatGetCall<'a, C, A> { + VideoFormatGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id, + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists available video formats. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> VideoFormatListCall<'a, C, A> { + VideoFormatListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *dynamicTargetingKey* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `delete(...)`, `insert(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.dynamic_targeting_keys(); +/// # } +/// ``` +pub struct DynamicTargetingKeyMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for DynamicTargetingKeyMethods<'a, C, A> {} + +impl<'a, C, A> DynamicTargetingKeyMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Deletes an existing dynamic targeting key. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `objectId` - ID of the object of this dynamic targeting key. This is a required field. + /// * `name` - Name of this dynamic targeting key. This is a required field. Must be less than 256 characters long and cannot contain commas. All characters are converted to lowercase. + /// * `objectType` - Type of the object of this dynamic targeting key. This is a required field. + pub fn delete(&self, profile_id: &str, object_id: &str, name: &str, object_type: &str) -> DynamicTargetingKeyDeleteCall<'a, C, A> { + DynamicTargetingKeyDeleteCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _object_id: object_id.to_string(), + _name: name.to_string(), + _object_type: object_type.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of dynamic targeting keys. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> DynamicTargetingKeyListCall<'a, C, A> { + DynamicTargetingKeyListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _object_type: Default::default(), + _object_id: Default::default(), + _names: Default::default(), + _advertiser_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new dynamic targeting key. Keys must be created at the advertiser level before being assigned to the advertiser's ads, creatives, or placements. There is a maximum of 1000 keys per advertiser, out of which a maximum of 20 keys can be assigned per ad, creative, or placement. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: DynamicTargetingKey, profile_id: &str) -> DynamicTargetingKeyInsertCall<'a, C, A> { + DynamicTargetingKeyInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *size* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `insert(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.sizes(); +/// # } +/// ``` +pub struct SizeMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for SizeMethods<'a, C, A> {} + +impl<'a, C, A> SizeMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new size. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: Size, profile_id: &str) -> SizeInsertCall<'a, C, A> { + SizeInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of sizes, possibly filtered. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> SizeListCall<'a, C, A> { + SizeListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _width: Default::default(), + _ids: Default::default(), + _iab_standard: Default::default(), + _height: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one size by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Size ID. + pub fn get(&self, profile_id: &str, id: &str) -> SizeGetCall<'a, C, A> { + SizeGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *accountActiveAdSummary* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` +/// // to build up your call. +/// let rb = hub.account_active_ad_summaries(); +/// # } +/// ``` +pub struct AccountActiveAdSummaryMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for AccountActiveAdSummaryMethods<'a, C, A> {} + +impl<'a, C, A> AccountActiveAdSummaryMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets the account's active ad summary by account ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `summaryAccountId` - Account ID. + pub fn get(&self, profile_id: &str, summary_account_id: &str) -> AccountActiveAdSummaryGetCall<'a, C, A> { + AccountActiveAdSummaryGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _summary_account_id: summary_account_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *accountUserProfile* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.account_user_profiles(); +/// # } +/// ``` +pub struct AccountUserProfileMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for AccountUserProfileMethods<'a, C, A> {} + +impl<'a, C, A> AccountUserProfileMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing account user profile. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: AccountUserProfile, profile_id: &str) -> AccountUserProfileUpdateCall<'a, C, A> { + AccountUserProfileUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of account user profiles, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> AccountUserProfileListCall<'a, C, A> { + AccountUserProfileListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _user_role_id: Default::default(), + _subaccount_id: Default::default(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _active: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new account user profile. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: AccountUserProfile, profile_id: &str) -> AccountUserProfileInsertCall<'a, C, A> { + AccountUserProfileInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing account user profile. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - User profile ID. + pub fn patch(&self, request: AccountUserProfile, profile_id: &str, id: &str) -> AccountUserProfilePatchCall<'a, C, A> { + AccountUserProfilePatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one account user profile by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - User profile ID. + pub fn get(&self, profile_id: &str, id: &str) -> AccountUserProfileGetCall<'a, C, A> { + AccountUserProfileGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *country* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.countries(); +/// # } +/// ``` +pub struct CountryMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for CountryMethods<'a, C, A> {} + +impl<'a, C, A> CountryMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of countries. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> CountryListCall<'a, C, A> { + CountryListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one country by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `dartId` - Country DART ID. + pub fn get(&self, profile_id: &str, dart_id: &str) -> CountryGetCall<'a, C, A> { + CountryGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _dart_id: dart_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *creativeFieldValue* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.creative_field_values(); +/// # } +/// ``` +pub struct CreativeFieldValueMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for CreativeFieldValueMethods<'a, C, A> {} + +impl<'a, C, A> CreativeFieldValueMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing creative field value. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `creativeFieldId` - Creative field ID for this creative field value. + /// * `id` - Creative Field Value ID + pub fn patch(&self, request: CreativeFieldValue, profile_id: &str, creative_field_id: &str, id: &str) -> CreativeFieldValuePatchCall<'a, C, A> { + CreativeFieldValuePatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _creative_field_id: creative_field_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one creative field value by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `creativeFieldId` - Creative field ID for this creative field value. + /// * `id` - Creative Field Value ID + pub fn get(&self, profile_id: &str, creative_field_id: &str, id: &str) -> CreativeFieldValueGetCall<'a, C, A> { + CreativeFieldValueGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _creative_field_id: creative_field_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes an existing creative field value. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `creativeFieldId` - Creative field ID for this creative field value. + /// * `id` - Creative Field Value ID + pub fn delete(&self, profile_id: &str, creative_field_id: &str, id: &str) -> CreativeFieldValueDeleteCall<'a, C, A> { + CreativeFieldValueDeleteCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _creative_field_id: creative_field_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new creative field value. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `creativeFieldId` - Creative field ID for this creative field value. + pub fn insert(&self, request: CreativeFieldValue, profile_id: &str, creative_field_id: &str) -> CreativeFieldValueInsertCall<'a, C, A> { + CreativeFieldValueInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _creative_field_id: creative_field_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing creative field value. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `creativeFieldId` - Creative field ID for this creative field value. + pub fn update(&self, request: CreativeFieldValue, profile_id: &str, creative_field_id: &str) -> CreativeFieldValueUpdateCall<'a, C, A> { + CreativeFieldValueUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _creative_field_id: creative_field_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of creative field values, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `creativeFieldId` - Creative field ID for this creative field value. + pub fn list(&self, profile_id: &str, creative_field_id: &str) -> CreativeFieldValueListCall<'a, C, A> { + CreativeFieldValueListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _creative_field_id: creative_field_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *postalCode* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.postal_codes(); +/// # } +/// ``` +pub struct PostalCodeMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for PostalCodeMethods<'a, C, A> {} + +impl<'a, C, A> PostalCodeMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one postal code by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `code` - Postal code ID. + pub fn get(&self, profile_id: &str, code: &str) -> PostalCodeGetCall<'a, C, A> { + PostalCodeGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _code: code.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of postal codes. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> PostalCodeListCall<'a, C, A> { + PostalCodeListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *browser* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `list(...)` +/// // to build up your call. +/// let rb = hub.browsers(); +/// # } +/// ``` +pub struct BrowserMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for BrowserMethods<'a, C, A> {} + +impl<'a, C, A> BrowserMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of browsers. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> BrowserListCall<'a, C, A> { + BrowserListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *account* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.accounts(); +/// # } +/// ``` +pub struct AccountMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for AccountMethods<'a, C, A> {} + +impl<'a, C, A> AccountMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one account by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Account ID. + pub fn get(&self, profile_id: &str, id: &str) -> AccountGetCall<'a, C, A> { + AccountGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves the list of accounts, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> AccountListCall<'a, C, A> { + AccountListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _active: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing account. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: Account, profile_id: &str) -> AccountUpdateCall<'a, C, A> { + AccountUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing account. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Account ID. + pub fn patch(&self, request: Account, profile_id: &str, id: &str) -> AccountPatchCall<'a, C, A> { + AccountPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *placement* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d7 as dfareporting2d7; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d7::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `generatetags(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.placements(); +/// # } +/// ``` +pub struct PlacementMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for PlacementMethods<'a, C, A> {} + +impl<'a, C, A> PlacementMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing placement. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Placement ID. + pub fn patch(&self, request: Placement, profile_id: &str, id: &str) -> PlacementPatchCall<'a, C, A> { + PlacementPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of placements, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> PlacementListCall<'a, C, A> { + PlacementListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _size_ids: Default::default(), + _site_ids: Default::default(), + _search_string: Default::default(), + _pricing_types: Default::default(), + _placement_strategy_ids: Default::default(), + _payment_source: Default::default(), + _page_token: Default::default(), + _min_start_date: Default::default(), + _min_end_date: Default::default(), + _max_start_date: Default::default(), + _max_results: Default::default(), + _max_end_date: Default::default(), + _ids: Default::default(), + _group_ids: Default::default(), + _directory_site_ids: Default::default(), + _content_category_ids: Default::default(), + _compatibilities: Default::default(), + _campaign_ids: Default::default(), + _archived: Default::default(), + _advertiser_ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one placement by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Placement ID. + pub fn get(&self, profile_id: &str, id: &str) -> PlacementGetCall<'a, C, A> { + PlacementGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new placement. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: Placement, profile_id: &str) -> PlacementInsertCall<'a, C, A> { + PlacementInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing placement. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: Placement, profile_id: &str) -> PlacementUpdateCall<'a, C, A> { + PlacementUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Generates tags for a placement. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn generatetags(&self, profile_id: &str) -> PlacementGeneratetagCall<'a, C, A> { + PlacementGeneratetagCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _tag_formats: Default::default(), + _placement_ids: Default::default(), + _campaign_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + + + +// ################### +// CallBuilders ### +// ################# + +/// Inserts conversions. +/// +/// A builder for the *batchinsert* method supported by a *conversion* resource. +/// It is not used directly, but through a `ConversionMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::ConversionsBatchInsertRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ConversionsBatchInsertRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.conversions().batchinsert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct ConversionBatchinsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: ConversionsBatchInsertRequest, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ConversionBatchinsertCall<'a, C, A> {} + +impl<'a, C, A> ConversionBatchinsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ConversionsBatchInsertResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.conversions.batchinsert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/conversions/batchinsert".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Ddmconversion.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ConversionsBatchInsertRequest) -> ConversionBatchinsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ConversionBatchinsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ConversionBatchinsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ConversionBatchinsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Ddmconversion`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ConversionBatchinsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one user role permission group by ID. +/// +/// A builder for the *get* method supported by a *userRolePermissionGroup* resource. +/// It is not used directly, but through a `UserRolePermissionGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.user_role_permission_groups().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct UserRolePermissionGroupGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for UserRolePermissionGroupGetCall<'a, C, A> {} + +impl<'a, C, A> UserRolePermissionGroupGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, UserRolePermissionGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.userRolePermissionGroups.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/userRolePermissionGroups/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> UserRolePermissionGroupGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// User role permission group ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> UserRolePermissionGroupGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> UserRolePermissionGroupGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> UserRolePermissionGroupGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> UserRolePermissionGroupGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets a list of all supported user role permission groups. +/// +/// A builder for the *list* method supported by a *userRolePermissionGroup* resource. +/// It is not used directly, but through a `UserRolePermissionGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.user_role_permission_groups().list("profileId") +/// .doit(); +/// # } +/// ``` +pub struct UserRolePermissionGroupListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for UserRolePermissionGroupListCall<'a, C, A> {} + +impl<'a, C, A> UserRolePermissionGroupListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, UserRolePermissionGroupsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.userRolePermissionGroups.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/userRolePermissionGroups".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> UserRolePermissionGroupListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> UserRolePermissionGroupListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> UserRolePermissionGroupListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> UserRolePermissionGroupListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one platform type by ID. +/// +/// A builder for the *get* method supported by a *platformType* resource. +/// It is not used directly, but through a `PlatformTypeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.platform_types().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct PlatformTypeGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlatformTypeGetCall<'a, C, A> {} + +impl<'a, C, A> PlatformTypeGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlatformType)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.platformTypes.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/platformTypes/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlatformTypeGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Platform type ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> PlatformTypeGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PlatformTypeGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlatformTypeGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PlatformTypeGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of platform types. +/// +/// A builder for the *list* method supported by a *platformType* resource. +/// It is not used directly, but through a `PlatformTypeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.platform_types().list("profileId") +/// .doit(); +/// # } +/// ``` +pub struct PlatformTypeListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlatformTypeListCall<'a, C, A> {} + +impl<'a, C, A> PlatformTypeListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlatformTypesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.platformTypes.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/platformTypes".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlatformTypeListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PlatformTypeListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlatformTypeListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PlatformTypeListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one order document by ID. +/// +/// A builder for the *get* method supported by a *orderDocument* resource. +/// It is not used directly, but through a `OrderDocumentMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.order_documents().get("profileId", "projectId", "id") +/// .doit(); +/// # } +/// ``` +pub struct OrderDocumentGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _project_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrderDocumentGetCall<'a, C, A> {} + +impl<'a, C, A> OrderDocumentGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, OrderDocument)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.orderDocuments.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("projectId", self._project_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "projectId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/projects/{projectId}/orderDocuments/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{projectId}", "projectId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["id", "projectId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> OrderDocumentGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Project ID for order documents. + /// + /// Sets the *project id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project_id(mut self, new_value: &str) -> OrderDocumentGetCall<'a, C, A> { + self._project_id = new_value.to_string(); + self + } + /// Order document ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> OrderDocumentGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrderDocumentGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> OrderDocumentGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrderDocumentGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of order documents, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *orderDocument* resource. +/// It is not used directly, but through a `OrderDocumentMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.order_documents().list("profileId", "projectId") +/// .sort_order("et") +/// .sort_field("diam") +/// .add_site_id("ipsum") +/// .search_string("Lorem") +/// .page_token("et") +/// .add_order_id("duo") +/// .max_results(-32) +/// .add_ids("sea") +/// .approved(false) +/// .doit(); +/// # } +/// ``` +pub struct OrderDocumentListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _project_id: String, + _sort_order: Option, + _sort_field: Option, + _site_id: Vec, + _search_string: Option, + _page_token: Option, + _order_id: Vec, + _max_results: Option, + _ids: Vec, + _approved: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrderDocumentListCall<'a, C, A> {} + +impl<'a, C, A> OrderDocumentListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, OrderDocumentsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.orderDocuments.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((13 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("projectId", self._project_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if self._site_id.len() > 0 { + for f in self._site_id.iter() { + params.push(("siteId", f.to_string())); + } + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if self._order_id.len() > 0 { + for f in self._order_id.iter() { + params.push(("orderId", f.to_string())); + } + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if let Some(value) = self._approved { + params.push(("approved", value.to_string())); + } + for &field in ["alt", "profileId", "projectId", "sortOrder", "sortField", "siteId", "searchString", "pageToken", "orderId", "maxResults", "ids", "approved"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/projects/{projectId}/orderDocuments".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{projectId}", "projectId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["projectId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> OrderDocumentListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Project ID for order documents. + /// + /// Sets the *project id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project_id(mut self, new_value: &str) -> OrderDocumentListCall<'a, C, A> { + self._project_id = new_value.to_string(); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> OrderDocumentListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> OrderDocumentListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Select only order documents that are associated with these sites. + /// + /// Append the given value to the *site id* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_site_id(mut self, new_value: &str) -> OrderDocumentListCall<'a, C, A> { + self._site_id.push(new_value.to_string()); + self + } + /// Allows searching for order documents by name or ID. Wildcards (*) are allowed. For example, "orderdocument*2015" will return order documents with names like "orderdocument June 2015", "orderdocument April 2015", or simply "orderdocument 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "orderdocument" will match order documents with name "my orderdocument", "orderdocument 2015", or simply "orderdocument". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> OrderDocumentListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> OrderDocumentListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Select only order documents for specified orders. + /// + /// Append the given value to the *order id* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_order_id(mut self, new_value: &str) -> OrderDocumentListCall<'a, C, A> { + self._order_id.push(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> OrderDocumentListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only order documents with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> OrderDocumentListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only order documents that have been approved by at least one user. + /// + /// Sets the *approved* query property to the given value. + pub fn approved(mut self, new_value: bool) -> OrderDocumentListCall<'a, C, A> { + self._approved = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrderDocumentListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> OrderDocumentListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrderDocumentListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing creative field. +/// +/// A builder for the *update* method supported by a *creativeField* resource. +/// It is not used directly, but through a `CreativeFieldMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::CreativeField; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = CreativeField::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creative_fields().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct CreativeFieldUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: CreativeField, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeFieldUpdateCall<'a, C, A> {} + +impl<'a, C, A> CreativeFieldUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeField)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeFields.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/creativeFields".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: CreativeField) -> CreativeFieldUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeFieldUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeFieldUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeFieldUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeFieldUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of creative fields, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *creativeField* resource. +/// It is not used directly, but through a `CreativeFieldMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creative_fields().list("profileId") +/// .sort_order("sadipscing") +/// .sort_field("dolor") +/// .search_string("eirmod") +/// .page_token("elitr") +/// .max_results(-97) +/// .add_ids("no") +/// .add_advertiser_ids("labore") +/// .doit(); +/// # } +/// ``` +pub struct CreativeFieldListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _advertiser_ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeFieldListCall<'a, C, A> {} + +impl<'a, C, A> CreativeFieldListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeFieldsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeFields.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((10 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if self._advertiser_ids.len() > 0 { + for f in self._advertiser_ids.iter() { + params.push(("advertiserIds", f.to_string())); + } + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids", "advertiserIds"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/creativeFields".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeFieldListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> CreativeFieldListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> CreativeFieldListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for creative fields by name or ID. Wildcards (*) are allowed. For example, "creativefield*2015" will return creative fields with names like "creativefield June 2015", "creativefield April 2015", or simply "creativefield 2015". Most of the searches also add wild-cards implicitly at the start and the end of the search string. For example, a search string of "creativefield" will match creative fields with the name "my creativefield", "creativefield 2015", or simply "creativefield". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> CreativeFieldListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> CreativeFieldListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> CreativeFieldListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only creative fields with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> CreativeFieldListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only creative fields that belong to these advertisers. + /// + /// Append the given value to the *advertiser ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_advertiser_ids(mut self, new_value: &str) -> CreativeFieldListCall<'a, C, A> { + self._advertiser_ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeFieldListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeFieldListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeFieldListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes an existing creative field. +/// +/// A builder for the *delete* method supported by a *creativeField* resource. +/// It is not used directly, but through a `CreativeFieldMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creative_fields().delete("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct CreativeFieldDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeFieldDeleteCall<'a, C, A> {} + +impl<'a, C, A> CreativeFieldDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeFields.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/creativeFields/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeFieldDeleteCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Creative Field ID + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CreativeFieldDeleteCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeFieldDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeFieldDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeFieldDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one creative field by ID. +/// +/// A builder for the *get* method supported by a *creativeField* resource. +/// It is not used directly, but through a `CreativeFieldMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creative_fields().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct CreativeFieldGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeFieldGetCall<'a, C, A> {} + +impl<'a, C, A> CreativeFieldGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeField)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeFields.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/creativeFields/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeFieldGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Creative Field ID + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CreativeFieldGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeFieldGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeFieldGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeFieldGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new creative field. +/// +/// A builder for the *insert* method supported by a *creativeField* resource. +/// It is not used directly, but through a `CreativeFieldMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::CreativeField; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = CreativeField::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creative_fields().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct CreativeFieldInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: CreativeField, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeFieldInsertCall<'a, C, A> {} + +impl<'a, C, A> CreativeFieldInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeField)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeFields.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/creativeFields".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: CreativeField) -> CreativeFieldInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeFieldInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeFieldInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeFieldInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeFieldInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing creative field. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *creativeField* resource. +/// It is not used directly, but through a `CreativeFieldMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::CreativeField; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = CreativeField::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creative_fields().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct CreativeFieldPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: CreativeField, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeFieldPatchCall<'a, C, A> {} + +impl<'a, C, A> CreativeFieldPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeField)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeFields.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/creativeFields".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: CreativeField) -> CreativeFieldPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeFieldPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Creative Field ID + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CreativeFieldPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeFieldPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeFieldPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeFieldPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new user role. +/// +/// A builder for the *insert* method supported by a *userRole* resource. +/// It is not used directly, but through a `UserRoleMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::UserRole; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = UserRole::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.user_roles().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct UserRoleInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: UserRole, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for UserRoleInsertCall<'a, C, A> {} + +impl<'a, C, A> UserRoleInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, UserRole)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.userRoles.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/userRoles".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: UserRole) -> UserRoleInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> UserRoleInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> UserRoleInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> UserRoleInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> UserRoleInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one user role by ID. +/// +/// A builder for the *get* method supported by a *userRole* resource. +/// It is not used directly, but through a `UserRoleMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.user_roles().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct UserRoleGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for UserRoleGetCall<'a, C, A> {} + +impl<'a, C, A> UserRoleGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, UserRole)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.userRoles.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/userRoles/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> UserRoleGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// User role ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> UserRoleGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> UserRoleGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> UserRoleGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> UserRoleGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing user role. +/// +/// A builder for the *update* method supported by a *userRole* resource. +/// It is not used directly, but through a `UserRoleMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::UserRole; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = UserRole::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.user_roles().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct UserRoleUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: UserRole, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for UserRoleUpdateCall<'a, C, A> {} + +impl<'a, C, A> UserRoleUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, UserRole)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.userRoles.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/userRoles".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: UserRole) -> UserRoleUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> UserRoleUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> UserRoleUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> UserRoleUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> UserRoleUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes an existing user role. +/// +/// A builder for the *delete* method supported by a *userRole* resource. +/// It is not used directly, but through a `UserRoleMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.user_roles().delete("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct UserRoleDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for UserRoleDeleteCall<'a, C, A> {} + +impl<'a, C, A> UserRoleDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.userRoles.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/userRoles/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> UserRoleDeleteCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// User role ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> UserRoleDeleteCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> UserRoleDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> UserRoleDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> UserRoleDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing user role. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *userRole* resource. +/// It is not used directly, but through a `UserRoleMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::UserRole; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = UserRole::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.user_roles().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct UserRolePatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: UserRole, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for UserRolePatchCall<'a, C, A> {} + +impl<'a, C, A> UserRolePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, UserRole)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.userRoles.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/userRoles".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: UserRole) -> UserRolePatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> UserRolePatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// User role ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> UserRolePatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> UserRolePatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> UserRolePatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> UserRolePatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of user roles, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *userRole* resource. +/// It is not used directly, but through a `UserRoleMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.user_roles().list("profileId") +/// .subaccount_id("ut") +/// .sort_order("ea") +/// .sort_field("sed") +/// .search_string("dolor") +/// .page_token("dolor") +/// .max_results(-48) +/// .add_ids("et") +/// .account_user_role_only(false) +/// .doit(); +/// # } +/// ``` +pub struct UserRoleListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _subaccount_id: Option, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _account_user_role_only: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for UserRoleListCall<'a, C, A> {} + +impl<'a, C, A> UserRoleListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, UserRolesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.userRoles.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((11 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._subaccount_id { + params.push(("subaccountId", value.to_string())); + } + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if let Some(value) = self._account_user_role_only { + params.push(("accountUserRoleOnly", value.to_string())); + } + for &field in ["alt", "profileId", "subaccountId", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids", "accountUserRoleOnly"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/userRoles".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> UserRoleListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only user roles that belong to this subaccount. + /// + /// Sets the *subaccount id* query property to the given value. + pub fn subaccount_id(mut self, new_value: &str) -> UserRoleListCall<'a, C, A> { + self._subaccount_id = Some(new_value.to_string()); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> UserRoleListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> UserRoleListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "userrole*2015" will return objects with names like "userrole June 2015", "userrole April 2015", or simply "userrole 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "userrole" will match objects with name "my userrole", "userrole 2015", or simply "userrole". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> UserRoleListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> UserRoleListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> UserRoleListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only user roles with the specified IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> UserRoleListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only account level user roles not associated with any specific subaccount. + /// + /// Sets the *account user role only* query property to the given value. + pub fn account_user_role_only(mut self, new_value: bool) -> UserRoleListCall<'a, C, A> { + self._account_user_role_only = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> UserRoleListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> UserRoleListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> UserRoleListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one operating system version by ID. +/// +/// A builder for the *get* method supported by a *operatingSystemVersion* resource. +/// It is not used directly, but through a `OperatingSystemVersionMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.operating_system_versions().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct OperatingSystemVersionGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OperatingSystemVersionGetCall<'a, C, A> {} + +impl<'a, C, A> OperatingSystemVersionGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, OperatingSystemVersion)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.operatingSystemVersions.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/operatingSystemVersions/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> OperatingSystemVersionGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Operating system version ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> OperatingSystemVersionGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OperatingSystemVersionGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> OperatingSystemVersionGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OperatingSystemVersionGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of operating system versions. +/// +/// A builder for the *list* method supported by a *operatingSystemVersion* resource. +/// It is not used directly, but through a `OperatingSystemVersionMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.operating_system_versions().list("profileId") +/// .doit(); +/// # } +/// ``` +pub struct OperatingSystemVersionListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OperatingSystemVersionListCall<'a, C, A> {} + +impl<'a, C, A> OperatingSystemVersionListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, OperatingSystemVersionsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.operatingSystemVersions.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/operatingSystemVersions".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> OperatingSystemVersionListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OperatingSystemVersionListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> OperatingSystemVersionListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OperatingSystemVersionListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one campaign landing page by ID. +/// +/// A builder for the *get* method supported by a *landingPage* resource. +/// It is not used directly, but through a `LandingPageMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.landing_pages().get("profileId", "campaignId", "id") +/// .doit(); +/// # } +/// ``` +pub struct LandingPageGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _campaign_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for LandingPageGetCall<'a, C, A> {} + +impl<'a, C, A> LandingPageGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LandingPage)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.landingPages.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("campaignId", self._campaign_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "campaignId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/campaigns/{campaignId}/landingPages/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{campaignId}", "campaignId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["id", "campaignId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> LandingPageGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Landing page campaign ID. + /// + /// Sets the *campaign id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn campaign_id(mut self, new_value: &str) -> LandingPageGetCall<'a, C, A> { + self._campaign_id = new_value.to_string(); + self + } + /// Landing page ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> LandingPageGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> LandingPageGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> LandingPageGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> LandingPageGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing campaign landing page. +/// +/// A builder for the *update* method supported by a *landingPage* resource. +/// It is not used directly, but through a `LandingPageMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::LandingPage; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = LandingPage::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.landing_pages().update(req, "profileId", "campaignId") +/// .doit(); +/// # } +/// ``` +pub struct LandingPageUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: LandingPage, + _profile_id: String, + _campaign_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for LandingPageUpdateCall<'a, C, A> {} + +impl<'a, C, A> LandingPageUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LandingPage)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.landingPages.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("campaignId", self._campaign_id.to_string())); + for &field in ["alt", "profileId", "campaignId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/campaigns/{campaignId}/landingPages".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{campaignId}", "campaignId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["campaignId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: LandingPage) -> LandingPageUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> LandingPageUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Landing page campaign ID. + /// + /// Sets the *campaign id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn campaign_id(mut self, new_value: &str) -> LandingPageUpdateCall<'a, C, A> { + self._campaign_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> LandingPageUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> LandingPageUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> LandingPageUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves the list of landing pages for the specified campaign. +/// +/// A builder for the *list* method supported by a *landingPage* resource. +/// It is not used directly, but through a `LandingPageMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.landing_pages().list("profileId", "campaignId") +/// .doit(); +/// # } +/// ``` +pub struct LandingPageListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _campaign_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for LandingPageListCall<'a, C, A> {} + +impl<'a, C, A> LandingPageListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LandingPagesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.landingPages.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("campaignId", self._campaign_id.to_string())); + for &field in ["alt", "profileId", "campaignId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/campaigns/{campaignId}/landingPages".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{campaignId}", "campaignId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["campaignId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> LandingPageListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Landing page campaign ID. + /// + /// Sets the *campaign id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn campaign_id(mut self, new_value: &str) -> LandingPageListCall<'a, C, A> { + self._campaign_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> LandingPageListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> LandingPageListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> LandingPageListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new landing page for the specified campaign. +/// +/// A builder for the *insert* method supported by a *landingPage* resource. +/// It is not used directly, but through a `LandingPageMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::LandingPage; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = LandingPage::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.landing_pages().insert(req, "profileId", "campaignId") +/// .doit(); +/// # } +/// ``` +pub struct LandingPageInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: LandingPage, + _profile_id: String, + _campaign_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for LandingPageInsertCall<'a, C, A> {} + +impl<'a, C, A> LandingPageInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LandingPage)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.landingPages.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("campaignId", self._campaign_id.to_string())); + for &field in ["alt", "profileId", "campaignId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/campaigns/{campaignId}/landingPages".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{campaignId}", "campaignId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["campaignId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: LandingPage) -> LandingPageInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> LandingPageInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Landing page campaign ID. + /// + /// Sets the *campaign id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn campaign_id(mut self, new_value: &str) -> LandingPageInsertCall<'a, C, A> { + self._campaign_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> LandingPageInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> LandingPageInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> LandingPageInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing campaign landing page. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *landingPage* resource. +/// It is not used directly, but through a `LandingPageMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::LandingPage; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = LandingPage::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.landing_pages().patch(req, "profileId", "campaignId", "id") +/// .doit(); +/// # } +/// ``` +pub struct LandingPagePatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: LandingPage, + _profile_id: String, + _campaign_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for LandingPagePatchCall<'a, C, A> {} + +impl<'a, C, A> LandingPagePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LandingPage)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.landingPages.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("campaignId", self._campaign_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "campaignId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/campaigns/{campaignId}/landingPages".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{campaignId}", "campaignId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["campaignId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: LandingPage) -> LandingPagePatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> LandingPagePatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Landing page campaign ID. + /// + /// Sets the *campaign id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn campaign_id(mut self, new_value: &str) -> LandingPagePatchCall<'a, C, A> { + self._campaign_id = new_value.to_string(); + self + } + /// Landing page ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> LandingPagePatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> LandingPagePatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> LandingPagePatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> LandingPagePatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes an existing campaign landing page. +/// +/// A builder for the *delete* method supported by a *landingPage* resource. +/// It is not used directly, but through a `LandingPageMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.landing_pages().delete("profileId", "campaignId", "id") +/// .doit(); +/// # } +/// ``` +pub struct LandingPageDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _campaign_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for LandingPageDeleteCall<'a, C, A> {} + +impl<'a, C, A> LandingPageDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.landingPages.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("campaignId", self._campaign_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["profileId", "campaignId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/campaigns/{campaignId}/landingPages/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{campaignId}", "campaignId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["id", "campaignId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> LandingPageDeleteCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Landing page campaign ID. + /// + /// Sets the *campaign id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn campaign_id(mut self, new_value: &str) -> LandingPageDeleteCall<'a, C, A> { + self._campaign_id = new_value.to_string(); + self + } + /// Landing page ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> LandingPageDeleteCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> LandingPageDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> LandingPageDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> LandingPageDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new creative asset. +/// +/// A builder for the *insert* method supported by a *creativeAsset* resource. +/// It is not used directly, but through a `CreativeAssetMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::CreativeAssetMetadata; +/// use std::fs; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = CreativeAssetMetadata::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `upload_resumable(...)`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creative_assets().insert(req, "profileId", "advertiserId") +/// .upload_resumable(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()); +/// # } +/// ``` +pub struct CreativeAssetInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: CreativeAssetMetadata, + _profile_id: String, + _advertiser_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeAssetInsertCall<'a, C, A> {} + +impl<'a, C, A> CreativeAssetInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + fn doit(mut self, mut reader: RS, reader_mime_type: mime::Mime, protocol: &'static str) -> Result<(hyper::client::Response, CreativeAssetMetadata)> + where RS: ReadSeek { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeAssets.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("advertiserId", self._advertiser_id.to_string())); + for &field in ["alt", "profileId", "advertiserId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let (mut url, upload_type) = + if protocol == "simple" { + ("https://www.googleapis.com/upload/dfareporting/v2.7/userprofiles/{profileId}/creativeAssets/{advertiserId}/creativeAssets".to_string(), "multipart") + } else if protocol == "resumable" { + ("https://www.googleapis.com/resumable/upload/dfareporting/v2.7/userprofiles/{profileId}/creativeAssets/{advertiserId}/creativeAssets".to_string(), "resumable") + } else { + unreachable!() + }; + params.push(("uploadType", upload_type.to_string())); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{advertiserId}", "advertiserId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["advertiserId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + let mut should_ask_dlg_for_url = false; + let mut upload_url_from_server; + let mut upload_url: Option = None; + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + if should_ask_dlg_for_url && (upload_url = dlg.upload_url()) == () && upload_url.is_some() { + should_ask_dlg_for_url = false; + upload_url_from_server = false; + let url = upload_url.as_ref().and_then(|s| Some(hyper::Url::parse(s).unwrap())).unwrap(); + hyper::client::Response::new(url, Box::new(cmn::DummyNetworkStream)).and_then(|mut res| { + res.status = hyper::status::StatusCode::Ok; + res.headers.set(Location(upload_url.as_ref().unwrap().clone())); + Ok(res) + }) + } else { + let mut mp_reader: MultiPartReader = Default::default(); + let (mut body_reader, content_type) = match protocol { + "simple" => { + mp_reader.reserve_exact(2); + let size = reader.seek(io::SeekFrom::End(0)).unwrap(); + reader.seek(io::SeekFrom::Start(0)).unwrap(); + if size > 1073741824 { + return Err(Error::UploadSizeLimitExceeded(size, 1073741824)) + } + mp_reader.add_part(&mut request_value_reader, request_size, json_mime_type.clone()) + .add_part(&mut reader, size, reader_mime_type.clone()); + let mime_type = mp_reader.mime_type(); + (&mut mp_reader as &mut io::Read, ContentType(mime_type)) + }, + _ => (&mut request_value_reader as &mut io::Read, ContentType(json_mime_type.clone())), + }; + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(content_type) + .body(&mut body_reader); + upload_url_from_server = true; + if protocol == "resumable" { + req = req.header(cmn::XUploadContentType(reader_mime_type.clone())); + } + + dlg.pre_request(); + req.send() + } + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + if protocol == "resumable" { + let size = reader.seek(io::SeekFrom::End(0)).unwrap(); + reader.seek(io::SeekFrom::Start(0)).unwrap(); + if size > 1073741824 { + return Err(Error::UploadSizeLimitExceeded(size, 1073741824)) + } + let mut client = &mut *self.hub.client.borrow_mut(); + let upload_result = { + let url_str = &res.headers.get::().expect("Location header is part of protocol").0; + if upload_url_from_server { + dlg.store_upload_url(Some(url_str)); + } + + cmn::ResumableUploadHelper { + client: &mut client.borrow_mut(), + delegate: dlg, + start_at: if upload_url_from_server { Some(0) } else { None }, + auth: &mut *self.hub.auth.borrow_mut(), + user_agent: &self.hub._user_agent, + auth_header: auth_header.clone(), + url: url_str, + reader: &mut reader, + media_type: reader_mime_type.clone(), + content_length: size + }.upload() + }; + match upload_result { + None => { + dlg.finished(false); + return Err(Error::Cancelled) + } + Some(Err(err)) => { + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Some(Ok(upload_result)) => { + res = upload_result; + if !res.status.is_success() { + dlg.store_upload_url(None); + dlg.finished(false); + return Err(Error::Failure(res)) + } + } + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + /// Upload media all at once. + /// If the upload fails for whichever reason, all progress is lost. + /// + /// * *max size*: 1024MB + /// * *multipart*: yes + /// * *valid mime types*: '*/*' + pub fn upload(self, stream: RS, mime_type: mime::Mime) -> Result<(hyper::client::Response, CreativeAssetMetadata)> + where RS: ReadSeek { + self.doit(stream, mime_type, "simple") + } + /// Upload media in a resumable fashion. + /// Even if the upload fails or is interrupted, it can be resumed for a + /// certain amount of time as the server maintains state temporarily. + /// + /// The delegate will be asked for an `upload_url()`, and if not provided, will be asked to store an upload URL + /// that was provided by the server, using `store_upload_url(...)`. The upload will be done in chunks, the delegate + /// may specify the `chunk_size()` and may cancel the operation before each chunk is uploaded, using + /// `cancel_chunk_upload(...)`. + /// + /// * *max size*: 1024MB + /// * *multipart*: yes + /// * *valid mime types*: '*/*' + pub fn upload_resumable(self, resumeable_stream: RS, mime_type: mime::Mime) -> Result<(hyper::client::Response, CreativeAssetMetadata)> + where RS: ReadSeek { + self.doit(resumeable_stream, mime_type, "resumable") + } + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: CreativeAssetMetadata) -> CreativeAssetInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeAssetInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Advertiser ID of this creative. This is a required field. + /// + /// Sets the *advertiser id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn advertiser_id(mut self, new_value: &str) -> CreativeAssetInsertCall<'a, C, A> { + self._advertiser_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeAssetInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeAssetInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeAssetInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Associates a creative with the specified campaign. This method creates a default ad with dimensions matching the creative in the campaign if such a default ad does not exist already. +/// +/// A builder for the *insert* method supported by a *campaignCreativeAssociation* resource. +/// It is not used directly, but through a `CampaignCreativeAssociationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::CampaignCreativeAssociation; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = CampaignCreativeAssociation::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.campaign_creative_associations().insert(req, "profileId", "campaignId") +/// .doit(); +/// # } +/// ``` +pub struct CampaignCreativeAssociationInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: CampaignCreativeAssociation, + _profile_id: String, + _campaign_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CampaignCreativeAssociationInsertCall<'a, C, A> {} + +impl<'a, C, A> CampaignCreativeAssociationInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CampaignCreativeAssociation)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.campaignCreativeAssociations.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("campaignId", self._campaign_id.to_string())); + for &field in ["alt", "profileId", "campaignId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/campaigns/{campaignId}/campaignCreativeAssociations".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{campaignId}", "campaignId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["campaignId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: CampaignCreativeAssociation) -> CampaignCreativeAssociationInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CampaignCreativeAssociationInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Campaign ID in this association. + /// + /// Sets the *campaign id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn campaign_id(mut self, new_value: &str) -> CampaignCreativeAssociationInsertCall<'a, C, A> { + self._campaign_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CampaignCreativeAssociationInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CampaignCreativeAssociationInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CampaignCreativeAssociationInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves the list of creative IDs associated with the specified campaign. This method supports paging. +/// +/// A builder for the *list* method supported by a *campaignCreativeAssociation* resource. +/// It is not used directly, but through a `CampaignCreativeAssociationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.campaign_creative_associations().list("profileId", "campaignId") +/// .sort_order("kasd") +/// .page_token("sanctus") +/// .max_results(-58) +/// .doit(); +/// # } +/// ``` +pub struct CampaignCreativeAssociationListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _campaign_id: String, + _sort_order: Option, + _page_token: Option, + _max_results: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CampaignCreativeAssociationListCall<'a, C, A> {} + +impl<'a, C, A> CampaignCreativeAssociationListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CampaignCreativeAssociationsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.campaignCreativeAssociations.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("campaignId", self._campaign_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + for &field in ["alt", "profileId", "campaignId", "sortOrder", "pageToken", "maxResults"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/campaigns/{campaignId}/campaignCreativeAssociations".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{campaignId}", "campaignId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["campaignId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CampaignCreativeAssociationListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Campaign ID in this association. + /// + /// Sets the *campaign id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn campaign_id(mut self, new_value: &str) -> CampaignCreativeAssociationListCall<'a, C, A> { + self._campaign_id = new_value.to_string(); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> CampaignCreativeAssociationListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> CampaignCreativeAssociationListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> CampaignCreativeAssociationListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CampaignCreativeAssociationListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CampaignCreativeAssociationListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CampaignCreativeAssociationListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of change logs. This method supports paging. +/// +/// A builder for the *list* method supported by a *changeLog* resource. +/// It is not used directly, but through a `ChangeLogMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.change_logs().list("profileId") +/// .add_user_profile_ids("labore") +/// .search_string("invidunt") +/// .page_token("ea") +/// .object_type("sadipscing") +/// .add_object_ids("rebum.") +/// .min_change_time("dolore") +/// .max_results(-41) +/// .max_change_time("sed") +/// .add_ids("aliquyam") +/// .action("sit") +/// .doit(); +/// # } +/// ``` +pub struct ChangeLogListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _user_profile_ids: Vec, + _search_string: Option, + _page_token: Option, + _object_type: Option, + _object_ids: Vec, + _min_change_time: Option, + _max_results: Option, + _max_change_time: Option, + _ids: Vec, + _action: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ChangeLogListCall<'a, C, A> {} + +impl<'a, C, A> ChangeLogListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ChangeLogsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.changeLogs.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((13 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if self._user_profile_ids.len() > 0 { + for f in self._user_profile_ids.iter() { + params.push(("userProfileIds", f.to_string())); + } + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._object_type { + params.push(("objectType", value.to_string())); + } + if self._object_ids.len() > 0 { + for f in self._object_ids.iter() { + params.push(("objectIds", f.to_string())); + } + } + if let Some(value) = self._min_change_time { + params.push(("minChangeTime", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._max_change_time { + params.push(("maxChangeTime", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if let Some(value) = self._action { + params.push(("action", value.to_string())); + } + for &field in ["alt", "profileId", "userProfileIds", "searchString", "pageToken", "objectType", "objectIds", "minChangeTime", "maxResults", "maxChangeTime", "ids", "action"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/changeLogs".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ChangeLogListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only change logs with these user profile IDs. + /// + /// Append the given value to the *user profile ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_user_profile_ids(mut self, new_value: &str) -> ChangeLogListCall<'a, C, A> { + self._user_profile_ids.push(new_value.to_string()); + self + } + /// Select only change logs whose object ID, user name, old or new values match the search string. + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> ChangeLogListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ChangeLogListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Select only change logs with the specified object type. + /// + /// Sets the *object type* query property to the given value. + pub fn object_type(mut self, new_value: &str) -> ChangeLogListCall<'a, C, A> { + self._object_type = Some(new_value.to_string()); + self + } + /// Select only change logs with these object IDs. + /// + /// Append the given value to the *object ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_object_ids(mut self, new_value: &str) -> ChangeLogListCall<'a, C, A> { + self._object_ids.push(new_value.to_string()); + self + } + /// Select only change logs whose change time is before the specified minChangeTime.The time should be formatted as an RFC3339 date/time string. For example, for 10:54 PM on July 18th, 2015, in the America/New York time zone, the format is "2015-07-18T22:54:00-04:00". In other words, the year, month, day, the letter T, the hour (24-hour clock system), minute, second, and then the time zone offset. + /// + /// Sets the *min change time* query property to the given value. + pub fn min_change_time(mut self, new_value: &str) -> ChangeLogListCall<'a, C, A> { + self._min_change_time = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> ChangeLogListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only change logs whose change time is before the specified maxChangeTime.The time should be formatted as an RFC3339 date/time string. For example, for 10:54 PM on July 18th, 2015, in the America/New York time zone, the format is "2015-07-18T22:54:00-04:00". In other words, the year, month, day, the letter T, the hour (24-hour clock system), minute, second, and then the time zone offset. + /// + /// Sets the *max change time* query property to the given value. + pub fn max_change_time(mut self, new_value: &str) -> ChangeLogListCall<'a, C, A> { + self._max_change_time = Some(new_value.to_string()); + self + } + /// Select only change logs with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> ChangeLogListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only change logs with the specified action. + /// + /// Sets the *action* query property to the given value. + pub fn action(mut self, new_value: &str) -> ChangeLogListCall<'a, C, A> { + self._action = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ChangeLogListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ChangeLogListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ChangeLogListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one change log by ID. +/// +/// A builder for the *get* method supported by a *changeLog* resource. +/// It is not used directly, but through a `ChangeLogMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.change_logs().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct ChangeLogGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ChangeLogGetCall<'a, C, A> {} + +impl<'a, C, A> ChangeLogGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ChangeLog)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.changeLogs.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/changeLogs/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ChangeLogGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Change log ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> ChangeLogGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ChangeLogGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ChangeLogGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ChangeLogGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one remarketing list share by remarketing list ID. +/// +/// A builder for the *get* method supported by a *remarketingListShare* resource. +/// It is not used directly, but through a `RemarketingListShareMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.remarketing_list_shares().get("profileId", "remarketingListId") +/// .doit(); +/// # } +/// ``` +pub struct RemarketingListShareGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _remarketing_list_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RemarketingListShareGetCall<'a, C, A> {} + +impl<'a, C, A> RemarketingListShareGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, RemarketingListShare)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.remarketingListShares.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("remarketingListId", self._remarketing_list_id.to_string())); + for &field in ["alt", "profileId", "remarketingListId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/remarketingListShares/{remarketingListId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{remarketingListId}", "remarketingListId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["remarketingListId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> RemarketingListShareGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Remarketing list ID. + /// + /// Sets the *remarketing list id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn remarketing_list_id(mut self, new_value: &str) -> RemarketingListShareGetCall<'a, C, A> { + self._remarketing_list_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> RemarketingListShareGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RemarketingListShareGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> RemarketingListShareGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing remarketing list share. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *remarketingListShare* resource. +/// It is not used directly, but through a `RemarketingListShareMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::RemarketingListShare; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = RemarketingListShare::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.remarketing_list_shares().patch(req, "profileId", "remarketingListId") +/// .doit(); +/// # } +/// ``` +pub struct RemarketingListSharePatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: RemarketingListShare, + _profile_id: String, + _remarketing_list_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RemarketingListSharePatchCall<'a, C, A> {} + +impl<'a, C, A> RemarketingListSharePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, RemarketingListShare)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.remarketingListShares.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("remarketingListId", self._remarketing_list_id.to_string())); + for &field in ["alt", "profileId", "remarketingListId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/remarketingListShares".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: RemarketingListShare) -> RemarketingListSharePatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> RemarketingListSharePatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Remarketing list ID. + /// + /// Sets the *remarketing list id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn remarketing_list_id(mut self, new_value: &str) -> RemarketingListSharePatchCall<'a, C, A> { + self._remarketing_list_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> RemarketingListSharePatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RemarketingListSharePatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> RemarketingListSharePatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing remarketing list share. +/// +/// A builder for the *update* method supported by a *remarketingListShare* resource. +/// It is not used directly, but through a `RemarketingListShareMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::RemarketingListShare; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = RemarketingListShare::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.remarketing_list_shares().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct RemarketingListShareUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: RemarketingListShare, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RemarketingListShareUpdateCall<'a, C, A> {} + +impl<'a, C, A> RemarketingListShareUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, RemarketingListShare)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.remarketingListShares.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/remarketingListShares".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: RemarketingListShare) -> RemarketingListShareUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> RemarketingListShareUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> RemarketingListShareUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RemarketingListShareUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> RemarketingListShareUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Runs a report. +/// +/// A builder for the *run* method supported by a *report* resource. +/// It is not used directly, but through a `ReportMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.reports().run("profileId", "reportId") +/// .synchronous(false) +/// .doit(); +/// # } +/// ``` +pub struct ReportRunCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _report_id: String, + _synchronous: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ReportRunCall<'a, C, A> {} + +impl<'a, C, A> ReportRunCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, File)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.reports.run", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("reportId", self._report_id.to_string())); + if let Some(value) = self._synchronous { + params.push(("synchronous", value.to_string())); + } + for &field in ["alt", "profileId", "reportId", "synchronous"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/reports/{reportId}/run".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{reportId}", "reportId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["reportId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The DFA profile ID. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ReportRunCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The ID of the report. + /// + /// Sets the *report id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn report_id(mut self, new_value: &str) -> ReportRunCall<'a, C, A> { + self._report_id = new_value.to_string(); + self + } + /// If set and true, tries to run the report synchronously. + /// + /// Sets the *synchronous* query property to the given value. + pub fn synchronous(mut self, new_value: bool) -> ReportRunCall<'a, C, A> { + self._synchronous = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ReportRunCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ReportRunCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ReportRunCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates a report. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *report* resource. +/// It is not used directly, but through a `ReportMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::Report; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Report::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.reports().patch(req, "profileId", "reportId") +/// .doit(); +/// # } +/// ``` +pub struct ReportPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Report, + _profile_id: String, + _report_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ReportPatchCall<'a, C, A> {} + +impl<'a, C, A> ReportPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Report)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.reports.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("reportId", self._report_id.to_string())); + for &field in ["alt", "profileId", "reportId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/reports/{reportId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{reportId}", "reportId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["reportId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Report) -> ReportPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// The DFA user profile ID. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ReportPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The ID of the report. + /// + /// Sets the *report id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn report_id(mut self, new_value: &str) -> ReportPatchCall<'a, C, A> { + self._report_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ReportPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ReportPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ReportPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Lists files for a report. +/// +/// A builder for the *files.list* method supported by a *report* resource. +/// It is not used directly, but through a `ReportMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.reports().files_list("profileId", "reportId") +/// .sort_order("sit") +/// .sort_field("diam") +/// .page_token("ut") +/// .max_results(-70) +/// .doit(); +/// # } +/// ``` +pub struct ReportFileListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _report_id: String, + _sort_order: Option, + _sort_field: Option, + _page_token: Option, + _max_results: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ReportFileListCall<'a, C, A> {} + +impl<'a, C, A> ReportFileListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FileList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.reports.files.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("reportId", self._report_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + for &field in ["alt", "profileId", "reportId", "sortOrder", "sortField", "pageToken", "maxResults"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/reports/{reportId}/files".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{reportId}", "reportId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["reportId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The DFA profile ID. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ReportFileListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The ID of the parent report. + /// + /// Sets the *report id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn report_id(mut self, new_value: &str) -> ReportFileListCall<'a, C, A> { + self._report_id = new_value.to_string(); + self + } + /// Order of sorted results, default is 'DESCENDING'. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> ReportFileListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// The field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> ReportFileListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// The value of the nextToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ReportFileListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> ReportFileListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ReportFileListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ReportFileListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ReportFileListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Creates a report. +/// +/// A builder for the *insert* method supported by a *report* resource. +/// It is not used directly, but through a `ReportMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::Report; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Report::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.reports().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct ReportInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Report, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ReportInsertCall<'a, C, A> {} + +impl<'a, C, A> ReportInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Report)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.reports.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/reports".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Report) -> ReportInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// The DFA user profile ID. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ReportInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ReportInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ReportInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ReportInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Returns the fields that are compatible to be selected in the respective sections of a report criteria, given the fields already selected in the input report and user permissions. +/// +/// A builder for the *compatibleFields.query* method supported by a *report* resource. +/// It is not used directly, but through a `ReportMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::Report; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Report::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.reports().compatible_fields_query(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct ReportCompatibleFieldQueryCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Report, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ReportCompatibleFieldQueryCall<'a, C, A> {} + +impl<'a, C, A> ReportCompatibleFieldQueryCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CompatibleFields)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.reports.compatibleFields.query", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/reports/compatiblefields/query".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Report) -> ReportCompatibleFieldQueryCall<'a, C, A> { + self._request = new_value; + self + } + /// The DFA user profile ID. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ReportCompatibleFieldQueryCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ReportCompatibleFieldQueryCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ReportCompatibleFieldQueryCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ReportCompatibleFieldQueryCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a report by its ID. +/// +/// A builder for the *get* method supported by a *report* resource. +/// It is not used directly, but through a `ReportMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.reports().get("profileId", "reportId") +/// .doit(); +/// # } +/// ``` +pub struct ReportGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _report_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ReportGetCall<'a, C, A> {} + +impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Report)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.reports.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("reportId", self._report_id.to_string())); + for &field in ["alt", "profileId", "reportId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/reports/{reportId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{reportId}", "reportId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["reportId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The DFA user profile ID. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ReportGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The ID of the report. + /// + /// Sets the *report id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn report_id(mut self, new_value: &str) -> ReportGetCall<'a, C, A> { + self._report_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ReportGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ReportGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ReportGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a report file. +/// +/// This method supports **media download**. To enable it, adjust the builder like this: +/// `.param("alt", "media")`. +/// Please note that due to missing multi-part support on the server side, you will only receive the media, +/// but not the `File` structure that you would usually get. The latter will be a default value. +/// +/// A builder for the *files.get* method supported by a *report* resource. +/// It is not used directly, but through a `ReportMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.reports().files_get("profileId", "reportId", "fileId") +/// .doit(); +/// # } +/// ``` +pub struct ReportFileGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _report_id: String, + _file_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ReportFileGetCall<'a, C, A> {} + +impl<'a, C, A> ReportFileGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, File)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.reports.files.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("reportId", self._report_id.to_string())); + params.push(("fileId", self._file_id.to_string())); + for &field in ["profileId", "reportId", "fileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + let (json_field_missing, enable_resource_parsing) = { + let mut enable = true; + let mut field_present = true; + for &(name, ref value) in params.iter() { + if name == "alt" { + field_present = false; + if >::as_ref(&value) != "json" { + enable = false; + } + break; + } + } + (field_present, enable) + }; + if json_field_missing { + params.push(("alt", "json".to_string())); + } + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/reports/{reportId}/files/{fileId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{reportId}", "reportId"), ("{fileId}", "fileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["fileId", "reportId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = if enable_resource_parsing { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + } else { (res, Default::default()) }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The DFA profile ID. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ReportFileGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The ID of the report. + /// + /// Sets the *report id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn report_id(mut self, new_value: &str) -> ReportFileGetCall<'a, C, A> { + self._report_id = new_value.to_string(); + self + } + /// The ID of the report file. + /// + /// Sets the *file id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn file_id(mut self, new_value: &str) -> ReportFileGetCall<'a, C, A> { + self._file_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ReportFileGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ReportFileGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ReportFileGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes a report by its ID. +/// +/// A builder for the *delete* method supported by a *report* resource. +/// It is not used directly, but through a `ReportMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.reports().delete("profileId", "reportId") +/// .doit(); +/// # } +/// ``` +pub struct ReportDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _report_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ReportDeleteCall<'a, C, A> {} + +impl<'a, C, A> ReportDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.reports.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("reportId", self._report_id.to_string())); + for &field in ["profileId", "reportId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/reports/{reportId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{reportId}", "reportId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["reportId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The DFA user profile ID. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ReportDeleteCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The ID of the report. + /// + /// Sets the *report id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn report_id(mut self, new_value: &str) -> ReportDeleteCall<'a, C, A> { + self._report_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ReportDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ReportDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ReportDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates a report. +/// +/// A builder for the *update* method supported by a *report* resource. +/// It is not used directly, but through a `ReportMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::Report; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Report::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.reports().update(req, "profileId", "reportId") +/// .doit(); +/// # } +/// ``` +pub struct ReportUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Report, + _profile_id: String, + _report_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ReportUpdateCall<'a, C, A> {} + +impl<'a, C, A> ReportUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Report)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.reports.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("reportId", self._report_id.to_string())); + for &field in ["alt", "profileId", "reportId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/reports/{reportId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{reportId}", "reportId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["reportId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Report) -> ReportUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// The DFA user profile ID. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ReportUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The ID of the report. + /// + /// Sets the *report id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn report_id(mut self, new_value: &str) -> ReportUpdateCall<'a, C, A> { + self._report_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ReportUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ReportUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ReportUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves list of reports. +/// +/// A builder for the *list* method supported by a *report* resource. +/// It is not used directly, but through a `ReportMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.reports().list("profileId") +/// .sort_order("voluptua.") +/// .sort_field("duo") +/// .scope("sed") +/// .page_token("aliquyam") +/// .max_results(-67) +/// .doit(); +/// # } +/// ``` +pub struct ReportListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _scope: Option, + _page_token: Option, + _max_results: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ReportListCall<'a, C, A> {} + +impl<'a, C, A> ReportListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ReportList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.reports.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._scope { + params.push(("scope", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "scope", "pageToken", "maxResults"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/reports".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The DFA user profile ID. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ReportListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results, default is 'DESCENDING'. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> ReportListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// The field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> ReportListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// The scope that defines which results are returned, default is 'MINE'. + /// + /// Sets the *scope* query property to the given value. + pub fn scope(mut self, new_value: &str) -> ReportListCall<'a, C, A> { + self._scope = Some(new_value.to_string()); + self + } + /// The value of the nextToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ReportListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> ReportListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ReportListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ReportListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ReportListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new advertiser. +/// +/// A builder for the *insert* method supported by a *advertiser* resource. +/// It is not used directly, but through a `AdvertiserMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::Advertiser; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Advertiser::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.advertisers().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct AdvertiserInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Advertiser, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdvertiserInsertCall<'a, C, A> {} + +impl<'a, C, A> AdvertiserInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Advertiser)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.advertisers.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/advertisers".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Advertiser) -> AdvertiserInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdvertiserInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AdvertiserInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdvertiserInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AdvertiserInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing advertiser. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *advertiser* resource. +/// It is not used directly, but through a `AdvertiserMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::Advertiser; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Advertiser::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.advertisers().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct AdvertiserPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Advertiser, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdvertiserPatchCall<'a, C, A> {} + +impl<'a, C, A> AdvertiserPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Advertiser)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.advertisers.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/advertisers".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Advertiser) -> AdvertiserPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdvertiserPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Advertiser ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> AdvertiserPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AdvertiserPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdvertiserPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AdvertiserPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of advertisers, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *advertiser* resource. +/// It is not used directly, but through a `AdvertiserMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.advertisers().list("profileId") +/// .subaccount_id("kasd") +/// .status("invidunt") +/// .sort_order("rebum.") +/// .sort_field("Lorem") +/// .search_string("clita") +/// .page_token("invidunt") +/// .only_parent(false) +/// .max_results(-77) +/// .include_advertisers_without_groups_only(false) +/// .add_ids("et") +/// .add_floodlight_configuration_ids("sed") +/// .add_advertiser_group_ids("sit") +/// .doit(); +/// # } +/// ``` +pub struct AdvertiserListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _subaccount_id: Option, + _status: Option, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _only_parent: Option, + _max_results: Option, + _include_advertisers_without_groups_only: Option, + _ids: Vec, + _floodlight_configuration_ids: Vec, + _advertiser_group_ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdvertiserListCall<'a, C, A> {} + +impl<'a, C, A> AdvertiserListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AdvertisersListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.advertisers.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((15 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._subaccount_id { + params.push(("subaccountId", value.to_string())); + } + if let Some(value) = self._status { + params.push(("status", value.to_string())); + } + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._only_parent { + params.push(("onlyParent", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._include_advertisers_without_groups_only { + params.push(("includeAdvertisersWithoutGroupsOnly", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if self._floodlight_configuration_ids.len() > 0 { + for f in self._floodlight_configuration_ids.iter() { + params.push(("floodlightConfigurationIds", f.to_string())); + } + } + if self._advertiser_group_ids.len() > 0 { + for f in self._advertiser_group_ids.iter() { + params.push(("advertiserGroupIds", f.to_string())); + } + } + for &field in ["alt", "profileId", "subaccountId", "status", "sortOrder", "sortField", "searchString", "pageToken", "onlyParent", "maxResults", "includeAdvertisersWithoutGroupsOnly", "ids", "floodlightConfigurationIds", "advertiserGroupIds"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/advertisers".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdvertiserListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only advertisers with these subaccount IDs. + /// + /// Sets the *subaccount id* query property to the given value. + pub fn subaccount_id(mut self, new_value: &str) -> AdvertiserListCall<'a, C, A> { + self._subaccount_id = Some(new_value.to_string()); + self + } + /// Select only advertisers with the specified status. + /// + /// Sets the *status* query property to the given value. + pub fn status(mut self, new_value: &str) -> AdvertiserListCall<'a, C, A> { + self._status = Some(new_value.to_string()); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> AdvertiserListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> AdvertiserListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "advertiser*2015" will return objects with names like "advertiser June 2015", "advertiser April 2015", or simply "advertiser 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "advertiser" will match objects with name "my advertiser", "advertiser 2015", or simply "advertiser". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> AdvertiserListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> AdvertiserListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Select only advertisers which use another advertiser's floodlight configuration. + /// + /// Sets the *only parent* query property to the given value. + pub fn only_parent(mut self, new_value: bool) -> AdvertiserListCall<'a, C, A> { + self._only_parent = Some(new_value); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> AdvertiserListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only advertisers which do not belong to any advertiser group. + /// + /// Sets the *include advertisers without groups only* query property to the given value. + pub fn include_advertisers_without_groups_only(mut self, new_value: bool) -> AdvertiserListCall<'a, C, A> { + self._include_advertisers_without_groups_only = Some(new_value); + self + } + /// Select only advertisers with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> AdvertiserListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only advertisers with these floodlight configuration IDs. + /// + /// Append the given value to the *floodlight configuration ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_floodlight_configuration_ids(mut self, new_value: &str) -> AdvertiserListCall<'a, C, A> { + self._floodlight_configuration_ids.push(new_value.to_string()); + self + } + /// Select only advertisers with these advertiser group IDs. + /// + /// Append the given value to the *advertiser group ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_advertiser_group_ids(mut self, new_value: &str) -> AdvertiserListCall<'a, C, A> { + self._advertiser_group_ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AdvertiserListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdvertiserListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AdvertiserListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing advertiser. +/// +/// A builder for the *update* method supported by a *advertiser* resource. +/// It is not used directly, but through a `AdvertiserMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::Advertiser; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Advertiser::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.advertisers().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct AdvertiserUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Advertiser, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdvertiserUpdateCall<'a, C, A> {} + +impl<'a, C, A> AdvertiserUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Advertiser)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.advertisers.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/advertisers".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Advertiser) -> AdvertiserUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdvertiserUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AdvertiserUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdvertiserUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AdvertiserUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one advertiser by ID. +/// +/// A builder for the *get* method supported by a *advertiser* resource. +/// It is not used directly, but through a `AdvertiserMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.advertisers().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct AdvertiserGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdvertiserGetCall<'a, C, A> {} + +impl<'a, C, A> AdvertiserGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Advertiser)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.advertisers.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/advertisers/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdvertiserGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Advertiser ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> AdvertiserGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AdvertiserGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdvertiserGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AdvertiserGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves list of report dimension values for a list of filters. +/// +/// A builder for the *query* method supported by a *dimensionValue* resource. +/// It is not used directly, but through a `DimensionValueMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::DimensionValueRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = DimensionValueRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.dimension_values().query(req, "profileId") +/// .page_token("Lorem") +/// .max_results(-50) +/// .doit(); +/// # } +/// ``` +pub struct DimensionValueQueryCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: DimensionValueRequest, + _profile_id: String, + _page_token: Option, + _max_results: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for DimensionValueQueryCall<'a, C, A> {} + +impl<'a, C, A> DimensionValueQueryCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, DimensionValueList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.dimensionValues.query", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + for &field in ["alt", "profileId", "pageToken", "maxResults"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/dimensionvalues/query".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: DimensionValueRequest) -> DimensionValueQueryCall<'a, C, A> { + self._request = new_value; + self + } + /// The DFA user profile ID. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> DimensionValueQueryCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The value of the nextToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> DimensionValueQueryCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> DimensionValueQueryCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> DimensionValueQueryCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> DimensionValueQueryCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> DimensionValueQueryCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one floodlight activity group by ID. +/// +/// A builder for the *get* method supported by a *floodlightActivityGroup* resource. +/// It is not used directly, but through a `FloodlightActivityGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.floodlight_activity_groups().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightActivityGroupGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightActivityGroupGetCall<'a, C, A> {} + +impl<'a, C, A> FloodlightActivityGroupGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightActivityGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivityGroups.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/floodlightActivityGroups/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightActivityGroupGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Floodlight activity Group ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> FloodlightActivityGroupGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FloodlightActivityGroupGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightActivityGroupGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FloodlightActivityGroupGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing floodlight activity group. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *floodlightActivityGroup* resource. +/// It is not used directly, but through a `FloodlightActivityGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::FloodlightActivityGroup; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = FloodlightActivityGroup::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.floodlight_activity_groups().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightActivityGroupPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: FloodlightActivityGroup, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightActivityGroupPatchCall<'a, C, A> {} + +impl<'a, C, A> FloodlightActivityGroupPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightActivityGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivityGroups.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/floodlightActivityGroups".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: FloodlightActivityGroup) -> FloodlightActivityGroupPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightActivityGroupPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Floodlight activity Group ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> FloodlightActivityGroupPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FloodlightActivityGroupPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightActivityGroupPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FloodlightActivityGroupPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of floodlight activity groups, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *floodlightActivityGroup* resource. +/// It is not used directly, but through a `FloodlightActivityGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.floodlight_activity_groups().list("profileId") +/// .type_("ut") +/// .sort_order("dolor") +/// .sort_field("sea") +/// .search_string("ut") +/// .page_token("eirmod") +/// .max_results(-8) +/// .add_ids("voluptua.") +/// .floodlight_configuration_id("dolor") +/// .advertiser_id("et") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightActivityGroupListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _type_: Option, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _floodlight_configuration_id: Option, + _advertiser_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightActivityGroupListCall<'a, C, A> {} + +impl<'a, C, A> FloodlightActivityGroupListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightActivityGroupsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivityGroups.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((12 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._type_ { + params.push(("type", value.to_string())); + } + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if let Some(value) = self._floodlight_configuration_id { + params.push(("floodlightConfigurationId", value.to_string())); + } + if let Some(value) = self._advertiser_id { + params.push(("advertiserId", value.to_string())); + } + for &field in ["alt", "profileId", "type", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids", "floodlightConfigurationId", "advertiserId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/floodlightActivityGroups".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightActivityGroupListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only floodlight activity groups with the specified floodlight activity group type. + /// + /// Sets the *type* query property to the given value. + pub fn type_(mut self, new_value: &str) -> FloodlightActivityGroupListCall<'a, C, A> { + self._type_ = Some(new_value.to_string()); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> FloodlightActivityGroupListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> FloodlightActivityGroupListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "floodlightactivitygroup*2015" will return objects with names like "floodlightactivitygroup June 2015", "floodlightactivitygroup April 2015", or simply "floodlightactivitygroup 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "floodlightactivitygroup" will match objects with name "my floodlightactivitygroup activity", "floodlightactivitygroup 2015", or simply "floodlightactivitygroup". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> FloodlightActivityGroupListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> FloodlightActivityGroupListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> FloodlightActivityGroupListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only floodlight activity groups with the specified IDs. Must specify either advertiserId or floodlightConfigurationId for a non-empty result. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> FloodlightActivityGroupListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only floodlight activity groups with the specified floodlight configuration ID. Must specify either advertiserId, or floodlightConfigurationId for a non-empty result. + /// + /// Sets the *floodlight configuration id* query property to the given value. + pub fn floodlight_configuration_id(mut self, new_value: &str) -> FloodlightActivityGroupListCall<'a, C, A> { + self._floodlight_configuration_id = Some(new_value.to_string()); + self + } + /// Select only floodlight activity groups with the specified advertiser ID. Must specify either advertiserId or floodlightConfigurationId for a non-empty result. + /// + /// Sets the *advertiser id* query property to the given value. + pub fn advertiser_id(mut self, new_value: &str) -> FloodlightActivityGroupListCall<'a, C, A> { + self._advertiser_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FloodlightActivityGroupListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightActivityGroupListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FloodlightActivityGroupListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new floodlight activity group. +/// +/// A builder for the *insert* method supported by a *floodlightActivityGroup* resource. +/// It is not used directly, but through a `FloodlightActivityGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::FloodlightActivityGroup; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = FloodlightActivityGroup::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.floodlight_activity_groups().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightActivityGroupInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: FloodlightActivityGroup, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightActivityGroupInsertCall<'a, C, A> {} + +impl<'a, C, A> FloodlightActivityGroupInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightActivityGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivityGroups.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/floodlightActivityGroups".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: FloodlightActivityGroup) -> FloodlightActivityGroupInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightActivityGroupInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FloodlightActivityGroupInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightActivityGroupInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FloodlightActivityGroupInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing floodlight activity group. +/// +/// A builder for the *update* method supported by a *floodlightActivityGroup* resource. +/// It is not used directly, but through a `FloodlightActivityGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::FloodlightActivityGroup; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = FloodlightActivityGroup::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.floodlight_activity_groups().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightActivityGroupUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: FloodlightActivityGroup, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightActivityGroupUpdateCall<'a, C, A> {} + +impl<'a, C, A> FloodlightActivityGroupUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightActivityGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivityGroups.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/floodlightActivityGroups".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: FloodlightActivityGroup) -> FloodlightActivityGroupUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightActivityGroupUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FloodlightActivityGroupUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightActivityGroupUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FloodlightActivityGroupUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of metros. +/// +/// A builder for the *list* method supported by a *metro* resource. +/// It is not used directly, but through a `MetroMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.metros().list("profileId") +/// .doit(); +/// # } +/// ``` +pub struct MetroListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for MetroListCall<'a, C, A> {} + +impl<'a, C, A> MetroListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, MetrosListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.metros.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/metros".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> MetroListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> MetroListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> MetroListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> MetroListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of orders, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *order* resource. +/// It is not used directly, but through a `OrderMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.orders().list("profileId", "projectId") +/// .sort_order("ipsum") +/// .sort_field("justo") +/// .add_site_id("dolore") +/// .search_string("vero") +/// .page_token("dolor") +/// .max_results(-58) +/// .add_ids("et") +/// .doit(); +/// # } +/// ``` +pub struct OrderListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _project_id: String, + _sort_order: Option, + _sort_field: Option, + _site_id: Vec, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrderListCall<'a, C, A> {} + +impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, OrdersListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.orders.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((11 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("projectId", self._project_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if self._site_id.len() > 0 { + for f in self._site_id.iter() { + params.push(("siteId", f.to_string())); + } + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + for &field in ["alt", "profileId", "projectId", "sortOrder", "sortField", "siteId", "searchString", "pageToken", "maxResults", "ids"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/projects/{projectId}/orders".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{projectId}", "projectId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["projectId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> OrderListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Project ID for orders. + /// + /// Sets the *project id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project_id(mut self, new_value: &str) -> OrderListCall<'a, C, A> { + self._project_id = new_value.to_string(); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> OrderListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> OrderListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Select only orders that are associated with these site IDs. + /// + /// Append the given value to the *site id* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_site_id(mut self, new_value: &str) -> OrderListCall<'a, C, A> { + self._site_id.push(new_value.to_string()); + self + } + /// Allows searching for orders by name or ID. Wildcards (*) are allowed. For example, "order*2015" will return orders with names like "order June 2015", "order April 2015", or simply "order 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "order" will match orders with name "my order", "order 2015", or simply "order". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> OrderListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> OrderListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> OrderListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only orders with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> OrderListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrderListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> OrderListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrderListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one order by ID. +/// +/// A builder for the *get* method supported by a *order* resource. +/// It is not used directly, but through a `OrderMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.orders().get("profileId", "projectId", "id") +/// .doit(); +/// # } +/// ``` +pub struct OrderGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _project_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrderGetCall<'a, C, A> {} + +impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Order)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.orders.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("projectId", self._project_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "projectId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/projects/{projectId}/orders/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{projectId}", "projectId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["id", "projectId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> OrderGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Project ID for orders. + /// + /// Sets the *project id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project_id(mut self, new_value: &str) -> OrderGetCall<'a, C, A> { + self._project_id = new_value.to_string(); + self + } + /// Order ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> OrderGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrderGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> OrderGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrderGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of languages. +/// +/// A builder for the *list* method supported by a *language* resource. +/// It is not used directly, but through a `LanguageMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.languages().list("profileId") +/// .doit(); +/// # } +/// ``` +pub struct LanguageListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for LanguageListCall<'a, C, A> {} + +impl<'a, C, A> LanguageListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LanguagesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.languages.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/languages".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> LanguageListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> LanguageListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> LanguageListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> LanguageListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one directory site contact by ID. +/// +/// A builder for the *get* method supported by a *directorySiteContact* resource. +/// It is not used directly, but through a `DirectorySiteContactMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.directory_site_contacts().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct DirectorySiteContactGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for DirectorySiteContactGetCall<'a, C, A> {} + +impl<'a, C, A> DirectorySiteContactGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, DirectorySiteContact)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.directorySiteContacts.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/directorySiteContacts/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> DirectorySiteContactGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Directory site contact ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> DirectorySiteContactGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> DirectorySiteContactGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> DirectorySiteContactGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> DirectorySiteContactGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of directory site contacts, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *directorySiteContact* resource. +/// It is not used directly, but through a `DirectorySiteContactMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.directory_site_contacts().list("profileId") +/// .sort_order("aliquyam") +/// .sort_field("elitr") +/// .search_string("consetetur") +/// .page_token("sea") +/// .max_results(-43) +/// .add_ids("At") +/// .add_directory_site_ids("sea") +/// .doit(); +/// # } +/// ``` +pub struct DirectorySiteContactListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _directory_site_ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for DirectorySiteContactListCall<'a, C, A> {} + +impl<'a, C, A> DirectorySiteContactListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, DirectorySiteContactsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.directorySiteContacts.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((10 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if self._directory_site_ids.len() > 0 { + for f in self._directory_site_ids.iter() { + params.push(("directorySiteIds", f.to_string())); + } + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids", "directorySiteIds"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/directorySiteContacts".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> DirectorySiteContactListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> DirectorySiteContactListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> DirectorySiteContactListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name, ID or email. Wildcards (*) are allowed. For example, "directory site contact*2015" will return objects with names like "directory site contact June 2015", "directory site contact April 2015", or simply "directory site contact 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "directory site contact" will match objects with name "my directory site contact", "directory site contact 2015", or simply "directory site contact". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> DirectorySiteContactListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> DirectorySiteContactListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> DirectorySiteContactListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only directory site contacts with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> DirectorySiteContactListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only directory site contacts with these directory site IDs. This is a required field. + /// + /// Append the given value to the *directory site ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_directory_site_ids(mut self, new_value: &str) -> DirectorySiteContactListCall<'a, C, A> { + self._directory_site_ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> DirectorySiteContactListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> DirectorySiteContactListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> DirectorySiteContactListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves list of user profiles for a user. +/// +/// A builder for the *list* method supported by a *userProfile* resource. +/// It is not used directly, but through a `UserProfileMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.user_profiles().list() +/// .doit(); +/// # } +/// ``` +pub struct UserProfileListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for UserProfileListCall<'a, C, A> {} + +impl<'a, C, A> UserProfileListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, UserProfileList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.userProfiles.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); + for &field in ["alt"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> UserProfileListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> UserProfileListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> UserProfileListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one user profile by ID. +/// +/// A builder for the *get* method supported by a *userProfile* resource. +/// It is not used directly, but through a `UserProfileMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.user_profiles().get("profileId") +/// .doit(); +/// # } +/// ``` +pub struct UserProfileGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for UserProfileGetCall<'a, C, A> {} + +impl<'a, C, A> UserProfileGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, UserProfile)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.userProfiles.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The user profile ID. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> UserProfileGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> UserProfileGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> UserProfileGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> UserProfileGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing ad. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *ad* resource. +/// It is not used directly, but through a `AdMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::Ad; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Ad::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.ads().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct AdPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Ad, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdPatchCall<'a, C, A> {} + +impl<'a, C, A> AdPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Ad)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.ads.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/ads".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Ad) -> AdPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Ad ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> AdPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AdPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AdPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new ad. +/// +/// A builder for the *insert* method supported by a *ad* resource. +/// It is not used directly, but through a `AdMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::Ad; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Ad::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.ads().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct AdInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Ad, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdInsertCall<'a, C, A> {} + +impl<'a, C, A> AdInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Ad)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.ads.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/ads".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Ad) -> AdInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AdInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AdInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of ads, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *ad* resource. +/// It is not used directly, but through a `AdMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.ads().list("profileId") +/// .add_type("dolor") +/// .ssl_required(false) +/// .ssl_compliant(false) +/// .sort_order("ea") +/// .sort_field("et") +/// .add_size_ids("Stet") +/// .search_string("sed") +/// .add_remarketing_list_ids("dolor") +/// .add_placement_ids("sanctus") +/// .page_token("dolore") +/// .overridden_event_tag_id("Lorem") +/// .max_results(-96) +/// .add_landing_page_ids("consetetur") +/// .add_ids("eirmod") +/// .dynamic_click_tracker(true) +/// .add_creative_optimization_configuration_ids("gubergren") +/// .add_creative_ids("et") +/// .compatibility("sadipscing") +/// .add_campaign_ids("accusam") +/// .add_audience_segment_ids("magna") +/// .archived(false) +/// .advertiser_id("rebum.") +/// .active(false) +/// .doit(); +/// # } +/// ``` +pub struct AdListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _type_: Vec, + _ssl_required: Option, + _ssl_compliant: Option, + _sort_order: Option, + _sort_field: Option, + _size_ids: Vec, + _search_string: Option, + _remarketing_list_ids: Vec, + _placement_ids: Vec, + _page_token: Option, + _overridden_event_tag_id: Option, + _max_results: Option, + _landing_page_ids: Vec, + _ids: Vec, + _dynamic_click_tracker: Option, + _creative_optimization_configuration_ids: Vec, + _creative_ids: Vec, + _compatibility: Option, + _campaign_ids: Vec, + _audience_segment_ids: Vec, + _archived: Option, + _advertiser_id: Option, + _active: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdListCall<'a, C, A> {} + +impl<'a, C, A> AdListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AdsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.ads.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((26 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if self._type_.len() > 0 { + for f in self._type_.iter() { + params.push(("type", f.to_string())); + } + } + if let Some(value) = self._ssl_required { + params.push(("sslRequired", value.to_string())); + } + if let Some(value) = self._ssl_compliant { + params.push(("sslCompliant", value.to_string())); + } + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if self._size_ids.len() > 0 { + for f in self._size_ids.iter() { + params.push(("sizeIds", f.to_string())); + } + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if self._remarketing_list_ids.len() > 0 { + for f in self._remarketing_list_ids.iter() { + params.push(("remarketingListIds", f.to_string())); + } + } + if self._placement_ids.len() > 0 { + for f in self._placement_ids.iter() { + params.push(("placementIds", f.to_string())); + } + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._overridden_event_tag_id { + params.push(("overriddenEventTagId", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._landing_page_ids.len() > 0 { + for f in self._landing_page_ids.iter() { + params.push(("landingPageIds", f.to_string())); + } + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if let Some(value) = self._dynamic_click_tracker { + params.push(("dynamicClickTracker", value.to_string())); + } + if self._creative_optimization_configuration_ids.len() > 0 { + for f in self._creative_optimization_configuration_ids.iter() { + params.push(("creativeOptimizationConfigurationIds", f.to_string())); + } + } + if self._creative_ids.len() > 0 { + for f in self._creative_ids.iter() { + params.push(("creativeIds", f.to_string())); + } + } + if let Some(value) = self._compatibility { + params.push(("compatibility", value.to_string())); + } + if self._campaign_ids.len() > 0 { + for f in self._campaign_ids.iter() { + params.push(("campaignIds", f.to_string())); + } + } + if self._audience_segment_ids.len() > 0 { + for f in self._audience_segment_ids.iter() { + params.push(("audienceSegmentIds", f.to_string())); + } + } + if let Some(value) = self._archived { + params.push(("archived", value.to_string())); + } + if let Some(value) = self._advertiser_id { + params.push(("advertiserId", value.to_string())); + } + if let Some(value) = self._active { + params.push(("active", value.to_string())); + } + for &field in ["alt", "profileId", "type", "sslRequired", "sslCompliant", "sortOrder", "sortField", "sizeIds", "searchString", "remarketingListIds", "placementIds", "pageToken", "overriddenEventTagId", "maxResults", "landingPageIds", "ids", "dynamicClickTracker", "creativeOptimizationConfigurationIds", "creativeIds", "compatibility", "campaignIds", "audienceSegmentIds", "archived", "advertiserId", "active"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/ads".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only ads with these types. + /// + /// Append the given value to the *type* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_type(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._type_.push(new_value.to_string()); + self + } + /// Select only ads that require SSL. + /// + /// Sets the *ssl required* query property to the given value. + pub fn ssl_required(mut self, new_value: bool) -> AdListCall<'a, C, A> { + self._ssl_required = Some(new_value); + self + } + /// Select only ads that are SSL-compliant. + /// + /// Sets the *ssl compliant* query property to the given value. + pub fn ssl_compliant(mut self, new_value: bool) -> AdListCall<'a, C, A> { + self._ssl_compliant = Some(new_value); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Select only ads with these size IDs. + /// + /// Append the given value to the *size ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_size_ids(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._size_ids.push(new_value.to_string()); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "ad*2015" will return objects with names like "ad June 2015", "ad April 2015", or simply "ad 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "ad" will match objects with name "my ad", "ad 2015", or simply "ad". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Select only ads whose list targeting expression use these remarketing list IDs. + /// + /// Append the given value to the *remarketing list ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_remarketing_list_ids(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._remarketing_list_ids.push(new_value.to_string()); + self + } + /// Select only ads with these placement IDs assigned. + /// + /// Append the given value to the *placement ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_placement_ids(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._placement_ids.push(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Select only ads with this event tag override ID. + /// + /// Sets the *overridden event tag id* query property to the given value. + pub fn overridden_event_tag_id(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._overridden_event_tag_id = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> AdListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only ads with these landing page IDs. + /// + /// Append the given value to the *landing page ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_landing_page_ids(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._landing_page_ids.push(new_value.to_string()); + self + } + /// Select only ads with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only dynamic click trackers. Applicable when type is AD_SERVING_CLICK_TRACKER. If true, select dynamic click trackers. If false, select static click trackers. Leave unset to select both. + /// + /// Sets the *dynamic click tracker* query property to the given value. + pub fn dynamic_click_tracker(mut self, new_value: bool) -> AdListCall<'a, C, A> { + self._dynamic_click_tracker = Some(new_value); + self + } + /// Select only ads with these creative optimization configuration IDs. + /// + /// Append the given value to the *creative optimization configuration ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_creative_optimization_configuration_ids(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._creative_optimization_configuration_ids.push(new_value.to_string()); + self + } + /// Select only ads with these creative IDs assigned. + /// + /// Append the given value to the *creative ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_creative_ids(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._creative_ids.push(new_value.to_string()); + self + } + /// Select default ads with the specified compatibility. Applicable when type is AD_SERVING_DEFAULT_AD. DISPLAY and DISPLAY_INTERSTITIAL refer to rendering either on desktop or on mobile devices for regular or interstitial ads, respectively. APP and APP_INTERSTITIAL are for rendering in mobile apps. IN_STREAM_VIDEO refers to rendering an in-stream video ads developed with the VAST standard. + /// + /// Sets the *compatibility* query property to the given value. + pub fn compatibility(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._compatibility = Some(new_value.to_string()); + self + } + /// Select only ads with these campaign IDs. + /// + /// Append the given value to the *campaign ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_campaign_ids(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._campaign_ids.push(new_value.to_string()); + self + } + /// Select only ads with these audience segment IDs. + /// + /// Append the given value to the *audience segment ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_audience_segment_ids(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._audience_segment_ids.push(new_value.to_string()); + self + } + /// Select only archived ads. + /// + /// Sets the *archived* query property to the given value. + pub fn archived(mut self, new_value: bool) -> AdListCall<'a, C, A> { + self._archived = Some(new_value); + self + } + /// Select only ads with this advertiser ID. + /// + /// Sets the *advertiser id* query property to the given value. + pub fn advertiser_id(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._advertiser_id = Some(new_value.to_string()); + self + } + /// Select only active ads. + /// + /// Sets the *active* query property to the given value. + pub fn active(mut self, new_value: bool) -> AdListCall<'a, C, A> { + self._active = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AdListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AdListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one ad by ID. +/// +/// A builder for the *get* method supported by a *ad* resource. +/// It is not used directly, but through a `AdMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.ads().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct AdGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdGetCall<'a, C, A> {} + +impl<'a, C, A> AdGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Ad)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.ads.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/ads/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Ad ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> AdGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AdGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AdGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing ad. +/// +/// A builder for the *update* method supported by a *ad* resource. +/// It is not used directly, but through a `AdMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::Ad; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Ad::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.ads().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct AdUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Ad, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdUpdateCall<'a, C, A> {} + +impl<'a, C, A> AdUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Ad)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.ads.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/ads".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Ad) -> AdUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AdUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AdUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one account permission by ID. +/// +/// A builder for the *get* method supported by a *accountPermission* resource. +/// It is not used directly, but through a `AccountPermissionMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.account_permissions().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct AccountPermissionGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountPermissionGetCall<'a, C, A> {} + +impl<'a, C, A> AccountPermissionGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AccountPermission)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.accountPermissions.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/accountPermissions/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AccountPermissionGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Account permission ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> AccountPermissionGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountPermissionGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountPermissionGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccountPermissionGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves the list of account permissions. +/// +/// A builder for the *list* method supported by a *accountPermission* resource. +/// It is not used directly, but through a `AccountPermissionMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.account_permissions().list("profileId") +/// .doit(); +/// # } +/// ``` +pub struct AccountPermissionListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountPermissionListCall<'a, C, A> {} + +impl<'a, C, A> AccountPermissionListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AccountPermissionsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.accountPermissions.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/accountPermissions".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AccountPermissionListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountPermissionListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountPermissionListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccountPermissionListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of connection types. +/// +/// A builder for the *list* method supported by a *connectionType* resource. +/// It is not used directly, but through a `ConnectionTypeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.connection_types().list("profileId") +/// .doit(); +/// # } +/// ``` +pub struct ConnectionTypeListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ConnectionTypeListCall<'a, C, A> {} + +impl<'a, C, A> ConnectionTypeListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ConnectionTypesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.connectionTypes.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/connectionTypes".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ConnectionTypeListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ConnectionTypeListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ConnectionTypeListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ConnectionTypeListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one connection type by ID. +/// +/// A builder for the *get* method supported by a *connectionType* resource. +/// It is not used directly, but through a `ConnectionTypeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.connection_types().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct ConnectionTypeGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ConnectionTypeGetCall<'a, C, A> {} + +impl<'a, C, A> ConnectionTypeGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ConnectionType)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.connectionTypes.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/connectionTypes/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ConnectionTypeGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Connection type ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> ConnectionTypeGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ConnectionTypeGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ConnectionTypeGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ConnectionTypeGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of targetable remarketing lists, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *targetableRemarketingList* resource. +/// It is not used directly, but through a `TargetableRemarketingListMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.targetable_remarketing_lists().list("profileId", "advertiserId") +/// .sort_order("dolore") +/// .sort_field("amet.") +/// .page_token("dolore") +/// .name("magna") +/// .max_results(-94) +/// .active(false) +/// .doit(); +/// # } +/// ``` +pub struct TargetableRemarketingListListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _advertiser_id: String, + _sort_order: Option, + _sort_field: Option, + _page_token: Option, + _name: Option, + _max_results: Option, + _active: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for TargetableRemarketingListListCall<'a, C, A> {} + +impl<'a, C, A> TargetableRemarketingListListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, TargetableRemarketingListsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.targetableRemarketingLists.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((10 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("advertiserId", self._advertiser_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._name { + params.push(("name", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._active { + params.push(("active", value.to_string())); + } + for &field in ["alt", "profileId", "advertiserId", "sortOrder", "sortField", "pageToken", "name", "maxResults", "active"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/targetableRemarketingLists".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> TargetableRemarketingListListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only targetable remarketing lists targetable by these advertisers. + /// + /// Sets the *advertiser id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn advertiser_id(mut self, new_value: &str) -> TargetableRemarketingListListCall<'a, C, A> { + self._advertiser_id = new_value.to_string(); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> TargetableRemarketingListListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> TargetableRemarketingListListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> TargetableRemarketingListListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "remarketing list*2015" will return objects with names like "remarketing list June 2015", "remarketing list April 2015", or simply "remarketing list 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "remarketing list" will match objects with name "my remarketing list", "remarketing list 2015", or simply "remarketing list". + /// + /// Sets the *name* query property to the given value. + pub fn name(mut self, new_value: &str) -> TargetableRemarketingListListCall<'a, C, A> { + self._name = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> TargetableRemarketingListListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only active or only inactive targetable remarketing lists. + /// + /// Sets the *active* query property to the given value. + pub fn active(mut self, new_value: bool) -> TargetableRemarketingListListCall<'a, C, A> { + self._active = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> TargetableRemarketingListListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> TargetableRemarketingListListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> TargetableRemarketingListListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one remarketing list by ID. +/// +/// A builder for the *get* method supported by a *targetableRemarketingList* resource. +/// It is not used directly, but through a `TargetableRemarketingListMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.targetable_remarketing_lists().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct TargetableRemarketingListGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for TargetableRemarketingListGetCall<'a, C, A> {} + +impl<'a, C, A> TargetableRemarketingListGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, TargetableRemarketingList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.targetableRemarketingLists.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/targetableRemarketingLists/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> TargetableRemarketingListGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Remarketing list ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> TargetableRemarketingListGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> TargetableRemarketingListGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> TargetableRemarketingListGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> TargetableRemarketingListGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one advertiser group by ID. +/// +/// A builder for the *get* method supported by a *advertiserGroup* resource. +/// It is not used directly, but through a `AdvertiserGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.advertiser_groups().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct AdvertiserGroupGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdvertiserGroupGetCall<'a, C, A> {} + +impl<'a, C, A> AdvertiserGroupGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AdvertiserGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.advertiserGroups.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/advertiserGroups/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdvertiserGroupGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Advertiser group ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> AdvertiserGroupGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AdvertiserGroupGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdvertiserGroupGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AdvertiserGroupGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of advertiser groups, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *advertiserGroup* resource. +/// It is not used directly, but through a `AdvertiserGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.advertiser_groups().list("profileId") +/// .sort_order("nonumy") +/// .sort_field("sed") +/// .search_string("diam") +/// .page_token("magna") +/// .max_results(-99) +/// .add_ids("Lorem") +/// .doit(); +/// # } +/// ``` +pub struct AdvertiserGroupListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdvertiserGroupListCall<'a, C, A> {} + +impl<'a, C, A> AdvertiserGroupListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AdvertiserGroupsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.advertiserGroups.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/advertiserGroups".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdvertiserGroupListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> AdvertiserGroupListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> AdvertiserGroupListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "advertiser*2015" will return objects with names like "advertiser group June 2015", "advertiser group April 2015", or simply "advertiser group 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "advertisergroup" will match objects with name "my advertisergroup", "advertisergroup 2015", or simply "advertisergroup". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> AdvertiserGroupListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> AdvertiserGroupListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> AdvertiserGroupListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only advertiser groups with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> AdvertiserGroupListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AdvertiserGroupListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdvertiserGroupListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AdvertiserGroupListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new advertiser group. +/// +/// A builder for the *insert* method supported by a *advertiserGroup* resource. +/// It is not used directly, but through a `AdvertiserGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::AdvertiserGroup; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = AdvertiserGroup::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.advertiser_groups().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct AdvertiserGroupInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: AdvertiserGroup, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdvertiserGroupInsertCall<'a, C, A> {} + +impl<'a, C, A> AdvertiserGroupInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AdvertiserGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.advertiserGroups.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/advertiserGroups".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: AdvertiserGroup) -> AdvertiserGroupInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdvertiserGroupInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AdvertiserGroupInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdvertiserGroupInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AdvertiserGroupInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing advertiser group. +/// +/// A builder for the *update* method supported by a *advertiserGroup* resource. +/// It is not used directly, but through a `AdvertiserGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::AdvertiserGroup; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = AdvertiserGroup::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.advertiser_groups().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct AdvertiserGroupUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: AdvertiserGroup, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdvertiserGroupUpdateCall<'a, C, A> {} + +impl<'a, C, A> AdvertiserGroupUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AdvertiserGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.advertiserGroups.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/advertiserGroups".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: AdvertiserGroup) -> AdvertiserGroupUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdvertiserGroupUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AdvertiserGroupUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdvertiserGroupUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AdvertiserGroupUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing advertiser group. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *advertiserGroup* resource. +/// It is not used directly, but through a `AdvertiserGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::AdvertiserGroup; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = AdvertiserGroup::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.advertiser_groups().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct AdvertiserGroupPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: AdvertiserGroup, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdvertiserGroupPatchCall<'a, C, A> {} + +impl<'a, C, A> AdvertiserGroupPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AdvertiserGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.advertiserGroups.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/advertiserGroups".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: AdvertiserGroup) -> AdvertiserGroupPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdvertiserGroupPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Advertiser group ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> AdvertiserGroupPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AdvertiserGroupPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdvertiserGroupPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AdvertiserGroupPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes an existing advertiser group. +/// +/// A builder for the *delete* method supported by a *advertiserGroup* resource. +/// It is not used directly, but through a `AdvertiserGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.advertiser_groups().delete("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct AdvertiserGroupDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdvertiserGroupDeleteCall<'a, C, A> {} + +impl<'a, C, A> AdvertiserGroupDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.advertiserGroups.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/advertiserGroups/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdvertiserGroupDeleteCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Advertiser group ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> AdvertiserGroupDeleteCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AdvertiserGroupDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdvertiserGroupDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AdvertiserGroupDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new site. +/// +/// A builder for the *insert* method supported by a *site* resource. +/// It is not used directly, but through a `SiteMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::Site; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Site::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.sites().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct SiteInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Site, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SiteInsertCall<'a, C, A> {} + +impl<'a, C, A> SiteInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Site)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.sites.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/sites".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Site) -> SiteInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> SiteInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> SiteInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SiteInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> SiteInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one site by ID. +/// +/// A builder for the *get* method supported by a *site* resource. +/// It is not used directly, but through a `SiteMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.sites().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct SiteGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SiteGetCall<'a, C, A> {} + +impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Site)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.sites.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/sites/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> SiteGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Site ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> SiteGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> SiteGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SiteGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> SiteGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of sites, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *site* resource. +/// It is not used directly, but through a `SiteMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.sites().list("profileId") +/// .unmapped_site(true) +/// .subaccount_id("sed") +/// .sort_order("et") +/// .sort_field("aliquyam") +/// .search_string("nonumy") +/// .page_token("sit") +/// .max_results(-31) +/// .add_ids("sadipscing") +/// .add_directory_site_ids("magna") +/// .add_campaign_ids("gubergren") +/// .approved(false) +/// .ad_words_site(false) +/// .accepts_publisher_paid_placements(true) +/// .accepts_interstitial_placements(false) +/// .accepts_in_stream_video_placements(true) +/// .doit(); +/// # } +/// ``` +pub struct SiteListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _unmapped_site: Option, + _subaccount_id: Option, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _directory_site_ids: Vec, + _campaign_ids: Vec, + _approved: Option, + _ad_words_site: Option, + _accepts_publisher_paid_placements: Option, + _accepts_interstitial_placements: Option, + _accepts_in_stream_video_placements: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SiteListCall<'a, C, A> {} + +impl<'a, C, A> SiteListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, SitesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.sites.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((18 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._unmapped_site { + params.push(("unmappedSite", value.to_string())); + } + if let Some(value) = self._subaccount_id { + params.push(("subaccountId", value.to_string())); + } + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if self._directory_site_ids.len() > 0 { + for f in self._directory_site_ids.iter() { + params.push(("directorySiteIds", f.to_string())); + } + } + if self._campaign_ids.len() > 0 { + for f in self._campaign_ids.iter() { + params.push(("campaignIds", f.to_string())); + } + } + if let Some(value) = self._approved { + params.push(("approved", value.to_string())); + } + if let Some(value) = self._ad_words_site { + params.push(("adWordsSite", value.to_string())); + } + if let Some(value) = self._accepts_publisher_paid_placements { + params.push(("acceptsPublisherPaidPlacements", value.to_string())); + } + if let Some(value) = self._accepts_interstitial_placements { + params.push(("acceptsInterstitialPlacements", value.to_string())); + } + if let Some(value) = self._accepts_in_stream_video_placements { + params.push(("acceptsInStreamVideoPlacements", value.to_string())); + } + for &field in ["alt", "profileId", "unmappedSite", "subaccountId", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids", "directorySiteIds", "campaignIds", "approved", "adWordsSite", "acceptsPublisherPaidPlacements", "acceptsInterstitialPlacements", "acceptsInStreamVideoPlacements"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/sites".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> SiteListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only sites that have not been mapped to a directory site. + /// + /// Sets the *unmapped site* query property to the given value. + pub fn unmapped_site(mut self, new_value: bool) -> SiteListCall<'a, C, A> { + self._unmapped_site = Some(new_value); + self + } + /// Select only sites with this subaccount ID. + /// + /// Sets the *subaccount id* query property to the given value. + pub fn subaccount_id(mut self, new_value: &str) -> SiteListCall<'a, C, A> { + self._subaccount_id = Some(new_value.to_string()); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> SiteListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> SiteListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name, ID or keyName. Wildcards (*) are allowed. For example, "site*2015" will return objects with names like "site June 2015", "site April 2015", or simply "site 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "site" will match objects with name "my site", "site 2015", or simply "site". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> SiteListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> SiteListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> SiteListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only sites with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> SiteListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only sites with these directory site IDs. + /// + /// Append the given value to the *directory site ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_directory_site_ids(mut self, new_value: &str) -> SiteListCall<'a, C, A> { + self._directory_site_ids.push(new_value.to_string()); + self + } + /// Select only sites with these campaign IDs. + /// + /// Append the given value to the *campaign ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_campaign_ids(mut self, new_value: &str) -> SiteListCall<'a, C, A> { + self._campaign_ids.push(new_value.to_string()); + self + } + /// Select only approved sites. + /// + /// Sets the *approved* query property to the given value. + pub fn approved(mut self, new_value: bool) -> SiteListCall<'a, C, A> { + self._approved = Some(new_value); + self + } + /// Select only AdWords sites. + /// + /// Sets the *ad words site* query property to the given value. + pub fn ad_words_site(mut self, new_value: bool) -> SiteListCall<'a, C, A> { + self._ad_words_site = Some(new_value); + self + } + /// Select only sites that accept publisher paid placements. + /// + /// Sets the *accepts publisher paid placements* query property to the given value. + pub fn accepts_publisher_paid_placements(mut self, new_value: bool) -> SiteListCall<'a, C, A> { + self._accepts_publisher_paid_placements = Some(new_value); + self + } + /// This search filter is no longer supported and will have no effect on the results returned. + /// + /// Sets the *accepts interstitial placements* query property to the given value. + pub fn accepts_interstitial_placements(mut self, new_value: bool) -> SiteListCall<'a, C, A> { + self._accepts_interstitial_placements = Some(new_value); + self + } + /// This search filter is no longer supported and will have no effect on the results returned. + /// + /// Sets the *accepts in stream video placements* query property to the given value. + pub fn accepts_in_stream_video_placements(mut self, new_value: bool) -> SiteListCall<'a, C, A> { + self._accepts_in_stream_video_placements = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> SiteListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SiteListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> SiteListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing site. +/// +/// A builder for the *update* method supported by a *site* resource. +/// It is not used directly, but through a `SiteMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::Site; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Site::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.sites().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct SiteUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Site, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SiteUpdateCall<'a, C, A> {} + +impl<'a, C, A> SiteUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Site)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.sites.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/sites".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Site) -> SiteUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> SiteUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> SiteUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SiteUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> SiteUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing site. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *site* resource. +/// It is not used directly, but through a `SiteMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::Site; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Site::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.sites().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct SitePatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Site, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SitePatchCall<'a, C, A> {} + +impl<'a, C, A> SitePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Site)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.sites.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/sites".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Site) -> SitePatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> SitePatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Site ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> SitePatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> SitePatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SitePatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> SitePatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one floodlight activity by ID. +/// +/// A builder for the *get* method supported by a *floodlightActivity* resource. +/// It is not used directly, but through a `FloodlightActivityMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.floodlight_activities().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightActivityGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightActivityGetCall<'a, C, A> {} + +impl<'a, C, A> FloodlightActivityGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightActivity)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/floodlightActivities/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightActivityGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Floodlight activity ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> FloodlightActivityGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FloodlightActivityGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightActivityGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FloodlightActivityGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of floodlight activities, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *floodlightActivity* resource. +/// It is not used directly, but through a `FloodlightActivityMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.floodlight_activities().list("profileId") +/// .tag_string("Lorem") +/// .sort_order("sed") +/// .sort_field("sit") +/// .search_string("dolore") +/// .page_token("et") +/// .max_results(-26) +/// .add_ids("sit") +/// .floodlight_configuration_id("ut") +/// .floodlight_activity_group_type("diam") +/// .floodlight_activity_group_tag_string("tempor") +/// .floodlight_activity_group_name("et") +/// .add_floodlight_activity_group_ids("erat") +/// .advertiser_id("dolores") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightActivityListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _tag_string: Option, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _floodlight_configuration_id: Option, + _floodlight_activity_group_type: Option, + _floodlight_activity_group_tag_string: Option, + _floodlight_activity_group_name: Option, + _floodlight_activity_group_ids: Vec, + _advertiser_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightActivityListCall<'a, C, A> {} + +impl<'a, C, A> FloodlightActivityListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightActivitiesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((16 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._tag_string { + params.push(("tagString", value.to_string())); + } + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if let Some(value) = self._floodlight_configuration_id { + params.push(("floodlightConfigurationId", value.to_string())); + } + if let Some(value) = self._floodlight_activity_group_type { + params.push(("floodlightActivityGroupType", value.to_string())); + } + if let Some(value) = self._floodlight_activity_group_tag_string { + params.push(("floodlightActivityGroupTagString", value.to_string())); + } + if let Some(value) = self._floodlight_activity_group_name { + params.push(("floodlightActivityGroupName", value.to_string())); + } + if self._floodlight_activity_group_ids.len() > 0 { + for f in self._floodlight_activity_group_ids.iter() { + params.push(("floodlightActivityGroupIds", f.to_string())); + } + } + if let Some(value) = self._advertiser_id { + params.push(("advertiserId", value.to_string())); + } + for &field in ["alt", "profileId", "tagString", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids", "floodlightConfigurationId", "floodlightActivityGroupType", "floodlightActivityGroupTagString", "floodlightActivityGroupName", "floodlightActivityGroupIds", "advertiserId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/floodlightActivities".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightActivityListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only floodlight activities with the specified tag string. + /// + /// Sets the *tag string* query property to the given value. + pub fn tag_string(mut self, new_value: &str) -> FloodlightActivityListCall<'a, C, A> { + self._tag_string = Some(new_value.to_string()); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> FloodlightActivityListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> FloodlightActivityListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "floodlightactivity*2015" will return objects with names like "floodlightactivity June 2015", "floodlightactivity April 2015", or simply "floodlightactivity 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "floodlightactivity" will match objects with name "my floodlightactivity activity", "floodlightactivity 2015", or simply "floodlightactivity". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> FloodlightActivityListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> FloodlightActivityListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> FloodlightActivityListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only floodlight activities with the specified IDs. Must specify either ids, advertiserId, or floodlightConfigurationId for a non-empty result. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> FloodlightActivityListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only floodlight activities for the specified floodlight configuration ID. Must specify either ids, advertiserId, or floodlightConfigurationId for a non-empty result. + /// + /// Sets the *floodlight configuration id* query property to the given value. + pub fn floodlight_configuration_id(mut self, new_value: &str) -> FloodlightActivityListCall<'a, C, A> { + self._floodlight_configuration_id = Some(new_value.to_string()); + self + } + /// Select only floodlight activities with the specified floodlight activity group type. + /// + /// Sets the *floodlight activity group type* query property to the given value. + pub fn floodlight_activity_group_type(mut self, new_value: &str) -> FloodlightActivityListCall<'a, C, A> { + self._floodlight_activity_group_type = Some(new_value.to_string()); + self + } + /// Select only floodlight activities with the specified floodlight activity group tag string. + /// + /// Sets the *floodlight activity group tag string* query property to the given value. + pub fn floodlight_activity_group_tag_string(mut self, new_value: &str) -> FloodlightActivityListCall<'a, C, A> { + self._floodlight_activity_group_tag_string = Some(new_value.to_string()); + self + } + /// Select only floodlight activities with the specified floodlight activity group name. + /// + /// Sets the *floodlight activity group name* query property to the given value. + pub fn floodlight_activity_group_name(mut self, new_value: &str) -> FloodlightActivityListCall<'a, C, A> { + self._floodlight_activity_group_name = Some(new_value.to_string()); + self + } + /// Select only floodlight activities with the specified floodlight activity group IDs. + /// + /// Append the given value to the *floodlight activity group ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_floodlight_activity_group_ids(mut self, new_value: &str) -> FloodlightActivityListCall<'a, C, A> { + self._floodlight_activity_group_ids.push(new_value.to_string()); + self + } + /// Select only floodlight activities for the specified advertiser ID. Must specify either ids, advertiserId, or floodlightConfigurationId for a non-empty result. + /// + /// Sets the *advertiser id* query property to the given value. + pub fn advertiser_id(mut self, new_value: &str) -> FloodlightActivityListCall<'a, C, A> { + self._advertiser_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FloodlightActivityListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightActivityListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FloodlightActivityListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new floodlight activity. +/// +/// A builder for the *insert* method supported by a *floodlightActivity* resource. +/// It is not used directly, but through a `FloodlightActivityMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::FloodlightActivity; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = FloodlightActivity::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.floodlight_activities().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightActivityInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: FloodlightActivity, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightActivityInsertCall<'a, C, A> {} + +impl<'a, C, A> FloodlightActivityInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightActivity)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/floodlightActivities".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: FloodlightActivity) -> FloodlightActivityInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightActivityInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FloodlightActivityInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightActivityInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FloodlightActivityInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes an existing floodlight activity. +/// +/// A builder for the *delete* method supported by a *floodlightActivity* resource. +/// It is not used directly, but through a `FloodlightActivityMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.floodlight_activities().delete("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightActivityDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightActivityDeleteCall<'a, C, A> {} + +impl<'a, C, A> FloodlightActivityDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/floodlightActivities/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightActivityDeleteCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Floodlight activity ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> FloodlightActivityDeleteCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FloodlightActivityDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightActivityDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FloodlightActivityDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing floodlight activity. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *floodlightActivity* resource. +/// It is not used directly, but through a `FloodlightActivityMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::FloodlightActivity; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = FloodlightActivity::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.floodlight_activities().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightActivityPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: FloodlightActivity, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightActivityPatchCall<'a, C, A> {} + +impl<'a, C, A> FloodlightActivityPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightActivity)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/floodlightActivities".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: FloodlightActivity) -> FloodlightActivityPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightActivityPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Floodlight activity ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> FloodlightActivityPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FloodlightActivityPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightActivityPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FloodlightActivityPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Generates a tag for a floodlight activity. +/// +/// A builder for the *generatetag* method supported by a *floodlightActivity* resource. +/// It is not used directly, but through a `FloodlightActivityMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.floodlight_activities().generatetag("profileId") +/// .floodlight_activity_id("eos") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightActivityGeneratetagCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _floodlight_activity_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightActivityGeneratetagCall<'a, C, A> {} + +impl<'a, C, A> FloodlightActivityGeneratetagCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightActivitiesGenerateTagResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.generatetag", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._floodlight_activity_id { + params.push(("floodlightActivityId", value.to_string())); + } + for &field in ["alt", "profileId", "floodlightActivityId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/floodlightActivities/generatetag".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightActivityGeneratetagCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Floodlight activity ID for which we want to generate a tag. + /// + /// Sets the *floodlight activity id* query property to the given value. + pub fn floodlight_activity_id(mut self, new_value: &str) -> FloodlightActivityGeneratetagCall<'a, C, A> { + self._floodlight_activity_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FloodlightActivityGeneratetagCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightActivityGeneratetagCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FloodlightActivityGeneratetagCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing floodlight activity. +/// +/// A builder for the *update* method supported by a *floodlightActivity* resource. +/// It is not used directly, but through a `FloodlightActivityMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::FloodlightActivity; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = FloodlightActivity::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.floodlight_activities().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightActivityUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: FloodlightActivity, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightActivityUpdateCall<'a, C, A> {} + +impl<'a, C, A> FloodlightActivityUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightActivity)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/floodlightActivities".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: FloodlightActivity) -> FloodlightActivityUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightActivityUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FloodlightActivityUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightActivityUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FloodlightActivityUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of regions. +/// +/// A builder for the *list* method supported by a *region* resource. +/// It is not used directly, but through a `RegionMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.regions().list("profileId") +/// .doit(); +/// # } +/// ``` +pub struct RegionListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RegionListCall<'a, C, A> {} + +impl<'a, C, A> RegionListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, RegionsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.regions.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/regions".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> RegionListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> RegionListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RegionListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> RegionListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new creative group. +/// +/// A builder for the *insert* method supported by a *creativeGroup* resource. +/// It is not used directly, but through a `CreativeGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::CreativeGroup; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = CreativeGroup::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creative_groups().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct CreativeGroupInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: CreativeGroup, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeGroupInsertCall<'a, C, A> {} + +impl<'a, C, A> CreativeGroupInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeGroups.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/creativeGroups".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: CreativeGroup) -> CreativeGroupInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeGroupInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeGroupInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeGroupInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeGroupInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one creative group by ID. +/// +/// A builder for the *get* method supported by a *creativeGroup* resource. +/// It is not used directly, but through a `CreativeGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creative_groups().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct CreativeGroupGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeGroupGetCall<'a, C, A> {} + +impl<'a, C, A> CreativeGroupGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeGroups.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/creativeGroups/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeGroupGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Creative group ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CreativeGroupGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeGroupGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeGroupGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeGroupGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing creative group. +/// +/// A builder for the *update* method supported by a *creativeGroup* resource. +/// It is not used directly, but through a `CreativeGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::CreativeGroup; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = CreativeGroup::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creative_groups().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct CreativeGroupUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: CreativeGroup, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeGroupUpdateCall<'a, C, A> {} + +impl<'a, C, A> CreativeGroupUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeGroups.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/creativeGroups".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: CreativeGroup) -> CreativeGroupUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeGroupUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeGroupUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeGroupUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeGroupUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of creative groups, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *creativeGroup* resource. +/// It is not used directly, but through a `CreativeGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creative_groups().list("profileId") +/// .sort_order("gubergren") +/// .sort_field("erat") +/// .search_string("et") +/// .page_token("amet") +/// .max_results(-101) +/// .add_ids("voluptua.") +/// .group_number(-66) +/// .add_advertiser_ids("justo") +/// .doit(); +/// # } +/// ``` +pub struct CreativeGroupListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _group_number: Option, + _advertiser_ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeGroupListCall<'a, C, A> {} + +impl<'a, C, A> CreativeGroupListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeGroupsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeGroups.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((11 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if let Some(value) = self._group_number { + params.push(("groupNumber", value.to_string())); + } + if self._advertiser_ids.len() > 0 { + for f in self._advertiser_ids.iter() { + params.push(("advertiserIds", f.to_string())); + } + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids", "groupNumber", "advertiserIds"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/creativeGroups".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeGroupListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> CreativeGroupListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> CreativeGroupListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for creative groups by name or ID. Wildcards (*) are allowed. For example, "creativegroup*2015" will return creative groups with names like "creativegroup June 2015", "creativegroup April 2015", or simply "creativegroup 2015". Most of the searches also add wild-cards implicitly at the start and the end of the search string. For example, a search string of "creativegroup" will match creative groups with the name "my creativegroup", "creativegroup 2015", or simply "creativegroup". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> CreativeGroupListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> CreativeGroupListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> CreativeGroupListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only creative groups with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> CreativeGroupListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only creative groups that belong to this subgroup. + /// + /// Sets the *group number* query property to the given value. + pub fn group_number(mut self, new_value: i32) -> CreativeGroupListCall<'a, C, A> { + self._group_number = Some(new_value); + self + } + /// Select only creative groups that belong to these advertisers. + /// + /// Append the given value to the *advertiser ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_advertiser_ids(mut self, new_value: &str) -> CreativeGroupListCall<'a, C, A> { + self._advertiser_ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeGroupListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeGroupListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeGroupListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing creative group. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *creativeGroup* resource. +/// It is not used directly, but through a `CreativeGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::CreativeGroup; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = CreativeGroup::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creative_groups().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct CreativeGroupPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: CreativeGroup, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeGroupPatchCall<'a, C, A> {} + +impl<'a, C, A> CreativeGroupPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeGroups.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/creativeGroups".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: CreativeGroup) -> CreativeGroupPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeGroupPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Creative group ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CreativeGroupPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeGroupPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeGroupPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeGroupPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing targeting template. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *targetingTemplate* resource. +/// It is not used directly, but through a `TargetingTemplateMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::TargetingTemplate; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = TargetingTemplate::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.targeting_templates().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct TargetingTemplatePatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: TargetingTemplate, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for TargetingTemplatePatchCall<'a, C, A> {} + +impl<'a, C, A> TargetingTemplatePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, TargetingTemplate)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.targetingTemplates.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/targetingTemplates".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: TargetingTemplate) -> TargetingTemplatePatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> TargetingTemplatePatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Targeting template ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> TargetingTemplatePatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> TargetingTemplatePatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> TargetingTemplatePatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> TargetingTemplatePatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of targeting templates, optionally filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *targetingTemplate* resource. +/// It is not used directly, but through a `TargetingTemplateMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.targeting_templates().list("profileId") +/// .sort_order("voluptua.") +/// .sort_field("no") +/// .search_string("aliquyam") +/// .page_token("magna") +/// .max_results(-17) +/// .add_ids("sed") +/// .advertiser_id("est") +/// .doit(); +/// # } +/// ``` +pub struct TargetingTemplateListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _advertiser_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for TargetingTemplateListCall<'a, C, A> {} + +impl<'a, C, A> TargetingTemplateListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, TargetingTemplatesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.targetingTemplates.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((10 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if let Some(value) = self._advertiser_id { + params.push(("advertiserId", value.to_string())); + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids", "advertiserId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/targetingTemplates".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> TargetingTemplateListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> TargetingTemplateListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> TargetingTemplateListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "template*2015" will return objects with names like "template June 2015", "template April 2015", or simply "template 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "template" will match objects with name "my template", "template 2015", or simply "template". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> TargetingTemplateListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> TargetingTemplateListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> TargetingTemplateListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only targeting templates with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> TargetingTemplateListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only targeting templates with this advertiser ID. + /// + /// Sets the *advertiser id* query property to the given value. + pub fn advertiser_id(mut self, new_value: &str) -> TargetingTemplateListCall<'a, C, A> { + self._advertiser_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> TargetingTemplateListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> TargetingTemplateListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> TargetingTemplateListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one targeting template by ID. +/// +/// A builder for the *get* method supported by a *targetingTemplate* resource. +/// It is not used directly, but through a `TargetingTemplateMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.targeting_templates().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct TargetingTemplateGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for TargetingTemplateGetCall<'a, C, A> {} + +impl<'a, C, A> TargetingTemplateGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, TargetingTemplate)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.targetingTemplates.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/targetingTemplates/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> TargetingTemplateGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Targeting template ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> TargetingTemplateGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> TargetingTemplateGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> TargetingTemplateGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> TargetingTemplateGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new targeting template. +/// +/// A builder for the *insert* method supported by a *targetingTemplate* resource. +/// It is not used directly, but through a `TargetingTemplateMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::TargetingTemplate; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = TargetingTemplate::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.targeting_templates().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct TargetingTemplateInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: TargetingTemplate, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for TargetingTemplateInsertCall<'a, C, A> {} + +impl<'a, C, A> TargetingTemplateInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, TargetingTemplate)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.targetingTemplates.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/targetingTemplates".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: TargetingTemplate) -> TargetingTemplateInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> TargetingTemplateInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> TargetingTemplateInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> TargetingTemplateInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> TargetingTemplateInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing targeting template. +/// +/// A builder for the *update* method supported by a *targetingTemplate* resource. +/// It is not used directly, but through a `TargetingTemplateMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::TargetingTemplate; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = TargetingTemplate::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.targeting_templates().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct TargetingTemplateUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: TargetingTemplate, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for TargetingTemplateUpdateCall<'a, C, A> {} + +impl<'a, C, A> TargetingTemplateUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, TargetingTemplate)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.targetingTemplates.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/targetingTemplates".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: TargetingTemplate) -> TargetingTemplateUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> TargetingTemplateUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> TargetingTemplateUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> TargetingTemplateUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> TargetingTemplateUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing subaccount. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *subaccount* resource. +/// It is not used directly, but through a `SubaccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::Subaccount; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Subaccount::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.subaccounts().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct SubaccountPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Subaccount, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SubaccountPatchCall<'a, C, A> {} + +impl<'a, C, A> SubaccountPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Subaccount)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.subaccounts.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/subaccounts".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Subaccount) -> SubaccountPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> SubaccountPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Subaccount ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> SubaccountPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> SubaccountPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SubaccountPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> SubaccountPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new subaccount. +/// +/// A builder for the *insert* method supported by a *subaccount* resource. +/// It is not used directly, but through a `SubaccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::Subaccount; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Subaccount::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.subaccounts().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct SubaccountInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Subaccount, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SubaccountInsertCall<'a, C, A> {} + +impl<'a, C, A> SubaccountInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Subaccount)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.subaccounts.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/subaccounts".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Subaccount) -> SubaccountInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> SubaccountInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> SubaccountInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SubaccountInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> SubaccountInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing subaccount. +/// +/// A builder for the *update* method supported by a *subaccount* resource. +/// It is not used directly, but through a `SubaccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::Subaccount; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Subaccount::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.subaccounts().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct SubaccountUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Subaccount, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SubaccountUpdateCall<'a, C, A> {} + +impl<'a, C, A> SubaccountUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Subaccount)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.subaccounts.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/subaccounts".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Subaccount) -> SubaccountUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> SubaccountUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> SubaccountUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SubaccountUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> SubaccountUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets a list of subaccounts, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *subaccount* resource. +/// It is not used directly, but through a `SubaccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.subaccounts().list("profileId") +/// .sort_order("vero") +/// .sort_field("dolores") +/// .search_string("magna") +/// .page_token("ut") +/// .max_results(-47) +/// .add_ids("sed") +/// .doit(); +/// # } +/// ``` +pub struct SubaccountListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SubaccountListCall<'a, C, A> {} + +impl<'a, C, A> SubaccountListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, SubaccountsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.subaccounts.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/subaccounts".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> SubaccountListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> SubaccountListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> SubaccountListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "subaccount*2015" will return objects with names like "subaccount June 2015", "subaccount April 2015", or simply "subaccount 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "subaccount" will match objects with name "my subaccount", "subaccount 2015", or simply "subaccount". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> SubaccountListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> SubaccountListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> SubaccountListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only subaccounts with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> SubaccountListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> SubaccountListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SubaccountListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> SubaccountListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one subaccount by ID. +/// +/// A builder for the *get* method supported by a *subaccount* resource. +/// It is not used directly, but through a `SubaccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.subaccounts().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct SubaccountGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SubaccountGetCall<'a, C, A> {} + +impl<'a, C, A> SubaccountGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Subaccount)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.subaccounts.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/subaccounts/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> SubaccountGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Subaccount ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> SubaccountGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> SubaccountGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SubaccountGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> SubaccountGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one mobile carrier by ID. +/// +/// A builder for the *get* method supported by a *mobileCarrier* resource. +/// It is not used directly, but through a `MobileCarrierMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.mobile_carriers().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct MobileCarrierGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for MobileCarrierGetCall<'a, C, A> {} + +impl<'a, C, A> MobileCarrierGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, MobileCarrier)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.mobileCarriers.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/mobileCarriers/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> MobileCarrierGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Mobile carrier ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> MobileCarrierGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> MobileCarrierGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> MobileCarrierGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> MobileCarrierGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of mobile carriers. +/// +/// A builder for the *list* method supported by a *mobileCarrier* resource. +/// It is not used directly, but through a `MobileCarrierMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.mobile_carriers().list("profileId") +/// .doit(); +/// # } +/// ``` +pub struct MobileCarrierListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for MobileCarrierListCall<'a, C, A> {} + +impl<'a, C, A> MobileCarrierListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, MobileCarriersListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.mobileCarriers.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/mobileCarriers".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> MobileCarrierListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> MobileCarrierListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> MobileCarrierListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> MobileCarrierListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one floodlight configuration by ID. +/// +/// A builder for the *get* method supported by a *floodlightConfiguration* resource. +/// It is not used directly, but through a `FloodlightConfigurationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.floodlight_configurations().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightConfigurationGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightConfigurationGetCall<'a, C, A> {} + +impl<'a, C, A> FloodlightConfigurationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightConfiguration)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightConfigurations.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/floodlightConfigurations/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightConfigurationGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Floodlight configuration ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> FloodlightConfigurationGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FloodlightConfigurationGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightConfigurationGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FloodlightConfigurationGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing floodlight configuration. +/// +/// A builder for the *update* method supported by a *floodlightConfiguration* resource. +/// It is not used directly, but through a `FloodlightConfigurationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::FloodlightConfiguration; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = FloodlightConfiguration::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.floodlight_configurations().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightConfigurationUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: FloodlightConfiguration, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightConfigurationUpdateCall<'a, C, A> {} + +impl<'a, C, A> FloodlightConfigurationUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightConfiguration)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightConfigurations.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/floodlightConfigurations".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: FloodlightConfiguration) -> FloodlightConfigurationUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightConfigurationUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FloodlightConfigurationUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightConfigurationUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FloodlightConfigurationUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing floodlight configuration. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *floodlightConfiguration* resource. +/// It is not used directly, but through a `FloodlightConfigurationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::FloodlightConfiguration; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = FloodlightConfiguration::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.floodlight_configurations().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightConfigurationPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: FloodlightConfiguration, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightConfigurationPatchCall<'a, C, A> {} + +impl<'a, C, A> FloodlightConfigurationPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightConfiguration)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightConfigurations.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/floodlightConfigurations".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: FloodlightConfiguration) -> FloodlightConfigurationPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightConfigurationPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Floodlight configuration ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> FloodlightConfigurationPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FloodlightConfigurationPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightConfigurationPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FloodlightConfigurationPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of floodlight configurations, possibly filtered. +/// +/// A builder for the *list* method supported by a *floodlightConfiguration* resource. +/// It is not used directly, but through a `FloodlightConfigurationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.floodlight_configurations().list("profileId") +/// .add_ids("ipsum") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightConfigurationListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightConfigurationListCall<'a, C, A> {} + +impl<'a, C, A> FloodlightConfigurationListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightConfigurationsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightConfigurations.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + for &field in ["alt", "profileId", "ids"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/floodlightConfigurations".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightConfigurationListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Set of IDs of floodlight configurations to retrieve. Required field; otherwise an empty list will be returned. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> FloodlightConfigurationListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FloodlightConfigurationListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightConfigurationListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FloodlightConfigurationListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of operating systems. +/// +/// A builder for the *list* method supported by a *operatingSystem* resource. +/// It is not used directly, but through a `OperatingSystemMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.operating_systems().list("profileId") +/// .doit(); +/// # } +/// ``` +pub struct OperatingSystemListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OperatingSystemListCall<'a, C, A> {} + +impl<'a, C, A> OperatingSystemListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, OperatingSystemsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.operatingSystems.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/operatingSystems".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> OperatingSystemListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OperatingSystemListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> OperatingSystemListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OperatingSystemListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one operating system by DART ID. +/// +/// A builder for the *get* method supported by a *operatingSystem* resource. +/// It is not used directly, but through a `OperatingSystemMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.operating_systems().get("profileId", "dartId") +/// .doit(); +/// # } +/// ``` +pub struct OperatingSystemGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _dart_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OperatingSystemGetCall<'a, C, A> {} + +impl<'a, C, A> OperatingSystemGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, OperatingSystem)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.operatingSystems.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("dartId", self._dart_id.to_string())); + for &field in ["alt", "profileId", "dartId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/operatingSystems/{dartId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{dartId}", "dartId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["dartId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> OperatingSystemGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Operating system DART ID. + /// + /// Sets the *dart id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn dart_id(mut self, new_value: &str) -> OperatingSystemGetCall<'a, C, A> { + self._dart_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OperatingSystemGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> OperatingSystemGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OperatingSystemGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Lists files for a user profile. +/// +/// A builder for the *list* method supported by a *file* resource. +/// It is not used directly, but through a `FileMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.files().list("profileId") +/// .sort_order("kasd") +/// .sort_field("duo") +/// .scope("et") +/// .page_token("sit") +/// .max_results(-40) +/// .doit(); +/// # } +/// ``` +pub struct FileListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _scope: Option, + _page_token: Option, + _max_results: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FileListCall<'a, C, A> {} + +impl<'a, C, A> FileListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FileList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.files.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._scope { + params.push(("scope", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "scope", "pageToken", "maxResults"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/files".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The DFA profile ID. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FileListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results, default is 'DESCENDING'. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> FileListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// The field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> FileListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// The scope that defines which results are returned, default is 'MINE'. + /// + /// Sets the *scope* query property to the given value. + pub fn scope(mut self, new_value: &str) -> FileListCall<'a, C, A> { + self._scope = Some(new_value.to_string()); + self + } + /// The value of the nextToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> FileListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> FileListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FileListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FileListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FileListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a report file by its report ID and file ID. +/// +/// This method supports **media download**. To enable it, adjust the builder like this: +/// `.param("alt", "media")`. +/// Please note that due to missing multi-part support on the server side, you will only receive the media, +/// but not the `File` structure that you would usually get. The latter will be a default value. +/// +/// A builder for the *get* method supported by a *file* resource. +/// It is not used directly, but through a `FileMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.files().get("reportId", "fileId") +/// .doit(); +/// # } +/// ``` +pub struct FileGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _report_id: String, + _file_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FileGetCall<'a, C, A> {} + +impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, File)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.files.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("reportId", self._report_id.to_string())); + params.push(("fileId", self._file_id.to_string())); + for &field in ["reportId", "fileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + let (json_field_missing, enable_resource_parsing) = { + let mut enable = true; + let mut field_present = true; + for &(name, ref value) in params.iter() { + if name == "alt" { + field_present = false; + if >::as_ref(&value) != "json" { + enable = false; + } + break; + } + } + (field_present, enable) + }; + if json_field_missing { + params.push(("alt", "json".to_string())); + } + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/reports/{reportId}/files/{fileId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{reportId}", "reportId"), ("{fileId}", "fileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["fileId", "reportId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = if enable_resource_parsing { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + } else { (res, Default::default()) }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The ID of the report. + /// + /// Sets the *report id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn report_id(mut self, new_value: &str) -> FileGetCall<'a, C, A> { + self._report_id = new_value.to_string(); + self + } + /// The ID of the report file. + /// + /// Sets the *file id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn file_id(mut self, new_value: &str) -> FileGetCall<'a, C, A> { + self._file_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FileGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FileGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FileGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of placement groups, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *placementGroup* resource. +/// It is not used directly, but through a `PlacementGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.placement_groups().list("profileId") +/// .sort_order("tempor") +/// .sort_field("clita") +/// .add_site_ids("kasd") +/// .search_string("elitr") +/// .add_pricing_types("et") +/// .add_placement_strategy_ids("vero") +/// .placement_group_type("sadipscing") +/// .page_token("sed") +/// .min_start_date("vero") +/// .min_end_date("nonumy") +/// .max_start_date("magna") +/// .max_results(-66) +/// .max_end_date("sea") +/// .add_ids("ipsum") +/// .add_directory_site_ids("labore") +/// .add_content_category_ids("Lorem") +/// .add_campaign_ids("aliquyam") +/// .archived(true) +/// .add_advertiser_ids("et") +/// .doit(); +/// # } +/// ``` +pub struct PlacementGroupListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _site_ids: Vec, + _search_string: Option, + _pricing_types: Vec, + _placement_strategy_ids: Vec, + _placement_group_type: Option, + _page_token: Option, + _min_start_date: Option, + _min_end_date: Option, + _max_start_date: Option, + _max_results: Option, + _max_end_date: Option, + _ids: Vec, + _directory_site_ids: Vec, + _content_category_ids: Vec, + _campaign_ids: Vec, + _archived: Option, + _advertiser_ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementGroupListCall<'a, C, A> {} + +impl<'a, C, A> PlacementGroupListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlacementGroupsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placementGroups.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((22 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if self._site_ids.len() > 0 { + for f in self._site_ids.iter() { + params.push(("siteIds", f.to_string())); + } + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if self._pricing_types.len() > 0 { + for f in self._pricing_types.iter() { + params.push(("pricingTypes", f.to_string())); + } + } + if self._placement_strategy_ids.len() > 0 { + for f in self._placement_strategy_ids.iter() { + params.push(("placementStrategyIds", f.to_string())); + } + } + if let Some(value) = self._placement_group_type { + params.push(("placementGroupType", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._min_start_date { + params.push(("minStartDate", value.to_string())); + } + if let Some(value) = self._min_end_date { + params.push(("minEndDate", value.to_string())); + } + if let Some(value) = self._max_start_date { + params.push(("maxStartDate", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._max_end_date { + params.push(("maxEndDate", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if self._directory_site_ids.len() > 0 { + for f in self._directory_site_ids.iter() { + params.push(("directorySiteIds", f.to_string())); + } + } + if self._content_category_ids.len() > 0 { + for f in self._content_category_ids.iter() { + params.push(("contentCategoryIds", f.to_string())); + } + } + if self._campaign_ids.len() > 0 { + for f in self._campaign_ids.iter() { + params.push(("campaignIds", f.to_string())); + } + } + if let Some(value) = self._archived { + params.push(("archived", value.to_string())); + } + if self._advertiser_ids.len() > 0 { + for f in self._advertiser_ids.iter() { + params.push(("advertiserIds", f.to_string())); + } + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "siteIds", "searchString", "pricingTypes", "placementStrategyIds", "placementGroupType", "pageToken", "minStartDate", "minEndDate", "maxStartDate", "maxResults", "maxEndDate", "ids", "directorySiteIds", "contentCategoryIds", "campaignIds", "archived", "advertiserIds"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/placementGroups".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Select only placement groups that are associated with these sites. + /// + /// Append the given value to the *site ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_site_ids(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._site_ids.push(new_value.to_string()); + self + } + /// Allows searching for placement groups by name or ID. Wildcards (*) are allowed. For example, "placement*2015" will return placement groups with names like "placement group June 2015", "placement group May 2015", or simply "placements 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "placementgroup" will match placement groups with name "my placementgroup", "placementgroup 2015", or simply "placementgroup". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Select only placement groups with these pricing types. + /// + /// Append the given value to the *pricing types* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_pricing_types(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._pricing_types.push(new_value.to_string()); + self + } + /// Select only placement groups that are associated with these placement strategies. + /// + /// Append the given value to the *placement strategy ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_placement_strategy_ids(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._placement_strategy_ids.push(new_value.to_string()); + self + } + /// Select only placement groups belonging with this group type. A package is a simple group of placements that acts as a single pricing point for a group of tags. A roadblock is a group of placements that not only acts as a single pricing point but also assumes that all the tags in it will be served at the same time. A roadblock requires one of its assigned placements to be marked as primary for reporting. + /// + /// Sets the *placement group type* query property to the given value. + pub fn placement_group_type(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._placement_group_type = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Select only placements or placement groups whose start date is on or after the specified minStartDate. The date should be formatted as "yyyy-MM-dd". + /// + /// Sets the *min start date* query property to the given value. + pub fn min_start_date(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._min_start_date = Some(new_value.to_string()); + self + } + /// Select only placements or placement groups whose end date is on or after the specified minEndDate. The date should be formatted as "yyyy-MM-dd". + /// + /// Sets the *min end date* query property to the given value. + pub fn min_end_date(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._min_end_date = Some(new_value.to_string()); + self + } + /// Select only placements or placement groups whose start date is on or before the specified maxStartDate. The date should be formatted as "yyyy-MM-dd". + /// + /// Sets the *max start date* query property to the given value. + pub fn max_start_date(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._max_start_date = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> PlacementGroupListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only placements or placement groups whose end date is on or before the specified maxEndDate. The date should be formatted as "yyyy-MM-dd". + /// + /// Sets the *max end date* query property to the given value. + pub fn max_end_date(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._max_end_date = Some(new_value.to_string()); + self + } + /// Select only placement groups with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only placement groups that are associated with these directory sites. + /// + /// Append the given value to the *directory site ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_directory_site_ids(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._directory_site_ids.push(new_value.to_string()); + self + } + /// Select only placement groups that are associated with these content categories. + /// + /// Append the given value to the *content category ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_content_category_ids(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._content_category_ids.push(new_value.to_string()); + self + } + /// Select only placement groups that belong to these campaigns. + /// + /// Append the given value to the *campaign ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_campaign_ids(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._campaign_ids.push(new_value.to_string()); + self + } + /// Select only archived placements. Don't set this field to select both archived and non-archived placements. + /// + /// Sets the *archived* query property to the given value. + pub fn archived(mut self, new_value: bool) -> PlacementGroupListCall<'a, C, A> { + self._archived = Some(new_value); + self + } + /// Select only placement groups that belong to these advertisers. + /// + /// Append the given value to the *advertiser ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_advertiser_ids(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._advertiser_ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PlacementGroupListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementGroupListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PlacementGroupListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing placement group. +/// +/// A builder for the *update* method supported by a *placementGroup* resource. +/// It is not used directly, but through a `PlacementGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::PlacementGroup; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = PlacementGroup::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.placement_groups().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct PlacementGroupUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: PlacementGroup, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementGroupUpdateCall<'a, C, A> {} + +impl<'a, C, A> PlacementGroupUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlacementGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placementGroups.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/placementGroups".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: PlacementGroup) -> PlacementGroupUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementGroupUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PlacementGroupUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementGroupUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PlacementGroupUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new placement group. +/// +/// A builder for the *insert* method supported by a *placementGroup* resource. +/// It is not used directly, but through a `PlacementGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::PlacementGroup; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = PlacementGroup::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.placement_groups().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct PlacementGroupInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: PlacementGroup, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementGroupInsertCall<'a, C, A> {} + +impl<'a, C, A> PlacementGroupInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlacementGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placementGroups.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/placementGroups".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: PlacementGroup) -> PlacementGroupInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementGroupInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PlacementGroupInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementGroupInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PlacementGroupInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one placement group by ID. +/// +/// A builder for the *get* method supported by a *placementGroup* resource. +/// It is not used directly, but through a `PlacementGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.placement_groups().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct PlacementGroupGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementGroupGetCall<'a, C, A> {} + +impl<'a, C, A> PlacementGroupGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlacementGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placementGroups.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/placementGroups/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementGroupGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Placement group ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> PlacementGroupGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PlacementGroupGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementGroupGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PlacementGroupGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing placement group. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *placementGroup* resource. +/// It is not used directly, but through a `PlacementGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::PlacementGroup; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = PlacementGroup::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.placement_groups().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct PlacementGroupPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: PlacementGroup, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementGroupPatchCall<'a, C, A> {} + +impl<'a, C, A> PlacementGroupPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlacementGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placementGroups.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/placementGroups".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: PlacementGroup) -> PlacementGroupPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementGroupPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Placement group ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> PlacementGroupPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PlacementGroupPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementGroupPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PlacementGroupPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of inventory items, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *inventoryItem* resource. +/// It is not used directly, but through a `InventoryItemMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.inventory_items().list("profileId", "projectId") +/// .type_("sanctus") +/// .sort_order("voluptua.") +/// .sort_field("labore") +/// .add_site_id("erat") +/// .page_token("erat") +/// .add_order_id("voluptua.") +/// .max_results(-6) +/// .in_plan(false) +/// .add_ids("tempor") +/// .doit(); +/// # } +/// ``` +pub struct InventoryItemListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _project_id: String, + _type_: Option, + _sort_order: Option, + _sort_field: Option, + _site_id: Vec, + _page_token: Option, + _order_id: Vec, + _max_results: Option, + _in_plan: Option, + _ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for InventoryItemListCall<'a, C, A> {} + +impl<'a, C, A> InventoryItemListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, InventoryItemsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.inventoryItems.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((13 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("projectId", self._project_id.to_string())); + if let Some(value) = self._type_ { + params.push(("type", value.to_string())); + } + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if self._site_id.len() > 0 { + for f in self._site_id.iter() { + params.push(("siteId", f.to_string())); + } + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if self._order_id.len() > 0 { + for f in self._order_id.iter() { + params.push(("orderId", f.to_string())); + } + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._in_plan { + params.push(("inPlan", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + for &field in ["alt", "profileId", "projectId", "type", "sortOrder", "sortField", "siteId", "pageToken", "orderId", "maxResults", "inPlan", "ids"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/projects/{projectId}/inventoryItems".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{projectId}", "projectId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["projectId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> InventoryItemListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Project ID for order documents. + /// + /// Sets the *project id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project_id(mut self, new_value: &str) -> InventoryItemListCall<'a, C, A> { + self._project_id = new_value.to_string(); + self + } + /// Select only inventory items with this type. + /// + /// Sets the *type* query property to the given value. + pub fn type_(mut self, new_value: &str) -> InventoryItemListCall<'a, C, A> { + self._type_ = Some(new_value.to_string()); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> InventoryItemListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> InventoryItemListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Select only inventory items that are associated with these sites. + /// + /// Append the given value to the *site id* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_site_id(mut self, new_value: &str) -> InventoryItemListCall<'a, C, A> { + self._site_id.push(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> InventoryItemListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Select only inventory items that belong to specified orders. + /// + /// Append the given value to the *order id* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_order_id(mut self, new_value: &str) -> InventoryItemListCall<'a, C, A> { + self._order_id.push(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> InventoryItemListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only inventory items that are in plan. + /// + /// Sets the *in plan* query property to the given value. + pub fn in_plan(mut self, new_value: bool) -> InventoryItemListCall<'a, C, A> { + self._in_plan = Some(new_value); + self + } + /// Select only inventory items with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> InventoryItemListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> InventoryItemListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> InventoryItemListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> InventoryItemListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one inventory item by ID. +/// +/// A builder for the *get* method supported by a *inventoryItem* resource. +/// It is not used directly, but through a `InventoryItemMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.inventory_items().get("profileId", "projectId", "id") +/// .doit(); +/// # } +/// ``` +pub struct InventoryItemGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _project_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for InventoryItemGetCall<'a, C, A> {} + +impl<'a, C, A> InventoryItemGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, InventoryItem)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.inventoryItems.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("projectId", self._project_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "projectId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/projects/{projectId}/inventoryItems/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{projectId}", "projectId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["id", "projectId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> InventoryItemGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Project ID for order documents. + /// + /// Sets the *project id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project_id(mut self, new_value: &str) -> InventoryItemGetCall<'a, C, A> { + self._project_id = new_value.to_string(); + self + } + /// Inventory item ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> InventoryItemGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> InventoryItemGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> InventoryItemGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> InventoryItemGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one user role permission by ID. +/// +/// A builder for the *get* method supported by a *userRolePermission* resource. +/// It is not used directly, but through a `UserRolePermissionMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.user_role_permissions().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct UserRolePermissionGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for UserRolePermissionGetCall<'a, C, A> {} + +impl<'a, C, A> UserRolePermissionGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, UserRolePermission)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.userRolePermissions.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/userRolePermissions/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> UserRolePermissionGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// User role permission ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> UserRolePermissionGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> UserRolePermissionGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> UserRolePermissionGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> UserRolePermissionGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets a list of user role permissions, possibly filtered. +/// +/// A builder for the *list* method supported by a *userRolePermission* resource. +/// It is not used directly, but through a `UserRolePermissionMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.user_role_permissions().list("profileId") +/// .add_ids("eirmod") +/// .doit(); +/// # } +/// ``` +pub struct UserRolePermissionListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for UserRolePermissionListCall<'a, C, A> {} + +impl<'a, C, A> UserRolePermissionListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, UserRolePermissionsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.userRolePermissions.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + for &field in ["alt", "profileId", "ids"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/userRolePermissions".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> UserRolePermissionListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only user role permissions with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> UserRolePermissionListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> UserRolePermissionListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> UserRolePermissionListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> UserRolePermissionListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves the list of account permission groups. +/// +/// A builder for the *list* method supported by a *accountPermissionGroup* resource. +/// It is not used directly, but through a `AccountPermissionGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.account_permission_groups().list("profileId") +/// .doit(); +/// # } +/// ``` +pub struct AccountPermissionGroupListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountPermissionGroupListCall<'a, C, A> {} + +impl<'a, C, A> AccountPermissionGroupListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AccountPermissionGroupsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.accountPermissionGroups.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/accountPermissionGroups".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AccountPermissionGroupListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountPermissionGroupListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountPermissionGroupListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccountPermissionGroupListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one account permission group by ID. +/// +/// A builder for the *get* method supported by a *accountPermissionGroup* resource. +/// It is not used directly, but through a `AccountPermissionGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.account_permission_groups().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct AccountPermissionGroupGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountPermissionGroupGetCall<'a, C, A> {} + +impl<'a, C, A> AccountPermissionGroupGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AccountPermissionGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.accountPermissionGroups.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/accountPermissionGroups/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AccountPermissionGroupGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Account permission group ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> AccountPermissionGroupGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountPermissionGroupGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountPermissionGroupGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccountPermissionGroupGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of content categories, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *contentCategory* resource. +/// It is not used directly, but through a `ContentCategoryMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.content_categories().list("profileId") +/// .sort_order("sea") +/// .sort_field("ipsum") +/// .search_string("gubergren") +/// .page_token("eos") +/// .max_results(-29) +/// .add_ids("sit") +/// .doit(); +/// # } +/// ``` +pub struct ContentCategoryListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ContentCategoryListCall<'a, C, A> {} + +impl<'a, C, A> ContentCategoryListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ContentCategoriesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.contentCategories.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/contentCategories".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ContentCategoryListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> ContentCategoryListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> ContentCategoryListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "contentcategory*2015" will return objects with names like "contentcategory June 2015", "contentcategory April 2015", or simply "contentcategory 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "contentcategory" will match objects with name "my contentcategory", "contentcategory 2015", or simply "contentcategory". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> ContentCategoryListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ContentCategoryListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> ContentCategoryListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only content categories with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> ContentCategoryListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ContentCategoryListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ContentCategoryListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ContentCategoryListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing content category. +/// +/// A builder for the *update* method supported by a *contentCategory* resource. +/// It is not used directly, but through a `ContentCategoryMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::ContentCategory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ContentCategory::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.content_categories().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct ContentCategoryUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: ContentCategory, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ContentCategoryUpdateCall<'a, C, A> {} + +impl<'a, C, A> ContentCategoryUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ContentCategory)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.contentCategories.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/contentCategories".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ContentCategory) -> ContentCategoryUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ContentCategoryUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ContentCategoryUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ContentCategoryUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ContentCategoryUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new content category. +/// +/// A builder for the *insert* method supported by a *contentCategory* resource. +/// It is not used directly, but through a `ContentCategoryMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::ContentCategory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ContentCategory::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.content_categories().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct ContentCategoryInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: ContentCategory, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ContentCategoryInsertCall<'a, C, A> {} + +impl<'a, C, A> ContentCategoryInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ContentCategory)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.contentCategories.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/contentCategories".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ContentCategory) -> ContentCategoryInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ContentCategoryInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ContentCategoryInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ContentCategoryInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ContentCategoryInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes an existing content category. +/// +/// A builder for the *delete* method supported by a *contentCategory* resource. +/// It is not used directly, but through a `ContentCategoryMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.content_categories().delete("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct ContentCategoryDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ContentCategoryDeleteCall<'a, C, A> {} + +impl<'a, C, A> ContentCategoryDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.contentCategories.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/contentCategories/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ContentCategoryDeleteCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Content category ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> ContentCategoryDeleteCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ContentCategoryDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ContentCategoryDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ContentCategoryDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one content category by ID. +/// +/// A builder for the *get* method supported by a *contentCategory* resource. +/// It is not used directly, but through a `ContentCategoryMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.content_categories().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct ContentCategoryGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ContentCategoryGetCall<'a, C, A> {} + +impl<'a, C, A> ContentCategoryGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ContentCategory)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.contentCategories.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/contentCategories/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ContentCategoryGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Content category ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> ContentCategoryGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ContentCategoryGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ContentCategoryGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ContentCategoryGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing content category. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *contentCategory* resource. +/// It is not used directly, but through a `ContentCategoryMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::ContentCategory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ContentCategory::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.content_categories().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct ContentCategoryPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: ContentCategory, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ContentCategoryPatchCall<'a, C, A> {} + +impl<'a, C, A> ContentCategoryPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ContentCategory)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.contentCategories.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/contentCategories".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ContentCategory) -> ContentCategoryPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ContentCategoryPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Content category ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> ContentCategoryPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ContentCategoryPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ContentCategoryPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ContentCategoryPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing creative. +/// +/// A builder for the *update* method supported by a *creative* resource. +/// It is not used directly, but through a `CreativeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::Creative; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Creative::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creatives().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct CreativeUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Creative, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeUpdateCall<'a, C, A> {} + +impl<'a, C, A> CreativeUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Creative)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creatives.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/creatives".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Creative) -> CreativeUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new creative. +/// +/// A builder for the *insert* method supported by a *creative* resource. +/// It is not used directly, but through a `CreativeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::Creative; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Creative::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creatives().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct CreativeInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Creative, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeInsertCall<'a, C, A> {} + +impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Creative)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creatives.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/creatives".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Creative) -> CreativeInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one creative by ID. +/// +/// A builder for the *get* method supported by a *creative* resource. +/// It is not used directly, but through a `CreativeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creatives().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct CreativeGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeGetCall<'a, C, A> {} + +impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Creative)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creatives.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/creatives/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Creative ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CreativeGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of creatives, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *creative* resource. +/// It is not used directly, but through a `CreativeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creatives().list("profileId") +/// .add_types("vero") +/// .studio_creative_id("dolore") +/// .sort_order("Lorem") +/// .sort_field("invidunt") +/// .add_size_ids("duo") +/// .search_string("dolor") +/// .add_rendering_ids("accusam") +/// .page_token("diam") +/// .max_results(-53) +/// .add_ids("eirmod") +/// .add_creative_field_ids("amet") +/// .add_companion_creative_ids("ipsum") +/// .campaign_id("voluptua.") +/// .archived(true) +/// .advertiser_id("sed") +/// .active(false) +/// .doit(); +/// # } +/// ``` +pub struct CreativeListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _types: Vec, + _studio_creative_id: Option, + _sort_order: Option, + _sort_field: Option, + _size_ids: Vec, + _search_string: Option, + _rendering_ids: Vec, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _creative_field_ids: Vec, + _companion_creative_ids: Vec, + _campaign_id: Option, + _archived: Option, + _advertiser_id: Option, + _active: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeListCall<'a, C, A> {} + +impl<'a, C, A> CreativeListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creatives.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((19 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if self._types.len() > 0 { + for f in self._types.iter() { + params.push(("types", f.to_string())); + } + } + if let Some(value) = self._studio_creative_id { + params.push(("studioCreativeId", value.to_string())); + } + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if self._size_ids.len() > 0 { + for f in self._size_ids.iter() { + params.push(("sizeIds", f.to_string())); + } + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if self._rendering_ids.len() > 0 { + for f in self._rendering_ids.iter() { + params.push(("renderingIds", f.to_string())); + } + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if self._creative_field_ids.len() > 0 { + for f in self._creative_field_ids.iter() { + params.push(("creativeFieldIds", f.to_string())); + } + } + if self._companion_creative_ids.len() > 0 { + for f in self._companion_creative_ids.iter() { + params.push(("companionCreativeIds", f.to_string())); + } + } + if let Some(value) = self._campaign_id { + params.push(("campaignId", value.to_string())); + } + if let Some(value) = self._archived { + params.push(("archived", value.to_string())); + } + if let Some(value) = self._advertiser_id { + params.push(("advertiserId", value.to_string())); + } + if let Some(value) = self._active { + params.push(("active", value.to_string())); + } + for &field in ["alt", "profileId", "types", "studioCreativeId", "sortOrder", "sortField", "sizeIds", "searchString", "renderingIds", "pageToken", "maxResults", "ids", "creativeFieldIds", "companionCreativeIds", "campaignId", "archived", "advertiserId", "active"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/creatives".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only creatives with these creative types. + /// + /// Append the given value to the *types* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_types(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._types.push(new_value.to_string()); + self + } + /// Select only creatives corresponding to this Studio creative ID. + /// + /// Sets the *studio creative id* query property to the given value. + pub fn studio_creative_id(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._studio_creative_id = Some(new_value.to_string()); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Select only creatives with these size IDs. + /// + /// Append the given value to the *size ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_size_ids(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._size_ids.push(new_value.to_string()); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "creative*2015" will return objects with names like "creative June 2015", "creative April 2015", or simply "creative 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "creative" will match objects with name "my creative", "creative 2015", or simply "creative". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Select only creatives with these rendering IDs. + /// + /// Append the given value to the *rendering ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_rendering_ids(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._rendering_ids.push(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> CreativeListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only creatives with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only creatives with these creative field IDs. + /// + /// Append the given value to the *creative field ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_creative_field_ids(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._creative_field_ids.push(new_value.to_string()); + self + } + /// Select only in-stream video creatives with these companion IDs. + /// + /// Append the given value to the *companion creative ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_companion_creative_ids(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._companion_creative_ids.push(new_value.to_string()); + self + } + /// Select only creatives with this campaign ID. + /// + /// Sets the *campaign id* query property to the given value. + pub fn campaign_id(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._campaign_id = Some(new_value.to_string()); + self + } + /// Select only archived creatives. Leave blank to select archived and unarchived creatives. + /// + /// Sets the *archived* query property to the given value. + pub fn archived(mut self, new_value: bool) -> CreativeListCall<'a, C, A> { + self._archived = Some(new_value); + self + } + /// Select only creatives with this advertiser ID. + /// + /// Sets the *advertiser id* query property to the given value. + pub fn advertiser_id(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._advertiser_id = Some(new_value.to_string()); + self + } + /// Select only active creatives. Leave blank to select active and inactive creatives. + /// + /// Sets the *active* query property to the given value. + pub fn active(mut self, new_value: bool) -> CreativeListCall<'a, C, A> { + self._active = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing creative. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *creative* resource. +/// It is not used directly, but through a `CreativeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::Creative; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Creative::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creatives().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct CreativePatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Creative, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativePatchCall<'a, C, A> {} + +impl<'a, C, A> CreativePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Creative)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creatives.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/creatives".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Creative) -> CreativePatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativePatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Creative ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CreativePatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativePatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativePatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativePatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one campaign by ID. +/// +/// A builder for the *get* method supported by a *campaign* resource. +/// It is not used directly, but through a `CampaignMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.campaigns().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct CampaignGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CampaignGetCall<'a, C, A> {} + +impl<'a, C, A> CampaignGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Campaign)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.campaigns.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/campaigns/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CampaignGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Campaign ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CampaignGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CampaignGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CampaignGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CampaignGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new campaign. +/// +/// A builder for the *insert* method supported by a *campaign* resource. +/// It is not used directly, but through a `CampaignMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::Campaign; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Campaign::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.campaigns().insert(req, "profileId", "defaultLandingPageName", "defaultLandingPageUrl") +/// .doit(); +/// # } +/// ``` +pub struct CampaignInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Campaign, + _profile_id: String, + _default_landing_page_name: String, + _default_landing_page_url: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CampaignInsertCall<'a, C, A> {} + +impl<'a, C, A> CampaignInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Campaign)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.campaigns.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("defaultLandingPageName", self._default_landing_page_name.to_string())); + params.push(("defaultLandingPageUrl", self._default_landing_page_url.to_string())); + for &field in ["alt", "profileId", "defaultLandingPageName", "defaultLandingPageUrl"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/campaigns".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Campaign) -> CampaignInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CampaignInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Default landing page name for this new campaign. Must be less than 256 characters long. + /// + /// Sets the *default landing page name* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn default_landing_page_name(mut self, new_value: &str) -> CampaignInsertCall<'a, C, A> { + self._default_landing_page_name = new_value.to_string(); + self + } + /// Default landing page URL for this new campaign. + /// + /// Sets the *default landing page url* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn default_landing_page_url(mut self, new_value: &str) -> CampaignInsertCall<'a, C, A> { + self._default_landing_page_url = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CampaignInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CampaignInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CampaignInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing campaign. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *campaign* resource. +/// It is not used directly, but through a `CampaignMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::Campaign; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Campaign::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.campaigns().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct CampaignPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Campaign, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CampaignPatchCall<'a, C, A> {} + +impl<'a, C, A> CampaignPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Campaign)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.campaigns.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/campaigns".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Campaign) -> CampaignPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CampaignPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Campaign ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CampaignPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CampaignPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CampaignPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CampaignPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing campaign. +/// +/// A builder for the *update* method supported by a *campaign* resource. +/// It is not used directly, but through a `CampaignMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::Campaign; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Campaign::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.campaigns().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct CampaignUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Campaign, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CampaignUpdateCall<'a, C, A> {} + +impl<'a, C, A> CampaignUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Campaign)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.campaigns.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/campaigns".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Campaign) -> CampaignUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CampaignUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CampaignUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CampaignUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CampaignUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of campaigns, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *campaign* resource. +/// It is not used directly, but through a `CampaignMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.campaigns().list("profileId") +/// .subaccount_id("takimata") +/// .sort_order("invidunt") +/// .sort_field("amet") +/// .search_string("dolor") +/// .page_token("voluptua.") +/// .overridden_event_tag_id("et") +/// .max_results(-43) +/// .add_ids("kasd") +/// .add_excluded_ids("sit") +/// .at_least_one_optimization_activity(false) +/// .archived(false) +/// .add_advertiser_ids("ipsum") +/// .add_advertiser_group_ids("amet.") +/// .doit(); +/// # } +/// ``` +pub struct CampaignListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _subaccount_id: Option, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _overridden_event_tag_id: Option, + _max_results: Option, + _ids: Vec, + _excluded_ids: Vec, + _at_least_one_optimization_activity: Option, + _archived: Option, + _advertiser_ids: Vec, + _advertiser_group_ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CampaignListCall<'a, C, A> {} + +impl<'a, C, A> CampaignListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CampaignsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.campaigns.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((16 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._subaccount_id { + params.push(("subaccountId", value.to_string())); + } + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._overridden_event_tag_id { + params.push(("overriddenEventTagId", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if self._excluded_ids.len() > 0 { + for f in self._excluded_ids.iter() { + params.push(("excludedIds", f.to_string())); + } + } + if let Some(value) = self._at_least_one_optimization_activity { + params.push(("atLeastOneOptimizationActivity", value.to_string())); + } + if let Some(value) = self._archived { + params.push(("archived", value.to_string())); + } + if self._advertiser_ids.len() > 0 { + for f in self._advertiser_ids.iter() { + params.push(("advertiserIds", f.to_string())); + } + } + if self._advertiser_group_ids.len() > 0 { + for f in self._advertiser_group_ids.iter() { + params.push(("advertiserGroupIds", f.to_string())); + } + } + for &field in ["alt", "profileId", "subaccountId", "sortOrder", "sortField", "searchString", "pageToken", "overriddenEventTagId", "maxResults", "ids", "excludedIds", "atLeastOneOptimizationActivity", "archived", "advertiserIds", "advertiserGroupIds"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/campaigns".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CampaignListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only campaigns that belong to this subaccount. + /// + /// Sets the *subaccount id* query property to the given value. + pub fn subaccount_id(mut self, new_value: &str) -> CampaignListCall<'a, C, A> { + self._subaccount_id = Some(new_value.to_string()); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> CampaignListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> CampaignListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for campaigns by name or ID. Wildcards (*) are allowed. For example, "campaign*2015" will return campaigns with names like "campaign June 2015", "campaign April 2015", or simply "campaign 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "campaign" will match campaigns with name "my campaign", "campaign 2015", or simply "campaign". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> CampaignListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> CampaignListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Select only campaigns that have overridden this event tag ID. + /// + /// Sets the *overridden event tag id* query property to the given value. + pub fn overridden_event_tag_id(mut self, new_value: &str) -> CampaignListCall<'a, C, A> { + self._overridden_event_tag_id = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> CampaignListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only campaigns with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> CampaignListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Exclude campaigns with these IDs. + /// + /// Append the given value to the *excluded ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_excluded_ids(mut self, new_value: &str) -> CampaignListCall<'a, C, A> { + self._excluded_ids.push(new_value.to_string()); + self + } + /// Select only campaigns that have at least one optimization activity. + /// + /// Sets the *at least one optimization activity* query property to the given value. + pub fn at_least_one_optimization_activity(mut self, new_value: bool) -> CampaignListCall<'a, C, A> { + self._at_least_one_optimization_activity = Some(new_value); + self + } + /// Select only archived campaigns. Don't set this field to select both archived and non-archived campaigns. + /// + /// Sets the *archived* query property to the given value. + pub fn archived(mut self, new_value: bool) -> CampaignListCall<'a, C, A> { + self._archived = Some(new_value); + self + } + /// Select only campaigns that belong to these advertisers. + /// + /// Append the given value to the *advertiser ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_advertiser_ids(mut self, new_value: &str) -> CampaignListCall<'a, C, A> { + self._advertiser_ids.push(new_value.to_string()); + self + } + /// Select only campaigns whose advertisers belong to these advertiser groups. + /// + /// Append the given value to the *advertiser group ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_advertiser_group_ids(mut self, new_value: &str) -> CampaignListCall<'a, C, A> { + self._advertiser_group_ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CampaignListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CampaignListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CampaignListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes an existing event tag. +/// +/// A builder for the *delete* method supported by a *eventTag* resource. +/// It is not used directly, but through a `EventTagMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.event_tags().delete("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct EventTagDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EventTagDeleteCall<'a, C, A> {} + +impl<'a, C, A> EventTagDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.eventTags.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/eventTags/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> EventTagDeleteCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Event tag ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> EventTagDeleteCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> EventTagDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> EventTagDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> EventTagDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of event tags, possibly filtered. +/// +/// A builder for the *list* method supported by a *eventTag* resource. +/// It is not used directly, but through a `EventTagMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.event_tags().list("profileId") +/// .sort_order("magna") +/// .sort_field("amet.") +/// .search_string("eirmod") +/// .add_ids("ea") +/// .add_event_tag_types("ea") +/// .enabled(true) +/// .definitions_only(true) +/// .campaign_id("diam") +/// .advertiser_id("eos") +/// .ad_id("tempor") +/// .doit(); +/// # } +/// ``` +pub struct EventTagListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _ids: Vec, + _event_tag_types: Vec, + _enabled: Option, + _definitions_only: Option, + _campaign_id: Option, + _advertiser_id: Option, + _ad_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EventTagListCall<'a, C, A> {} + +impl<'a, C, A> EventTagListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, EventTagsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.eventTags.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((13 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if self._event_tag_types.len() > 0 { + for f in self._event_tag_types.iter() { + params.push(("eventTagTypes", f.to_string())); + } + } + if let Some(value) = self._enabled { + params.push(("enabled", value.to_string())); + } + if let Some(value) = self._definitions_only { + params.push(("definitionsOnly", value.to_string())); + } + if let Some(value) = self._campaign_id { + params.push(("campaignId", value.to_string())); + } + if let Some(value) = self._advertiser_id { + params.push(("advertiserId", value.to_string())); + } + if let Some(value) = self._ad_id { + params.push(("adId", value.to_string())); + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "searchString", "ids", "eventTagTypes", "enabled", "definitionsOnly", "campaignId", "advertiserId", "adId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/eventTags".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> EventTagListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> EventTagListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> EventTagListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "eventtag*2015" will return objects with names like "eventtag June 2015", "eventtag April 2015", or simply "eventtag 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "eventtag" will match objects with name "my eventtag", "eventtag 2015", or simply "eventtag". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> EventTagListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Select only event tags with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> EventTagListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only event tags with the specified event tag types. Event tag types can be used to specify whether to use a third-party pixel, a third-party JavaScript URL, or a third-party click-through URL for either impression or click tracking. + /// + /// Append the given value to the *event tag types* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_event_tag_types(mut self, new_value: &str) -> EventTagListCall<'a, C, A> { + self._event_tag_types.push(new_value.to_string()); + self + } + /// Select only enabled event tags. What is considered enabled or disabled depends on the definitionsOnly parameter. When definitionsOnly is set to true, only the specified advertiser or campaign's event tags' enabledByDefault field is examined. When definitionsOnly is set to false, the specified ad or specified campaign's parent advertiser's or parent campaign's event tags' enabledByDefault and status fields are examined as well. + /// + /// Sets the *enabled* query property to the given value. + pub fn enabled(mut self, new_value: bool) -> EventTagListCall<'a, C, A> { + self._enabled = Some(new_value); + self + } + /// Examine only the specified campaign or advertiser's event tags for matching selector criteria. When set to false, the parent advertiser and parent campaign of the specified ad or campaign is examined as well. In addition, when set to false, the status field is examined as well, along with the enabledByDefault field. This parameter can not be set to true when adId is specified as ads do not define their own even tags. + /// + /// Sets the *definitions only* query property to the given value. + pub fn definitions_only(mut self, new_value: bool) -> EventTagListCall<'a, C, A> { + self._definitions_only = Some(new_value); + self + } + /// Select only event tags that belong to this campaign. + /// + /// Sets the *campaign id* query property to the given value. + pub fn campaign_id(mut self, new_value: &str) -> EventTagListCall<'a, C, A> { + self._campaign_id = Some(new_value.to_string()); + self + } + /// Select only event tags that belong to this advertiser. + /// + /// Sets the *advertiser id* query property to the given value. + pub fn advertiser_id(mut self, new_value: &str) -> EventTagListCall<'a, C, A> { + self._advertiser_id = Some(new_value.to_string()); + self + } + /// Select only event tags that belong to this ad. + /// + /// Sets the *ad id* query property to the given value. + pub fn ad_id(mut self, new_value: &str) -> EventTagListCall<'a, C, A> { + self._ad_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> EventTagListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> EventTagListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> EventTagListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new event tag. +/// +/// A builder for the *insert* method supported by a *eventTag* resource. +/// It is not used directly, but through a `EventTagMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::EventTag; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = EventTag::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.event_tags().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct EventTagInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: EventTag, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EventTagInsertCall<'a, C, A> {} + +impl<'a, C, A> EventTagInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, EventTag)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.eventTags.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/eventTags".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: EventTag) -> EventTagInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> EventTagInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> EventTagInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> EventTagInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> EventTagInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing event tag. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *eventTag* resource. +/// It is not used directly, but through a `EventTagMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::EventTag; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = EventTag::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.event_tags().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct EventTagPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: EventTag, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EventTagPatchCall<'a, C, A> {} + +impl<'a, C, A> EventTagPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, EventTag)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.eventTags.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/eventTags".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: EventTag) -> EventTagPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> EventTagPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Event tag ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> EventTagPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> EventTagPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> EventTagPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> EventTagPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing event tag. +/// +/// A builder for the *update* method supported by a *eventTag* resource. +/// It is not used directly, but through a `EventTagMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::EventTag; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = EventTag::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.event_tags().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct EventTagUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: EventTag, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EventTagUpdateCall<'a, C, A> {} + +impl<'a, C, A> EventTagUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, EventTag)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.eventTags.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/eventTags".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: EventTag) -> EventTagUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> EventTagUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> EventTagUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> EventTagUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> EventTagUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one event tag by ID. +/// +/// A builder for the *get* method supported by a *eventTag* resource. +/// It is not used directly, but through a `EventTagMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.event_tags().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct EventTagGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EventTagGetCall<'a, C, A> {} + +impl<'a, C, A> EventTagGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, EventTag)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.eventTags.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/eventTags/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> EventTagGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Event tag ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> EventTagGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> EventTagGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> EventTagGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> EventTagGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one remarketing list by ID. +/// +/// A builder for the *get* method supported by a *remarketingList* resource. +/// It is not used directly, but through a `RemarketingListMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.remarketing_lists().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct RemarketingListGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RemarketingListGetCall<'a, C, A> {} + +impl<'a, C, A> RemarketingListGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, RemarketingList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.remarketingLists.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/remarketingLists/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> RemarketingListGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Remarketing list ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> RemarketingListGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> RemarketingListGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RemarketingListGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> RemarketingListGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing remarketing list. +/// +/// A builder for the *update* method supported by a *remarketingList* resource. +/// It is not used directly, but through a `RemarketingListMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::RemarketingList; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = RemarketingList::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.remarketing_lists().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct RemarketingListUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: RemarketingList, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RemarketingListUpdateCall<'a, C, A> {} + +impl<'a, C, A> RemarketingListUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, RemarketingList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.remarketingLists.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/remarketingLists".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: RemarketingList) -> RemarketingListUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> RemarketingListUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> RemarketingListUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RemarketingListUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> RemarketingListUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of remarketing lists, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *remarketingList* resource. +/// It is not used directly, but through a `RemarketingListMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.remarketing_lists().list("profileId", "advertiserId") +/// .sort_order("sed") +/// .sort_field("sea") +/// .page_token("amet.") +/// .name("clita") +/// .max_results(-13) +/// .floodlight_activity_id("est") +/// .active(false) +/// .doit(); +/// # } +/// ``` +pub struct RemarketingListListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _advertiser_id: String, + _sort_order: Option, + _sort_field: Option, + _page_token: Option, + _name: Option, + _max_results: Option, + _floodlight_activity_id: Option, + _active: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RemarketingListListCall<'a, C, A> {} + +impl<'a, C, A> RemarketingListListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, RemarketingListsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.remarketingLists.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((11 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("advertiserId", self._advertiser_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._name { + params.push(("name", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._floodlight_activity_id { + params.push(("floodlightActivityId", value.to_string())); + } + if let Some(value) = self._active { + params.push(("active", value.to_string())); + } + for &field in ["alt", "profileId", "advertiserId", "sortOrder", "sortField", "pageToken", "name", "maxResults", "floodlightActivityId", "active"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/remarketingLists".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> RemarketingListListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only remarketing lists owned by this advertiser. + /// + /// Sets the *advertiser id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn advertiser_id(mut self, new_value: &str) -> RemarketingListListCall<'a, C, A> { + self._advertiser_id = new_value.to_string(); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> RemarketingListListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> RemarketingListListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> RemarketingListListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "remarketing list*2015" will return objects with names like "remarketing list June 2015", "remarketing list April 2015", or simply "remarketing list 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "remarketing list" will match objects with name "my remarketing list", "remarketing list 2015", or simply "remarketing list". + /// + /// Sets the *name* query property to the given value. + pub fn name(mut self, new_value: &str) -> RemarketingListListCall<'a, C, A> { + self._name = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> RemarketingListListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only remarketing lists that have this floodlight activity ID. + /// + /// Sets the *floodlight activity id* query property to the given value. + pub fn floodlight_activity_id(mut self, new_value: &str) -> RemarketingListListCall<'a, C, A> { + self._floodlight_activity_id = Some(new_value.to_string()); + self + } + /// Select only active or only inactive remarketing lists. + /// + /// Sets the *active* query property to the given value. + pub fn active(mut self, new_value: bool) -> RemarketingListListCall<'a, C, A> { + self._active = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> RemarketingListListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RemarketingListListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> RemarketingListListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing remarketing list. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *remarketingList* resource. +/// It is not used directly, but through a `RemarketingListMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::RemarketingList; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = RemarketingList::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.remarketing_lists().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct RemarketingListPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: RemarketingList, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RemarketingListPatchCall<'a, C, A> {} + +impl<'a, C, A> RemarketingListPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, RemarketingList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.remarketingLists.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/remarketingLists".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: RemarketingList) -> RemarketingListPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> RemarketingListPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Remarketing list ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> RemarketingListPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> RemarketingListPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RemarketingListPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> RemarketingListPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new remarketing list. +/// +/// A builder for the *insert* method supported by a *remarketingList* resource. +/// It is not used directly, but through a `RemarketingListMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::RemarketingList; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = RemarketingList::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.remarketing_lists().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct RemarketingListInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: RemarketingList, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RemarketingListInsertCall<'a, C, A> {} + +impl<'a, C, A> RemarketingListInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, RemarketingList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.remarketingLists.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/remarketingLists".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: RemarketingList) -> RemarketingListInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> RemarketingListInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> RemarketingListInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RemarketingListInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> RemarketingListInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of cities, possibly filtered. +/// +/// A builder for the *list* method supported by a *city* resource. +/// It is not used directly, but through a `CityMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.cities().list("profileId") +/// .add_region_dart_ids("sadipscing") +/// .name_prefix("ea") +/// .add_dart_ids("dolor") +/// .add_country_dart_ids("consetetur") +/// .doit(); +/// # } +/// ``` +pub struct CityListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _region_dart_ids: Vec, + _name_prefix: Option, + _dart_ids: Vec, + _country_dart_ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CityListCall<'a, C, A> {} + +impl<'a, C, A> CityListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CitiesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.cities.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if self._region_dart_ids.len() > 0 { + for f in self._region_dart_ids.iter() { + params.push(("regionDartIds", f.to_string())); + } + } + if let Some(value) = self._name_prefix { + params.push(("namePrefix", value.to_string())); + } + if self._dart_ids.len() > 0 { + for f in self._dart_ids.iter() { + params.push(("dartIds", f.to_string())); + } + } + if self._country_dart_ids.len() > 0 { + for f in self._country_dart_ids.iter() { + params.push(("countryDartIds", f.to_string())); + } + } + for &field in ["alt", "profileId", "regionDartIds", "namePrefix", "dartIds", "countryDartIds"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/cities".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CityListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only cities from these regions. + /// + /// Append the given value to the *region dart ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_region_dart_ids(mut self, new_value: &str) -> CityListCall<'a, C, A> { + self._region_dart_ids.push(new_value.to_string()); + self + } + /// Select only cities with names starting with this prefix. + /// + /// Sets the *name prefix* query property to the given value. + pub fn name_prefix(mut self, new_value: &str) -> CityListCall<'a, C, A> { + self._name_prefix = Some(new_value.to_string()); + self + } + /// Select only cities with these DART IDs. + /// + /// Append the given value to the *dart ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_dart_ids(mut self, new_value: &str) -> CityListCall<'a, C, A> { + self._dart_ids.push(new_value.to_string()); + self + } + /// Select only cities from these countries. + /// + /// Append the given value to the *country dart ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_country_dart_ids(mut self, new_value: &str) -> CityListCall<'a, C, A> { + self._country_dart_ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CityListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CityListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CityListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing placement strategy. +/// +/// A builder for the *update* method supported by a *placementStrategy* resource. +/// It is not used directly, but through a `PlacementStrategyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::PlacementStrategy; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = PlacementStrategy::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.placement_strategies().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct PlacementStrategyUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: PlacementStrategy, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementStrategyUpdateCall<'a, C, A> {} + +impl<'a, C, A> PlacementStrategyUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlacementStrategy)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placementStrategies.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/placementStrategies".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: PlacementStrategy) -> PlacementStrategyUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementStrategyUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PlacementStrategyUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementStrategyUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PlacementStrategyUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one placement strategy by ID. +/// +/// A builder for the *get* method supported by a *placementStrategy* resource. +/// It is not used directly, but through a `PlacementStrategyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.placement_strategies().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct PlacementStrategyGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementStrategyGetCall<'a, C, A> {} + +impl<'a, C, A> PlacementStrategyGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlacementStrategy)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placementStrategies.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/placementStrategies/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementStrategyGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Placement strategy ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> PlacementStrategyGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PlacementStrategyGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementStrategyGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PlacementStrategyGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of placement strategies, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *placementStrategy* resource. +/// It is not used directly, but through a `PlacementStrategyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.placement_strategies().list("profileId") +/// .sort_order("amet.") +/// .sort_field("sit") +/// .search_string("dolor") +/// .page_token("et") +/// .max_results(-47) +/// .add_ids("sit") +/// .doit(); +/// # } +/// ``` +pub struct PlacementStrategyListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementStrategyListCall<'a, C, A> {} + +impl<'a, C, A> PlacementStrategyListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlacementStrategiesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placementStrategies.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/placementStrategies".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementStrategyListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> PlacementStrategyListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> PlacementStrategyListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "placementstrategy*2015" will return objects with names like "placementstrategy June 2015", "placementstrategy April 2015", or simply "placementstrategy 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "placementstrategy" will match objects with name "my placementstrategy", "placementstrategy 2015", or simply "placementstrategy". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> PlacementStrategyListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> PlacementStrategyListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> PlacementStrategyListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only placement strategies with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> PlacementStrategyListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PlacementStrategyListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementStrategyListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PlacementStrategyListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes an existing placement strategy. +/// +/// A builder for the *delete* method supported by a *placementStrategy* resource. +/// It is not used directly, but through a `PlacementStrategyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.placement_strategies().delete("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct PlacementStrategyDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementStrategyDeleteCall<'a, C, A> {} + +impl<'a, C, A> PlacementStrategyDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placementStrategies.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/placementStrategies/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementStrategyDeleteCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Placement strategy ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> PlacementStrategyDeleteCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PlacementStrategyDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementStrategyDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PlacementStrategyDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new placement strategy. +/// +/// A builder for the *insert* method supported by a *placementStrategy* resource. +/// It is not used directly, but through a `PlacementStrategyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::PlacementStrategy; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = PlacementStrategy::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.placement_strategies().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct PlacementStrategyInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: PlacementStrategy, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementStrategyInsertCall<'a, C, A> {} + +impl<'a, C, A> PlacementStrategyInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlacementStrategy)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placementStrategies.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/placementStrategies".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: PlacementStrategy) -> PlacementStrategyInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementStrategyInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PlacementStrategyInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementStrategyInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PlacementStrategyInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing placement strategy. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *placementStrategy* resource. +/// It is not used directly, but through a `PlacementStrategyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::PlacementStrategy; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = PlacementStrategy::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.placement_strategies().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct PlacementStrategyPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: PlacementStrategy, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementStrategyPatchCall<'a, C, A> {} + +impl<'a, C, A> PlacementStrategyPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlacementStrategy)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placementStrategies.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/placementStrategies".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: PlacementStrategy) -> PlacementStrategyPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementStrategyPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Placement strategy ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> PlacementStrategyPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PlacementStrategyPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementStrategyPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PlacementStrategyPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of projects, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().list("profileId") +/// .sort_order("vero") +/// .sort_field("accusam") +/// .search_string("et") +/// .page_token("clita") +/// .max_results(-89) +/// .add_ids("ut") +/// .add_advertiser_ids("kasd") +/// .doit(); +/// # } +/// ``` +pub struct ProjectListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _advertiser_ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectListCall<'a, C, A> {} + +impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ProjectsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.projects.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((10 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if self._advertiser_ids.len() > 0 { + for f in self._advertiser_ids.iter() { + params.push(("advertiserIds", f.to_string())); + } + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids", "advertiserIds"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/projects".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ProjectListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> ProjectListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> ProjectListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for projects by name or ID. Wildcards (*) are allowed. For example, "project*2015" will return projects with names like "project June 2015", "project April 2015", or simply "project 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "project" will match projects with name "my project", "project 2015", or simply "project". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> ProjectListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> ProjectListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only projects with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> ProjectListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only projects with these advertiser IDs. + /// + /// Append the given value to the *advertiser ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_advertiser_ids(mut self, new_value: &str) -> ProjectListCall<'a, C, A> { + self._advertiser_ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ProjectListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one project by ID. +/// +/// A builder for the *get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct ProjectGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Project)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.projects.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/projects/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ProjectGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Project ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> ProjectGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ProjectGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new directory site. +/// +/// A builder for the *insert* method supported by a *directorySite* resource. +/// It is not used directly, but through a `DirectorySiteMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::DirectorySite; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = DirectorySite::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.directory_sites().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct DirectorySiteInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: DirectorySite, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for DirectorySiteInsertCall<'a, C, A> {} + +impl<'a, C, A> DirectorySiteInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, DirectorySite)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.directorySites.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/directorySites".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: DirectorySite) -> DirectorySiteInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> DirectorySiteInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> DirectorySiteInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> DirectorySiteInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> DirectorySiteInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of directory sites, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *directorySite* resource. +/// It is not used directly, but through a `DirectorySiteMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.directory_sites().list("profileId") +/// .sort_order("elitr") +/// .sort_field("tempor") +/// .search_string("ipsum") +/// .parent_id("no") +/// .page_token("takimata") +/// .max_results(-58) +/// .add_ids("gubergren") +/// .dfp_network_code("clita") +/// .country_id("et") +/// .active(false) +/// .accepts_publisher_paid_placements(true) +/// .accepts_interstitial_placements(false) +/// .accepts_in_stream_video_placements(true) +/// .doit(); +/// # } +/// ``` +pub struct DirectorySiteListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _parent_id: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _dfp_network_code: Option, + _country_id: Option, + _active: Option, + _accepts_publisher_paid_placements: Option, + _accepts_interstitial_placements: Option, + _accepts_in_stream_video_placements: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for DirectorySiteListCall<'a, C, A> {} + +impl<'a, C, A> DirectorySiteListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, DirectorySitesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.directorySites.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((16 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._parent_id { + params.push(("parentId", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if let Some(value) = self._dfp_network_code { + params.push(("dfp_network_code", value.to_string())); + } + if let Some(value) = self._country_id { + params.push(("countryId", value.to_string())); + } + if let Some(value) = self._active { + params.push(("active", value.to_string())); + } + if let Some(value) = self._accepts_publisher_paid_placements { + params.push(("acceptsPublisherPaidPlacements", value.to_string())); + } + if let Some(value) = self._accepts_interstitial_placements { + params.push(("acceptsInterstitialPlacements", value.to_string())); + } + if let Some(value) = self._accepts_in_stream_video_placements { + params.push(("acceptsInStreamVideoPlacements", value.to_string())); + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "searchString", "parentId", "pageToken", "maxResults", "ids", "dfp_network_code", "countryId", "active", "acceptsPublisherPaidPlacements", "acceptsInterstitialPlacements", "acceptsInStreamVideoPlacements"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/directorySites".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> DirectorySiteListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> DirectorySiteListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> DirectorySiteListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name, ID or URL. Wildcards (*) are allowed. For example, "directory site*2015" will return objects with names like "directory site June 2015", "directory site April 2015", or simply "directory site 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "directory site" will match objects with name "my directory site", "directory site 2015" or simply, "directory site". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> DirectorySiteListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Select only directory sites with this parent ID. + /// + /// Sets the *parent id* query property to the given value. + pub fn parent_id(mut self, new_value: &str) -> DirectorySiteListCall<'a, C, A> { + self._parent_id = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> DirectorySiteListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> DirectorySiteListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only directory sites with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> DirectorySiteListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only directory sites with this DFP network code. + /// + /// Sets the *dfp_network_code* query property to the given value. + pub fn dfp_network_code(mut self, new_value: &str) -> DirectorySiteListCall<'a, C, A> { + self._dfp_network_code = Some(new_value.to_string()); + self + } + /// Select only directory sites with this country ID. + /// + /// Sets the *country id* query property to the given value. + pub fn country_id(mut self, new_value: &str) -> DirectorySiteListCall<'a, C, A> { + self._country_id = Some(new_value.to_string()); + self + } + /// Select only active directory sites. Leave blank to retrieve both active and inactive directory sites. + /// + /// Sets the *active* query property to the given value. + pub fn active(mut self, new_value: bool) -> DirectorySiteListCall<'a, C, A> { + self._active = Some(new_value); + self + } + /// Select only directory sites that accept publisher paid placements. This field can be left blank. + /// + /// Sets the *accepts publisher paid placements* query property to the given value. + pub fn accepts_publisher_paid_placements(mut self, new_value: bool) -> DirectorySiteListCall<'a, C, A> { + self._accepts_publisher_paid_placements = Some(new_value); + self + } + /// This search filter is no longer supported and will have no effect on the results returned. + /// + /// Sets the *accepts interstitial placements* query property to the given value. + pub fn accepts_interstitial_placements(mut self, new_value: bool) -> DirectorySiteListCall<'a, C, A> { + self._accepts_interstitial_placements = Some(new_value); + self + } + /// This search filter is no longer supported and will have no effect on the results returned. + /// + /// Sets the *accepts in stream video placements* query property to the given value. + pub fn accepts_in_stream_video_placements(mut self, new_value: bool) -> DirectorySiteListCall<'a, C, A> { + self._accepts_in_stream_video_placements = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> DirectorySiteListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> DirectorySiteListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> DirectorySiteListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one directory site by ID. +/// +/// A builder for the *get* method supported by a *directorySite* resource. +/// It is not used directly, but through a `DirectorySiteMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.directory_sites().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct DirectorySiteGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for DirectorySiteGetCall<'a, C, A> {} + +impl<'a, C, A> DirectorySiteGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, DirectorySite)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.directorySites.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/directorySites/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> DirectorySiteGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Directory site ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> DirectorySiteGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> DirectorySiteGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> DirectorySiteGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> DirectorySiteGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one video format by ID. +/// +/// A builder for the *get* method supported by a *videoFormat* resource. +/// It is not used directly, but through a `VideoFormatMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.video_formats().get("profileId", -48) +/// .doit(); +/// # } +/// ``` +pub struct VideoFormatGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: i32, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for VideoFormatGetCall<'a, C, A> {} + +impl<'a, C, A> VideoFormatGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, VideoFormat)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.videoFormats.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/videoFormats/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> VideoFormatGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Video format ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: i32) -> VideoFormatGetCall<'a, C, A> { + self._id = new_value; + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> VideoFormatGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> VideoFormatGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> VideoFormatGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Lists available video formats. +/// +/// A builder for the *list* method supported by a *videoFormat* resource. +/// It is not used directly, but through a `VideoFormatMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.video_formats().list("profileId") +/// .doit(); +/// # } +/// ``` +pub struct VideoFormatListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for VideoFormatListCall<'a, C, A> {} + +impl<'a, C, A> VideoFormatListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, VideoFormatsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.videoFormats.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/videoFormats".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> VideoFormatListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> VideoFormatListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> VideoFormatListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> VideoFormatListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes an existing dynamic targeting key. +/// +/// A builder for the *delete* method supported by a *dynamicTargetingKey* resource. +/// It is not used directly, but through a `DynamicTargetingKeyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.dynamic_targeting_keys().delete("profileId", "objectId", "name", "objectType") +/// .doit(); +/// # } +/// ``` +pub struct DynamicTargetingKeyDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _object_id: String, + _name: String, + _object_type: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for DynamicTargetingKeyDeleteCall<'a, C, A> {} + +impl<'a, C, A> DynamicTargetingKeyDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.dynamicTargetingKeys.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("objectId", self._object_id.to_string())); + params.push(("name", self._name.to_string())); + params.push(("objectType", self._object_type.to_string())); + for &field in ["profileId", "objectId", "name", "objectType"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/dynamicTargetingKeys/{objectId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{objectId}", "objectId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["objectId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> DynamicTargetingKeyDeleteCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// ID of the object of this dynamic targeting key. This is a required field. + /// + /// Sets the *object id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn object_id(mut self, new_value: &str) -> DynamicTargetingKeyDeleteCall<'a, C, A> { + self._object_id = new_value.to_string(); + self + } + /// Name of this dynamic targeting key. This is a required field. Must be less than 256 characters long and cannot contain commas. All characters are converted to lowercase. + /// + /// Sets the *name* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> DynamicTargetingKeyDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// Type of the object of this dynamic targeting key. This is a required field. + /// + /// Sets the *object type* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn object_type(mut self, new_value: &str) -> DynamicTargetingKeyDeleteCall<'a, C, A> { + self._object_type = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> DynamicTargetingKeyDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> DynamicTargetingKeyDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> DynamicTargetingKeyDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of dynamic targeting keys. +/// +/// A builder for the *list* method supported by a *dynamicTargetingKey* resource. +/// It is not used directly, but through a `DynamicTargetingKeyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.dynamic_targeting_keys().list("profileId") +/// .object_type("sit") +/// .object_id("Lorem") +/// .add_names("sanctus") +/// .advertiser_id("accusam") +/// .doit(); +/// # } +/// ``` +pub struct DynamicTargetingKeyListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _object_type: Option, + _object_id: Option, + _names: Vec, + _advertiser_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for DynamicTargetingKeyListCall<'a, C, A> {} + +impl<'a, C, A> DynamicTargetingKeyListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, DynamicTargetingKeysListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.dynamicTargetingKeys.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._object_type { + params.push(("objectType", value.to_string())); + } + if let Some(value) = self._object_id { + params.push(("objectId", value.to_string())); + } + if self._names.len() > 0 { + for f in self._names.iter() { + params.push(("names", f.to_string())); + } + } + if let Some(value) = self._advertiser_id { + params.push(("advertiserId", value.to_string())); + } + for &field in ["alt", "profileId", "objectType", "objectId", "names", "advertiserId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/dynamicTargetingKeys".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> DynamicTargetingKeyListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only dynamic targeting keys with this object type. + /// + /// Sets the *object type* query property to the given value. + pub fn object_type(mut self, new_value: &str) -> DynamicTargetingKeyListCall<'a, C, A> { + self._object_type = Some(new_value.to_string()); + self + } + /// Select only dynamic targeting keys with this object ID. + /// + /// Sets the *object id* query property to the given value. + pub fn object_id(mut self, new_value: &str) -> DynamicTargetingKeyListCall<'a, C, A> { + self._object_id = Some(new_value.to_string()); + self + } + /// Select only dynamic targeting keys exactly matching these names. + /// + /// Append the given value to the *names* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_names(mut self, new_value: &str) -> DynamicTargetingKeyListCall<'a, C, A> { + self._names.push(new_value.to_string()); + self + } + /// Select only dynamic targeting keys whose object has this advertiser ID. + /// + /// Sets the *advertiser id* query property to the given value. + pub fn advertiser_id(mut self, new_value: &str) -> DynamicTargetingKeyListCall<'a, C, A> { + self._advertiser_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> DynamicTargetingKeyListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> DynamicTargetingKeyListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> DynamicTargetingKeyListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new dynamic targeting key. Keys must be created at the advertiser level before being assigned to the advertiser's ads, creatives, or placements. There is a maximum of 1000 keys per advertiser, out of which a maximum of 20 keys can be assigned per ad, creative, or placement. +/// +/// A builder for the *insert* method supported by a *dynamicTargetingKey* resource. +/// It is not used directly, but through a `DynamicTargetingKeyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::DynamicTargetingKey; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = DynamicTargetingKey::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.dynamic_targeting_keys().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct DynamicTargetingKeyInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: DynamicTargetingKey, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for DynamicTargetingKeyInsertCall<'a, C, A> {} + +impl<'a, C, A> DynamicTargetingKeyInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, DynamicTargetingKey)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.dynamicTargetingKeys.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/dynamicTargetingKeys".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: DynamicTargetingKey) -> DynamicTargetingKeyInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> DynamicTargetingKeyInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> DynamicTargetingKeyInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> DynamicTargetingKeyInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> DynamicTargetingKeyInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new size. +/// +/// A builder for the *insert* method supported by a *size* resource. +/// It is not used directly, but through a `SizeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::Size; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Size::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.sizes().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct SizeInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Size, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SizeInsertCall<'a, C, A> {} + +impl<'a, C, A> SizeInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Size)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.sizes.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/sizes".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Size) -> SizeInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> SizeInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> SizeInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SizeInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> SizeInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of sizes, possibly filtered. +/// +/// A builder for the *list* method supported by a *size* resource. +/// It is not used directly, but through a `SizeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.sizes().list("profileId") +/// .width(-73) +/// .add_ids("accusam") +/// .iab_standard(true) +/// .height(-40) +/// .doit(); +/// # } +/// ``` +pub struct SizeListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _width: Option, + _ids: Vec, + _iab_standard: Option, + _height: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SizeListCall<'a, C, A> {} + +impl<'a, C, A> SizeListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, SizesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.sizes.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._width { + params.push(("width", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if let Some(value) = self._iab_standard { + params.push(("iabStandard", value.to_string())); + } + if let Some(value) = self._height { + params.push(("height", value.to_string())); + } + for &field in ["alt", "profileId", "width", "ids", "iabStandard", "height"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/sizes".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> SizeListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only sizes with this width. + /// + /// Sets the *width* query property to the given value. + pub fn width(mut self, new_value: i32) -> SizeListCall<'a, C, A> { + self._width = Some(new_value); + self + } + /// Select only sizes with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> SizeListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only IAB standard sizes. + /// + /// Sets the *iab standard* query property to the given value. + pub fn iab_standard(mut self, new_value: bool) -> SizeListCall<'a, C, A> { + self._iab_standard = Some(new_value); + self + } + /// Select only sizes with this height. + /// + /// Sets the *height* query property to the given value. + pub fn height(mut self, new_value: i32) -> SizeListCall<'a, C, A> { + self._height = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> SizeListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SizeListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> SizeListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one size by ID. +/// +/// A builder for the *get* method supported by a *size* resource. +/// It is not used directly, but through a `SizeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.sizes().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct SizeGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SizeGetCall<'a, C, A> {} + +impl<'a, C, A> SizeGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Size)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.sizes.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/sizes/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> SizeGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Size ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> SizeGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> SizeGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SizeGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> SizeGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets the account's active ad summary by account ID. +/// +/// A builder for the *get* method supported by a *accountActiveAdSummary* resource. +/// It is not used directly, but through a `AccountActiveAdSummaryMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.account_active_ad_summaries().get("profileId", "summaryAccountId") +/// .doit(); +/// # } +/// ``` +pub struct AccountActiveAdSummaryGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _summary_account_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountActiveAdSummaryGetCall<'a, C, A> {} + +impl<'a, C, A> AccountActiveAdSummaryGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AccountActiveAdSummary)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.accountActiveAdSummaries.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("summaryAccountId", self._summary_account_id.to_string())); + for &field in ["alt", "profileId", "summaryAccountId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/accountActiveAdSummaries/{summaryAccountId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{summaryAccountId}", "summaryAccountId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["summaryAccountId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AccountActiveAdSummaryGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Account ID. + /// + /// Sets the *summary account id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn summary_account_id(mut self, new_value: &str) -> AccountActiveAdSummaryGetCall<'a, C, A> { + self._summary_account_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountActiveAdSummaryGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountActiveAdSummaryGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccountActiveAdSummaryGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing account user profile. +/// +/// A builder for the *update* method supported by a *accountUserProfile* resource. +/// It is not used directly, but through a `AccountUserProfileMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::AccountUserProfile; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = AccountUserProfile::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.account_user_profiles().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct AccountUserProfileUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: AccountUserProfile, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountUserProfileUpdateCall<'a, C, A> {} + +impl<'a, C, A> AccountUserProfileUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AccountUserProfile)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.accountUserProfiles.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/accountUserProfiles".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: AccountUserProfile) -> AccountUserProfileUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AccountUserProfileUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountUserProfileUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountUserProfileUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccountUserProfileUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of account user profiles, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *accountUserProfile* resource. +/// It is not used directly, but through a `AccountUserProfileMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.account_user_profiles().list("profileId") +/// .user_role_id("est") +/// .subaccount_id("et") +/// .sort_order("et") +/// .sort_field("clita") +/// .search_string("consetetur") +/// .page_token("magna") +/// .max_results(-38) +/// .add_ids("At") +/// .active(true) +/// .doit(); +/// # } +/// ``` +pub struct AccountUserProfileListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _user_role_id: Option, + _subaccount_id: Option, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _active: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountUserProfileListCall<'a, C, A> {} + +impl<'a, C, A> AccountUserProfileListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AccountUserProfilesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.accountUserProfiles.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((12 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._user_role_id { + params.push(("userRoleId", value.to_string())); + } + if let Some(value) = self._subaccount_id { + params.push(("subaccountId", value.to_string())); + } + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if let Some(value) = self._active { + params.push(("active", value.to_string())); + } + for &field in ["alt", "profileId", "userRoleId", "subaccountId", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids", "active"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/accountUserProfiles".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AccountUserProfileListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only user profiles with the specified user role ID. + /// + /// Sets the *user role id* query property to the given value. + pub fn user_role_id(mut self, new_value: &str) -> AccountUserProfileListCall<'a, C, A> { + self._user_role_id = Some(new_value.to_string()); + self + } + /// Select only user profiles with the specified subaccount ID. + /// + /// Sets the *subaccount id* query property to the given value. + pub fn subaccount_id(mut self, new_value: &str) -> AccountUserProfileListCall<'a, C, A> { + self._subaccount_id = Some(new_value.to_string()); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> AccountUserProfileListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> AccountUserProfileListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name, ID or email. Wildcards (*) are allowed. For example, "user profile*2015" will return objects with names like "user profile June 2015", "user profile April 2015", or simply "user profile 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "user profile" will match objects with name "my user profile", "user profile 2015", or simply "user profile". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> AccountUserProfileListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> AccountUserProfileListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> AccountUserProfileListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only user profiles with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> AccountUserProfileListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only active user profiles. + /// + /// Sets the *active* query property to the given value. + pub fn active(mut self, new_value: bool) -> AccountUserProfileListCall<'a, C, A> { + self._active = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountUserProfileListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountUserProfileListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccountUserProfileListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new account user profile. +/// +/// A builder for the *insert* method supported by a *accountUserProfile* resource. +/// It is not used directly, but through a `AccountUserProfileMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::AccountUserProfile; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = AccountUserProfile::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.account_user_profiles().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct AccountUserProfileInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: AccountUserProfile, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountUserProfileInsertCall<'a, C, A> {} + +impl<'a, C, A> AccountUserProfileInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AccountUserProfile)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.accountUserProfiles.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/accountUserProfiles".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: AccountUserProfile) -> AccountUserProfileInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AccountUserProfileInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountUserProfileInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountUserProfileInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccountUserProfileInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing account user profile. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *accountUserProfile* resource. +/// It is not used directly, but through a `AccountUserProfileMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::AccountUserProfile; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = AccountUserProfile::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.account_user_profiles().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct AccountUserProfilePatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: AccountUserProfile, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountUserProfilePatchCall<'a, C, A> {} + +impl<'a, C, A> AccountUserProfilePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AccountUserProfile)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.accountUserProfiles.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/accountUserProfiles".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: AccountUserProfile) -> AccountUserProfilePatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AccountUserProfilePatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// User profile ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> AccountUserProfilePatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountUserProfilePatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountUserProfilePatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccountUserProfilePatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one account user profile by ID. +/// +/// A builder for the *get* method supported by a *accountUserProfile* resource. +/// It is not used directly, but through a `AccountUserProfileMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.account_user_profiles().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct AccountUserProfileGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountUserProfileGetCall<'a, C, A> {} + +impl<'a, C, A> AccountUserProfileGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AccountUserProfile)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.accountUserProfiles.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/accountUserProfiles/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AccountUserProfileGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// User profile ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> AccountUserProfileGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountUserProfileGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountUserProfileGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccountUserProfileGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of countries. +/// +/// A builder for the *list* method supported by a *country* resource. +/// It is not used directly, but through a `CountryMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.countries().list("profileId") +/// .doit(); +/// # } +/// ``` +pub struct CountryListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CountryListCall<'a, C, A> {} + +impl<'a, C, A> CountryListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CountriesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.countries.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/countries".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CountryListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CountryListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CountryListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CountryListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one country by ID. +/// +/// A builder for the *get* method supported by a *country* resource. +/// It is not used directly, but through a `CountryMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.countries().get("profileId", "dartId") +/// .doit(); +/// # } +/// ``` +pub struct CountryGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _dart_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CountryGetCall<'a, C, A> {} + +impl<'a, C, A> CountryGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Country)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.countries.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("dartId", self._dart_id.to_string())); + for &field in ["alt", "profileId", "dartId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/countries/{dartId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{dartId}", "dartId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["dartId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CountryGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Country DART ID. + /// + /// Sets the *dart id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn dart_id(mut self, new_value: &str) -> CountryGetCall<'a, C, A> { + self._dart_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CountryGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CountryGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CountryGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing creative field value. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *creativeFieldValue* resource. +/// It is not used directly, but through a `CreativeFieldValueMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::CreativeFieldValue; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = CreativeFieldValue::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creative_field_values().patch(req, "profileId", "creativeFieldId", "id") +/// .doit(); +/// # } +/// ``` +pub struct CreativeFieldValuePatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: CreativeFieldValue, + _profile_id: String, + _creative_field_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeFieldValuePatchCall<'a, C, A> {} + +impl<'a, C, A> CreativeFieldValuePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeFieldValue)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeFieldValues.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("creativeFieldId", self._creative_field_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "creativeFieldId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/creativeFields/{creativeFieldId}/creativeFieldValues".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{creativeFieldId}", "creativeFieldId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["creativeFieldId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: CreativeFieldValue) -> CreativeFieldValuePatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeFieldValuePatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Creative field ID for this creative field value. + /// + /// Sets the *creative field id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn creative_field_id(mut self, new_value: &str) -> CreativeFieldValuePatchCall<'a, C, A> { + self._creative_field_id = new_value.to_string(); + self + } + /// Creative Field Value ID + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CreativeFieldValuePatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeFieldValuePatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeFieldValuePatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeFieldValuePatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one creative field value by ID. +/// +/// A builder for the *get* method supported by a *creativeFieldValue* resource. +/// It is not used directly, but through a `CreativeFieldValueMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creative_field_values().get("profileId", "creativeFieldId", "id") +/// .doit(); +/// # } +/// ``` +pub struct CreativeFieldValueGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _creative_field_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeFieldValueGetCall<'a, C, A> {} + +impl<'a, C, A> CreativeFieldValueGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeFieldValue)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeFieldValues.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("creativeFieldId", self._creative_field_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "creativeFieldId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/creativeFields/{creativeFieldId}/creativeFieldValues/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{creativeFieldId}", "creativeFieldId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["id", "creativeFieldId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeFieldValueGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Creative field ID for this creative field value. + /// + /// Sets the *creative field id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn creative_field_id(mut self, new_value: &str) -> CreativeFieldValueGetCall<'a, C, A> { + self._creative_field_id = new_value.to_string(); + self + } + /// Creative Field Value ID + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CreativeFieldValueGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeFieldValueGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeFieldValueGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeFieldValueGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes an existing creative field value. +/// +/// A builder for the *delete* method supported by a *creativeFieldValue* resource. +/// It is not used directly, but through a `CreativeFieldValueMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creative_field_values().delete("profileId", "creativeFieldId", "id") +/// .doit(); +/// # } +/// ``` +pub struct CreativeFieldValueDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _creative_field_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeFieldValueDeleteCall<'a, C, A> {} + +impl<'a, C, A> CreativeFieldValueDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeFieldValues.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("creativeFieldId", self._creative_field_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["profileId", "creativeFieldId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/creativeFields/{creativeFieldId}/creativeFieldValues/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{creativeFieldId}", "creativeFieldId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["id", "creativeFieldId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeFieldValueDeleteCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Creative field ID for this creative field value. + /// + /// Sets the *creative field id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn creative_field_id(mut self, new_value: &str) -> CreativeFieldValueDeleteCall<'a, C, A> { + self._creative_field_id = new_value.to_string(); + self + } + /// Creative Field Value ID + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CreativeFieldValueDeleteCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeFieldValueDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeFieldValueDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeFieldValueDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new creative field value. +/// +/// A builder for the *insert* method supported by a *creativeFieldValue* resource. +/// It is not used directly, but through a `CreativeFieldValueMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::CreativeFieldValue; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = CreativeFieldValue::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creative_field_values().insert(req, "profileId", "creativeFieldId") +/// .doit(); +/// # } +/// ``` +pub struct CreativeFieldValueInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: CreativeFieldValue, + _profile_id: String, + _creative_field_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeFieldValueInsertCall<'a, C, A> {} + +impl<'a, C, A> CreativeFieldValueInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeFieldValue)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeFieldValues.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("creativeFieldId", self._creative_field_id.to_string())); + for &field in ["alt", "profileId", "creativeFieldId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/creativeFields/{creativeFieldId}/creativeFieldValues".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{creativeFieldId}", "creativeFieldId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["creativeFieldId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: CreativeFieldValue) -> CreativeFieldValueInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeFieldValueInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Creative field ID for this creative field value. + /// + /// Sets the *creative field id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn creative_field_id(mut self, new_value: &str) -> CreativeFieldValueInsertCall<'a, C, A> { + self._creative_field_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeFieldValueInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeFieldValueInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeFieldValueInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing creative field value. +/// +/// A builder for the *update* method supported by a *creativeFieldValue* resource. +/// It is not used directly, but through a `CreativeFieldValueMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::CreativeFieldValue; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = CreativeFieldValue::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creative_field_values().update(req, "profileId", "creativeFieldId") +/// .doit(); +/// # } +/// ``` +pub struct CreativeFieldValueUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: CreativeFieldValue, + _profile_id: String, + _creative_field_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeFieldValueUpdateCall<'a, C, A> {} + +impl<'a, C, A> CreativeFieldValueUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeFieldValue)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeFieldValues.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("creativeFieldId", self._creative_field_id.to_string())); + for &field in ["alt", "profileId", "creativeFieldId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/creativeFields/{creativeFieldId}/creativeFieldValues".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{creativeFieldId}", "creativeFieldId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["creativeFieldId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: CreativeFieldValue) -> CreativeFieldValueUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeFieldValueUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Creative field ID for this creative field value. + /// + /// Sets the *creative field id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn creative_field_id(mut self, new_value: &str) -> CreativeFieldValueUpdateCall<'a, C, A> { + self._creative_field_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeFieldValueUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeFieldValueUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeFieldValueUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of creative field values, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *creativeFieldValue* resource. +/// It is not used directly, but through a `CreativeFieldValueMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creative_field_values().list("profileId", "creativeFieldId") +/// .sort_order("ipsum") +/// .sort_field("et") +/// .search_string("kasd") +/// .page_token("sed") +/// .max_results(-38) +/// .add_ids("diam") +/// .doit(); +/// # } +/// ``` +pub struct CreativeFieldValueListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _creative_field_id: String, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeFieldValueListCall<'a, C, A> {} + +impl<'a, C, A> CreativeFieldValueListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeFieldValuesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeFieldValues.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((10 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("creativeFieldId", self._creative_field_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + for &field in ["alt", "profileId", "creativeFieldId", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/creativeFields/{creativeFieldId}/creativeFieldValues".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{creativeFieldId}", "creativeFieldId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["creativeFieldId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeFieldValueListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Creative field ID for this creative field value. + /// + /// Sets the *creative field id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn creative_field_id(mut self, new_value: &str) -> CreativeFieldValueListCall<'a, C, A> { + self._creative_field_id = new_value.to_string(); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> CreativeFieldValueListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> CreativeFieldValueListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for creative field values by their values. Wildcards (e.g. *) are not allowed. + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> CreativeFieldValueListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> CreativeFieldValueListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> CreativeFieldValueListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only creative field values with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> CreativeFieldValueListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeFieldValueListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeFieldValueListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeFieldValueListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one postal code by ID. +/// +/// A builder for the *get* method supported by a *postalCode* resource. +/// It is not used directly, but through a `PostalCodeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.postal_codes().get("profileId", "code") +/// .doit(); +/// # } +/// ``` +pub struct PostalCodeGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _code: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PostalCodeGetCall<'a, C, A> {} + +impl<'a, C, A> PostalCodeGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PostalCode)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.postalCodes.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("code", self._code.to_string())); + for &field in ["alt", "profileId", "code"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/postalCodes/{code}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{code}", "code")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["code", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PostalCodeGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Postal code ID. + /// + /// Sets the *code* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn code(mut self, new_value: &str) -> PostalCodeGetCall<'a, C, A> { + self._code = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PostalCodeGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PostalCodeGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PostalCodeGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of postal codes. +/// +/// A builder for the *list* method supported by a *postalCode* resource. +/// It is not used directly, but through a `PostalCodeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.postal_codes().list("profileId") +/// .doit(); +/// # } +/// ``` +pub struct PostalCodeListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PostalCodeListCall<'a, C, A> {} + +impl<'a, C, A> PostalCodeListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PostalCodesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.postalCodes.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/postalCodes".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PostalCodeListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PostalCodeListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PostalCodeListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PostalCodeListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of browsers. +/// +/// A builder for the *list* method supported by a *browser* resource. +/// It is not used directly, but through a `BrowserMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.browsers().list("profileId") +/// .doit(); +/// # } +/// ``` +pub struct BrowserListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for BrowserListCall<'a, C, A> {} + +impl<'a, C, A> BrowserListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, BrowsersListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.browsers.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/browsers".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> BrowserListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> BrowserListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> BrowserListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> BrowserListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one account by ID. +/// +/// A builder for the *get* method supported by a *account* resource. +/// It is not used directly, but through a `AccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.accounts().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct AccountGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountGetCall<'a, C, A> {} + +impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Account)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.accounts.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/accounts/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AccountGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Account ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> AccountGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccountGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves the list of accounts, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *account* resource. +/// It is not used directly, but through a `AccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.accounts().list("profileId") +/// .sort_order("sea") +/// .sort_field("voluptua.") +/// .search_string("At") +/// .page_token("sanctus") +/// .max_results(-48) +/// .add_ids("sit") +/// .active(false) +/// .doit(); +/// # } +/// ``` +pub struct AccountListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _active: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountListCall<'a, C, A> {} + +impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AccountsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.accounts.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((10 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if let Some(value) = self._active { + params.push(("active", value.to_string())); + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids", "active"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/accounts".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AccountListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> AccountListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> AccountListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "account*2015" will return objects with names like "account June 2015", "account April 2015", or simply "account 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "account" will match objects with name "my account", "account 2015", or simply "account". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> AccountListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> AccountListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> AccountListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only accounts with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> AccountListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only active accounts. Don't set this field to select both active and non-active accounts. + /// + /// Sets the *active* query property to the given value. + pub fn active(mut self, new_value: bool) -> AccountListCall<'a, C, A> { + self._active = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccountListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing account. +/// +/// A builder for the *update* method supported by a *account* resource. +/// It is not used directly, but through a `AccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::Account; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Account::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.accounts().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct AccountUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Account, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountUpdateCall<'a, C, A> {} + +impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Account)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.accounts.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/accounts".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Account) -> AccountUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AccountUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccountUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing account. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *account* resource. +/// It is not used directly, but through a `AccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::Account; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Account::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.accounts().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct AccountPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Account, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountPatchCall<'a, C, A> {} + +impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Account)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.accounts.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/accounts".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Account) -> AccountPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AccountPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Account ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> AccountPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccountPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing placement. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *placement* resource. +/// It is not used directly, but through a `PlacementMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::Placement; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Placement::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.placements().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct PlacementPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Placement, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementPatchCall<'a, C, A> {} + +impl<'a, C, A> PlacementPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Placement)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placements.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/placements".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Placement) -> PlacementPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Placement ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> PlacementPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PlacementPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PlacementPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of placements, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *placement* resource. +/// It is not used directly, but through a `PlacementMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.placements().list("profileId") +/// .sort_order("gubergren") +/// .sort_field("sit") +/// .add_size_ids("et") +/// .add_site_ids("sea") +/// .search_string("justo") +/// .add_pricing_types("dolore") +/// .add_placement_strategy_ids("At") +/// .payment_source("dolor") +/// .page_token("tempor") +/// .min_start_date("ipsum") +/// .min_end_date("est") +/// .max_start_date("et") +/// .max_results(-60) +/// .max_end_date("sed") +/// .add_ids("kasd") +/// .add_group_ids("ipsum") +/// .add_directory_site_ids("sadipscing") +/// .add_content_category_ids("sea") +/// .add_compatibilities("eos") +/// .add_campaign_ids("dolor") +/// .archived(true) +/// .add_advertiser_ids("amet") +/// .doit(); +/// # } +/// ``` +pub struct PlacementListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _size_ids: Vec, + _site_ids: Vec, + _search_string: Option, + _pricing_types: Vec, + _placement_strategy_ids: Vec, + _payment_source: Option, + _page_token: Option, + _min_start_date: Option, + _min_end_date: Option, + _max_start_date: Option, + _max_results: Option, + _max_end_date: Option, + _ids: Vec, + _group_ids: Vec, + _directory_site_ids: Vec, + _content_category_ids: Vec, + _compatibilities: Vec, + _campaign_ids: Vec, + _archived: Option, + _advertiser_ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementListCall<'a, C, A> {} + +impl<'a, C, A> PlacementListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlacementsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placements.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((25 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if self._size_ids.len() > 0 { + for f in self._size_ids.iter() { + params.push(("sizeIds", f.to_string())); + } + } + if self._site_ids.len() > 0 { + for f in self._site_ids.iter() { + params.push(("siteIds", f.to_string())); + } + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if self._pricing_types.len() > 0 { + for f in self._pricing_types.iter() { + params.push(("pricingTypes", f.to_string())); + } + } + if self._placement_strategy_ids.len() > 0 { + for f in self._placement_strategy_ids.iter() { + params.push(("placementStrategyIds", f.to_string())); + } + } + if let Some(value) = self._payment_source { + params.push(("paymentSource", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._min_start_date { + params.push(("minStartDate", value.to_string())); + } + if let Some(value) = self._min_end_date { + params.push(("minEndDate", value.to_string())); + } + if let Some(value) = self._max_start_date { + params.push(("maxStartDate", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._max_end_date { + params.push(("maxEndDate", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if self._group_ids.len() > 0 { + for f in self._group_ids.iter() { + params.push(("groupIds", f.to_string())); + } + } + if self._directory_site_ids.len() > 0 { + for f in self._directory_site_ids.iter() { + params.push(("directorySiteIds", f.to_string())); + } + } + if self._content_category_ids.len() > 0 { + for f in self._content_category_ids.iter() { + params.push(("contentCategoryIds", f.to_string())); + } + } + if self._compatibilities.len() > 0 { + for f in self._compatibilities.iter() { + params.push(("compatibilities", f.to_string())); + } + } + if self._campaign_ids.len() > 0 { + for f in self._campaign_ids.iter() { + params.push(("campaignIds", f.to_string())); + } + } + if let Some(value) = self._archived { + params.push(("archived", value.to_string())); + } + if self._advertiser_ids.len() > 0 { + for f in self._advertiser_ids.iter() { + params.push(("advertiserIds", f.to_string())); + } + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "sizeIds", "siteIds", "searchString", "pricingTypes", "placementStrategyIds", "paymentSource", "pageToken", "minStartDate", "minEndDate", "maxStartDate", "maxResults", "maxEndDate", "ids", "groupIds", "directorySiteIds", "contentCategoryIds", "compatibilities", "campaignIds", "archived", "advertiserIds"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/placements".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Select only placements that are associated with these sizes. + /// + /// Append the given value to the *size ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_size_ids(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._size_ids.push(new_value.to_string()); + self + } + /// Select only placements that are associated with these sites. + /// + /// Append the given value to the *site ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_site_ids(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._site_ids.push(new_value.to_string()); + self + } + /// Allows searching for placements by name or ID. Wildcards (*) are allowed. For example, "placement*2015" will return placements with names like "placement June 2015", "placement May 2015", or simply "placements 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "placement" will match placements with name "my placement", "placement 2015", or simply "placement". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Select only placements with these pricing types. + /// + /// Append the given value to the *pricing types* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_pricing_types(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._pricing_types.push(new_value.to_string()); + self + } + /// Select only placements that are associated with these placement strategies. + /// + /// Append the given value to the *placement strategy ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_placement_strategy_ids(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._placement_strategy_ids.push(new_value.to_string()); + self + } + /// Select only placements with this payment source. + /// + /// Sets the *payment source* query property to the given value. + pub fn payment_source(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._payment_source = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Select only placements or placement groups whose start date is on or after the specified minStartDate. The date should be formatted as "yyyy-MM-dd". + /// + /// Sets the *min start date* query property to the given value. + pub fn min_start_date(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._min_start_date = Some(new_value.to_string()); + self + } + /// Select only placements or placement groups whose end date is on or after the specified minEndDate. The date should be formatted as "yyyy-MM-dd". + /// + /// Sets the *min end date* query property to the given value. + pub fn min_end_date(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._min_end_date = Some(new_value.to_string()); + self + } + /// Select only placements or placement groups whose start date is on or before the specified maxStartDate. The date should be formatted as "yyyy-MM-dd". + /// + /// Sets the *max start date* query property to the given value. + pub fn max_start_date(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._max_start_date = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> PlacementListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only placements or placement groups whose end date is on or before the specified maxEndDate. The date should be formatted as "yyyy-MM-dd". + /// + /// Sets the *max end date* query property to the given value. + pub fn max_end_date(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._max_end_date = Some(new_value.to_string()); + self + } + /// Select only placements with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only placements that belong to these placement groups. + /// + /// Append the given value to the *group ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_group_ids(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._group_ids.push(new_value.to_string()); + self + } + /// Select only placements that are associated with these directory sites. + /// + /// Append the given value to the *directory site ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_directory_site_ids(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._directory_site_ids.push(new_value.to_string()); + self + } + /// Select only placements that are associated with these content categories. + /// + /// Append the given value to the *content category ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_content_category_ids(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._content_category_ids.push(new_value.to_string()); + self + } + /// Select only placements that are associated with these compatibilities. DISPLAY and DISPLAY_INTERSTITIAL refer to rendering either on desktop or on mobile devices for regular or interstitial ads respectively. APP and APP_INTERSTITIAL are for rendering in mobile apps. IN_STREAM_VIDEO refers to rendering in in-stream video ads developed with the VAST standard. + /// + /// Append the given value to the *compatibilities* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_compatibilities(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._compatibilities.push(new_value.to_string()); + self + } + /// Select only placements that belong to these campaigns. + /// + /// Append the given value to the *campaign ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_campaign_ids(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._campaign_ids.push(new_value.to_string()); + self + } + /// Select only archived placements. Don't set this field to select both archived and non-archived placements. + /// + /// Sets the *archived* query property to the given value. + pub fn archived(mut self, new_value: bool) -> PlacementListCall<'a, C, A> { + self._archived = Some(new_value); + self + } + /// Select only placements that belong to these advertisers. + /// + /// Append the given value to the *advertiser ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_advertiser_ids(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._advertiser_ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PlacementListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PlacementListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one placement by ID. +/// +/// A builder for the *get* method supported by a *placement* resource. +/// It is not used directly, but through a `PlacementMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.placements().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct PlacementGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementGetCall<'a, C, A> {} + +impl<'a, C, A> PlacementGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Placement)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placements.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/placements/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Placement ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> PlacementGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PlacementGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PlacementGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new placement. +/// +/// A builder for the *insert* method supported by a *placement* resource. +/// It is not used directly, but through a `PlacementMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::Placement; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Placement::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.placements().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct PlacementInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Placement, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementInsertCall<'a, C, A> {} + +impl<'a, C, A> PlacementInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Placement)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placements.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/placements".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Placement) -> PlacementInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PlacementInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PlacementInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing placement. +/// +/// A builder for the *update* method supported by a *placement* resource. +/// It is not used directly, but through a `PlacementMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// use dfareporting2d7::Placement; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Placement::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.placements().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct PlacementUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Placement, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementUpdateCall<'a, C, A> {} + +impl<'a, C, A> PlacementUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Placement)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placements.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/placements".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Placement) -> PlacementUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PlacementUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PlacementUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Generates tags for a placement. +/// +/// A builder for the *generatetags* method supported by a *placement* resource. +/// It is not used directly, but through a `PlacementMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d7 as dfareporting2d7; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d7::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.placements().generatetags("profileId") +/// .add_tag_formats("no") +/// .add_placement_ids("tempor") +/// .campaign_id("dolor") +/// .doit(); +/// # } +/// ``` +pub struct PlacementGeneratetagCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _tag_formats: Vec, + _placement_ids: Vec, + _campaign_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementGeneratetagCall<'a, C, A> {} + +impl<'a, C, A> PlacementGeneratetagCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlacementsGenerateTagsResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placements.generatetags", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if self._tag_formats.len() > 0 { + for f in self._tag_formats.iter() { + params.push(("tagFormats", f.to_string())); + } + } + if self._placement_ids.len() > 0 { + for f in self._placement_ids.iter() { + params.push(("placementIds", f.to_string())); + } + } + if let Some(value) = self._campaign_id { + params.push(("campaignId", value.to_string())); + } + for &field in ["alt", "profileId", "tagFormats", "placementIds", "campaignId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.7/userprofiles/{profileId}/placements/generatetags".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementGeneratetagCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Tag formats to generate for these placements. + /// + /// Append the given value to the *tag formats* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_tag_formats(mut self, new_value: &str) -> PlacementGeneratetagCall<'a, C, A> { + self._tag_formats.push(new_value.to_string()); + self + } + /// Generate tags for these placements. + /// + /// Append the given value to the *placement ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_placement_ids(mut self, new_value: &str) -> PlacementGeneratetagCall<'a, C, A> { + self._placement_ids.push(new_value.to_string()); + self + } + /// Generate placements belonging to this campaign. This is a required field. + /// + /// Sets the *campaign id* query property to the given value. + pub fn campaign_id(mut self, new_value: &str) -> PlacementGeneratetagCall<'a, C, A> { + self._campaign_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PlacementGeneratetagCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementGeneratetagCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PlacementGeneratetagCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + diff --git a/gen/dns1-cli/Cargo.toml b/gen/dns1-cli/Cargo.toml index f759c5d2be..23e252542c 100644 --- a/gen/dns1-cli/Cargo.toml +++ b/gen/dns1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-dns1-cli" -version = "1.0.0+20160825" +version = "1.0.0+20161130" authors = ["Sebastian Thiel "] description = "A complete library to interact with dns (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/dns1-cli" diff --git a/gen/dns1-cli/README.md b/gen/dns1-cli/README.md index f3be8d0744..412fabd1d9 100644 --- a/gen/dns1-cli/README.md +++ b/gen/dns1-cli/README.md @@ -24,7 +24,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *dns* API at revision *20160825*. The CLI is at version *1.0.0*. +This documentation was generated from the *dns* API at revision *20161130*. The CLI is at version *1.0.0*. ```bash dns1 [options] diff --git a/gen/dns1-cli/mkdocs.yml b/gen/dns1-cli/mkdocs.yml index 96d5619513..ec98b2ee74 100644 --- a/gen/dns1-cli/mkdocs.yml +++ b/gen/dns1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: dns v1.0.0+20160825 +site_name: dns v1.0.0+20161130 site_url: http://byron.github.io/google-apis-rs/google-dns1-cli site_description: Write integrating applications with bcore diff --git a/gen/dns1-cli/src/main.rs b/gen/dns1-cli/src/main.rs index 334672c92c..f83f139d2d 100644 --- a/gen/dns1-cli/src/main.rs +++ b/gen/dns1-cli/src/main.rs @@ -1025,7 +1025,7 @@ fn main() { let mut app = App::new("dns1") .author("Sebastian Thiel ") - .version("1.0.0+20160825") + .version("1.0.0+20161130") .about("Configures and serves authoritative DNS records.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_dns1_cli") .arg(Arg::with_name("url") diff --git a/gen/dns1/Cargo.toml b/gen/dns1/Cargo.toml index aca96f9f39..126c2385a4 100644 --- a/gen/dns1/Cargo.toml +++ b/gen/dns1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-dns1" -version = "1.0.0+20160825" +version = "1.0.0+20161130" authors = ["Sebastian Thiel "] description = "A complete library to interact with dns (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/dns1" diff --git a/gen/dns1/README.md b/gen/dns1/README.md index d9c9d1ff34..257db1dd78 100644 --- a/gen/dns1/README.md +++ b/gen/dns1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-dns1` library allows access to all features of the *Google dns* service. -This documentation was generated from *dns* crate version *1.0.0+20160825*, where *20160825* is the exact revision of the *dns:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *dns* crate version *1.0.0+20161130*, where *20161130* is the exact revision of the *dns:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *dns* *v1* API can be found at the [official documentation site](https://developers.google.com/cloud-dns). diff --git a/gen/dns1/src/lib.rs b/gen/dns1/src/lib.rs index 97d25e2dcb..7370734b73 100644 --- a/gen/dns1/src/lib.rs +++ b/gen/dns1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *dns* crate version *1.0.0+20160825*, where *20160825* is the exact revision of the *dns:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *dns* crate version *1.0.0+20161130*, where *20161130* is the exact revision of the *dns:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *dns* *v1* API can be found at the //! [official documentation site](https://developers.google.com/cloud-dns). diff --git a/gen/doubleclickbidmanager1-cli/Cargo.toml b/gen/doubleclickbidmanager1-cli/Cargo.toml index 420d7505c4..baa8a957c3 100644 --- a/gen/doubleclickbidmanager1-cli/Cargo.toml +++ b/gen/doubleclickbidmanager1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-doubleclickbidmanager1-cli" -version = "1.0.0+20160608" +version = "1.0.0+20161010" authors = ["Sebastian Thiel "] description = "A complete library to interact with DoubleClick Bid Manager (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/doubleclickbidmanager1-cli" diff --git a/gen/doubleclickbidmanager1-cli/README.md b/gen/doubleclickbidmanager1-cli/README.md index 4d7a2cf18d..9f4861ba85 100644 --- a/gen/doubleclickbidmanager1-cli/README.md +++ b/gen/doubleclickbidmanager1-cli/README.md @@ -24,7 +24,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *DoubleClick Bid Manager* API at revision *20160608*. The CLI is at version *1.0.0*. +This documentation was generated from the *DoubleClick Bid Manager* API at revision *20161010*. The CLI is at version *1.0.0*. ```bash doubleclickbidmanager1 [options] @@ -39,8 +39,8 @@ doubleclickbidmanager1 [options] runquery (-r )... [-p ]... reports listreports [-p ]... [-o ] - rubicon - notifyproposalchange (-r )... [-p ]... + sdf + download (-r )... [-p ]... [-o ] doubleclickbidmanager1 --help Configuration: diff --git a/gen/doubleclickbidmanager1-cli/mkdocs.yml b/gen/doubleclickbidmanager1-cli/mkdocs.yml index 0206d7c385..297c4fad26 100644 --- a/gen/doubleclickbidmanager1-cli/mkdocs.yml +++ b/gen/doubleclickbidmanager1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: DoubleClick Bid Manager v1.0.0+20160608 +site_name: DoubleClick Bid Manager v1.0.0+20161010 site_url: http://byron.github.io/google-apis-rs/google-doubleclickbidmanager1-cli site_description: Write integrating applications with bcore @@ -17,7 +17,7 @@ pages: - ['queries_listqueries.md', 'Queries', 'Listqueries'] - ['queries_runquery.md', 'Queries', 'Runquery'] - ['reports_listreports.md', 'Reports', 'Listreports'] -- ['rubicon_notifyproposalchange.md', 'Rubicon', 'Notifyproposalchange'] +- ['sdf_download.md', 'Sdf', 'Download'] theme: readthedocs diff --git a/gen/doubleclickbidmanager1-cli/src/main.rs b/gen/doubleclickbidmanager1-cli/src/main.rs index b71a5f5977..4b10371981 100644 --- a/gen/doubleclickbidmanager1-cli/src/main.rs +++ b/gen/doubleclickbidmanager1-cli/src/main.rs @@ -584,7 +584,7 @@ impl<'n> Engine<'n> { } } - fn _rubicon_notifyproposalchange(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + fn _sdf_download(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); @@ -607,12 +607,12 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "action" => Some(("action", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "token" => Some(("token", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "href" => Some(("href", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "filter-type" => Some(("filterType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "version" => Some(("version", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "file-types" => Some(("fileTypes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "filter-ids" => Some(("filterIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["action", "href", "id", "token"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["file-types", "filter-ids", "filter-type", "version"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -621,8 +621,8 @@ impl<'n> Engine<'n> { FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); } } - let mut request: api::NotifyProposalChangeRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.rubicon().notifyproposalchange(request); + let mut request: api::DownloadRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.sdf().download(request); for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { @@ -649,12 +649,20 @@ impl<'n> Engine<'n> { Ok(()) } else { assert!(err.issues.len() == 0); + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; match match protocol { CallType::Standard => call.doit(), _ => unreachable!() } { Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok(mut response) => { + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); Ok(()) } } @@ -714,13 +722,13 @@ impl<'n> Engine<'n> { } } }, - ("rubicon", Some(opt)) => { + ("sdf", Some(opt)) => { match opt.subcommand() { - ("notifyproposalchange", Some(opt)) => { - call_result = self._rubicon_notifyproposalchange(opt, dry_run, &mut err); + ("download", Some(opt)) => { + call_result = self._sdf_download(opt, dry_run, &mut err); }, _ => { - err.issues.push(CLIError::MissingMethodError("rubicon".to_string())); + err.issues.push(CLIError::MissingMethodError("sdf".to_string())); writeln!(io::stderr(), "{}\n", opt.usage()).ok(); } } @@ -980,10 +988,10 @@ fn main() { ]), ]), - ("rubicon", "methods: 'notifyproposalchange'", vec![ - ("notifyproposalchange", - Some(r##"Update proposal upon actions of Rubicon publisher."##), - "Details at http://byron.github.io/google-apis-rs/google_doubleclickbidmanager1_cli/rubicon_notifyproposalchange", + ("sdf", "methods: 'download'", vec![ + ("download", + Some(r##"Retrieves entities in SDF format."##), + "Details at http://byron.github.io/google-apis-rs/google_doubleclickbidmanager1_cli/sdf_download", vec![ (Some(r##"kv"##), Some(r##"r"##), @@ -996,6 +1004,12 @@ fn main() { Some(r##"Set various optional parameters, matching the key=value form"##), Some(false), Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), ]), ]), @@ -1003,7 +1017,7 @@ fn main() { let mut app = App::new("doubleclickbidmanager1") .author("Sebastian Thiel ") - .version("1.0.0+20160608") + .version("1.0.0+20161010") .about("API for viewing and managing your reports in DoubleClick Bid Manager.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_doubleclickbidmanager1_cli") .arg(Arg::with_name("folder") diff --git a/gen/doubleclickbidmanager1/Cargo.toml b/gen/doubleclickbidmanager1/Cargo.toml index 1a85f9ed15..74825ae295 100644 --- a/gen/doubleclickbidmanager1/Cargo.toml +++ b/gen/doubleclickbidmanager1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-doubleclickbidmanager1" -version = "1.0.0+20160608" +version = "1.0.0+20161010" authors = ["Sebastian Thiel "] description = "A complete library to interact with DoubleClick Bid Manager (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/doubleclickbidmanager1" diff --git a/gen/doubleclickbidmanager1/README.md b/gen/doubleclickbidmanager1/README.md index dfa927e47a..2a3e3f80b2 100644 --- a/gen/doubleclickbidmanager1/README.md +++ b/gen/doubleclickbidmanager1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-doubleclickbidmanager1` library allows access to all features of the *Google DoubleClick Bid Manager* service. -This documentation was generated from *DoubleClick Bid Manager* crate version *1.0.0+20160608*, where *20160608* is the exact revision of the *doubleclickbidmanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *DoubleClick Bid Manager* crate version *1.0.0+20161010*, where *20161010* is the exact revision of the *doubleclickbidmanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *DoubleClick Bid Manager* *v1* API can be found at the [official documentation site](https://developers.google.com/bid-manager/). @@ -19,8 +19,8 @@ Handle the following *Resources* with ease from the central [hub](http://byron.g * [*createquery*](http://byron.github.io/google-apis-rs/google_doubleclickbidmanager1/struct.QueryCreatequeryCall.html), [*deletequery*](http://byron.github.io/google-apis-rs/google_doubleclickbidmanager1/struct.QueryDeletequeryCall.html), [*getquery*](http://byron.github.io/google-apis-rs/google_doubleclickbidmanager1/struct.QueryGetqueryCall.html), [*listqueries*](http://byron.github.io/google-apis-rs/google_doubleclickbidmanager1/struct.QueryListqueryCall.html) and [*runquery*](http://byron.github.io/google-apis-rs/google_doubleclickbidmanager1/struct.QueryRunqueryCall.html) * [reports](http://byron.github.io/google-apis-rs/google_doubleclickbidmanager1/struct.Report.html) * [*listreports*](http://byron.github.io/google-apis-rs/google_doubleclickbidmanager1/struct.ReportListreportCall.html) -* rubicon - * [*notifyproposalchange*](http://byron.github.io/google-apis-rs/google_doubleclickbidmanager1/struct.RubiconNotifyproposalchangeCall.html) +* sdf + * [*download*](http://byron.github.io/google-apis-rs/google_doubleclickbidmanager1/struct.SdfDownloadCall.html) diff --git a/gen/doubleclickbidmanager1/src/lib.rs b/gen/doubleclickbidmanager1/src/lib.rs index 13eb94362b..9b00bb5860 100644 --- a/gen/doubleclickbidmanager1/src/lib.rs +++ b/gen/doubleclickbidmanager1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *DoubleClick Bid Manager* crate version *1.0.0+20160608*, where *20160608* is the exact revision of the *doubleclickbidmanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *DoubleClick Bid Manager* crate version *1.0.0+20161010*, where *20161010* is the exact revision of the *doubleclickbidmanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *DoubleClick Bid Manager* *v1* API can be found at the //! [official documentation site](https://developers.google.com/bid-manager/). @@ -17,8 +17,8 @@ //! * [*createquery*](struct.QueryCreatequeryCall.html), [*deletequery*](struct.QueryDeletequeryCall.html), [*getquery*](struct.QueryGetqueryCall.html), [*listqueries*](struct.QueryListqueryCall.html) and [*runquery*](struct.QueryRunqueryCall.html) //! * [reports](struct.Report.html) //! * [*listreports*](struct.ReportListreportCall.html) -//! * rubicon -//! * [*notifyproposalchange*](struct.RubiconNotifyproposalchangeCall.html) +//! * sdf +//! * [*download*](struct.SdfDownloadCall.html) //! //! //! diff --git a/gen/doubleclickbidmanager1/src/lib.rs.in b/gen/doubleclickbidmanager1/src/lib.rs.in index 290419b0e1..0b600d1a76 100644 --- a/gen/doubleclickbidmanager1/src/lib.rs.in +++ b/gen/doubleclickbidmanager1/src/lib.rs.in @@ -122,8 +122,8 @@ impl<'a, C, A> DoubleClickBidManager pub fn reports(&'a self) -> ReportMethods<'a, C, A> { ReportMethods { hub: &self } } - pub fn rubicon(&'a self) -> RubiconMethods<'a, C, A> { - RubiconMethods { hub: &self } + pub fn sdf(&'a self) -> SdfMethods<'a, C, A> { + SdfMethods { hub: &self } } /// Set the user-agent header field to use in all requests to the server. @@ -141,32 +141,6 @@ impl<'a, C, A> DoubleClickBidManager // ############ // SCHEMAS ### // ########## -/// NotifyProposalChange request. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [notifyproposalchange rubicon](struct.RubiconNotifyproposalchangeCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct NotifyProposalChangeRequest { - /// Action taken by publisher. One of: Accept, Decline, Append - pub action: Option, - /// Notes from publisher - pub notes: Option>, - /// URL to access proposal detail. - pub href: Option, - /// Below are contents of notification from Rubicon. Proposal id. - pub id: Option, - /// Deal token, available when proposal is accepted by publisher. - pub token: Option, -} - -impl RequestValue for NotifyProposalChangeRequest {} - - /// Request to fetch stored line items. /// /// # Activities @@ -232,27 +206,6 @@ pub struct Parameters { impl Part for Parameters {} -/// Publisher comment from Rubicon. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Note { - /// Publisher user name. - pub username: Option, - /// Equals "publisher" for notification from Rubicon. - pub source: Option, - /// Message from publisher. - pub message: Option, - /// Note id. - pub id: Option, - /// Time when the note was added, e.g. "2015-12-16T17:25:35.000-08:00". - pub timestamp: Option, -} - -impl Part for Note {} - - /// Key used to identify a report. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -487,6 +440,33 @@ pub struct ListReportsResponse { impl ResponseResult for ListReportsResponse {} +/// Request to fetch stored insertion orders, line items, TrueView ad groups and ads. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [download sdf](struct.SdfDownloadCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DownloadRequest { + /// File types that will be returned. + #[serde(rename="fileTypes")] + pub file_types: Option>, + /// SDF Version (column names, types, order) in which the entities will be returned. Default to 3. + pub version: Option, + /// Filter type used to filter line items to fetch. + #[serde(rename="filterType")] + pub filter_type: Option, + /// The IDs of the specified filter type. This is used to filter entities to fetch. At least one ID must be specified. Only one ID is allowed for the ADVERTISER_ID filter type. For INSERTION_ORDER_ID or LINE_ITEM_ID filter types all IDs must be from the same Advertiser. + #[serde(rename="filterIds")] + pub filter_ids: Option>, +} + +impl RequestValue for DownloadRequest {} + + /// Represents the upload status of a row in the request. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -624,12 +604,39 @@ pub struct UploadStatus { impl Part for UploadStatus {} +/// Download response. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [download sdf](struct.SdfDownloadCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DownloadResponse { + /// Retrieved insertion orders in SDF format. + #[serde(rename="insertionOrders")] + pub insertion_orders: Option, + /// Retrieved line items in SDF format. + #[serde(rename="lineItems")] + pub line_items: Option, + /// Retrieved ads in SDF format. + pub ads: Option, + /// Retrieved ad groups in SDF format. + #[serde(rename="adGroups")] + pub ad_groups: Option, +} + +impl ResponseResult for DownloadResponse {} + + // ################### // MethodBuilders ### // ################# -/// A builder providing access to all methods supported on *rubicon* resources. +/// A builder providing access to all methods supported on *sdf* resources. /// It is not used directly, but through the `DoubleClickBidManager` hub. /// /// # Example @@ -652,30 +659,30 @@ impl Part for UploadStatus {} /// ::default(), None); /// let mut hub = DoubleClickBidManager::new(hyper::Client::new(), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `notifyproposalchange(...)` +/// // like `download(...)` /// // to build up your call. -/// let rb = hub.rubicon(); +/// let rb = hub.sdf(); /// # } /// ``` -pub struct RubiconMethods<'a, C, A> +pub struct SdfMethods<'a, C, A> where C: 'a, A: 'a { hub: &'a DoubleClickBidManager, } -impl<'a, C, A> MethodsBuilder for RubiconMethods<'a, C, A> {} +impl<'a, C, A> MethodsBuilder for SdfMethods<'a, C, A> {} -impl<'a, C, A> RubiconMethods<'a, C, A> { +impl<'a, C, A> SdfMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Update proposal upon actions of Rubicon publisher. + /// Retrieves entities in SDF format. /// /// # Arguments /// /// * `request` - No description provided. - pub fn notifyproposalchange(&self, request: NotifyProposalChangeRequest) -> RubiconNotifyproposalchangeCall<'a, C, A> { - RubiconNotifyproposalchangeCall { + pub fn download(&self, request: DownloadRequest) -> SdfDownloadCall<'a, C, A> { + SdfDownloadCall { hub: self.hub, _request: request, _delegate: Default::default(), @@ -940,10 +947,10 @@ impl<'a, C, A> QueryMethods<'a, C, A> { // CallBuilders ### // ################# -/// Update proposal upon actions of Rubicon publisher. +/// Retrieves entities in SDF format. /// -/// A builder for the *notifyproposalchange* method supported by a *rubicon* resource. -/// It is not used directly, but through a `RubiconMethods` instance. +/// A builder for the *download* method supported by a *sdf* resource. +/// It is not used directly, but through a `SdfMethods` instance. /// /// # Example /// @@ -953,7 +960,7 @@ impl<'a, C, A> QueryMethods<'a, C, A> { /// # extern crate hyper; /// # extern crate yup_oauth2 as oauth2; /// # extern crate google_doubleclickbidmanager1 as doubleclickbidmanager1; -/// use doubleclickbidmanager1::NotifyProposalChangeRequest; +/// use doubleclickbidmanager1::DownloadRequest; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -967,31 +974,31 @@ impl<'a, C, A> QueryMethods<'a, C, A> { /// // As the method needs a request, you would usually fill it with the desired information /// // into the respective structure. Some of the parts shown here might not be applicable ! /// // Values shown here are possibly random and not representative ! -/// let mut req = NotifyProposalChangeRequest::default(); +/// let mut req = DownloadRequest::default(); /// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.rubicon().notifyproposalchange(req) +/// let result = hub.sdf().download(req) /// .doit(); /// # } /// ``` -pub struct RubiconNotifyproposalchangeCall<'a, C, A> +pub struct SdfDownloadCall<'a, C, A> where C: 'a, A: 'a { hub: &'a DoubleClickBidManager, - _request: NotifyProposalChangeRequest, + _request: DownloadRequest, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, } -impl<'a, C, A> CallBuilder for RubiconNotifyproposalchangeCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for SdfDownloadCall<'a, C, A> {} -impl<'a, C, A> RubiconNotifyproposalchangeCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> SdfDownloadCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result { + pub fn doit(mut self) -> Result<(hyper::client::Response, DownloadResponse)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -999,10 +1006,10 @@ impl<'a, C, A> RubiconNotifyproposalchangeCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "doubleclickbidmanager.rubicon.notifyproposalchange", + dlg.begin(MethodInfo { id: "doubleclickbidmanager.sdf.download", http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); - for &field in [].iter() { + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + for &field in ["alt"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -1012,8 +1019,9 @@ impl<'a, C, A> RubiconNotifyproposalchangeCall<'a, C, A> where C: BorrowMut RubiconNotifyproposalchangeCall<'a, C, A> where C: BorrowMut Err(Error::BadRequest(serr)) } } - let result_value = res; + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; dlg.finished(true); return Ok(result_value) @@ -1100,7 +1118,7 @@ impl<'a, C, A> RubiconNotifyproposalchangeCall<'a, C, A> where C: BorrowMut RubiconNotifyproposalchangeCall<'a, C, A> { + pub fn request(mut self, new_value: DownloadRequest) -> SdfDownloadCall<'a, C, A> { self._request = new_value; self } @@ -1110,7 +1128,7 @@ impl<'a, C, A> RubiconNotifyproposalchangeCall<'a, C, A> where C: BorrowMut RubiconNotifyproposalchangeCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> SdfDownloadCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -1131,7 +1149,7 @@ impl<'a, C, A> RubiconNotifyproposalchangeCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> RubiconNotifyproposalchangeCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> SdfDownloadCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self diff --git a/gen/doubleclicksearch2-cli/Cargo.toml b/gen/doubleclicksearch2-cli/Cargo.toml index d34c87d9c8..85787de023 100644 --- a/gen/doubleclicksearch2-cli/Cargo.toml +++ b/gen/doubleclicksearch2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-doubleclicksearch2-cli" -version = "1.0.0+20160831" +version = "1.0.0+20161108" authors = ["Sebastian Thiel "] description = "A complete library to interact with doubleclicksearch (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/doubleclicksearch2-cli" diff --git a/gen/doubleclicksearch2-cli/README.md b/gen/doubleclicksearch2-cli/README.md index 28ab19282f..8a707b555e 100644 --- a/gen/doubleclicksearch2-cli/README.md +++ b/gen/doubleclicksearch2-cli/README.md @@ -24,7 +24,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *doubleclicksearch* API at revision *20160831*. The CLI is at version *1.0.0*. +This documentation was generated from the *doubleclicksearch* API at revision *20161108*. The CLI is at version *1.0.0*. ```bash doubleclicksearch2 [options] diff --git a/gen/doubleclicksearch2-cli/mkdocs.yml b/gen/doubleclicksearch2-cli/mkdocs.yml index 2caf467b94..548e739205 100644 --- a/gen/doubleclicksearch2-cli/mkdocs.yml +++ b/gen/doubleclicksearch2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: doubleclicksearch v1.0.0+20160831 +site_name: doubleclicksearch v1.0.0+20161108 site_url: http://byron.github.io/google-apis-rs/google-doubleclicksearch2-cli site_description: Write integrating applications with bcore diff --git a/gen/doubleclicksearch2-cli/src/main.rs b/gen/doubleclicksearch2-cli/src/main.rs index d22bef9fcd..3cb0adf633 100644 --- a/gen/doubleclicksearch2-cli/src/main.rs +++ b/gen/doubleclicksearch2-cli/src/main.rs @@ -1291,7 +1291,7 @@ fn main() { let mut app = App::new("doubleclicksearch2") .author("Sebastian Thiel ") - .version("1.0.0+20160831") + .version("1.0.0+20161108") .about("Reports and modifies your advertising data in DoubleClick Search (for example, campaigns, ad groups, keywords, and conversions).") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_doubleclicksearch2_cli") .arg(Arg::with_name("url") diff --git a/gen/doubleclicksearch2/Cargo.toml b/gen/doubleclicksearch2/Cargo.toml index 32c9ec9608..7db35b9a53 100644 --- a/gen/doubleclicksearch2/Cargo.toml +++ b/gen/doubleclicksearch2/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-doubleclicksearch2" -version = "1.0.0+20160831" +version = "1.0.0+20161108" authors = ["Sebastian Thiel "] description = "A complete library to interact with doubleclicksearch (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/doubleclicksearch2" diff --git a/gen/doubleclicksearch2/README.md b/gen/doubleclicksearch2/README.md index ff142f4254..d22dcd7253 100644 --- a/gen/doubleclicksearch2/README.md +++ b/gen/doubleclicksearch2/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-doubleclicksearch2` library allows access to all features of the *Google doubleclicksearch* service. -This documentation was generated from *doubleclicksearch* crate version *1.0.0+20160831*, where *20160831* is the exact revision of the *doubleclicksearch:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *doubleclicksearch* crate version *1.0.0+20161108*, where *20161108* is the exact revision of the *doubleclicksearch:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *doubleclicksearch* *v2* API can be found at the [official documentation site](https://developers.google.com/doubleclick-search/). diff --git a/gen/doubleclicksearch2/src/lib.rs b/gen/doubleclicksearch2/src/lib.rs index b8bbe4e83e..5f6b76f2b5 100644 --- a/gen/doubleclicksearch2/src/lib.rs +++ b/gen/doubleclicksearch2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *doubleclicksearch* crate version *1.0.0+20160831*, where *20160831* is the exact revision of the *doubleclicksearch:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *doubleclicksearch* crate version *1.0.0+20161108*, where *20161108* is the exact revision of the *doubleclicksearch:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *doubleclicksearch* *v2* API can be found at the //! [official documentation site](https://developers.google.com/doubleclick-search/). diff --git a/gen/drive2-cli/Cargo.toml b/gen/drive2-cli/Cargo.toml index 781e9d8bb7..cf7ce0e816 100644 --- a/gen/drive2-cli/Cargo.toml +++ b/gen/drive2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-drive2-cli" -version = "1.0.0+20160901" +version = "1.0.0+20161212" authors = ["Sebastian Thiel "] description = "A complete library to interact with drive (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/drive2-cli" diff --git a/gen/drive2-cli/README.md b/gen/drive2-cli/README.md index 597cb5c2d1..1a4c2d26fb 100644 --- a/gen/drive2-cli/README.md +++ b/gen/drive2-cli/README.md @@ -24,7 +24,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *drive* API at revision *20160901*. The CLI is at version *1.0.0*. +This documentation was generated from the *drive* API at revision *20161212*. The CLI is at version *1.0.0*. ```bash drive2 [options] diff --git a/gen/drive2-cli/mkdocs.yml b/gen/drive2-cli/mkdocs.yml index 89cc299841..dd79190c7e 100644 --- a/gen/drive2-cli/mkdocs.yml +++ b/gen/drive2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: drive v1.0.0+20160901 +site_name: drive v1.0.0+20161212 site_url: http://byron.github.io/google-apis-rs/google-drive2-cli site_description: Write integrating applications with bcore diff --git a/gen/drive2-cli/src/main.rs b/gen/drive2-cli/src/main.rs index 165c121def..298f7d0f89 100644 --- a/gen/drive2-cli/src/main.rs +++ b/gen/drive2-cli/src/main.rs @@ -1292,16 +1292,18 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { + "has-thumbnail" => Some(("hasThumbnail", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "mime-type" => Some(("mimeType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "last-viewed-by-me-date" => Some(("lastViewedByMeDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "app-data-contents" => Some(("appDataContents", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "thumbnail-link" => Some(("thumbnailLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "labels.restricted" => Some(("labels.restricted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "labels.hidden" => Some(("labels.hidden", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "labels.modified" => Some(("labels.modified", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "labels.viewed" => Some(("labels.viewed", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "labels.starred" => Some(("labels.starred", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "labels.hidden" => Some(("labels.hidden", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "labels.trashed" => Some(("labels.trashed", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "indexable-text.text" => Some(("indexableText.text", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "thumbnail-version" => Some(("thumbnailVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "explicitly-trashed" => Some(("explicitlyTrashed", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "is-app-authorized" => Some(("isAppAuthorized", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "last-modifying-user-name" => Some(("lastModifyingUserName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1366,6 +1368,7 @@ impl<'n> Engine<'n> { "quota-bytes-used" => Some(("quotaBytesUsed", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "embed-link" => Some(("embedLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "created-date" => Some(("createdDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-viewed-by-me-date" => Some(("lastViewedByMeDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "md5-checksum" => Some(("md5Checksum", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "icon-link" => Some(("iconLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "default-open-with-link" => Some(("defaultOpenWithLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1400,7 +1403,7 @@ impl<'n> Engine<'n> { "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "modified-date" => Some(("modifiedDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["additional-roles", "alternate-link", "altitude", "aperture", "app-data-contents", "auth-key", "camera-make", "camera-model", "can-comment", "can-read-revisions", "color-space", "copyable", "created-date", "date", "default-open-with-link", "description", "display-name", "domain", "download-url", "duration-millis", "editable", "email-address", "embed-link", "etag", "expiration-date", "explicitly-trashed", "export-links", "exposure-bias", "exposure-mode", "exposure-time", "file-extension", "file-size", "flash-used", "focal-length", "folder-color-rgb", "full-file-extension", "head-revision-id", "height", "hidden", "icon-link", "id", "image", "image-media-metadata", "indexable-text", "is-app-authorized", "is-authenticated-user", "iso-speed", "kind", "labels", "last-modifying-user", "last-modifying-user-name", "last-viewed-by-me-date", "latitude", "lens", "location", "longitude", "marked-viewed-by-me-date", "max-aperture-value", "md5-checksum", "metering-mode", "mime-type", "modified-by-me-date", "modified-date", "name", "open-with-links", "original-filename", "owned-by-me", "owner-names", "permission-id", "photo-link", "picture", "quota-bytes-used", "restricted", "role", "rotation", "self-link", "sensor", "shareable", "shared", "shared-with-me-date", "sharing-user", "spaces", "starred", "subject-distance", "text", "thumbnail", "thumbnail-link", "title", "trashed", "type", "url", "user-permission", "value", "version", "video-media-metadata", "viewed", "web-content-link", "web-view-link", "white-balance", "width", "with-link", "writers-can-share"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["additional-roles", "alternate-link", "altitude", "aperture", "app-data-contents", "auth-key", "camera-make", "camera-model", "can-comment", "can-read-revisions", "color-space", "copyable", "created-date", "date", "default-open-with-link", "description", "display-name", "domain", "download-url", "duration-millis", "editable", "email-address", "embed-link", "etag", "expiration-date", "explicitly-trashed", "export-links", "exposure-bias", "exposure-mode", "exposure-time", "file-extension", "file-size", "flash-used", "focal-length", "folder-color-rgb", "full-file-extension", "has-thumbnail", "head-revision-id", "height", "hidden", "icon-link", "id", "image", "image-media-metadata", "indexable-text", "is-app-authorized", "is-authenticated-user", "iso-speed", "kind", "labels", "last-modifying-user", "last-modifying-user-name", "last-viewed-by-me-date", "latitude", "lens", "location", "longitude", "marked-viewed-by-me-date", "max-aperture-value", "md5-checksum", "metering-mode", "mime-type", "modified", "modified-by-me-date", "modified-date", "name", "open-with-links", "original-filename", "owned-by-me", "owner-names", "permission-id", "photo-link", "picture", "quota-bytes-used", "restricted", "role", "rotation", "self-link", "sensor", "shareable", "shared", "shared-with-me-date", "sharing-user", "spaces", "starred", "subject-distance", "text", "thumbnail", "thumbnail-link", "thumbnail-version", "title", "trashed", "type", "url", "user-permission", "value", "version", "video-media-metadata", "viewed", "web-content-link", "web-view-link", "white-balance", "width", "with-link", "writers-can-share"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1783,16 +1786,18 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { + "has-thumbnail" => Some(("hasThumbnail", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "mime-type" => Some(("mimeType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "last-viewed-by-me-date" => Some(("lastViewedByMeDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "app-data-contents" => Some(("appDataContents", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "thumbnail-link" => Some(("thumbnailLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "labels.restricted" => Some(("labels.restricted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "labels.hidden" => Some(("labels.hidden", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "labels.modified" => Some(("labels.modified", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "labels.viewed" => Some(("labels.viewed", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "labels.starred" => Some(("labels.starred", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "labels.hidden" => Some(("labels.hidden", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "labels.trashed" => Some(("labels.trashed", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "indexable-text.text" => Some(("indexableText.text", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "thumbnail-version" => Some(("thumbnailVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "explicitly-trashed" => Some(("explicitlyTrashed", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "is-app-authorized" => Some(("isAppAuthorized", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "last-modifying-user-name" => Some(("lastModifyingUserName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1857,6 +1862,7 @@ impl<'n> Engine<'n> { "quota-bytes-used" => Some(("quotaBytesUsed", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "embed-link" => Some(("embedLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "created-date" => Some(("createdDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-viewed-by-me-date" => Some(("lastViewedByMeDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "md5-checksum" => Some(("md5Checksum", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "icon-link" => Some(("iconLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "default-open-with-link" => Some(("defaultOpenWithLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1891,7 +1897,7 @@ impl<'n> Engine<'n> { "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "modified-date" => Some(("modifiedDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["additional-roles", "alternate-link", "altitude", "aperture", "app-data-contents", "auth-key", "camera-make", "camera-model", "can-comment", "can-read-revisions", "color-space", "copyable", "created-date", "date", "default-open-with-link", "description", "display-name", "domain", "download-url", "duration-millis", "editable", "email-address", "embed-link", "etag", "expiration-date", "explicitly-trashed", "export-links", "exposure-bias", "exposure-mode", "exposure-time", "file-extension", "file-size", "flash-used", "focal-length", "folder-color-rgb", "full-file-extension", "head-revision-id", "height", "hidden", "icon-link", "id", "image", "image-media-metadata", "indexable-text", "is-app-authorized", "is-authenticated-user", "iso-speed", "kind", "labels", "last-modifying-user", "last-modifying-user-name", "last-viewed-by-me-date", "latitude", "lens", "location", "longitude", "marked-viewed-by-me-date", "max-aperture-value", "md5-checksum", "metering-mode", "mime-type", "modified-by-me-date", "modified-date", "name", "open-with-links", "original-filename", "owned-by-me", "owner-names", "permission-id", "photo-link", "picture", "quota-bytes-used", "restricted", "role", "rotation", "self-link", "sensor", "shareable", "shared", "shared-with-me-date", "sharing-user", "spaces", "starred", "subject-distance", "text", "thumbnail", "thumbnail-link", "title", "trashed", "type", "url", "user-permission", "value", "version", "video-media-metadata", "viewed", "web-content-link", "web-view-link", "white-balance", "width", "with-link", "writers-can-share"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["additional-roles", "alternate-link", "altitude", "aperture", "app-data-contents", "auth-key", "camera-make", "camera-model", "can-comment", "can-read-revisions", "color-space", "copyable", "created-date", "date", "default-open-with-link", "description", "display-name", "domain", "download-url", "duration-millis", "editable", "email-address", "embed-link", "etag", "expiration-date", "explicitly-trashed", "export-links", "exposure-bias", "exposure-mode", "exposure-time", "file-extension", "file-size", "flash-used", "focal-length", "folder-color-rgb", "full-file-extension", "has-thumbnail", "head-revision-id", "height", "hidden", "icon-link", "id", "image", "image-media-metadata", "indexable-text", "is-app-authorized", "is-authenticated-user", "iso-speed", "kind", "labels", "last-modifying-user", "last-modifying-user-name", "last-viewed-by-me-date", "latitude", "lens", "location", "longitude", "marked-viewed-by-me-date", "max-aperture-value", "md5-checksum", "metering-mode", "mime-type", "modified", "modified-by-me-date", "modified-date", "name", "open-with-links", "original-filename", "owned-by-me", "owner-names", "permission-id", "photo-link", "picture", "quota-bytes-used", "restricted", "role", "rotation", "self-link", "sensor", "shareable", "shared", "shared-with-me-date", "sharing-user", "spaces", "starred", "subject-distance", "text", "thumbnail", "thumbnail-link", "thumbnail-version", "title", "trashed", "type", "url", "user-permission", "value", "version", "video-media-metadata", "viewed", "web-content-link", "web-view-link", "white-balance", "width", "with-link", "writers-can-share"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -2077,16 +2083,18 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { + "has-thumbnail" => Some(("hasThumbnail", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "mime-type" => Some(("mimeType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "last-viewed-by-me-date" => Some(("lastViewedByMeDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "app-data-contents" => Some(("appDataContents", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "thumbnail-link" => Some(("thumbnailLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "labels.restricted" => Some(("labels.restricted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "labels.hidden" => Some(("labels.hidden", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "labels.modified" => Some(("labels.modified", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "labels.viewed" => Some(("labels.viewed", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "labels.starred" => Some(("labels.starred", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "labels.hidden" => Some(("labels.hidden", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "labels.trashed" => Some(("labels.trashed", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "indexable-text.text" => Some(("indexableText.text", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "thumbnail-version" => Some(("thumbnailVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "explicitly-trashed" => Some(("explicitlyTrashed", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "is-app-authorized" => Some(("isAppAuthorized", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "last-modifying-user-name" => Some(("lastModifyingUserName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2151,6 +2159,7 @@ impl<'n> Engine<'n> { "quota-bytes-used" => Some(("quotaBytesUsed", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "embed-link" => Some(("embedLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "created-date" => Some(("createdDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-viewed-by-me-date" => Some(("lastViewedByMeDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "md5-checksum" => Some(("md5Checksum", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "icon-link" => Some(("iconLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "default-open-with-link" => Some(("defaultOpenWithLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2185,7 +2194,7 @@ impl<'n> Engine<'n> { "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "modified-date" => Some(("modifiedDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["additional-roles", "alternate-link", "altitude", "aperture", "app-data-contents", "auth-key", "camera-make", "camera-model", "can-comment", "can-read-revisions", "color-space", "copyable", "created-date", "date", "default-open-with-link", "description", "display-name", "domain", "download-url", "duration-millis", "editable", "email-address", "embed-link", "etag", "expiration-date", "explicitly-trashed", "export-links", "exposure-bias", "exposure-mode", "exposure-time", "file-extension", "file-size", "flash-used", "focal-length", "folder-color-rgb", "full-file-extension", "head-revision-id", "height", "hidden", "icon-link", "id", "image", "image-media-metadata", "indexable-text", "is-app-authorized", "is-authenticated-user", "iso-speed", "kind", "labels", "last-modifying-user", "last-modifying-user-name", "last-viewed-by-me-date", "latitude", "lens", "location", "longitude", "marked-viewed-by-me-date", "max-aperture-value", "md5-checksum", "metering-mode", "mime-type", "modified-by-me-date", "modified-date", "name", "open-with-links", "original-filename", "owned-by-me", "owner-names", "permission-id", "photo-link", "picture", "quota-bytes-used", "restricted", "role", "rotation", "self-link", "sensor", "shareable", "shared", "shared-with-me-date", "sharing-user", "spaces", "starred", "subject-distance", "text", "thumbnail", "thumbnail-link", "title", "trashed", "type", "url", "user-permission", "value", "version", "video-media-metadata", "viewed", "web-content-link", "web-view-link", "white-balance", "width", "with-link", "writers-can-share"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["additional-roles", "alternate-link", "altitude", "aperture", "app-data-contents", "auth-key", "camera-make", "camera-model", "can-comment", "can-read-revisions", "color-space", "copyable", "created-date", "date", "default-open-with-link", "description", "display-name", "domain", "download-url", "duration-millis", "editable", "email-address", "embed-link", "etag", "expiration-date", "explicitly-trashed", "export-links", "exposure-bias", "exposure-mode", "exposure-time", "file-extension", "file-size", "flash-used", "focal-length", "folder-color-rgb", "full-file-extension", "has-thumbnail", "head-revision-id", "height", "hidden", "icon-link", "id", "image", "image-media-metadata", "indexable-text", "is-app-authorized", "is-authenticated-user", "iso-speed", "kind", "labels", "last-modifying-user", "last-modifying-user-name", "last-viewed-by-me-date", "latitude", "lens", "location", "longitude", "marked-viewed-by-me-date", "max-aperture-value", "md5-checksum", "metering-mode", "mime-type", "modified", "modified-by-me-date", "modified-date", "name", "open-with-links", "original-filename", "owned-by-me", "owner-names", "permission-id", "photo-link", "picture", "quota-bytes-used", "restricted", "role", "rotation", "self-link", "sensor", "shareable", "shared", "shared-with-me-date", "sharing-user", "spaces", "starred", "subject-distance", "text", "thumbnail", "thumbnail-link", "thumbnail-version", "title", "trashed", "type", "url", "user-permission", "value", "version", "video-media-metadata", "viewed", "web-content-link", "web-view-link", "white-balance", "width", "with-link", "writers-can-share"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -2464,16 +2473,18 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { + "has-thumbnail" => Some(("hasThumbnail", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "mime-type" => Some(("mimeType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "last-viewed-by-me-date" => Some(("lastViewedByMeDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "app-data-contents" => Some(("appDataContents", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "thumbnail-link" => Some(("thumbnailLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "labels.restricted" => Some(("labels.restricted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "labels.hidden" => Some(("labels.hidden", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "labels.modified" => Some(("labels.modified", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "labels.viewed" => Some(("labels.viewed", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "labels.starred" => Some(("labels.starred", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "labels.hidden" => Some(("labels.hidden", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "labels.trashed" => Some(("labels.trashed", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "indexable-text.text" => Some(("indexableText.text", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "thumbnail-version" => Some(("thumbnailVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "explicitly-trashed" => Some(("explicitlyTrashed", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "is-app-authorized" => Some(("isAppAuthorized", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "last-modifying-user-name" => Some(("lastModifyingUserName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2538,6 +2549,7 @@ impl<'n> Engine<'n> { "quota-bytes-used" => Some(("quotaBytesUsed", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "embed-link" => Some(("embedLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "created-date" => Some(("createdDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-viewed-by-me-date" => Some(("lastViewedByMeDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "md5-checksum" => Some(("md5Checksum", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "icon-link" => Some(("iconLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "default-open-with-link" => Some(("defaultOpenWithLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2572,7 +2584,7 @@ impl<'n> Engine<'n> { "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "modified-date" => Some(("modifiedDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["additional-roles", "alternate-link", "altitude", "aperture", "app-data-contents", "auth-key", "camera-make", "camera-model", "can-comment", "can-read-revisions", "color-space", "copyable", "created-date", "date", "default-open-with-link", "description", "display-name", "domain", "download-url", "duration-millis", "editable", "email-address", "embed-link", "etag", "expiration-date", "explicitly-trashed", "export-links", "exposure-bias", "exposure-mode", "exposure-time", "file-extension", "file-size", "flash-used", "focal-length", "folder-color-rgb", "full-file-extension", "head-revision-id", "height", "hidden", "icon-link", "id", "image", "image-media-metadata", "indexable-text", "is-app-authorized", "is-authenticated-user", "iso-speed", "kind", "labels", "last-modifying-user", "last-modifying-user-name", "last-viewed-by-me-date", "latitude", "lens", "location", "longitude", "marked-viewed-by-me-date", "max-aperture-value", "md5-checksum", "metering-mode", "mime-type", "modified-by-me-date", "modified-date", "name", "open-with-links", "original-filename", "owned-by-me", "owner-names", "permission-id", "photo-link", "picture", "quota-bytes-used", "restricted", "role", "rotation", "self-link", "sensor", "shareable", "shared", "shared-with-me-date", "sharing-user", "spaces", "starred", "subject-distance", "text", "thumbnail", "thumbnail-link", "title", "trashed", "type", "url", "user-permission", "value", "version", "video-media-metadata", "viewed", "web-content-link", "web-view-link", "white-balance", "width", "with-link", "writers-can-share"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["additional-roles", "alternate-link", "altitude", "aperture", "app-data-contents", "auth-key", "camera-make", "camera-model", "can-comment", "can-read-revisions", "color-space", "copyable", "created-date", "date", "default-open-with-link", "description", "display-name", "domain", "download-url", "duration-millis", "editable", "email-address", "embed-link", "etag", "expiration-date", "explicitly-trashed", "export-links", "exposure-bias", "exposure-mode", "exposure-time", "file-extension", "file-size", "flash-used", "focal-length", "folder-color-rgb", "full-file-extension", "has-thumbnail", "head-revision-id", "height", "hidden", "icon-link", "id", "image", "image-media-metadata", "indexable-text", "is-app-authorized", "is-authenticated-user", "iso-speed", "kind", "labels", "last-modifying-user", "last-modifying-user-name", "last-viewed-by-me-date", "latitude", "lens", "location", "longitude", "marked-viewed-by-me-date", "max-aperture-value", "md5-checksum", "metering-mode", "mime-type", "modified", "modified-by-me-date", "modified-date", "name", "open-with-links", "original-filename", "owned-by-me", "owner-names", "permission-id", "photo-link", "picture", "quota-bytes-used", "restricted", "role", "rotation", "self-link", "sensor", "shareable", "shared", "shared-with-me-date", "sharing-user", "spaces", "starred", "subject-distance", "text", "thumbnail", "thumbnail-link", "thumbnail-version", "title", "trashed", "type", "url", "user-permission", "value", "version", "video-media-metadata", "viewed", "web-content-link", "web-view-link", "white-balance", "width", "with-link", "writers-can-share"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -4652,6 +4664,12 @@ impl<'n> Engine<'n> { for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, _ => { let mut found = false; for param in &self.gp { @@ -4665,6 +4683,7 @@ impl<'n> Engine<'n> { err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "max-results"].iter().map(|v|*v)); v } )); } } @@ -6894,7 +6913,7 @@ fn main() { let mut app = App::new("drive2") .author("Sebastian Thiel ") - .version("1.0.0+20160901") + .version("1.0.0+20161212") .about("Manages files in Drive including uploading, downloading, searching, detecting changes, and updating sharing permissions.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_drive2_cli") .arg(Arg::with_name("url") diff --git a/gen/drive2/Cargo.toml b/gen/drive2/Cargo.toml index fdc7f051fc..66dca05568 100644 --- a/gen/drive2/Cargo.toml +++ b/gen/drive2/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-drive2" -version = "1.0.0+20160901" +version = "1.0.0+20161212" authors = ["Sebastian Thiel "] description = "A complete library to interact with drive (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/drive2" diff --git a/gen/drive2/README.md b/gen/drive2/README.md index 9e0c6691ea..19e1c1cf97 100644 --- a/gen/drive2/README.md +++ b/gen/drive2/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-drive2` library allows access to all features of the *Google drive* service. -This documentation was generated from *drive* crate version *1.0.0+20160901*, where *20160901* is the exact revision of the *drive:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *drive* crate version *1.0.0+20161212*, where *20161212* is the exact revision of the *drive:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *drive* *v2* API can be found at the [official documentation site](https://developers.google.com/drive/). diff --git a/gen/drive2/src/lib.rs b/gen/drive2/src/lib.rs index d23a8b0aa2..4d8153a848 100644 --- a/gen/drive2/src/lib.rs +++ b/gen/drive2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *drive* crate version *1.0.0+20160901*, where *20160901* is the exact revision of the *drive:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *drive* crate version *1.0.0+20161212*, where *20161212* is the exact revision of the *drive:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *drive* *v2* API can be found at the //! [official documentation site](https://developers.google.com/drive/). @@ -158,19 +158,19 @@ //! // execute the final call using `doit()`. //! // Values shown here are possibly random and not representative ! //! let result = hub.files().patch(req, "fileId") -//! .use_content_as_indexable_text(false) +//! .use_content_as_indexable_text(true) //! .update_viewed_date(true) -//! .timed_text_track_name("dolore") -//! .timed_text_language("Lorem") +//! .timed_text_track_name("consetetur") +//! .timed_text_language("consetetur") //! .set_modified_date(false) -//! .remove_parents("consetetur") +//! .remove_parents("labore") //! .pinned(false) -//! .ocr_language("labore") -//! .ocr(false) +//! .ocr_language("et") +//! .ocr(true) //! .new_revision(false) -//! .modified_date_behavior("sadipscing") +//! .modified_date_behavior("magna") //! .convert(false) -//! .add_parents("magna") +//! .add_parents("rebum.") //! .doit(); //! //! match result { diff --git a/gen/drive2/src/lib.rs.in b/gen/drive2/src/lib.rs.in index 21f1687aab..77aa9aee36 100644 --- a/gen/drive2/src/lib.rs.in +++ b/gen/drive2/src/lib.rs.in @@ -423,7 +423,7 @@ pub struct About { impl ResponseResult for About {} -/// Thumbnail for the file. Only accepted on upload and for files that are not already thumbnailed by Google. +/// A thumbnail for the file. This will only be used if Drive cannot generate a standard thumbnail. /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -464,16 +464,16 @@ impl Part for FileThumbnail {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct File { + /// Whether this file has a thumbnail. + #[serde(rename="hasThumbnail")] + pub has_thumbnail: Option, /// The MIME type of the file. This is only mutable on update when uploading new content. This field can be left blank, and the mimetype will be determined from the uploaded content's MIME type. #[serde(rename="mimeType")] pub mime_type: Option, - /// Last time this file was viewed by the user (formatted RFC 3339 timestamp). - #[serde(rename="lastViewedByMeDate")] - pub last_viewed_by_me_date: Option, /// Whether this file is in the Application Data folder. #[serde(rename="appDataContents")] pub app_data_contents: Option, - /// A short-lived link to the file's thumbnail. Typically lasts on the order of hours. + /// A short-lived link to the file's thumbnail. Typically lasts on the order of hours. Only populated when the requesting app can access the file's content. #[serde(rename="thumbnailLink")] pub thumbnail_link: Option, /// A group of labels for the file. @@ -481,6 +481,9 @@ pub struct File { /// Indexable text attributes for the file (can only be written) #[serde(rename="indexableText")] pub indexable_text: Option, + /// The thumbnail version for use in client-contructable thumbnail URLs or thumbnail cache invalidation. + #[serde(rename="thumbnailVersion")] + pub thumbnail_version: Option, /// Whether this file has been explicitly trashed, as opposed to recursively trashed. #[serde(rename="explicitlyTrashed")] pub explicitly_trashed: Option, @@ -573,6 +576,9 @@ pub struct File { /// Create time for this file (formatted RFC 3339 timestamp). #[serde(rename="createdDate")] pub created_date: Option, + /// Last time this file was viewed by the user (formatted RFC 3339 timestamp). + #[serde(rename="lastViewedByMeDate")] + pub last_viewed_by_me_date: Option, /// The list of properties. pub properties: Option>, /// An MD5 checksum for the content of this file. This field is only populated for files with content stored in Drive; it is not populated for Google Docs or shortcut files. @@ -595,7 +601,7 @@ pub struct File { /// Last time this file was modified by the user (formatted RFC 3339 timestamp). Note that setting modifiedDate will also update the modifiedByMe date for the user which set the date. #[serde(rename="modifiedByMeDate")] pub modified_by_me_date: Option, - /// Thumbnail for the file. Only accepted on upload and for files that are not already thumbnailed by Google. + /// A thumbnail for the file. This will only be used if Drive cannot generate a standard thumbnail. pub thumbnail: Option, /// no description provided #[serde(rename="downloadUrl")] @@ -839,6 +845,9 @@ impl Part for AboutImportFormats {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct RevisionList { + /// The page token for the next page of revisions. This field will be absent if the end of the revisions list has been reached. If the token is rejected for any reason, it should be discarded and pagination should be restarted from the first page of results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, /// The actual list of revisions. pub items: Option>, /// This is always drive#revisionList. @@ -876,16 +885,18 @@ impl Part for AboutMaxUploadSizes {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct FileLabels { - /// Whether viewers and commenters are prevented from downloading, printing, and copying this file. - pub restricted: Option, - /// Deprecated. - pub hidden: Option, - /// Whether this file has been trashed. This label applies to all users accessing the file; however, only owners are allowed to see and untrash files. - pub trashed: Option, /// Whether this file is starred by the user. pub starred: Option, /// Whether this file has been viewed by this user. pub viewed: Option, + /// Whether viewers and commenters are prevented from downloading, printing, and copying this file. + pub restricted: Option, + /// Deprecated. + pub hidden: Option, + /// Whether the file has been modified by this user. + pub modified: Option, + /// Whether this file has been trashed. This label applies to all users accessing the file; however, only owners are allowed to see and untrash files. + pub trashed: Option, } impl NestedType for FileLabels {} @@ -1121,7 +1132,7 @@ pub struct Permission { pub name: Option, /// This is always drive#permission. pub kind: Option, - /// The email address or domain name for the entity. This is used during inserts and is not populated in responses. When making a drive.permissions.insert request, exactly one of the id or value fields must be specified unless the permission type anyone, in which case both id and value are ignored. + /// The email address or domain name for the entity. This is used during inserts and is not populated in responses. When making a drive.permissions.insert request, exactly one of the id or value fields must be specified unless the permission type is anyone, in which case both id and value are ignored. pub value: Option, /// Additional roles for this user. Only commenter is currently allowed. #[serde(rename="additionalRoles")] @@ -1149,7 +1160,7 @@ pub struct Permission { /// - anyone #[serde(rename="type")] pub type_: Option, - /// The ID of the user this permission refers to, and identical to the permissionId in the About and Files resources. When making a drive.permissions.insert request, exactly one of the id or value fields must be specified unless the permission type anyone, in which case both id and value are ignored. + /// The ID of the user this permission refers to, and identical to the permissionId in the About and Files resources. When making a drive.permissions.insert request, exactly one of the id or value fields must be specified unless the permission type is anyone, in which case both id and value are ignored. pub id: Option, /// A link back to this permission. #[serde(rename="selfLink")] @@ -3446,6 +3457,8 @@ impl<'a, C, A> RevisionMethods<'a, C, A> { RevisionListCall { hub: self.hub, _file_id: file_id.to_string(), + _page_token: Default::default(), + _max_results: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -19830,6 +19843,8 @@ impl<'a, C, A> RevisionUpdateCall<'a, C, A> where C: BorrowMut, A /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.revisions().list("fileId") +/// .page_token("sed") +/// .max_results(-99) /// .doit(); /// # } /// ``` @@ -19838,6 +19853,8 @@ pub struct RevisionListCall<'a, C, A> hub: &'a Drive, _file_id: String, + _page_token: Option, + _max_results: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap @@ -19859,9 +19876,15 @@ impl<'a, C, A> RevisionListCall<'a, C, A> where C: BorrowMut, A: }; dlg.begin(MethodInfo { id: "drive.revisions.list", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); - for &field in ["alt", "fileId"].iter() { + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + for &field in ["alt", "fileId", "pageToken", "maxResults"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -19986,6 +20009,20 @@ impl<'a, C, A> RevisionListCall<'a, C, A> where C: BorrowMut, A: self._file_id = new_value.to_string(); self } + /// Page token for revisions. To get the next page of results, set this parameter to the value of "nextPageToken" from the previous response. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> RevisionListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of revisions to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> RevisionListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// diff --git a/gen/drive3-cli/Cargo.toml b/gen/drive3-cli/Cargo.toml index 333b8345b9..fd739e2134 100644 --- a/gen/drive3-cli/Cargo.toml +++ b/gen/drive3-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-drive3-cli" -version = "1.0.0+20160901" +version = "1.0.0+20161212" authors = ["Sebastian Thiel "] description = "A complete library to interact with drive (protocol v3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/drive3-cli" diff --git a/gen/drive3-cli/README.md b/gen/drive3-cli/README.md index d85daa18ad..c476eeed97 100644 --- a/gen/drive3-cli/README.md +++ b/gen/drive3-cli/README.md @@ -24,7 +24,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *drive* API at revision *20160901*. The CLI is at version *1.0.0*. +This documentation was generated from the *drive* API at revision *20161212*. The CLI is at version *1.0.0*. ```bash drive3 [options] diff --git a/gen/drive3-cli/mkdocs.yml b/gen/drive3-cli/mkdocs.yml index 48e38aa999..8324b70209 100644 --- a/gen/drive3-cli/mkdocs.yml +++ b/gen/drive3-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: drive v1.0.0+20160901 +site_name: drive v1.0.0+20161212 site_url: http://byron.github.io/google-apis-rs/google-drive3-cli site_description: Write integrating applications with bcore diff --git a/gen/drive3-cli/src/main.rs b/gen/drive3-cli/src/main.rs index fea6fa7fc6..08afdc8f4e 100644 --- a/gen/drive3-cli/src/main.rs +++ b/gen/drive3-cli/src/main.rs @@ -797,9 +797,11 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { + "has-thumbnail" => Some(("hasThumbnail", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "mime-type" => Some(("mimeType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "modified-by-me-time" => Some(("modifiedByMeTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "thumbnail-link" => Some(("thumbnailLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "thumbnail-version" => Some(("thumbnailVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "explicitly-trashed" => Some(("explicitlyTrashed", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "is-app-authorized" => Some(("isAppAuthorized", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "writers-can-share" => Some(("writersCanShare", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -840,6 +842,7 @@ impl<'n> Engine<'n> { "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "modified-time" => Some(("modifiedTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "viewed-by-me" => Some(("viewedByMe", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "modified-by-me" => Some(("modifiedByMe", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "quota-bytes-used" => Some(("quotaBytesUsed", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "file-extension" => Some(("fileExtension", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "properties" => Some(("properties", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), @@ -880,7 +883,7 @@ impl<'n> Engine<'n> { "starred" => Some(("starred", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "head-revision-id" => Some(("headRevisionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["altitude", "aperture", "app-properties", "camera-make", "camera-model", "can-comment", "can-copy", "can-edit", "can-read-revisions", "can-share", "capabilities", "color-space", "content-hints", "created-time", "description", "display-name", "duration-millis", "email-address", "explicitly-trashed", "exposure-bias", "exposure-mode", "exposure-time", "file-extension", "flash-used", "focal-length", "folder-color-rgb", "full-file-extension", "head-revision-id", "height", "icon-link", "id", "image", "image-media-metadata", "indexable-text", "is-app-authorized", "iso-speed", "kind", "last-modifying-user", "latitude", "lens", "location", "longitude", "max-aperture-value", "md5-checksum", "me", "metering-mode", "mime-type", "modified-by-me-time", "modified-time", "name", "original-filename", "owned-by-me", "parents", "permission-id", "photo-link", "properties", "quota-bytes-used", "rotation", "sensor", "shared", "shared-with-me-time", "sharing-user", "size", "spaces", "starred", "subject-distance", "thumbnail", "thumbnail-link", "time", "trashed", "version", "video-media-metadata", "viewed-by-me", "viewed-by-me-time", "viewers-can-copy-content", "web-content-link", "web-view-link", "white-balance", "width", "writers-can-share"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["altitude", "aperture", "app-properties", "camera-make", "camera-model", "can-comment", "can-copy", "can-edit", "can-read-revisions", "can-share", "capabilities", "color-space", "content-hints", "created-time", "description", "display-name", "duration-millis", "email-address", "explicitly-trashed", "exposure-bias", "exposure-mode", "exposure-time", "file-extension", "flash-used", "focal-length", "folder-color-rgb", "full-file-extension", "has-thumbnail", "head-revision-id", "height", "icon-link", "id", "image", "image-media-metadata", "indexable-text", "is-app-authorized", "iso-speed", "kind", "last-modifying-user", "latitude", "lens", "location", "longitude", "max-aperture-value", "md5-checksum", "me", "metering-mode", "mime-type", "modified-by-me", "modified-by-me-time", "modified-time", "name", "original-filename", "owned-by-me", "parents", "permission-id", "photo-link", "properties", "quota-bytes-used", "rotation", "sensor", "shared", "shared-with-me-time", "sharing-user", "size", "spaces", "starred", "subject-distance", "thumbnail", "thumbnail-link", "thumbnail-version", "time", "trashed", "version", "video-media-metadata", "viewed-by-me", "viewed-by-me-time", "viewers-can-copy-content", "web-content-link", "web-view-link", "white-balance", "width", "writers-can-share"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -973,9 +976,11 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { + "has-thumbnail" => Some(("hasThumbnail", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "mime-type" => Some(("mimeType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "modified-by-me-time" => Some(("modifiedByMeTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "thumbnail-link" => Some(("thumbnailLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "thumbnail-version" => Some(("thumbnailVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "explicitly-trashed" => Some(("explicitlyTrashed", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "is-app-authorized" => Some(("isAppAuthorized", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "writers-can-share" => Some(("writersCanShare", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -1016,6 +1021,7 @@ impl<'n> Engine<'n> { "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "modified-time" => Some(("modifiedTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "viewed-by-me" => Some(("viewedByMe", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "modified-by-me" => Some(("modifiedByMe", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "quota-bytes-used" => Some(("quotaBytesUsed", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "file-extension" => Some(("fileExtension", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "properties" => Some(("properties", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), @@ -1056,7 +1062,7 @@ impl<'n> Engine<'n> { "starred" => Some(("starred", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "head-revision-id" => Some(("headRevisionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["altitude", "aperture", "app-properties", "camera-make", "camera-model", "can-comment", "can-copy", "can-edit", "can-read-revisions", "can-share", "capabilities", "color-space", "content-hints", "created-time", "description", "display-name", "duration-millis", "email-address", "explicitly-trashed", "exposure-bias", "exposure-mode", "exposure-time", "file-extension", "flash-used", "focal-length", "folder-color-rgb", "full-file-extension", "head-revision-id", "height", "icon-link", "id", "image", "image-media-metadata", "indexable-text", "is-app-authorized", "iso-speed", "kind", "last-modifying-user", "latitude", "lens", "location", "longitude", "max-aperture-value", "md5-checksum", "me", "metering-mode", "mime-type", "modified-by-me-time", "modified-time", "name", "original-filename", "owned-by-me", "parents", "permission-id", "photo-link", "properties", "quota-bytes-used", "rotation", "sensor", "shared", "shared-with-me-time", "sharing-user", "size", "spaces", "starred", "subject-distance", "thumbnail", "thumbnail-link", "time", "trashed", "version", "video-media-metadata", "viewed-by-me", "viewed-by-me-time", "viewers-can-copy-content", "web-content-link", "web-view-link", "white-balance", "width", "writers-can-share"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["altitude", "aperture", "app-properties", "camera-make", "camera-model", "can-comment", "can-copy", "can-edit", "can-read-revisions", "can-share", "capabilities", "color-space", "content-hints", "created-time", "description", "display-name", "duration-millis", "email-address", "explicitly-trashed", "exposure-bias", "exposure-mode", "exposure-time", "file-extension", "flash-used", "focal-length", "folder-color-rgb", "full-file-extension", "has-thumbnail", "head-revision-id", "height", "icon-link", "id", "image", "image-media-metadata", "indexable-text", "is-app-authorized", "iso-speed", "kind", "last-modifying-user", "latitude", "lens", "location", "longitude", "max-aperture-value", "md5-checksum", "me", "metering-mode", "mime-type", "modified-by-me", "modified-by-me-time", "modified-time", "name", "original-filename", "owned-by-me", "parents", "permission-id", "photo-link", "properties", "quota-bytes-used", "rotation", "sensor", "shared", "shared-with-me-time", "sharing-user", "size", "spaces", "starred", "subject-distance", "thumbnail", "thumbnail-link", "thumbnail-version", "time", "trashed", "version", "video-media-metadata", "viewed-by-me", "viewed-by-me-time", "viewers-can-copy-content", "web-content-link", "web-view-link", "white-balance", "width", "writers-can-share"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1496,9 +1502,11 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { + "has-thumbnail" => Some(("hasThumbnail", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "mime-type" => Some(("mimeType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "modified-by-me-time" => Some(("modifiedByMeTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "thumbnail-link" => Some(("thumbnailLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "thumbnail-version" => Some(("thumbnailVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "explicitly-trashed" => Some(("explicitlyTrashed", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "is-app-authorized" => Some(("isAppAuthorized", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "writers-can-share" => Some(("writersCanShare", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -1539,6 +1547,7 @@ impl<'n> Engine<'n> { "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "modified-time" => Some(("modifiedTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "viewed-by-me" => Some(("viewedByMe", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "modified-by-me" => Some(("modifiedByMe", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "quota-bytes-used" => Some(("quotaBytesUsed", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "file-extension" => Some(("fileExtension", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "properties" => Some(("properties", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), @@ -1579,7 +1588,7 @@ impl<'n> Engine<'n> { "starred" => Some(("starred", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "head-revision-id" => Some(("headRevisionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["altitude", "aperture", "app-properties", "camera-make", "camera-model", "can-comment", "can-copy", "can-edit", "can-read-revisions", "can-share", "capabilities", "color-space", "content-hints", "created-time", "description", "display-name", "duration-millis", "email-address", "explicitly-trashed", "exposure-bias", "exposure-mode", "exposure-time", "file-extension", "flash-used", "focal-length", "folder-color-rgb", "full-file-extension", "head-revision-id", "height", "icon-link", "id", "image", "image-media-metadata", "indexable-text", "is-app-authorized", "iso-speed", "kind", "last-modifying-user", "latitude", "lens", "location", "longitude", "max-aperture-value", "md5-checksum", "me", "metering-mode", "mime-type", "modified-by-me-time", "modified-time", "name", "original-filename", "owned-by-me", "parents", "permission-id", "photo-link", "properties", "quota-bytes-used", "rotation", "sensor", "shared", "shared-with-me-time", "sharing-user", "size", "spaces", "starred", "subject-distance", "thumbnail", "thumbnail-link", "time", "trashed", "version", "video-media-metadata", "viewed-by-me", "viewed-by-me-time", "viewers-can-copy-content", "web-content-link", "web-view-link", "white-balance", "width", "writers-can-share"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["altitude", "aperture", "app-properties", "camera-make", "camera-model", "can-comment", "can-copy", "can-edit", "can-read-revisions", "can-share", "capabilities", "color-space", "content-hints", "created-time", "description", "display-name", "duration-millis", "email-address", "explicitly-trashed", "exposure-bias", "exposure-mode", "exposure-time", "file-extension", "flash-used", "focal-length", "folder-color-rgb", "full-file-extension", "has-thumbnail", "head-revision-id", "height", "icon-link", "id", "image", "image-media-metadata", "indexable-text", "is-app-authorized", "iso-speed", "kind", "last-modifying-user", "latitude", "lens", "location", "longitude", "max-aperture-value", "md5-checksum", "me", "metering-mode", "mime-type", "modified-by-me", "modified-by-me-time", "modified-time", "name", "original-filename", "owned-by-me", "parents", "permission-id", "photo-link", "properties", "quota-bytes-used", "rotation", "sensor", "shared", "shared-with-me-time", "sharing-user", "size", "spaces", "starred", "subject-distance", "thumbnail", "thumbnail-link", "thumbnail-version", "time", "trashed", "version", "video-media-metadata", "viewed-by-me", "viewed-by-me-time", "viewers-can-copy-content", "web-content-link", "web-view-link", "white-balance", "width", "writers-can-share"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -2592,6 +2601,12 @@ impl<'n> Engine<'n> { for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, _ => { let mut found = false; for param in &self.gp { @@ -2605,6 +2620,7 @@ impl<'n> Engine<'n> { err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size"].iter().map(|v|*v)); v } )); } } @@ -3883,7 +3899,7 @@ fn main() { let mut app = App::new("drive3") .author("Sebastian Thiel ") - .version("1.0.0+20160901") + .version("1.0.0+20161212") .about("Manages files in Drive including uploading, downloading, searching, detecting changes, and updating sharing permissions.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_drive3_cli") .arg(Arg::with_name("url") diff --git a/gen/drive3/Cargo.toml b/gen/drive3/Cargo.toml index 56c2164167..3f5c67c174 100644 --- a/gen/drive3/Cargo.toml +++ b/gen/drive3/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-drive3" -version = "1.0.0+20160901" +version = "1.0.0+20161212" authors = ["Sebastian Thiel "] description = "A complete library to interact with drive (protocol v3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/drive3" diff --git a/gen/drive3/README.md b/gen/drive3/README.md index 7dcb9e82d1..f992dd02de 100644 --- a/gen/drive3/README.md +++ b/gen/drive3/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-drive3` library allows access to all features of the *Google drive* service. -This documentation was generated from *drive* crate version *1.0.0+20160901*, where *20160901* is the exact revision of the *drive:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *drive* crate version *1.0.0+20161212*, where *20161212* is the exact revision of the *drive:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *drive* *v3* API can be found at the [official documentation site](https://developers.google.com/drive/). diff --git a/gen/drive3/src/lib.rs b/gen/drive3/src/lib.rs index 727d7b8d77..b777832e8c 100644 --- a/gen/drive3/src/lib.rs +++ b/gen/drive3/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *drive* crate version *1.0.0+20160901*, where *20160901* is the exact revision of the *drive:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *drive* crate version *1.0.0+20161212*, where *20161212* is the exact revision of the *drive:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *drive* *v3* API can be found at the //! [official documentation site](https://developers.google.com/drive/). @@ -144,11 +144,11 @@ //! // execute the final call using `upload_resumable(...)`. //! // Values shown here are possibly random and not representative ! //! let result = hub.files().update(req, "fileId") -//! .use_content_as_indexable_text(false) -//! .remove_parents("eirmod") -//! .ocr_language("consetetur") -//! .keep_revision_forever(false) -//! .add_parents("sed") +//! .use_content_as_indexable_text(true) +//! .remove_parents("labore") +//! .ocr_language("sed") +//! .keep_revision_forever(true) +//! .add_parents("gubergren") //! .upload_resumable(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()); //! //! match result { diff --git a/gen/drive3/src/lib.rs.in b/gen/drive3/src/lib.rs.in index a5d516ac4c..64d0a392d2 100644 --- a/gen/drive3/src/lib.rs.in +++ b/gen/drive3/src/lib.rs.in @@ -467,6 +467,9 @@ impl Part for FileImageMediaMetadata {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct RevisionList { + /// The page token for the next page of revisions. This will be absent if the end of the revisions list has been reached. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, /// Identifies what kind of resource this is. Value: the fixed string "drive#revisionList". pub kind: Option, /// The full list of revisions. @@ -870,6 +873,9 @@ impl Part for User {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct File { + /// Whether this file has a thumbnail. + #[serde(rename="hasThumbnail")] + pub has_thumbnail: Option, /// The MIME type of the file. /// Drive will attempt to automatically detect an appropriate value from uploaded content if no value is provided. The value cannot be changed unless a new revision is uploaded. /// If a file is created with a Google Doc MIME type, the uploaded content will be imported if possible. The supported import formats are published in the About resource. @@ -878,9 +884,12 @@ pub struct File { /// The last time the file was modified by the user (RFC 3339 date-time). #[serde(rename="modifiedByMeTime")] pub modified_by_me_time: Option, - /// A short-lived link to the file's thumbnail, if available. Typically lasts on the order of hours. + /// A short-lived link to the file's thumbnail, if available. Typically lasts on the order of hours. Only populated when the requesting app can access the file's content. #[serde(rename="thumbnailLink")] pub thumbnail_link: Option, + /// The thumbnail version for use in client-contructable thumbnail URLs or thumbnail cache invalidation. + #[serde(rename="thumbnailVersion")] + pub thumbnail_version: Option, /// Whether the file has been explicitly trashed, as opposed to recursively trashed from a parent folder. #[serde(rename="explicitlyTrashed")] pub explicitly_trashed: Option, @@ -954,6 +963,9 @@ pub struct File { /// Whether the file has been viewed by this user. #[serde(rename="viewedByMe")] pub viewed_by_me: Option, + /// Whether the file has been modified by this user. + #[serde(rename="modifiedByMe")] + pub modified_by_me: Option, /// Identifies what kind of resource this is. Value: the fixed string "drive#file". pub kind: Option, /// The time at which the file was created (RFC 3339 date-time). @@ -1833,6 +1845,8 @@ impl<'a, C, A> RevisionMethods<'a, C, A> { RevisionListCall { hub: self.hub, _file_id: file_id.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -8881,6 +8895,8 @@ impl<'a, C, A> RevisionDeleteCall<'a, C, A> where C: BorrowMut, A /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.revisions().list("fileId") +/// .page_token("invidunt") +/// .page_size(-96) /// .doit(); /// # } /// ``` @@ -8889,6 +8905,8 @@ pub struct RevisionListCall<'a, C, A> hub: &'a Drive, _file_id: String, + _page_token: Option, + _page_size: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap @@ -8910,9 +8928,15 @@ impl<'a, C, A> RevisionListCall<'a, C, A> where C: BorrowMut, A: }; dlg.begin(MethodInfo { id: "drive.revisions.list", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); - for &field in ["alt", "fileId"].iter() { + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "fileId", "pageToken", "pageSize"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -9037,6 +9061,20 @@ impl<'a, C, A> RevisionListCall<'a, C, A> where C: BorrowMut, A: self._file_id = new_value.to_string(); self } + /// The token for continuing a previous list request on the next page. This should be set to the value of 'nextPageToken' from the previous response. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> RevisionListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The maximum number of revisions to return per page. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> RevisionListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// @@ -9324,10 +9362,10 @@ impl<'a, C, A> ChangeGetStartPageTokenCall<'a, C, A> where C: BorrowMut ChangeWatchCall<'a, C, A> where C: BorrowMut, A: o /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.changes().list("pageToken") -/// .spaces("et") -/// .restrict_to_my_drive(true) -/// .page_size(-45) -/// .include_removed(false) +/// .spaces("consetetur") +/// .restrict_to_my_drive(false) +/// .page_size(-40) +/// .include_removed(true) /// .doit(); /// # } /// ``` @@ -10351,7 +10389,7 @@ impl<'a, C, A> PermissionListCall<'a, C, A> where C: BorrowMut, A /// // Values shown here are possibly random and not representative ! /// let result = hub.permissions().update(req, "fileId", "permissionId") /// .transfer_ownership(false) -/// .remove_expiration(true) +/// .remove_expiration(false) /// .doit(); /// # } /// ``` @@ -10900,8 +10938,8 @@ impl<'a, C, A> PermissionGetCall<'a, C, A> where C: BorrowMut, A: /// // Values shown here are possibly random and not representative ! /// let result = hub.permissions().create(req, "fileId") /// .transfer_ownership(true) -/// .send_notification_email(true) -/// .email_message("sed") +/// .send_notification_email(false) +/// .email_message("sit") /// .doit(); /// # } /// ``` diff --git a/gen/firebasedynamiclinks1-cli/Cargo.toml b/gen/firebasedynamiclinks1-cli/Cargo.toml new file mode 100644 index 0000000000..4557b4ff82 --- /dev/null +++ b/gen/firebasedynamiclinks1-cli/Cargo.toml @@ -0,0 +1,43 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-firebasedynamiclinks1-cli" +version = "1.0.0+20161118" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Firebase Dynamic Links (protocol v1)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/firebasedynamiclinks1-cli" +homepage = "https://firebase.google.com/docs/dynamic-links/" +documentation = "http://byron.github.io/google-apis-rs/google_firebasedynamiclinks1_cli" +license = "MIT" +keywords = ["firebasedynamiclinks", "google", "cli"] + +[[bin]] +name = "firebasedynamiclinks1" + +[dependencies] +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.8" +serde_json = "^ 0.8" +yup-oauth2 = { version = "^ 1.0", optional = true, default-features = false } +serde_derive = { version = "^ 0.8", optional = true } +strsim = "^0.5" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-serde-codegen"] +nightly = ["serde_derive","yup-oauth2/nightly","google-firebasedynamiclinks1/nightly"] +with-serde-codegen = ["serde_codegen","yup-oauth2/with-serde-codegen","google-firebasedynamiclinks1/with-serde-codegen"] + +[build-dependencies] +serde_codegen = { version = "^ 0.8", optional = true } + + +[dependencies.google-firebasedynamiclinks1] +path = "../firebasedynamiclinks1" +version = "1.0.0" +optional = true +default-features = false diff --git a/gen/firebasedynamiclinks1-cli/LICENSE.md b/gen/firebasedynamiclinks1-cli/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/firebasedynamiclinks1-cli/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/firebasedynamiclinks1-cli/README.md b/gen/firebasedynamiclinks1-cli/README.md new file mode 100644 index 0000000000..5c0eaf6654 --- /dev/null +++ b/gen/firebasedynamiclinks1-cli/README.md @@ -0,0 +1,113 @@ + +The `firebasedynamiclinks1` command-line interface *(CLI)* allows to use most features of the *Google Firebase Dynamic Links* service from the comfort of your terminal. + +By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's +capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero. + +If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. + +Everything else about the *Firebase Dynamic Links* API can be found at the +[official documentation site](https://firebase.google.com/docs/dynamic-links/). + +# Downloads + +You can download the pre-compiled 64bit binaries for the following platforms: + +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/1.0.0/ubuntu/firebasedynamiclinks1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/1.0.0/osx/firebasedynamiclinks1.tar.gz) + +Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/firebasedynamiclinks1-cli). + +# Usage + +This documentation was generated from the *Firebase Dynamic Links* API at revision *20161118*. The CLI is at version *1.0.0*. + +```bash +firebasedynamiclinks1 [options] + short-links + create (-r )... [-p ]... [-o ] + firebasedynamiclinks1 --help + +Configuration: + [--scope ]... + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. + If unset, it defaults to the shortest scope url for a particular method. + --config-dir + A directory into which we will store our persistent data. Defaults to + a user-writable directory that we will create during the first invocation. + [default: ~/.google-service-cli] + --debug + Output all server communication to standard error. `tx` and `rx` are placed + into the same stream. + --debug-auth + Output all communication related to authentication to standard error. `tx` + and `rx` are placed into the same stream. + +``` + +# Configuration + +The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `firebasedynamiclinks1-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis. + +More information about the various kinds of persistent data are given in the following paragraphs. + +# Authentication + +Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the +set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*. + +If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a +method that is read-only, it will ask only for a read-only scope. +You may use the `--scope` flag to specify a scope directly. +All applicable scopes are documented in the respective method's CLI documentation. + +The first time a scope is used, the user is asked for permission. Follow the instructions given +by the CLI to grant permissions, or to decline. + +If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration +directory, e.g. `~/.google-service-cli/firebasedynamiclinks1-token-.json`. No manual management of these tokens +is necessary. + +To revoke granted authentication, please refer to the [official documentation][revoke-access]. + +# Application Secrets + +In order to allow any application to use Google services, it will need to be registered using the +[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it +one by one. Most APIs can be used for free and have a daily quota. + +To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI +comes with a default application secret that is configured accordingly. This also means that heavy usage +all around the world may deplete the daily quota. + +You can workaround this limitation by putting your own secrets file at this location: +`~/.google-service-cli/firebasedynamiclinks1-secret.json`, assuming that the required *firebasedynamiclinks* API +was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at +*APIs & auth -> Credentials -> Download JSON* and used as is. + +Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new]. + + +# Debugging + +Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know +what exactly led to a particular issue. This is done by allowing all client-server communication to be +output to standard error *as-is*. + +The `--debug` flag will print all client-server communication to standard error, whereas the `--debug-auth` flag +will cause all communication related to authentication to standard error. +If the `--debug` flag is set, error-results will be debug-printed, possibly yielding more information about the +issue at hand. + +You may consider redirecting standard error into a file for ease of use, e.g. `firebasedynamiclinks1 --debug [options] 2>debug.txt`. + + +[scopes]: https://developers.google.com/+/api/oauth#scopes +[revoke-access]: http://webapps.stackexchange.com/a/30849 +[google-dev-console]: https://console.developers.google.com/ +[google-project-new]: https://developers.google.com/console/help/new/ \ No newline at end of file diff --git a/gen/firebasedynamiclinks1-cli/mkdocs.yml b/gen/firebasedynamiclinks1-cli/mkdocs.yml new file mode 100644 index 0000000000..2fe386607a --- /dev/null +++ b/gen/firebasedynamiclinks1-cli/mkdocs.yml @@ -0,0 +1,17 @@ +site_name: Firebase Dynamic Links v1.0.0+20161118 +site_url: http://byron.github.io/google-apis-rs/google-firebasedynamiclinks1-cli +site_description: Write integrating applications with bcore + +repo_url: https://github.com/Byron/google-apis-rs/tree/master/gen/firebasedynamiclinks1-cli + +docs_dir: docs +site_dir: build_html + +pages: +- ['index.md', 'Home'] +- ['short-links_create.md', 'Short Links', 'Create'] + +theme: readthedocs + +copyright: Copyright © 2015-2016, `Sebastian Thiel` + diff --git a/gen/firebasedynamiclinks1-cli/src/cmn.rs b/gen/firebasedynamiclinks1-cli/src/cmn.rs new file mode 100644 index 0000000000..779c1dc086 --- /dev/null +++ b/gen/firebasedynamiclinks1-cli/src/cmn.rs @@ -0,0 +1,721 @@ +// COPY OF 'src/rust/cli/cmn.rs' +// DO NOT EDIT +use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token}; +use serde_json as json; +use serde_json::value::Value; +use mime::Mime; +use clap::{App, SubCommand}; +use strsim; + +use std::fs; +use std::env; +use std::io; +use std::fmt; +use std::path::{Path, PathBuf}; +use std::str::FromStr; +use std::string::ToString; +use std::io::{Write, Read, stdout}; + +use std::default::Default; + +const FIELD_SEP: char = '.'; + + +pub enum ComplexType { + Pod, + Vec, + Map, +} + + // Null, + // Bool(bool), + // I64(i64), + // U64(u64), + // F64(f64), + // String(String), + +pub enum JsonType { + Boolean, + Int, + Uint, + Float, + String, +} + +pub struct JsonTypeInfo { + pub jtype: JsonType, + pub ctype: ComplexType, +} + +// Based on @erickt user comment. Thanks for the idea ! +// Remove all keys whose values are null from given value (changed in place) +pub fn remove_json_null_values(value: &mut Value) { + match *value { + Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} + +fn did_you_mean<'a>(v: &str, possible_values: &[&'a str]) -> Option<&'a str> { + + let mut candidate: Option<(f64, &str)> = None; + for pv in possible_values { + let confidence = strsim::jaro_winkler(v, pv); + if confidence > 0.8 && (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { + candidate = Some((confidence, pv)); + } + } + match candidate { + None => None, + Some((_, candidate)) => Some(candidate), + } +} + +pub enum CallType { + Upload(UploadProtocol), + Standard, +} + +arg_enum!{ + pub enum UploadProtocol { + Simple, + Resumable + } +} + +impl AsRef for UploadProtocol { + fn as_ref(&self) -> &str { + match *self { + UploadProtocol::Simple => "simple", + UploadProtocol::Resumable => "resumable" + } + } +} + +impl AsRef for CallType { + fn as_ref(&self) -> &str { + match *self { + CallType::Upload(ref proto) => proto.as_ref(), + CallType::Standard => "standard-request" + } + } +} + +#[derive(Clone, Default)] +pub struct FieldCursor(Vec); + +impl ToString for FieldCursor { + fn to_string(&self) -> String { + self.0.join(".") + } +} + +impl From<&'static str> for FieldCursor { + fn from(value: &'static str) -> FieldCursor { + let mut res = FieldCursor::default(); + res.set(value).unwrap(); + res + } +} + +impl FieldCursor { + pub fn set(&mut self, value: &str) -> Result<(), CLIError> { + if value.len() == 0 { + return Err(CLIError::Field(FieldError::Empty)) + } + + let mut first_is_field_sep = false; + let mut char_count: usize = 0; + let mut last_c = FIELD_SEP; + let mut num_conscutive_field_seps = 0; + + let mut field = String::new(); + let mut fields = self.0.clone(); + + let push_field = |fs: &mut Vec, f: &mut String| { + if f.len() > 0 { + fs.push(f.clone()); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + char_count += 1; + + if c == FIELD_SEP { + if cid == 0 { + first_is_field_sep = true; + } + num_conscutive_field_seps += 1; + if cid > 0 && last_c == FIELD_SEP { + if fields.pop().is_none() { + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))) + } + } else { + push_field(&mut fields, &mut field); + } + } else { + num_conscutive_field_seps = 0; + if cid == 1 { + if first_is_field_sep { + fields.truncate(0); + } + } + field.push(c); + } + + last_c = c; + } + + push_field(&mut fields, &mut field); + + if char_count == 1 && first_is_field_sep { + fields.truncate(0); + } + if char_count > 1 && num_conscutive_field_seps == 1 { + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + } + + self.0 = fields; + Ok(()) + } + + pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { + if value.len() == 0 { + return None + } + + let mut last_c = FIELD_SEP; + + let mut field = String::new(); + let mut output = String::new(); + + let push_field = |fs: &mut String, f: &mut String| { + if f.len() > 0 { + fs.push_str( + match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + if c == FIELD_SEP { + if last_c != FIELD_SEP { + push_field(&mut output, &mut field); + } + output.push(c); + } else { + field.push(c); + } + + last_c = c; + } + + push_field(&mut output, &mut field); + + if &output == value { + None + } else { + Some(output) + } + } + + pub fn set_json_value(&self, mut object: &mut Value, + value: &str, type_info: JsonTypeInfo, + err: &mut InvalidOptionsError, + orig_cursor: &FieldCursor) { + assert!(self.0.len() > 0); + + for field in &self.0[..self.0.len()-1] { + let tmp = object; + object = + match *tmp { + Value::Object(ref mut mapping) => { + mapping.entry(field.to_owned()).or_insert( + Value::Object(Default::default()) + ) + }, + _ => panic!("We don't expect non-object Values here ...") + }; + } + + match *object { + Value::Object(ref mut mapping) => { + let field = &self.0[self.0.len()-1]; + let to_jval = + |value: &str, jtype: JsonType, err: &mut InvalidOptionsError| + -> Value { + match jtype { + JsonType::Boolean => + Value::Bool(arg_from_str(value, err, &field, "boolean")), + JsonType::Int => + Value::I64(arg_from_str(value, err, &field, "int")), + JsonType::Uint => + Value::U64(arg_from_str(value, err, &field, "uint")), + JsonType::Float => + Value::F64(arg_from_str(value, err, &field, "float")), + JsonType::String => + Value::String(value.to_owned()), + } + }; + + match type_info.ctype { + ComplexType::Pod => { + if mapping.insert(field.to_owned(), to_jval(value, type_info.jtype, err)).is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + }, + ComplexType::Vec => { + match *mapping.entry(field.to_owned()) + .or_insert(Value::Array(Default::default())) { + Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), + _ => unreachable!() + } + }, + ComplexType::Map => { + let (key, value) = parse_kv_arg(value, err, true); + let jval = to_jval(value.unwrap_or(""), type_info.jtype, err); + + match *mapping.entry(field.to_owned()) + .or_insert(Value::Object(Default::default())) { + Value::Object(ref mut value_map) => { + if value_map.insert(key.to_owned(), jval).is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + _ => unreachable!() + } + } + } + }, + _ => unreachable!() + } + } + + pub fn num_fields(&self) -> usize { + self.0.len() + } +} + +pub fn parse_kv_arg<'a>(kv: &'a str, err: &mut InvalidOptionsError, for_hashmap: bool) + -> (&'a str, Option<&'a str>) { + let mut add_err = || err.issues.push(CLIError::InvalidKeyValueSyntax(kv.to_string(),for_hashmap)); + match kv.find('=') { + None => { + add_err(); + return (kv, None) + }, + Some(pos) => { + let key = &kv[..pos]; + if kv.len() <= pos + 1 { + add_err(); + return (key, Some("")) + } + (key, Some(&kv[pos+1..])) + } + } +} + +pub fn calltype_from_str(name: &str, valid_protocols: Vec, err: &mut InvalidOptionsError) -> CallType { + CallType::Upload( + match UploadProtocol::from_str(name) { + Ok(up) => up, + Err(msg) => { + err.issues.push(CLIError::InvalidUploadProtocol(name.to_string(), valid_protocols)); + UploadProtocol::Simple + } + }) +} + +pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> Option { + match fs::File::open(file_path) { + Ok(f) => Some(f), + Err(io_err) => { + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); + None + } + } +} + +pub fn input_mime_from_opts(mime: &str, err: &mut InvalidOptionsError) -> Option { + match mime.parse() { + Ok(m) => Some(m), + Err(_) => { + err.issues.push(CLIError::Input(InputError::Mime(mime.to_string()))); + None + } + } +} + +pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { + let f = arg.unwrap_or("-"); + match f { + "-" => Ok(Box::new(stdout())), + _ => match fs::OpenOptions::new().create(true).write(true).open(f) { + Ok(f) => Ok(Box::new(f)), + Err(io_err) => Err(io_err), + } + } +} + + +pub fn arg_from_str<'a, T>(arg: &str, err: &mut InvalidOptionsError, + arg_name: &'a str, + arg_type: &'a str) -> T + where T: FromStr + Default, + ::Err: fmt::Display { + match FromStr::from_str(arg) { + Err(perr) => { + err.issues.push( + CLIError::ParseError(arg_name.to_owned(), arg_type.to_owned(), arg.to_string(), format!("{}", perr)) + ); + Default::default() + }, + Ok(v) => v, + } +} + +pub struct JsonTokenStorage { + pub program_name: &'static str, + pub db_dir: String, +} + +impl JsonTokenStorage { + fn path(&self, scope_hash: u64) -> PathBuf { + Path::new(&self.db_dir).join(&format!("{}-token-{}.json", self.program_name, scope_hash)) + } +} + +impl TokenStorage for JsonTokenStorage { + type Error = json::Error; + + // NOTE: logging might be interesting, currently we swallow all errors + fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), json::Error> { + match token { + None => { + match fs::remove_file(self.path(scope_hash)) { + Err(err) => + match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(json::Error::Io(err)) + }, + Ok(_) => Ok(()), + } + } + Some(token) => { + match fs::OpenOptions::new().create(true).write(true).open(&self.path(scope_hash)) { + Ok(mut f) => { + match json::to_writer_pretty(&mut f, &token) { + Ok(_) => Ok(()), + Err(serde_err) => Err(serde_err), + } + }, + Err(io_err) => Err(json::Error::Io(io_err)) + } + } + } + } + + fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result, json::Error> { + match fs::File::open(&self.path(scope_hash)) { + Ok(f) => { + match json::de::from_reader(f) { + Ok(token) => Ok(Some(token)), + Err(err) => Err(err), + } + }, + Err(io_err) => { + match io_err.kind() { + io::ErrorKind::NotFound => Ok(None), + _ => Err(json::Error::Io(io_err)) + } + } + } + } +} + + +#[derive(Debug)] +pub enum ApplicationSecretError { + DecoderError((String, json::Error)), + FormatError(String), +} + +impl fmt::Display for ApplicationSecretError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ApplicationSecretError::DecoderError((ref path, ref err)) + => writeln!(f, "Could not decode file at '{}' with error: {}.", + path, err), + ApplicationSecretError::FormatError(ref path) + => writeln!(f, "'installed' field is unset in secret file at '{}'.", + path), + } + } +} + +#[derive(Debug)] +pub enum ConfigurationError { + DirectoryCreationFailed((String, io::Error)), + DirectoryUnset, + HomeExpansionFailed(String), + Secret(ApplicationSecretError), + Io((String, io::Error)), +} + +impl fmt::Display for ConfigurationError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ConfigurationError::DirectoryCreationFailed((ref dir, ref err)) + => writeln!(f, "Directory '{}' could not be created with error: {}.", dir, err), + ConfigurationError::DirectoryUnset + => writeln!(f, "--config-dir was unset or empty."), + ConfigurationError::HomeExpansionFailed(ref dir) + => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), + ConfigurationError::Secret(ref err) + => writeln!(f, "Secret -> {}", err), + ConfigurationError::Io((ref path, ref err)) + => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + } + } +} + +#[derive(Debug)] +pub enum InputError { + Io((String, io::Error)), + Mime(String), +} + +impl fmt::Display for InputError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + InputError::Io((ref file_path, ref io_err)) + => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), + InputError::Mime(ref mime) + => writeln!(f, "'{}' is not a known mime-type.", mime), + } + } +} + +#[derive(Debug)] +pub enum FieldError { + PopOnEmpty(String), + TrailingFieldSep(String), + Unknown(String, Option, Option), + Duplicate(String), + Empty, +} + + +impl fmt::Display for FieldError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + FieldError::PopOnEmpty(ref field) + => writeln!(f, "'{}': Cannot move up on empty field cursor.", field), + FieldError::TrailingFieldSep(ref field) + => writeln!(f, "'{}': Single field separator may not be last character.", field), + FieldError::Unknown(ref field, ref suggestion, ref value) => { + let suffix = + match *suggestion { + Some(ref s) => { + let kv = + match *value { + Some(ref v) => format!("{}={}", s, v), + None => s.clone(), + }; + format!(" Did you mean '{}' ?", kv) + }, + None => String::new(), + }; + writeln!(f, "Field '{}' does not exist.{}", field, suffix) + }, + FieldError::Duplicate(ref cursor) + => writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty + => writeln!(f, "Field names must not be empty."), + } + } +} + + +#[derive(Debug)] +pub enum CLIError { + Configuration(ConfigurationError), + ParseError(String, String, String, String), + UnknownParameter(String, Vec<&'static str>), + InvalidUploadProtocol(String, Vec), + InvalidKeyValueSyntax(String, bool), + Input(InputError), + Field(FieldError), + MissingCommandError, + MissingMethodError(String), +} + +impl fmt::Display for CLIError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + CLIError::Configuration(ref err) => write!(f, "Configuration -> {}", err), + CLIError::Input(ref err) => write!(f, "Input -> {}", err), + CLIError::Field(ref err) => write!(f, "Field -> {}", err), + CLIError::InvalidUploadProtocol(ref proto_name, ref valid_names) + => writeln!(f, "'{}' is not a valid upload protocol. Choose from one of {}.", proto_name, valid_names.join(", ")), + CLIError::ParseError(ref arg_name, ref type_name, ref value, ref err_desc) + => writeln!(f, "Failed to parse argument '{}' with value '{}' as {} with error: {}.", + arg_name, value, type_name, err_desc), + CLIError::UnknownParameter(ref param_name, ref possible_values) => { + let suffix = + match did_you_mean(param_name, &possible_values) { + Some(v) => format!(" Did you mean '{}' ?", v), + None => String::new(), + }; + write!(f, "Parameter '{}' is unknown.{}\n", param_name, suffix) + }, + CLIError::InvalidKeyValueSyntax(ref kv, is_hashmap) => { + let hashmap_info = if is_hashmap { "hashmap " } else { "" }; + writeln!(f, "'{}' does not match {}pattern =.", kv, hashmap_info) + }, + CLIError::MissingCommandError => writeln!(f, "Please specify the main sub-command."), + CLIError::MissingMethodError(ref cmd) => writeln!(f, "Please specify the method to call on the '{}' command.", cmd), + } + } +} + +#[derive(Debug)] +pub struct InvalidOptionsError { + pub issues: Vec, + pub exit_code: i32, +} + +impl fmt::Display for InvalidOptionsError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + for issue in &self.issues { + try!(issue.fmt(f)); + } + Ok(()) + } +} + +impl InvalidOptionsError { + pub fn single(err: CLIError, exit_code: i32) -> InvalidOptionsError { + InvalidOptionsError { + issues: vec![err], + exit_code: exit_code, + } + } + + pub fn new() -> InvalidOptionsError { + InvalidOptionsError { + issues: Vec::new(), + exit_code: 1, + } + } +} + +pub fn assure_config_dir_exists(dir: &str) -> Result { + let trdir = dir.trim(); + if trdir.len() == 0 { + return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + } + + let expanded_config_dir = + if trdir.as_bytes()[0] == b'~' { + match env::var("HOME").ok().or(env::var("UserProfile").ok()) { + None => return Err(CLIError::Configuration(ConfigurationError::HomeExpansionFailed(trdir.to_string()))), + Some(mut user) => { + user.push_str(&trdir[1..]); + user + } + } + } else { + trdir.to_string() + }; + + if let Err(err) = fs::create_dir(&expanded_config_dir) { + if err.kind() != io::ErrorKind::AlreadyExists { + return Err(CLIError::Configuration( + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))) + } + } + + Ok(expanded_config_dir) +} + +pub fn application_secret_from_directory(dir: &str, + secret_basename: &str, + json_console_secret: &str) + -> Result { + let secret_path = Path::new(dir).join(secret_basename); + let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); + let secret_io_error = |io_err: io::Error| { + Err(CLIError::Configuration(ConfigurationError::Io( + (secret_str(), io_err) + ))) + }; + + for _ in 0..2 { + match fs::File::open(&secret_path) { + Err(mut err) => { + if err.kind() == io::ErrorKind::NotFound { + // Write our built-in one - user may adjust the written file at will + + err = match fs::OpenOptions::new().create(true).write(true).open(&secret_path) { + Err(cfe) => cfe, + Ok(mut f) => { + // Assure we convert 'ugly' json string into pretty one + let console_secret: ConsoleApplicationSecret + = json::from_str(json_console_secret).unwrap(); + match json::to_writer_pretty(&mut f, &console_secret) { + Err(serde_err) => match serde_err { + json::Error::Io(err) => err, + _ => panic!("Unexpected serde error: {:#?}", serde_err) + }, + Ok(_) => continue, + } + } + }; + // fall through to IO error handling + } + return secret_io_error(err) + }, + Ok(f) => { + match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { + Err(json::Error::Io(err)) => + return secret_io_error(err), + Err(json_err) => + return Err(CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::DecoderError( + (secret_str(), json_err) + )))), + Ok(console_secret) => + match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( + CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::FormatError(secret_str()) + ))) + }, + } + } + } + } + unreachable!(); +} diff --git a/gen/firebasedynamiclinks1-cli/src/main.rs b/gen/firebasedynamiclinks1-cli/src/main.rs new file mode 100644 index 0000000000..d180d282d2 --- /dev/null +++ b/gen/firebasedynamiclinks1-cli/src/main.rs @@ -0,0 +1,391 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/cli/main.rs.mako' +// DO NOT EDIT ! +#![allow(unused_variables, unused_imports, dead_code, unused_mut)] + +#[macro_use] +extern crate clap; +extern crate yup_oauth2 as oauth2; +extern crate yup_hyper_mock as mock; +extern crate serde; +extern crate serde_json; +extern crate hyper; +extern crate mime; +extern crate strsim; +extern crate google_firebasedynamiclinks1 as api; + +use std::env; +use std::io::{self, Write}; +use clap::{App, SubCommand, Arg}; + +mod cmn; + +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, + input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, + calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; + +use std::default::Default; +use std::str::FromStr; + +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; +use serde_json as json; +use clap::ArgMatches; + +enum DoitError { + IoError(String, io::Error), + ApiError(api::Error), +} + +struct Engine<'n> { + opt: ArgMatches<'n>, + hub: api::FirebaseDynamicLinks>, + gp: Vec<&'static str>, + gpm: Vec<(&'static str, &'static str)>, +} + + +impl<'n> Engine<'n> { + fn _short_links_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "dynamic-link-info.analytics-info.google-play-analytics.utm-medium" => Some(("dynamicLinkInfo.analyticsInfo.googlePlayAnalytics.utmMedium", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "dynamic-link-info.analytics-info.google-play-analytics.utm-source" => Some(("dynamicLinkInfo.analyticsInfo.googlePlayAnalytics.utmSource", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "dynamic-link-info.analytics-info.google-play-analytics.gclid" => Some(("dynamicLinkInfo.analyticsInfo.googlePlayAnalytics.gclid", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "dynamic-link-info.analytics-info.google-play-analytics.utm-term" => Some(("dynamicLinkInfo.analyticsInfo.googlePlayAnalytics.utmTerm", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "dynamic-link-info.analytics-info.google-play-analytics.utm-content" => Some(("dynamicLinkInfo.analyticsInfo.googlePlayAnalytics.utmContent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "dynamic-link-info.analytics-info.google-play-analytics.utm-campaign" => Some(("dynamicLinkInfo.analyticsInfo.googlePlayAnalytics.utmCampaign", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "dynamic-link-info.analytics-info.itunes-connect-analytics.mt" => Some(("dynamicLinkInfo.analyticsInfo.itunesConnectAnalytics.mt", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "dynamic-link-info.analytics-info.itunes-connect-analytics.at" => Some(("dynamicLinkInfo.analyticsInfo.itunesConnectAnalytics.at", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "dynamic-link-info.analytics-info.itunes-connect-analytics.pt" => Some(("dynamicLinkInfo.analyticsInfo.itunesConnectAnalytics.pt", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "dynamic-link-info.analytics-info.itunes-connect-analytics.ct" => Some(("dynamicLinkInfo.analyticsInfo.itunesConnectAnalytics.ct", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "dynamic-link-info.ios-info.ios-custom-scheme" => Some(("dynamicLinkInfo.iosInfo.iosCustomScheme", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "dynamic-link-info.ios-info.ios-fallback-link" => Some(("dynamicLinkInfo.iosInfo.iosFallbackLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "dynamic-link-info.ios-info.ios-bundle-id" => Some(("dynamicLinkInfo.iosInfo.iosBundleId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "dynamic-link-info.ios-info.ios-ipad-bundle-id" => Some(("dynamicLinkInfo.iosInfo.iosIpadBundleId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "dynamic-link-info.ios-info.ios-app-store-id" => Some(("dynamicLinkInfo.iosInfo.iosAppStoreId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "dynamic-link-info.ios-info.ios-ipad-fallback-link" => Some(("dynamicLinkInfo.iosInfo.iosIpadFallbackLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "dynamic-link-info.android-info.android-fallback-link" => Some(("dynamicLinkInfo.androidInfo.androidFallbackLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "dynamic-link-info.android-info.android-package-name" => Some(("dynamicLinkInfo.androidInfo.androidPackageName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "dynamic-link-info.android-info.android-link" => Some(("dynamicLinkInfo.androidInfo.androidLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "dynamic-link-info.android-info.android-min-package-version-code" => Some(("dynamicLinkInfo.androidInfo.androidMinPackageVersionCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "dynamic-link-info.social-meta-tag-info.social-title" => Some(("dynamicLinkInfo.socialMetaTagInfo.socialTitle", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "dynamic-link-info.social-meta-tag-info.social-description" => Some(("dynamicLinkInfo.socialMetaTagInfo.socialDescription", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "dynamic-link-info.social-meta-tag-info.social-image-link" => Some(("dynamicLinkInfo.socialMetaTagInfo.socialImageLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "dynamic-link-info.link" => Some(("dynamicLinkInfo.link", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "dynamic-link-info.dynamic-link-domain" => Some(("dynamicLinkInfo.dynamicLinkDomain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "long-dynamic-link" => Some(("longDynamicLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "suffix.option" => Some(("suffix.option", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["analytics-info", "android-fallback-link", "android-info", "android-link", "android-min-package-version-code", "android-package-name", "at", "ct", "dynamic-link-domain", "dynamic-link-info", "gclid", "google-play-analytics", "ios-app-store-id", "ios-bundle-id", "ios-custom-scheme", "ios-fallback-link", "ios-info", "ios-ipad-bundle-id", "ios-ipad-fallback-link", "itunes-connect-analytics", "link", "long-dynamic-link", "mt", "option", "pt", "social-description", "social-image-link", "social-meta-tag-info", "social-title", "suffix", "utm-campaign", "utm-content", "utm-medium", "utm-source", "utm-term"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CreateShortDynamicLinkRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.short_links().create(request); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _doit(&self, dry_run: bool) -> Result, Option> { + let mut err = InvalidOptionsError::new(); + let mut call_result: Result<(), DoitError> = Ok(()); + let mut err_opt: Option = None; + match self.opt.subcommand() { + ("short-links", Some(opt)) => { + match opt.subcommand() { + ("create", Some(opt)) => { + call_result = self._short_links_create(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("short-links".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + _ => { + err.issues.push(CLIError::MissingCommandError); + writeln!(io::stderr(), "{}\n", self.opt.usage()).ok(); + } + } + + if dry_run { + if err.issues.len() > 0 { + err_opt = Some(err); + } + Err(err_opt) + } else { + Ok(call_result) + } + } + + // Please note that this call will fail if any part of the opt can't be handled + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { + let (config_dir, secret) = { + let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { + Err(e) => return Err(InvalidOptionsError::single(e, 3)), + Ok(p) => p, + }; + + match cmn::application_secret_from_directory(&config_dir, "firebasedynamiclinks1-secret.json", + "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { + Ok(secret) => (config_dir, secret), + Err(e) => return Err(InvalidOptionsError::single(e, 4)) + } + }; + + let auth = Authenticator::new( &secret, DefaultAuthenticatorDelegate, + if opt.is_present("debug-auth") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::::default() + }) + } else { + hyper::Client::new() + }, + JsonTokenStorage { + program_name: "firebasedynamiclinks1", + db_dir: config_dir.clone(), + }, Some(FlowType::InstalledRedirect(54324))); + + let client = + if opt.is_present("debug") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::::default() + }) + } else { + hyper::Client::new() + }; + let engine = Engine { + opt: opt, + hub: api::FirebaseDynamicLinks::new(client, auth), + gp: vec!["$-xgafv", "access-token", "alt", "bearer-token", "callback", "fields", "key", "oauth-token", "pp", "pretty-print", "quota-user", "upload-type", "upload-protocol"], + gpm: vec![ + ("$-xgafv", "$.xgafv"), + ("access-token", "access_token"), + ("bearer-token", "bearer_token"), + ("oauth-token", "oauth_token"), + ("pretty-print", "prettyPrint"), + ("quota-user", "quotaUser"), + ("upload-type", "uploadType"), + ("upload-protocol", "upload_protocol"), + ] + }; + + match engine._doit(true) { + Err(Some(err)) => Err(err), + Err(None) => Ok(engine), + Ok(_) => unreachable!(), + } + } + + fn doit(&self) -> Result<(), DoitError> { + match self._doit(false) { + Ok(res) => res, + Err(_) => unreachable!(), + } + } +} + +fn main() { + let mut exit_status = 0i32; + let arg_data = [ + ("short-links", "methods: 'create'", vec![ + ("create", + Some(r##"Creates a short Dynamic Link given either a valid long Dynamic Link or + details such as Dynamic Link domain, Android and iOS app information. + The created short Dynamic Link will not expire. + + Repeated calls with the same long Dynamic Link or Dynamic Link information + will produce the same short Dynamic Link. + + The Dynamic Link domain in the request must be owned by requester's + Firebase project."##), + "Details at http://byron.github.io/google-apis-rs/google_firebasedynamiclinks1_cli/short-links_create", + vec![ + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ]; + + let mut app = App::new("firebasedynamiclinks1") + .author("Sebastian Thiel ") + .version("1.0.0+20161118") + .about("Firebase Dynamic Links API enables third party developers to programmatically create and manage Dynamic Links.") + .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_firebasedynamiclinks1_cli") + .arg(Arg::with_name("url") + .long("scope") + .help("Specify the authentication a method should be executed in. Each scope requires the user to grant this application permission to use it.If unset, it defaults to the shortest scope url for a particular method.") + .multiple(true) + .takes_value(true)) + .arg(Arg::with_name("folder") + .long("config-dir") + .help("A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation.[default: ~/.google-service-cli") + .multiple(false) + .takes_value(true)) + .arg(Arg::with_name("debug") + .long("debug") + .help("Output all server communication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)) + .arg(Arg::with_name("debug-auth") + .long("debug-auth") + .help("Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)); + + for &(main_command_name, about, ref subcommands) in arg_data.iter() { + let mut mcmd = SubCommand::with_name(main_command_name).about(about); + + for &(sub_command_name, ref desc, url_info, ref args) in subcommands { + let mut scmd = SubCommand::with_name(sub_command_name); + if let &Some(desc) = desc { + scmd = scmd.about(desc); + } + scmd = scmd.after_help(url_info); + + for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { + let arg_name_str = + match (arg_name, flag) { + (&Some(an), _ ) => an, + (_ , &Some(f)) => f, + _ => unreachable!(), + }; + let mut arg = Arg::with_name(arg_name_str) + .empty_values(false); + if let &Some(short_flag) = flag { + arg = arg.short(short_flag); + } + if let &Some(desc) = desc { + arg = arg.help(desc); + } + if arg_name.is_some() && flag.is_some() { + arg = arg.takes_value(true); + } + if let &Some(required) = required { + arg = arg.required(required); + } + if let &Some(multi) = multi { + arg = arg.multiple(multi); + } + scmd = scmd.arg(arg); + } + mcmd = mcmd.subcommand(scmd); + } + app = app.subcommand(mcmd); + } + + let matches = app.get_matches(); + + let debug = matches.is_present("debug"); + match Engine::new(matches) { + Err(err) => { + exit_status = err.exit_code; + writeln!(io::stderr(), "{}", err).ok(); + }, + Ok(engine) => { + if let Err(doit_err) = engine.doit() { + exit_status = 1; + match doit_err { + DoitError::IoError(path, err) => { + writeln!(io::stderr(), "Failed to open output file '{}': {}", path, err).ok(); + }, + DoitError::ApiError(err) => { + if debug { + writeln!(io::stderr(), "{:#?}", err).ok(); + } else { + writeln!(io::stderr(), "{}", err).ok(); + } + } + } + } + } + } + + std::process::exit(exit_status); +} \ No newline at end of file diff --git a/gen/firebasedynamiclinks1/Cargo.toml b/gen/firebasedynamiclinks1/Cargo.toml new file mode 100644 index 0000000000..a6a4af96b3 --- /dev/null +++ b/gen/firebasedynamiclinks1/Cargo.toml @@ -0,0 +1,34 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-firebasedynamiclinks1" +version = "1.0.0+20161118" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Firebase Dynamic Links (protocol v1)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/firebasedynamiclinks1" +homepage = "https://firebase.google.com/docs/dynamic-links/" +documentation = "http://byron.github.io/google-apis-rs/google_firebasedynamiclinks1" +license = "MIT" +keywords = ["firebasedynamiclinks", "google", "protocol", "web", "api"] +build = "src/build.rs" + + +[dependencies] +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.8" +serde_json = "^ 0.8" +yup-oauth2 = { version = "^ 1.0", optional = true, default-features = false } +serde_derive = { version = "^ 0.8", optional = true } +url = "= 0.5" + +[features] +default = ["with-serde-codegen"] +nightly = ["serde_derive","yup-oauth2/nightly"] +with-serde-codegen = ["serde_codegen","yup-oauth2/with-serde-codegen"] + +[build-dependencies] +serde_codegen = { version = "^ 0.8", optional = true } + diff --git a/gen/firebasedynamiclinks1/LICENSE.md b/gen/firebasedynamiclinks1/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/firebasedynamiclinks1/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/firebasedynamiclinks1/README.md b/gen/firebasedynamiclinks1/README.md new file mode 100644 index 0000000000..4bbbcc90ff --- /dev/null +++ b/gen/firebasedynamiclinks1/README.md @@ -0,0 +1,179 @@ + +The `google-firebasedynamiclinks1` library allows access to all features of the *Google Firebase Dynamic Links* service. + +This documentation was generated from *Firebase Dynamic Links* crate version *1.0.0+20161118*, where *20161118* is the exact revision of the *firebasedynamiclinks:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. + +Everything else about the *Firebase Dynamic Links* *v1* API can be found at the +[official documentation site](https://firebase.google.com/docs/dynamic-links/). +# Features + +Handle the following *Resources* with ease from the central [hub](http://byron.github.io/google-apis-rs/google_firebasedynamiclinks1/struct.FirebaseDynamicLinks.html) ... + +* short links + * [*create*](http://byron.github.io/google-apis-rs/google_firebasedynamiclinks1/struct.ShortLinkCreateCall.html) + + + + +# Structure of this Library + +The API is structured into the following primary items: + +* **[Hub](http://byron.github.io/google-apis-rs/google_firebasedynamiclinks1/struct.FirebaseDynamicLinks.html)** + * a central object to maintain state and allow accessing all *Activities* + * creates [*Method Builders*](http://byron.github.io/google-apis-rs/google_firebasedynamiclinks1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](http://byron.github.io/google-apis-rs/google_firebasedynamiclinks1/trait.CallBuilder.html) +* **[Resources](http://byron.github.io/google-apis-rs/google_firebasedynamiclinks1/trait.Resource.html)** + * primary types that you can apply *Activities* to + * a collection of properties and *Parts* + * **[Parts](http://byron.github.io/google-apis-rs/google_firebasedynamiclinks1/trait.Part.html)** + * a collection of properties + * never directly used in *Activities* +* **[Activities](http://byron.github.io/google-apis-rs/google_firebasedynamiclinks1/trait.CallBuilder.html)** + * operations to apply to *Resources* + +All *structures* are marked with applicable traits to further categorize them and ease browsing. + +Generally speaking, you can invoke *Activities* like this: + +```Rust,ignore +let r = hub.resource().activity(...).doit() +``` + +Or specifically ... + +```ignore +let r = hub.short_links().create(...).doit() +``` + +The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +The `doit()` method performs the actual communication with the server and returns the respective result. + +# Usage + +## Setting up your Project + +To use this library, you would put the following lines into your `Cargo.toml` file: + +```toml +[dependencies] +google-firebasedynamiclinks1 = "*" +``` + +## A complete example + +```Rust +extern crate hyper; +extern crate yup_oauth2 as oauth2; +extern crate google_firebasedynamiclinks1 as firebasedynamiclinks1; +use firebasedynamiclinks1::CreateShortDynamicLinkRequest; +use firebasedynamiclinks1::{Result, Error}; +use std::default::Default; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +use firebasedynamiclinks1::FirebaseDynamicLinks; + +// Get an ApplicationSecret instance by some means. It contains the `client_id` and +// `client_secret`, among other things. +let secret: ApplicationSecret = Default::default(); +// Instantiate the authenticator. It will choose a suitable authentication flow for you, +// unless you replace `None` with the desired Flow. +// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +// retrieve them from storage. +let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, + hyper::Client::new(), + ::default(), None); +let mut hub = FirebaseDynamicLinks::new(hyper::Client::new(), auth); +// As the method needs a request, you would usually fill it with the desired information +// into the respective structure. Some of the parts shown here might not be applicable ! +// Values shown here are possibly random and not representative ! +let mut req = CreateShortDynamicLinkRequest::default(); + +// You can configure optional parameters by calling the respective setters at will, and +// execute the final call using `doit()`. +// Values shown here are possibly random and not representative ! +let result = hub.short_links().create(req) + .doit(); + +match result { + Err(e) => match e { + // The Error enum provides details about what exactly happened. + // You can also just use its `Debug`, `Display` or `Error` traits + Error::HttpError(_) + |Error::MissingAPIKey + |Error::MissingToken(_) + |Error::Cancelled + |Error::UploadSizeLimitExceeded(_, _) + |Error::Failure(_) + |Error::BadRequest(_) + |Error::FieldClash(_) + |Error::JsonDecodeError(_, _) => println!("{}", e), + }, + Ok(res) => println!("Success: {:?}", res), +} + +``` +## Handling Errors + +All errors produced by the system are provided either as [Result](http://byron.github.io/google-apis-rs/google_firebasedynamiclinks1/enum.Result.html) enumeration as return value of +the doit() methods, or handed as possibly intermediate results to either the +[Hub Delegate](http://byron.github.io/google-apis-rs/google_firebasedynamiclinks1/trait.Delegate.html), or the [Authenticator Delegate](http://byron.github.io/google-apis-rs/google_firebasedynamiclinks1/../yup-oauth2/trait.AuthenticatorDelegate.html). + +When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +makes the system potentially resilient to all kinds of errors. + +## Uploads and Downloads +If a method supports downloads, the response body, which is part of the [Result](http://byron.github.io/google-apis-rs/google_firebasedynamiclinks1/enum.Result.html), should be +read by you to obtain the media. +If such a method also supports a [Response Result](http://byron.github.io/google-apis-rs/google_firebasedynamiclinks1/trait.ResponseResult.html), it will return that by default. +You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +this call: `.param("alt", "media")`. + +Methods supporting uploads can do so using up to 2 different protocols: +*simple* and *resumable*. The distinctiveness of each is represented by customized +`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. + +## Customization and Callbacks + +You may alter the way an `doit()` method is called by providing a [delegate](http://byron.github.io/google-apis-rs/google_firebasedynamiclinks1/trait.Delegate.html) to the +[Method Builder](http://byron.github.io/google-apis-rs/google_firebasedynamiclinks1/trait.CallBuilder.html) before making the final `doit()` call. +Respective methods will be called to provide progress information, as well as determine whether the system should +retry on failure. + +The [delegate trait](http://byron.github.io/google-apis-rs/google_firebasedynamiclinks1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. + +## Optional Parts in Server-Requests + +All structures provided by this library are made to be [enocodable](http://byron.github.io/google-apis-rs/google_firebasedynamiclinks1/trait.RequestValue.html) and +[decodable](http://byron.github.io/google-apis-rs/google_firebasedynamiclinks1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +are valid. +Most optionals are are considered [Parts](http://byron.github.io/google-apis-rs/google_firebasedynamiclinks1/trait.Part.html) which are identifiable by name, which will be sent to +the server to indicate either the set parts of the request or the desired parts in the response. + +## Builder Arguments + +Using [method builders](http://byron.github.io/google-apis-rs/google_firebasedynamiclinks1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +These will always take a single argument, for which the following statements are true. + +* [PODs][wiki-pod] are handed by copy +* strings are passed as `&str` +* [request values](http://byron.github.io/google-apis-rs/google_firebasedynamiclinks1/trait.RequestValue.html) are moved + +Arguments will always be copied or cloned into the builder, to make them independent of their original life times. + +[wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +[google-go-api]: https://github.com/google/google-api-go-client + +# License +The **firebasedynamiclinks1** library was generated by Sebastian Thiel, and is placed +under the *MIT* license. +You can read the full text at the repository's [license file][repo-license]. + +[repo-license]: https://github.com/Byron/google-apis-rs/LICENSE.md diff --git a/gen/firebasedynamiclinks1/src/build.rs b/gen/firebasedynamiclinks1/src/build.rs new file mode 100644 index 0000000000..0bebaf0bf0 --- /dev/null +++ b/gen/firebasedynamiclinks1/src/build.rs @@ -0,0 +1,25 @@ +#[cfg(feature = "with-serde-codegen")] +mod inner { + extern crate serde_codegen; + + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + serde_codegen::expand(&src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-serde-codegen"))] +mod inner { + pub fn main() {} +} + +pub fn main() { + inner::main() +} \ No newline at end of file diff --git a/gen/firebasedynamiclinks1/src/cmn.rs b/gen/firebasedynamiclinks1/src/cmn.rs new file mode 100644 index 0000000000..d75063e466 --- /dev/null +++ b/gen/firebasedynamiclinks1/src/cmn.rs @@ -0,0 +1,753 @@ +// COPY OF 'src/rust/api/cmn.rs' +// DO NOT EDIT +use std::io::{self, Read, Seek, Cursor, Write, SeekFrom}; +use std; +use std::fmt::{self, Display}; +use std::str::FromStr; +use std::error; +use std::thread::sleep; +use std::time::Duration; + +use mime::{Mime, TopLevel, SubLevel, Attr, Value}; +use oauth2::{TokenType, Retry, self}; +use hyper; +use hyper::header::{ContentType, ContentLength, Headers, UserAgent, Authorization, Header, + HeaderFormat, Bearer}; +use hyper::http::h1::LINE_ENDING; +use hyper::method::Method; +use hyper::status::StatusCode; + +use serde_json as json; + +/// Identifies the Hub. There is only one per library, this trait is supposed +/// to make intended use more explicit. +/// The hub allows to access all resource methods more easily. +pub trait Hub {} + +/// Identifies types for building methods of a particular resource type +pub trait MethodsBuilder {} + +/// Identifies types which represent builders for a particular resource method +pub trait CallBuilder {} + +/// Identifies types which can be inserted and deleted. +/// Types with this trait are most commonly used by clients of this API. +pub trait Resource {} + +/// Identifies types which are used in API responses. +pub trait ResponseResult {} + +/// Identifies types which are used in API requests. +pub trait RequestValue {} + +/// Identifies types which are not actually used by the API +/// This might be a bug within the google API schema. +pub trait UnusedType {} + +/// Identifies types which are only used as part of other types, which +/// usually are carrying the `Resource` trait. +pub trait Part {} + +/// Identifies types which are only used by other types internally. +/// They have no special meaning, this trait just marks them for completeness. +pub trait NestedType {} + +/// A utility to specify reader types which provide seeking capabilities too +pub trait ReadSeek: Seek + Read {} +impl ReadSeek for T {} + +/// A trait for all types that can convert themselves into a *parts* string +pub trait ToParts { + fn to_parts(&self) -> String; +} + +/// A utility type which can decode a server response that indicates error +#[derive(Deserialize)] +pub struct JsonServerError { + pub error: String, + pub error_description: Option +} + +/// A utility to represent detailed errors we might see in case there are BadRequests. +/// The latter happen if the sent parameters or request structures are unsound +#[derive(Deserialize, Serialize, Debug)] +pub struct ErrorResponse { + error: ServerError, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerError { + errors: Vec, + code: u16, + message: String, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerMessage { + domain: String, + reason: String, + message: String, + #[serde(rename="locationType")] + location_type: Option, + location: Option +} + +#[derive(Copy, Clone)] +pub struct DummyNetworkStream; + +impl Read for DummyNetworkStream { + fn read(&mut self, _: &mut [u8]) -> io::Result { + Ok(0) + } +} + +impl Write for DummyNetworkStream { + fn write(&mut self, _: &[u8]) -> io::Result { + Ok(0) + } + + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} + +impl hyper::net::NetworkStream for DummyNetworkStream { + fn peer_addr(&mut self) -> io::Result { + Ok("127.0.0.1:1337".parse().unwrap()) + } + + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } + + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } +} + + +/// A trait specifying functionality to help controlling any request performed by the API. +/// The trait has a conservative default implementation. +/// +/// It contains methods to deal with all common issues, as well with the ones related to +/// uploading media +pub trait Delegate { + + /// Called at the beginning of any API request. The delegate should store the method + /// information if he is interesting in knowing more context when further calls to it + /// are made. + /// The matching `finished()` call will always be made, no matter whether or not the API + /// request was successful. That way, the delegate may easily maintain a clean state + /// between various API calls. + fn begin(&mut self, MethodInfo) {} + + /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + /// + /// Return retry information. + fn http_error(&mut self, &hyper::Error) -> Retry { + Retry::Abort + } + + /// Called whenever there is the need for your applications API key after + /// the official authenticator implementation didn't provide one, for some reason. + /// If this method returns None as well, the underlying operation will fail + fn api_key(&mut self) -> Option { + None + } + + /// Called whenever the Authenticator didn't yield a token. The delegate + /// may attempt to provide one, or just take it as a general information about the + /// impending failure. + /// The given Error provides information about why the token couldn't be acquired in the + /// first place + fn token(&mut self, err: &error::Error) -> Option { + let _ = err; + None + } + + /// Called during resumable uploads to provide a URL for the impending upload. + /// It was saved after a previous call to `store_upload_url(...)`, and if not None, + /// will be used instead of asking the server for a new upload URL. + /// This is useful in case a previous resumable upload was aborted/canceled, but should now + /// be resumed. + /// The returned URL will be used exactly once - if it fails again and the delegate allows + /// to retry, we will ask the server for a new upload URL. + fn upload_url(&mut self) -> Option { + None + } + + /// Called after we have retrieved a new upload URL for a resumable upload to store it + /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// see `upload_url()`. + /// It will also be called with None after a successful upload, which allows the delegate + /// to forget the URL. That way, we will not attempt to resume an upload that has already + /// finished. + fn store_upload_url(&mut self, url: Option<&str>) { + let _ = url; + } + + /// Called whenever a server response could not be decoded from json. + /// It's for informational purposes only, the caller will return with an error + /// accordingly. + /// + /// # Arguments + /// + /// * `json_encoded_value` - The json-encoded value which failed to decode. + /// * `json_decode_error` - The decoder error + fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &json::Error) { + let _ = json_encoded_value; + let _ = json_decode_error; + } + + /// Called whenever the http request returns with a non-success status code. + /// This can involve authentication issues, or anything else that very much + /// depends on the used API method. + /// The delegate should check the status, header and decoded json error to decide + /// whether to retry or not. In the latter case, the underlying call will fail. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + fn http_failure(&mut self, _: &hyper::client::Response, Option, _: Option) -> Retry { + Retry::Abort + } + + /// Called prior to sending the main request of the given method. It can be used to time + /// the call or to print progress information. + /// It's also useful as you can be sure that a request will definitely be made. + fn pre_request(&mut self) { } + + /// Return the size of each chunk of a resumable upload. + /// Must be a power of two, with 1<<18 being the smallest allowed chunk size. + /// Will be called once before starting any resumable upload. + fn chunk_size(&mut self) -> u64 { + 1 << 23 + } + + /// Called before the given chunk is uploaded to the server. + /// If true is returned, the upload will be interrupted. + /// However, it may be resumable if you stored the upload URL in a previous call + /// to `store_upload_url()` + fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { + let _ = chunk; + false + } + + /// Called before the API request method returns, in every case. It can be used to clean up + /// internal state between calls to the API. + /// This call always has a matching call to `begin(...)`. + /// + /// # Arguments + /// + /// * `is_success` - a true value indicates the operation was successful. If false, you should + /// discard all values stored during `store_upload_url`. + fn finished(&mut self, is_success: bool) { + let _ = is_success; + } +} + +/// A delegate with a conservative default implementation, which is used if no other delegate is +/// set. +#[derive(Default)] +pub struct DefaultDelegate; + +impl Delegate for DefaultDelegate {} + + +#[derive(Debug)] +pub enum Error { + /// The http connection failed + HttpError(hyper::Error), + + /// An attempt was made to upload a resource with size stored in field `.0` + /// even though the maximum upload size is what is stored in field `.1`. + UploadSizeLimitExceeded(u64, u64), + + /// Represents information about a request that was not understood by the server. + /// Details are included. + BadRequest(ErrorResponse), + + /// We needed an API key for authentication, but didn't obtain one. + /// Neither through the authenticator, nor through the Delegate. + MissingAPIKey, + + /// We required a Token, but didn't get one from the Authenticator + MissingToken(Box), + + /// The delgate instructed to cancel the operation + Cancelled, + + /// An additional, free form field clashed with one of the built-in optional ones + FieldClash(&'static str), + + /// Shows that we failed to decode the server response. + /// This can happen if the protocol changes in conjunction with strict json decoding. + JsonDecodeError(String, json::Error), + + /// Indicates an HTTP repsonse with a non-success status code + Failure(hyper::client::Response), +} + + +impl Display for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + Error::HttpError(ref err) => err.fmt(f), + Error::UploadSizeLimitExceeded(ref resource_size, ref max_size) => + writeln!(f, "The media size {} exceeds the maximum allowed upload size of {}" + , resource_size, max_size), + Error::MissingAPIKey => { + (writeln!(f, "The application's API key was not found in the configuration")).ok(); + writeln!(f, "It is used as there are no Scopes defined for this method.") + }, + Error::BadRequest(ref err) => { + try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); + for err in err.error.errors.iter() { + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, + err.reason, + match &err.location { + &Some(ref loc) => format!("@{}", loc), + &None => String::new(), + })); + } + Ok(()) + }, + Error::MissingToken(ref err) => + writeln!(f, "Token retrieval failed with error: {}", err), + Error::Cancelled => + writeln!(f, "Operation cancelled by delegate"), + Error::FieldClash(field) => + writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), + Error::JsonDecodeError(ref json_str, ref err) + => writeln!(f, "{}: {}", err, json_str), + Error::Failure(ref response) => + writeln!(f, "Http status indicates failure: {:?}", response), + } + } +} + +impl error::Error for Error { + fn description(&self) -> &str { + match *self { + Error::HttpError(ref err) => err.description(), + Error::JsonDecodeError(_, ref err) => err.description(), + _ => "NO DESCRIPTION POSSIBLE - use `Display.fmt()` instead" + } + } + + fn cause(&self) -> Option<&error::Error> { + match *self { + Error::HttpError(ref err) => err.cause(), + Error::JsonDecodeError(_, ref err) => err.cause(), + _ => None + } + } +} + +/// A universal result type used as return for all calls. +pub type Result = std::result::Result; + +/// Contains information about an API request. +pub struct MethodInfo { + pub id: &'static str, + pub http_method: Method, +} + +const BOUNDARY: &'static str = "MDuXWGyeE33QFXGchb2VFWc4Z7945d"; + +/// Provides a `Read` interface that converts multiple parts into the protocol +/// identified by [RFC2387](https://tools.ietf.org/html/rfc2387). +/// **Note**: This implementation is just as rich as it needs to be to perform uploads +/// to google APIs, and might not be a fully-featured implementation. +#[derive(Default)] +pub struct MultiPartReader<'a> { + raw_parts: Vec<(Headers, &'a mut Read)>, + current_part: Option<(Cursor>, &'a mut Read)>, + last_part_boundary: Option>>, +} + +impl<'a> MultiPartReader<'a> { + + /// Reserve memory for exactly the given amount of parts + pub fn reserve_exact(&mut self, cap: usize) { + self.raw_parts.reserve_exact(cap); + } + + /// Add a new part to the queue of parts to be read on the first `read` call. + /// + /// # Arguments + /// + /// `headers` - identifying the body of the part. It's similar to the header + /// in an ordinary single-part call, and should thus contain the + /// same information. + /// `reader` - a reader providing the part's body + /// `size` - the amount of bytes provided by the reader. It will be put onto the header as + /// content-size. + /// `mime` - It will be put onto the content type + pub fn add_part(&mut self, reader: &'a mut Read, size: u64, mime_type: Mime) -> &mut MultiPartReader<'a> { + let mut headers = Headers::new(); + headers.set(ContentType(mime_type)); + headers.set(ContentLength(size)); + self.raw_parts.push((headers, reader)); + self + } + + /// Returns the mime-type representing our multi-part message. + /// Use it with the ContentType header. + pub fn mime_type(&self) -> Mime { + Mime( + TopLevel::Multipart, + SubLevel::Ext("Related".to_string()), + vec![(Attr::Ext("boundary".to_string()), Value::Ext(BOUNDARY.to_string()))], + ) + } + + /// Returns true if we are totally used + fn is_depleted(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_none() && self.last_part_boundary.is_none() + } + + /// Returns true if we are handling our last part + fn is_last_part(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_some() + } +} + +impl<'a> Read for MultiPartReader<'a> { + fn read(&mut self, buf: &mut [u8]) -> io::Result { + match (self.raw_parts.len(), + self.current_part.is_none(), + self.last_part_boundary.is_none()) { + (_, _, false) => { + let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); + if br < buf.len() { + self.last_part_boundary = None; + } + return Ok(br) + }, + (0, true, true) => return Ok(0), + (n, true, _) if n > 0 => { + let (headers, reader) = self.raw_parts.remove(0); + let mut c = Cursor::new(Vec::::new()); + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + headers, LINE_ENDING)).unwrap(); + c.seek(SeekFrom::Start(0)).unwrap(); + self.current_part = Some((c, reader)); + } + _ => {}, + } + + // read headers as long as possible + let (hb, rr) = { + let &mut (ref mut c, ref mut reader) = self.current_part.as_mut().unwrap(); + let b = c.read(buf).unwrap_or(0); + (b, reader.read(&mut buf[b..])) + }; + + match rr { + Ok(bytes_read) => { + if hb < buf.len() && bytes_read == 0 { + if self.is_last_part() { + // before clearing the last part, we will add the boundary that + // will be written last + self.last_part_boundary = Some(Cursor::new( + format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) + } + // We are depleted - this can trigger the next part to come in + self.current_part = None; + } + let mut total_bytes_read = hb + bytes_read; + while total_bytes_read < buf.len() && !self.is_depleted() { + match self.read(&mut buf[total_bytes_read ..]) { + Ok(br) => total_bytes_read += br, + Err(err) => return Err(err), + } + } + Ok(total_bytes_read) + } + Err(err) => { + // fail permanently + self.current_part = None; + self.last_part_boundary = None; + self.raw_parts.clear(); + Err(err) + } + } + } +} + +/// The `X-Upload-Content-Type` header. +/// +/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// processed to be more readable. +#[derive(PartialEq, Debug, Clone)] +pub struct XUploadContentType(pub Mime); + +impl ::std::ops::Deref for XUploadContentType { + type Target = Mime; + fn deref<'a>(&'a self) -> &'a Mime { &self.0 } +} +impl ::std::ops::DerefMut for XUploadContentType { + fn deref_mut<'a>(&'a mut self) -> &'a mut Mime { &mut self.0 } +} +impl Header for XUploadContentType { + fn header_name() -> &'static str { "X-Upload-Content-Type" } + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + hyper::header::parsing::from_one_raw_str(raw).map(XUploadContentType) + } +} +impl HeaderFormat for XUploadContentType { + fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result { + Display::fmt(&**self, f) + } +} +impl Display for XUploadContentType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(&**self, f) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct Chunk { + pub first: u64, + pub last: u64 +} + +impl fmt::Display for Chunk { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + (write!(fmt, "{}-{}", self.first, self.last)).ok(); + Ok(()) + } +} + +impl FromStr for Chunk { + type Err = &'static str; + + /// NOTE: only implements `%i-%i`, not `*` + fn from_str(s: &str) -> std::result::Result { + let parts: Vec<&str> = s.split('-').collect(); + if parts.len() != 2 { + return Err("Expected two parts: %i-%i") + } + Ok( + Chunk { + first: match FromStr::from_str(parts[0]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'first' as digit") + }, + last: match FromStr::from_str(parts[1]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'last' as digit") + } + } + ) + } +} + +/// Implements the Content-Range header, for serialization only +#[derive(Clone, PartialEq, Debug)] +pub struct ContentRange { + pub range: Option, + pub total_length: u64, +} + +impl Header for ContentRange { + fn header_name() -> &'static str { + "Content-Range" + } + + /// We are not parsable, as parsing is done by the `Range` header + fn parse_header(_: &[Vec]) -> hyper::error::Result { + Err(hyper::error::Error::Method) + } +} + + +impl HeaderFormat for ContentRange { + fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + try!(fmt.write_str("bytes ")); + match self.range { + Some(ref c) => try!(c.fmt(fmt)), + None => try!(fmt.write_str("*")) + } + (write!(fmt, "/{}", self.total_length)).ok(); + Ok(()) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct RangeResponseHeader(pub Chunk); + +impl Header for RangeResponseHeader { + fn header_name() -> &'static str { + "Range" + } + + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + if raw.len() > 0 { + let v = &raw[0]; + if let Ok(s) = std::str::from_utf8(v) { + const PREFIX: &'static str = "bytes "; + if s.starts_with(PREFIX) { + if let Ok(c) = ::from_str(&s[PREFIX.len()..]) { + return Ok(RangeResponseHeader(c)) + } + } + } + } + Err(hyper::error::Error::Method) + } +} + +impl HeaderFormat for RangeResponseHeader { + /// No implmentation necessary, we just need to parse + fn fmt_header(&self, _: &mut fmt::Formatter) -> fmt::Result { + Err(fmt::Error) + } +} + +/// A utility type to perform a resumable upload from start to end. +pub struct ResumableUploadHelper<'a, A: 'a> { + pub client: &'a mut hyper::client::Client, + pub delegate: &'a mut Delegate, + pub start_at: Option, + pub auth: &'a mut A, + pub user_agent: &'a str, + pub auth_header: Authorization, + pub url: &'a str, + pub reader: &'a mut ReadSeek, + pub media_type: Mime, + pub content_length: u64 +} + +impl<'a, A> ResumableUploadHelper<'a, A> + where A: oauth2::GetToken { + + fn query_transfer_status(&mut self) -> std::result::Result> { + loop { + match self.client.post(self.url) + .header(UserAgent(self.user_agent.to_string())) + .header(ContentRange { range: None, total_length: self.content_length }) + .header(self.auth_header.clone()) + .send() { + Ok(r) => { + // 308 = resume-incomplete == PermanentRedirect + let headers = r.headers.clone(); + let h: &RangeResponseHeader = match headers.get() { + Some(hh) if r.status == StatusCode::PermanentRedirect => hh, + None|Some(_) => { + if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { + sleep(d); + continue; + } + return Err(Ok(r)) + } + }; + return Ok(h.0.last) + } + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Err(Err(err)) + } + } + } + } + + /// returns None if operation was cancelled by delegate, or the HttpResult. + /// It can be that we return the result just because we didn't understand the status code - + /// caller should check for status himself before assuming it's OK to use + pub fn upload(&mut self) -> Option> { + let mut start = match self.start_at { + Some(s) => s, + None => match self.query_transfer_status() { + Ok(s) => s, + Err(result) => return Some(result) + } + }; + + const MIN_CHUNK_SIZE: u64 = 1 << 18; + let chunk_size = match self.delegate.chunk_size() { + cs if cs > MIN_CHUNK_SIZE => cs, + _ => MIN_CHUNK_SIZE + }; + + self.reader.seek(SeekFrom::Start(start)).unwrap(); + loop { + let request_size = match self.content_length - start { + rs if rs > chunk_size => chunk_size, + rs => rs + }; + + let mut section_reader = self.reader.take(request_size); + let range_header = ContentRange { + range: Some(Chunk {first: start, last: start + request_size - 1}), + total_length: self.content_length + }; + start += request_size; + if self.delegate.cancel_chunk_upload(&range_header) { + return None + } + let res = self.client.post(self.url) + .header(range_header) + .header(ContentType(self.media_type.clone())) + .header(UserAgent(self.user_agent.to_string())) + .body(&mut section_reader) + .send(); + match res { + Ok(mut res) => { + if res.status == StatusCode::PermanentRedirect { + continue + } + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let Retry::After(d) = self.delegate.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + } + return Some(Ok(res)) + }, + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Some(Err(err)) + } + } + } + } +} + +// Copy of src/rust/cli/cmn.rs +// TODO(ST): Allow sharing common code between program types +pub fn remove_json_null_values(value: &mut json::value::Value) { + match *value { + json::value::Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} diff --git a/gen/firebasedynamiclinks1/src/lib.rs b/gen/firebasedynamiclinks1/src/lib.rs new file mode 100644 index 0000000000..d410507880 --- /dev/null +++ b/gen/firebasedynamiclinks1/src/lib.rs @@ -0,0 +1,188 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +//! This documentation was generated from *Firebase Dynamic Links* crate version *1.0.0+20161118*, where *20161118* is the exact revision of the *firebasedynamiclinks:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! +//! Everything else about the *Firebase Dynamic Links* *v1* API can be found at the +//! [official documentation site](https://firebase.google.com/docs/dynamic-links/). +//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/firebasedynamiclinks1). +//! # Features +//! +//! Handle the following *Resources* with ease from the central [hub](struct.FirebaseDynamicLinks.html) ... +//! +//! * short links +//! * [*create*](struct.ShortLinkCreateCall.html) +//! +//! +//! +//! +//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](../index.html). +//! +//! # Structure of this Library +//! +//! The API is structured into the following primary items: +//! +//! * **[Hub](struct.FirebaseDynamicLinks.html)** +//! * a central object to maintain state and allow accessing all *Activities* +//! * creates [*Method Builders*](trait.MethodsBuilder.html) which in turn +//! allow access to individual [*Call Builders*](trait.CallBuilder.html) +//! * **[Resources](trait.Resource.html)** +//! * primary types that you can apply *Activities* to +//! * a collection of properties and *Parts* +//! * **[Parts](trait.Part.html)** +//! * a collection of properties +//! * never directly used in *Activities* +//! * **[Activities](trait.CallBuilder.html)** +//! * operations to apply to *Resources* +//! +//! All *structures* are marked with applicable traits to further categorize them and ease browsing. +//! +//! Generally speaking, you can invoke *Activities* like this: +//! +//! ```Rust,ignore +//! let r = hub.resource().activity(...).doit() +//! ``` +//! +//! Or specifically ... +//! +//! ```ignore +//! let r = hub.short_links().create(...).doit() +//! ``` +//! +//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +//! The `doit()` method performs the actual communication with the server and returns the respective result. +//! +//! # Usage +//! +//! ## Setting up your Project +//! +//! To use this library, you would put the following lines into your `Cargo.toml` file: +//! +//! ```toml +//! [dependencies] +//! google-firebasedynamiclinks1 = "*" +//! ``` +//! +//! ## A complete example +//! +//! ```test_harness,no_run +//! extern crate hyper; +//! extern crate yup_oauth2 as oauth2; +//! extern crate google_firebasedynamiclinks1 as firebasedynamiclinks1; +//! use firebasedynamiclinks1::CreateShortDynamicLinkRequest; +//! use firebasedynamiclinks1::{Result, Error}; +//! # #[test] fn egal() { +//! use std::default::Default; +//! use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +//! use firebasedynamiclinks1::FirebaseDynamicLinks; +//! +//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and +//! // `client_secret`, among other things. +//! let secret: ApplicationSecret = Default::default(); +//! // Instantiate the authenticator. It will choose a suitable authentication flow for you, +//! // unless you replace `None` with the desired Flow. +//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +//! // retrieve them from storage. +//! let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +//! hyper::Client::new(), +//! ::default(), None); +//! let mut hub = FirebaseDynamicLinks::new(hyper::Client::new(), auth); +//! // As the method needs a request, you would usually fill it with the desired information +//! // into the respective structure. Some of the parts shown here might not be applicable ! +//! // Values shown here are possibly random and not representative ! +//! let mut req = CreateShortDynamicLinkRequest::default(); +//! +//! // You can configure optional parameters by calling the respective setters at will, and +//! // execute the final call using `doit()`. +//! // Values shown here are possibly random and not representative ! +//! let result = hub.short_links().create(req) +//! .doit(); +//! +//! match result { +//! Err(e) => match e { +//! // The Error enum provides details about what exactly happened. +//! // You can also just use its `Debug`, `Display` or `Error` traits +//! Error::HttpError(_) +//! |Error::MissingAPIKey +//! |Error::MissingToken(_) +//! |Error::Cancelled +//! |Error::UploadSizeLimitExceeded(_, _) +//! |Error::Failure(_) +//! |Error::BadRequest(_) +//! |Error::FieldClash(_) +//! |Error::JsonDecodeError(_, _) => println!("{}", e), +//! }, +//! Ok(res) => println!("Success: {:?}", res), +//! } +//! # } +//! ``` +//! ## Handling Errors +//! +//! All errors produced by the system are provided either as [Result](enum.Result.html) enumeration as return value of +//! the doit() methods, or handed as possibly intermediate results to either the +//! [Hub Delegate](trait.Delegate.html), or the [Authenticator Delegate](../yup-oauth2/trait.AuthenticatorDelegate.html). +//! +//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +//! makes the system potentially resilient to all kinds of errors. +//! +//! ## Uploads and Downloads +//! If a method supports downloads, the response body, which is part of the [Result](enum.Result.html), should be +//! read by you to obtain the media. +//! If such a method also supports a [Response Result](trait.ResponseResult.html), it will return that by default. +//! You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +//! this call: `.param("alt", "media")`. +//! +//! Methods supporting uploads can do so using up to 2 different protocols: +//! *simple* and *resumable*. The distinctiveness of each is represented by customized +//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. +//! +//! ## Customization and Callbacks +//! +//! You may alter the way an `doit()` method is called by providing a [delegate](trait.Delegate.html) to the +//! [Method Builder](trait.CallBuilder.html) before making the final `doit()` call. +//! Respective methods will be called to provide progress information, as well as determine whether the system should +//! retry on failure. +//! +//! The [delegate trait](trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +//! +//! ## Optional Parts in Server-Requests +//! +//! All structures provided by this library are made to be [enocodable](trait.RequestValue.html) and +//! [decodable](trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +//! are valid. +//! Most optionals are are considered [Parts](trait.Part.html) which are identifiable by name, which will be sent to +//! the server to indicate either the set parts of the request or the desired parts in the response. +//! +//! ## Builder Arguments +//! +//! Using [method builders](trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +//! These will always take a single argument, for which the following statements are true. +//! +//! * [PODs][wiki-pod] are handed by copy +//! * strings are passed as `&str` +//! * [request values](trait.RequestValue.html) are moved +//! +//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times. +//! +//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +//! [google-go-api]: https://github.com/google/google-api-go-client +//! +//! + +// Unused attributes happen thanks to defined, but unused structures +// We don't warn about this, as depending on the API, some data structures or facilities are never used. +// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any +// unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(proc_macro))] +#![allow(unused_imports, unused_mut, dead_code)] + +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-serde-codegen")] +include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/firebasedynamiclinks1/src/lib.rs.in b/gen/firebasedynamiclinks1/src/lib.rs.in new file mode 100644 index 0000000000..9355ee8e5d --- /dev/null +++ b/gen/firebasedynamiclinks1/src/lib.rs.in @@ -0,0 +1,757 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.in.mako' +// DO NOT EDIT ! + +#[cfg(feature = "nightly")] +#[macro_use] +extern crate serde_derive; + +extern crate hyper; +extern crate serde; +extern crate serde_json; +extern crate yup_oauth2 as oauth2; +extern crate mime; +extern crate url; + +mod cmn; + +use std::collections::HashMap; +use std::cell::RefCell; +use std::borrow::BorrowMut; +use std::default::Default; +use std::collections::BTreeMap; +use serde_json as json; +use std::io; +use std::fs; +use std::thread::sleep; +use std::time::Duration; + +pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + Resource, ErrorResponse, remove_json_null_values}; + + +// ############## +// UTILITIES ### +// ############ + +/// Identifies the an OAuth2 authorization scope. +/// A scope is needed when requesting an +/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). +#[derive(PartialEq, Eq, Hash)] +pub enum Scope { + /// View and administer all your Firebase data and settings + Firebase, +} + +impl AsRef for Scope { + fn as_ref(&self) -> &str { + match *self { + Scope::Firebase => "https://www.googleapis.com/auth/firebase", + } + } +} + +impl Default for Scope { + fn default() -> Scope { + Scope::Firebase + } +} + + + +// ######## +// HUB ### +// ###### + +/// Central instance to access all FirebaseDynamicLinks related resource activities +/// +/// # Examples +/// +/// Instantiate a new hub +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_firebasedynamiclinks1 as firebasedynamiclinks1; +/// use firebasedynamiclinks1::CreateShortDynamicLinkRequest; +/// use firebasedynamiclinks1::{Result, Error}; +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use firebasedynamiclinks1::FirebaseDynamicLinks; +/// +/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and +/// // `client_secret`, among other things. +/// let secret: ApplicationSecret = Default::default(); +/// // Instantiate the authenticator. It will choose a suitable authentication flow for you, +/// // unless you replace `None` with the desired Flow. +/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +/// // retrieve them from storage. +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = FirebaseDynamicLinks::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = CreateShortDynamicLinkRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.short_links().create(req) +/// .doit(); +/// +/// match result { +/// Err(e) => match e { +/// // The Error enum provides details about what exactly happened. +/// // You can also just use its `Debug`, `Display` or `Error` traits +/// Error::HttpError(_) +/// |Error::MissingAPIKey +/// |Error::MissingToken(_) +/// |Error::Cancelled +/// |Error::UploadSizeLimitExceeded(_, _) +/// |Error::Failure(_) +/// |Error::BadRequest(_) +/// |Error::FieldClash(_) +/// |Error::JsonDecodeError(_, _) => println!("{}", e), +/// }, +/// Ok(res) => println!("Success: {:?}", res), +/// } +/// # } +/// ``` +pub struct FirebaseDynamicLinks { + client: RefCell, + auth: RefCell, + _user_agent: String, +} + +impl<'a, C, A> Hub for FirebaseDynamicLinks {} + +impl<'a, C, A> FirebaseDynamicLinks + where C: BorrowMut, A: oauth2::GetToken { + + pub fn new(client: C, authenticator: A) -> FirebaseDynamicLinks { + FirebaseDynamicLinks { + client: RefCell::new(client), + auth: RefCell::new(authenticator), + _user_agent: "google-api-rust-client/1.0.0".to_string(), + } + } + + pub fn short_links(&'a self) -> ShortLinkMethods<'a, C, A> { + ShortLinkMethods { hub: &self } + } + + /// Set the user-agent header field to use in all requests to the server. + /// It defaults to `google-api-rust-client/1.0.0`. + /// + /// Returns the previously set user-agent. + pub fn user_agent(&mut self, agent_name: String) -> String { + let prev = self._user_agent.clone(); + self._user_agent = agent_name; + prev + } +} + + +// ############ +// SCHEMAS ### +// ########## +/// Tracking parameters supported by Dynamic Link. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AnalyticsInfo { + /// Google Play Campaign Measurements. + #[serde(rename="googlePlayAnalytics")] + pub google_play_analytics: Option, + /// iTunes Connect App Analytics. + #[serde(rename="itunesConnectAnalytics")] + pub itunes_connect_analytics: Option, +} + +impl Part for AnalyticsInfo {} + + +/// Short Dynamic Link suffix. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Suffix { + /// Suffix option. + pub option: Option, +} + +impl Part for Suffix {} + + +/// Dynamic Links warning messages. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DynamicLinkWarning { + /// The warning code. + #[serde(rename="warningCode")] + pub warning_code: Option, + /// The warning message to help developers improve their requests. + #[serde(rename="warningMessage")] + pub warning_message: Option, +} + +impl Part for DynamicLinkWarning {} + + +/// iOS related attributes to the Dynamic Link.. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct IosInfo { + /// Custom (destination) scheme to use for iOS. By default, we’ll use the + /// bundle ID as the custom scheme. Developer can override this behavior using + /// this param. + #[serde(rename="iosCustomScheme")] + pub ios_custom_scheme: Option, + /// Link to open on iOS if the app is not installed. + #[serde(rename="iosFallbackLink")] + pub ios_fallback_link: Option, + /// iOS bundle ID of the app. + #[serde(rename="iosBundleId")] + pub ios_bundle_id: Option, + /// If specified, this overrides the ios_fallback_link value on iPads. + #[serde(rename="iosIpadFallbackLink")] + pub ios_ipad_fallback_link: Option, + /// iPad bundle ID of the app. + #[serde(rename="iosIpadBundleId")] + pub ios_ipad_bundle_id: Option, + /// iOS App Store ID. + #[serde(rename="iosAppStoreId")] + pub ios_app_store_id: Option, +} + +impl Part for IosInfo {} + + +/// Android related attributes to the Dynamic Link. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AndroidInfo { + /// Link to open on Android if the app is not installed. + #[serde(rename="androidFallbackLink")] + pub android_fallback_link: Option, + /// Android package name of the app. + #[serde(rename="androidPackageName")] + pub android_package_name: Option, + /// If specified, this overrides the ‘link’ parameter on Android. + #[serde(rename="androidLink")] + pub android_link: Option, + /// Minimum version code for the Android app. If the installed app’s version + /// code is lower, then the user is taken to the Play Store. + #[serde(rename="androidMinPackageVersionCode")] + pub android_min_package_version_code: Option, +} + +impl Part for AndroidInfo {} + + +/// Parameters for social meta tag params. +/// Used to set meta tag data for link previews on social sites. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SocialMetaTagInfo { + /// Title to be displayed. Optional. + #[serde(rename="socialTitle")] + pub social_title: Option, + /// A short description of the link. Optional. + #[serde(rename="socialDescription")] + pub social_description: Option, + /// An image url string. Optional. + #[serde(rename="socialImageLink")] + pub social_image_link: Option, +} + +impl Part for SocialMetaTagInfo {} + + +/// Request to create a short Dynamic Link. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [create short links](struct.ShortLinkCreateCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreateShortDynamicLinkRequest { + /// Information about the Dynamic Link to be shortened. + /// [Learn more](https://firebase.google.com/docs/dynamic-links/android#create-a-dynamic-link-programmatically). + #[serde(rename="dynamicLinkInfo")] + pub dynamic_link_info: Option, + /// Full long Dynamic Link URL with desired query parameters specified. + /// For example, + /// "https://sample.app.goo.gl/?link=http://www.google.com&apn=com.sample", + /// [Learn more](https://firebase.google.com/docs/dynamic-links/android#create-a-dynamic-link-programmatically). + #[serde(rename="longDynamicLink")] + pub long_dynamic_link: Option, + /// Short Dynamic Link suffix. Optional. + pub suffix: Option, +} + +impl RequestValue for CreateShortDynamicLinkRequest {} + + +/// Parameters for iTunes Connect App Analytics. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ITunesConnectAnalytics { + /// iTune media types, including music, podcasts, audiobooks and so on. + pub mt: Option, + /// Affiliate token used to create affiliate-coded links. + pub at: Option, + /// Provider token that enables analytics for Dynamic Links from within iTunes + /// Connect. + pub pt: Option, + /// Campaign text that developers can optionally add to any link in order to + /// track sales from a specific marketing campaign. + pub ct: Option, +} + +impl Part for ITunesConnectAnalytics {} + + +/// Parameters for Google Play Campaign Measurements. +/// [Learn more](https://developers.google.com/analytics/devguides/collection/android/v4/campaigns#campaign-params) +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GooglePlayAnalytics { + /// Campaign medium; used to identify a medium such as email or cost-per-click. + #[serde(rename="utmMedium")] + pub utm_medium: Option, + /// Campaign content; used for A/B testing and content-targeted ads to + /// differentiate ads or links that point to the same URL. + #[serde(rename="utmContent")] + pub utm_content: Option, + /// Campaign source; used to identify a search engine, newsletter, or other + /// source. + #[serde(rename="utmSource")] + pub utm_source: Option, + /// [AdWords autotagging parameter](https://support.google.com/analytics/answer/1033981?hl=en); + /// used to measure Google AdWords ads. This value is generated dynamically + /// and should never be modified. + pub gclid: Option, + /// Campaign name; used for keyword analysis to identify a specific product + /// promotion or strategic campaign. + #[serde(rename="utmCampaign")] + pub utm_campaign: Option, + /// Campaign term; used with paid search to supply the keywords for ads. + #[serde(rename="utmTerm")] + pub utm_term: Option, +} + +impl Part for GooglePlayAnalytics {} + + +/// Information about a Dynamic Link. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DynamicLinkInfo { + /// Parameters used for tracking. See all tracking parameters in the + /// [documentation](https://firebase.google.com/docs/dynamic-links/android#create-a-dynamic-link-programmatically). + #[serde(rename="analyticsInfo")] + pub analytics_info: Option, + /// The link your app will open, You can specify any URL your app can handle. + /// This link must be a well-formatted URL, be properly URL-encoded, and use + /// the HTTP or HTTPS scheme. See 'link' parameters in the + /// [documentation](https://firebase.google.com/docs/dynamic-links/android#create-a-dynamic-link-programmatically). + /// + /// Required. + pub link: Option, + /// iOS related information. See iOS related parameters in the + /// [documentation](https://firebase.google.com/docs/dynamic-links/ios#create-a-dynamic-link-programmatically). + #[serde(rename="iosInfo")] + pub ios_info: Option, + /// Android related information. See Android related parameters in the + /// [documentation](https://firebase.google.com/docs/dynamic-links/android#create-a-dynamic-link-programmatically). + #[serde(rename="androidInfo")] + pub android_info: Option, + /// Parameters for social meta tag params. + /// Used to set meta tag data for link previews on social sites. + #[serde(rename="socialMetaTagInfo")] + pub social_meta_tag_info: Option, + /// Dynamic Links domain that the project owns, e.g. abcd.app.goo.gl + /// [Learn more](https://firebase.google.com/docs/dynamic-links/android#set-up-firebase-and-the-dynamic-links-sdk) + /// on how to set up Dynamic Link domain associated with your Firebase project. + /// + /// Required. + #[serde(rename="dynamicLinkDomain")] + pub dynamic_link_domain: Option, +} + +impl Part for DynamicLinkInfo {} + + +/// Response to create a short Dynamic Link. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [create short links](struct.ShortLinkCreateCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreateShortDynamicLinkResponse { + /// Preivew link to show the link flow chart. + #[serde(rename="previewLink")] + pub preview_link: Option, + /// Information about potential warnings on link creation. + pub warning: Option>, + /// Short Dynamic Link value. e.g. https://abcd.app.goo.gl/wxyz + #[serde(rename="shortLink")] + pub short_link: Option, +} + +impl ResponseResult for CreateShortDynamicLinkResponse {} + + + +// ################### +// MethodBuilders ### +// ################# + +/// A builder providing access to all methods supported on *shortLink* resources. +/// It is not used directly, but through the `FirebaseDynamicLinks` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_firebasedynamiclinks1 as firebasedynamiclinks1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use firebasedynamiclinks1::FirebaseDynamicLinks; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = FirebaseDynamicLinks::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `create(...)` +/// // to build up your call. +/// let rb = hub.short_links(); +/// # } +/// ``` +pub struct ShortLinkMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a FirebaseDynamicLinks, +} + +impl<'a, C, A> MethodsBuilder for ShortLinkMethods<'a, C, A> {} + +impl<'a, C, A> ShortLinkMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Creates a short Dynamic Link given either a valid long Dynamic Link or + /// details such as Dynamic Link domain, Android and iOS app information. + /// The created short Dynamic Link will not expire. + /// + /// Repeated calls with the same long Dynamic Link or Dynamic Link information + /// will produce the same short Dynamic Link. + /// + /// The Dynamic Link domain in the request must be owned by requester's + /// Firebase project. + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn create(&self, request: CreateShortDynamicLinkRequest) -> ShortLinkCreateCall<'a, C, A> { + ShortLinkCreateCall { + hub: self.hub, + _request: request, + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + + + +// ################### +// CallBuilders ### +// ################# + +/// Creates a short Dynamic Link given either a valid long Dynamic Link or +/// details such as Dynamic Link domain, Android and iOS app information. +/// The created short Dynamic Link will not expire. +/// +/// Repeated calls with the same long Dynamic Link or Dynamic Link information +/// will produce the same short Dynamic Link. +/// +/// The Dynamic Link domain in the request must be owned by requester's +/// Firebase project. +/// +/// A builder for the *create* method supported by a *shortLink* resource. +/// It is not used directly, but through a `ShortLinkMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_firebasedynamiclinks1 as firebasedynamiclinks1; +/// use firebasedynamiclinks1::CreateShortDynamicLinkRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use firebasedynamiclinks1::FirebaseDynamicLinks; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = FirebaseDynamicLinks::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = CreateShortDynamicLinkRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.short_links().create(req) +/// .doit(); +/// # } +/// ``` +pub struct ShortLinkCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a FirebaseDynamicLinks, + _request: CreateShortDynamicLinkRequest, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ShortLinkCreateCall<'a, C, A> {} + +impl<'a, C, A> ShortLinkCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreateShortDynamicLinkResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "firebasedynamiclinks.shortLinks.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + for &field in ["alt"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://firebasedynamiclinks.googleapis.com/v1/shortLinks".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Firebase.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: CreateShortDynamicLinkRequest) -> ShortLinkCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ShortLinkCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ShortLinkCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Firebase`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ShortLinkCreateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + diff --git a/gen/fitness1-cli/Cargo.toml b/gen/fitness1-cli/Cargo.toml index b19257e412..a0fa2b2c98 100644 --- a/gen/fitness1-cli/Cargo.toml +++ b/gen/fitness1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-fitness1-cli" -version = "1.0.0+20160801" +version = "1.0.0+20161128" authors = ["Sebastian Thiel "] description = "A complete library to interact with fitness (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/fitness1-cli" diff --git a/gen/fitness1-cli/README.md b/gen/fitness1-cli/README.md index aeca2c9933..c099ce9475 100644 --- a/gen/fitness1-cli/README.md +++ b/gen/fitness1-cli/README.md @@ -24,7 +24,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *fitness* API at revision *20160801*. The CLI is at version *1.0.0*. +This documentation was generated from the *fitness* API at revision *20161128*. The CLI is at version *1.0.0*. ```bash fitness1 [options] diff --git a/gen/fitness1-cli/mkdocs.yml b/gen/fitness1-cli/mkdocs.yml index cc08dcc47d..b90c1556e5 100644 --- a/gen/fitness1-cli/mkdocs.yml +++ b/gen/fitness1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: fitness v1.0.0+20160801 +site_name: fitness v1.0.0+20161128 site_url: http://byron.github.io/google-apis-rs/google-fitness1-cli site_description: Write integrating applications with bcore diff --git a/gen/fitness1-cli/src/main.rs b/gen/fitness1-cli/src/main.rs index d66926e6f3..bbefba4946 100644 --- a/gen/fitness1-cli/src/main.rs +++ b/gen/fitness1-cli/src/main.rs @@ -1540,7 +1540,7 @@ fn main() { let mut app = App::new("fitness1") .author("Sebastian Thiel ") - .version("1.0.0+20160801") + .version("1.0.0+20161128") .about("Stores and accesses user data in the fitness store from apps on any platform.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_fitness1_cli") .arg(Arg::with_name("url") diff --git a/gen/fitness1/Cargo.toml b/gen/fitness1/Cargo.toml index 3ba2a42a65..0a9ab30f4a 100644 --- a/gen/fitness1/Cargo.toml +++ b/gen/fitness1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-fitness1" -version = "1.0.0+20160801" +version = "1.0.0+20161128" authors = ["Sebastian Thiel "] description = "A complete library to interact with fitness (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/fitness1" diff --git a/gen/fitness1/README.md b/gen/fitness1/README.md index ba30a26300..fa4b2e150a 100644 --- a/gen/fitness1/README.md +++ b/gen/fitness1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-fitness1` library allows access to all features of the *Google fitness* service. -This documentation was generated from *fitness* crate version *1.0.0+20160801*, where *20160801* is the exact revision of the *fitness:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *fitness* crate version *1.0.0+20161128*, where *20161128* is the exact revision of the *fitness:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *fitness* *v1* API can be found at the [official documentation site](https://developers.google.com/fit/rest/). diff --git a/gen/fitness1/src/lib.rs b/gen/fitness1/src/lib.rs index 742dd27392..d25407de60 100644 --- a/gen/fitness1/src/lib.rs +++ b/gen/fitness1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *fitness* crate version *1.0.0+20160801*, where *20160801* is the exact revision of the *fitness:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *fitness* crate version *1.0.0+20161128*, where *20161128* is the exact revision of the *fitness:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *fitness* *v1* API can be found at the //! [official documentation site](https://developers.google.com/fit/rest/). diff --git a/gen/fitness1/src/lib.rs.in b/gen/fitness1/src/lib.rs.in index 906a2d4c0d..d9d6fa8abf 100644 --- a/gen/fitness1/src/lib.rs.in +++ b/gen/fitness1/src/lib.rs.in @@ -43,17 +43,44 @@ pub enum Scope { /// View body sensor information in Google Fit BodyRead, - /// View and store body sensor data in Google Fit - BodyWrite, + /// View and store reproductive health data in Google Fit + ReproductiveHealthWrite, + + /// View blood pressure data in Google Fit + BloodPressureRead, + + /// View and store nutrition information in Google Fit + NutritionWrite, + + /// View and store blood glucose data in Google Fit + BloodGlucoseWrite, + + /// View and store oxygen saturation data in Google Fit + OxygenSaturationWrite, /// View and store your location data in Google Fit LocationWrite, + /// View reproductive health data in Google Fit + ReproductiveHealthRead, + + /// View and store body temperature data in Google Fit + BodyTemperatureWrite, + + /// View and store body sensor data in Google Fit + BodyWrite, + + /// View your activity information in Google Fit + ActivityRead, + /// View your stored location data in Google Fit LocationRead, - /// View and store nutrition information in Google Fit - NutritionWrite, + /// View and store blood pressure data in Google Fit + BloodPressureWrite, + + /// View body temperature data in Google Fit + BodyTemperatureRead, /// View and store your activity information in Google Fit ActivityWrite, @@ -61,21 +88,34 @@ pub enum Scope { /// View nutrition information in Google Fit NutritionRead, - /// View your activity information in Google Fit - ActivityRead, + /// View blood glucose data in Google Fit + BloodGlucoseRead, + + /// View oxygen saturation data in Google Fit + OxygenSaturationRead, } impl AsRef for Scope { fn as_ref(&self) -> &str { match *self { Scope::BodyRead => "https://www.googleapis.com/auth/fitness.body.read", - Scope::BodyWrite => "https://www.googleapis.com/auth/fitness.body.write", - Scope::LocationWrite => "https://www.googleapis.com/auth/fitness.location.write", - Scope::LocationRead => "https://www.googleapis.com/auth/fitness.location.read", + Scope::ReproductiveHealthWrite => "https://www.googleapis.com/auth/fitness.reproductive_health.write", + Scope::BloodPressureRead => "https://www.googleapis.com/auth/fitness.blood_pressure.read", Scope::NutritionWrite => "https://www.googleapis.com/auth/fitness.nutrition.write", + Scope::BloodGlucoseWrite => "https://www.googleapis.com/auth/fitness.blood_glucose.write", + Scope::OxygenSaturationWrite => "https://www.googleapis.com/auth/fitness.oxygen_saturation.write", + Scope::LocationWrite => "https://www.googleapis.com/auth/fitness.location.write", + Scope::ReproductiveHealthRead => "https://www.googleapis.com/auth/fitness.reproductive_health.read", + Scope::BodyTemperatureWrite => "https://www.googleapis.com/auth/fitness.body_temperature.write", + Scope::BodyWrite => "https://www.googleapis.com/auth/fitness.body.write", + Scope::ActivityRead => "https://www.googleapis.com/auth/fitness.activity.read", + Scope::LocationRead => "https://www.googleapis.com/auth/fitness.location.read", + Scope::BloodPressureWrite => "https://www.googleapis.com/auth/fitness.blood_pressure.write", + Scope::BodyTemperatureRead => "https://www.googleapis.com/auth/fitness.body_temperature.read", Scope::ActivityWrite => "https://www.googleapis.com/auth/fitness.activity.write", Scope::NutritionRead => "https://www.googleapis.com/auth/fitness.nutrition.read", - Scope::ActivityRead => "https://www.googleapis.com/auth/fitness.activity.read", + Scope::BloodGlucoseRead => "https://www.googleapis.com/auth/fitness.blood_glucose.read", + Scope::OxygenSaturationRead => "https://www.googleapis.com/auth/fitness.oxygen_saturation.read", } } } @@ -222,7 +262,7 @@ impl Part for ValueMapValEntry {} /// Holder object for the value of a single field in a data point. /// -/// A field value has a particular format and is only ever set to one of an integer or a floating point value. +/// A field value has a particular format and is only ever set to one of an integer or a floating point value. LINT.IfChange /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -336,6 +376,9 @@ impl Part for DataPoint {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListSessionsResponse { + /// Flag to indicate server has more data to transfer + #[serde(rename="hasMoreData")] + pub has_more_data: Option, /// The continuation token, which is used to page through large result sets. Provide this value in a subsequent request to return the next page of results. #[serde(rename="nextPageToken")] pub next_page_token: Option, @@ -392,7 +435,7 @@ pub struct BucketByActivity { impl Part for BucketByActivity {} -/// There is no detailed description. +/// Next id: 10 /// /// # Activities /// diff --git a/gen/games1-cli/Cargo.toml b/gen/games1-cli/Cargo.toml index 85e985b29f..d488e3927f 100644 --- a/gen/games1-cli/Cargo.toml +++ b/gen/games1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-games1-cli" -version = "1.0.0+20160901" +version = "1.0.0+20161207" authors = ["Sebastian Thiel "] description = "A complete library to interact with Games (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/games1-cli" diff --git a/gen/games1-cli/README.md b/gen/games1-cli/README.md index 83b2f1c017..18086a4821 100644 --- a/gen/games1-cli/README.md +++ b/gen/games1-cli/README.md @@ -24,7 +24,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Games* API at revision *20160901*. The CLI is at version *1.0.0*. +This documentation was generated from the *Games* API at revision *20161207*. The CLI is at version *1.0.0*. ```bash games1 [options] diff --git a/gen/games1-cli/mkdocs.yml b/gen/games1-cli/mkdocs.yml index ae47220fca..2732ef3fc5 100644 --- a/gen/games1-cli/mkdocs.yml +++ b/gen/games1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Games v1.0.0+20160901 +site_name: Games v1.0.0+20161207 site_url: http://byron.github.io/google-apis-rs/google-games1-cli site_description: Write integrating applications with bcore diff --git a/gen/games1-cli/src/main.rs b/gen/games1-cli/src/main.rs index dcc93bb59f..796dd8e1d1 100644 --- a/gen/games1-cli/src/main.rs +++ b/gen/games1-cli/src/main.rs @@ -5259,7 +5259,7 @@ fn main() { let mut app = App::new("games1") .author("Sebastian Thiel ") - .version("1.0.0+20160901") + .version("1.0.0+20161207") .about("The API for Google Play Game Services.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_games1_cli") .arg(Arg::with_name("url") diff --git a/gen/games1/Cargo.toml b/gen/games1/Cargo.toml index 317ef272c0..a3fd2a38c9 100644 --- a/gen/games1/Cargo.toml +++ b/gen/games1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-games1" -version = "1.0.0+20160901" +version = "1.0.0+20161207" authors = ["Sebastian Thiel "] description = "A complete library to interact with Games (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/games1" diff --git a/gen/games1/README.md b/gen/games1/README.md index a847fafd84..2725eb0025 100644 --- a/gen/games1/README.md +++ b/gen/games1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-games1` library allows access to all features of the *Google Games* service. -This documentation was generated from *Games* crate version *1.0.0+20160901*, where *20160901* is the exact revision of the *games:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *Games* crate version *1.0.0+20161207*, where *20161207* is the exact revision of the *games:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *Games* *v1* API can be found at the [official documentation site](https://developers.google.com/games/services/). diff --git a/gen/games1/src/lib.rs b/gen/games1/src/lib.rs index 932e040757..e43f064308 100644 --- a/gen/games1/src/lib.rs +++ b/gen/games1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Games* crate version *1.0.0+20160901*, where *20160901* is the exact revision of the *games:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *Games* crate version *1.0.0+20161207*, where *20161207* is the exact revision of the *games:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *Games* *v1* API can be found at the //! [official documentation site](https://developers.google.com/games/services/). diff --git a/gen/gamesconfiguration1_configuration-cli/Cargo.toml b/gen/gamesconfiguration1_configuration-cli/Cargo.toml index d9dd0dee3c..4730824978 100644 --- a/gen/gamesconfiguration1_configuration-cli/Cargo.toml +++ b/gen/gamesconfiguration1_configuration-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-gamesconfiguration1_configuration-cli" -version = "1.0.0+20160901" +version = "1.0.0+20161207" authors = ["Sebastian Thiel "] description = "A complete library to interact with Games Configuration (protocol v1configuration)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/gamesconfiguration1_configuration-cli" diff --git a/gen/gamesconfiguration1_configuration-cli/README.md b/gen/gamesconfiguration1_configuration-cli/README.md index a20458c39b..163fabde5c 100644 --- a/gen/gamesconfiguration1_configuration-cli/README.md +++ b/gen/gamesconfiguration1_configuration-cli/README.md @@ -24,7 +24,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Games Configuration* API at revision *20160901*. The CLI is at version *1.0.0*. +This documentation was generated from the *Games Configuration* API at revision *20161207*. The CLI is at version *1.0.0*. ```bash gamesconfiguration1-configuration [options] diff --git a/gen/gamesconfiguration1_configuration-cli/mkdocs.yml b/gen/gamesconfiguration1_configuration-cli/mkdocs.yml index fc56c5bfaa..11314a6464 100644 --- a/gen/gamesconfiguration1_configuration-cli/mkdocs.yml +++ b/gen/gamesconfiguration1_configuration-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Games Configuration v1.0.0+20160901 +site_name: Games Configuration v1.0.0+20161207 site_url: http://byron.github.io/google-apis-rs/google-gamesconfiguration1_configuration-cli site_description: Write integrating applications with bcore diff --git a/gen/gamesconfiguration1_configuration-cli/src/main.rs b/gen/gamesconfiguration1_configuration-cli/src/main.rs index cb1e852303..921fdd187a 100644 --- a/gen/gamesconfiguration1_configuration-cli/src/main.rs +++ b/gen/gamesconfiguration1_configuration-cli/src/main.rs @@ -1551,7 +1551,7 @@ fn main() { let mut app = App::new("gamesconfiguration1-configuration") .author("Sebastian Thiel ") - .version("1.0.0+20160901") + .version("1.0.0+20161207") .about("The Publishing API for Google Play Game Services.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_gamesconfiguration1_configuration_cli") .arg(Arg::with_name("url") diff --git a/gen/gamesconfiguration1_configuration/Cargo.toml b/gen/gamesconfiguration1_configuration/Cargo.toml index af10ff361e..87d3a691eb 100644 --- a/gen/gamesconfiguration1_configuration/Cargo.toml +++ b/gen/gamesconfiguration1_configuration/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-gamesconfiguration1_configuration" -version = "1.0.0+20160901" +version = "1.0.0+20161207" authors = ["Sebastian Thiel "] description = "A complete library to interact with Games Configuration (protocol v1configuration)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/gamesconfiguration1_configuration" diff --git a/gen/gamesconfiguration1_configuration/README.md b/gen/gamesconfiguration1_configuration/README.md index 6d9bab7acc..ebd2567f36 100644 --- a/gen/gamesconfiguration1_configuration/README.md +++ b/gen/gamesconfiguration1_configuration/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-gamesconfiguration1_configuration` library allows access to all features of the *Google Games Configuration* service. -This documentation was generated from *Games Configuration* crate version *1.0.0+20160901*, where *20160901* is the exact revision of the *gamesConfiguration:v1configuration* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *Games Configuration* crate version *1.0.0+20161207*, where *20161207* is the exact revision of the *gamesConfiguration:v1configuration* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *Games Configuration* *v1_configuration* API can be found at the [official documentation site](https://developers.google.com/games/services). diff --git a/gen/gamesconfiguration1_configuration/src/lib.rs b/gen/gamesconfiguration1_configuration/src/lib.rs index 854d579042..4990110aae 100644 --- a/gen/gamesconfiguration1_configuration/src/lib.rs +++ b/gen/gamesconfiguration1_configuration/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Games Configuration* crate version *1.0.0+20160901*, where *20160901* is the exact revision of the *gamesConfiguration:v1configuration* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *Games Configuration* crate version *1.0.0+20161207*, where *20161207* is the exact revision of the *gamesConfiguration:v1configuration* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *Games Configuration* *v1_configuration* API can be found at the //! [official documentation site](https://developers.google.com/games/services). diff --git a/gen/gamesmanagement1_management-cli/Cargo.toml b/gen/gamesmanagement1_management-cli/Cargo.toml index dcc1356679..14e67f0f28 100644 --- a/gen/gamesmanagement1_management-cli/Cargo.toml +++ b/gen/gamesmanagement1_management-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-gamesmanagement1_management-cli" -version = "1.0.0+20160901" +version = "1.0.0+20161207" authors = ["Sebastian Thiel "] description = "A complete library to interact with Games Management (protocol v1management)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/gamesmanagement1_management-cli" diff --git a/gen/gamesmanagement1_management-cli/README.md b/gen/gamesmanagement1_management-cli/README.md index 0d9ce8552c..c1254d17af 100644 --- a/gen/gamesmanagement1_management-cli/README.md +++ b/gen/gamesmanagement1_management-cli/README.md @@ -24,7 +24,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Games Management* API at revision *20160901*. The CLI is at version *1.0.0*. +This documentation was generated from the *Games Management* API at revision *20161207*. The CLI is at version *1.0.0*. ```bash gamesmanagement1-management [options] diff --git a/gen/gamesmanagement1_management-cli/mkdocs.yml b/gen/gamesmanagement1_management-cli/mkdocs.yml index 42a4c04559..ad94bc9bee 100644 --- a/gen/gamesmanagement1_management-cli/mkdocs.yml +++ b/gen/gamesmanagement1_management-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Games Management v1.0.0+20160901 +site_name: Games Management v1.0.0+20161207 site_url: http://byron.github.io/google-apis-rs/google-gamesmanagement1_management-cli site_description: Write integrating applications with bcore diff --git a/gen/gamesmanagement1_management-cli/src/main.rs b/gen/gamesmanagement1_management-cli/src/main.rs index c9b426b030..faa4b1852a 100644 --- a/gen/gamesmanagement1_management-cli/src/main.rs +++ b/gen/gamesmanagement1_management-cli/src/main.rs @@ -2078,7 +2078,7 @@ fn main() { let mut app = App::new("gamesmanagement1-management") .author("Sebastian Thiel ") - .version("1.0.0+20160901") + .version("1.0.0+20161207") .about("The Management API for Google Play Game Services.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_gamesmanagement1_management_cli") .arg(Arg::with_name("url") diff --git a/gen/gamesmanagement1_management/Cargo.toml b/gen/gamesmanagement1_management/Cargo.toml index 51d803e569..ba2210f71d 100644 --- a/gen/gamesmanagement1_management/Cargo.toml +++ b/gen/gamesmanagement1_management/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-gamesmanagement1_management" -version = "1.0.0+20160901" +version = "1.0.0+20161207" authors = ["Sebastian Thiel "] description = "A complete library to interact with Games Management (protocol v1management)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/gamesmanagement1_management" diff --git a/gen/gamesmanagement1_management/README.md b/gen/gamesmanagement1_management/README.md index 069700f110..8dc77897c7 100644 --- a/gen/gamesmanagement1_management/README.md +++ b/gen/gamesmanagement1_management/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-gamesmanagement1_management` library allows access to all features of the *Google Games Management* service. -This documentation was generated from *Games Management* crate version *1.0.0+20160901*, where *20160901* is the exact revision of the *gamesManagement:v1management* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *Games Management* crate version *1.0.0+20161207*, where *20161207* is the exact revision of the *gamesManagement:v1management* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *Games Management* *v1_management* API can be found at the [official documentation site](https://developers.google.com/games/services). diff --git a/gen/gamesmanagement1_management/src/lib.rs b/gen/gamesmanagement1_management/src/lib.rs index 65e403eccd..dc22372919 100644 --- a/gen/gamesmanagement1_management/src/lib.rs +++ b/gen/gamesmanagement1_management/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Games Management* crate version *1.0.0+20160901*, where *20160901* is the exact revision of the *gamesManagement:v1management* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *Games Management* crate version *1.0.0+20161207*, where *20161207* is the exact revision of the *gamesManagement:v1management* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *Games Management* *v1_management* API can be found at the //! [official documentation site](https://developers.google.com/games/services). diff --git a/gen/genomics1-cli/Cargo.toml b/gen/genomics1-cli/Cargo.toml index 50fe7b5bc4..4bb5362eab 100644 --- a/gen/genomics1-cli/Cargo.toml +++ b/gen/genomics1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-genomics1-cli" -version = "1.0.0+20160905" +version = "1.0.0+20160928" authors = ["Sebastian Thiel "] description = "A complete library to interact with genomics (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/genomics1-cli" diff --git a/gen/genomics1-cli/README.md b/gen/genomics1-cli/README.md index 34d063aab0..6cecdfe4ba 100644 --- a/gen/genomics1-cli/README.md +++ b/gen/genomics1-cli/README.md @@ -24,7 +24,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *genomics* API at revision *20160905*. The CLI is at version *1.0.0*. +This documentation was generated from the *genomics* API at revision *20160928*. The CLI is at version *1.0.0*. ```bash genomics1 [options] diff --git a/gen/genomics1-cli/mkdocs.yml b/gen/genomics1-cli/mkdocs.yml index 8b29aef4f8..c52b9047f8 100644 --- a/gen/genomics1-cli/mkdocs.yml +++ b/gen/genomics1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: genomics v1.0.0+20160905 +site_name: genomics v1.0.0+20160928 site_url: http://byron.github.io/google-apis-rs/google-genomics1-cli site_description: Write integrating applications with bcore diff --git a/gen/genomics1-cli/src/main.rs b/gen/genomics1-cli/src/main.rs index bcdc58c5cb..0218a7d8e5 100644 --- a/gen/genomics1-cli/src/main.rs +++ b/gen/genomics1-cli/src/main.rs @@ -6040,7 +6040,7 @@ fn main() { let mut app = App::new("genomics1") .author("Sebastian Thiel ") - .version("1.0.0+20160905") + .version("1.0.0+20160928") .about("Stores, processes, explores and shares genomic data.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_genomics1_cli") .arg(Arg::with_name("url") diff --git a/gen/genomics1/Cargo.toml b/gen/genomics1/Cargo.toml index 038c317315..1e0e87432d 100644 --- a/gen/genomics1/Cargo.toml +++ b/gen/genomics1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-genomics1" -version = "1.0.0+20160905" +version = "1.0.0+20160928" authors = ["Sebastian Thiel "] description = "A complete library to interact with genomics (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/genomics1" diff --git a/gen/genomics1/README.md b/gen/genomics1/README.md index 61b45e0c5c..65e77e67ca 100644 --- a/gen/genomics1/README.md +++ b/gen/genomics1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-genomics1` library allows access to all features of the *Google genomics* service. -This documentation was generated from *genomics* crate version *1.0.0+20160905*, where *20160905* is the exact revision of the *genomics:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *genomics* crate version *1.0.0+20160928*, where *20160928* is the exact revision of the *genomics:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *genomics* *v1* API can be found at the [official documentation site](https://cloud.google.com/genomics/). diff --git a/gen/genomics1/src/lib.rs b/gen/genomics1/src/lib.rs index 4fea7c816e..e9c77c5917 100644 --- a/gen/genomics1/src/lib.rs +++ b/gen/genomics1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *genomics* crate version *1.0.0+20160905*, where *20160905* is the exact revision of the *genomics:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *genomics* crate version *1.0.0+20160928*, where *20160928* is the exact revision of the *genomics:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *genomics* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/genomics/). diff --git a/gen/genomics1/src/lib.rs.in b/gen/genomics1/src/lib.rs.in index 9932c51942..a3f3deabdb 100644 --- a/gen/genomics1/src/lib.rs.in +++ b/gen/genomics1/src/lib.rs.in @@ -1048,7 +1048,7 @@ pub struct Operation { pub response: Option>, /// The server-assigned name, which is only unique within the same service that originally returns it. For example: `operations/CJHU7Oi_ChDrveSpBRjfuL-qzoWAgEw` pub name: Option, - /// The error result of the operation in case of failure. + /// The error result of the operation in case of failure or cancellation. pub error: Option, } @@ -4257,7 +4257,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: self._page_size = Some(new_value); self } - /// A string for filtering Operations. The following filter fields are supported: * projectId: Required. Corresponds to OperationMetadata.projectId. * createTime: The time this job was created, in seconds from the [epoch](http://en.wikipedia.org/wiki/Unix_time). Can use `>=` and/or `= 1432140000` * `projectId = my-project AND createTime >= 1432140000 AND createTime <= 1432150000 AND status = RUNNING` + /// A string for filtering Operations. The following filter fields are supported: * projectId: Required. Corresponds to OperationMetadata.projectId. * createTime: The time this job was created, in seconds from the [epoch](http://en.wikipedia.org/wiki/Unix_time). Can use `>=` and/or `= 1432140000` * `projectId = my-project AND createTime >= 1432140000 AND createTime <= 1432150000 AND status = RUNNING` * `projectId = my-project AND labels.color = *` * `projectId = my-project AND labels.color = red` /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> OperationListCall<'a, C, A> { diff --git a/gen/gmail1-cli/Cargo.toml b/gen/gmail1-cli/Cargo.toml index bf8c9e414c..7b4cfd3f10 100644 --- a/gen/gmail1-cli/Cargo.toml +++ b/gen/gmail1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-gmail1-cli" -version = "1.0.0+20160711" +version = "1.0.0+20161206" authors = ["Sebastian Thiel "] description = "A complete library to interact with gmail (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/gmail1-cli" diff --git a/gen/gmail1-cli/README.md b/gen/gmail1-cli/README.md index 3e4a0b2593..39335aa05f 100644 --- a/gen/gmail1-cli/README.md +++ b/gen/gmail1-cli/README.md @@ -24,7 +24,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *gmail* API at revision *20160711*. The CLI is at version *1.0.0*. +This documentation was generated from the *gmail* API at revision *20161206*. The CLI is at version *1.0.0*. ```bash gmail1 [options] @@ -45,6 +45,7 @@ gmail1 [options] labels-update (-r )... [-p ]... [-o ] messages-attachments-get [-p ]... [-o ] messages-batch-delete (-r )... [-p ]... + messages-batch-modify (-r )... [-p ]... messages-delete [-p ]... messages-get [-p ]... [-o ] messages-import (-r )... (-u (simple|resumable) -f [-m ]) [-p ]... [-o ] diff --git a/gen/gmail1-cli/mkdocs.yml b/gen/gmail1-cli/mkdocs.yml index 5bc7f76ab0..1391504511 100644 --- a/gen/gmail1-cli/mkdocs.yml +++ b/gen/gmail1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: gmail v1.0.0+20160711 +site_name: gmail v1.0.0+20161206 site_url: http://byron.github.io/google-apis-rs/google-gmail1-cli site_description: Write integrating applications with bcore @@ -25,6 +25,7 @@ pages: - ['users_labels-update.md', 'Users', 'Labels Update'] - ['users_messages-attachments-get.md', 'Users', 'Messages Attachments Get'] - ['users_messages-batch-delete.md', 'Users', 'Messages Batch Delete'] +- ['users_messages-batch-modify.md', 'Users', 'Messages Batch Modify'] - ['users_messages-delete.md', 'Users', 'Messages Delete'] - ['users_messages-get.md', 'Users', 'Messages Get'] - ['users_messages-import.md', 'Users', 'Messages Import'] diff --git a/gen/gmail1-cli/src/main.rs b/gen/gmail1-cli/src/main.rs index 70c70343e2..7a1647039a 100644 --- a/gen/gmail1-cli/src/main.rs +++ b/gen/gmail1-cli/src/main.rs @@ -1192,6 +1192,85 @@ impl<'n> Engine<'n> { } } + fn _users_messages_batch_modify(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "remove-label-ids" => Some(("removeLabelIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "ids" => Some(("ids", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "add-label-ids" => Some(("addLabelIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["add-label-ids", "ids", "remove-label-ids"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::BatchModifyMessagesRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.users().messages_batch_modify(request, opt.value_of("user-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + fn _users_messages_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.users().messages_delete(opt.value_of("user-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); @@ -3949,6 +4028,9 @@ impl<'n> Engine<'n> { ("messages-batch-delete", Some(opt)) => { call_result = self._users_messages_batch_delete(opt, dry_run, &mut err); }, + ("messages-batch-modify", Some(opt)) => { + call_result = self._users_messages_batch_modify(opt, dry_run, &mut err); + }, ("messages-delete", Some(opt)) => { call_result = self._users_messages_delete(opt, dry_run, &mut err); }, @@ -4158,7 +4240,7 @@ fn main() { let mut exit_status = 0i32; let upload_value_names = ["mode", "file"]; let arg_data = [ - ("users", "methods: 'drafts-create', 'drafts-delete', 'drafts-get', 'drafts-list', 'drafts-send', 'drafts-update', 'get-profile', 'history-list', 'labels-create', 'labels-delete', 'labels-get', 'labels-list', 'labels-patch', 'labels-update', 'messages-attachments-get', 'messages-batch-delete', 'messages-delete', 'messages-get', 'messages-import', 'messages-insert', 'messages-list', 'messages-modify', 'messages-send', 'messages-trash', 'messages-untrash', 'settings-filters-create', 'settings-filters-delete', 'settings-filters-get', 'settings-filters-list', 'settings-forwarding-addresses-create', 'settings-forwarding-addresses-delete', 'settings-forwarding-addresses-get', 'settings-forwarding-addresses-list', 'settings-get-auto-forwarding', 'settings-get-imap', 'settings-get-pop', 'settings-get-vacation', 'settings-send-as-create', 'settings-send-as-delete', 'settings-send-as-get', 'settings-send-as-list', 'settings-send-as-patch', 'settings-send-as-update', 'settings-send-as-verify', 'settings-update-auto-forwarding', 'settings-update-imap', 'settings-update-pop', 'settings-update-vacation', 'stop', 'threads-delete', 'threads-get', 'threads-list', 'threads-modify', 'threads-trash', 'threads-untrash' and 'watch'", vec![ + ("users", "methods: 'drafts-create', 'drafts-delete', 'drafts-get', 'drafts-list', 'drafts-send', 'drafts-update', 'get-profile', 'history-list', 'labels-create', 'labels-delete', 'labels-get', 'labels-list', 'labels-patch', 'labels-update', 'messages-attachments-get', 'messages-batch-delete', 'messages-batch-modify', 'messages-delete', 'messages-get', 'messages-import', 'messages-insert', 'messages-list', 'messages-modify', 'messages-send', 'messages-trash', 'messages-untrash', 'settings-filters-create', 'settings-filters-delete', 'settings-filters-get', 'settings-filters-list', 'settings-forwarding-addresses-create', 'settings-forwarding-addresses-delete', 'settings-forwarding-addresses-get', 'settings-forwarding-addresses-list', 'settings-get-auto-forwarding', 'settings-get-imap', 'settings-get-pop', 'settings-get-vacation', 'settings-send-as-create', 'settings-send-as-delete', 'settings-send-as-get', 'settings-send-as-list', 'settings-send-as-patch', 'settings-send-as-update', 'settings-send-as-verify', 'settings-update-auto-forwarding', 'settings-update-imap', 'settings-update-pop', 'settings-update-vacation', 'stop', 'threads-delete', 'threads-get', 'threads-list', 'threads-modify', 'threads-trash', 'threads-untrash' and 'watch'", vec![ ("drafts-create", Some(r##"Creates a new draft with the DRAFT label."##), "Details at http://byron.github.io/google-apis-rs/google_gmail1_cli/users_drafts-create", @@ -4601,6 +4683,28 @@ fn main() { Some(true), Some(true)), + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("messages-batch-modify", + Some(r##"Modifies the labels on the specified messages."##), + "Details at http://byron.github.io/google-apis-rs/google_gmail1_cli/users_messages-batch-modify", + vec![ + (Some(r##"user-id"##), + None, + Some(r##"The user's email address. The special value me can be used to indicate the authenticated user."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + (Some(r##"v"##), Some(r##"p"##), Some(r##"Set various optional parameters, matching the key=value form"##), @@ -5673,7 +5777,7 @@ fn main() { let mut app = App::new("gmail1") .author("Sebastian Thiel ") - .version("1.0.0+20160711") + .version("1.0.0+20161206") .about("Access Gmail mailboxes including sending user email.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_gmail1_cli") .arg(Arg::with_name("url") diff --git a/gen/gmail1/Cargo.toml b/gen/gmail1/Cargo.toml index 6878b72458..c8fdd75deb 100644 --- a/gen/gmail1/Cargo.toml +++ b/gen/gmail1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-gmail1" -version = "1.0.0+20160711" +version = "1.0.0+20161206" authors = ["Sebastian Thiel "] description = "A complete library to interact with gmail (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/gmail1" diff --git a/gen/gmail1/README.md b/gen/gmail1/README.md index d453d04b23..b8eed4d8c8 100644 --- a/gen/gmail1/README.md +++ b/gen/gmail1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-gmail1` library allows access to all features of the *Google gmail* service. -This documentation was generated from *gmail* crate version *1.0.0+20160711*, where *20160711* is the exact revision of the *gmail:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *gmail* crate version *1.0.0+20161206*, where *20161206* is the exact revision of the *gmail:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *gmail* *v1* API can be found at the [official documentation site](https://developers.google.com/gmail/api/). @@ -14,7 +14,7 @@ Everything else about the *gmail* *v1* API can be found at the Handle the following *Resources* with ease from the central [hub](http://byron.github.io/google-apis-rs/google_gmail1/struct.Gmail.html) ... * users - * [*drafts create*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserDraftCreateCall.html), [*drafts delete*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserDraftDeleteCall.html), [*drafts get*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserDraftGetCall.html), [*drafts list*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserDraftListCall.html), [*drafts send*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserDraftSendCall.html), [*drafts update*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserDraftUpdateCall.html), [*get profile*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserGetProfileCall.html), [*history list*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserHistoryListCall.html), [*labels create*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserLabelCreateCall.html), [*labels delete*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserLabelDeleteCall.html), [*labels get*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserLabelGetCall.html), [*labels list*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserLabelListCall.html), [*labels patch*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserLabelPatchCall.html), [*labels update*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserLabelUpdateCall.html), [*messages attachments get*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserMessageAttachmentGetCall.html), [*messages batch delete*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserMessageBatchDeleteCall.html), [*messages delete*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserMessageDeleteCall.html), [*messages get*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserMessageGetCall.html), [*messages import*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserMessageImportCall.html), [*messages insert*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserMessageInsertCall.html), [*messages list*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserMessageListCall.html), [*messages modify*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserMessageModifyCall.html), [*messages send*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserMessageSendCall.html), [*messages trash*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserMessageTrashCall.html), [*messages untrash*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserMessageUntrashCall.html), [*settings filters create*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingFilterCreateCall.html), [*settings filters delete*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingFilterDeleteCall.html), [*settings filters get*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingFilterGetCall.html), [*settings filters list*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingFilterListCall.html), [*settings forwarding addresses create*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingForwardingAddresseCreateCall.html), [*settings forwarding addresses delete*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingForwardingAddresseDeleteCall.html), [*settings forwarding addresses get*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingForwardingAddresseGetCall.html), [*settings forwarding addresses list*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingForwardingAddresseListCall.html), [*settings get auto forwarding*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingGetAutoForwardingCall.html), [*settings get imap*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingGetImapCall.html), [*settings get pop*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingGetPopCall.html), [*settings get vacation*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingGetVacationCall.html), [*settings send as create*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingSendACreateCall.html), [*settings send as delete*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingSendADeleteCall.html), [*settings send as get*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingSendAGetCall.html), [*settings send as list*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingSendAListCall.html), [*settings send as patch*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingSendAPatchCall.html), [*settings send as update*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingSendAUpdateCall.html), [*settings send as verify*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingSendAVerifyCall.html), [*settings update auto forwarding*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingUpdateAutoForwardingCall.html), [*settings update imap*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingUpdateImapCall.html), [*settings update pop*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingUpdatePopCall.html), [*settings update vacation*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingUpdateVacationCall.html), [*stop*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserStopCall.html), [*threads delete*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserThreadDeleteCall.html), [*threads get*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserThreadGetCall.html), [*threads list*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserThreadListCall.html), [*threads modify*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserThreadModifyCall.html), [*threads trash*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserThreadTrashCall.html), [*threads untrash*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserThreadUntrashCall.html) and [*watch*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserWatchCall.html) + * [*drafts create*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserDraftCreateCall.html), [*drafts delete*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserDraftDeleteCall.html), [*drafts get*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserDraftGetCall.html), [*drafts list*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserDraftListCall.html), [*drafts send*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserDraftSendCall.html), [*drafts update*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserDraftUpdateCall.html), [*get profile*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserGetProfileCall.html), [*history list*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserHistoryListCall.html), [*labels create*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserLabelCreateCall.html), [*labels delete*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserLabelDeleteCall.html), [*labels get*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserLabelGetCall.html), [*labels list*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserLabelListCall.html), [*labels patch*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserLabelPatchCall.html), [*labels update*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserLabelUpdateCall.html), [*messages attachments get*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserMessageAttachmentGetCall.html), [*messages batch delete*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserMessageBatchDeleteCall.html), [*messages batch modify*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserMessageBatchModifyCall.html), [*messages delete*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserMessageDeleteCall.html), [*messages get*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserMessageGetCall.html), [*messages import*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserMessageImportCall.html), [*messages insert*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserMessageInsertCall.html), [*messages list*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserMessageListCall.html), [*messages modify*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserMessageModifyCall.html), [*messages send*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserMessageSendCall.html), [*messages trash*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserMessageTrashCall.html), [*messages untrash*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserMessageUntrashCall.html), [*settings filters create*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingFilterCreateCall.html), [*settings filters delete*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingFilterDeleteCall.html), [*settings filters get*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingFilterGetCall.html), [*settings filters list*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingFilterListCall.html), [*settings forwarding addresses create*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingForwardingAddresseCreateCall.html), [*settings forwarding addresses delete*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingForwardingAddresseDeleteCall.html), [*settings forwarding addresses get*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingForwardingAddresseGetCall.html), [*settings forwarding addresses list*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingForwardingAddresseListCall.html), [*settings get auto forwarding*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingGetAutoForwardingCall.html), [*settings get imap*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingGetImapCall.html), [*settings get pop*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingGetPopCall.html), [*settings get vacation*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingGetVacationCall.html), [*settings send as create*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingSendACreateCall.html), [*settings send as delete*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingSendADeleteCall.html), [*settings send as get*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingSendAGetCall.html), [*settings send as list*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingSendAListCall.html), [*settings send as patch*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingSendAPatchCall.html), [*settings send as update*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingSendAUpdateCall.html), [*settings send as verify*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingSendAVerifyCall.html), [*settings update auto forwarding*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingUpdateAutoForwardingCall.html), [*settings update imap*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingUpdateImapCall.html), [*settings update pop*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingUpdatePopCall.html), [*settings update vacation*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserSettingUpdateVacationCall.html), [*stop*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserStopCall.html), [*threads delete*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserThreadDeleteCall.html), [*threads get*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserThreadGetCall.html), [*threads list*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserThreadListCall.html), [*threads modify*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserThreadModifyCall.html), [*threads trash*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserThreadTrashCall.html), [*threads untrash*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserThreadUntrashCall.html) and [*watch*](http://byron.github.io/google-apis-rs/google_gmail1/struct.UserWatchCall.html) Upload supported by ... diff --git a/gen/gmail1/src/lib.rs b/gen/gmail1/src/lib.rs index d0ee7ad148..54f4c4730e 100644 --- a/gen/gmail1/src/lib.rs +++ b/gen/gmail1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *gmail* crate version *1.0.0+20160711*, where *20160711* is the exact revision of the *gmail:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *gmail* crate version *1.0.0+20161206*, where *20161206* is the exact revision of the *gmail:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *gmail* *v1* API can be found at the //! [official documentation site](https://developers.google.com/gmail/api/). @@ -12,7 +12,7 @@ //! Handle the following *Resources* with ease from the central [hub](struct.Gmail.html) ... //! //! * users -//! * [*drafts create*](struct.UserDraftCreateCall.html), [*drafts delete*](struct.UserDraftDeleteCall.html), [*drafts get*](struct.UserDraftGetCall.html), [*drafts list*](struct.UserDraftListCall.html), [*drafts send*](struct.UserDraftSendCall.html), [*drafts update*](struct.UserDraftUpdateCall.html), [*get profile*](struct.UserGetProfileCall.html), [*history list*](struct.UserHistoryListCall.html), [*labels create*](struct.UserLabelCreateCall.html), [*labels delete*](struct.UserLabelDeleteCall.html), [*labels get*](struct.UserLabelGetCall.html), [*labels list*](struct.UserLabelListCall.html), [*labels patch*](struct.UserLabelPatchCall.html), [*labels update*](struct.UserLabelUpdateCall.html), [*messages attachments get*](struct.UserMessageAttachmentGetCall.html), [*messages batch delete*](struct.UserMessageBatchDeleteCall.html), [*messages delete*](struct.UserMessageDeleteCall.html), [*messages get*](struct.UserMessageGetCall.html), [*messages import*](struct.UserMessageImportCall.html), [*messages insert*](struct.UserMessageInsertCall.html), [*messages list*](struct.UserMessageListCall.html), [*messages modify*](struct.UserMessageModifyCall.html), [*messages send*](struct.UserMessageSendCall.html), [*messages trash*](struct.UserMessageTrashCall.html), [*messages untrash*](struct.UserMessageUntrashCall.html), [*settings filters create*](struct.UserSettingFilterCreateCall.html), [*settings filters delete*](struct.UserSettingFilterDeleteCall.html), [*settings filters get*](struct.UserSettingFilterGetCall.html), [*settings filters list*](struct.UserSettingFilterListCall.html), [*settings forwarding addresses create*](struct.UserSettingForwardingAddresseCreateCall.html), [*settings forwarding addresses delete*](struct.UserSettingForwardingAddresseDeleteCall.html), [*settings forwarding addresses get*](struct.UserSettingForwardingAddresseGetCall.html), [*settings forwarding addresses list*](struct.UserSettingForwardingAddresseListCall.html), [*settings get auto forwarding*](struct.UserSettingGetAutoForwardingCall.html), [*settings get imap*](struct.UserSettingGetImapCall.html), [*settings get pop*](struct.UserSettingGetPopCall.html), [*settings get vacation*](struct.UserSettingGetVacationCall.html), [*settings send as create*](struct.UserSettingSendACreateCall.html), [*settings send as delete*](struct.UserSettingSendADeleteCall.html), [*settings send as get*](struct.UserSettingSendAGetCall.html), [*settings send as list*](struct.UserSettingSendAListCall.html), [*settings send as patch*](struct.UserSettingSendAPatchCall.html), [*settings send as update*](struct.UserSettingSendAUpdateCall.html), [*settings send as verify*](struct.UserSettingSendAVerifyCall.html), [*settings update auto forwarding*](struct.UserSettingUpdateAutoForwardingCall.html), [*settings update imap*](struct.UserSettingUpdateImapCall.html), [*settings update pop*](struct.UserSettingUpdatePopCall.html), [*settings update vacation*](struct.UserSettingUpdateVacationCall.html), [*stop*](struct.UserStopCall.html), [*threads delete*](struct.UserThreadDeleteCall.html), [*threads get*](struct.UserThreadGetCall.html), [*threads list*](struct.UserThreadListCall.html), [*threads modify*](struct.UserThreadModifyCall.html), [*threads trash*](struct.UserThreadTrashCall.html), [*threads untrash*](struct.UserThreadUntrashCall.html) and [*watch*](struct.UserWatchCall.html) +//! * [*drafts create*](struct.UserDraftCreateCall.html), [*drafts delete*](struct.UserDraftDeleteCall.html), [*drafts get*](struct.UserDraftGetCall.html), [*drafts list*](struct.UserDraftListCall.html), [*drafts send*](struct.UserDraftSendCall.html), [*drafts update*](struct.UserDraftUpdateCall.html), [*get profile*](struct.UserGetProfileCall.html), [*history list*](struct.UserHistoryListCall.html), [*labels create*](struct.UserLabelCreateCall.html), [*labels delete*](struct.UserLabelDeleteCall.html), [*labels get*](struct.UserLabelGetCall.html), [*labels list*](struct.UserLabelListCall.html), [*labels patch*](struct.UserLabelPatchCall.html), [*labels update*](struct.UserLabelUpdateCall.html), [*messages attachments get*](struct.UserMessageAttachmentGetCall.html), [*messages batch delete*](struct.UserMessageBatchDeleteCall.html), [*messages batch modify*](struct.UserMessageBatchModifyCall.html), [*messages delete*](struct.UserMessageDeleteCall.html), [*messages get*](struct.UserMessageGetCall.html), [*messages import*](struct.UserMessageImportCall.html), [*messages insert*](struct.UserMessageInsertCall.html), [*messages list*](struct.UserMessageListCall.html), [*messages modify*](struct.UserMessageModifyCall.html), [*messages send*](struct.UserMessageSendCall.html), [*messages trash*](struct.UserMessageTrashCall.html), [*messages untrash*](struct.UserMessageUntrashCall.html), [*settings filters create*](struct.UserSettingFilterCreateCall.html), [*settings filters delete*](struct.UserSettingFilterDeleteCall.html), [*settings filters get*](struct.UserSettingFilterGetCall.html), [*settings filters list*](struct.UserSettingFilterListCall.html), [*settings forwarding addresses create*](struct.UserSettingForwardingAddresseCreateCall.html), [*settings forwarding addresses delete*](struct.UserSettingForwardingAddresseDeleteCall.html), [*settings forwarding addresses get*](struct.UserSettingForwardingAddresseGetCall.html), [*settings forwarding addresses list*](struct.UserSettingForwardingAddresseListCall.html), [*settings get auto forwarding*](struct.UserSettingGetAutoForwardingCall.html), [*settings get imap*](struct.UserSettingGetImapCall.html), [*settings get pop*](struct.UserSettingGetPopCall.html), [*settings get vacation*](struct.UserSettingGetVacationCall.html), [*settings send as create*](struct.UserSettingSendACreateCall.html), [*settings send as delete*](struct.UserSettingSendADeleteCall.html), [*settings send as get*](struct.UserSettingSendAGetCall.html), [*settings send as list*](struct.UserSettingSendAListCall.html), [*settings send as patch*](struct.UserSettingSendAPatchCall.html), [*settings send as update*](struct.UserSettingSendAUpdateCall.html), [*settings send as verify*](struct.UserSettingSendAVerifyCall.html), [*settings update auto forwarding*](struct.UserSettingUpdateAutoForwardingCall.html), [*settings update imap*](struct.UserSettingUpdateImapCall.html), [*settings update pop*](struct.UserSettingUpdatePopCall.html), [*settings update vacation*](struct.UserSettingUpdateVacationCall.html), [*stop*](struct.UserStopCall.html), [*threads delete*](struct.UserThreadDeleteCall.html), [*threads get*](struct.UserThreadGetCall.html), [*threads list*](struct.UserThreadListCall.html), [*threads modify*](struct.UserThreadModifyCall.html), [*threads trash*](struct.UserThreadTrashCall.html), [*threads untrash*](struct.UserThreadUntrashCall.html) and [*watch*](struct.UserWatchCall.html) //! //! //! Upload supported by ... @@ -118,8 +118,8 @@ //! // Values shown here are possibly random and not representative ! //! let result = hub.users().messages_import(req, "userId") //! .process_for_calendar(true) -//! .never_mark_spam(true) -//! .internal_date_source("diam") +//! .never_mark_spam(false) +//! .internal_date_source("justo") //! .deleted(false) //! .upload(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()); //! diff --git a/gen/gmail1/src/lib.rs.in b/gen/gmail1/src/lib.rs.in index 3a48487ad0..7ae8d52b34 100644 --- a/gen/gmail1/src/lib.rs.in +++ b/gen/gmail1/src/lib.rs.in @@ -52,6 +52,9 @@ pub enum Scope { /// Manage drafts and send emails Compose, + /// View your email message metadata such as labels and headers, but not the email body + Metadata, + /// Manage your sensitive mail settings, including who can manage your mail SettingSharing, @@ -75,6 +78,7 @@ impl AsRef for Scope { Scope::Gmai => "https://mail.google.com/", Scope::Send => "https://www.googleapis.com/auth/gmail.send", Scope::Compose => "https://www.googleapis.com/auth/gmail.compose", + Scope::Metadata => "https://www.googleapis.com/auth/gmail.metadata", Scope::SettingSharing => "https://www.googleapis.com/auth/gmail.settings.sharing", Scope::Label => "https://www.googleapis.com/auth/gmail.labels", Scope::Readonly => "https://www.googleapis.com/auth/gmail.readonly", @@ -320,9 +324,9 @@ pub struct MessagePartBody { /// When present, contains the ID of an external attachment that can be retrieved in a separate messages.attachments.get request. When not present, the entire content of the message part body is contained in the data field. #[serde(rename="attachmentId")] pub attachment_id: Option, - /// The body data of a MIME message part. May be empty for MIME container types that have no message body or when the body data is sent as a separate attachment. An attachment ID is present if the body data is contained in a separate attachment. + /// The body data of a MIME message part as a base64url encoded string. May be empty for MIME container types that have no message body or when the body data is sent as a separate attachment. An attachment ID is present if the body data is contained in a separate attachment. pub data: Option, - /// Total number of bytes in the body of the message part. + /// Number of bytes for the message part data (encoding notwithstanding). pub size: Option, } @@ -395,7 +399,7 @@ pub struct HistoryLabelAdded { impl Part for HistoryLabelAdded {} -/// Settings associated with a send-as alias, which can be either the primary login address associated with the account or a custom "from" address. Send-as aliases correspond to the "Send Mail As" feature in the web interface. See for more details. +/// Settings associated with a send-as alias, which can be either the primary login address associated with the account or a custom "from" address. Send-as aliases correspond to the "Send Mail As" feature in the web interface. /// /// # Activities /// @@ -420,7 +424,7 @@ pub struct SendAs { pub reply_to_address: Option, /// An optional HTML signature that is included in messages composed with this alias in the Gmail web UI. pub signature: Option, - /// Whether Gmail should treat this address as an alias for the user's primary email address. See for more details. This setting only applies to custom "from" aliases. + /// Whether Gmail should treat this address as an alias for the user's primary email address. This setting only applies to custom "from" aliases. #[serde(rename="treatAsAlias")] pub treat_as_alias: Option, /// The email address that appears in the "From:" header for mail sent using this alias. This is read-only for all operations except create. @@ -820,7 +824,7 @@ pub struct ListMessagesResponse { impl ResponseResult for ListMessagesResponse {} -/// Vacation auto-reply settings for an account. These settings correspond to the "Vacation responder" feature in the web interface. See for more details. +/// Vacation auto-reply settings for an account. These settings correspond to the "Vacation responder" feature in the web interface. /// /// # Activities /// @@ -904,6 +908,30 @@ pub struct ListThreadsResponse { impl ResponseResult for ListThreadsResponse {} +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [messages batch modify users](struct.UserMessageBatchModifyCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BatchModifyMessagesRequest { + /// A list of label IDs to add to messages. + #[serde(rename="addLabelIds")] + pub add_label_ids: Option>, + /// The IDs of the messages to modify. There is a limit of 1000 ids per request. + pub ids: Option>, + /// A list of label IDs to remove from messages. + #[serde(rename="removeLabelIds")] + pub remove_label_ids: Option>, +} + +impl RequestValue for BatchModifyMessagesRequest {} + + /// Set up or update a new push notification watch on this user's mailbox. /// /// # Activities @@ -1115,7 +1143,7 @@ impl Part for MessagePart {} /// ::default(), None); /// let mut hub = Gmail::new(hyper::Client::new(), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `drafts_create(...)`, `drafts_delete(...)`, `drafts_get(...)`, `drafts_list(...)`, `drafts_send(...)`, `drafts_update(...)`, `get_profile(...)`, `history_list(...)`, `labels_create(...)`, `labels_delete(...)`, `labels_get(...)`, `labels_list(...)`, `labels_patch(...)`, `labels_update(...)`, `messages_attachments_get(...)`, `messages_batch_delete(...)`, `messages_delete(...)`, `messages_get(...)`, `messages_import(...)`, `messages_insert(...)`, `messages_list(...)`, `messages_modify(...)`, `messages_send(...)`, `messages_trash(...)`, `messages_untrash(...)`, `settings_filters_create(...)`, `settings_filters_delete(...)`, `settings_filters_get(...)`, `settings_filters_list(...)`, `settings_forwarding_addresses_create(...)`, `settings_forwarding_addresses_delete(...)`, `settings_forwarding_addresses_get(...)`, `settings_forwarding_addresses_list(...)`, `settings_get_auto_forwarding(...)`, `settings_get_imap(...)`, `settings_get_pop(...)`, `settings_get_vacation(...)`, `settings_send_as_create(...)`, `settings_send_as_delete(...)`, `settings_send_as_get(...)`, `settings_send_as_list(...)`, `settings_send_as_patch(...)`, `settings_send_as_update(...)`, `settings_send_as_verify(...)`, `settings_update_auto_forwarding(...)`, `settings_update_imap(...)`, `settings_update_pop(...)`, `settings_update_vacation(...)`, `stop(...)`, `threads_delete(...)`, `threads_get(...)`, `threads_list(...)`, `threads_modify(...)`, `threads_trash(...)`, `threads_untrash(...)` and `watch(...)` +/// // like `drafts_create(...)`, `drafts_delete(...)`, `drafts_get(...)`, `drafts_list(...)`, `drafts_send(...)`, `drafts_update(...)`, `get_profile(...)`, `history_list(...)`, `labels_create(...)`, `labels_delete(...)`, `labels_get(...)`, `labels_list(...)`, `labels_patch(...)`, `labels_update(...)`, `messages_attachments_get(...)`, `messages_batch_delete(...)`, `messages_batch_modify(...)`, `messages_delete(...)`, `messages_get(...)`, `messages_import(...)`, `messages_insert(...)`, `messages_list(...)`, `messages_modify(...)`, `messages_send(...)`, `messages_trash(...)`, `messages_untrash(...)`, `settings_filters_create(...)`, `settings_filters_delete(...)`, `settings_filters_get(...)`, `settings_filters_list(...)`, `settings_forwarding_addresses_create(...)`, `settings_forwarding_addresses_delete(...)`, `settings_forwarding_addresses_get(...)`, `settings_forwarding_addresses_list(...)`, `settings_get_auto_forwarding(...)`, `settings_get_imap(...)`, `settings_get_pop(...)`, `settings_get_vacation(...)`, `settings_send_as_create(...)`, `settings_send_as_delete(...)`, `settings_send_as_get(...)`, `settings_send_as_list(...)`, `settings_send_as_patch(...)`, `settings_send_as_update(...)`, `settings_send_as_verify(...)`, `settings_update_auto_forwarding(...)`, `settings_update_imap(...)`, `settings_update_pop(...)`, `settings_update_vacation(...)`, `stop(...)`, `threads_delete(...)`, `threads_get(...)`, `threads_list(...)`, `threads_modify(...)`, `threads_trash(...)`, `threads_untrash(...)` and `watch(...)` /// // to build up your call. /// let rb = hub.users(); /// # } @@ -1607,6 +1635,25 @@ impl<'a, C, A> UserMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Modifies the labels on the specified messages. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `userId` - The user's email address. The special value me can be used to indicate the authenticated user. + pub fn messages_batch_modify(&self, request: BatchModifyMessagesRequest, user_id: &str) -> UserMessageBatchModifyCall<'a, C, A> { + UserMessageBatchModifyCall { + hub: self.hub, + _request: request, + _user_id: user_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Updates the specified label. This method supports patch semantics. @@ -8753,7 +8800,7 @@ impl<'a, C, A> UserThreadListCall<'a, C, A> where C: BorrowMut, A self._user_id = new_value.to_string(); self } - /// Only return threads matching the specified query. Supports the same query format as the Gmail search box. For example, "from:someuser@example.com rfc822msgid: is:unread". + /// Only return threads matching the specified query. Supports the same query format as the Gmail search box. For example, "from:someuser@example.com rfc822msgid: is:unread". Parameter cannot be used when accessing the api using the gmail.metadata scope. /// /// Sets the *q* query property to the given value. pub fn q(mut self, new_value: &str) -> UserThreadListCall<'a, C, A> { @@ -9088,6 +9135,261 @@ impl<'a, C, A> UserSettingFilterGetCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = Gmail::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = BatchModifyMessagesRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.users().messages_batch_modify(req, "userId") +/// .doit(); +/// # } +/// ``` +pub struct UserMessageBatchModifyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Gmail, + _request: BatchModifyMessagesRequest, + _user_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for UserMessageBatchModifyCall<'a, C, A> {} + +impl<'a, C, A> UserMessageBatchModifyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "gmail.users.messages.batchModify", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("userId", self._user_id.to_string())); + for &field in ["userId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/gmail/v1/users/{userId}/messages/batchModify".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Gmai.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{userId}", "userId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["userId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: BatchModifyMessagesRequest) -> UserMessageBatchModifyCall<'a, C, A> { + self._request = new_value; + self + } + /// The user's email address. The special value me can be used to indicate the authenticated user. + /// + /// Sets the *user id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn user_id(mut self, new_value: &str) -> UserMessageBatchModifyCall<'a, C, A> { + self._user_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> UserMessageBatchModifyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> UserMessageBatchModifyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Gmai`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> UserMessageBatchModifyCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + /// Updates the specified label. This method supports patch semantics. /// /// A builder for the *labels.patch* method supported by a *user* resource. @@ -11972,8 +12274,8 @@ impl<'a, C, A> UserMessageModifyCall<'a, C, A> where C: BorrowMut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.users().messages_get("userId", "id") -/// .add_metadata_headers("dolore") -/// .format("duo") +/// .add_metadata_headers("duo") +/// .format("aliquyam") /// .doit(); /// # } /// ``` @@ -12748,9 +13050,9 @@ impl<'a, C, A> UserSettingFilterDeleteCall<'a, C, A> where C: BorrowMut UserSettingForwardingAddresseCreateCall<'a, C, A> where C: Borrow /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.users().messages_list("userId") -/// .q("rebum.") -/// .page_token("dolore") -/// .max_results(60) -/// .add_label_ids("sed") +/// .q("dolore") +/// .page_token("nonumy") +/// .max_results(72) +/// .add_label_ids("aliquyam") /// .include_spam_trash(false) /// .doit(); /// # } @@ -14597,7 +14899,7 @@ impl<'a, C, A> UserMessageListCall<'a, C, A> where C: BorrowMut, self._user_id = new_value.to_string(); self } - /// Only return messages matching the specified query. Supports the same query format as the Gmail search box. For example, "from:someuser@example.com rfc822msgid: is:unread". + /// Only return messages matching the specified query. Supports the same query format as the Gmail search box. For example, "from:someuser@example.com rfc822msgid: is:unread". Parameter cannot be used when accessing the api using the gmail.metadata scope. /// /// Sets the *q* query property to the given value. pub fn q(mut self, new_value: &str) -> UserMessageListCall<'a, C, A> { @@ -15738,8 +16040,8 @@ impl<'a, C, A> UserGetProfileCall<'a, C, A> where C: BorrowMut, A /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.users().threads_get("userId", "id") -/// .add_metadata_headers("eos") -/// .format("tempor") +/// .add_metadata_headers("tempor") +/// .format("sea") /// .doit(); /// # } /// ``` @@ -16255,7 +16557,7 @@ impl<'a, C, A> UserSettingSendAVerifyCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with iam (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/iam1-cli" diff --git a/gen/iam1-cli/README.md b/gen/iam1-cli/README.md index aeb7869708..bd06269bd9 100644 --- a/gen/iam1-cli/README.md +++ b/gen/iam1-cli/README.md @@ -24,7 +24,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *iam* API at revision *20160129*. The CLI is at version *1.0.0*. +This documentation was generated from the *iam* API at revision *20160915*. The CLI is at version *1.0.0*. ```bash iam1 [options] @@ -42,6 +42,8 @@ iam1 [options] service-accounts-sign-blob (-r )... [-p ]... [-o ] service-accounts-test-iam-permissions (-r )... [-p ]... [-o ] service-accounts-update (-r )... [-p ]... [-o ] + roles + query-grantable-roles (-r )... [-p ]... [-o ] iam1 --help Configuration: diff --git a/gen/iam1-cli/mkdocs.yml b/gen/iam1-cli/mkdocs.yml index c663aca39c..54cd42c0d6 100644 --- a/gen/iam1-cli/mkdocs.yml +++ b/gen/iam1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: iam v1.0.0+20160129 +site_name: iam v1.0.0+20160915 site_url: http://byron.github.io/google-apis-rs/google-iam1-cli site_description: Write integrating applications with bcore @@ -22,6 +22,7 @@ pages: - ['projects_service-accounts-sign-blob.md', 'Projects', 'Service Accounts Sign Blob'] - ['projects_service-accounts-test-iam-permissions.md', 'Projects', 'Service Accounts Test Iam Permissions'] - ['projects_service-accounts-update.md', 'Projects', 'Service Accounts Update'] +- ['roles_query-grantable-roles.md', 'Roles', 'Query Grantable Roles'] theme: readthedocs diff --git a/gen/iam1-cli/src/main.rs b/gen/iam1-cli/src/main.rs index 619202ee2d..69ba41f611 100644 --- a/gen/iam1-cli/src/main.rs +++ b/gen/iam1-cli/src/main.rs @@ -317,8 +317,9 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "private-key-type" => Some(("privateKeyType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "key-algorithm" => Some(("keyAlgorithm", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["private-key-type"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["key-algorithm", "private-key-type"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -436,6 +437,9 @@ impl<'n> Engine<'n> { for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { + "public-key-type" => { + call = call.public_key_type(value.unwrap_or("")); + }, _ => { let mut found = false; for param in &self.gp { @@ -449,6 +453,7 @@ impl<'n> Engine<'n> { err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); + v.extend(["public-key-type"].iter().map(|v|*v)); v } )); } } @@ -944,6 +949,91 @@ impl<'n> Engine<'n> { } } + fn _roles_query_grantable_roles(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "full-resource-name" => Some(("fullResourceName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["full-resource-name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::QueryGrantableRolesRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.roles().query_grantable_roles(request); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _doit(&self, dry_run: bool) -> Result, Option> { let mut err = InvalidOptionsError::new(); let mut call_result: Result<(), DoitError> = Ok(()); @@ -996,6 +1086,17 @@ impl<'n> Engine<'n> { } } }, + ("roles", Some(opt)) => { + match opt.subcommand() { + ("query-grantable-roles", Some(opt)) => { + call_result = self._roles_query_grantable_roles(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("roles".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, _ => { err.issues.push(CLIError::MissingCommandError); writeln!(io::stderr(), "{}\n", self.opt.usage()).ok(); @@ -1084,12 +1185,12 @@ fn main() { let arg_data = [ ("projects", "methods: 'service-accounts-create', 'service-accounts-delete', 'service-accounts-get', 'service-accounts-get-iam-policy', 'service-accounts-keys-create', 'service-accounts-keys-delete', 'service-accounts-keys-get', 'service-accounts-keys-list', 'service-accounts-list', 'service-accounts-set-iam-policy', 'service-accounts-sign-blob', 'service-accounts-test-iam-permissions' and 'service-accounts-update'", vec![ ("service-accounts-create", - Some(r##"Creates a service account and returns it."##), + Some(r##"Creates a ServiceAccount and returns it."##), "Details at http://byron.github.io/google-apis-rs/google_iam1_cli/projects_service-accounts-create", vec![ (Some(r##"name"##), None, - Some(r##"Required. The resource name of the project associated with the service accounts, such as "projects/123""##), + Some(r##"Required. The resource name of the project associated with the service accounts, such as `projects/my-project-123`."##), Some(true), Some(false)), @@ -1112,12 +1213,12 @@ fn main() { Some(false)), ]), ("service-accounts-delete", - Some(r##"Deletes a service acount."##), + Some(r##"Deletes a ServiceAccount."##), "Details at http://byron.github.io/google-apis-rs/google_iam1_cli/projects_service-accounts-delete", vec![ (Some(r##"name"##), None, - Some(r##"The resource name of the service account in the format "projects/{project}/serviceAccounts/{account}". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account."##), + Some(r##"The resource name of the service account in the following format: `projects/{project}/serviceAccounts/{account}`. Using `-` as a wildcard for the project will infer the project from the account. The `account` value can be the `email` address or the `unique_id` of the service account."##), Some(true), Some(false)), @@ -1134,12 +1235,12 @@ fn main() { Some(false)), ]), ("service-accounts-get", - Some(r##"Gets a ServiceAccount"##), + Some(r##"Gets a ServiceAccount."##), "Details at http://byron.github.io/google-apis-rs/google_iam1_cli/projects_service-accounts-get", vec![ (Some(r##"name"##), None, - Some(r##"The resource name of the service account in the format "projects/{project}/serviceAccounts/{account}". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account."##), + Some(r##"The resource name of the service account in the following format: `projects/{project}/serviceAccounts/{account}`. Using `-` as a wildcard for the project will infer the project from the account. The `account` value can be the `email` address or the `unique_id` of the service account."##), Some(true), Some(false)), @@ -1156,12 +1257,12 @@ fn main() { Some(false)), ]), ("service-accounts-get-iam-policy", - Some(r##"Returns the IAM access control policy for specified IAM resource."##), + Some(r##"Returns the IAM access control policy for a ServiceAccount."##), "Details at http://byron.github.io/google-apis-rs/google_iam1_cli/projects_service-accounts-get-iam-policy", vec![ (Some(r##"resource"##), None, - Some(r##"REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation."##), + Some(r##"REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path. For example, a Project resource is specified as `projects/{project}`."##), Some(true), Some(false)), @@ -1178,12 +1279,12 @@ fn main() { Some(false)), ]), ("service-accounts-keys-create", - Some(r##"Creates a service account key and returns it."##), + Some(r##"Creates a ServiceAccountKey and returns it."##), "Details at http://byron.github.io/google-apis-rs/google_iam1_cli/projects_service-accounts-keys-create", vec![ (Some(r##"name"##), None, - Some(r##"The resource name of the service account in the format "projects/{project}/serviceAccounts/{account}". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account."##), + Some(r##"The resource name of the service account in the following format: `projects/{project}/serviceAccounts/{account}`. Using `-` as a wildcard for the project will infer the project from the account. The `account` value can be the `email` address or the `unique_id` of the service account."##), Some(true), Some(false)), @@ -1206,12 +1307,12 @@ fn main() { Some(false)), ]), ("service-accounts-keys-delete", - Some(r##"Deletes a service account key."##), + Some(r##"Deletes a ServiceAccountKey."##), "Details at http://byron.github.io/google-apis-rs/google_iam1_cli/projects_service-accounts-keys-delete", vec![ (Some(r##"name"##), None, - Some(r##"The resource name of the service account key in the format "projects/{project}/serviceAccounts/{account}/keys/{key}". Using '-' as a wildcard for the project will infer the project from the account. The account value can be the email address or the unique_id of the service account."##), + Some(r##"The resource name of the service account key in the following format: `projects/{project}/serviceAccounts/{account}/keys/{key}`. Using `-` as a wildcard for the project will infer the project from the account. The `account` value can be the `email` address or the `unique_id` of the service account."##), Some(true), Some(false)), @@ -1233,7 +1334,7 @@ fn main() { vec![ (Some(r##"name"##), None, - Some(r##"The resource name of the service account key in the format "projects/{project}/serviceAccounts/{account}/keys/{key}". Using '-' as a wildcard for the project will infer the project from the account. The account value can be the email address or the unique_id of the service account."##), + Some(r##"The resource name of the service account key in the following format: `projects/{project}/serviceAccounts/{account}/keys/{key}`. Using `-` as a wildcard for the project will infer the project from the account. The `account` value can be the `email` address or the `unique_id` of the service account."##), Some(true), Some(false)), @@ -1250,12 +1351,12 @@ fn main() { Some(false)), ]), ("service-accounts-keys-list", - Some(r##"Lists service account keys"##), + Some(r##"Lists ServiceAccountKeys."##), "Details at http://byron.github.io/google-apis-rs/google_iam1_cli/projects_service-accounts-keys-list", vec![ (Some(r##"name"##), None, - Some(r##"The resource name of the service account in the format "projects/{project}/serviceAccounts/{account}". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account."##), + Some(r##"The resource name of the service account in the following format: `projects/{project}/serviceAccounts/{account}`. Using `-` as a wildcard for the project, will infer the project from the account. The `account` value can be the `email` address or the `unique_id` of the service account."##), Some(true), Some(false)), @@ -1272,12 +1373,12 @@ fn main() { Some(false)), ]), ("service-accounts-list", - Some(r##"Lists service accounts for a project."##), + Some(r##"Lists ServiceAccounts for a project."##), "Details at http://byron.github.io/google-apis-rs/google_iam1_cli/projects_service-accounts-list", vec![ (Some(r##"name"##), None, - Some(r##"Required. The resource name of the project associated with the service accounts, such as "projects/123""##), + Some(r##"Required. The resource name of the project associated with the service accounts, such as `projects/my-project-123`."##), Some(true), Some(false)), @@ -1294,12 +1395,12 @@ fn main() { Some(false)), ]), ("service-accounts-set-iam-policy", - Some(r##"Sets the IAM access control policy for the specified IAM resource."##), + Some(r##"Sets the IAM access control policy for a ServiceAccount."##), "Details at http://byron.github.io/google-apis-rs/google_iam1_cli/projects_service-accounts-set-iam-policy", vec![ (Some(r##"resource"##), None, - Some(r##"REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `setIamPolicy` documentation."##), + Some(r##"REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path. For example, a Project resource is specified as `projects/{project}`."##), Some(true), Some(false)), @@ -1322,12 +1423,12 @@ fn main() { Some(false)), ]), ("service-accounts-sign-blob", - Some(r##"Signs a blob using a service account."##), + Some(r##"Signs a blob using a service account's system-managed private key."##), "Details at http://byron.github.io/google-apis-rs/google_iam1_cli/projects_service-accounts-sign-blob", vec![ (Some(r##"name"##), None, - Some(r##"The resource name of the service account in the format "projects/{project}/serviceAccounts/{account}". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account."##), + Some(r##"The resource name of the service account in the following format: `projects/{project}/serviceAccounts/{account}`. Using `-` as a wildcard for the project will infer the project from the account. The `account` value can be the `email` address or the `unique_id` of the service account."##), Some(true), Some(false)), @@ -1350,12 +1451,12 @@ fn main() { Some(false)), ]), ("service-accounts-test-iam-permissions", - Some(r##"Tests the specified permissions against the IAM access control policy for the specified IAM resource."##), + Some(r##"Tests the specified permissions against the IAM access control policy for a ServiceAccount."##), "Details at http://byron.github.io/google-apis-rs/google_iam1_cli/projects_service-accounts-test-iam-permissions", vec![ (Some(r##"resource"##), None, - Some(r##"REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `testIamPermissions` documentation."##), + Some(r##"REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path. For example, a Project resource is specified as `projects/{project}`."##), Some(true), Some(false)), @@ -1378,12 +1479,12 @@ fn main() { Some(false)), ]), ("service-accounts-update", - Some(r##"Updates a service account. Currently, only the following fields are updatable: 'display_name' . The 'etag' is mandatory."##), + Some(r##"Updates a ServiceAccount. Currently, only the following fields are updatable: `display_name` . The `etag` is mandatory."##), "Details at http://byron.github.io/google-apis-rs/google_iam1_cli/projects_service-accounts-update", vec![ (Some(r##"name"##), None, - Some(r##"The resource name of the service account in the format "projects/{project}/serviceAccounts/{account}". In requests using '-' as a wildcard for the project, will infer the project from the account and the account value can be the email address or the unique_id of the service account. In responses the resource name will always be in the format "projects/{project}/serviceAccounts/{email}"."##), + Some(r##"The resource name of the service account in the following format: `projects/{project}/serviceAccounts/{account}`. Requests using `-` as a wildcard for the project will infer the project from the `account` and the `account` value can be the `email` address or the `unique_id` of the service account. In responses the resource name will always be in the format `projects/{project}/serviceAccounts/{email}`."##), Some(true), Some(false)), @@ -1407,11 +1508,36 @@ fn main() { ]), ]), + ("roles", "methods: 'query-grantable-roles'", vec![ + ("query-grantable-roles", + Some(r##"Queries roles that can be granted on a particular resource. A role is grantable if it can be used as the role in a binding for a policy for that resource."##), + "Details at http://byron.github.io/google-apis-rs/google_iam1_cli/roles_query-grantable-roles", + vec![ + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + ]; let mut app = App::new("iam1") .author("Sebastian Thiel ") - .version("1.0.0+20160129") + .version("1.0.0+20160915") .about("Manages identity and access control for Google Cloud Platform resources, including the creation of service accounts, which you can use to authenticate to Google and make API calls.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_iam1_cli") .arg(Arg::with_name("url") diff --git a/gen/iam1/Cargo.toml b/gen/iam1/Cargo.toml index 5131cd45aa..64b282998d 100644 --- a/gen/iam1/Cargo.toml +++ b/gen/iam1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-iam1" -version = "1.0.0+20160129" +version = "1.0.0+20160915" authors = ["Sebastian Thiel "] description = "A complete library to interact with iam (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/iam1" diff --git a/gen/iam1/README.md b/gen/iam1/README.md index 61e9cdc325..503f446723 100644 --- a/gen/iam1/README.md +++ b/gen/iam1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-iam1` library allows access to all features of the *Google iam* service. -This documentation was generated from *iam* crate version *1.0.0+20160129*, where *20160129* is the exact revision of the *iam:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *iam* crate version *1.0.0+20160915*, where *20160915* is the exact revision of the *iam:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *iam* *v1* API can be found at the [official documentation site](https://cloud.google.com/iam/). @@ -15,6 +15,8 @@ Handle the following *Resources* with ease from the central [hub](http://byron.g * projects * [*service accounts create*](http://byron.github.io/google-apis-rs/google_iam1/struct.ProjectServiceAccountCreateCall.html), [*service accounts delete*](http://byron.github.io/google-apis-rs/google_iam1/struct.ProjectServiceAccountDeleteCall.html), [*service accounts get*](http://byron.github.io/google-apis-rs/google_iam1/struct.ProjectServiceAccountGetCall.html), [*service accounts get iam policy*](http://byron.github.io/google-apis-rs/google_iam1/struct.ProjectServiceAccountGetIamPolicyCall.html), [*service accounts keys create*](http://byron.github.io/google-apis-rs/google_iam1/struct.ProjectServiceAccountKeyCreateCall.html), [*service accounts keys delete*](http://byron.github.io/google-apis-rs/google_iam1/struct.ProjectServiceAccountKeyDeleteCall.html), [*service accounts keys get*](http://byron.github.io/google-apis-rs/google_iam1/struct.ProjectServiceAccountKeyGetCall.html), [*service accounts keys list*](http://byron.github.io/google-apis-rs/google_iam1/struct.ProjectServiceAccountKeyListCall.html), [*service accounts list*](http://byron.github.io/google-apis-rs/google_iam1/struct.ProjectServiceAccountListCall.html), [*service accounts set iam policy*](http://byron.github.io/google-apis-rs/google_iam1/struct.ProjectServiceAccountSetIamPolicyCall.html), [*service accounts sign blob*](http://byron.github.io/google-apis-rs/google_iam1/struct.ProjectServiceAccountSignBlobCall.html), [*service accounts test iam permissions*](http://byron.github.io/google-apis-rs/google_iam1/struct.ProjectServiceAccountTestIamPermissionCall.html) and [*service accounts update*](http://byron.github.io/google-apis-rs/google_iam1/struct.ProjectServiceAccountUpdateCall.html) +* [roles](http://byron.github.io/google-apis-rs/google_iam1/struct.Role.html) + * [*query grantable roles*](http://byron.github.io/google-apis-rs/google_iam1/struct.RoleQueryGrantableRoleCall.html) diff --git a/gen/iam1/src/lib.rs b/gen/iam1/src/lib.rs index 8be3af1906..4ff292f678 100644 --- a/gen/iam1/src/lib.rs +++ b/gen/iam1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *iam* crate version *1.0.0+20160129*, where *20160129* is the exact revision of the *iam:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *iam* crate version *1.0.0+20160915*, where *20160915* is the exact revision of the *iam:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *iam* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/iam/). @@ -13,6 +13,8 @@ //! //! * projects //! * [*service accounts create*](struct.ProjectServiceAccountCreateCall.html), [*service accounts delete*](struct.ProjectServiceAccountDeleteCall.html), [*service accounts get*](struct.ProjectServiceAccountGetCall.html), [*service accounts get iam policy*](struct.ProjectServiceAccountGetIamPolicyCall.html), [*service accounts keys create*](struct.ProjectServiceAccountKeyCreateCall.html), [*service accounts keys delete*](struct.ProjectServiceAccountKeyDeleteCall.html), [*service accounts keys get*](struct.ProjectServiceAccountKeyGetCall.html), [*service accounts keys list*](struct.ProjectServiceAccountKeyListCall.html), [*service accounts list*](struct.ProjectServiceAccountListCall.html), [*service accounts set iam policy*](struct.ProjectServiceAccountSetIamPolicyCall.html), [*service accounts sign blob*](struct.ProjectServiceAccountSignBlobCall.html), [*service accounts test iam permissions*](struct.ProjectServiceAccountTestIamPermissionCall.html) and [*service accounts update*](struct.ProjectServiceAccountUpdateCall.html) +//! * [roles](struct.Role.html) +//! * [*query grantable roles*](struct.RoleQueryGrantableRoleCall.html) //! //! //! diff --git a/gen/iam1/src/lib.rs.in b/gen/iam1/src/lib.rs.in index 1394850d9d..552cca5505 100644 --- a/gen/iam1/src/lib.rs.in +++ b/gen/iam1/src/lib.rs.in @@ -144,6 +144,9 @@ impl<'a, C, A> Iam pub fn projects(&'a self) -> ProjectMethods<'a, C, A> { ProjectMethods { hub: &self } } + pub fn roles(&'a self) -> RoleMethods<'a, C, A> { + RoleMethods { hub: &self } + } /// Set the user-agent header field to use in all requests to the server. /// It defaults to `google-api-rust-client/1.0.0`. @@ -171,7 +174,7 @@ impl<'a, C, A> Iam /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TestIamPermissionsRequest { - /// The set of permissions to check for the `resource`. Permissions with wildcards (such as '*' or 'storage.*') are not allowed. For more information see IAM Overview. + /// The set of permissions to check for the `resource`. Permissions with wildcards (such as '*' or 'storage.*') are not allowed. For more information see [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). pub permissions: Option>, } @@ -214,7 +217,7 @@ pub struct ListServiceAccountKeysResponse { impl ResponseResult for ListServiceAccountKeysResponse {} -/// A service account in the Identity and Access Management API. To create a service account, you specify the project_id and account_id for the account. The account_id is unique within the project, and used to generate the service account email address and a stable unique id. All other methods can identify accounts using the format "projects/{project}/serviceAccounts/{account}". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account. +/// A service account in the Identity and Access Management API. To create a service account, specify the `project_id` and the `account_id` for the account. The `account_id` is unique within the project, and is used to generate the service account email address and a stable `unique_id`. If the account already exists, the account's resource name is returned in util::Status's ResourceInfo.resource_name in the format of projects/{project}/serviceAccounts/{email}. The caller can use the name in other methods to access the account. All other methods can identify the service account using the format `projects/{project}/serviceAccounts/{account}`. Using `-` as a wildcard for the project will infer the project from the account. The `account` value can be the `email` address or the `unique_id` of the service account. /// /// # Activities /// @@ -235,15 +238,15 @@ pub struct ServiceAccount { /// Optional. A user-specified description of the service account. Must be fewer than 100 UTF-8 bytes. #[serde(rename="displayName")] pub display_name: Option, - /// The resource name of the service account in the format "projects/{project}/serviceAccounts/{account}". In requests using '-' as a wildcard for the project, will infer the project from the account and the account value can be the email address or the unique_id of the service account. In responses the resource name will always be in the format "projects/{project}/serviceAccounts/{email}". + /// The resource name of the service account in the following format: `projects/{project}/serviceAccounts/{account}`. Requests using `-` as a wildcard for the project will infer the project from the `account` and the `account` value can be the `email` address or the `unique_id` of the service account. In responses the resource name will always be in the format `projects/{project}/serviceAccounts/{email}`. pub name: Option, - /// @OutputOnly unique and stable id of the service account. + /// @OutputOnly The unique and stable id of the service account. #[serde(rename="uniqueId")] pub unique_id: Option, /// @OutputOnly The id of the project that owns the service account. #[serde(rename="projectId")] pub project_id: Option, - /// @OutputOnly Email address of the service account. + /// @OutputOnly The email address of the service account. pub email: Option, } @@ -251,32 +254,44 @@ impl RequestValue for ServiceAccount {} impl ResponseResult for ServiceAccount {} -/// A rule to be applied in a Policy. +/// The grantable role query response. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [query grantable roles roles](struct.RoleQueryGrantableRoleCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Rule { - /// The rule matches if the PRINCIPAL/AUTHORITY_SELECTOR is not in this set of entries. The format for in and not_in entries is the same as for members in a Binding (see google/iam/v1/policy.proto). - #[serde(rename="notIn")] - pub not_in: Option>, - /// Human-readable description of the rule. - pub description: Option, - /// The rule matches if the PRINCIPAL/AUTHORITY_SELECTOR is in this set of entries. - #[serde(rename="in")] - pub in_: Option>, - /// Required - pub action: Option, - /// Additional restrictions that must be met - pub conditions: Option>, - /// The config returned to callers of tech.iam.IAM.CheckPolicy for any entries that match the LOG action. - #[serde(rename="logConfig")] - pub log_config: Option>, - /// A permission is a string of form '..' (e.g., 'storage.buckets.list'). A value of '*' matches all permissions, and a verb part of '*' (e.g., 'storage.buckets.*') matches all verbs. - pub permissions: Option>, +pub struct QueryGrantableRolesResponse { + /// The list of matching roles. + pub roles: Option>, } -impl Part for Rule {} +impl ResponseResult for QueryGrantableRolesResponse {} + + +/// A role in the Identity and Access Management API. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [query grantable roles roles](struct.RoleQueryGrantableRoleCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Role { + /// Optional. A human-readable title for the role. Typically this is limited to 100 UTF-8 bytes. + pub title: Option, + /// Optional. A human-readable description for the role. + pub description: Option, + /// The name of the role. When Role is used in CreateRole, the role name must not be set. When Role is used in output and other input such as UpdateRole, the role name is the complete path, e.g., roles/logging.viewer for curated roles and organizations/{organization-id}/roles/logging.viewer for custom roles. + pub name: Option, +} + +impl Resource for Role {} /// The service account sign blob request. @@ -290,7 +305,7 @@ impl Part for Rule {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct SignBlobRequest { - /// The bytes to sign + /// The bytes to sign. #[serde(rename="bytesToSign")] pub bytes_to_sign: Option, } @@ -309,7 +324,7 @@ impl RequestValue for SignBlobRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListServiceAccountsResponse { - /// To retrieve the next page of results, set [ListServiceAccountsRequest.page_token] to this value. + /// To retrieve the next page of results, set ListServiceAccountsRequest.page_token to this value. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// The list of matching service accounts. @@ -319,7 +334,7 @@ pub struct ListServiceAccountsResponse { impl ResponseResult for ListServiceAccountsResponse {} -/// Defines an Identity and Access Management (IAM) policy. It is used to specify access control policies for Cloud Platform resources. A `Policy` consists of a list of `bindings`. A `Binding` binds a list of `members` to a `role`, where the members can be user accounts, Google groups, Google domains, and service accounts. A `role` is a named list of permissions defined by IAM. **Example** { "bindings": [ { "role": "roles/owner", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-other-app@appspot.gserviceaccount.com"] }, { "role": "roles/viewer", "members": ["user:sean@example.com"] } ] } For a description of IAM and its features, see the [IAM developer's guide](https://cloud.google.com/iam). +/// Defines an Identity and Access Management (IAM) policy. It is used to specify access control policies for Cloud Platform resources. A `Policy` consists of a list of `bindings`. A `Binding` binds a list of `members` to a `role`, where the members can be user accounts, Google groups, Google domains, and service accounts. A `role` is a named list of permissions defined by IAM. **Example** { "bindings": [ { "role": "roles/owner", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-other-app@appspot.gserviceaccount.com", ] }, { "role": "roles/viewer", "members": ["user:sean@example.com"] } ] } For a description of IAM and its features, see the [IAM developer's guide](https://cloud.google.com/iam). /// /// # Activities /// @@ -331,8 +346,6 @@ impl ResponseResult for ListServiceAccountsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Policy { - /// no description provided - pub rules: Option>, /// Associates a list of `members` to a `role`. Multiple `bindings` must not be specified for the same `role`. `bindings` with no members will result in an error. pub bindings: Option>, /// Version of the `Policy`. The default version is 0. @@ -344,6 +357,25 @@ pub struct Policy { impl ResponseResult for Policy {} +/// The grantable role query request. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [query grantable roles roles](struct.RoleQueryGrantableRoleCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct QueryGrantableRolesRequest { + /// Required. The full resource name to query from the list of grantable roles. The name follows the Google Cloud Platform resource format. For example, a Cloud Platform project with id `my-project` will be named `//cloudresourcemanager.googleapis.com/projects/my-project`. + #[serde(rename="fullResourceName")] + pub full_resource_name: Option, +} + +impl RequestValue for QueryGrantableRolesRequest {} + + /// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON representation for `Empty` is empty JSON object `{}`. /// /// # Activities @@ -360,31 +392,6 @@ pub struct Empty { _never_set: Option } impl ResponseResult for Empty {} -/// Write a Cloud Audit log -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CloudAuditOptions { _never_set: Option } - -impl Part for CloudAuditOptions {} - - -/// Options for counters -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CounterOptions { - /// The field value to attribute. - pub field: Option, - /// The metric to update. - pub metric: Option, -} - -impl Part for CounterOptions {} - - /// Response message for `TestIamPermissions` method. /// /// # Activities @@ -418,17 +425,7 @@ pub struct Binding { impl Part for Binding {} -/// Write a Data Access (Gin) log -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DataAccessOptions { _never_set: Option } - -impl Part for DataAccessOptions {} - - -/// Represents a service account key. A service account can have 0 or more key pairs. The private keys for these are not stored by Google. ServiceAccountKeys are immutable. +/// Represents a service account key. A service account has two sets of key-pairs: user-managed, and system-managed. User-managed key-pairs can be created and deleted by users. Users are responsible for rotating these keys periodically to ensure security of their service accounts. Users retain the private key of these key-pairs, and Google retains ONLY the public key. System-managed key-pairs are managed automatically by Google, and rotated daily without user intervention. The private key never leaves Google's servers to maximize security. Public keys for all service accounts are also published at the OAuth2 Service Account API. /// /// # Activities /// @@ -440,20 +437,26 @@ impl Part for DataAccessOptions {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ServiceAccountKey { - /// The type of the private key. - #[serde(rename="privateKeyType")] - pub private_key_type: Option, - /// The key data. - #[serde(rename="privateKeyData")] - pub private_key_data: Option, - /// The key can be used before this timestamp. - #[serde(rename="validBeforeTime")] - pub valid_before_time: Option, - /// The resource name of the service account key in the format "projects/{project}/serviceAccounts/{email}/keys/{key}". - pub name: Option, + /// Specifies the algorithm (and possibly key size) for the key. + #[serde(rename="keyAlgorithm")] + pub key_algorithm: Option, /// The key can be used after this timestamp. #[serde(rename="validAfterTime")] pub valid_after_time: Option, + /// The private key data. Only provided in `CreateServiceAccountKey` responses. + #[serde(rename="privateKeyData")] + pub private_key_data: Option, + /// The output format for the private key. Only provided in `CreateServiceAccountKey` responses, not in `GetServiceAccountKey` or `ListServiceAccountKey` responses. Google never exposes system-managed private keys, and never retains user-managed private keys. + #[serde(rename="privateKeyType")] + pub private_key_type: Option, + /// The key can be used before this timestamp. + #[serde(rename="validBeforeTime")] + pub valid_before_time: Option, + /// The public key data. Only provided in `GetServiceAccountKey` responses. + #[serde(rename="publicKeyData")] + pub public_key_data: Option, + /// The resource name of the service account key in the following format `projects/{project}/serviceAccounts/{account}/keys/{key}`. + pub name: Option, } impl ResponseResult for ServiceAccountKey {} @@ -491,9 +494,12 @@ impl ResponseResult for SignBlobResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct CreateServiceAccountKeyRequest { - /// The type of the key requested. GOOGLE_CREDENTIALS is the default key type. + /// The output format of the private key. `GOOGLE_CREDENTIALS_FILE` is the default output format. #[serde(rename="privateKeyType")] pub private_key_type: Option, + /// Which type of key and algorithm to use for the key. The default is currently a 4K RSA key. However this may change in the future. + #[serde(rename="keyAlgorithm")] + pub key_algorithm: Option, } impl RequestValue for CreateServiceAccountKeyRequest {} @@ -510,10 +516,10 @@ impl RequestValue for CreateServiceAccountKeyRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct CreateServiceAccountRequest { - /// The ServiceAccount resource to create. Currently, only the following values are user assignable: display_name . + /// The ServiceAccount resource to create. Currently, only the following values are user assignable: `display_name` . #[serde(rename="serviceAccount")] pub service_account: Option, - /// Required. The account id that is used to generate the service account email address and a stable unique id. It is unique within a project, must be 1-63 characters long, and match the regular expression [a-z]([-a-z0-9]*[a-z0-9]) to comply with RFC1035. + /// Required. The account id that is used to generate the service account email address and a stable unique id. It is unique within a project, must be 6-30 characters long, and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])` to comply with RFC1035. #[serde(rename="accountId")] pub account_id: Option, } @@ -521,53 +527,69 @@ pub struct CreateServiceAccountRequest { impl RequestValue for CreateServiceAccountRequest {} -/// Specifies what kind of log the caller must write Increment a streamz counter with the specified metric and field names. Metric names should start with a '/', generally be lowercase-only, and end in "_count". Field names should not contain an initial slash. The actual exported metric names will have "/iam/policy" prepended. Field names correspond to IAM request parameters and field values are their respective values. At present only "iam_principal", corresponding to IAMContext.principal, is supported. Examples: counter { metric: "/debug_access_count" field: "iam_principal" } ==> increment counter /iam/policy/backend_debug_access_count {iam_principal=[value of IAMContext.principal]} At this time we do not support: * multiple field names (though this may be supported in the future) * decrementing the counter * incrementing it by anything other than 1 -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct LogConfig { - /// Counter options. - pub counter: Option, - /// Data access options. - #[serde(rename="dataAccess")] - pub data_access: Option, - /// Cloud audit options. - #[serde(rename="cloudAudit")] - pub cloud_audit: Option, -} - -impl Part for LogConfig {} - - -/// A condition to be met. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Condition { - /// Trusted attributes supplied by the IAM system. - pub iam: Option, - /// Trusted attributes supplied by any service that owns resources and uses the IAM system for access control. - pub sys: Option, - /// The objects of the condition. This is mutually exclusive with 'value'. - pub values: Option>, - /// Trusted attributes discharged by the service. - pub svc: Option, - /// The object of the condition. Exactly one of these must be set. - pub value: Option, - /// An operator to apply the subject with. - pub op: Option, -} - -impl Part for Condition {} - - // ################### // MethodBuilders ### // ################# +/// A builder providing access to all methods supported on *role* resources. +/// It is not used directly, but through the `Iam` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_iam1 as iam1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use iam1::Iam; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Iam::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `query_grantable_roles(...)` +/// // to build up your call. +/// let rb = hub.roles(); +/// # } +/// ``` +pub struct RoleMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Iam, +} + +impl<'a, C, A> MethodsBuilder for RoleMethods<'a, C, A> {} + +impl<'a, C, A> RoleMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Queries roles that can be granted on a particular resource. A role is grantable if it can be used as the role in a binding for a policy for that resource. + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn query_grantable_roles(&self, request: QueryGrantableRolesRequest) -> RoleQueryGrantableRoleCall<'a, C, A> { + RoleQueryGrantableRoleCall { + hub: self.hub, + _request: request, + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + /// A builder providing access to all methods supported on *project* resources. /// It is not used directly, but through the `Iam` hub. /// @@ -608,11 +630,11 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists service account keys + /// Lists ServiceAccountKeys. /// /// # Arguments /// - /// * `name` - The resource name of the service account in the format "projects/{project}/serviceAccounts/{account}". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account. + /// * `name` - The resource name of the service account in the following format: `projects/{project}/serviceAccounts/{account}`. Using `-` as a wildcard for the project, will infer the project from the account. The `account` value can be the `email` address or the `unique_id` of the service account. pub fn service_accounts_keys_list(&self, name: &str) -> ProjectServiceAccountKeyListCall<'a, C, A> { ProjectServiceAccountKeyListCall { hub: self.hub, @@ -626,12 +648,12 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Sets the IAM access control policy for the specified IAM resource. + /// Sets the IAM access control policy for a ServiceAccount. /// /// # Arguments /// /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `setIamPolicy` documentation. + /// * `resource` - REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path. For example, a Project resource is specified as `projects/{project}`. pub fn service_accounts_set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> ProjectServiceAccountSetIamPolicyCall<'a, C, A> { ProjectServiceAccountSetIamPolicyCall { hub: self.hub, @@ -645,11 +667,11 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Deletes a service account key. + /// Deletes a ServiceAccountKey. /// /// # Arguments /// - /// * `name` - The resource name of the service account key in the format "projects/{project}/serviceAccounts/{account}/keys/{key}". Using '-' as a wildcard for the project will infer the project from the account. The account value can be the email address or the unique_id of the service account. + /// * `name` - The resource name of the service account key in the following format: `projects/{project}/serviceAccounts/{account}/keys/{key}`. Using `-` as a wildcard for the project will infer the project from the account. The `account` value can be the `email` address or the `unique_id` of the service account. pub fn service_accounts_keys_delete(&self, name: &str) -> ProjectServiceAccountKeyDeleteCall<'a, C, A> { ProjectServiceAccountKeyDeleteCall { hub: self.hub, @@ -662,12 +684,12 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Creates a service account key and returns it. + /// Creates a ServiceAccountKey and returns it. /// /// # Arguments /// /// * `request` - No description provided. - /// * `name` - The resource name of the service account in the format "projects/{project}/serviceAccounts/{account}". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account. + /// * `name` - The resource name of the service account in the following format: `projects/{project}/serviceAccounts/{account}`. Using `-` as a wildcard for the project will infer the project from the account. The `account` value can be the `email` address or the `unique_id` of the service account. pub fn service_accounts_keys_create(&self, request: CreateServiceAccountKeyRequest, name: &str) -> ProjectServiceAccountKeyCreateCall<'a, C, A> { ProjectServiceAccountKeyCreateCall { hub: self.hub, @@ -681,12 +703,12 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Signs a blob using a service account. + /// Signs a blob using a service account's system-managed private key. /// /// # Arguments /// /// * `request` - No description provided. - /// * `name` - The resource name of the service account in the format "projects/{project}/serviceAccounts/{account}". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account. + /// * `name` - The resource name of the service account in the following format: `projects/{project}/serviceAccounts/{account}`. Using `-` as a wildcard for the project will infer the project from the account. The `account` value can be the `email` address or the `unique_id` of the service account. pub fn service_accounts_sign_blob(&self, request: SignBlobRequest, name: &str) -> ProjectServiceAccountSignBlobCall<'a, C, A> { ProjectServiceAccountSignBlobCall { hub: self.hub, @@ -700,12 +722,12 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates a service account. Currently, only the following fields are updatable: 'display_name' . The 'etag' is mandatory. + /// Updates a ServiceAccount. Currently, only the following fields are updatable: `display_name` . The `etag` is mandatory. /// /// # Arguments /// /// * `request` - No description provided. - /// * `name` - The resource name of the service account in the format "projects/{project}/serviceAccounts/{account}". In requests using '-' as a wildcard for the project, will infer the project from the account and the account value can be the email address or the unique_id of the service account. In responses the resource name will always be in the format "projects/{project}/serviceAccounts/{email}". + /// * `name` - The resource name of the service account in the following format: `projects/{project}/serviceAccounts/{account}`. Requests using `-` as a wildcard for the project will infer the project from the `account` and the `account` value can be the `email` address or the `unique_id` of the service account. In responses the resource name will always be in the format `projects/{project}/serviceAccounts/{email}`. pub fn service_accounts_update(&self, request: ServiceAccount, name: &str) -> ProjectServiceAccountUpdateCall<'a, C, A> { ProjectServiceAccountUpdateCall { hub: self.hub, @@ -719,11 +741,11 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists service accounts for a project. + /// Lists ServiceAccounts for a project. /// /// # Arguments /// - /// * `name` - Required. The resource name of the project associated with the service accounts, such as "projects/123" + /// * `name` - Required. The resource name of the project associated with the service accounts, such as `projects/my-project-123`. pub fn service_accounts_list(&self, name: &str) -> ProjectServiceAccountListCall<'a, C, A> { ProjectServiceAccountListCall { hub: self.hub, @@ -738,11 +760,11 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Deletes a service acount. + /// Deletes a ServiceAccount. /// /// # Arguments /// - /// * `name` - The resource name of the service account in the format "projects/{project}/serviceAccounts/{account}". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account. + /// * `name` - The resource name of the service account in the following format: `projects/{project}/serviceAccounts/{account}`. Using `-` as a wildcard for the project will infer the project from the account. The `account` value can be the `email` address or the `unique_id` of the service account. pub fn service_accounts_delete(&self, name: &str) -> ProjectServiceAccountDeleteCall<'a, C, A> { ProjectServiceAccountDeleteCall { hub: self.hub, @@ -759,11 +781,12 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// /// # Arguments /// - /// * `name` - The resource name of the service account key in the format "projects/{project}/serviceAccounts/{account}/keys/{key}". Using '-' as a wildcard for the project will infer the project from the account. The account value can be the email address or the unique_id of the service account. + /// * `name` - The resource name of the service account key in the following format: `projects/{project}/serviceAccounts/{account}/keys/{key}`. Using `-` as a wildcard for the project will infer the project from the account. The `account` value can be the `email` address or the `unique_id` of the service account. pub fn service_accounts_keys_get(&self, name: &str) -> ProjectServiceAccountKeyGetCall<'a, C, A> { ProjectServiceAccountKeyGetCall { hub: self.hub, _name: name.to_string(), + _public_key_type: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -772,11 +795,11 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Returns the IAM access control policy for specified IAM resource. + /// Returns the IAM access control policy for a ServiceAccount. /// /// # Arguments /// - /// * `resource` - REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation. + /// * `resource` - REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path. For example, a Project resource is specified as `projects/{project}`. pub fn service_accounts_get_iam_policy(&self, resource: &str) -> ProjectServiceAccountGetIamPolicyCall<'a, C, A> { ProjectServiceAccountGetIamPolicyCall { hub: self.hub, @@ -789,12 +812,12 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Tests the specified permissions against the IAM access control policy for the specified IAM resource. + /// Tests the specified permissions against the IAM access control policy for a ServiceAccount. /// /// # Arguments /// /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `testIamPermissions` documentation. + /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path. For example, a Project resource is specified as `projects/{project}`. pub fn service_accounts_test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> ProjectServiceAccountTestIamPermissionCall<'a, C, A> { ProjectServiceAccountTestIamPermissionCall { hub: self.hub, @@ -808,12 +831,12 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Creates a service account and returns it. + /// Creates a ServiceAccount and returns it. /// /// # Arguments /// /// * `request` - No description provided. - /// * `name` - Required. The resource name of the project associated with the service accounts, such as "projects/123" + /// * `name` - Required. The resource name of the project associated with the service accounts, such as `projects/my-project-123`. pub fn service_accounts_create(&self, request: CreateServiceAccountRequest, name: &str) -> ProjectServiceAccountCreateCall<'a, C, A> { ProjectServiceAccountCreateCall { hub: self.hub, @@ -827,11 +850,11 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets a ServiceAccount + /// Gets a ServiceAccount. /// /// # Arguments /// - /// * `name` - The resource name of the service account in the format "projects/{project}/serviceAccounts/{account}". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account. + /// * `name` - The resource name of the service account in the following format: `projects/{project}/serviceAccounts/{account}`. Using `-` as a wildcard for the project will infer the project from the account. The `account` value can be the `email` address or the `unique_id` of the service account. pub fn service_accounts_get(&self, name: &str) -> ProjectServiceAccountGetCall<'a, C, A> { ProjectServiceAccountGetCall { hub: self.hub, @@ -851,7 +874,246 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { // CallBuilders ### // ################# -/// Lists service account keys +/// Queries roles that can be granted on a particular resource. A role is grantable if it can be used as the role in a binding for a policy for that resource. +/// +/// A builder for the *queryGrantableRoles* method supported by a *role* resource. +/// It is not used directly, but through a `RoleMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_iam1 as iam1; +/// use iam1::QueryGrantableRolesRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use iam1::Iam; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Iam::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = QueryGrantableRolesRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.roles().query_grantable_roles(req) +/// .doit(); +/// # } +/// ``` +pub struct RoleQueryGrantableRoleCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Iam, + _request: QueryGrantableRolesRequest, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RoleQueryGrantableRoleCall<'a, C, A> {} + +impl<'a, C, A> RoleQueryGrantableRoleCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, QueryGrantableRolesResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "iam.roles.queryGrantableRoles", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + for &field in ["alt"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://iam.googleapis.com/v1/roles:queryGrantableRoles".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: QueryGrantableRolesRequest) -> RoleQueryGrantableRoleCall<'a, C, A> { + self._request = new_value; + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> RoleQueryGrantableRoleCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> RoleQueryGrantableRoleCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> RoleQueryGrantableRoleCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Lists ServiceAccountKeys. /// /// A builder for the *serviceAccounts.keys.list* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -1035,7 +1297,7 @@ impl<'a, C, A> ProjectServiceAccountKeyListCall<'a, C, A> where C: BorrowMut ProjectServiceAccountKeyListCall<'a, C, A> where C: BorrowMut ProjectServiceAccountKeyListCall<'a, C, A> where C: BorrowMut ProjectServiceAccountSetIamPolicyCall<'a, C, A> where C: BorrowMu self._request = new_value; self } - /// REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `setIamPolicy` documentation. + /// REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path. For example, a Project resource is specified as `projects/{project}`. /// /// Sets the *resource* path property to the given value. /// @@ -1387,7 +1649,7 @@ impl<'a, C, A> ProjectServiceAccountSetIamPolicyCall<'a, C, A> where C: BorrowMu } -/// Deletes a service account key. +/// Deletes a ServiceAccountKey. /// /// A builder for the *serviceAccounts.keys.delete* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -1564,7 +1826,7 @@ impl<'a, C, A> ProjectServiceAccountKeyDeleteCall<'a, C, A> where C: BorrowMut ProjectServiceAccountKeyDeleteCall<'a, C, A> where C: BorrowMut ProjectServiceAccountKeyCreateCall<'a, C, A> where C: BorrowMut ProjectServiceAccountKeyCreateCall<'a, C, A> where C: BorrowMut ProjectServiceAccountSignBlobCall<'a, C, A> where C: BorrowMut ProjectServiceAccountSignBlobCall<'a, C, A> where C: BorrowMut ProjectServiceAccountUpdateCall<'a, C, A> where C: BorrowMut ProjectServiceAccountUpdateCall<'a, C, A> where C: BorrowMut ProjectServiceAccountListCall<'a, C, A> where C: BorrowMut ProjectServiceAccountListCall<'a, C, A> where C: BorrowMut ProjectServiceAccountListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Optional limit on the number of service accounts to include in the response. Further accounts can subsequently be obtained by including the [ListServiceAccountsResponse.next_page_token] in a subsequent request. + /// Optional limit on the number of service accounts to include in the response. Further accounts can subsequently be obtained by including the ListServiceAccountsResponse.next_page_token in a subsequent request. /// /// Sets the *page size* query property to the given value. pub fn page_size(mut self, new_value: i32) -> ProjectServiceAccountListCall<'a, C, A> { @@ -2729,7 +2991,7 @@ impl<'a, C, A> ProjectServiceAccountListCall<'a, C, A> where C: BorrowMut ProjectServiceAccountDeleteCall<'a, C, A> where C: BorrowMut ProjectServiceAccountDeleteCall<'a, C, A> where C: BorrowMut hub: &'a Iam, _name: String, + _public_key_type: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap @@ -3031,9 +3295,12 @@ impl<'a, C, A> ProjectServiceAccountKeyGetCall<'a, C, A> where C: BorrowMut = Vec::with_capacity((3 + self._additional_params.len())); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("name", self._name.to_string())); - for &field in ["alt", "name"].iter() { + if let Some(value) = self._public_key_type { + params.push(("publicKeyType", value.to_string())); + } + for &field in ["alt", "name", "publicKeyType"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -3151,7 +3418,7 @@ impl<'a, C, A> ProjectServiceAccountKeyGetCall<'a, C, A> where C: BorrowMut ProjectServiceAccountKeyGetCall<'a, C, A> where C: BorrowMut ProjectServiceAccountKeyGetCall<'a, C, A> { + self._public_key_type = Some(new_value.to_string()); + self + } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// @@ -3219,7 +3493,7 @@ impl<'a, C, A> ProjectServiceAccountKeyGetCall<'a, C, A> where C: BorrowMut ProjectServiceAccountGetIamPolicyCall<'a, C, A> where C: BorrowMu } - /// REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation. + /// REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path. For example, a Project resource is specified as `projects/{project}`. /// /// Sets the *resource* path property to the given value. /// @@ -3464,7 +3738,7 @@ impl<'a, C, A> ProjectServiceAccountGetIamPolicyCall<'a, C, A> where C: BorrowMu } -/// Tests the specified permissions against the IAM access control policy for the specified IAM resource. +/// Tests the specified permissions against the IAM access control policy for a ServiceAccount. /// /// A builder for the *serviceAccounts.testIamPermissions* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -3672,7 +3946,7 @@ impl<'a, C, A> ProjectServiceAccountTestIamPermissionCall<'a, C, A> where C: Bor self._request = new_value; self } - /// REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `testIamPermissions` documentation. + /// REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path. For example, a Project resource is specified as `projects/{project}`. /// /// Sets the *resource* path property to the given value. /// @@ -3740,7 +4014,7 @@ impl<'a, C, A> ProjectServiceAccountTestIamPermissionCall<'a, C, A> where C: Bor } -/// Creates a service account and returns it. +/// Creates a ServiceAccount and returns it. /// /// A builder for the *serviceAccounts.create* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -3948,7 +4222,7 @@ impl<'a, C, A> ProjectServiceAccountCreateCall<'a, C, A> where C: BorrowMut ProjectServiceAccountCreateCall<'a, C, A> where C: BorrowMut ProjectServiceAccountGetCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with Identity Toolkit (protocol v3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/identitytoolkit3-cli" diff --git a/gen/identitytoolkit3-cli/README.md b/gen/identitytoolkit3-cli/README.md index 27f05357ed..9046417f1c 100644 --- a/gen/identitytoolkit3-cli/README.md +++ b/gen/identitytoolkit3-cli/README.md @@ -24,7 +24,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Identity Toolkit* API at revision *20160812*. The CLI is at version *1.0.0*. +This documentation was generated from the *Identity Toolkit* API at revision *20161206*. The CLI is at version *1.0.0*. ```bash identitytoolkit3 [options] @@ -49,6 +49,10 @@ identitytoolkit3 [options] identitytoolkit3 --help Configuration: + [--scope ]... + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. + If unset, it defaults to the shortest scope url for a particular method. --config-dir A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. diff --git a/gen/identitytoolkit3-cli/mkdocs.yml b/gen/identitytoolkit3-cli/mkdocs.yml index b19ec1ce7d..80d6b2e4e6 100644 --- a/gen/identitytoolkit3-cli/mkdocs.yml +++ b/gen/identitytoolkit3-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Identity Toolkit v1.0.0+20160812 +site_name: Identity Toolkit v1.0.0+20161206 site_url: http://byron.github.io/google-apis-rs/google-identitytoolkit3-cli site_description: Write integrating applications with bcore diff --git a/gen/identitytoolkit3-cli/src/main.rs b/gen/identitytoolkit3-cli/src/main.rs index a5c12f1574..8e6a732b8b 100644 --- a/gen/identitytoolkit3-cli/src/main.rs +++ b/gen/identitytoolkit3-cli/src/main.rs @@ -80,9 +80,10 @@ impl<'n> Engine<'n> { "context" => Some(("context", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "app-id" => Some(("appId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "continue-uri" => Some(("continueUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "custom-parameter" => Some(("customParameter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "identifier" => Some(("identifier", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["app-id", "auth-flow-type", "client-id", "context", "continue-uri", "hosted-domain", "identifier", "oauth-consumer-key", "oauth-scope", "openid-realm", "ota-app", "provider-id", "session-id"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["app-id", "auth-flow-type", "client-id", "context", "continue-uri", "custom-parameter", "hosted-domain", "identifier", "oauth-consumer-key", "oauth-scope", "openid-realm", "ota-app", "provider-id", "session-id"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -119,6 +120,9 @@ impl<'n> Engine<'n> { Ok(()) } else { assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } let mut ostream = match writer_from_opts(opt.value_of("out")) { Ok(mut f) => f, Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), @@ -203,6 +207,9 @@ impl<'n> Engine<'n> { Ok(()) } else { assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } let mut ostream = match writer_from_opts(opt.value_of("out")) { Ok(mut f) => f, Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), @@ -247,10 +254,11 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "next-page-token" => Some(("nextPageToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "target-project-id" => Some(("targetProjectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "delegated-project-number" => Some(("delegatedProjectNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "max-results" => Some(("maxResults", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["delegated-project-number", "max-results", "next-page-token"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["delegated-project-number", "max-results", "next-page-token", "target-project-id"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -287,6 +295,9 @@ impl<'n> Engine<'n> { Ok(()) } else { assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } let mut ostream = match writer_from_opts(opt.value_of("out")) { Ok(mut f) => f, Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), @@ -372,6 +383,9 @@ impl<'n> Engine<'n> { Ok(()) } else { assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } let mut ostream = match writer_from_opts(opt.value_of("out")) { Ok(mut f) => f, Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), @@ -461,6 +475,9 @@ impl<'n> Engine<'n> { Ok(()) } else { assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } let mut ostream = match writer_from_opts(opt.value_of("out")) { Ok(mut f) => f, Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), @@ -517,6 +534,9 @@ impl<'n> Engine<'n> { Ok(()) } else { assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } let mut ostream = match writer_from_opts(opt.value_of("out")) { Ok(mut f) => f, Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), @@ -566,6 +586,9 @@ impl<'n> Engine<'n> { Ok(()) } else { assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } let mut ostream = match writer_from_opts(opt.value_of("out")) { Ok(mut f) => f, Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), @@ -615,6 +638,9 @@ impl<'n> Engine<'n> { Ok(()) } else { assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } let mut ostream = match writer_from_opts(opt.value_of("out")) { Ok(mut f) => f, Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), @@ -700,6 +726,9 @@ impl<'n> Engine<'n> { Ok(()) } else { assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } let mut ostream = match writer_from_opts(opt.value_of("out")) { Ok(mut f) => f, Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), @@ -802,6 +831,9 @@ impl<'n> Engine<'n> { Ok(()) } else { assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } let mut ostream = match writer_from_opts(opt.value_of("out")) { Ok(mut f) => f, Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), @@ -913,6 +945,9 @@ impl<'n> Engine<'n> { Ok(()) } else { assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } let mut ostream = match writer_from_opts(opt.value_of("out")) { Ok(mut f) => f, Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), @@ -996,6 +1031,9 @@ impl<'n> Engine<'n> { Ok(()) } else { assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } let mut ostream = match writer_from_opts(opt.value_of("out")) { Ok(mut f) => f, Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), @@ -1039,15 +1077,18 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "instance-id" => Some(("instanceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "photo-url" => Some(("photoUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "instance-id" => Some(("instanceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "email-verified" => Some(("emailVerified", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "disabled" => Some(("disabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "captcha-response" => Some(("captchaResponse", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id-token" => Some(("idToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "captcha-challenge" => Some(("captchaChallenge", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "password" => Some(("password", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "email" => Some(("email", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["captcha-challenge", "captcha-response", "display-name", "email", "id-token", "instance-id", "password"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["captcha-challenge", "captcha-response", "disabled", "display-name", "email", "email-verified", "id-token", "instance-id", "password", "photo-url"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1084,6 +1125,9 @@ impl<'n> Engine<'n> { Ok(()) } else { assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } let mut ostream = match writer_from_opts(opt.value_of("out")) { Ok(mut f) => f, Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), @@ -1129,12 +1173,15 @@ impl<'n> Engine<'n> { match &temp_cursor.to_string()[..] { "hash-algorithm" => Some(("hashAlgorithm", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "delegated-project-number" => Some(("delegatedProjectNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "allow-overwrite" => Some(("allowOverwrite", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "sanity-check" => Some(("sanityCheck", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "signer-key" => Some(("signerKey", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "memory-cost" => Some(("memoryCost", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "salt-separator" => Some(("saltSeparator", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "target-project-id" => Some(("targetProjectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "rounds" => Some(("rounds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["delegated-project-number", "hash-algorithm", "memory-cost", "rounds", "salt-separator", "signer-key"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["allow-overwrite", "delegated-project-number", "hash-algorithm", "memory-cost", "rounds", "salt-separator", "sanity-check", "signer-key", "target-project-id"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1171,6 +1218,9 @@ impl<'n> Engine<'n> { Ok(()) } else { assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } let mut ostream = match writer_from_opts(opt.value_of("out")) { Ok(mut f) => f, Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), @@ -1262,6 +1312,9 @@ impl<'n> Engine<'n> { Ok(()) } else { assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } let mut ostream = match writer_from_opts(opt.value_of("out")) { Ok(mut f) => f, Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), @@ -1347,6 +1400,9 @@ impl<'n> Engine<'n> { Ok(()) } else { assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } let mut ostream = match writer_from_opts(opt.value_of("out")) { Ok(mut f) => f, Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), @@ -1437,6 +1493,9 @@ impl<'n> Engine<'n> { Ok(()) } else { assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } let mut ostream = match writer_from_opts(opt.value_of("out")) { Ok(mut f) => f, Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), @@ -1966,9 +2025,14 @@ fn main() { let mut app = App::new("identitytoolkit3") .author("Sebastian Thiel ") - .version("1.0.0+20160812") + .version("1.0.0+20161206") .about("Help the third party sites to implement federated login.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_identitytoolkit3_cli") + .arg(Arg::with_name("url") + .long("scope") + .help("Specify the authentication a method should be executed in. Each scope requires the user to grant this application permission to use it.If unset, it defaults to the shortest scope url for a particular method.") + .multiple(true) + .takes_value(true)) .arg(Arg::with_name("folder") .long("config-dir") .help("A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation.[default: ~/.google-service-cli") diff --git a/gen/identitytoolkit3/Cargo.toml b/gen/identitytoolkit3/Cargo.toml index e69d79eb15..b51ba89d2c 100644 --- a/gen/identitytoolkit3/Cargo.toml +++ b/gen/identitytoolkit3/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-identitytoolkit3" -version = "1.0.0+20160812" +version = "1.0.0+20161206" authors = ["Sebastian Thiel "] description = "A complete library to interact with Identity Toolkit (protocol v3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/identitytoolkit3" diff --git a/gen/identitytoolkit3/README.md b/gen/identitytoolkit3/README.md index 12f82cdea9..d0f773e63c 100644 --- a/gen/identitytoolkit3/README.md +++ b/gen/identitytoolkit3/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-identitytoolkit3` library allows access to all features of the *Google Identity Toolkit* service. -This documentation was generated from *Identity Toolkit* crate version *1.0.0+20160812*, where *20160812* is the exact revision of the *identitytoolkit:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *Identity Toolkit* crate version *1.0.0+20161206*, where *20161206* is the exact revision of the *identitytoolkit:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *Identity Toolkit* *v3* API can be found at the [official documentation site](https://developers.google.com/identity-toolkit/v3/). diff --git a/gen/identitytoolkit3/src/lib.rs b/gen/identitytoolkit3/src/lib.rs index ee89c317ca..905514d1bf 100644 --- a/gen/identitytoolkit3/src/lib.rs +++ b/gen/identitytoolkit3/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Identity Toolkit* crate version *1.0.0+20160812*, where *20160812* is the exact revision of the *identitytoolkit:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *Identity Toolkit* crate version *1.0.0+20161206*, where *20161206* is the exact revision of the *identitytoolkit:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *Identity Toolkit* *v3* API can be found at the //! [official documentation site](https://developers.google.com/identity-toolkit/v3/). diff --git a/gen/identitytoolkit3/src/lib.rs.in b/gen/identitytoolkit3/src/lib.rs.in index 1838559333..597614b3c4 100644 --- a/gen/identitytoolkit3/src/lib.rs.in +++ b/gen/identitytoolkit3/src/lib.rs.in @@ -35,6 +35,32 @@ pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, // UTILITIES ### // ############ +/// Identifies the an OAuth2 authorization scope. +/// A scope is needed when requesting an +/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). +#[derive(PartialEq, Eq, Hash)] +pub enum Scope { + /// View and manage your data across Google Cloud Platform services + CloudPlatform, + + /// View and administer all your Firebase data and settings + Firebase, +} + +impl AsRef for Scope { + fn as_ref(&self) -> &str { + match *self { + Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform", + Scope::Firebase => "https://www.googleapis.com/auth/firebase", + } + } +} + +impl Default for Scope { + fn default() -> Scope { + Scope::Firebase + } +} @@ -206,9 +232,9 @@ impl ResponseResult for IdentitytoolkitRelyingpartySetProjectConfigResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct IdentitytoolkitRelyingpartyGetProjectConfigResponse { - /// Whether to allow password user sign in or sign up. - #[serde(rename="allowPasswordUser")] - pub allow_password_user: Option, + /// no description provided + #[serde(rename="dynamicLinksDomain")] + pub dynamic_links_domain: Option, /// Browser API key, needed when making http request to Apiary. #[serde(rename="apiKey")] pub api_key: Option, @@ -233,6 +259,9 @@ pub struct IdentitytoolkitRelyingpartyGetProjectConfigResponse { /// Verify email template. #[serde(rename="verifyEmailTemplate")] pub verify_email_template: Option, + /// Whether to allow password user sign in or sign up. + #[serde(rename="allowPasswordUser")] + pub allow_password_user: Option, /// Reset password email template. #[serde(rename="resetPasswordTemplate")] pub reset_password_template: Option, @@ -468,10 +497,16 @@ impl ResponseResult for VerifyPasswordResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ResetPasswordResponse { + /// The request type. + #[serde(rename="requestType")] + pub request_type: Option, /// The fixed string "identitytoolkit#ResetPasswordResponse". pub kind: Option, - /// The user's email. + /// The user's email. If the out-of-band code is for email recovery, the user's original email. pub email: Option, + /// If the out-of-band code is for email recovery, the user's new email. + #[serde(rename="newEmail")] + pub new_email: Option, } impl ResponseResult for ResetPasswordResponse {} @@ -541,6 +576,9 @@ pub struct IdentitytoolkitRelyingpartyCreateAuthUriRequest { /// The URI to which the IDP redirects the user after the federated login flow. #[serde(rename="continueUri")] pub continue_uri: Option, + /// The query parameter that client can customize by themselves in auth url. The following parameters are reserved for server so that they cannot be customized by clients: client_id, response_type, scope, redirect_uri, state, oauth_token. + #[serde(rename="customParameter")] + pub custom_parameter: Option>, /// Optional realm for OpenID protocol. The sub string "scheme://domain:port" of the param "continueUri" is used if this is not set. #[serde(rename="openidRealm")] pub openid_realm: Option, @@ -560,21 +598,29 @@ impl RequestValue for IdentitytoolkitRelyingpartyCreateAuthUriRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct IdentitytoolkitRelyingpartySignupNewUserRequest { - /// Response to the captcha. - #[serde(rename="captchaResponse")] - pub captcha_response: Option, /// The name of the user. #[serde(rename="displayName")] pub display_name: Option, - /// The captcha challenge. - #[serde(rename="captchaChallenge")] - pub captcha_challenge: Option, + /// The photo url of the user. + #[serde(rename="photoUrl")] + pub photo_url: Option, /// Instance id token of the app. #[serde(rename="instanceId")] pub instance_id: Option, + /// Mark the email as verified or not. Only can be used by service account. + #[serde(rename="emailVerified")] + pub email_verified: Option, + /// Whether to disable the user. Only can be used by service account. + pub disabled: Option, + /// Response to the captcha. + #[serde(rename="captchaResponse")] + pub captcha_response: Option, /// The GITKit token of the authenticated user. #[serde(rename="idToken")] pub id_token: Option, + /// The captcha challenge. + #[serde(rename="captchaChallenge")] + pub captcha_challenge: Option, /// The new password of the user. pub password: Option, /// The email of the user. @@ -613,6 +659,9 @@ pub struct IdentitytoolkitRelyingpartyDownloadAccountRequest { /// The token for the next page. This should be taken from the previous response. #[serde(rename="nextPageToken")] pub next_page_token: Option, + /// Specify which project (field value is actually project id) to operate. Only used when provided credential. + #[serde(rename="targetProjectId")] + pub target_project_id: Option, /// GCP project number of the requesting delegated app. Currently only intended for Firebase V1 migration. #[serde(rename="delegatedProjectNumber")] pub delegated_project_number: Option, @@ -987,24 +1036,21 @@ pub struct UserInfoProviderUserInfo { /// User's identifier at IDP. #[serde(rename="federatedId")] pub federated_id: Option, + /// The IdP ID. For white listed IdPs it's a short domain name, e.g., google.com, aol.com, live.net and yahoo.com. For other OpenID IdPs it's the OP identifier. + #[serde(rename="providerId")] + pub provider_id: Option, /// The user's display name at the IDP. #[serde(rename="displayName")] pub display_name: Option, /// The user's photo url at the IDP. #[serde(rename="photoUrl")] pub photo_url: Option, - /// Raw IDP-returned user info. - #[serde(rename="rawUserInfo")] - pub raw_user_info: Option, - /// The IdP ID. For white listed IdPs it's a short domain name, e.g., google.com, aol.com, live.net and yahoo.com. For other OpenID IdPs it's the OP identifier. - #[serde(rename="providerId")] - pub provider_id: Option, /// User's raw identifier directly returned from IDP. #[serde(rename="rawId")] pub raw_id: Option, /// User's email at IDP. pub email: Option, - /// User's screen name at Twitter. + /// User's screen name at Twitter or login name at Github. #[serde(rename="screenName")] pub screen_name: Option, } @@ -1111,7 +1157,7 @@ pub struct VerifyAssertionResponse { pub nick_name: Option, /// The email returned by the IdP. NOTE: The federated login user may not own the email. pub email: Option, - /// The screen_name of a Twitter user. + /// The screen_name of a Twitter user or the login name at Github. #[serde(rename="screenName")] pub screen_name: Option, /// URL for OTA app installation. @@ -1266,17 +1312,26 @@ pub struct IdentitytoolkitRelyingpartyUploadAccountRequest { /// GCP project number of the requesting delegated app. Currently only intended for Firebase V1 migration. #[serde(rename="delegatedProjectNumber")] pub delegated_project_number: Option, - /// Memory cost for hash calculation. Used by scrypt similar algorithms. - #[serde(rename="memoryCost")] - pub memory_cost: Option, + /// Whether allow overwrite existing account when user local_id exists. + #[serde(rename="allowOverwrite")] + pub allow_overwrite: Option, /// The account info to be stored. pub users: Option>, - /// The salt separator. - #[serde(rename="saltSeparator")] - pub salt_separator: Option, + /// If true, backend will do sanity check(including duplicate email and federated id) when uploading account. + #[serde(rename="sanityCheck")] + pub sanity_check: Option, /// The key for to hash the password. #[serde(rename="signerKey")] pub signer_key: Option, + /// Memory cost for hash calculation. Used by scrypt similar algorithms. + #[serde(rename="memoryCost")] + pub memory_cost: Option, + /// The salt separator. + #[serde(rename="saltSeparator")] + pub salt_separator: Option, + /// Specify which project (field value is actually project id) to operate. Only used when provided credential. + #[serde(rename="targetProjectId")] + pub target_project_id: Option, /// Rounds for hash calculation. Used by scrypt and similar algorithms. pub rounds: Option, } @@ -1290,12 +1345,12 @@ impl RequestValue for IdentitytoolkitRelyingpartyUploadAccountRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct UserInfo { - /// last login timestamp. - #[serde(rename="lastLoginAt")] - pub last_login_at: Option, - /// The name of the user. - #[serde(rename="displayName")] - pub display_name: Option, + /// The user's plain text password. + #[serde(rename="rawPassword")] + pub raw_password: Option, + /// The user's hashed password. + #[serde(rename="passwordHash")] + pub password_hash: Option, /// The local ID of the user. #[serde(rename="localId")] pub local_id: Option, @@ -1305,30 +1360,36 @@ pub struct UserInfo { /// The URL of the user profile photo. #[serde(rename="photoUrl")] pub photo_url: Option, + /// last login timestamp. + #[serde(rename="lastLoginAt")] + pub last_login_at: Option, + /// Whether the user is authenticated by the developer. + #[serde(rename="customAuth")] + pub custom_auth: Option, + /// Whether the user is disabled. + pub disabled: Option, + /// The timestamp when the password was last updated. + #[serde(rename="passwordUpdatedAt")] + pub password_updated_at: Option, + /// User creation timestamp. + #[serde(rename="createdAt")] + pub created_at: Option, + /// The name of the user. + #[serde(rename="displayName")] + pub display_name: Option, /// Whether the email has been verified. #[serde(rename="emailVerified")] pub email_verified: Option, - /// The user's hashed password. - #[serde(rename="passwordHash")] - pub password_hash: Option, - /// Whether the user is disabled. - pub disabled: Option, /// Version of the user's password. pub version: Option, /// The IDP of the user. #[serde(rename="providerUserInfo")] pub provider_user_info: Option>, - /// The timestamp when the password was last updated. - #[serde(rename="passwordUpdatedAt")] - pub password_updated_at: Option, /// The user's password salt. pub salt: Option, /// The email of the user. pub email: Option, - /// User creation timestamp. - #[serde(rename="createdAt")] - pub created_at: Option, - /// User's screen name at Twitter. + /// User's screen name at Twitter or login name at Github. #[serde(rename="screenName")] pub screen_name: Option, } @@ -1467,6 +1528,7 @@ impl<'a, C, A> RelyingpartyMethods<'a, C, A> { hub: self.hub, _request: request, _delegate: Default::default(), + _scopes: Default::default(), _additional_params: Default::default(), } } @@ -1483,6 +1545,7 @@ impl<'a, C, A> RelyingpartyMethods<'a, C, A> { hub: self.hub, _request: request, _delegate: Default::default(), + _scopes: Default::default(), _additional_params: Default::default(), } } @@ -1499,6 +1562,7 @@ impl<'a, C, A> RelyingpartyMethods<'a, C, A> { hub: self.hub, _request: request, _delegate: Default::default(), + _scopes: Default::default(), _additional_params: Default::default(), } } @@ -1515,6 +1579,7 @@ impl<'a, C, A> RelyingpartyMethods<'a, C, A> { hub: self.hub, _request: request, _delegate: Default::default(), + _scopes: Default::default(), _additional_params: Default::default(), } } @@ -1531,6 +1596,7 @@ impl<'a, C, A> RelyingpartyMethods<'a, C, A> { hub: self.hub, _request: request, _delegate: Default::default(), + _scopes: Default::default(), _additional_params: Default::default(), } } @@ -1547,6 +1613,7 @@ impl<'a, C, A> RelyingpartyMethods<'a, C, A> { hub: self.hub, _request: request, _delegate: Default::default(), + _scopes: Default::default(), _additional_params: Default::default(), } } @@ -1563,6 +1630,7 @@ impl<'a, C, A> RelyingpartyMethods<'a, C, A> { hub: self.hub, _request: request, _delegate: Default::default(), + _scopes: Default::default(), _additional_params: Default::default(), } } @@ -1579,6 +1647,7 @@ impl<'a, C, A> RelyingpartyMethods<'a, C, A> { hub: self.hub, _request: request, _delegate: Default::default(), + _scopes: Default::default(), _additional_params: Default::default(), } } @@ -1595,6 +1664,7 @@ impl<'a, C, A> RelyingpartyMethods<'a, C, A> { hub: self.hub, _request: request, _delegate: Default::default(), + _scopes: Default::default(), _additional_params: Default::default(), } } @@ -1611,6 +1681,7 @@ impl<'a, C, A> RelyingpartyMethods<'a, C, A> { hub: self.hub, _request: request, _delegate: Default::default(), + _scopes: Default::default(), _additional_params: Default::default(), } } @@ -1627,6 +1698,7 @@ impl<'a, C, A> RelyingpartyMethods<'a, C, A> { hub: self.hub, _request: request, _delegate: Default::default(), + _scopes: Default::default(), _additional_params: Default::default(), } } @@ -1643,6 +1715,7 @@ impl<'a, C, A> RelyingpartyMethods<'a, C, A> { hub: self.hub, _request: request, _delegate: Default::default(), + _scopes: Default::default(), _additional_params: Default::default(), } } @@ -1654,6 +1727,7 @@ impl<'a, C, A> RelyingpartyMethods<'a, C, A> { RelyingpartyGetPublicKeyCall { hub: self.hub, _delegate: Default::default(), + _scopes: Default::default(), _additional_params: Default::default(), } } @@ -1665,6 +1739,7 @@ impl<'a, C, A> RelyingpartyMethods<'a, C, A> { RelyingpartyGetRecaptchaParamCall { hub: self.hub, _delegate: Default::default(), + _scopes: Default::default(), _additional_params: Default::default(), } } @@ -1681,6 +1756,7 @@ impl<'a, C, A> RelyingpartyMethods<'a, C, A> { hub: self.hub, _request: request, _delegate: Default::default(), + _scopes: Default::default(), _additional_params: Default::default(), } } @@ -1697,6 +1773,7 @@ impl<'a, C, A> RelyingpartyMethods<'a, C, A> { hub: self.hub, _request: request, _delegate: Default::default(), + _scopes: Default::default(), _additional_params: Default::default(), } } @@ -1710,6 +1787,7 @@ impl<'a, C, A> RelyingpartyMethods<'a, C, A> { _project_number: Default::default(), _delegated_project_number: Default::default(), _delegate: Default::default(), + _scopes: Default::default(), _additional_params: Default::default(), } } @@ -1766,6 +1844,7 @@ pub struct RelyingpartyGetOobConfirmationCodeCall<'a, C, A> _request: Relyingparty, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, + _scopes: BTreeMap } impl<'a, C, A> CallBuilder for RelyingpartyGetOobConfirmationCodeCall<'a, C, A> {} @@ -1798,17 +1877,8 @@ impl<'a, C, A> RelyingpartyGetOobConfirmationCodeCall<'a, C, A> where C: BorrowM params.push(("alt", "json".to_string())); let mut url = "https://www.googleapis.com/identitytoolkit/v3/relyingparty/getOobConfirmationCode".to_string(); - - let mut key = self.hub.auth.borrow_mut().api_key(); - if key.is_none() { - key = dlg.api_key(); - } - match key { - Some(value) => params.push(("key", value)), - None => { - dlg.finished(false); - return Err(Error::MissingAPIKey) - } + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } @@ -1831,11 +1901,25 @@ impl<'a, C, A> RelyingpartyGetOobConfirmationCodeCall<'a, C, A> where C: BorrowM loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) .body(&mut request_value_reader); @@ -1931,6 +2015,22 @@ impl<'a, C, A> RelyingpartyGetOobConfirmationCodeCall<'a, C, A> where C: BorrowM self } + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> RelyingpartyGetOobConfirmationCodeCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } } @@ -1977,6 +2077,7 @@ pub struct RelyingpartySignupNewUserCall<'a, C, A> _request: IdentitytoolkitRelyingpartySignupNewUserRequest, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, + _scopes: BTreeMap } impl<'a, C, A> CallBuilder for RelyingpartySignupNewUserCall<'a, C, A> {} @@ -2009,17 +2110,8 @@ impl<'a, C, A> RelyingpartySignupNewUserCall<'a, C, A> where C: BorrowMut params.push(("key", value)), - None => { - dlg.finished(false); - return Err(Error::MissingAPIKey) - } + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } @@ -2042,11 +2134,25 @@ impl<'a, C, A> RelyingpartySignupNewUserCall<'a, C, A> where C: BorrowMut token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) .body(&mut request_value_reader); @@ -2142,6 +2248,22 @@ impl<'a, C, A> RelyingpartySignupNewUserCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RelyingpartySignupNewUserCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } } @@ -2188,6 +2310,7 @@ pub struct RelyingpartyCreateAuthUriCall<'a, C, A> _request: IdentitytoolkitRelyingpartyCreateAuthUriRequest, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, + _scopes: BTreeMap } impl<'a, C, A> CallBuilder for RelyingpartyCreateAuthUriCall<'a, C, A> {} @@ -2220,17 +2343,8 @@ impl<'a, C, A> RelyingpartyCreateAuthUriCall<'a, C, A> where C: BorrowMut params.push(("key", value)), - None => { - dlg.finished(false); - return Err(Error::MissingAPIKey) - } + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } @@ -2253,11 +2367,25 @@ impl<'a, C, A> RelyingpartyCreateAuthUriCall<'a, C, A> where C: BorrowMut token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) .body(&mut request_value_reader); @@ -2353,6 +2481,22 @@ impl<'a, C, A> RelyingpartyCreateAuthUriCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RelyingpartyCreateAuthUriCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } } @@ -2399,6 +2543,7 @@ pub struct RelyingpartySignOutUserCall<'a, C, A> _request: IdentitytoolkitRelyingpartySignOutUserRequest, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, + _scopes: BTreeMap } impl<'a, C, A> CallBuilder for RelyingpartySignOutUserCall<'a, C, A> {} @@ -2431,17 +2576,8 @@ impl<'a, C, A> RelyingpartySignOutUserCall<'a, C, A> where C: BorrowMut params.push(("key", value)), - None => { - dlg.finished(false); - return Err(Error::MissingAPIKey) - } + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } @@ -2464,11 +2600,25 @@ impl<'a, C, A> RelyingpartySignOutUserCall<'a, C, A> where C: BorrowMut token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) .body(&mut request_value_reader); @@ -2564,6 +2714,22 @@ impl<'a, C, A> RelyingpartySignOutUserCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RelyingpartySignOutUserCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } } @@ -2610,6 +2776,7 @@ pub struct RelyingpartyVerifyAssertionCall<'a, C, A> _request: IdentitytoolkitRelyingpartyVerifyAssertionRequest, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, + _scopes: BTreeMap } impl<'a, C, A> CallBuilder for RelyingpartyVerifyAssertionCall<'a, C, A> {} @@ -2642,17 +2809,8 @@ impl<'a, C, A> RelyingpartyVerifyAssertionCall<'a, C, A> where C: BorrowMut params.push(("key", value)), - None => { - dlg.finished(false); - return Err(Error::MissingAPIKey) - } + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } @@ -2675,11 +2833,25 @@ impl<'a, C, A> RelyingpartyVerifyAssertionCall<'a, C, A> where C: BorrowMut token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) .body(&mut request_value_reader); @@ -2775,6 +2947,22 @@ impl<'a, C, A> RelyingpartyVerifyAssertionCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RelyingpartyVerifyAssertionCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } } @@ -2821,6 +3009,7 @@ pub struct RelyingpartyUploadAccountCall<'a, C, A> _request: IdentitytoolkitRelyingpartyUploadAccountRequest, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, + _scopes: BTreeMap } impl<'a, C, A> CallBuilder for RelyingpartyUploadAccountCall<'a, C, A> {} @@ -2853,17 +3042,8 @@ impl<'a, C, A> RelyingpartyUploadAccountCall<'a, C, A> where C: BorrowMut params.push(("key", value)), - None => { - dlg.finished(false); - return Err(Error::MissingAPIKey) - } + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } @@ -2886,11 +3066,25 @@ impl<'a, C, A> RelyingpartyUploadAccountCall<'a, C, A> where C: BorrowMut token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) .body(&mut request_value_reader); @@ -2986,6 +3180,22 @@ impl<'a, C, A> RelyingpartyUploadAccountCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RelyingpartyUploadAccountCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } } @@ -3032,6 +3242,7 @@ pub struct RelyingpartyGetAccountInfoCall<'a, C, A> _request: IdentitytoolkitRelyingpartyGetAccountInfoRequest, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, + _scopes: BTreeMap } impl<'a, C, A> CallBuilder for RelyingpartyGetAccountInfoCall<'a, C, A> {} @@ -3064,17 +3275,8 @@ impl<'a, C, A> RelyingpartyGetAccountInfoCall<'a, C, A> where C: BorrowMut params.push(("key", value)), - None => { - dlg.finished(false); - return Err(Error::MissingAPIKey) - } + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } @@ -3097,11 +3299,25 @@ impl<'a, C, A> RelyingpartyGetAccountInfoCall<'a, C, A> where C: BorrowMut token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) .body(&mut request_value_reader); @@ -3197,6 +3413,22 @@ impl<'a, C, A> RelyingpartyGetAccountInfoCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RelyingpartyGetAccountInfoCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } } @@ -3243,6 +3475,7 @@ pub struct RelyingpartyVerifyCustomTokenCall<'a, C, A> _request: IdentitytoolkitRelyingpartyVerifyCustomTokenRequest, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, + _scopes: BTreeMap } impl<'a, C, A> CallBuilder for RelyingpartyVerifyCustomTokenCall<'a, C, A> {} @@ -3275,17 +3508,8 @@ impl<'a, C, A> RelyingpartyVerifyCustomTokenCall<'a, C, A> where C: BorrowMut params.push(("key", value)), - None => { - dlg.finished(false); - return Err(Error::MissingAPIKey) - } + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } @@ -3308,11 +3532,25 @@ impl<'a, C, A> RelyingpartyVerifyCustomTokenCall<'a, C, A> where C: BorrowMut token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) .body(&mut request_value_reader); @@ -3408,6 +3646,22 @@ impl<'a, C, A> RelyingpartyVerifyCustomTokenCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RelyingpartyVerifyCustomTokenCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } } @@ -3454,6 +3708,7 @@ pub struct RelyingpartyResetPasswordCall<'a, C, A> _request: IdentitytoolkitRelyingpartyResetPasswordRequest, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, + _scopes: BTreeMap } impl<'a, C, A> CallBuilder for RelyingpartyResetPasswordCall<'a, C, A> {} @@ -3486,17 +3741,8 @@ impl<'a, C, A> RelyingpartyResetPasswordCall<'a, C, A> where C: BorrowMut params.push(("key", value)), - None => { - dlg.finished(false); - return Err(Error::MissingAPIKey) - } + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } @@ -3519,11 +3765,25 @@ impl<'a, C, A> RelyingpartyResetPasswordCall<'a, C, A> where C: BorrowMut token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) .body(&mut request_value_reader); @@ -3619,6 +3879,22 @@ impl<'a, C, A> RelyingpartyResetPasswordCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RelyingpartyResetPasswordCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } } @@ -3665,6 +3941,7 @@ pub struct RelyingpartyDownloadAccountCall<'a, C, A> _request: IdentitytoolkitRelyingpartyDownloadAccountRequest, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, + _scopes: BTreeMap } impl<'a, C, A> CallBuilder for RelyingpartyDownloadAccountCall<'a, C, A> {} @@ -3697,17 +3974,8 @@ impl<'a, C, A> RelyingpartyDownloadAccountCall<'a, C, A> where C: BorrowMut params.push(("key", value)), - None => { - dlg.finished(false); - return Err(Error::MissingAPIKey) - } + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } @@ -3730,11 +3998,25 @@ impl<'a, C, A> RelyingpartyDownloadAccountCall<'a, C, A> where C: BorrowMut token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) .body(&mut request_value_reader); @@ -3830,6 +4112,22 @@ impl<'a, C, A> RelyingpartyDownloadAccountCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RelyingpartyDownloadAccountCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } } @@ -3876,6 +4174,7 @@ pub struct RelyingpartySetAccountInfoCall<'a, C, A> _request: IdentitytoolkitRelyingpartySetAccountInfoRequest, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, + _scopes: BTreeMap } impl<'a, C, A> CallBuilder for RelyingpartySetAccountInfoCall<'a, C, A> {} @@ -3908,17 +4207,8 @@ impl<'a, C, A> RelyingpartySetAccountInfoCall<'a, C, A> where C: BorrowMut params.push(("key", value)), - None => { - dlg.finished(false); - return Err(Error::MissingAPIKey) - } + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } @@ -3941,11 +4231,25 @@ impl<'a, C, A> RelyingpartySetAccountInfoCall<'a, C, A> where C: BorrowMut token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) .body(&mut request_value_reader); @@ -4041,6 +4345,22 @@ impl<'a, C, A> RelyingpartySetAccountInfoCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RelyingpartySetAccountInfoCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } } @@ -4087,6 +4407,7 @@ pub struct RelyingpartyDeleteAccountCall<'a, C, A> _request: IdentitytoolkitRelyingpartyDeleteAccountRequest, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, + _scopes: BTreeMap } impl<'a, C, A> CallBuilder for RelyingpartyDeleteAccountCall<'a, C, A> {} @@ -4119,17 +4440,8 @@ impl<'a, C, A> RelyingpartyDeleteAccountCall<'a, C, A> where C: BorrowMut params.push(("key", value)), - None => { - dlg.finished(false); - return Err(Error::MissingAPIKey) - } + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } @@ -4152,11 +4464,25 @@ impl<'a, C, A> RelyingpartyDeleteAccountCall<'a, C, A> where C: BorrowMut token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) .body(&mut request_value_reader); @@ -4252,6 +4578,22 @@ impl<'a, C, A> RelyingpartyDeleteAccountCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RelyingpartyDeleteAccountCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } } @@ -4291,6 +4633,7 @@ pub struct RelyingpartyGetPublicKeyCall<'a, C, A> hub: &'a IdentityToolkit, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, + _scopes: BTreeMap } impl<'a, C, A> CallBuilder for RelyingpartyGetPublicKeyCall<'a, C, A> {} @@ -4323,17 +4666,8 @@ impl<'a, C, A> RelyingpartyGetPublicKeyCall<'a, C, A> where C: BorrowMut params.push(("key", value)), - None => { - dlg.finished(false); - return Err(Error::MissingAPIKey) - } + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } @@ -4345,10 +4679,24 @@ impl<'a, C, A> RelyingpartyGetPublicKeyCall<'a, C, A> where C: BorrowMut token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())); + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); dlg.pre_request(); req.send() @@ -4432,6 +4780,22 @@ impl<'a, C, A> RelyingpartyGetPublicKeyCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RelyingpartyGetPublicKeyCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } } @@ -4471,6 +4835,7 @@ pub struct RelyingpartyGetRecaptchaParamCall<'a, C, A> hub: &'a IdentityToolkit, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, + _scopes: BTreeMap } impl<'a, C, A> CallBuilder for RelyingpartyGetRecaptchaParamCall<'a, C, A> {} @@ -4503,17 +4868,8 @@ impl<'a, C, A> RelyingpartyGetRecaptchaParamCall<'a, C, A> where C: BorrowMut params.push(("key", value)), - None => { - dlg.finished(false); - return Err(Error::MissingAPIKey) - } + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } @@ -4525,10 +4881,24 @@ impl<'a, C, A> RelyingpartyGetRecaptchaParamCall<'a, C, A> where C: BorrowMut token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())); + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); dlg.pre_request(); req.send() @@ -4612,6 +4982,22 @@ impl<'a, C, A> RelyingpartyGetRecaptchaParamCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RelyingpartyGetRecaptchaParamCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } } @@ -4658,6 +5044,7 @@ pub struct RelyingpartyVerifyPasswordCall<'a, C, A> _request: IdentitytoolkitRelyingpartyVerifyPasswordRequest, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, + _scopes: BTreeMap } impl<'a, C, A> CallBuilder for RelyingpartyVerifyPasswordCall<'a, C, A> {} @@ -4690,17 +5077,8 @@ impl<'a, C, A> RelyingpartyVerifyPasswordCall<'a, C, A> where C: BorrowMut params.push(("key", value)), - None => { - dlg.finished(false); - return Err(Error::MissingAPIKey) - } + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } @@ -4723,11 +5101,25 @@ impl<'a, C, A> RelyingpartyVerifyPasswordCall<'a, C, A> where C: BorrowMut token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) .body(&mut request_value_reader); @@ -4823,6 +5215,22 @@ impl<'a, C, A> RelyingpartyVerifyPasswordCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RelyingpartyVerifyPasswordCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } } @@ -4869,6 +5277,7 @@ pub struct RelyingpartySetProjectConfigCall<'a, C, A> _request: IdentitytoolkitRelyingpartySetProjectConfigRequest, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, + _scopes: BTreeMap } impl<'a, C, A> CallBuilder for RelyingpartySetProjectConfigCall<'a, C, A> {} @@ -4901,17 +5310,8 @@ impl<'a, C, A> RelyingpartySetProjectConfigCall<'a, C, A> where C: BorrowMut params.push(("key", value)), - None => { - dlg.finished(false); - return Err(Error::MissingAPIKey) - } + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } @@ -4934,11 +5334,25 @@ impl<'a, C, A> RelyingpartySetProjectConfigCall<'a, C, A> where C: BorrowMut token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) .body(&mut request_value_reader); @@ -5034,6 +5448,22 @@ impl<'a, C, A> RelyingpartySetProjectConfigCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RelyingpartySetProjectConfigCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } } @@ -5077,6 +5507,7 @@ pub struct RelyingpartyGetProjectConfigCall<'a, C, A> _delegated_project_number: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, + _scopes: BTreeMap } impl<'a, C, A> CallBuilder for RelyingpartyGetProjectConfigCall<'a, C, A> {} @@ -5115,17 +5546,8 @@ impl<'a, C, A> RelyingpartyGetProjectConfigCall<'a, C, A> where C: BorrowMut params.push(("key", value)), - None => { - dlg.finished(false); - return Err(Error::MissingAPIKey) - } + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } @@ -5137,10 +5559,24 @@ impl<'a, C, A> RelyingpartyGetProjectConfigCall<'a, C, A> where C: BorrowMut token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())); + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); dlg.pre_request(); req.send() @@ -5238,6 +5674,22 @@ impl<'a, C, A> RelyingpartyGetProjectConfigCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RelyingpartyGetProjectConfigCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } } diff --git a/gen/logging2-cli/Cargo.toml b/gen/logging2-cli/Cargo.toml new file mode 100644 index 0000000000..da05846334 --- /dev/null +++ b/gen/logging2-cli/Cargo.toml @@ -0,0 +1,43 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-logging2-cli" +version = "1.0.0+20161206" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Logging (protocol v2)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/logging2-cli" +homepage = "https://cloud.google.com/logging/docs/" +documentation = "http://byron.github.io/google-apis-rs/google_logging2_cli" +license = "MIT" +keywords = ["logging", "google", "cli"] + +[[bin]] +name = "logging2" + +[dependencies] +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.8" +serde_json = "^ 0.8" +yup-oauth2 = { version = "^ 1.0", optional = true, default-features = false } +serde_derive = { version = "^ 0.8", optional = true } +strsim = "^0.5" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-serde-codegen"] +nightly = ["serde_derive","yup-oauth2/nightly","google-logging2/nightly"] +with-serde-codegen = ["serde_codegen","yup-oauth2/with-serde-codegen","google-logging2/with-serde-codegen"] + +[build-dependencies] +serde_codegen = { version = "^ 0.8", optional = true } + + +[dependencies.google-logging2] +path = "../logging2" +version = "1.0.0" +optional = true +default-features = false diff --git a/gen/logging2-cli/LICENSE.md b/gen/logging2-cli/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/logging2-cli/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/logging2-cli/README.md b/gen/logging2-cli/README.md new file mode 100644 index 0000000000..109444dd08 --- /dev/null +++ b/gen/logging2-cli/README.md @@ -0,0 +1,153 @@ + +The `logging2` command-line interface *(CLI)* allows to use most features of the *Google Logging* service from the comfort of your terminal. + +By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's +capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero. + +If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. + +Everything else about the *Logging* API can be found at the +[official documentation site](https://cloud.google.com/logging/docs/). + +# Downloads + +You can download the pre-compiled 64bit binaries for the following platforms: + +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/1.0.0/ubuntu/logging2.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/1.0.0/osx/logging2.tar.gz) + +Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/logging2-cli). + +# Usage + +This documentation was generated from the *Logging* API at revision *20161206*. The CLI is at version *1.0.0*. + +```bash +logging2 [options] + billing-accounts + logs-delete [-p ]... [-o ] + logs-list [-p ]... [-o ] + sinks-create (-r )... [-p ]... [-o ] + sinks-delete [-p ]... [-o ] + sinks-get [-p ]... [-o ] + sinks-list [-p ]... [-o ] + sinks-update (-r )... [-p ]... [-o ] + entries + list (-r )... [-p ]... [-o ] + write (-r )... [-p ]... [-o ] + folders + logs-delete [-p ]... [-o ] + logs-list [-p ]... [-o ] + sinks-create (-r )... [-p ]... [-o ] + sinks-delete [-p ]... [-o ] + sinks-get [-p ]... [-o ] + sinks-list [-p ]... [-o ] + sinks-update (-r )... [-p ]... [-o ] + monitored-resource-descriptors + list [-p ]... [-o ] + organizations + logs-delete [-p ]... [-o ] + logs-list [-p ]... [-o ] + sinks-create (-r )... [-p ]... [-o ] + sinks-delete [-p ]... [-o ] + sinks-get [-p ]... [-o ] + sinks-list [-p ]... [-o ] + sinks-update (-r )... [-p ]... [-o ] + projects + logs-delete [-p ]... [-o ] + logs-list [-p ]... [-o ] + metrics-create (-r )... [-p ]... [-o ] + metrics-delete [-p ]... [-o ] + metrics-get [-p ]... [-o ] + metrics-list [-p ]... [-o ] + metrics-update (-r )... [-p ]... [-o ] + sinks-create (-r )... [-p ]... [-o ] + sinks-delete [-p ]... [-o ] + sinks-get [-p ]... [-o ] + sinks-list [-p ]... [-o ] + sinks-update (-r )... [-p ]... [-o ] + logging2 --help + +Configuration: + [--scope ]... + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. + If unset, it defaults to the shortest scope url for a particular method. + --config-dir + A directory into which we will store our persistent data. Defaults to + a user-writable directory that we will create during the first invocation. + [default: ~/.google-service-cli] + --debug + Output all server communication to standard error. `tx` and `rx` are placed + into the same stream. + --debug-auth + Output all communication related to authentication to standard error. `tx` + and `rx` are placed into the same stream. + +``` + +# Configuration + +The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `logging2-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis. + +More information about the various kinds of persistent data are given in the following paragraphs. + +# Authentication + +Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the +set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*. + +If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a +method that is read-only, it will ask only for a read-only scope. +You may use the `--scope` flag to specify a scope directly. +All applicable scopes are documented in the respective method's CLI documentation. + +The first time a scope is used, the user is asked for permission. Follow the instructions given +by the CLI to grant permissions, or to decline. + +If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration +directory, e.g. `~/.google-service-cli/logging2-token-.json`. No manual management of these tokens +is necessary. + +To revoke granted authentication, please refer to the [official documentation][revoke-access]. + +# Application Secrets + +In order to allow any application to use Google services, it will need to be registered using the +[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it +one by one. Most APIs can be used for free and have a daily quota. + +To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI +comes with a default application secret that is configured accordingly. This also means that heavy usage +all around the world may deplete the daily quota. + +You can workaround this limitation by putting your own secrets file at this location: +`~/.google-service-cli/logging2-secret.json`, assuming that the required *logging* API +was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at +*APIs & auth -> Credentials -> Download JSON* and used as is. + +Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new]. + + +# Debugging + +Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know +what exactly led to a particular issue. This is done by allowing all client-server communication to be +output to standard error *as-is*. + +The `--debug` flag will print all client-server communication to standard error, whereas the `--debug-auth` flag +will cause all communication related to authentication to standard error. +If the `--debug` flag is set, error-results will be debug-printed, possibly yielding more information about the +issue at hand. + +You may consider redirecting standard error into a file for ease of use, e.g. `logging2 --debug [options] 2>debug.txt`. + + +[scopes]: https://developers.google.com/+/api/oauth#scopes +[revoke-access]: http://webapps.stackexchange.com/a/30849 +[google-dev-console]: https://console.developers.google.com/ +[google-project-new]: https://developers.google.com/console/help/new/ \ No newline at end of file diff --git a/gen/logging2-cli/mkdocs.yml b/gen/logging2-cli/mkdocs.yml new file mode 100644 index 0000000000..0af9ba5ab7 --- /dev/null +++ b/gen/logging2-cli/mkdocs.yml @@ -0,0 +1,52 @@ +site_name: Logging v1.0.0+20161206 +site_url: http://byron.github.io/google-apis-rs/google-logging2-cli +site_description: Write integrating applications with bcore + +repo_url: https://github.com/Byron/google-apis-rs/tree/master/gen/logging2-cli + +docs_dir: docs +site_dir: build_html + +pages: +- ['index.md', 'Home'] +- ['billing-accounts_logs-delete.md', 'Billing Accounts', 'Logs Delete'] +- ['billing-accounts_logs-list.md', 'Billing Accounts', 'Logs List'] +- ['billing-accounts_sinks-create.md', 'Billing Accounts', 'Sinks Create'] +- ['billing-accounts_sinks-delete.md', 'Billing Accounts', 'Sinks Delete'] +- ['billing-accounts_sinks-get.md', 'Billing Accounts', 'Sinks Get'] +- ['billing-accounts_sinks-list.md', 'Billing Accounts', 'Sinks List'] +- ['billing-accounts_sinks-update.md', 'Billing Accounts', 'Sinks Update'] +- ['entries_list.md', 'Entries', 'List'] +- ['entries_write.md', 'Entries', 'Write'] +- ['folders_logs-delete.md', 'Folders', 'Logs Delete'] +- ['folders_logs-list.md', 'Folders', 'Logs List'] +- ['folders_sinks-create.md', 'Folders', 'Sinks Create'] +- ['folders_sinks-delete.md', 'Folders', 'Sinks Delete'] +- ['folders_sinks-get.md', 'Folders', 'Sinks Get'] +- ['folders_sinks-list.md', 'Folders', 'Sinks List'] +- ['folders_sinks-update.md', 'Folders', 'Sinks Update'] +- ['monitored-resource-descriptors_list.md', 'Monitored Resource Descriptors', 'List'] +- ['organizations_logs-delete.md', 'Organizations', 'Logs Delete'] +- ['organizations_logs-list.md', 'Organizations', 'Logs List'] +- ['organizations_sinks-create.md', 'Organizations', 'Sinks Create'] +- ['organizations_sinks-delete.md', 'Organizations', 'Sinks Delete'] +- ['organizations_sinks-get.md', 'Organizations', 'Sinks Get'] +- ['organizations_sinks-list.md', 'Organizations', 'Sinks List'] +- ['organizations_sinks-update.md', 'Organizations', 'Sinks Update'] +- ['projects_logs-delete.md', 'Projects', 'Logs Delete'] +- ['projects_logs-list.md', 'Projects', 'Logs List'] +- ['projects_metrics-create.md', 'Projects', 'Metrics Create'] +- ['projects_metrics-delete.md', 'Projects', 'Metrics Delete'] +- ['projects_metrics-get.md', 'Projects', 'Metrics Get'] +- ['projects_metrics-list.md', 'Projects', 'Metrics List'] +- ['projects_metrics-update.md', 'Projects', 'Metrics Update'] +- ['projects_sinks-create.md', 'Projects', 'Sinks Create'] +- ['projects_sinks-delete.md', 'Projects', 'Sinks Delete'] +- ['projects_sinks-get.md', 'Projects', 'Sinks Get'] +- ['projects_sinks-list.md', 'Projects', 'Sinks List'] +- ['projects_sinks-update.md', 'Projects', 'Sinks Update'] + +theme: readthedocs + +copyright: Copyright © 2015-2016, `Sebastian Thiel` + diff --git a/gen/logging2-cli/src/cmn.rs b/gen/logging2-cli/src/cmn.rs new file mode 100644 index 0000000000..779c1dc086 --- /dev/null +++ b/gen/logging2-cli/src/cmn.rs @@ -0,0 +1,721 @@ +// COPY OF 'src/rust/cli/cmn.rs' +// DO NOT EDIT +use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token}; +use serde_json as json; +use serde_json::value::Value; +use mime::Mime; +use clap::{App, SubCommand}; +use strsim; + +use std::fs; +use std::env; +use std::io; +use std::fmt; +use std::path::{Path, PathBuf}; +use std::str::FromStr; +use std::string::ToString; +use std::io::{Write, Read, stdout}; + +use std::default::Default; + +const FIELD_SEP: char = '.'; + + +pub enum ComplexType { + Pod, + Vec, + Map, +} + + // Null, + // Bool(bool), + // I64(i64), + // U64(u64), + // F64(f64), + // String(String), + +pub enum JsonType { + Boolean, + Int, + Uint, + Float, + String, +} + +pub struct JsonTypeInfo { + pub jtype: JsonType, + pub ctype: ComplexType, +} + +// Based on @erickt user comment. Thanks for the idea ! +// Remove all keys whose values are null from given value (changed in place) +pub fn remove_json_null_values(value: &mut Value) { + match *value { + Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} + +fn did_you_mean<'a>(v: &str, possible_values: &[&'a str]) -> Option<&'a str> { + + let mut candidate: Option<(f64, &str)> = None; + for pv in possible_values { + let confidence = strsim::jaro_winkler(v, pv); + if confidence > 0.8 && (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { + candidate = Some((confidence, pv)); + } + } + match candidate { + None => None, + Some((_, candidate)) => Some(candidate), + } +} + +pub enum CallType { + Upload(UploadProtocol), + Standard, +} + +arg_enum!{ + pub enum UploadProtocol { + Simple, + Resumable + } +} + +impl AsRef for UploadProtocol { + fn as_ref(&self) -> &str { + match *self { + UploadProtocol::Simple => "simple", + UploadProtocol::Resumable => "resumable" + } + } +} + +impl AsRef for CallType { + fn as_ref(&self) -> &str { + match *self { + CallType::Upload(ref proto) => proto.as_ref(), + CallType::Standard => "standard-request" + } + } +} + +#[derive(Clone, Default)] +pub struct FieldCursor(Vec); + +impl ToString for FieldCursor { + fn to_string(&self) -> String { + self.0.join(".") + } +} + +impl From<&'static str> for FieldCursor { + fn from(value: &'static str) -> FieldCursor { + let mut res = FieldCursor::default(); + res.set(value).unwrap(); + res + } +} + +impl FieldCursor { + pub fn set(&mut self, value: &str) -> Result<(), CLIError> { + if value.len() == 0 { + return Err(CLIError::Field(FieldError::Empty)) + } + + let mut first_is_field_sep = false; + let mut char_count: usize = 0; + let mut last_c = FIELD_SEP; + let mut num_conscutive_field_seps = 0; + + let mut field = String::new(); + let mut fields = self.0.clone(); + + let push_field = |fs: &mut Vec, f: &mut String| { + if f.len() > 0 { + fs.push(f.clone()); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + char_count += 1; + + if c == FIELD_SEP { + if cid == 0 { + first_is_field_sep = true; + } + num_conscutive_field_seps += 1; + if cid > 0 && last_c == FIELD_SEP { + if fields.pop().is_none() { + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))) + } + } else { + push_field(&mut fields, &mut field); + } + } else { + num_conscutive_field_seps = 0; + if cid == 1 { + if first_is_field_sep { + fields.truncate(0); + } + } + field.push(c); + } + + last_c = c; + } + + push_field(&mut fields, &mut field); + + if char_count == 1 && first_is_field_sep { + fields.truncate(0); + } + if char_count > 1 && num_conscutive_field_seps == 1 { + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + } + + self.0 = fields; + Ok(()) + } + + pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { + if value.len() == 0 { + return None + } + + let mut last_c = FIELD_SEP; + + let mut field = String::new(); + let mut output = String::new(); + + let push_field = |fs: &mut String, f: &mut String| { + if f.len() > 0 { + fs.push_str( + match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + if c == FIELD_SEP { + if last_c != FIELD_SEP { + push_field(&mut output, &mut field); + } + output.push(c); + } else { + field.push(c); + } + + last_c = c; + } + + push_field(&mut output, &mut field); + + if &output == value { + None + } else { + Some(output) + } + } + + pub fn set_json_value(&self, mut object: &mut Value, + value: &str, type_info: JsonTypeInfo, + err: &mut InvalidOptionsError, + orig_cursor: &FieldCursor) { + assert!(self.0.len() > 0); + + for field in &self.0[..self.0.len()-1] { + let tmp = object; + object = + match *tmp { + Value::Object(ref mut mapping) => { + mapping.entry(field.to_owned()).or_insert( + Value::Object(Default::default()) + ) + }, + _ => panic!("We don't expect non-object Values here ...") + }; + } + + match *object { + Value::Object(ref mut mapping) => { + let field = &self.0[self.0.len()-1]; + let to_jval = + |value: &str, jtype: JsonType, err: &mut InvalidOptionsError| + -> Value { + match jtype { + JsonType::Boolean => + Value::Bool(arg_from_str(value, err, &field, "boolean")), + JsonType::Int => + Value::I64(arg_from_str(value, err, &field, "int")), + JsonType::Uint => + Value::U64(arg_from_str(value, err, &field, "uint")), + JsonType::Float => + Value::F64(arg_from_str(value, err, &field, "float")), + JsonType::String => + Value::String(value.to_owned()), + } + }; + + match type_info.ctype { + ComplexType::Pod => { + if mapping.insert(field.to_owned(), to_jval(value, type_info.jtype, err)).is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + }, + ComplexType::Vec => { + match *mapping.entry(field.to_owned()) + .or_insert(Value::Array(Default::default())) { + Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), + _ => unreachable!() + } + }, + ComplexType::Map => { + let (key, value) = parse_kv_arg(value, err, true); + let jval = to_jval(value.unwrap_or(""), type_info.jtype, err); + + match *mapping.entry(field.to_owned()) + .or_insert(Value::Object(Default::default())) { + Value::Object(ref mut value_map) => { + if value_map.insert(key.to_owned(), jval).is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + _ => unreachable!() + } + } + } + }, + _ => unreachable!() + } + } + + pub fn num_fields(&self) -> usize { + self.0.len() + } +} + +pub fn parse_kv_arg<'a>(kv: &'a str, err: &mut InvalidOptionsError, for_hashmap: bool) + -> (&'a str, Option<&'a str>) { + let mut add_err = || err.issues.push(CLIError::InvalidKeyValueSyntax(kv.to_string(),for_hashmap)); + match kv.find('=') { + None => { + add_err(); + return (kv, None) + }, + Some(pos) => { + let key = &kv[..pos]; + if kv.len() <= pos + 1 { + add_err(); + return (key, Some("")) + } + (key, Some(&kv[pos+1..])) + } + } +} + +pub fn calltype_from_str(name: &str, valid_protocols: Vec, err: &mut InvalidOptionsError) -> CallType { + CallType::Upload( + match UploadProtocol::from_str(name) { + Ok(up) => up, + Err(msg) => { + err.issues.push(CLIError::InvalidUploadProtocol(name.to_string(), valid_protocols)); + UploadProtocol::Simple + } + }) +} + +pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> Option { + match fs::File::open(file_path) { + Ok(f) => Some(f), + Err(io_err) => { + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); + None + } + } +} + +pub fn input_mime_from_opts(mime: &str, err: &mut InvalidOptionsError) -> Option { + match mime.parse() { + Ok(m) => Some(m), + Err(_) => { + err.issues.push(CLIError::Input(InputError::Mime(mime.to_string()))); + None + } + } +} + +pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { + let f = arg.unwrap_or("-"); + match f { + "-" => Ok(Box::new(stdout())), + _ => match fs::OpenOptions::new().create(true).write(true).open(f) { + Ok(f) => Ok(Box::new(f)), + Err(io_err) => Err(io_err), + } + } +} + + +pub fn arg_from_str<'a, T>(arg: &str, err: &mut InvalidOptionsError, + arg_name: &'a str, + arg_type: &'a str) -> T + where T: FromStr + Default, + ::Err: fmt::Display { + match FromStr::from_str(arg) { + Err(perr) => { + err.issues.push( + CLIError::ParseError(arg_name.to_owned(), arg_type.to_owned(), arg.to_string(), format!("{}", perr)) + ); + Default::default() + }, + Ok(v) => v, + } +} + +pub struct JsonTokenStorage { + pub program_name: &'static str, + pub db_dir: String, +} + +impl JsonTokenStorage { + fn path(&self, scope_hash: u64) -> PathBuf { + Path::new(&self.db_dir).join(&format!("{}-token-{}.json", self.program_name, scope_hash)) + } +} + +impl TokenStorage for JsonTokenStorage { + type Error = json::Error; + + // NOTE: logging might be interesting, currently we swallow all errors + fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), json::Error> { + match token { + None => { + match fs::remove_file(self.path(scope_hash)) { + Err(err) => + match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(json::Error::Io(err)) + }, + Ok(_) => Ok(()), + } + } + Some(token) => { + match fs::OpenOptions::new().create(true).write(true).open(&self.path(scope_hash)) { + Ok(mut f) => { + match json::to_writer_pretty(&mut f, &token) { + Ok(_) => Ok(()), + Err(serde_err) => Err(serde_err), + } + }, + Err(io_err) => Err(json::Error::Io(io_err)) + } + } + } + } + + fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result, json::Error> { + match fs::File::open(&self.path(scope_hash)) { + Ok(f) => { + match json::de::from_reader(f) { + Ok(token) => Ok(Some(token)), + Err(err) => Err(err), + } + }, + Err(io_err) => { + match io_err.kind() { + io::ErrorKind::NotFound => Ok(None), + _ => Err(json::Error::Io(io_err)) + } + } + } + } +} + + +#[derive(Debug)] +pub enum ApplicationSecretError { + DecoderError((String, json::Error)), + FormatError(String), +} + +impl fmt::Display for ApplicationSecretError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ApplicationSecretError::DecoderError((ref path, ref err)) + => writeln!(f, "Could not decode file at '{}' with error: {}.", + path, err), + ApplicationSecretError::FormatError(ref path) + => writeln!(f, "'installed' field is unset in secret file at '{}'.", + path), + } + } +} + +#[derive(Debug)] +pub enum ConfigurationError { + DirectoryCreationFailed((String, io::Error)), + DirectoryUnset, + HomeExpansionFailed(String), + Secret(ApplicationSecretError), + Io((String, io::Error)), +} + +impl fmt::Display for ConfigurationError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ConfigurationError::DirectoryCreationFailed((ref dir, ref err)) + => writeln!(f, "Directory '{}' could not be created with error: {}.", dir, err), + ConfigurationError::DirectoryUnset + => writeln!(f, "--config-dir was unset or empty."), + ConfigurationError::HomeExpansionFailed(ref dir) + => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), + ConfigurationError::Secret(ref err) + => writeln!(f, "Secret -> {}", err), + ConfigurationError::Io((ref path, ref err)) + => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + } + } +} + +#[derive(Debug)] +pub enum InputError { + Io((String, io::Error)), + Mime(String), +} + +impl fmt::Display for InputError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + InputError::Io((ref file_path, ref io_err)) + => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), + InputError::Mime(ref mime) + => writeln!(f, "'{}' is not a known mime-type.", mime), + } + } +} + +#[derive(Debug)] +pub enum FieldError { + PopOnEmpty(String), + TrailingFieldSep(String), + Unknown(String, Option, Option), + Duplicate(String), + Empty, +} + + +impl fmt::Display for FieldError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + FieldError::PopOnEmpty(ref field) + => writeln!(f, "'{}': Cannot move up on empty field cursor.", field), + FieldError::TrailingFieldSep(ref field) + => writeln!(f, "'{}': Single field separator may not be last character.", field), + FieldError::Unknown(ref field, ref suggestion, ref value) => { + let suffix = + match *suggestion { + Some(ref s) => { + let kv = + match *value { + Some(ref v) => format!("{}={}", s, v), + None => s.clone(), + }; + format!(" Did you mean '{}' ?", kv) + }, + None => String::new(), + }; + writeln!(f, "Field '{}' does not exist.{}", field, suffix) + }, + FieldError::Duplicate(ref cursor) + => writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty + => writeln!(f, "Field names must not be empty."), + } + } +} + + +#[derive(Debug)] +pub enum CLIError { + Configuration(ConfigurationError), + ParseError(String, String, String, String), + UnknownParameter(String, Vec<&'static str>), + InvalidUploadProtocol(String, Vec), + InvalidKeyValueSyntax(String, bool), + Input(InputError), + Field(FieldError), + MissingCommandError, + MissingMethodError(String), +} + +impl fmt::Display for CLIError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + CLIError::Configuration(ref err) => write!(f, "Configuration -> {}", err), + CLIError::Input(ref err) => write!(f, "Input -> {}", err), + CLIError::Field(ref err) => write!(f, "Field -> {}", err), + CLIError::InvalidUploadProtocol(ref proto_name, ref valid_names) + => writeln!(f, "'{}' is not a valid upload protocol. Choose from one of {}.", proto_name, valid_names.join(", ")), + CLIError::ParseError(ref arg_name, ref type_name, ref value, ref err_desc) + => writeln!(f, "Failed to parse argument '{}' with value '{}' as {} with error: {}.", + arg_name, value, type_name, err_desc), + CLIError::UnknownParameter(ref param_name, ref possible_values) => { + let suffix = + match did_you_mean(param_name, &possible_values) { + Some(v) => format!(" Did you mean '{}' ?", v), + None => String::new(), + }; + write!(f, "Parameter '{}' is unknown.{}\n", param_name, suffix) + }, + CLIError::InvalidKeyValueSyntax(ref kv, is_hashmap) => { + let hashmap_info = if is_hashmap { "hashmap " } else { "" }; + writeln!(f, "'{}' does not match {}pattern =.", kv, hashmap_info) + }, + CLIError::MissingCommandError => writeln!(f, "Please specify the main sub-command."), + CLIError::MissingMethodError(ref cmd) => writeln!(f, "Please specify the method to call on the '{}' command.", cmd), + } + } +} + +#[derive(Debug)] +pub struct InvalidOptionsError { + pub issues: Vec, + pub exit_code: i32, +} + +impl fmt::Display for InvalidOptionsError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + for issue in &self.issues { + try!(issue.fmt(f)); + } + Ok(()) + } +} + +impl InvalidOptionsError { + pub fn single(err: CLIError, exit_code: i32) -> InvalidOptionsError { + InvalidOptionsError { + issues: vec![err], + exit_code: exit_code, + } + } + + pub fn new() -> InvalidOptionsError { + InvalidOptionsError { + issues: Vec::new(), + exit_code: 1, + } + } +} + +pub fn assure_config_dir_exists(dir: &str) -> Result { + let trdir = dir.trim(); + if trdir.len() == 0 { + return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + } + + let expanded_config_dir = + if trdir.as_bytes()[0] == b'~' { + match env::var("HOME").ok().or(env::var("UserProfile").ok()) { + None => return Err(CLIError::Configuration(ConfigurationError::HomeExpansionFailed(trdir.to_string()))), + Some(mut user) => { + user.push_str(&trdir[1..]); + user + } + } + } else { + trdir.to_string() + }; + + if let Err(err) = fs::create_dir(&expanded_config_dir) { + if err.kind() != io::ErrorKind::AlreadyExists { + return Err(CLIError::Configuration( + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))) + } + } + + Ok(expanded_config_dir) +} + +pub fn application_secret_from_directory(dir: &str, + secret_basename: &str, + json_console_secret: &str) + -> Result { + let secret_path = Path::new(dir).join(secret_basename); + let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); + let secret_io_error = |io_err: io::Error| { + Err(CLIError::Configuration(ConfigurationError::Io( + (secret_str(), io_err) + ))) + }; + + for _ in 0..2 { + match fs::File::open(&secret_path) { + Err(mut err) => { + if err.kind() == io::ErrorKind::NotFound { + // Write our built-in one - user may adjust the written file at will + + err = match fs::OpenOptions::new().create(true).write(true).open(&secret_path) { + Err(cfe) => cfe, + Ok(mut f) => { + // Assure we convert 'ugly' json string into pretty one + let console_secret: ConsoleApplicationSecret + = json::from_str(json_console_secret).unwrap(); + match json::to_writer_pretty(&mut f, &console_secret) { + Err(serde_err) => match serde_err { + json::Error::Io(err) => err, + _ => panic!("Unexpected serde error: {:#?}", serde_err) + }, + Ok(_) => continue, + } + } + }; + // fall through to IO error handling + } + return secret_io_error(err) + }, + Ok(f) => { + match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { + Err(json::Error::Io(err)) => + return secret_io_error(err), + Err(json_err) => + return Err(CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::DecoderError( + (secret_str(), json_err) + )))), + Ok(console_secret) => + match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( + CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::FormatError(secret_str()) + ))) + }, + } + } + } + } + unreachable!(); +} diff --git a/gen/logging2-cli/src/main.rs b/gen/logging2-cli/src/main.rs new file mode 100644 index 0000000000..0ba25005b3 --- /dev/null +++ b/gen/logging2-cli/src/main.rs @@ -0,0 +1,3771 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/cli/main.rs.mako' +// DO NOT EDIT ! +#![allow(unused_variables, unused_imports, dead_code, unused_mut)] + +#[macro_use] +extern crate clap; +extern crate yup_oauth2 as oauth2; +extern crate yup_hyper_mock as mock; +extern crate serde; +extern crate serde_json; +extern crate hyper; +extern crate mime; +extern crate strsim; +extern crate google_logging2 as api; + +use std::env; +use std::io::{self, Write}; +use clap::{App, SubCommand, Arg}; + +mod cmn; + +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, + input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, + calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; + +use std::default::Default; +use std::str::FromStr; + +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; +use serde_json as json; +use clap::ArgMatches; + +enum DoitError { + IoError(String, io::Error), + ApiError(api::Error), +} + +struct Engine<'n> { + opt: ArgMatches<'n>, + hub: api::Logging>, + gp: Vec<&'static str>, + gpm: Vec<(&'static str, &'static str)>, +} + + +impl<'n> Engine<'n> { + fn _billing_accounts_logs_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.billing_accounts().logs_delete(opt.value_of("log-name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _billing_accounts_logs_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.billing_accounts().logs_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _billing_accounts_sinks_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "end-time" => Some(("endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "destination" => Some(("destination", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "start-time" => Some(("startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "output-version-format" => Some(("outputVersionFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "writer-identity" => Some(("writerIdentity", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["destination", "end-time", "filter", "name", "output-version-format", "start-time", "writer-identity"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::LogSink = json::value::from_value(object).unwrap(); + let mut call = self.hub.billing_accounts().sinks_create(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "unique-writer-identity" => { + call = call.unique_writer_identity(arg_from_str(value.unwrap_or("false"), err, "unique-writer-identity", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["unique-writer-identity"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _billing_accounts_sinks_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.billing_accounts().sinks_delete(opt.value_of("sink-name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _billing_accounts_sinks_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.billing_accounts().sinks_get(opt.value_of("sink-name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _billing_accounts_sinks_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.billing_accounts().sinks_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _billing_accounts_sinks_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "end-time" => Some(("endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "destination" => Some(("destination", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "start-time" => Some(("startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "output-version-format" => Some(("outputVersionFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "writer-identity" => Some(("writerIdentity", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["destination", "end-time", "filter", "name", "output-version-format", "start-time", "writer-identity"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::LogSink = json::value::from_value(object).unwrap(); + let mut call = self.hub.billing_accounts().sinks_update(request, opt.value_of("sink-name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "unique-writer-identity" => { + call = call.unique_writer_identity(arg_from_str(value.unwrap_or("false"), err, "unique-writer-identity", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["unique-writer-identity"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _entries_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "order-by" => Some(("orderBy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "resource-names" => Some(("resourceNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "page-size" => Some(("pageSize", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "page-token" => Some(("pageToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "project-ids" => Some(("projectIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["filter", "order-by", "page-size", "page-token", "project-ids", "resource-names"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::ListLogEntriesRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.entries().list(request); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _entries_write(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "resource.labels" => Some(("resource.labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "resource.type" => Some(("resource.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "partial-success" => Some(("partialSuccess", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "log-name" => Some(("logName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["labels", "log-name", "partial-success", "resource", "type"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::WriteLogEntriesRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.entries().write(request); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _folders_logs_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.folders().logs_delete(opt.value_of("log-name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _folders_logs_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.folders().logs_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _folders_sinks_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "end-time" => Some(("endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "destination" => Some(("destination", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "start-time" => Some(("startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "output-version-format" => Some(("outputVersionFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "writer-identity" => Some(("writerIdentity", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["destination", "end-time", "filter", "name", "output-version-format", "start-time", "writer-identity"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::LogSink = json::value::from_value(object).unwrap(); + let mut call = self.hub.folders().sinks_create(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "unique-writer-identity" => { + call = call.unique_writer_identity(arg_from_str(value.unwrap_or("false"), err, "unique-writer-identity", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["unique-writer-identity"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _folders_sinks_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.folders().sinks_delete(opt.value_of("sink-name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _folders_sinks_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.folders().sinks_get(opt.value_of("sink-name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _folders_sinks_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.folders().sinks_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _folders_sinks_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "end-time" => Some(("endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "destination" => Some(("destination", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "start-time" => Some(("startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "output-version-format" => Some(("outputVersionFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "writer-identity" => Some(("writerIdentity", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["destination", "end-time", "filter", "name", "output-version-format", "start-time", "writer-identity"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::LogSink = json::value::from_value(object).unwrap(); + let mut call = self.hub.folders().sinks_update(request, opt.value_of("sink-name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "unique-writer-identity" => { + call = call.unique_writer_identity(arg_from_str(value.unwrap_or("false"), err, "unique-writer-identity", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["unique-writer-identity"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _monitored_resource_descriptors_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.monitored_resource_descriptors().list(); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _organizations_logs_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.organizations().logs_delete(opt.value_of("log-name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _organizations_logs_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.organizations().logs_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _organizations_sinks_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "end-time" => Some(("endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "destination" => Some(("destination", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "start-time" => Some(("startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "output-version-format" => Some(("outputVersionFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "writer-identity" => Some(("writerIdentity", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["destination", "end-time", "filter", "name", "output-version-format", "start-time", "writer-identity"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::LogSink = json::value::from_value(object).unwrap(); + let mut call = self.hub.organizations().sinks_create(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "unique-writer-identity" => { + call = call.unique_writer_identity(arg_from_str(value.unwrap_or("false"), err, "unique-writer-identity", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["unique-writer-identity"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _organizations_sinks_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.organizations().sinks_delete(opt.value_of("sink-name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _organizations_sinks_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.organizations().sinks_get(opt.value_of("sink-name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _organizations_sinks_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.organizations().sinks_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _organizations_sinks_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "end-time" => Some(("endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "destination" => Some(("destination", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "start-time" => Some(("startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "output-version-format" => Some(("outputVersionFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "writer-identity" => Some(("writerIdentity", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["destination", "end-time", "filter", "name", "output-version-format", "start-time", "writer-identity"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::LogSink = json::value::from_value(object).unwrap(); + let mut call = self.hub.organizations().sinks_update(request, opt.value_of("sink-name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "unique-writer-identity" => { + call = call.unique_writer_identity(arg_from_str(value.unwrap_or("false"), err, "unique-writer-identity", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["unique-writer-identity"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_logs_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().logs_delete(opt.value_of("log-name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_logs_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().logs_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_metrics_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "version" => Some(("version", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["description", "filter", "name", "version"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::LogMetric = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().metrics_create(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_metrics_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().metrics_delete(opt.value_of("metric-name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_metrics_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().metrics_get(opt.value_of("metric-name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_metrics_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().metrics_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_metrics_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "version" => Some(("version", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["description", "filter", "name", "version"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::LogMetric = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().metrics_update(request, opt.value_of("metric-name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_sinks_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "end-time" => Some(("endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "destination" => Some(("destination", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "start-time" => Some(("startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "output-version-format" => Some(("outputVersionFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "writer-identity" => Some(("writerIdentity", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["destination", "end-time", "filter", "name", "output-version-format", "start-time", "writer-identity"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::LogSink = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().sinks_create(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "unique-writer-identity" => { + call = call.unique_writer_identity(arg_from_str(value.unwrap_or("false"), err, "unique-writer-identity", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["unique-writer-identity"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_sinks_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().sinks_delete(opt.value_of("sink-name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_sinks_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().sinks_get(opt.value_of("sink-name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_sinks_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().sinks_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_sinks_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "end-time" => Some(("endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "destination" => Some(("destination", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "start-time" => Some(("startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "output-version-format" => Some(("outputVersionFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "writer-identity" => Some(("writerIdentity", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["destination", "end-time", "filter", "name", "output-version-format", "start-time", "writer-identity"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::LogSink = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().sinks_update(request, opt.value_of("sink-name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "unique-writer-identity" => { + call = call.unique_writer_identity(arg_from_str(value.unwrap_or("false"), err, "unique-writer-identity", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["unique-writer-identity"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _doit(&self, dry_run: bool) -> Result, Option> { + let mut err = InvalidOptionsError::new(); + let mut call_result: Result<(), DoitError> = Ok(()); + let mut err_opt: Option = None; + match self.opt.subcommand() { + ("billing-accounts", Some(opt)) => { + match opt.subcommand() { + ("logs-delete", Some(opt)) => { + call_result = self._billing_accounts_logs_delete(opt, dry_run, &mut err); + }, + ("logs-list", Some(opt)) => { + call_result = self._billing_accounts_logs_list(opt, dry_run, &mut err); + }, + ("sinks-create", Some(opt)) => { + call_result = self._billing_accounts_sinks_create(opt, dry_run, &mut err); + }, + ("sinks-delete", Some(opt)) => { + call_result = self._billing_accounts_sinks_delete(opt, dry_run, &mut err); + }, + ("sinks-get", Some(opt)) => { + call_result = self._billing_accounts_sinks_get(opt, dry_run, &mut err); + }, + ("sinks-list", Some(opt)) => { + call_result = self._billing_accounts_sinks_list(opt, dry_run, &mut err); + }, + ("sinks-update", Some(opt)) => { + call_result = self._billing_accounts_sinks_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("billing-accounts".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("entries", Some(opt)) => { + match opt.subcommand() { + ("list", Some(opt)) => { + call_result = self._entries_list(opt, dry_run, &mut err); + }, + ("write", Some(opt)) => { + call_result = self._entries_write(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("entries".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("folders", Some(opt)) => { + match opt.subcommand() { + ("logs-delete", Some(opt)) => { + call_result = self._folders_logs_delete(opt, dry_run, &mut err); + }, + ("logs-list", Some(opt)) => { + call_result = self._folders_logs_list(opt, dry_run, &mut err); + }, + ("sinks-create", Some(opt)) => { + call_result = self._folders_sinks_create(opt, dry_run, &mut err); + }, + ("sinks-delete", Some(opt)) => { + call_result = self._folders_sinks_delete(opt, dry_run, &mut err); + }, + ("sinks-get", Some(opt)) => { + call_result = self._folders_sinks_get(opt, dry_run, &mut err); + }, + ("sinks-list", Some(opt)) => { + call_result = self._folders_sinks_list(opt, dry_run, &mut err); + }, + ("sinks-update", Some(opt)) => { + call_result = self._folders_sinks_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("folders".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("monitored-resource-descriptors", Some(opt)) => { + match opt.subcommand() { + ("list", Some(opt)) => { + call_result = self._monitored_resource_descriptors_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("monitored-resource-descriptors".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("organizations", Some(opt)) => { + match opt.subcommand() { + ("logs-delete", Some(opt)) => { + call_result = self._organizations_logs_delete(opt, dry_run, &mut err); + }, + ("logs-list", Some(opt)) => { + call_result = self._organizations_logs_list(opt, dry_run, &mut err); + }, + ("sinks-create", Some(opt)) => { + call_result = self._organizations_sinks_create(opt, dry_run, &mut err); + }, + ("sinks-delete", Some(opt)) => { + call_result = self._organizations_sinks_delete(opt, dry_run, &mut err); + }, + ("sinks-get", Some(opt)) => { + call_result = self._organizations_sinks_get(opt, dry_run, &mut err); + }, + ("sinks-list", Some(opt)) => { + call_result = self._organizations_sinks_list(opt, dry_run, &mut err); + }, + ("sinks-update", Some(opt)) => { + call_result = self._organizations_sinks_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("organizations".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("projects", Some(opt)) => { + match opt.subcommand() { + ("logs-delete", Some(opt)) => { + call_result = self._projects_logs_delete(opt, dry_run, &mut err); + }, + ("logs-list", Some(opt)) => { + call_result = self._projects_logs_list(opt, dry_run, &mut err); + }, + ("metrics-create", Some(opt)) => { + call_result = self._projects_metrics_create(opt, dry_run, &mut err); + }, + ("metrics-delete", Some(opt)) => { + call_result = self._projects_metrics_delete(opt, dry_run, &mut err); + }, + ("metrics-get", Some(opt)) => { + call_result = self._projects_metrics_get(opt, dry_run, &mut err); + }, + ("metrics-list", Some(opt)) => { + call_result = self._projects_metrics_list(opt, dry_run, &mut err); + }, + ("metrics-update", Some(opt)) => { + call_result = self._projects_metrics_update(opt, dry_run, &mut err); + }, + ("sinks-create", Some(opt)) => { + call_result = self._projects_sinks_create(opt, dry_run, &mut err); + }, + ("sinks-delete", Some(opt)) => { + call_result = self._projects_sinks_delete(opt, dry_run, &mut err); + }, + ("sinks-get", Some(opt)) => { + call_result = self._projects_sinks_get(opt, dry_run, &mut err); + }, + ("sinks-list", Some(opt)) => { + call_result = self._projects_sinks_list(opt, dry_run, &mut err); + }, + ("sinks-update", Some(opt)) => { + call_result = self._projects_sinks_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("projects".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + _ => { + err.issues.push(CLIError::MissingCommandError); + writeln!(io::stderr(), "{}\n", self.opt.usage()).ok(); + } + } + + if dry_run { + if err.issues.len() > 0 { + err_opt = Some(err); + } + Err(err_opt) + } else { + Ok(call_result) + } + } + + // Please note that this call will fail if any part of the opt can't be handled + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { + let (config_dir, secret) = { + let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { + Err(e) => return Err(InvalidOptionsError::single(e, 3)), + Ok(p) => p, + }; + + match cmn::application_secret_from_directory(&config_dir, "logging2-secret.json", + "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { + Ok(secret) => (config_dir, secret), + Err(e) => return Err(InvalidOptionsError::single(e, 4)) + } + }; + + let auth = Authenticator::new( &secret, DefaultAuthenticatorDelegate, + if opt.is_present("debug-auth") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::::default() + }) + } else { + hyper::Client::new() + }, + JsonTokenStorage { + program_name: "logging2", + db_dir: config_dir.clone(), + }, Some(FlowType::InstalledRedirect(54324))); + + let client = + if opt.is_present("debug") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::::default() + }) + } else { + hyper::Client::new() + }; + let engine = Engine { + opt: opt, + hub: api::Logging::new(client, auth), + gp: vec!["$-xgafv", "access-token", "alt", "bearer-token", "callback", "fields", "key", "oauth-token", "pp", "pretty-print", "quota-user", "upload-type", "upload-protocol"], + gpm: vec![ + ("$-xgafv", "$.xgafv"), + ("access-token", "access_token"), + ("bearer-token", "bearer_token"), + ("oauth-token", "oauth_token"), + ("pretty-print", "prettyPrint"), + ("quota-user", "quotaUser"), + ("upload-type", "uploadType"), + ("upload-protocol", "upload_protocol"), + ] + }; + + match engine._doit(true) { + Err(Some(err)) => Err(err), + Err(None) => Ok(engine), + Ok(_) => unreachable!(), + } + } + + fn doit(&self) -> Result<(), DoitError> { + match self._doit(false) { + Ok(res) => res, + Err(_) => unreachable!(), + } + } +} + +fn main() { + let mut exit_status = 0i32; + let arg_data = [ + ("billing-accounts", "methods: 'logs-delete', 'logs-list', 'sinks-create', 'sinks-delete', 'sinks-get', 'sinks-list' and 'sinks-update'", vec![ + ("logs-delete", + Some(r##"Deletes all the log entries in a log. The log reappears if it receives new entries."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/billing-accounts_logs-delete", + vec![ + (Some(r##"log-name"##), + None, + Some(r##"Required. The resource name of the log to delete: + "projects/[PROJECT_ID]/logs/[LOG_ID]" + "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" + [LOG_ID] must be URL-encoded. For example, "projects/my-project-id/logs/syslog", "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity". For more information about log names, see LogEntry."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("logs-list", + Some(r##"Lists the logs in projects or organizations. Only logs that have entries are listed."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/billing-accounts_logs-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Required. The resource name that owns the logs: + "projects/[PROJECT_ID]" + "organizations/[ORGANIZATION_ID]" + "##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("sinks-create", + Some(r##"Creates a sink that exports specified log entries to a destination. The export of newly-ingested log entries begins immediately, unless the current time is outside the sink's start and end times or the sink's writer_identity is not permitted to write to the destination. A sink can export log entries only from the resource owning the sink."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/billing-accounts_sinks-create", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Required. The resource in which to create the sink: + "projects/[PROJECT_ID]" + "organizations/[ORGANIZATION_ID]" + Examples: "projects/my-logging-project", "organizations/123456789"."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("sinks-delete", + Some(r##"Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/billing-accounts_sinks-delete", + vec![ + (Some(r##"sink-name"##), + None, + Some(r##"Required. The full resource name of the sink to delete, including the parent resource and the sink identifier: + "projects/[PROJECT_ID]/sinks/[SINK_ID]" + "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + It is an error if the sink does not exist. Example: "projects/my-project-id/sinks/my-sink-id". It is an error if the sink does not exist."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("sinks-get", + Some(r##"Gets a sink."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/billing-accounts_sinks-get", + vec![ + (Some(r##"sink-name"##), + None, + Some(r##"Required. The parent resource name of the sink: + "projects/[PROJECT_ID]/sinks/[SINK_ID]" + "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + Example: "projects/my-project-id/sinks/my-sink-id"."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("sinks-list", + Some(r##"Lists sinks."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/billing-accounts_sinks-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Required. The parent resource whose sinks are to be listed. Examples: "projects/my-logging-project", "organizations/123456789"."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("sinks-update", + Some(r##"Updates a sink. If the named sink doesn't exist, then this method is identical to sinks.create. If the named sink does exist, then this method replaces the following fields in the existing sink with values from the new sink: destination, filter, output_version_format, start_time, and end_time. The updated filter might also have a new writer_identity; see the unique_writer_identity field."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/billing-accounts_sinks-update", + vec![ + (Some(r##"sink-name"##), + None, + Some(r##"Required. The full resource name of the sink to update, including the parent resource and the sink identifier: + "projects/[PROJECT_ID]/sinks/[SINK_ID]" + "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + Example: "projects/my-project-id/sinks/my-sink-id"."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("entries", "methods: 'list' and 'write'", vec![ + ("list", + Some(r##"Lists log entries. Use this method to retrieve log entries from Stackdriver Logging. For ways to export log entries, see Exporting Logs."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/entries_list", + vec![ + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("write", + Some(r##"Writes log entries to Stackdriver Logging. All log entries are written by this method."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/entries_write", + vec![ + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("folders", "methods: 'logs-delete', 'logs-list', 'sinks-create', 'sinks-delete', 'sinks-get', 'sinks-list' and 'sinks-update'", vec![ + ("logs-delete", + Some(r##"Deletes all the log entries in a log. The log reappears if it receives new entries."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/folders_logs-delete", + vec![ + (Some(r##"log-name"##), + None, + Some(r##"Required. The resource name of the log to delete: + "projects/[PROJECT_ID]/logs/[LOG_ID]" + "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" + [LOG_ID] must be URL-encoded. For example, "projects/my-project-id/logs/syslog", "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity". For more information about log names, see LogEntry."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("logs-list", + Some(r##"Lists the logs in projects or organizations. Only logs that have entries are listed."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/folders_logs-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Required. The resource name that owns the logs: + "projects/[PROJECT_ID]" + "organizations/[ORGANIZATION_ID]" + "##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("sinks-create", + Some(r##"Creates a sink that exports specified log entries to a destination. The export of newly-ingested log entries begins immediately, unless the current time is outside the sink's start and end times or the sink's writer_identity is not permitted to write to the destination. A sink can export log entries only from the resource owning the sink."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/folders_sinks-create", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Required. The resource in which to create the sink: + "projects/[PROJECT_ID]" + "organizations/[ORGANIZATION_ID]" + Examples: "projects/my-logging-project", "organizations/123456789"."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("sinks-delete", + Some(r##"Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/folders_sinks-delete", + vec![ + (Some(r##"sink-name"##), + None, + Some(r##"Required. The full resource name of the sink to delete, including the parent resource and the sink identifier: + "projects/[PROJECT_ID]/sinks/[SINK_ID]" + "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + It is an error if the sink does not exist. Example: "projects/my-project-id/sinks/my-sink-id". It is an error if the sink does not exist."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("sinks-get", + Some(r##"Gets a sink."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/folders_sinks-get", + vec![ + (Some(r##"sink-name"##), + None, + Some(r##"Required. The parent resource name of the sink: + "projects/[PROJECT_ID]/sinks/[SINK_ID]" + "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + Example: "projects/my-project-id/sinks/my-sink-id"."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("sinks-list", + Some(r##"Lists sinks."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/folders_sinks-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Required. The parent resource whose sinks are to be listed. Examples: "projects/my-logging-project", "organizations/123456789"."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("sinks-update", + Some(r##"Updates a sink. If the named sink doesn't exist, then this method is identical to sinks.create. If the named sink does exist, then this method replaces the following fields in the existing sink with values from the new sink: destination, filter, output_version_format, start_time, and end_time. The updated filter might also have a new writer_identity; see the unique_writer_identity field."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/folders_sinks-update", + vec![ + (Some(r##"sink-name"##), + None, + Some(r##"Required. The full resource name of the sink to update, including the parent resource and the sink identifier: + "projects/[PROJECT_ID]/sinks/[SINK_ID]" + "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + Example: "projects/my-project-id/sinks/my-sink-id"."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("monitored-resource-descriptors", "methods: 'list'", vec![ + ("list", + Some(r##"Lists the descriptors for monitored resource types used by Stackdriver Logging."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/monitored-resource-descriptors_list", + vec![ + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("organizations", "methods: 'logs-delete', 'logs-list', 'sinks-create', 'sinks-delete', 'sinks-get', 'sinks-list' and 'sinks-update'", vec![ + ("logs-delete", + Some(r##"Deletes all the log entries in a log. The log reappears if it receives new entries."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/organizations_logs-delete", + vec![ + (Some(r##"log-name"##), + None, + Some(r##"Required. The resource name of the log to delete: + "projects/[PROJECT_ID]/logs/[LOG_ID]" + "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" + [LOG_ID] must be URL-encoded. For example, "projects/my-project-id/logs/syslog", "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity". For more information about log names, see LogEntry."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("logs-list", + Some(r##"Lists the logs in projects or organizations. Only logs that have entries are listed."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/organizations_logs-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Required. The resource name that owns the logs: + "projects/[PROJECT_ID]" + "organizations/[ORGANIZATION_ID]" + "##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("sinks-create", + Some(r##"Creates a sink that exports specified log entries to a destination. The export of newly-ingested log entries begins immediately, unless the current time is outside the sink's start and end times or the sink's writer_identity is not permitted to write to the destination. A sink can export log entries only from the resource owning the sink."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/organizations_sinks-create", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Required. The resource in which to create the sink: + "projects/[PROJECT_ID]" + "organizations/[ORGANIZATION_ID]" + Examples: "projects/my-logging-project", "organizations/123456789"."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("sinks-delete", + Some(r##"Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/organizations_sinks-delete", + vec![ + (Some(r##"sink-name"##), + None, + Some(r##"Required. The full resource name of the sink to delete, including the parent resource and the sink identifier: + "projects/[PROJECT_ID]/sinks/[SINK_ID]" + "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + It is an error if the sink does not exist. Example: "projects/my-project-id/sinks/my-sink-id". It is an error if the sink does not exist."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("sinks-get", + Some(r##"Gets a sink."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/organizations_sinks-get", + vec![ + (Some(r##"sink-name"##), + None, + Some(r##"Required. The parent resource name of the sink: + "projects/[PROJECT_ID]/sinks/[SINK_ID]" + "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + Example: "projects/my-project-id/sinks/my-sink-id"."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("sinks-list", + Some(r##"Lists sinks."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/organizations_sinks-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Required. The parent resource whose sinks are to be listed. Examples: "projects/my-logging-project", "organizations/123456789"."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("sinks-update", + Some(r##"Updates a sink. If the named sink doesn't exist, then this method is identical to sinks.create. If the named sink does exist, then this method replaces the following fields in the existing sink with values from the new sink: destination, filter, output_version_format, start_time, and end_time. The updated filter might also have a new writer_identity; see the unique_writer_identity field."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/organizations_sinks-update", + vec![ + (Some(r##"sink-name"##), + None, + Some(r##"Required. The full resource name of the sink to update, including the parent resource and the sink identifier: + "projects/[PROJECT_ID]/sinks/[SINK_ID]" + "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + Example: "projects/my-project-id/sinks/my-sink-id"."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("projects", "methods: 'logs-delete', 'logs-list', 'metrics-create', 'metrics-delete', 'metrics-get', 'metrics-list', 'metrics-update', 'sinks-create', 'sinks-delete', 'sinks-get', 'sinks-list' and 'sinks-update'", vec![ + ("logs-delete", + Some(r##"Deletes all the log entries in a log. The log reappears if it receives new entries."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/projects_logs-delete", + vec![ + (Some(r##"log-name"##), + None, + Some(r##"Required. The resource name of the log to delete: + "projects/[PROJECT_ID]/logs/[LOG_ID]" + "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" + [LOG_ID] must be URL-encoded. For example, "projects/my-project-id/logs/syslog", "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity". For more information about log names, see LogEntry."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("logs-list", + Some(r##"Lists the logs in projects or organizations. Only logs that have entries are listed."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/projects_logs-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Required. The resource name that owns the logs: + "projects/[PROJECT_ID]" + "organizations/[ORGANIZATION_ID]" + "##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("metrics-create", + Some(r##"Creates a logs-based metric."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/projects_metrics-create", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The resource name of the project in which to create the metric: + "projects/[PROJECT_ID]" + The new metric must be provided in the request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("metrics-delete", + Some(r##"Deletes a logs-based metric."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/projects_metrics-delete", + vec![ + (Some(r##"metric-name"##), + None, + Some(r##"The resource name of the metric to delete: + "projects/[PROJECT_ID]/metrics/[METRIC_ID]" + "##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("metrics-get", + Some(r##"Gets a logs-based metric."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/projects_metrics-get", + vec![ + (Some(r##"metric-name"##), + None, + Some(r##"The resource name of the desired metric: + "projects/[PROJECT_ID]/metrics/[METRIC_ID]" + "##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("metrics-list", + Some(r##"Lists logs-based metrics."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/projects_metrics-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Required. The name of the project containing the metrics: + "projects/[PROJECT_ID]" + "##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("metrics-update", + Some(r##"Creates or updates a logs-based metric."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/projects_metrics-update", + vec![ + (Some(r##"metric-name"##), + None, + Some(r##"The resource name of the metric to update: + "projects/[PROJECT_ID]/metrics/[METRIC_ID]" + The updated metric must be provided in the request and it's name field must be the same as [METRIC_ID] If the metric does not exist in [PROJECT_ID], then a new metric is created."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("sinks-create", + Some(r##"Creates a sink that exports specified log entries to a destination. The export of newly-ingested log entries begins immediately, unless the current time is outside the sink's start and end times or the sink's writer_identity is not permitted to write to the destination. A sink can export log entries only from the resource owning the sink."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/projects_sinks-create", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Required. The resource in which to create the sink: + "projects/[PROJECT_ID]" + "organizations/[ORGANIZATION_ID]" + Examples: "projects/my-logging-project", "organizations/123456789"."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("sinks-delete", + Some(r##"Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/projects_sinks-delete", + vec![ + (Some(r##"sink-name"##), + None, + Some(r##"Required. The full resource name of the sink to delete, including the parent resource and the sink identifier: + "projects/[PROJECT_ID]/sinks/[SINK_ID]" + "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + It is an error if the sink does not exist. Example: "projects/my-project-id/sinks/my-sink-id". It is an error if the sink does not exist."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("sinks-get", + Some(r##"Gets a sink."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/projects_sinks-get", + vec![ + (Some(r##"sink-name"##), + None, + Some(r##"Required. The parent resource name of the sink: + "projects/[PROJECT_ID]/sinks/[SINK_ID]" + "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + Example: "projects/my-project-id/sinks/my-sink-id"."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("sinks-list", + Some(r##"Lists sinks."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/projects_sinks-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Required. The parent resource whose sinks are to be listed. Examples: "projects/my-logging-project", "organizations/123456789"."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("sinks-update", + Some(r##"Updates a sink. If the named sink doesn't exist, then this method is identical to sinks.create. If the named sink does exist, then this method replaces the following fields in the existing sink with values from the new sink: destination, filter, output_version_format, start_time, and end_time. The updated filter might also have a new writer_identity; see the unique_writer_identity field."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/projects_sinks-update", + vec![ + (Some(r##"sink-name"##), + None, + Some(r##"Required. The full resource name of the sink to update, including the parent resource and the sink identifier: + "projects/[PROJECT_ID]/sinks/[SINK_ID]" + "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + Example: "projects/my-project-id/sinks/my-sink-id"."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ]; + + let mut app = App::new("logging2") + .author("Sebastian Thiel ") + .version("1.0.0+20161206") + .about("Writes log entries and manages your Stackdriver Logging configuration.") + .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_logging2_cli") + .arg(Arg::with_name("url") + .long("scope") + .help("Specify the authentication a method should be executed in. Each scope requires the user to grant this application permission to use it.If unset, it defaults to the shortest scope url for a particular method.") + .multiple(true) + .takes_value(true)) + .arg(Arg::with_name("folder") + .long("config-dir") + .help("A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation.[default: ~/.google-service-cli") + .multiple(false) + .takes_value(true)) + .arg(Arg::with_name("debug") + .long("debug") + .help("Output all server communication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)) + .arg(Arg::with_name("debug-auth") + .long("debug-auth") + .help("Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)); + + for &(main_command_name, about, ref subcommands) in arg_data.iter() { + let mut mcmd = SubCommand::with_name(main_command_name).about(about); + + for &(sub_command_name, ref desc, url_info, ref args) in subcommands { + let mut scmd = SubCommand::with_name(sub_command_name); + if let &Some(desc) = desc { + scmd = scmd.about(desc); + } + scmd = scmd.after_help(url_info); + + for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { + let arg_name_str = + match (arg_name, flag) { + (&Some(an), _ ) => an, + (_ , &Some(f)) => f, + _ => unreachable!(), + }; + let mut arg = Arg::with_name(arg_name_str) + .empty_values(false); + if let &Some(short_flag) = flag { + arg = arg.short(short_flag); + } + if let &Some(desc) = desc { + arg = arg.help(desc); + } + if arg_name.is_some() && flag.is_some() { + arg = arg.takes_value(true); + } + if let &Some(required) = required { + arg = arg.required(required); + } + if let &Some(multi) = multi { + arg = arg.multiple(multi); + } + scmd = scmd.arg(arg); + } + mcmd = mcmd.subcommand(scmd); + } + app = app.subcommand(mcmd); + } + + let matches = app.get_matches(); + + let debug = matches.is_present("debug"); + match Engine::new(matches) { + Err(err) => { + exit_status = err.exit_code; + writeln!(io::stderr(), "{}", err).ok(); + }, + Ok(engine) => { + if let Err(doit_err) = engine.doit() { + exit_status = 1; + match doit_err { + DoitError::IoError(path, err) => { + writeln!(io::stderr(), "Failed to open output file '{}': {}", path, err).ok(); + }, + DoitError::ApiError(err) => { + if debug { + writeln!(io::stderr(), "{:#?}", err).ok(); + } else { + writeln!(io::stderr(), "{}", err).ok(); + } + } + } + } + } + } + + std::process::exit(exit_status); +} \ No newline at end of file diff --git a/gen/logging2/Cargo.toml b/gen/logging2/Cargo.toml new file mode 100644 index 0000000000..7419708ac9 --- /dev/null +++ b/gen/logging2/Cargo.toml @@ -0,0 +1,34 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-logging2" +version = "1.0.0+20161206" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Logging (protocol v2)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/logging2" +homepage = "https://cloud.google.com/logging/docs/" +documentation = "http://byron.github.io/google-apis-rs/google_logging2" +license = "MIT" +keywords = ["logging", "google", "protocol", "web", "api"] +build = "src/build.rs" + + +[dependencies] +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.8" +serde_json = "^ 0.8" +yup-oauth2 = { version = "^ 1.0", optional = true, default-features = false } +serde_derive = { version = "^ 0.8", optional = true } +url = "= 0.5" + +[features] +default = ["with-serde-codegen"] +nightly = ["serde_derive","yup-oauth2/nightly"] +with-serde-codegen = ["serde_codegen","yup-oauth2/with-serde-codegen"] + +[build-dependencies] +serde_codegen = { version = "^ 0.8", optional = true } + diff --git a/gen/logging2/LICENSE.md b/gen/logging2/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/logging2/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/logging2/README.md b/gen/logging2/README.md new file mode 100644 index 0000000000..70a36822f8 --- /dev/null +++ b/gen/logging2/README.md @@ -0,0 +1,201 @@ + +The `google-logging2` library allows access to all features of the *Google Logging* service. + +This documentation was generated from *Logging* crate version *1.0.0+20161206*, where *20161206* is the exact revision of the *logging:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. + +Everything else about the *Logging* *v2* API can be found at the +[official documentation site](https://cloud.google.com/logging/docs/). +# Features + +Handle the following *Resources* with ease from the central [hub](http://byron.github.io/google-apis-rs/google_logging2/struct.Logging.html) ... + +* billing accounts + * [*logs delete*](http://byron.github.io/google-apis-rs/google_logging2/struct.BillingAccountLogDeleteCall.html), [*logs list*](http://byron.github.io/google-apis-rs/google_logging2/struct.BillingAccountLogListCall.html), [*sinks create*](http://byron.github.io/google-apis-rs/google_logging2/struct.BillingAccountSinkCreateCall.html), [*sinks delete*](http://byron.github.io/google-apis-rs/google_logging2/struct.BillingAccountSinkDeleteCall.html), [*sinks get*](http://byron.github.io/google-apis-rs/google_logging2/struct.BillingAccountSinkGetCall.html), [*sinks list*](http://byron.github.io/google-apis-rs/google_logging2/struct.BillingAccountSinkListCall.html) and [*sinks update*](http://byron.github.io/google-apis-rs/google_logging2/struct.BillingAccountSinkUpdateCall.html) +* entries + * [*list*](http://byron.github.io/google-apis-rs/google_logging2/struct.EntryListCall.html) and [*write*](http://byron.github.io/google-apis-rs/google_logging2/struct.EntryWriteCall.html) +* folders + * [*logs delete*](http://byron.github.io/google-apis-rs/google_logging2/struct.FolderLogDeleteCall.html), [*logs list*](http://byron.github.io/google-apis-rs/google_logging2/struct.FolderLogListCall.html), [*sinks create*](http://byron.github.io/google-apis-rs/google_logging2/struct.FolderSinkCreateCall.html), [*sinks delete*](http://byron.github.io/google-apis-rs/google_logging2/struct.FolderSinkDeleteCall.html), [*sinks get*](http://byron.github.io/google-apis-rs/google_logging2/struct.FolderSinkGetCall.html), [*sinks list*](http://byron.github.io/google-apis-rs/google_logging2/struct.FolderSinkListCall.html) and [*sinks update*](http://byron.github.io/google-apis-rs/google_logging2/struct.FolderSinkUpdateCall.html) +* [monitored resource descriptors](http://byron.github.io/google-apis-rs/google_logging2/struct.MonitoredResourceDescriptor.html) + * [*list*](http://byron.github.io/google-apis-rs/google_logging2/struct.MonitoredResourceDescriptorListCall.html) +* organizations + * [*logs delete*](http://byron.github.io/google-apis-rs/google_logging2/struct.OrganizationLogDeleteCall.html), [*logs list*](http://byron.github.io/google-apis-rs/google_logging2/struct.OrganizationLogListCall.html), [*sinks create*](http://byron.github.io/google-apis-rs/google_logging2/struct.OrganizationSinkCreateCall.html), [*sinks delete*](http://byron.github.io/google-apis-rs/google_logging2/struct.OrganizationSinkDeleteCall.html), [*sinks get*](http://byron.github.io/google-apis-rs/google_logging2/struct.OrganizationSinkGetCall.html), [*sinks list*](http://byron.github.io/google-apis-rs/google_logging2/struct.OrganizationSinkListCall.html) and [*sinks update*](http://byron.github.io/google-apis-rs/google_logging2/struct.OrganizationSinkUpdateCall.html) +* projects + * [*logs delete*](http://byron.github.io/google-apis-rs/google_logging2/struct.ProjectLogDeleteCall.html), [*logs list*](http://byron.github.io/google-apis-rs/google_logging2/struct.ProjectLogListCall.html), [*metrics create*](http://byron.github.io/google-apis-rs/google_logging2/struct.ProjectMetricCreateCall.html), [*metrics delete*](http://byron.github.io/google-apis-rs/google_logging2/struct.ProjectMetricDeleteCall.html), [*metrics get*](http://byron.github.io/google-apis-rs/google_logging2/struct.ProjectMetricGetCall.html), [*metrics list*](http://byron.github.io/google-apis-rs/google_logging2/struct.ProjectMetricListCall.html), [*metrics update*](http://byron.github.io/google-apis-rs/google_logging2/struct.ProjectMetricUpdateCall.html), [*sinks create*](http://byron.github.io/google-apis-rs/google_logging2/struct.ProjectSinkCreateCall.html), [*sinks delete*](http://byron.github.io/google-apis-rs/google_logging2/struct.ProjectSinkDeleteCall.html), [*sinks get*](http://byron.github.io/google-apis-rs/google_logging2/struct.ProjectSinkGetCall.html), [*sinks list*](http://byron.github.io/google-apis-rs/google_logging2/struct.ProjectSinkListCall.html) and [*sinks update*](http://byron.github.io/google-apis-rs/google_logging2/struct.ProjectSinkUpdateCall.html) + + + + +# Structure of this Library + +The API is structured into the following primary items: + +* **[Hub](http://byron.github.io/google-apis-rs/google_logging2/struct.Logging.html)** + * a central object to maintain state and allow accessing all *Activities* + * creates [*Method Builders*](http://byron.github.io/google-apis-rs/google_logging2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](http://byron.github.io/google-apis-rs/google_logging2/trait.CallBuilder.html) +* **[Resources](http://byron.github.io/google-apis-rs/google_logging2/trait.Resource.html)** + * primary types that you can apply *Activities* to + * a collection of properties and *Parts* + * **[Parts](http://byron.github.io/google-apis-rs/google_logging2/trait.Part.html)** + * a collection of properties + * never directly used in *Activities* +* **[Activities](http://byron.github.io/google-apis-rs/google_logging2/trait.CallBuilder.html)** + * operations to apply to *Resources* + +All *structures* are marked with applicable traits to further categorize them and ease browsing. + +Generally speaking, you can invoke *Activities* like this: + +```Rust,ignore +let r = hub.resource().activity(...).doit() +``` + +Or specifically ... + +```ignore +let r = hub.projects().sinks_update(...).doit() +let r = hub.billing_accounts().sinks_get(...).doit() +let r = hub.billing_accounts().sinks_create(...).doit() +let r = hub.folders().sinks_create(...).doit() +let r = hub.organizations().sinks_create(...).doit() +let r = hub.organizations().sinks_update(...).doit() +let r = hub.billing_accounts().sinks_update(...).doit() +let r = hub.organizations().sinks_get(...).doit() +let r = hub.projects().sinks_create(...).doit() +let r = hub.folders().sinks_update(...).doit() +let r = hub.projects().sinks_get(...).doit() +let r = hub.folders().sinks_get(...).doit() +``` + +The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +The `doit()` method performs the actual communication with the server and returns the respective result. + +# Usage + +## Setting up your Project + +To use this library, you would put the following lines into your `Cargo.toml` file: + +```toml +[dependencies] +google-logging2 = "*" +``` + +## A complete example + +```Rust +extern crate hyper; +extern crate yup_oauth2 as oauth2; +extern crate google_logging2 as logging2; +use logging2::LogSink; +use logging2::{Result, Error}; +use std::default::Default; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +use logging2::Logging; + +// Get an ApplicationSecret instance by some means. It contains the `client_id` and +// `client_secret`, among other things. +let secret: ApplicationSecret = Default::default(); +// Instantiate the authenticator. It will choose a suitable authentication flow for you, +// unless you replace `None` with the desired Flow. +// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +// retrieve them from storage. +let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, + hyper::Client::new(), + ::default(), None); +let mut hub = Logging::new(hyper::Client::new(), auth); +// As the method needs a request, you would usually fill it with the desired information +// into the respective structure. Some of the parts shown here might not be applicable ! +// Values shown here are possibly random and not representative ! +let mut req = LogSink::default(); + +// You can configure optional parameters by calling the respective setters at will, and +// execute the final call using `doit()`. +// Values shown here are possibly random and not representative ! +let result = hub.projects().sinks_update(req, "sinkName") + .unique_writer_identity(true) + .doit(); + +match result { + Err(e) => match e { + // The Error enum provides details about what exactly happened. + // You can also just use its `Debug`, `Display` or `Error` traits + Error::HttpError(_) + |Error::MissingAPIKey + |Error::MissingToken(_) + |Error::Cancelled + |Error::UploadSizeLimitExceeded(_, _) + |Error::Failure(_) + |Error::BadRequest(_) + |Error::FieldClash(_) + |Error::JsonDecodeError(_, _) => println!("{}", e), + }, + Ok(res) => println!("Success: {:?}", res), +} + +``` +## Handling Errors + +All errors produced by the system are provided either as [Result](http://byron.github.io/google-apis-rs/google_logging2/enum.Result.html) enumeration as return value of +the doit() methods, or handed as possibly intermediate results to either the +[Hub Delegate](http://byron.github.io/google-apis-rs/google_logging2/trait.Delegate.html), or the [Authenticator Delegate](http://byron.github.io/google-apis-rs/google_logging2/../yup-oauth2/trait.AuthenticatorDelegate.html). + +When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +makes the system potentially resilient to all kinds of errors. + +## Uploads and Downloads +If a method supports downloads, the response body, which is part of the [Result](http://byron.github.io/google-apis-rs/google_logging2/enum.Result.html), should be +read by you to obtain the media. +If such a method also supports a [Response Result](http://byron.github.io/google-apis-rs/google_logging2/trait.ResponseResult.html), it will return that by default. +You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +this call: `.param("alt", "media")`. + +Methods supporting uploads can do so using up to 2 different protocols: +*simple* and *resumable*. The distinctiveness of each is represented by customized +`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. + +## Customization and Callbacks + +You may alter the way an `doit()` method is called by providing a [delegate](http://byron.github.io/google-apis-rs/google_logging2/trait.Delegate.html) to the +[Method Builder](http://byron.github.io/google-apis-rs/google_logging2/trait.CallBuilder.html) before making the final `doit()` call. +Respective methods will be called to provide progress information, as well as determine whether the system should +retry on failure. + +The [delegate trait](http://byron.github.io/google-apis-rs/google_logging2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. + +## Optional Parts in Server-Requests + +All structures provided by this library are made to be [enocodable](http://byron.github.io/google-apis-rs/google_logging2/trait.RequestValue.html) and +[decodable](http://byron.github.io/google-apis-rs/google_logging2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +are valid. +Most optionals are are considered [Parts](http://byron.github.io/google-apis-rs/google_logging2/trait.Part.html) which are identifiable by name, which will be sent to +the server to indicate either the set parts of the request or the desired parts in the response. + +## Builder Arguments + +Using [method builders](http://byron.github.io/google-apis-rs/google_logging2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +These will always take a single argument, for which the following statements are true. + +* [PODs][wiki-pod] are handed by copy +* strings are passed as `&str` +* [request values](http://byron.github.io/google-apis-rs/google_logging2/trait.RequestValue.html) are moved + +Arguments will always be copied or cloned into the builder, to make them independent of their original life times. + +[wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +[google-go-api]: https://github.com/google/google-api-go-client + +# License +The **logging2** library was generated by Sebastian Thiel, and is placed +under the *MIT* license. +You can read the full text at the repository's [license file][repo-license]. + +[repo-license]: https://github.com/Byron/google-apis-rs/LICENSE.md diff --git a/gen/logging2/src/build.rs b/gen/logging2/src/build.rs new file mode 100644 index 0000000000..0bebaf0bf0 --- /dev/null +++ b/gen/logging2/src/build.rs @@ -0,0 +1,25 @@ +#[cfg(feature = "with-serde-codegen")] +mod inner { + extern crate serde_codegen; + + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + serde_codegen::expand(&src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-serde-codegen"))] +mod inner { + pub fn main() {} +} + +pub fn main() { + inner::main() +} \ No newline at end of file diff --git a/gen/logging2/src/cmn.rs b/gen/logging2/src/cmn.rs new file mode 100644 index 0000000000..d75063e466 --- /dev/null +++ b/gen/logging2/src/cmn.rs @@ -0,0 +1,753 @@ +// COPY OF 'src/rust/api/cmn.rs' +// DO NOT EDIT +use std::io::{self, Read, Seek, Cursor, Write, SeekFrom}; +use std; +use std::fmt::{self, Display}; +use std::str::FromStr; +use std::error; +use std::thread::sleep; +use std::time::Duration; + +use mime::{Mime, TopLevel, SubLevel, Attr, Value}; +use oauth2::{TokenType, Retry, self}; +use hyper; +use hyper::header::{ContentType, ContentLength, Headers, UserAgent, Authorization, Header, + HeaderFormat, Bearer}; +use hyper::http::h1::LINE_ENDING; +use hyper::method::Method; +use hyper::status::StatusCode; + +use serde_json as json; + +/// Identifies the Hub. There is only one per library, this trait is supposed +/// to make intended use more explicit. +/// The hub allows to access all resource methods more easily. +pub trait Hub {} + +/// Identifies types for building methods of a particular resource type +pub trait MethodsBuilder {} + +/// Identifies types which represent builders for a particular resource method +pub trait CallBuilder {} + +/// Identifies types which can be inserted and deleted. +/// Types with this trait are most commonly used by clients of this API. +pub trait Resource {} + +/// Identifies types which are used in API responses. +pub trait ResponseResult {} + +/// Identifies types which are used in API requests. +pub trait RequestValue {} + +/// Identifies types which are not actually used by the API +/// This might be a bug within the google API schema. +pub trait UnusedType {} + +/// Identifies types which are only used as part of other types, which +/// usually are carrying the `Resource` trait. +pub trait Part {} + +/// Identifies types which are only used by other types internally. +/// They have no special meaning, this trait just marks them for completeness. +pub trait NestedType {} + +/// A utility to specify reader types which provide seeking capabilities too +pub trait ReadSeek: Seek + Read {} +impl ReadSeek for T {} + +/// A trait for all types that can convert themselves into a *parts* string +pub trait ToParts { + fn to_parts(&self) -> String; +} + +/// A utility type which can decode a server response that indicates error +#[derive(Deserialize)] +pub struct JsonServerError { + pub error: String, + pub error_description: Option +} + +/// A utility to represent detailed errors we might see in case there are BadRequests. +/// The latter happen if the sent parameters or request structures are unsound +#[derive(Deserialize, Serialize, Debug)] +pub struct ErrorResponse { + error: ServerError, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerError { + errors: Vec, + code: u16, + message: String, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerMessage { + domain: String, + reason: String, + message: String, + #[serde(rename="locationType")] + location_type: Option, + location: Option +} + +#[derive(Copy, Clone)] +pub struct DummyNetworkStream; + +impl Read for DummyNetworkStream { + fn read(&mut self, _: &mut [u8]) -> io::Result { + Ok(0) + } +} + +impl Write for DummyNetworkStream { + fn write(&mut self, _: &[u8]) -> io::Result { + Ok(0) + } + + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} + +impl hyper::net::NetworkStream for DummyNetworkStream { + fn peer_addr(&mut self) -> io::Result { + Ok("127.0.0.1:1337".parse().unwrap()) + } + + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } + + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } +} + + +/// A trait specifying functionality to help controlling any request performed by the API. +/// The trait has a conservative default implementation. +/// +/// It contains methods to deal with all common issues, as well with the ones related to +/// uploading media +pub trait Delegate { + + /// Called at the beginning of any API request. The delegate should store the method + /// information if he is interesting in knowing more context when further calls to it + /// are made. + /// The matching `finished()` call will always be made, no matter whether or not the API + /// request was successful. That way, the delegate may easily maintain a clean state + /// between various API calls. + fn begin(&mut self, MethodInfo) {} + + /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + /// + /// Return retry information. + fn http_error(&mut self, &hyper::Error) -> Retry { + Retry::Abort + } + + /// Called whenever there is the need for your applications API key after + /// the official authenticator implementation didn't provide one, for some reason. + /// If this method returns None as well, the underlying operation will fail + fn api_key(&mut self) -> Option { + None + } + + /// Called whenever the Authenticator didn't yield a token. The delegate + /// may attempt to provide one, or just take it as a general information about the + /// impending failure. + /// The given Error provides information about why the token couldn't be acquired in the + /// first place + fn token(&mut self, err: &error::Error) -> Option { + let _ = err; + None + } + + /// Called during resumable uploads to provide a URL for the impending upload. + /// It was saved after a previous call to `store_upload_url(...)`, and if not None, + /// will be used instead of asking the server for a new upload URL. + /// This is useful in case a previous resumable upload was aborted/canceled, but should now + /// be resumed. + /// The returned URL will be used exactly once - if it fails again and the delegate allows + /// to retry, we will ask the server for a new upload URL. + fn upload_url(&mut self) -> Option { + None + } + + /// Called after we have retrieved a new upload URL for a resumable upload to store it + /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// see `upload_url()`. + /// It will also be called with None after a successful upload, which allows the delegate + /// to forget the URL. That way, we will not attempt to resume an upload that has already + /// finished. + fn store_upload_url(&mut self, url: Option<&str>) { + let _ = url; + } + + /// Called whenever a server response could not be decoded from json. + /// It's for informational purposes only, the caller will return with an error + /// accordingly. + /// + /// # Arguments + /// + /// * `json_encoded_value` - The json-encoded value which failed to decode. + /// * `json_decode_error` - The decoder error + fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &json::Error) { + let _ = json_encoded_value; + let _ = json_decode_error; + } + + /// Called whenever the http request returns with a non-success status code. + /// This can involve authentication issues, or anything else that very much + /// depends on the used API method. + /// The delegate should check the status, header and decoded json error to decide + /// whether to retry or not. In the latter case, the underlying call will fail. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + fn http_failure(&mut self, _: &hyper::client::Response, Option, _: Option) -> Retry { + Retry::Abort + } + + /// Called prior to sending the main request of the given method. It can be used to time + /// the call or to print progress information. + /// It's also useful as you can be sure that a request will definitely be made. + fn pre_request(&mut self) { } + + /// Return the size of each chunk of a resumable upload. + /// Must be a power of two, with 1<<18 being the smallest allowed chunk size. + /// Will be called once before starting any resumable upload. + fn chunk_size(&mut self) -> u64 { + 1 << 23 + } + + /// Called before the given chunk is uploaded to the server. + /// If true is returned, the upload will be interrupted. + /// However, it may be resumable if you stored the upload URL in a previous call + /// to `store_upload_url()` + fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { + let _ = chunk; + false + } + + /// Called before the API request method returns, in every case. It can be used to clean up + /// internal state between calls to the API. + /// This call always has a matching call to `begin(...)`. + /// + /// # Arguments + /// + /// * `is_success` - a true value indicates the operation was successful. If false, you should + /// discard all values stored during `store_upload_url`. + fn finished(&mut self, is_success: bool) { + let _ = is_success; + } +} + +/// A delegate with a conservative default implementation, which is used if no other delegate is +/// set. +#[derive(Default)] +pub struct DefaultDelegate; + +impl Delegate for DefaultDelegate {} + + +#[derive(Debug)] +pub enum Error { + /// The http connection failed + HttpError(hyper::Error), + + /// An attempt was made to upload a resource with size stored in field `.0` + /// even though the maximum upload size is what is stored in field `.1`. + UploadSizeLimitExceeded(u64, u64), + + /// Represents information about a request that was not understood by the server. + /// Details are included. + BadRequest(ErrorResponse), + + /// We needed an API key for authentication, but didn't obtain one. + /// Neither through the authenticator, nor through the Delegate. + MissingAPIKey, + + /// We required a Token, but didn't get one from the Authenticator + MissingToken(Box), + + /// The delgate instructed to cancel the operation + Cancelled, + + /// An additional, free form field clashed with one of the built-in optional ones + FieldClash(&'static str), + + /// Shows that we failed to decode the server response. + /// This can happen if the protocol changes in conjunction with strict json decoding. + JsonDecodeError(String, json::Error), + + /// Indicates an HTTP repsonse with a non-success status code + Failure(hyper::client::Response), +} + + +impl Display for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + Error::HttpError(ref err) => err.fmt(f), + Error::UploadSizeLimitExceeded(ref resource_size, ref max_size) => + writeln!(f, "The media size {} exceeds the maximum allowed upload size of {}" + , resource_size, max_size), + Error::MissingAPIKey => { + (writeln!(f, "The application's API key was not found in the configuration")).ok(); + writeln!(f, "It is used as there are no Scopes defined for this method.") + }, + Error::BadRequest(ref err) => { + try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); + for err in err.error.errors.iter() { + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, + err.reason, + match &err.location { + &Some(ref loc) => format!("@{}", loc), + &None => String::new(), + })); + } + Ok(()) + }, + Error::MissingToken(ref err) => + writeln!(f, "Token retrieval failed with error: {}", err), + Error::Cancelled => + writeln!(f, "Operation cancelled by delegate"), + Error::FieldClash(field) => + writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), + Error::JsonDecodeError(ref json_str, ref err) + => writeln!(f, "{}: {}", err, json_str), + Error::Failure(ref response) => + writeln!(f, "Http status indicates failure: {:?}", response), + } + } +} + +impl error::Error for Error { + fn description(&self) -> &str { + match *self { + Error::HttpError(ref err) => err.description(), + Error::JsonDecodeError(_, ref err) => err.description(), + _ => "NO DESCRIPTION POSSIBLE - use `Display.fmt()` instead" + } + } + + fn cause(&self) -> Option<&error::Error> { + match *self { + Error::HttpError(ref err) => err.cause(), + Error::JsonDecodeError(_, ref err) => err.cause(), + _ => None + } + } +} + +/// A universal result type used as return for all calls. +pub type Result = std::result::Result; + +/// Contains information about an API request. +pub struct MethodInfo { + pub id: &'static str, + pub http_method: Method, +} + +const BOUNDARY: &'static str = "MDuXWGyeE33QFXGchb2VFWc4Z7945d"; + +/// Provides a `Read` interface that converts multiple parts into the protocol +/// identified by [RFC2387](https://tools.ietf.org/html/rfc2387). +/// **Note**: This implementation is just as rich as it needs to be to perform uploads +/// to google APIs, and might not be a fully-featured implementation. +#[derive(Default)] +pub struct MultiPartReader<'a> { + raw_parts: Vec<(Headers, &'a mut Read)>, + current_part: Option<(Cursor>, &'a mut Read)>, + last_part_boundary: Option>>, +} + +impl<'a> MultiPartReader<'a> { + + /// Reserve memory for exactly the given amount of parts + pub fn reserve_exact(&mut self, cap: usize) { + self.raw_parts.reserve_exact(cap); + } + + /// Add a new part to the queue of parts to be read on the first `read` call. + /// + /// # Arguments + /// + /// `headers` - identifying the body of the part. It's similar to the header + /// in an ordinary single-part call, and should thus contain the + /// same information. + /// `reader` - a reader providing the part's body + /// `size` - the amount of bytes provided by the reader. It will be put onto the header as + /// content-size. + /// `mime` - It will be put onto the content type + pub fn add_part(&mut self, reader: &'a mut Read, size: u64, mime_type: Mime) -> &mut MultiPartReader<'a> { + let mut headers = Headers::new(); + headers.set(ContentType(mime_type)); + headers.set(ContentLength(size)); + self.raw_parts.push((headers, reader)); + self + } + + /// Returns the mime-type representing our multi-part message. + /// Use it with the ContentType header. + pub fn mime_type(&self) -> Mime { + Mime( + TopLevel::Multipart, + SubLevel::Ext("Related".to_string()), + vec![(Attr::Ext("boundary".to_string()), Value::Ext(BOUNDARY.to_string()))], + ) + } + + /// Returns true if we are totally used + fn is_depleted(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_none() && self.last_part_boundary.is_none() + } + + /// Returns true if we are handling our last part + fn is_last_part(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_some() + } +} + +impl<'a> Read for MultiPartReader<'a> { + fn read(&mut self, buf: &mut [u8]) -> io::Result { + match (self.raw_parts.len(), + self.current_part.is_none(), + self.last_part_boundary.is_none()) { + (_, _, false) => { + let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); + if br < buf.len() { + self.last_part_boundary = None; + } + return Ok(br) + }, + (0, true, true) => return Ok(0), + (n, true, _) if n > 0 => { + let (headers, reader) = self.raw_parts.remove(0); + let mut c = Cursor::new(Vec::::new()); + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + headers, LINE_ENDING)).unwrap(); + c.seek(SeekFrom::Start(0)).unwrap(); + self.current_part = Some((c, reader)); + } + _ => {}, + } + + // read headers as long as possible + let (hb, rr) = { + let &mut (ref mut c, ref mut reader) = self.current_part.as_mut().unwrap(); + let b = c.read(buf).unwrap_or(0); + (b, reader.read(&mut buf[b..])) + }; + + match rr { + Ok(bytes_read) => { + if hb < buf.len() && bytes_read == 0 { + if self.is_last_part() { + // before clearing the last part, we will add the boundary that + // will be written last + self.last_part_boundary = Some(Cursor::new( + format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) + } + // We are depleted - this can trigger the next part to come in + self.current_part = None; + } + let mut total_bytes_read = hb + bytes_read; + while total_bytes_read < buf.len() && !self.is_depleted() { + match self.read(&mut buf[total_bytes_read ..]) { + Ok(br) => total_bytes_read += br, + Err(err) => return Err(err), + } + } + Ok(total_bytes_read) + } + Err(err) => { + // fail permanently + self.current_part = None; + self.last_part_boundary = None; + self.raw_parts.clear(); + Err(err) + } + } + } +} + +/// The `X-Upload-Content-Type` header. +/// +/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// processed to be more readable. +#[derive(PartialEq, Debug, Clone)] +pub struct XUploadContentType(pub Mime); + +impl ::std::ops::Deref for XUploadContentType { + type Target = Mime; + fn deref<'a>(&'a self) -> &'a Mime { &self.0 } +} +impl ::std::ops::DerefMut for XUploadContentType { + fn deref_mut<'a>(&'a mut self) -> &'a mut Mime { &mut self.0 } +} +impl Header for XUploadContentType { + fn header_name() -> &'static str { "X-Upload-Content-Type" } + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + hyper::header::parsing::from_one_raw_str(raw).map(XUploadContentType) + } +} +impl HeaderFormat for XUploadContentType { + fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result { + Display::fmt(&**self, f) + } +} +impl Display for XUploadContentType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(&**self, f) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct Chunk { + pub first: u64, + pub last: u64 +} + +impl fmt::Display for Chunk { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + (write!(fmt, "{}-{}", self.first, self.last)).ok(); + Ok(()) + } +} + +impl FromStr for Chunk { + type Err = &'static str; + + /// NOTE: only implements `%i-%i`, not `*` + fn from_str(s: &str) -> std::result::Result { + let parts: Vec<&str> = s.split('-').collect(); + if parts.len() != 2 { + return Err("Expected two parts: %i-%i") + } + Ok( + Chunk { + first: match FromStr::from_str(parts[0]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'first' as digit") + }, + last: match FromStr::from_str(parts[1]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'last' as digit") + } + } + ) + } +} + +/// Implements the Content-Range header, for serialization only +#[derive(Clone, PartialEq, Debug)] +pub struct ContentRange { + pub range: Option, + pub total_length: u64, +} + +impl Header for ContentRange { + fn header_name() -> &'static str { + "Content-Range" + } + + /// We are not parsable, as parsing is done by the `Range` header + fn parse_header(_: &[Vec]) -> hyper::error::Result { + Err(hyper::error::Error::Method) + } +} + + +impl HeaderFormat for ContentRange { + fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + try!(fmt.write_str("bytes ")); + match self.range { + Some(ref c) => try!(c.fmt(fmt)), + None => try!(fmt.write_str("*")) + } + (write!(fmt, "/{}", self.total_length)).ok(); + Ok(()) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct RangeResponseHeader(pub Chunk); + +impl Header for RangeResponseHeader { + fn header_name() -> &'static str { + "Range" + } + + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + if raw.len() > 0 { + let v = &raw[0]; + if let Ok(s) = std::str::from_utf8(v) { + const PREFIX: &'static str = "bytes "; + if s.starts_with(PREFIX) { + if let Ok(c) = ::from_str(&s[PREFIX.len()..]) { + return Ok(RangeResponseHeader(c)) + } + } + } + } + Err(hyper::error::Error::Method) + } +} + +impl HeaderFormat for RangeResponseHeader { + /// No implmentation necessary, we just need to parse + fn fmt_header(&self, _: &mut fmt::Formatter) -> fmt::Result { + Err(fmt::Error) + } +} + +/// A utility type to perform a resumable upload from start to end. +pub struct ResumableUploadHelper<'a, A: 'a> { + pub client: &'a mut hyper::client::Client, + pub delegate: &'a mut Delegate, + pub start_at: Option, + pub auth: &'a mut A, + pub user_agent: &'a str, + pub auth_header: Authorization, + pub url: &'a str, + pub reader: &'a mut ReadSeek, + pub media_type: Mime, + pub content_length: u64 +} + +impl<'a, A> ResumableUploadHelper<'a, A> + where A: oauth2::GetToken { + + fn query_transfer_status(&mut self) -> std::result::Result> { + loop { + match self.client.post(self.url) + .header(UserAgent(self.user_agent.to_string())) + .header(ContentRange { range: None, total_length: self.content_length }) + .header(self.auth_header.clone()) + .send() { + Ok(r) => { + // 308 = resume-incomplete == PermanentRedirect + let headers = r.headers.clone(); + let h: &RangeResponseHeader = match headers.get() { + Some(hh) if r.status == StatusCode::PermanentRedirect => hh, + None|Some(_) => { + if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { + sleep(d); + continue; + } + return Err(Ok(r)) + } + }; + return Ok(h.0.last) + } + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Err(Err(err)) + } + } + } + } + + /// returns None if operation was cancelled by delegate, or the HttpResult. + /// It can be that we return the result just because we didn't understand the status code - + /// caller should check for status himself before assuming it's OK to use + pub fn upload(&mut self) -> Option> { + let mut start = match self.start_at { + Some(s) => s, + None => match self.query_transfer_status() { + Ok(s) => s, + Err(result) => return Some(result) + } + }; + + const MIN_CHUNK_SIZE: u64 = 1 << 18; + let chunk_size = match self.delegate.chunk_size() { + cs if cs > MIN_CHUNK_SIZE => cs, + _ => MIN_CHUNK_SIZE + }; + + self.reader.seek(SeekFrom::Start(start)).unwrap(); + loop { + let request_size = match self.content_length - start { + rs if rs > chunk_size => chunk_size, + rs => rs + }; + + let mut section_reader = self.reader.take(request_size); + let range_header = ContentRange { + range: Some(Chunk {first: start, last: start + request_size - 1}), + total_length: self.content_length + }; + start += request_size; + if self.delegate.cancel_chunk_upload(&range_header) { + return None + } + let res = self.client.post(self.url) + .header(range_header) + .header(ContentType(self.media_type.clone())) + .header(UserAgent(self.user_agent.to_string())) + .body(&mut section_reader) + .send(); + match res { + Ok(mut res) => { + if res.status == StatusCode::PermanentRedirect { + continue + } + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let Retry::After(d) = self.delegate.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + } + return Some(Ok(res)) + }, + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Some(Err(err)) + } + } + } + } +} + +// Copy of src/rust/cli/cmn.rs +// TODO(ST): Allow sharing common code between program types +pub fn remove_json_null_values(value: &mut json::value::Value) { + match *value { + json::value::Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} diff --git a/gen/logging2/src/lib.rs b/gen/logging2/src/lib.rs new file mode 100644 index 0000000000..6369970d08 --- /dev/null +++ b/gen/logging2/src/lib.rs @@ -0,0 +1,210 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +//! This documentation was generated from *Logging* crate version *1.0.0+20161206*, where *20161206* is the exact revision of the *logging:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! +//! Everything else about the *Logging* *v2* API can be found at the +//! [official documentation site](https://cloud.google.com/logging/docs/). +//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/logging2). +//! # Features +//! +//! Handle the following *Resources* with ease from the central [hub](struct.Logging.html) ... +//! +//! * billing accounts +//! * [*logs delete*](struct.BillingAccountLogDeleteCall.html), [*logs list*](struct.BillingAccountLogListCall.html), [*sinks create*](struct.BillingAccountSinkCreateCall.html), [*sinks delete*](struct.BillingAccountSinkDeleteCall.html), [*sinks get*](struct.BillingAccountSinkGetCall.html), [*sinks list*](struct.BillingAccountSinkListCall.html) and [*sinks update*](struct.BillingAccountSinkUpdateCall.html) +//! * entries +//! * [*list*](struct.EntryListCall.html) and [*write*](struct.EntryWriteCall.html) +//! * folders +//! * [*logs delete*](struct.FolderLogDeleteCall.html), [*logs list*](struct.FolderLogListCall.html), [*sinks create*](struct.FolderSinkCreateCall.html), [*sinks delete*](struct.FolderSinkDeleteCall.html), [*sinks get*](struct.FolderSinkGetCall.html), [*sinks list*](struct.FolderSinkListCall.html) and [*sinks update*](struct.FolderSinkUpdateCall.html) +//! * [monitored resource descriptors](struct.MonitoredResourceDescriptor.html) +//! * [*list*](struct.MonitoredResourceDescriptorListCall.html) +//! * organizations +//! * [*logs delete*](struct.OrganizationLogDeleteCall.html), [*logs list*](struct.OrganizationLogListCall.html), [*sinks create*](struct.OrganizationSinkCreateCall.html), [*sinks delete*](struct.OrganizationSinkDeleteCall.html), [*sinks get*](struct.OrganizationSinkGetCall.html), [*sinks list*](struct.OrganizationSinkListCall.html) and [*sinks update*](struct.OrganizationSinkUpdateCall.html) +//! * projects +//! * [*logs delete*](struct.ProjectLogDeleteCall.html), [*logs list*](struct.ProjectLogListCall.html), [*metrics create*](struct.ProjectMetricCreateCall.html), [*metrics delete*](struct.ProjectMetricDeleteCall.html), [*metrics get*](struct.ProjectMetricGetCall.html), [*metrics list*](struct.ProjectMetricListCall.html), [*metrics update*](struct.ProjectMetricUpdateCall.html), [*sinks create*](struct.ProjectSinkCreateCall.html), [*sinks delete*](struct.ProjectSinkDeleteCall.html), [*sinks get*](struct.ProjectSinkGetCall.html), [*sinks list*](struct.ProjectSinkListCall.html) and [*sinks update*](struct.ProjectSinkUpdateCall.html) +//! +//! +//! +//! +//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](../index.html). +//! +//! # Structure of this Library +//! +//! The API is structured into the following primary items: +//! +//! * **[Hub](struct.Logging.html)** +//! * a central object to maintain state and allow accessing all *Activities* +//! * creates [*Method Builders*](trait.MethodsBuilder.html) which in turn +//! allow access to individual [*Call Builders*](trait.CallBuilder.html) +//! * **[Resources](trait.Resource.html)** +//! * primary types that you can apply *Activities* to +//! * a collection of properties and *Parts* +//! * **[Parts](trait.Part.html)** +//! * a collection of properties +//! * never directly used in *Activities* +//! * **[Activities](trait.CallBuilder.html)** +//! * operations to apply to *Resources* +//! +//! All *structures* are marked with applicable traits to further categorize them and ease browsing. +//! +//! Generally speaking, you can invoke *Activities* like this: +//! +//! ```Rust,ignore +//! let r = hub.resource().activity(...).doit() +//! ``` +//! +//! Or specifically ... +//! +//! ```ignore +//! let r = hub.projects().sinks_update(...).doit() +//! let r = hub.billing_accounts().sinks_get(...).doit() +//! let r = hub.billing_accounts().sinks_create(...).doit() +//! let r = hub.folders().sinks_create(...).doit() +//! let r = hub.organizations().sinks_create(...).doit() +//! let r = hub.organizations().sinks_update(...).doit() +//! let r = hub.billing_accounts().sinks_update(...).doit() +//! let r = hub.organizations().sinks_get(...).doit() +//! let r = hub.projects().sinks_create(...).doit() +//! let r = hub.folders().sinks_update(...).doit() +//! let r = hub.projects().sinks_get(...).doit() +//! let r = hub.folders().sinks_get(...).doit() +//! ``` +//! +//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +//! The `doit()` method performs the actual communication with the server and returns the respective result. +//! +//! # Usage +//! +//! ## Setting up your Project +//! +//! To use this library, you would put the following lines into your `Cargo.toml` file: +//! +//! ```toml +//! [dependencies] +//! google-logging2 = "*" +//! ``` +//! +//! ## A complete example +//! +//! ```test_harness,no_run +//! extern crate hyper; +//! extern crate yup_oauth2 as oauth2; +//! extern crate google_logging2 as logging2; +//! use logging2::LogSink; +//! use logging2::{Result, Error}; +//! # #[test] fn egal() { +//! use std::default::Default; +//! use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +//! use logging2::Logging; +//! +//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and +//! // `client_secret`, among other things. +//! let secret: ApplicationSecret = Default::default(); +//! // Instantiate the authenticator. It will choose a suitable authentication flow for you, +//! // unless you replace `None` with the desired Flow. +//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +//! // retrieve them from storage. +//! let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +//! hyper::Client::new(), +//! ::default(), None); +//! let mut hub = Logging::new(hyper::Client::new(), auth); +//! // As the method needs a request, you would usually fill it with the desired information +//! // into the respective structure. Some of the parts shown here might not be applicable ! +//! // Values shown here are possibly random and not representative ! +//! let mut req = LogSink::default(); +//! +//! // You can configure optional parameters by calling the respective setters at will, and +//! // execute the final call using `doit()`. +//! // Values shown here are possibly random and not representative ! +//! let result = hub.projects().sinks_update(req, "sinkName") +//! .unique_writer_identity(false) +//! .doit(); +//! +//! match result { +//! Err(e) => match e { +//! // The Error enum provides details about what exactly happened. +//! // You can also just use its `Debug`, `Display` or `Error` traits +//! Error::HttpError(_) +//! |Error::MissingAPIKey +//! |Error::MissingToken(_) +//! |Error::Cancelled +//! |Error::UploadSizeLimitExceeded(_, _) +//! |Error::Failure(_) +//! |Error::BadRequest(_) +//! |Error::FieldClash(_) +//! |Error::JsonDecodeError(_, _) => println!("{}", e), +//! }, +//! Ok(res) => println!("Success: {:?}", res), +//! } +//! # } +//! ``` +//! ## Handling Errors +//! +//! All errors produced by the system are provided either as [Result](enum.Result.html) enumeration as return value of +//! the doit() methods, or handed as possibly intermediate results to either the +//! [Hub Delegate](trait.Delegate.html), or the [Authenticator Delegate](../yup-oauth2/trait.AuthenticatorDelegate.html). +//! +//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +//! makes the system potentially resilient to all kinds of errors. +//! +//! ## Uploads and Downloads +//! If a method supports downloads, the response body, which is part of the [Result](enum.Result.html), should be +//! read by you to obtain the media. +//! If such a method also supports a [Response Result](trait.ResponseResult.html), it will return that by default. +//! You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +//! this call: `.param("alt", "media")`. +//! +//! Methods supporting uploads can do so using up to 2 different protocols: +//! *simple* and *resumable*. The distinctiveness of each is represented by customized +//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. +//! +//! ## Customization and Callbacks +//! +//! You may alter the way an `doit()` method is called by providing a [delegate](trait.Delegate.html) to the +//! [Method Builder](trait.CallBuilder.html) before making the final `doit()` call. +//! Respective methods will be called to provide progress information, as well as determine whether the system should +//! retry on failure. +//! +//! The [delegate trait](trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +//! +//! ## Optional Parts in Server-Requests +//! +//! All structures provided by this library are made to be [enocodable](trait.RequestValue.html) and +//! [decodable](trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +//! are valid. +//! Most optionals are are considered [Parts](trait.Part.html) which are identifiable by name, which will be sent to +//! the server to indicate either the set parts of the request or the desired parts in the response. +//! +//! ## Builder Arguments +//! +//! Using [method builders](trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +//! These will always take a single argument, for which the following statements are true. +//! +//! * [PODs][wiki-pod] are handed by copy +//! * strings are passed as `&str` +//! * [request values](trait.RequestValue.html) are moved +//! +//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times. +//! +//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +//! [google-go-api]: https://github.com/google/google-api-go-client +//! +//! + +// Unused attributes happen thanks to defined, but unused structures +// We don't warn about this, as depending on the API, some data structures or facilities are never used. +// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any +// unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(proc_macro))] +#![allow(unused_imports, unused_mut, dead_code)] + +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-serde-codegen")] +include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/logging2/src/lib.rs.in b/gen/logging2/src/lib.rs.in new file mode 100644 index 0000000000..cbf64001ea --- /dev/null +++ b/gen/logging2/src/lib.rs.in @@ -0,0 +1,11205 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.in.mako' +// DO NOT EDIT ! + +#[cfg(feature = "nightly")] +#[macro_use] +extern crate serde_derive; + +extern crate hyper; +extern crate serde; +extern crate serde_json; +extern crate yup_oauth2 as oauth2; +extern crate mime; +extern crate url; + +mod cmn; + +use std::collections::HashMap; +use std::cell::RefCell; +use std::borrow::BorrowMut; +use std::default::Default; +use std::collections::BTreeMap; +use serde_json as json; +use std::io; +use std::fs; +use std::thread::sleep; +use std::time::Duration; + +pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + Resource, ErrorResponse, remove_json_null_values}; + + +// ############## +// UTILITIES ### +// ############ + +/// Identifies the an OAuth2 authorization scope. +/// A scope is needed when requesting an +/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). +#[derive(PartialEq, Eq, Hash)] +pub enum Scope { + /// View log data for your projects + Read, + + /// Submit log data for your projects + Write, + + /// Administrate log data for your projects + Admin, + + /// View and manage your data across Google Cloud Platform services + CloudPlatform, + + /// View your data across Google Cloud Platform services + CloudPlatformReadOnly, +} + +impl AsRef for Scope { + fn as_ref(&self) -> &str { + match *self { + Scope::Read => "https://www.googleapis.com/auth/logging.read", + Scope::Write => "https://www.googleapis.com/auth/logging.write", + Scope::Admin => "https://www.googleapis.com/auth/logging.admin", + Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform", + Scope::CloudPlatformReadOnly => "https://www.googleapis.com/auth/cloud-platform.read-only", + } + } +} + +impl Default for Scope { + fn default() -> Scope { + Scope::Read + } +} + + + +// ######## +// HUB ### +// ###### + +/// Central instance to access all Logging related resource activities +/// +/// # Examples +/// +/// Instantiate a new hub +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_logging2 as logging2; +/// use logging2::LogSink; +/// use logging2::{Result, Error}; +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use logging2::Logging; +/// +/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and +/// // `client_secret`, among other things. +/// let secret: ApplicationSecret = Default::default(); +/// // Instantiate the authenticator. It will choose a suitable authentication flow for you, +/// // unless you replace `None` with the desired Flow. +/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +/// // retrieve them from storage. +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Logging::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = LogSink::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().sinks_update(req, "sinkName") +/// .unique_writer_identity(true) +/// .doit(); +/// +/// match result { +/// Err(e) => match e { +/// // The Error enum provides details about what exactly happened. +/// // You can also just use its `Debug`, `Display` or `Error` traits +/// Error::HttpError(_) +/// |Error::MissingAPIKey +/// |Error::MissingToken(_) +/// |Error::Cancelled +/// |Error::UploadSizeLimitExceeded(_, _) +/// |Error::Failure(_) +/// |Error::BadRequest(_) +/// |Error::FieldClash(_) +/// |Error::JsonDecodeError(_, _) => println!("{}", e), +/// }, +/// Ok(res) => println!("Success: {:?}", res), +/// } +/// # } +/// ``` +pub struct Logging { + client: RefCell, + auth: RefCell, + _user_agent: String, +} + +impl<'a, C, A> Hub for Logging {} + +impl<'a, C, A> Logging + where C: BorrowMut, A: oauth2::GetToken { + + pub fn new(client: C, authenticator: A) -> Logging { + Logging { + client: RefCell::new(client), + auth: RefCell::new(authenticator), + _user_agent: "google-api-rust-client/1.0.0".to_string(), + } + } + + pub fn billing_accounts(&'a self) -> BillingAccountMethods<'a, C, A> { + BillingAccountMethods { hub: &self } + } + pub fn entries(&'a self) -> EntryMethods<'a, C, A> { + EntryMethods { hub: &self } + } + pub fn folders(&'a self) -> FolderMethods<'a, C, A> { + FolderMethods { hub: &self } + } + pub fn monitored_resource_descriptors(&'a self) -> MonitoredResourceDescriptorMethods<'a, C, A> { + MonitoredResourceDescriptorMethods { hub: &self } + } + pub fn organizations(&'a self) -> OrganizationMethods<'a, C, A> { + OrganizationMethods { hub: &self } + } + pub fn projects(&'a self) -> ProjectMethods<'a, C, A> { + ProjectMethods { hub: &self } + } + + /// Set the user-agent header field to use in all requests to the server. + /// It defaults to `google-api-rust-client/1.0.0`. + /// + /// Returns the previously set user-agent. + pub fn user_agent(&mut self, agent_name: String) -> String { + let prev = self._user_agent.clone(); + self._user_agent = agent_name; + prev + } +} + + +// ############ +// SCHEMAS ### +// ########## +/// Result returned from ListLogEntries. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list entries](struct.EntryListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListLogEntriesResponse { + /// If there might be more results than those appearing in this response, then nextPageToken is included. To get the next set of results, call this method again using the value of nextPageToken as pageToken.If a value for next_page_token appears and the entries field is empty, it means that the search found no log entries so far but it did not have time to search all the possible log entries. Retry the method with this value for page_token to continue the search. Alternatively, consider speeding up the search by changing your filter to specify a single log name or resource type, or to narrow the time range of the search. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// A list of log entries. + pub entries: Option>, +} + +impl ResponseResult for ListLogEntriesResponse {} + + +/// Additional information about the source code location that produced the log entry. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LogEntrySourceLocation { + /// Optional. Human-readable name of the function or method being invoked, with optional context such as the class or package name. This information may be used in contexts such as the logs viewer, where a file and line number are less meaningful. The format can vary by language. For example: qual.if.ied.Class.method (Java), dir/package.func (Go), function (Python). + pub function: Option, + /// Optional. Line within the source file. 1-based; 0 indicates no line number available. + pub line: Option, + /// Optional. Source file name. Depending on the runtime environment, this might be a simple name or a fully-qualified name. + pub file: Option, +} + +impl Part for LogEntrySourceLocation {} + + +/// Result returned from ListLogs. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [logs list folders](struct.FolderLogListCall.html) (response) +/// * [logs list organizations](struct.OrganizationLogListCall.html) (response) +/// * [logs list billing accounts](struct.BillingAccountLogListCall.html) (response) +/// * [logs list projects](struct.ProjectLogListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListLogsResponse { + /// If there might be more results than those appearing in this response, then nextPageToken is included. To get the next set of results, call this method again using the value of nextPageToken as pageToken. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// A list of log names. For example, "projects/my-project/syslog" or "organizations/123/cloudresourcemanager.googleapis.com%2Factivity". + #[serde(rename="logNames")] + pub log_names: Option>, +} + +impl ResponseResult for ListLogsResponse {} + + +/// Result returned from ListLogMetrics. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [metrics list projects](struct.ProjectMetricListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListLogMetricsResponse { + /// A list of logs-based metrics. + pub metrics: Option>, + /// If there might be more results than appear in this response, then nextPageToken is included. To get the next set of results, call this method again using the value of nextPageToken as pageToken. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, +} + +impl ResponseResult for ListLogMetricsResponse {} + + +/// An object representing a resource that can be used for monitoring, logging, billing, or other purposes. Examples include virtual machine instances, databases, and storage devices such as disks. The type field identifies a MonitoredResourceDescriptor object that describes the resource's schema. Information in the labels field identifies the actual resource and its attributes according to the schema. For example, a particular Compute Engine VM instance could be represented by the following object, because the MonitoredResourceDescriptor for "gce_instance" has labels "instance_id" and "zone": +/// { "type": "gce_instance", +/// "labels": { "instance_id": "12345678901234", +/// "zone": "us-central1-a" }} +/// +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct MonitoredResource { + /// Required. Values for all of the labels listed in the associated monitored resource descriptor. For example, Cloud SQL databases use the labels "database_id" and "zone". + pub labels: Option>, + /// Required. The monitored resource type. This field must match the type field of a MonitoredResourceDescriptor object. For example, the type of a Cloud SQL database is "cloudsql_database". + #[serde(rename="type")] + pub type_: Option, +} + +impl Part for MonitoredResource {} + + +/// Additional information about a potentially long-running operation with which a log entry is associated. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LogEntryOperation { + /// Optional. Set this to True if this is the last log entry in the operation. + pub last: Option, + /// Optional. An arbitrary operation identifier. Log entries with the same identifier are assumed to be part of the same operation. + pub id: Option, + /// Optional. An arbitrary producer identifier. The combination of id and producer must be globally unique. Examples for producer: "MyDivision.MyBigCompany.com", "github.com/MyProject/MyApplication". + pub producer: Option, + /// Optional. Set this to True if this is the first log entry in the operation. + pub first: Option, +} + +impl Part for LogEntryOperation {} + + +/// Describes a sink used to export log entries to one of the following destinations in any project: a Cloud Storage bucket, a BigQuery dataset, or a Cloud Pub/Sub topic. A logs filter controls which log entries are exported. The sink must be created within a project or organization. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [sinks update projects](struct.ProjectSinkUpdateCall.html) (request|response) +/// * [sinks get billing accounts](struct.BillingAccountSinkGetCall.html) (response) +/// * [sinks create billing accounts](struct.BillingAccountSinkCreateCall.html) (request|response) +/// * [sinks create folders](struct.FolderSinkCreateCall.html) (request|response) +/// * [sinks create organizations](struct.OrganizationSinkCreateCall.html) (request|response) +/// * [sinks update organizations](struct.OrganizationSinkUpdateCall.html) (request|response) +/// * [sinks update billing accounts](struct.BillingAccountSinkUpdateCall.html) (request|response) +/// * [sinks get organizations](struct.OrganizationSinkGetCall.html) (response) +/// * [sinks create projects](struct.ProjectSinkCreateCall.html) (request|response) +/// * [sinks update folders](struct.FolderSinkUpdateCall.html) (request|response) +/// * [sinks get projects](struct.ProjectSinkGetCall.html) (response) +/// * [sinks get folders](struct.FolderSinkGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LogSink { + /// Optional. An advanced logs filter. The only exported log entries are those that are in the resource owning the sink and that match the filter. The filter must use the log entry format specified by the output_version_format parameter. For example, in the v2 format: + /// logName="projects/[PROJECT_ID]/logs/[LOG_ID]" AND severity>=ERROR + /// + pub filter: Option, + /// Required. The export destination: + /// "storage.googleapis.com/[GCS_BUCKET]" + /// "bigquery.googleapis.com/projects/[PROJECT_ID]/datasets/[DATASET]" + /// "pubsub.googleapis.com/projects/[PROJECT_ID]/topics/[TOPIC_ID]" + /// The sink's writer_identity, set when the sink is created, must have permission to write to the destination or else the log entries are not exported. For more information, see Exporting Logs With Sinks. + pub destination: Option, + /// Required. The client-assigned sink identifier, unique within the project. Example: "my-syslog-errors-to-pubsub". Sink identifiers are limited to 100 characters and can include only the following characters: upper and lower-case alphanumeric characters, underscores, hyphens, and periods. + pub name: Option, + /// Optional. The time at which this sink will begin exporting log entries. Log entries are exported only if their timestamp is not earlier than the start time. The default value of this field is the time the sink is created or updated. + #[serde(rename="startTime")] + pub start_time: Option, + /// Optional. The log entry format to use for this sink's exported log entries. The v2 format is used by default. The v1 format is deprecated and should be used only as part of a migration effort to v2. See Migration to the v2 API. + #[serde(rename="outputVersionFormat")] + pub output_version_format: Option, + /// Output only. An IAM identity—a service account or group—under which Stackdriver Logging writes the exported log entries to the sink's destination. This field is set by sinks.create and sinks.update, based on the setting of unique_writer_identity in those methods.Until you grant this identity write-access to the destination, log entry exports from this sink will fail. For more information, see Granting access for a resource. Consult the destination service's documentation to determine the appropriate IAM roles to assign to the identity. + #[serde(rename="writerIdentity")] + pub writer_identity: Option, + /// Optional. The time at which this sink will stop exporting log entries. Log entries are exported only if their timestamp is earlier than the end time. If this field is not supplied, there is no end time. If both a start time and an end time are provided, then the end time must be later than the start time. + #[serde(rename="endTime")] + pub end_time: Option, +} + +impl RequestValue for LogSink {} +impl ResponseResult for LogSink {} + + +/// The parameters to ListLogEntries. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list entries](struct.EntryListCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListLogEntriesRequest { + /// Optional. How the results should be sorted. Presently, the only permitted values are "timestamp asc" (default) and "timestamp desc". The first option returns entries in order of increasing values of LogEntry.timestamp (oldest first), and the second option returns entries in order of decreasing timestamps (newest first). Entries with equal timestamps are returned in order of LogEntry.insertId. + #[serde(rename="orderBy")] + pub order_by: Option, + /// Required. Names of one or more resources from which to retrieve log entries: + /// "projects/[PROJECT_ID]" + /// "organizations/[ORGANIZATION_ID]" + /// Projects listed in the project_ids field are added to this list. + #[serde(rename="resourceNames")] + pub resource_names: Option>, + /// Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available. + #[serde(rename="pageSize")] + pub page_size: Option, + /// Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call. + #[serde(rename="pageToken")] + pub page_token: Option, + /// Deprecated. Use resource_names instead. One or more project identifiers or project numbers from which to retrieve log entries. Example: "my-project-1A". If present, these project identifiers are converted to resource name format and added to the list of resources in resource_names. + #[serde(rename="projectIds")] + pub project_ids: Option>, + /// Optional. A filter that chooses which log entries to return. See Advanced Logs Filters. Only log entries that match the filter are returned. An empty filter matches all log entries in the resources listed in resource_names. Referencing a parent resource that is not listed in resource_names will cause the filter to return no results. The maximum length of the filter is 20000 characters. + pub filter: Option, +} + +impl RequestValue for ListLogEntriesRequest {} + + +/// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: +/// service Foo { +/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); +/// } +/// The JSON representation for Empty is empty JSON object {}. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [logs delete organizations](struct.OrganizationLogDeleteCall.html) (response) +/// * [logs delete projects](struct.ProjectLogDeleteCall.html) (response) +/// * [sinks delete folders](struct.FolderSinkDeleteCall.html) (response) +/// * [sinks delete organizations](struct.OrganizationSinkDeleteCall.html) (response) +/// * [sinks delete billing accounts](struct.BillingAccountSinkDeleteCall.html) (response) +/// * [logs delete folders](struct.FolderLogDeleteCall.html) (response) +/// * [metrics delete projects](struct.ProjectMetricDeleteCall.html) (response) +/// * [sinks delete projects](struct.ProjectSinkDeleteCall.html) (response) +/// * [logs delete billing accounts](struct.BillingAccountLogDeleteCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Empty { _never_set: Option } + +impl ResponseResult for Empty {} + + +/// A common proto for logging HTTP requests. Only contains semantics defined by the HTTP specification. Product-specific logging information MUST be defined in a separate message. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct HttpRequest { + /// The response code indicating the status of response. Examples: 200, 404. + pub status: Option, + /// Whether or not the response was validated with the origin server before being served from cache. This field is only meaningful if cache_hit is True. + #[serde(rename="cacheValidatedWithOriginServer")] + pub cache_validated_with_origin_server: Option, + /// The request processing latency on the server, from the time the request was received until the response was sent. + pub latency: Option, + /// The number of HTTP response bytes inserted into cache. Set only when a cache fill was attempted. + #[serde(rename="cacheFillBytes")] + pub cache_fill_bytes: Option, + /// The scheme (http, https), the host name, the path and the query portion of the URL that was requested. Example: "http://example.com/some/info?color=red". + #[serde(rename="requestUrl")] + pub request_url: Option, + /// Whether or not an entity was served from cache (with or without validation). + #[serde(rename="cacheHit")] + pub cache_hit: Option, + /// The IP address (IPv4 or IPv6) of the origin server that the request was sent to. + #[serde(rename="serverIp")] + pub server_ip: Option, + /// Whether or not a cache lookup was attempted. + #[serde(rename="cacheLookup")] + pub cache_lookup: Option, + /// The request method. Examples: "GET", "HEAD", "PUT", "POST". + #[serde(rename="requestMethod")] + pub request_method: Option, + /// The referer URL of the request, as defined in HTTP/1.1 Header Field Definitions (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). + pub referer: Option, + /// The IP address (IPv4 or IPv6) of the client that issued the HTTP request. Examples: "192.168.1.1", "FE80::0202:B3FF:FE1E:8329". + #[serde(rename="remoteIp")] + pub remote_ip: Option, + /// The user agent sent by the client. Example: "Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET CLR 1.0.3705)". + #[serde(rename="userAgent")] + pub user_agent: Option, + /// The size of the HTTP request message in bytes, including the request headers and the request body. + #[serde(rename="requestSize")] + pub request_size: Option, + /// The size of the HTTP response message sent back to the client, in bytes, including the response headers and the response body. + #[serde(rename="responseSize")] + pub response_size: Option, +} + +impl Part for HttpRequest {} + + +/// Result returned from ListMonitoredResourceDescriptors. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list monitored resource descriptors](struct.MonitoredResourceDescriptorListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListMonitoredResourceDescriptorsResponse { + /// If there might be more results than those appearing in this response, then nextPageToken is included. To get the next set of results, call this method again using the value of nextPageToken as pageToken. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// A list of resource descriptors. + #[serde(rename="resourceDescriptors")] + pub resource_descriptors: Option>, +} + +impl ResponseResult for ListMonitoredResourceDescriptorsResponse {} + + +/// Result returned from ListSinks. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [sinks list projects](struct.ProjectSinkListCall.html) (response) +/// * [sinks list billing accounts](struct.BillingAccountSinkListCall.html) (response) +/// * [sinks list organizations](struct.OrganizationSinkListCall.html) (response) +/// * [sinks list folders](struct.FolderSinkListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListSinksResponse { + /// If there might be more results than appear in this response, then nextPageToken is included. To get the next set of results, call the same method again using the value of nextPageToken as pageToken. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// A list of sinks. + pub sinks: Option>, +} + +impl ResponseResult for ListSinksResponse {} + + +/// Result returned from WriteLogEntries. empty +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [write entries](struct.EntryWriteCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct WriteLogEntriesResponse { _never_set: Option } + +impl ResponseResult for WriteLogEntriesResponse {} + + +/// The parameters to WriteLogEntries. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [write entries](struct.EntryWriteCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct WriteLogEntriesRequest { + /// Optional. A default log resource name that is assigned to all log entries in entries that do not specify a value for log_name: + /// "projects/[PROJECT_ID]/logs/[LOG_ID]" + /// "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" + /// [LOG_ID] must be URL-encoded. For example, "projects/my-project-id/logs/syslog" or "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity". For more information about log names, see LogEntry. + #[serde(rename="logName")] + pub log_name: Option, + /// Optional. Whether valid entries should be written even if some other entries fail due to INVALID_ARGUMENT or PERMISSION_DENIED errors. If any entry is not written, the response status will be the error associated with one of the failed entries and include error details in the form of WriteLogEntriesPartialErrors. + #[serde(rename="partialSuccess")] + pub partial_success: Option, + /// Optional. Default labels that are added to the labels field of all log entries in entries. If a log entry already has a label with the same key as a label in this parameter, then the log entry's label is not changed. See LogEntry. + pub labels: Option>, + /// Optional. A default monitored resource object that is assigned to all log entries in entries that do not specify a value for resource. Example: + /// { "type": "gce_instance", + /// "labels": { + /// "zone": "us-central1-a", "instance_id": "00000000000000000000" }} + /// See LogEntry. + pub resource: Option, + /// Required. The log entries to write. Values supplied for the fields log_name, resource, and labels in this entries.write request are added to those log entries that do not provide their own values for the fields.To improve throughput and to avoid exceeding the quota limit for calls to entries.write, you should write multiple log entries at once rather than calling this method for each individual log entry. + pub entries: Option>, +} + +impl RequestValue for WriteLogEntriesRequest {} + + +/// A description of a label. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LabelDescriptor { + /// The type of data that can be assigned to the label. + #[serde(rename="valueType")] + pub value_type: Option, + /// A human-readable description for the label. + pub description: Option, + /// The label key. + pub key: Option, +} + +impl Part for LabelDescriptor {} + + +/// An individual entry in a log. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LogEntry { + /// Optional. Information about the HTTP request associated with this log entry, if applicable. + #[serde(rename="httpRequest")] + pub http_request: Option, + /// Required. The monitored resource associated with this log entry. Example: a log entry that reports a database error would be associated with the monitored resource designating the particular database that reported the error. + pub resource: Option, + /// The log entry payload, represented as a Unicode string (UTF-8). + #[serde(rename="textPayload")] + pub text_payload: Option, + /// Optional. Resource name of the trace associated with the log entry, if any. If it contains a relative resource name, the name is assumed to be relative to //tracing.googleapis.com. Example: projects/my-projectid/traces/06796866738c859f2f19b7cfb3214824 + pub trace: Option, + /// Optional. The time the event described by the log entry occurred. If omitted, Stackdriver Logging will use the time the log entry is received. + pub timestamp: Option, + /// Optional. A set of user-defined (key, value) data that provides additional information about the log entry. + pub labels: Option>, + /// The log entry payload, represented as a protocol buffer. Some Google Cloud Platform services use this field for their log entry payloads. + #[serde(rename="protoPayload")] + pub proto_payload: Option>, + /// The log entry payload, represented as a structure that is expressed as a JSON object. + #[serde(rename="jsonPayload")] + pub json_payload: Option>, + /// Required. The resource name of the log to which this log entry belongs: + /// "projects/[PROJECT_ID]/logs/[LOG_ID]" + /// "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" + /// [LOG_ID] must be URL-encoded within log_name. Example: "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity". [LOG_ID] must be less than 512 characters long and can only include the following characters: upper and lower case alphanumeric characters, forward-slash, underscore, hyphen, and period.For backward compatibility, if log_name begins with a forward-slash, such as /projects/..., then the log entry is ingested as usual but the forward-slash is removed. Listing the log entry will not show the leading slash and filtering for a log name with a leading slash will never return any results. + #[serde(rename="logName")] + pub log_name: Option, + /// Optional. A unique ID for the log entry. If you provide this field, the logging service considers other log entries in the same project with the same ID as duplicates which can be removed. If omitted, Stackdriver Logging will generate a unique ID for this log entry. + #[serde(rename="insertId")] + pub insert_id: Option, + /// Optional. Information about an operation associated with the log entry, if applicable. + pub operation: Option, + /// Optional. Source code location information associated with the log entry, if any. + #[serde(rename="sourceLocation")] + pub source_location: Option, + /// Optional. The severity of the log entry. The default value is LogSeverity.DEFAULT. + pub severity: Option, +} + +impl Part for LogEntry {} + + +/// Describes a logs-based metric. The value of the metric is the number of log entries that match a logs filter in a given time interval. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [metrics create projects](struct.ProjectMetricCreateCall.html) (request|response) +/// * [metrics get projects](struct.ProjectMetricGetCall.html) (response) +/// * [metrics update projects](struct.ProjectMetricUpdateCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LogMetric { + /// Required. An advanced logs filter which is used to match log entries. Example: + /// "resource.type=gae_app AND severity>=ERROR" + /// The maximum length of the filter is 20000 characters. + pub filter: Option, + /// Output only. The API version that created or updated this metric. The version also dictates the syntax of the filter expression. When a value for this field is missing, the default value of V2 should be assumed. + pub version: Option, + /// Optional. A description of this metric, which is used in documentation. + pub description: Option, + /// Required. The client-assigned metric identifier. Examples: "error_count", "nginx/requests".Metric identifiers are limited to 100 characters and can include only the following characters: A-Z, a-z, 0-9, and the special characters _-.,+!*',()%/. The forward-slash character (/) denotes a hierarchy of name pieces, and it cannot be the first character of the name.The metric identifier in this field must not be URL-encoded (https://en.wikipedia.org/wiki/Percent-encoding). However, when the metric identifier appears as the [METRIC_ID] part of a metric_name API parameter, then the metric identifier must be URL-encoded. Example: "projects/my-project/metrics/nginx%2Frequests". + pub name: Option, +} + +impl RequestValue for LogMetric {} +impl ResponseResult for LogMetric {} + + +/// An object that describes the schema of a MonitoredResource object using a type name and a set of labels. For example, the monitored resource descriptor for Google Compute Engine VM instances has a type of "gce_instance" and specifies the use of the labels "instance_id" and "zone" to identify particular VM instances.Different APIs can support different monitored resource types. APIs generally provide a list method that returns the monitored resource descriptors used by the API. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list monitored resource descriptors](struct.MonitoredResourceDescriptorListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct MonitoredResourceDescriptor { + /// Optional. A concise name for the monitored resource type that might be displayed in user interfaces. It should be a Title Cased Noun Phrase, without any article or other determiners. For example, "Google Cloud SQL Database". + #[serde(rename="displayName")] + pub display_name: Option, + /// Required. A set of labels used to describe instances of this monitored resource type. For example, an individual Google Cloud SQL database is identified by values for the labels "database_id" and "zone". + pub labels: Option>, + /// Required. The monitored resource type. For example, the type "cloudsql_database" represents databases in Google Cloud SQL. The maximum length of this value is 256 characters. + #[serde(rename="type")] + pub type_: Option, + /// Optional. A detailed description of the monitored resource type that might be used in documentation. + pub description: Option, + /// Optional. The resource name of the monitored resource descriptor: "projects/{project_id}/monitoredResourceDescriptors/{type}" where {type} is the value of the type field in this object and {project_id} is a project ID that provides API-specific context for accessing the type. APIs that do not use project information can use the resource name format "monitoredResourceDescriptors/{type}". + pub name: Option, +} + +impl Resource for MonitoredResourceDescriptor {} + + + +// ################### +// MethodBuilders ### +// ################# + +/// A builder providing access to all methods supported on *folder* resources. +/// It is not used directly, but through the `Logging` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_logging2 as logging2; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use logging2::Logging; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Logging::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `logs_delete(...)`, `logs_list(...)`, `sinks_create(...)`, `sinks_delete(...)`, `sinks_get(...)`, `sinks_list(...)` and `sinks_update(...)` +/// // to build up your call. +/// let rb = hub.folders(); +/// # } +/// ``` +pub struct FolderMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, +} + +impl<'a, C, A> MethodsBuilder for FolderMethods<'a, C, A> {} + +impl<'a, C, A> FolderMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Lists sinks. + /// + /// # Arguments + /// + /// * `parent` - Required. The parent resource whose sinks are to be listed. Examples: "projects/my-logging-project", "organizations/123456789". + pub fn sinks_list(&self, parent: &str) -> FolderSinkListCall<'a, C, A> { + FolderSinkListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates a sink. If the named sink doesn't exist, then this method is identical to sinks.create. If the named sink does exist, then this method replaces the following fields in the existing sink with values from the new sink: destination, filter, output_version_format, start_time, and end_time. The updated filter might also have a new writer_identity; see the unique_writer_identity field. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `sinkName` - Required. The full resource name of the sink to update, including the parent resource and the sink identifier: + /// "projects/[PROJECT_ID]/sinks/[SINK_ID]" + /// "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + /// Example: "projects/my-project-id/sinks/my-sink-id". + pub fn sinks_update(&self, request: LogSink, sink_name: &str) -> FolderSinkUpdateCall<'a, C, A> { + FolderSinkUpdateCall { + hub: self.hub, + _request: request, + _sink_name: sink_name.to_string(), + _unique_writer_identity: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets a sink. + /// + /// # Arguments + /// + /// * `sinkName` - Required. The parent resource name of the sink: + /// "projects/[PROJECT_ID]/sinks/[SINK_ID]" + /// "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + /// Example: "projects/my-project-id/sinks/my-sink-id". + pub fn sinks_get(&self, sink_name: &str) -> FolderSinkGetCall<'a, C, A> { + FolderSinkGetCall { + hub: self.hub, + _sink_name: sink_name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a sink that exports specified log entries to a destination. The export of newly-ingested log entries begins immediately, unless the current time is outside the sink's start and end times or the sink's writer_identity is not permitted to write to the destination. A sink can export log entries only from the resource owning the sink. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - Required. The resource in which to create the sink: + /// "projects/[PROJECT_ID]" + /// "organizations/[ORGANIZATION_ID]" + /// Examples: "projects/my-logging-project", "organizations/123456789". + pub fn sinks_create(&self, request: LogSink, parent: &str) -> FolderSinkCreateCall<'a, C, A> { + FolderSinkCreateCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _unique_writer_identity: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted. + /// + /// # Arguments + /// + /// * `sinkName` - Required. The full resource name of the sink to delete, including the parent resource and the sink identifier: + /// "projects/[PROJECT_ID]/sinks/[SINK_ID]" + /// "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + /// It is an error if the sink does not exist. Example: "projects/my-project-id/sinks/my-sink-id". It is an error if the sink does not exist. + pub fn sinks_delete(&self, sink_name: &str) -> FolderSinkDeleteCall<'a, C, A> { + FolderSinkDeleteCall { + hub: self.hub, + _sink_name: sink_name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists the logs in projects or organizations. Only logs that have entries are listed. + /// + /// # Arguments + /// + /// * `parent` - Required. The resource name that owns the logs: + /// "projects/[PROJECT_ID]" + /// "organizations/[ORGANIZATION_ID]" + /// + pub fn logs_list(&self, parent: &str) -> FolderLogListCall<'a, C, A> { + FolderLogListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes all the log entries in a log. The log reappears if it receives new entries. + /// + /// # Arguments + /// + /// * `logName` - Required. The resource name of the log to delete: + /// "projects/[PROJECT_ID]/logs/[LOG_ID]" + /// "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" + /// [LOG_ID] must be URL-encoded. For example, "projects/my-project-id/logs/syslog", "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity". For more information about log names, see LogEntry. + pub fn logs_delete(&self, log_name: &str) -> FolderLogDeleteCall<'a, C, A> { + FolderLogDeleteCall { + hub: self.hub, + _log_name: log_name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *organization* resources. +/// It is not used directly, but through the `Logging` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_logging2 as logging2; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use logging2::Logging; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Logging::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `logs_delete(...)`, `logs_list(...)`, `sinks_create(...)`, `sinks_delete(...)`, `sinks_get(...)`, `sinks_list(...)` and `sinks_update(...)` +/// // to build up your call. +/// let rb = hub.organizations(); +/// # } +/// ``` +pub struct OrganizationMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, +} + +impl<'a, C, A> MethodsBuilder for OrganizationMethods<'a, C, A> {} + +impl<'a, C, A> OrganizationMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Lists the logs in projects or organizations. Only logs that have entries are listed. + /// + /// # Arguments + /// + /// * `parent` - Required. The resource name that owns the logs: + /// "projects/[PROJECT_ID]" + /// "organizations/[ORGANIZATION_ID]" + /// + pub fn logs_list(&self, parent: &str) -> OrganizationLogListCall<'a, C, A> { + OrganizationLogListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes all the log entries in a log. The log reappears if it receives new entries. + /// + /// # Arguments + /// + /// * `logName` - Required. The resource name of the log to delete: + /// "projects/[PROJECT_ID]/logs/[LOG_ID]" + /// "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" + /// [LOG_ID] must be URL-encoded. For example, "projects/my-project-id/logs/syslog", "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity". For more information about log names, see LogEntry. + pub fn logs_delete(&self, log_name: &str) -> OrganizationLogDeleteCall<'a, C, A> { + OrganizationLogDeleteCall { + hub: self.hub, + _log_name: log_name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates a sink. If the named sink doesn't exist, then this method is identical to sinks.create. If the named sink does exist, then this method replaces the following fields in the existing sink with values from the new sink: destination, filter, output_version_format, start_time, and end_time. The updated filter might also have a new writer_identity; see the unique_writer_identity field. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `sinkName` - Required. The full resource name of the sink to update, including the parent resource and the sink identifier: + /// "projects/[PROJECT_ID]/sinks/[SINK_ID]" + /// "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + /// Example: "projects/my-project-id/sinks/my-sink-id". + pub fn sinks_update(&self, request: LogSink, sink_name: &str) -> OrganizationSinkUpdateCall<'a, C, A> { + OrganizationSinkUpdateCall { + hub: self.hub, + _request: request, + _sink_name: sink_name.to_string(), + _unique_writer_identity: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets a sink. + /// + /// # Arguments + /// + /// * `sinkName` - Required. The parent resource name of the sink: + /// "projects/[PROJECT_ID]/sinks/[SINK_ID]" + /// "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + /// Example: "projects/my-project-id/sinks/my-sink-id". + pub fn sinks_get(&self, sink_name: &str) -> OrganizationSinkGetCall<'a, C, A> { + OrganizationSinkGetCall { + hub: self.hub, + _sink_name: sink_name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists sinks. + /// + /// # Arguments + /// + /// * `parent` - Required. The parent resource whose sinks are to be listed. Examples: "projects/my-logging-project", "organizations/123456789". + pub fn sinks_list(&self, parent: &str) -> OrganizationSinkListCall<'a, C, A> { + OrganizationSinkListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted. + /// + /// # Arguments + /// + /// * `sinkName` - Required. The full resource name of the sink to delete, including the parent resource and the sink identifier: + /// "projects/[PROJECT_ID]/sinks/[SINK_ID]" + /// "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + /// It is an error if the sink does not exist. Example: "projects/my-project-id/sinks/my-sink-id". It is an error if the sink does not exist. + pub fn sinks_delete(&self, sink_name: &str) -> OrganizationSinkDeleteCall<'a, C, A> { + OrganizationSinkDeleteCall { + hub: self.hub, + _sink_name: sink_name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a sink that exports specified log entries to a destination. The export of newly-ingested log entries begins immediately, unless the current time is outside the sink's start and end times or the sink's writer_identity is not permitted to write to the destination. A sink can export log entries only from the resource owning the sink. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - Required. The resource in which to create the sink: + /// "projects/[PROJECT_ID]" + /// "organizations/[ORGANIZATION_ID]" + /// Examples: "projects/my-logging-project", "organizations/123456789". + pub fn sinks_create(&self, request: LogSink, parent: &str) -> OrganizationSinkCreateCall<'a, C, A> { + OrganizationSinkCreateCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _unique_writer_identity: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *entry* resources. +/// It is not used directly, but through the `Logging` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_logging2 as logging2; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use logging2::Logging; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Logging::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `list(...)` and `write(...)` +/// // to build up your call. +/// let rb = hub.entries(); +/// # } +/// ``` +pub struct EntryMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, +} + +impl<'a, C, A> MethodsBuilder for EntryMethods<'a, C, A> {} + +impl<'a, C, A> EntryMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Writes log entries to Stackdriver Logging. All log entries are written by this method. + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn write(&self, request: WriteLogEntriesRequest) -> EntryWriteCall<'a, C, A> { + EntryWriteCall { + hub: self.hub, + _request: request, + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists log entries. Use this method to retrieve log entries from Stackdriver Logging. For ways to export log entries, see Exporting Logs. + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn list(&self, request: ListLogEntriesRequest) -> EntryListCall<'a, C, A> { + EntryListCall { + hub: self.hub, + _request: request, + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *billingAccount* resources. +/// It is not used directly, but through the `Logging` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_logging2 as logging2; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use logging2::Logging; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Logging::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `logs_delete(...)`, `logs_list(...)`, `sinks_create(...)`, `sinks_delete(...)`, `sinks_get(...)`, `sinks_list(...)` and `sinks_update(...)` +/// // to build up your call. +/// let rb = hub.billing_accounts(); +/// # } +/// ``` +pub struct BillingAccountMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, +} + +impl<'a, C, A> MethodsBuilder for BillingAccountMethods<'a, C, A> {} + +impl<'a, C, A> BillingAccountMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Creates a sink that exports specified log entries to a destination. The export of newly-ingested log entries begins immediately, unless the current time is outside the sink's start and end times or the sink's writer_identity is not permitted to write to the destination. A sink can export log entries only from the resource owning the sink. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - Required. The resource in which to create the sink: + /// "projects/[PROJECT_ID]" + /// "organizations/[ORGANIZATION_ID]" + /// Examples: "projects/my-logging-project", "organizations/123456789". + pub fn sinks_create(&self, request: LogSink, parent: &str) -> BillingAccountSinkCreateCall<'a, C, A> { + BillingAccountSinkCreateCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _unique_writer_identity: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists the logs in projects or organizations. Only logs that have entries are listed. + /// + /// # Arguments + /// + /// * `parent` - Required. The resource name that owns the logs: + /// "projects/[PROJECT_ID]" + /// "organizations/[ORGANIZATION_ID]" + /// + pub fn logs_list(&self, parent: &str) -> BillingAccountLogListCall<'a, C, A> { + BillingAccountLogListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists sinks. + /// + /// # Arguments + /// + /// * `parent` - Required. The parent resource whose sinks are to be listed. Examples: "projects/my-logging-project", "organizations/123456789". + pub fn sinks_list(&self, parent: &str) -> BillingAccountSinkListCall<'a, C, A> { + BillingAccountSinkListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted. + /// + /// # Arguments + /// + /// * `sinkName` - Required. The full resource name of the sink to delete, including the parent resource and the sink identifier: + /// "projects/[PROJECT_ID]/sinks/[SINK_ID]" + /// "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + /// It is an error if the sink does not exist. Example: "projects/my-project-id/sinks/my-sink-id". It is an error if the sink does not exist. + pub fn sinks_delete(&self, sink_name: &str) -> BillingAccountSinkDeleteCall<'a, C, A> { + BillingAccountSinkDeleteCall { + hub: self.hub, + _sink_name: sink_name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets a sink. + /// + /// # Arguments + /// + /// * `sinkName` - Required. The parent resource name of the sink: + /// "projects/[PROJECT_ID]/sinks/[SINK_ID]" + /// "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + /// Example: "projects/my-project-id/sinks/my-sink-id". + pub fn sinks_get(&self, sink_name: &str) -> BillingAccountSinkGetCall<'a, C, A> { + BillingAccountSinkGetCall { + hub: self.hub, + _sink_name: sink_name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates a sink. If the named sink doesn't exist, then this method is identical to sinks.create. If the named sink does exist, then this method replaces the following fields in the existing sink with values from the new sink: destination, filter, output_version_format, start_time, and end_time. The updated filter might also have a new writer_identity; see the unique_writer_identity field. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `sinkName` - Required. The full resource name of the sink to update, including the parent resource and the sink identifier: + /// "projects/[PROJECT_ID]/sinks/[SINK_ID]" + /// "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + /// Example: "projects/my-project-id/sinks/my-sink-id". + pub fn sinks_update(&self, request: LogSink, sink_name: &str) -> BillingAccountSinkUpdateCall<'a, C, A> { + BillingAccountSinkUpdateCall { + hub: self.hub, + _request: request, + _sink_name: sink_name.to_string(), + _unique_writer_identity: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes all the log entries in a log. The log reappears if it receives new entries. + /// + /// # Arguments + /// + /// * `logName` - Required. The resource name of the log to delete: + /// "projects/[PROJECT_ID]/logs/[LOG_ID]" + /// "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" + /// [LOG_ID] must be URL-encoded. For example, "projects/my-project-id/logs/syslog", "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity". For more information about log names, see LogEntry. + pub fn logs_delete(&self, log_name: &str) -> BillingAccountLogDeleteCall<'a, C, A> { + BillingAccountLogDeleteCall { + hub: self.hub, + _log_name: log_name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *monitoredResourceDescriptor* resources. +/// It is not used directly, but through the `Logging` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_logging2 as logging2; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use logging2::Logging; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Logging::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `list(...)` +/// // to build up your call. +/// let rb = hub.monitored_resource_descriptors(); +/// # } +/// ``` +pub struct MonitoredResourceDescriptorMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, +} + +impl<'a, C, A> MethodsBuilder for MonitoredResourceDescriptorMethods<'a, C, A> {} + +impl<'a, C, A> MonitoredResourceDescriptorMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Lists the descriptors for monitored resource types used by Stackdriver Logging. + pub fn list(&self) -> MonitoredResourceDescriptorListCall<'a, C, A> { + MonitoredResourceDescriptorListCall { + hub: self.hub, + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *project* resources. +/// It is not used directly, but through the `Logging` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_logging2 as logging2; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use logging2::Logging; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Logging::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `logs_delete(...)`, `logs_list(...)`, `metrics_create(...)`, `metrics_delete(...)`, `metrics_get(...)`, `metrics_list(...)`, `metrics_update(...)`, `sinks_create(...)`, `sinks_delete(...)`, `sinks_get(...)`, `sinks_list(...)` and `sinks_update(...)` +/// // to build up your call. +/// let rb = hub.projects(); +/// # } +/// ``` +pub struct ProjectMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, +} + +impl<'a, C, A> MethodsBuilder for ProjectMethods<'a, C, A> {} + +impl<'a, C, A> ProjectMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Deletes all the log entries in a log. The log reappears if it receives new entries. + /// + /// # Arguments + /// + /// * `logName` - Required. The resource name of the log to delete: + /// "projects/[PROJECT_ID]/logs/[LOG_ID]" + /// "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" + /// [LOG_ID] must be URL-encoded. For example, "projects/my-project-id/logs/syslog", "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity". For more information about log names, see LogEntry. + pub fn logs_delete(&self, log_name: &str) -> ProjectLogDeleteCall<'a, C, A> { + ProjectLogDeleteCall { + hub: self.hub, + _log_name: log_name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets a logs-based metric. + /// + /// # Arguments + /// + /// * `metricName` - The resource name of the desired metric: + /// "projects/[PROJECT_ID]/metrics/[METRIC_ID]" + /// + pub fn metrics_get(&self, metric_name: &str) -> ProjectMetricGetCall<'a, C, A> { + ProjectMetricGetCall { + hub: self.hub, + _metric_name: metric_name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists the logs in projects or organizations. Only logs that have entries are listed. + /// + /// # Arguments + /// + /// * `parent` - Required. The resource name that owns the logs: + /// "projects/[PROJECT_ID]" + /// "organizations/[ORGANIZATION_ID]" + /// + pub fn logs_list(&self, parent: &str) -> ProjectLogListCall<'a, C, A> { + ProjectLogListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a logs-based metric. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - The resource name of the project in which to create the metric: + /// "projects/[PROJECT_ID]" + /// The new metric must be provided in the request. + pub fn metrics_create(&self, request: LogMetric, parent: &str) -> ProjectMetricCreateCall<'a, C, A> { + ProjectMetricCreateCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists logs-based metrics. + /// + /// # Arguments + /// + /// * `parent` - Required. The name of the project containing the metrics: + /// "projects/[PROJECT_ID]" + /// + pub fn metrics_list(&self, parent: &str) -> ProjectMetricListCall<'a, C, A> { + ProjectMetricListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates a sink. If the named sink doesn't exist, then this method is identical to sinks.create. If the named sink does exist, then this method replaces the following fields in the existing sink with values from the new sink: destination, filter, output_version_format, start_time, and end_time. The updated filter might also have a new writer_identity; see the unique_writer_identity field. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `sinkName` - Required. The full resource name of the sink to update, including the parent resource and the sink identifier: + /// "projects/[PROJECT_ID]/sinks/[SINK_ID]" + /// "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + /// Example: "projects/my-project-id/sinks/my-sink-id". + pub fn sinks_update(&self, request: LogSink, sink_name: &str) -> ProjectSinkUpdateCall<'a, C, A> { + ProjectSinkUpdateCall { + hub: self.hub, + _request: request, + _sink_name: sink_name.to_string(), + _unique_writer_identity: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists sinks. + /// + /// # Arguments + /// + /// * `parent` - Required. The parent resource whose sinks are to be listed. Examples: "projects/my-logging-project", "organizations/123456789". + pub fn sinks_list(&self, parent: &str) -> ProjectSinkListCall<'a, C, A> { + ProjectSinkListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets a sink. + /// + /// # Arguments + /// + /// * `sinkName` - Required. The parent resource name of the sink: + /// "projects/[PROJECT_ID]/sinks/[SINK_ID]" + /// "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + /// Example: "projects/my-project-id/sinks/my-sink-id". + pub fn sinks_get(&self, sink_name: &str) -> ProjectSinkGetCall<'a, C, A> { + ProjectSinkGetCall { + hub: self.hub, + _sink_name: sink_name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted. + /// + /// # Arguments + /// + /// * `sinkName` - Required. The full resource name of the sink to delete, including the parent resource and the sink identifier: + /// "projects/[PROJECT_ID]/sinks/[SINK_ID]" + /// "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + /// It is an error if the sink does not exist. Example: "projects/my-project-id/sinks/my-sink-id". It is an error if the sink does not exist. + pub fn sinks_delete(&self, sink_name: &str) -> ProjectSinkDeleteCall<'a, C, A> { + ProjectSinkDeleteCall { + hub: self.hub, + _sink_name: sink_name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a sink that exports specified log entries to a destination. The export of newly-ingested log entries begins immediately, unless the current time is outside the sink's start and end times or the sink's writer_identity is not permitted to write to the destination. A sink can export log entries only from the resource owning the sink. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - Required. The resource in which to create the sink: + /// "projects/[PROJECT_ID]" + /// "organizations/[ORGANIZATION_ID]" + /// Examples: "projects/my-logging-project", "organizations/123456789". + pub fn sinks_create(&self, request: LogSink, parent: &str) -> ProjectSinkCreateCall<'a, C, A> { + ProjectSinkCreateCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _unique_writer_identity: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates or updates a logs-based metric. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `metricName` - The resource name of the metric to update: + /// "projects/[PROJECT_ID]/metrics/[METRIC_ID]" + /// The updated metric must be provided in the request and it's name field must be the same as [METRIC_ID] If the metric does not exist in [PROJECT_ID], then a new metric is created. + pub fn metrics_update(&self, request: LogMetric, metric_name: &str) -> ProjectMetricUpdateCall<'a, C, A> { + ProjectMetricUpdateCall { + hub: self.hub, + _request: request, + _metric_name: metric_name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a logs-based metric. + /// + /// # Arguments + /// + /// * `metricName` - The resource name of the metric to delete: + /// "projects/[PROJECT_ID]/metrics/[METRIC_ID]" + /// + pub fn metrics_delete(&self, metric_name: &str) -> ProjectMetricDeleteCall<'a, C, A> { + ProjectMetricDeleteCall { + hub: self.hub, + _metric_name: metric_name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + + + +// ################### +// CallBuilders ### +// ################# + +/// Lists sinks. +/// +/// A builder for the *sinks.list* method supported by a *folder* resource. +/// It is not used directly, but through a `FolderMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2 as logging2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.folders().sinks_list("parent") +/// .page_token("dolores") +/// .page_size(-63) +/// .doit(); +/// # } +/// ``` +pub struct FolderSinkListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _parent: String, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FolderSinkListCall<'a, C, A> {} + +impl<'a, C, A> FolderSinkListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListSinksResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.folders.sinks.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2/{+parent}/sinks".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The parent resource whose sinks are to be listed. Examples: "projects/my-logging-project", "organizations/123456789". + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> FolderSinkListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> FolderSinkListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> FolderSinkListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FolderSinkListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> FolderSinkListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FolderSinkListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates a sink. If the named sink doesn't exist, then this method is identical to sinks.create. If the named sink does exist, then this method replaces the following fields in the existing sink with values from the new sink: destination, filter, output_version_format, start_time, and end_time. The updated filter might also have a new writer_identity; see the unique_writer_identity field. +/// +/// A builder for the *sinks.update* method supported by a *folder* resource. +/// It is not used directly, but through a `FolderMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2 as logging2; +/// use logging2::LogSink; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = LogSink::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.folders().sinks_update(req, "sinkName") +/// .unique_writer_identity(true) +/// .doit(); +/// # } +/// ``` +pub struct FolderSinkUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _request: LogSink, + _sink_name: String, + _unique_writer_identity: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FolderSinkUpdateCall<'a, C, A> {} + +impl<'a, C, A> FolderSinkUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LogSink)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.folders.sinks.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("sinkName", self._sink_name.to_string())); + if let Some(value) = self._unique_writer_identity { + params.push(("uniqueWriterIdentity", value.to_string())); + } + for &field in ["alt", "sinkName", "uniqueWriterIdentity"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2/{+sinkName}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+sinkName}", "sinkName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["sinkName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: LogSink) -> FolderSinkUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. The full resource name of the sink to update, including the parent resource and the sink identifier: + /// "projects/[PROJECT_ID]/sinks/[SINK_ID]" + /// "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + /// Example: "projects/my-project-id/sinks/my-sink-id". + /// + /// Sets the *sink name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn sink_name(mut self, new_value: &str) -> FolderSinkUpdateCall<'a, C, A> { + self._sink_name = new_value.to_string(); + self + } + /// Optional. See sinks.create for a description of this field. When updating a sink, the effect of this field on the value of writer_identity in the updated sink depends on both the old and new values of this field: + /// If the old and new values of this field are both false or both true, then there is no change to the sink's writer_identity. + /// If the old value was false and the new value is true, then writer_identity is changed to a unique service account. + /// It is an error if the old value was true and the new value is false. + /// + /// Sets the *unique writer identity* query property to the given value. + pub fn unique_writer_identity(mut self, new_value: bool) -> FolderSinkUpdateCall<'a, C, A> { + self._unique_writer_identity = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FolderSinkUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> FolderSinkUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FolderSinkUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets a sink. +/// +/// A builder for the *sinks.get* method supported by a *folder* resource. +/// It is not used directly, but through a `FolderMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2 as logging2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.folders().sinks_get("sinkName") +/// .doit(); +/// # } +/// ``` +pub struct FolderSinkGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _sink_name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FolderSinkGetCall<'a, C, A> {} + +impl<'a, C, A> FolderSinkGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LogSink)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.folders.sinks.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("sinkName", self._sink_name.to_string())); + for &field in ["alt", "sinkName"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2/{+sinkName}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+sinkName}", "sinkName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["sinkName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The parent resource name of the sink: + /// "projects/[PROJECT_ID]/sinks/[SINK_ID]" + /// "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + /// Example: "projects/my-project-id/sinks/my-sink-id". + /// + /// Sets the *sink name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn sink_name(mut self, new_value: &str) -> FolderSinkGetCall<'a, C, A> { + self._sink_name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FolderSinkGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> FolderSinkGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FolderSinkGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Creates a sink that exports specified log entries to a destination. The export of newly-ingested log entries begins immediately, unless the current time is outside the sink's start and end times or the sink's writer_identity is not permitted to write to the destination. A sink can export log entries only from the resource owning the sink. +/// +/// A builder for the *sinks.create* method supported by a *folder* resource. +/// It is not used directly, but through a `FolderMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2 as logging2; +/// use logging2::LogSink; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = LogSink::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.folders().sinks_create(req, "parent") +/// .unique_writer_identity(false) +/// .doit(); +/// # } +/// ``` +pub struct FolderSinkCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _request: LogSink, + _parent: String, + _unique_writer_identity: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FolderSinkCreateCall<'a, C, A> {} + +impl<'a, C, A> FolderSinkCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LogSink)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.folders.sinks.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._unique_writer_identity { + params.push(("uniqueWriterIdentity", value.to_string())); + } + for &field in ["alt", "parent", "uniqueWriterIdentity"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2/{+parent}/sinks".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: LogSink) -> FolderSinkCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. The resource in which to create the sink: + /// "projects/[PROJECT_ID]" + /// "organizations/[ORGANIZATION_ID]" + /// Examples: "projects/my-logging-project", "organizations/123456789". + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> FolderSinkCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Optional. Determines the kind of IAM identity returned as writer_identity in the new sink. If this value is omitted or set to false, and if the sink's parent is a project, then the value returned as writer_identity is cloud-logs@google.com, the same identity used before the addition of writer identities to this API. The sink's destination must be in the same project as the sink itself.If this field is set to true, or if the sink is owned by a non-project resource such as an organization, then the value of writer_identity will be a unique service account used only for exports from the new sink. For more information, see writer_identity in LogSink. + /// + /// Sets the *unique writer identity* query property to the given value. + pub fn unique_writer_identity(mut self, new_value: bool) -> FolderSinkCreateCall<'a, C, A> { + self._unique_writer_identity = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FolderSinkCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> FolderSinkCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FolderSinkCreateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted. +/// +/// A builder for the *sinks.delete* method supported by a *folder* resource. +/// It is not used directly, but through a `FolderMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2 as logging2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.folders().sinks_delete("sinkName") +/// .doit(); +/// # } +/// ``` +pub struct FolderSinkDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _sink_name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FolderSinkDeleteCall<'a, C, A> {} + +impl<'a, C, A> FolderSinkDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.folders.sinks.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("sinkName", self._sink_name.to_string())); + for &field in ["alt", "sinkName"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2/{+sinkName}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+sinkName}", "sinkName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["sinkName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The full resource name of the sink to delete, including the parent resource and the sink identifier: + /// "projects/[PROJECT_ID]/sinks/[SINK_ID]" + /// "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + /// It is an error if the sink does not exist. Example: "projects/my-project-id/sinks/my-sink-id". It is an error if the sink does not exist. + /// + /// Sets the *sink name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn sink_name(mut self, new_value: &str) -> FolderSinkDeleteCall<'a, C, A> { + self._sink_name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FolderSinkDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> FolderSinkDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FolderSinkDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Lists the logs in projects or organizations. Only logs that have entries are listed. +/// +/// A builder for the *logs.list* method supported by a *folder* resource. +/// It is not used directly, but through a `FolderMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2 as logging2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.folders().logs_list("parent") +/// .page_token("nonumy") +/// .page_size(-19) +/// .doit(); +/// # } +/// ``` +pub struct FolderLogListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _parent: String, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FolderLogListCall<'a, C, A> {} + +impl<'a, C, A> FolderLogListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListLogsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.folders.logs.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2/{+parent}/logs".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The resource name that owns the logs: + /// "projects/[PROJECT_ID]" + /// "organizations/[ORGANIZATION_ID]" + /// + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> FolderLogListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> FolderLogListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> FolderLogListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FolderLogListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> FolderLogListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FolderLogListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes all the log entries in a log. The log reappears if it receives new entries. +/// +/// A builder for the *logs.delete* method supported by a *folder* resource. +/// It is not used directly, but through a `FolderMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2 as logging2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.folders().logs_delete("logName") +/// .doit(); +/// # } +/// ``` +pub struct FolderLogDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _log_name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FolderLogDeleteCall<'a, C, A> {} + +impl<'a, C, A> FolderLogDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.folders.logs.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("logName", self._log_name.to_string())); + for &field in ["alt", "logName"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2/{+logName}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+logName}", "logName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["logName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The resource name of the log to delete: + /// "projects/[PROJECT_ID]/logs/[LOG_ID]" + /// "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" + /// [LOG_ID] must be URL-encoded. For example, "projects/my-project-id/logs/syslog", "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity". For more information about log names, see LogEntry. + /// + /// Sets the *log name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn log_name(mut self, new_value: &str) -> FolderLogDeleteCall<'a, C, A> { + self._log_name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FolderLogDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> FolderLogDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FolderLogDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Lists the logs in projects or organizations. Only logs that have entries are listed. +/// +/// A builder for the *logs.list* method supported by a *organization* resource. +/// It is not used directly, but through a `OrganizationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2 as logging2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.organizations().logs_list("parent") +/// .page_token("aliquyam") +/// .page_size(-66) +/// .doit(); +/// # } +/// ``` +pub struct OrganizationLogListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _parent: String, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrganizationLogListCall<'a, C, A> {} + +impl<'a, C, A> OrganizationLogListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListLogsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.organizations.logs.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2/{+parent}/logs".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The resource name that owns the logs: + /// "projects/[PROJECT_ID]" + /// "organizations/[ORGANIZATION_ID]" + /// + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> OrganizationLogListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> OrganizationLogListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> OrganizationLogListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationLogListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OrganizationLogListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrganizationLogListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes all the log entries in a log. The log reappears if it receives new entries. +/// +/// A builder for the *logs.delete* method supported by a *organization* resource. +/// It is not used directly, but through a `OrganizationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2 as logging2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.organizations().logs_delete("logName") +/// .doit(); +/// # } +/// ``` +pub struct OrganizationLogDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _log_name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrganizationLogDeleteCall<'a, C, A> {} + +impl<'a, C, A> OrganizationLogDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.organizations.logs.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("logName", self._log_name.to_string())); + for &field in ["alt", "logName"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2/{+logName}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+logName}", "logName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["logName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The resource name of the log to delete: + /// "projects/[PROJECT_ID]/logs/[LOG_ID]" + /// "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" + /// [LOG_ID] must be URL-encoded. For example, "projects/my-project-id/logs/syslog", "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity". For more information about log names, see LogEntry. + /// + /// Sets the *log name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn log_name(mut self, new_value: &str) -> OrganizationLogDeleteCall<'a, C, A> { + self._log_name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationLogDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OrganizationLogDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrganizationLogDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates a sink. If the named sink doesn't exist, then this method is identical to sinks.create. If the named sink does exist, then this method replaces the following fields in the existing sink with values from the new sink: destination, filter, output_version_format, start_time, and end_time. The updated filter might also have a new writer_identity; see the unique_writer_identity field. +/// +/// A builder for the *sinks.update* method supported by a *organization* resource. +/// It is not used directly, but through a `OrganizationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2 as logging2; +/// use logging2::LogSink; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = LogSink::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.organizations().sinks_update(req, "sinkName") +/// .unique_writer_identity(true) +/// .doit(); +/// # } +/// ``` +pub struct OrganizationSinkUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _request: LogSink, + _sink_name: String, + _unique_writer_identity: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrganizationSinkUpdateCall<'a, C, A> {} + +impl<'a, C, A> OrganizationSinkUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LogSink)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.organizations.sinks.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("sinkName", self._sink_name.to_string())); + if let Some(value) = self._unique_writer_identity { + params.push(("uniqueWriterIdentity", value.to_string())); + } + for &field in ["alt", "sinkName", "uniqueWriterIdentity"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2/{+sinkName}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+sinkName}", "sinkName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["sinkName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: LogSink) -> OrganizationSinkUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. The full resource name of the sink to update, including the parent resource and the sink identifier: + /// "projects/[PROJECT_ID]/sinks/[SINK_ID]" + /// "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + /// Example: "projects/my-project-id/sinks/my-sink-id". + /// + /// Sets the *sink name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn sink_name(mut self, new_value: &str) -> OrganizationSinkUpdateCall<'a, C, A> { + self._sink_name = new_value.to_string(); + self + } + /// Optional. See sinks.create for a description of this field. When updating a sink, the effect of this field on the value of writer_identity in the updated sink depends on both the old and new values of this field: + /// If the old and new values of this field are both false or both true, then there is no change to the sink's writer_identity. + /// If the old value was false and the new value is true, then writer_identity is changed to a unique service account. + /// It is an error if the old value was true and the new value is false. + /// + /// Sets the *unique writer identity* query property to the given value. + pub fn unique_writer_identity(mut self, new_value: bool) -> OrganizationSinkUpdateCall<'a, C, A> { + self._unique_writer_identity = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationSinkUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OrganizationSinkUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrganizationSinkUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets a sink. +/// +/// A builder for the *sinks.get* method supported by a *organization* resource. +/// It is not used directly, but through a `OrganizationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2 as logging2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.organizations().sinks_get("sinkName") +/// .doit(); +/// # } +/// ``` +pub struct OrganizationSinkGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _sink_name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrganizationSinkGetCall<'a, C, A> {} + +impl<'a, C, A> OrganizationSinkGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LogSink)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.organizations.sinks.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("sinkName", self._sink_name.to_string())); + for &field in ["alt", "sinkName"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2/{+sinkName}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+sinkName}", "sinkName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["sinkName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The parent resource name of the sink: + /// "projects/[PROJECT_ID]/sinks/[SINK_ID]" + /// "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + /// Example: "projects/my-project-id/sinks/my-sink-id". + /// + /// Sets the *sink name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn sink_name(mut self, new_value: &str) -> OrganizationSinkGetCall<'a, C, A> { + self._sink_name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationSinkGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OrganizationSinkGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrganizationSinkGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Lists sinks. +/// +/// A builder for the *sinks.list* method supported by a *organization* resource. +/// It is not used directly, but through a `OrganizationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2 as logging2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.organizations().sinks_list("parent") +/// .page_token("diam") +/// .page_size(-55) +/// .doit(); +/// # } +/// ``` +pub struct OrganizationSinkListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _parent: String, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrganizationSinkListCall<'a, C, A> {} + +impl<'a, C, A> OrganizationSinkListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListSinksResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.organizations.sinks.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2/{+parent}/sinks".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The parent resource whose sinks are to be listed. Examples: "projects/my-logging-project", "organizations/123456789". + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> OrganizationSinkListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> OrganizationSinkListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> OrganizationSinkListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationSinkListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OrganizationSinkListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrganizationSinkListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted. +/// +/// A builder for the *sinks.delete* method supported by a *organization* resource. +/// It is not used directly, but through a `OrganizationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2 as logging2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.organizations().sinks_delete("sinkName") +/// .doit(); +/// # } +/// ``` +pub struct OrganizationSinkDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _sink_name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrganizationSinkDeleteCall<'a, C, A> {} + +impl<'a, C, A> OrganizationSinkDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.organizations.sinks.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("sinkName", self._sink_name.to_string())); + for &field in ["alt", "sinkName"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2/{+sinkName}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+sinkName}", "sinkName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["sinkName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The full resource name of the sink to delete, including the parent resource and the sink identifier: + /// "projects/[PROJECT_ID]/sinks/[SINK_ID]" + /// "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + /// It is an error if the sink does not exist. Example: "projects/my-project-id/sinks/my-sink-id". It is an error if the sink does not exist. + /// + /// Sets the *sink name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn sink_name(mut self, new_value: &str) -> OrganizationSinkDeleteCall<'a, C, A> { + self._sink_name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationSinkDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OrganizationSinkDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrganizationSinkDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Creates a sink that exports specified log entries to a destination. The export of newly-ingested log entries begins immediately, unless the current time is outside the sink's start and end times or the sink's writer_identity is not permitted to write to the destination. A sink can export log entries only from the resource owning the sink. +/// +/// A builder for the *sinks.create* method supported by a *organization* resource. +/// It is not used directly, but through a `OrganizationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2 as logging2; +/// use logging2::LogSink; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = LogSink::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.organizations().sinks_create(req, "parent") +/// .unique_writer_identity(false) +/// .doit(); +/// # } +/// ``` +pub struct OrganizationSinkCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _request: LogSink, + _parent: String, + _unique_writer_identity: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrganizationSinkCreateCall<'a, C, A> {} + +impl<'a, C, A> OrganizationSinkCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LogSink)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.organizations.sinks.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._unique_writer_identity { + params.push(("uniqueWriterIdentity", value.to_string())); + } + for &field in ["alt", "parent", "uniqueWriterIdentity"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2/{+parent}/sinks".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: LogSink) -> OrganizationSinkCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. The resource in which to create the sink: + /// "projects/[PROJECT_ID]" + /// "organizations/[ORGANIZATION_ID]" + /// Examples: "projects/my-logging-project", "organizations/123456789". + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> OrganizationSinkCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Optional. Determines the kind of IAM identity returned as writer_identity in the new sink. If this value is omitted or set to false, and if the sink's parent is a project, then the value returned as writer_identity is cloud-logs@google.com, the same identity used before the addition of writer identities to this API. The sink's destination must be in the same project as the sink itself.If this field is set to true, or if the sink is owned by a non-project resource such as an organization, then the value of writer_identity will be a unique service account used only for exports from the new sink. For more information, see writer_identity in LogSink. + /// + /// Sets the *unique writer identity* query property to the given value. + pub fn unique_writer_identity(mut self, new_value: bool) -> OrganizationSinkCreateCall<'a, C, A> { + self._unique_writer_identity = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationSinkCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OrganizationSinkCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrganizationSinkCreateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Writes log entries to Stackdriver Logging. All log entries are written by this method. +/// +/// A builder for the *write* method supported by a *entry* resource. +/// It is not used directly, but through a `EntryMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2 as logging2; +/// use logging2::WriteLogEntriesRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = WriteLogEntriesRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.entries().write(req) +/// .doit(); +/// # } +/// ``` +pub struct EntryWriteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _request: WriteLogEntriesRequest, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EntryWriteCall<'a, C, A> {} + +impl<'a, C, A> EntryWriteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, WriteLogEntriesResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.entries.write", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + for &field in ["alt"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2/entries:write".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: WriteLogEntriesRequest) -> EntryWriteCall<'a, C, A> { + self._request = new_value; + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> EntryWriteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> EntryWriteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> EntryWriteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Lists log entries. Use this method to retrieve log entries from Stackdriver Logging. For ways to export log entries, see Exporting Logs. +/// +/// A builder for the *list* method supported by a *entry* resource. +/// It is not used directly, but through a `EntryMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2 as logging2; +/// use logging2::ListLogEntriesRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ListLogEntriesRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.entries().list(req) +/// .doit(); +/// # } +/// ``` +pub struct EntryListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _request: ListLogEntriesRequest, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EntryListCall<'a, C, A> {} + +impl<'a, C, A> EntryListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListLogEntriesResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.entries.list", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + for &field in ["alt"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2/entries:list".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ListLogEntriesRequest) -> EntryListCall<'a, C, A> { + self._request = new_value; + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> EntryListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> EntryListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> EntryListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Creates a sink that exports specified log entries to a destination. The export of newly-ingested log entries begins immediately, unless the current time is outside the sink's start and end times or the sink's writer_identity is not permitted to write to the destination. A sink can export log entries only from the resource owning the sink. +/// +/// A builder for the *sinks.create* method supported by a *billingAccount* resource. +/// It is not used directly, but through a `BillingAccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2 as logging2; +/// use logging2::LogSink; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = LogSink::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.billing_accounts().sinks_create(req, "parent") +/// .unique_writer_identity(true) +/// .doit(); +/// # } +/// ``` +pub struct BillingAccountSinkCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _request: LogSink, + _parent: String, + _unique_writer_identity: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for BillingAccountSinkCreateCall<'a, C, A> {} + +impl<'a, C, A> BillingAccountSinkCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LogSink)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.billingAccounts.sinks.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._unique_writer_identity { + params.push(("uniqueWriterIdentity", value.to_string())); + } + for &field in ["alt", "parent", "uniqueWriterIdentity"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2/{+parent}/sinks".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: LogSink) -> BillingAccountSinkCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. The resource in which to create the sink: + /// "projects/[PROJECT_ID]" + /// "organizations/[ORGANIZATION_ID]" + /// Examples: "projects/my-logging-project", "organizations/123456789". + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> BillingAccountSinkCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Optional. Determines the kind of IAM identity returned as writer_identity in the new sink. If this value is omitted or set to false, and if the sink's parent is a project, then the value returned as writer_identity is cloud-logs@google.com, the same identity used before the addition of writer identities to this API. The sink's destination must be in the same project as the sink itself.If this field is set to true, or if the sink is owned by a non-project resource such as an organization, then the value of writer_identity will be a unique service account used only for exports from the new sink. For more information, see writer_identity in LogSink. + /// + /// Sets the *unique writer identity* query property to the given value. + pub fn unique_writer_identity(mut self, new_value: bool) -> BillingAccountSinkCreateCall<'a, C, A> { + self._unique_writer_identity = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> BillingAccountSinkCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> BillingAccountSinkCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> BillingAccountSinkCreateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Lists the logs in projects or organizations. Only logs that have entries are listed. +/// +/// A builder for the *logs.list* method supported by a *billingAccount* resource. +/// It is not used directly, but through a `BillingAccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2 as logging2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.billing_accounts().logs_list("parent") +/// .page_token("eos") +/// .page_size(-81) +/// .doit(); +/// # } +/// ``` +pub struct BillingAccountLogListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _parent: String, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for BillingAccountLogListCall<'a, C, A> {} + +impl<'a, C, A> BillingAccountLogListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListLogsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.billingAccounts.logs.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2/{+parent}/logs".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The resource name that owns the logs: + /// "projects/[PROJECT_ID]" + /// "organizations/[ORGANIZATION_ID]" + /// + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> BillingAccountLogListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> BillingAccountLogListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> BillingAccountLogListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> BillingAccountLogListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> BillingAccountLogListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> BillingAccountLogListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Lists sinks. +/// +/// A builder for the *sinks.list* method supported by a *billingAccount* resource. +/// It is not used directly, but through a `BillingAccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2 as logging2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.billing_accounts().sinks_list("parent") +/// .page_token("dolor") +/// .page_size(-39) +/// .doit(); +/// # } +/// ``` +pub struct BillingAccountSinkListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _parent: String, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for BillingAccountSinkListCall<'a, C, A> {} + +impl<'a, C, A> BillingAccountSinkListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListSinksResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.billingAccounts.sinks.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2/{+parent}/sinks".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The parent resource whose sinks are to be listed. Examples: "projects/my-logging-project", "organizations/123456789". + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> BillingAccountSinkListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> BillingAccountSinkListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> BillingAccountSinkListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> BillingAccountSinkListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> BillingAccountSinkListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> BillingAccountSinkListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted. +/// +/// A builder for the *sinks.delete* method supported by a *billingAccount* resource. +/// It is not used directly, but through a `BillingAccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2 as logging2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.billing_accounts().sinks_delete("sinkName") +/// .doit(); +/// # } +/// ``` +pub struct BillingAccountSinkDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _sink_name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for BillingAccountSinkDeleteCall<'a, C, A> {} + +impl<'a, C, A> BillingAccountSinkDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.billingAccounts.sinks.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("sinkName", self._sink_name.to_string())); + for &field in ["alt", "sinkName"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2/{+sinkName}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+sinkName}", "sinkName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["sinkName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The full resource name of the sink to delete, including the parent resource and the sink identifier: + /// "projects/[PROJECT_ID]/sinks/[SINK_ID]" + /// "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + /// It is an error if the sink does not exist. Example: "projects/my-project-id/sinks/my-sink-id". It is an error if the sink does not exist. + /// + /// Sets the *sink name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn sink_name(mut self, new_value: &str) -> BillingAccountSinkDeleteCall<'a, C, A> { + self._sink_name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> BillingAccountSinkDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> BillingAccountSinkDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> BillingAccountSinkDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets a sink. +/// +/// A builder for the *sinks.get* method supported by a *billingAccount* resource. +/// It is not used directly, but through a `BillingAccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2 as logging2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.billing_accounts().sinks_get("sinkName") +/// .doit(); +/// # } +/// ``` +pub struct BillingAccountSinkGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _sink_name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for BillingAccountSinkGetCall<'a, C, A> {} + +impl<'a, C, A> BillingAccountSinkGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LogSink)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.billingAccounts.sinks.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("sinkName", self._sink_name.to_string())); + for &field in ["alt", "sinkName"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2/{+sinkName}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+sinkName}", "sinkName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["sinkName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The parent resource name of the sink: + /// "projects/[PROJECT_ID]/sinks/[SINK_ID]" + /// "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + /// Example: "projects/my-project-id/sinks/my-sink-id". + /// + /// Sets the *sink name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn sink_name(mut self, new_value: &str) -> BillingAccountSinkGetCall<'a, C, A> { + self._sink_name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> BillingAccountSinkGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> BillingAccountSinkGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> BillingAccountSinkGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates a sink. If the named sink doesn't exist, then this method is identical to sinks.create. If the named sink does exist, then this method replaces the following fields in the existing sink with values from the new sink: destination, filter, output_version_format, start_time, and end_time. The updated filter might also have a new writer_identity; see the unique_writer_identity field. +/// +/// A builder for the *sinks.update* method supported by a *billingAccount* resource. +/// It is not used directly, but through a `BillingAccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2 as logging2; +/// use logging2::LogSink; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = LogSink::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.billing_accounts().sinks_update(req, "sinkName") +/// .unique_writer_identity(true) +/// .doit(); +/// # } +/// ``` +pub struct BillingAccountSinkUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _request: LogSink, + _sink_name: String, + _unique_writer_identity: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for BillingAccountSinkUpdateCall<'a, C, A> {} + +impl<'a, C, A> BillingAccountSinkUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LogSink)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.billingAccounts.sinks.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("sinkName", self._sink_name.to_string())); + if let Some(value) = self._unique_writer_identity { + params.push(("uniqueWriterIdentity", value.to_string())); + } + for &field in ["alt", "sinkName", "uniqueWriterIdentity"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2/{+sinkName}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+sinkName}", "sinkName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["sinkName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: LogSink) -> BillingAccountSinkUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. The full resource name of the sink to update, including the parent resource and the sink identifier: + /// "projects/[PROJECT_ID]/sinks/[SINK_ID]" + /// "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + /// Example: "projects/my-project-id/sinks/my-sink-id". + /// + /// Sets the *sink name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn sink_name(mut self, new_value: &str) -> BillingAccountSinkUpdateCall<'a, C, A> { + self._sink_name = new_value.to_string(); + self + } + /// Optional. See sinks.create for a description of this field. When updating a sink, the effect of this field on the value of writer_identity in the updated sink depends on both the old and new values of this field: + /// If the old and new values of this field are both false or both true, then there is no change to the sink's writer_identity. + /// If the old value was false and the new value is true, then writer_identity is changed to a unique service account. + /// It is an error if the old value was true and the new value is false. + /// + /// Sets the *unique writer identity* query property to the given value. + pub fn unique_writer_identity(mut self, new_value: bool) -> BillingAccountSinkUpdateCall<'a, C, A> { + self._unique_writer_identity = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> BillingAccountSinkUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> BillingAccountSinkUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> BillingAccountSinkUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes all the log entries in a log. The log reappears if it receives new entries. +/// +/// A builder for the *logs.delete* method supported by a *billingAccount* resource. +/// It is not used directly, but through a `BillingAccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2 as logging2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.billing_accounts().logs_delete("logName") +/// .doit(); +/// # } +/// ``` +pub struct BillingAccountLogDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _log_name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for BillingAccountLogDeleteCall<'a, C, A> {} + +impl<'a, C, A> BillingAccountLogDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.billingAccounts.logs.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("logName", self._log_name.to_string())); + for &field in ["alt", "logName"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2/{+logName}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+logName}", "logName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["logName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The resource name of the log to delete: + /// "projects/[PROJECT_ID]/logs/[LOG_ID]" + /// "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" + /// [LOG_ID] must be URL-encoded. For example, "projects/my-project-id/logs/syslog", "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity". For more information about log names, see LogEntry. + /// + /// Sets the *log name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn log_name(mut self, new_value: &str) -> BillingAccountLogDeleteCall<'a, C, A> { + self._log_name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> BillingAccountLogDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> BillingAccountLogDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> BillingAccountLogDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Lists the descriptors for monitored resource types used by Stackdriver Logging. +/// +/// A builder for the *list* method supported by a *monitoredResourceDescriptor* resource. +/// It is not used directly, but through a `MonitoredResourceDescriptorMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2 as logging2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.monitored_resource_descriptors().list() +/// .page_token("dolore") +/// .page_size(-37) +/// .doit(); +/// # } +/// ``` +pub struct MonitoredResourceDescriptorListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for MonitoredResourceDescriptorListCall<'a, C, A> {} + +impl<'a, C, A> MonitoredResourceDescriptorListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListMonitoredResourceDescriptorsResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.monitoredResourceDescriptors.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2/monitoredResourceDescriptors".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> MonitoredResourceDescriptorListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> MonitoredResourceDescriptorListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> MonitoredResourceDescriptorListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> MonitoredResourceDescriptorListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> MonitoredResourceDescriptorListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes all the log entries in a log. The log reappears if it receives new entries. +/// +/// A builder for the *logs.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2 as logging2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().logs_delete("logName") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLogDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _log_name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLogDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectLogDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.projects.logs.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("logName", self._log_name.to_string())); + for &field in ["alt", "logName"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2/{+logName}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+logName}", "logName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["logName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The resource name of the log to delete: + /// "projects/[PROJECT_ID]/logs/[LOG_ID]" + /// "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" + /// [LOG_ID] must be URL-encoded. For example, "projects/my-project-id/logs/syslog", "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity". For more information about log names, see LogEntry. + /// + /// Sets the *log name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn log_name(mut self, new_value: &str) -> ProjectLogDeleteCall<'a, C, A> { + self._log_name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLogDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLogDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLogDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets a logs-based metric. +/// +/// A builder for the *metrics.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2 as logging2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().metrics_get("metricName") +/// .doit(); +/// # } +/// ``` +pub struct ProjectMetricGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _metric_name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectMetricGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectMetricGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LogMetric)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.projects.metrics.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("metricName", self._metric_name.to_string())); + for &field in ["alt", "metricName"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2/{+metricName}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+metricName}", "metricName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["metricName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The resource name of the desired metric: + /// "projects/[PROJECT_ID]/metrics/[METRIC_ID]" + /// + /// + /// Sets the *metric name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn metric_name(mut self, new_value: &str) -> ProjectMetricGetCall<'a, C, A> { + self._metric_name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectMetricGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectMetricGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectMetricGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Lists the logs in projects or organizations. Only logs that have entries are listed. +/// +/// A builder for the *logs.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2 as logging2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().logs_list("parent") +/// .page_token("sea") +/// .page_size(-21) +/// .doit(); +/// # } +/// ``` +pub struct ProjectLogListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _parent: String, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLogListCall<'a, C, A> {} + +impl<'a, C, A> ProjectLogListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListLogsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.projects.logs.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2/{+parent}/logs".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The resource name that owns the logs: + /// "projects/[PROJECT_ID]" + /// "organizations/[ORGANIZATION_ID]" + /// + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLogListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectLogListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectLogListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLogListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLogListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLogListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Creates a logs-based metric. +/// +/// A builder for the *metrics.create* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2 as logging2; +/// use logging2::LogMetric; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = LogMetric::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().metrics_create(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct ProjectMetricCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _request: LogMetric, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectMetricCreateCall<'a, C, A> {} + +impl<'a, C, A> ProjectMetricCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LogMetric)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.projects.metrics.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2/{+parent}/metrics".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: LogMetric) -> ProjectMetricCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// The resource name of the project in which to create the metric: + /// "projects/[PROJECT_ID]" + /// The new metric must be provided in the request. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectMetricCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectMetricCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectMetricCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectMetricCreateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Lists logs-based metrics. +/// +/// A builder for the *metrics.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2 as logging2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().metrics_list("parent") +/// .page_token("eirmod") +/// .page_size(-58) +/// .doit(); +/// # } +/// ``` +pub struct ProjectMetricListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _parent: String, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectMetricListCall<'a, C, A> {} + +impl<'a, C, A> ProjectMetricListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListLogMetricsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.projects.metrics.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2/{+parent}/metrics".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The name of the project containing the metrics: + /// "projects/[PROJECT_ID]" + /// + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectMetricListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectMetricListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectMetricListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectMetricListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectMetricListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectMetricListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates a sink. If the named sink doesn't exist, then this method is identical to sinks.create. If the named sink does exist, then this method replaces the following fields in the existing sink with values from the new sink: destination, filter, output_version_format, start_time, and end_time. The updated filter might also have a new writer_identity; see the unique_writer_identity field. +/// +/// A builder for the *sinks.update* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2 as logging2; +/// use logging2::LogSink; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = LogSink::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().sinks_update(req, "sinkName") +/// .unique_writer_identity(true) +/// .doit(); +/// # } +/// ``` +pub struct ProjectSinkUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _request: LogSink, + _sink_name: String, + _unique_writer_identity: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectSinkUpdateCall<'a, C, A> {} + +impl<'a, C, A> ProjectSinkUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LogSink)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.projects.sinks.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("sinkName", self._sink_name.to_string())); + if let Some(value) = self._unique_writer_identity { + params.push(("uniqueWriterIdentity", value.to_string())); + } + for &field in ["alt", "sinkName", "uniqueWriterIdentity"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2/{+sinkName}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+sinkName}", "sinkName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["sinkName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: LogSink) -> ProjectSinkUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. The full resource name of the sink to update, including the parent resource and the sink identifier: + /// "projects/[PROJECT_ID]/sinks/[SINK_ID]" + /// "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + /// Example: "projects/my-project-id/sinks/my-sink-id". + /// + /// Sets the *sink name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn sink_name(mut self, new_value: &str) -> ProjectSinkUpdateCall<'a, C, A> { + self._sink_name = new_value.to_string(); + self + } + /// Optional. See sinks.create for a description of this field. When updating a sink, the effect of this field on the value of writer_identity in the updated sink depends on both the old and new values of this field: + /// If the old and new values of this field are both false or both true, then there is no change to the sink's writer_identity. + /// If the old value was false and the new value is true, then writer_identity is changed to a unique service account. + /// It is an error if the old value was true and the new value is false. + /// + /// Sets the *unique writer identity* query property to the given value. + pub fn unique_writer_identity(mut self, new_value: bool) -> ProjectSinkUpdateCall<'a, C, A> { + self._unique_writer_identity = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectSinkUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectSinkUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectSinkUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Lists sinks. +/// +/// A builder for the *sinks.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2 as logging2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().sinks_list("parent") +/// .page_token("consetetur") +/// .page_size(-36) +/// .doit(); +/// # } +/// ``` +pub struct ProjectSinkListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _parent: String, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectSinkListCall<'a, C, A> {} + +impl<'a, C, A> ProjectSinkListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListSinksResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.projects.sinks.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2/{+parent}/sinks".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The parent resource whose sinks are to be listed. Examples: "projects/my-logging-project", "organizations/123456789". + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectSinkListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectSinkListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectSinkListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectSinkListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectSinkListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectSinkListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets a sink. +/// +/// A builder for the *sinks.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2 as logging2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().sinks_get("sinkName") +/// .doit(); +/// # } +/// ``` +pub struct ProjectSinkGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _sink_name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectSinkGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectSinkGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LogSink)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.projects.sinks.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("sinkName", self._sink_name.to_string())); + for &field in ["alt", "sinkName"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2/{+sinkName}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+sinkName}", "sinkName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["sinkName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The parent resource name of the sink: + /// "projects/[PROJECT_ID]/sinks/[SINK_ID]" + /// "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + /// Example: "projects/my-project-id/sinks/my-sink-id". + /// + /// Sets the *sink name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn sink_name(mut self, new_value: &str) -> ProjectSinkGetCall<'a, C, A> { + self._sink_name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectSinkGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectSinkGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectSinkGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted. +/// +/// A builder for the *sinks.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2 as logging2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().sinks_delete("sinkName") +/// .doit(); +/// # } +/// ``` +pub struct ProjectSinkDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _sink_name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectSinkDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectSinkDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.projects.sinks.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("sinkName", self._sink_name.to_string())); + for &field in ["alt", "sinkName"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2/{+sinkName}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+sinkName}", "sinkName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["sinkName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The full resource name of the sink to delete, including the parent resource and the sink identifier: + /// "projects/[PROJECT_ID]/sinks/[SINK_ID]" + /// "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + /// It is an error if the sink does not exist. Example: "projects/my-project-id/sinks/my-sink-id". It is an error if the sink does not exist. + /// + /// Sets the *sink name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn sink_name(mut self, new_value: &str) -> ProjectSinkDeleteCall<'a, C, A> { + self._sink_name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectSinkDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectSinkDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectSinkDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Creates a sink that exports specified log entries to a destination. The export of newly-ingested log entries begins immediately, unless the current time is outside the sink's start and end times or the sink's writer_identity is not permitted to write to the destination. A sink can export log entries only from the resource owning the sink. +/// +/// A builder for the *sinks.create* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2 as logging2; +/// use logging2::LogSink; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = LogSink::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().sinks_create(req, "parent") +/// .unique_writer_identity(true) +/// .doit(); +/// # } +/// ``` +pub struct ProjectSinkCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _request: LogSink, + _parent: String, + _unique_writer_identity: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectSinkCreateCall<'a, C, A> {} + +impl<'a, C, A> ProjectSinkCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LogSink)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.projects.sinks.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._unique_writer_identity { + params.push(("uniqueWriterIdentity", value.to_string())); + } + for &field in ["alt", "parent", "uniqueWriterIdentity"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2/{+parent}/sinks".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: LogSink) -> ProjectSinkCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. The resource in which to create the sink: + /// "projects/[PROJECT_ID]" + /// "organizations/[ORGANIZATION_ID]" + /// Examples: "projects/my-logging-project", "organizations/123456789". + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectSinkCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Optional. Determines the kind of IAM identity returned as writer_identity in the new sink. If this value is omitted or set to false, and if the sink's parent is a project, then the value returned as writer_identity is cloud-logs@google.com, the same identity used before the addition of writer identities to this API. The sink's destination must be in the same project as the sink itself.If this field is set to true, or if the sink is owned by a non-project resource such as an organization, then the value of writer_identity will be a unique service account used only for exports from the new sink. For more information, see writer_identity in LogSink. + /// + /// Sets the *unique writer identity* query property to the given value. + pub fn unique_writer_identity(mut self, new_value: bool) -> ProjectSinkCreateCall<'a, C, A> { + self._unique_writer_identity = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectSinkCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectSinkCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectSinkCreateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Creates or updates a logs-based metric. +/// +/// A builder for the *metrics.update* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2 as logging2; +/// use logging2::LogMetric; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = LogMetric::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().metrics_update(req, "metricName") +/// .doit(); +/// # } +/// ``` +pub struct ProjectMetricUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _request: LogMetric, + _metric_name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectMetricUpdateCall<'a, C, A> {} + +impl<'a, C, A> ProjectMetricUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LogMetric)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.projects.metrics.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("metricName", self._metric_name.to_string())); + for &field in ["alt", "metricName"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2/{+metricName}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+metricName}", "metricName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["metricName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: LogMetric) -> ProjectMetricUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// The resource name of the metric to update: + /// "projects/[PROJECT_ID]/metrics/[METRIC_ID]" + /// The updated metric must be provided in the request and it's name field must be the same as [METRIC_ID] If the metric does not exist in [PROJECT_ID], then a new metric is created. + /// + /// Sets the *metric name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn metric_name(mut self, new_value: &str) -> ProjectMetricUpdateCall<'a, C, A> { + self._metric_name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectMetricUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectMetricUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectMetricUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes a logs-based metric. +/// +/// A builder for the *metrics.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2 as logging2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().metrics_delete("metricName") +/// .doit(); +/// # } +/// ``` +pub struct ProjectMetricDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _metric_name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectMetricDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectMetricDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.projects.metrics.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("metricName", self._metric_name.to_string())); + for &field in ["alt", "metricName"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2/{+metricName}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+metricName}", "metricName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["metricName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The resource name of the metric to delete: + /// "projects/[PROJECT_ID]/metrics/[METRIC_ID]" + /// + /// + /// Sets the *metric name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn metric_name(mut self, new_value: &str) -> ProjectMetricDeleteCall<'a, C, A> { + self._metric_name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectMetricDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectMetricDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectMetricDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + diff --git a/gen/logging2_beta1-cli/Cargo.toml b/gen/logging2_beta1-cli/Cargo.toml index 4fea318d26..01f11b1525 100644 --- a/gen/logging2_beta1-cli/Cargo.toml +++ b/gen/logging2_beta1-cli/Cargo.toml @@ -4,9 +4,9 @@ [package] name = "google-logging2_beta1-cli" -version = "1.0.0+20160322" +version = "1.0.0+20161206" authors = ["Sebastian Thiel "] -description = "A complete library to interact with logging (protocol v2beta1)" +description = "A complete library to interact with Logging (protocol v2beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/logging2_beta1-cli" homepage = "https://cloud.google.com/logging/docs/" documentation = "http://byron.github.io/google-apis-rs/google_logging2_beta1_cli" diff --git a/gen/logging2_beta1-cli/README.md b/gen/logging2_beta1-cli/README.md index 9ecae8e95d..cb6622816f 100644 --- a/gen/logging2_beta1-cli/README.md +++ b/gen/logging2_beta1-cli/README.md @@ -3,14 +3,14 @@ DO NOT EDIT ! This file was generated automatically from 'src/mako/cli/README.md.mako' DO NOT EDIT ! --> -The `logging2-beta1` command-line interface *(CLI)* allows to use most features of the *Google logging* service from the comfort of your terminal. +The `logging2-beta1` command-line interface *(CLI)* allows to use most features of the *Google Logging* service from the comfort of your terminal. By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero. If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. -Everything else about the *logging* API can be found at the +Everything else about the *Logging* API can be found at the [official documentation site](https://cloud.google.com/logging/docs/). # Downloads @@ -24,26 +24,33 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *logging* API at revision *20160322*. The CLI is at version *1.0.0*. +This documentation was generated from the *Logging* API at revision *20161206*. The CLI is at version *1.0.0*. ```bash logging2-beta1 [options] + billing-accounts + logs-delete [-p ]... [-o ] + logs-list [-p ]... [-o ] entries list (-r )... [-p ]... [-o ] write (-r )... [-p ]... [-o ] monitored-resource-descriptors list [-p ]... [-o ] + organizations + logs-delete [-p ]... [-o ] + logs-list [-p ]... [-o ] projects logs-delete [-p ]... [-o ] - metrics-create (-r )... [-p ]... [-o ] + logs-list [-p ]... [-o ] + metrics-create (-r )... [-p ]... [-o ] metrics-delete [-p ]... [-o ] metrics-get [-p ]... [-o ] - metrics-list [-p ]... [-o ] + metrics-list [-p ]... [-o ] metrics-update (-r )... [-p ]... [-o ] - sinks-create (-r )... [-p ]... [-o ] + sinks-create (-r )... [-p ]... [-o ] sinks-delete [-p ]... [-o ] sinks-get [-p ]... [-o ] - sinks-list [-p ]... [-o ] + sinks-list [-p ]... [-o ] sinks-update (-r )... [-p ]... [-o ] logging2-beta1 --help diff --git a/gen/logging2_beta1-cli/mkdocs.yml b/gen/logging2_beta1-cli/mkdocs.yml index 2966536968..528f6e2020 100644 --- a/gen/logging2_beta1-cli/mkdocs.yml +++ b/gen/logging2_beta1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: logging v1.0.0+20160322 +site_name: Logging v1.0.0+20161206 site_url: http://byron.github.io/google-apis-rs/google-logging2_beta1-cli site_description: Write integrating applications with bcore @@ -9,10 +9,15 @@ site_dir: build_html pages: - ['index.md', 'Home'] +- ['billing-accounts_logs-delete.md', 'Billing Accounts', 'Logs Delete'] +- ['billing-accounts_logs-list.md', 'Billing Accounts', 'Logs List'] - ['entries_list.md', 'Entries', 'List'] - ['entries_write.md', 'Entries', 'Write'] - ['monitored-resource-descriptors_list.md', 'Monitored Resource Descriptors', 'List'] +- ['organizations_logs-delete.md', 'Organizations', 'Logs Delete'] +- ['organizations_logs-list.md', 'Organizations', 'Logs List'] - ['projects_logs-delete.md', 'Projects', 'Logs Delete'] +- ['projects_logs-list.md', 'Projects', 'Logs List'] - ['projects_metrics-create.md', 'Projects', 'Metrics Create'] - ['projects_metrics-delete.md', 'Projects', 'Metrics Delete'] - ['projects_metrics-get.md', 'Projects', 'Metrics Get'] diff --git a/gen/logging2_beta1-cli/src/main.rs b/gen/logging2_beta1-cli/src/main.rs index 78aa740b58..41a42f62e7 100644 --- a/gen/logging2_beta1-cli/src/main.rs +++ b/gen/logging2_beta1-cli/src/main.rs @@ -45,6 +45,117 @@ struct Engine<'n> { impl<'n> Engine<'n> { + fn _billing_accounts_logs_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.billing_accounts().logs_delete(opt.value_of("log-name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _billing_accounts_logs_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.billing_accounts().logs_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _entries_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -69,13 +180,13 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "order-by" => Some(("orderBy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "resource-names" => Some(("resourceNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "page-size" => Some(("pageSize", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "partial-success" => Some(("partialSuccess", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "page-token" => Some(("pageToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "project-ids" => Some(("projectIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["filter", "order-by", "page-size", "page-token", "partial-success", "project-ids"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["filter", "order-by", "page-size", "page-token", "project-ids", "resource-names"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -283,6 +394,117 @@ impl<'n> Engine<'n> { } } + fn _organizations_logs_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.organizations().logs_delete(opt.value_of("log-name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _organizations_logs_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.organizations().logs_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _projects_logs_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().logs_delete(opt.value_of("log-name").unwrap_or("")); @@ -335,6 +557,65 @@ impl<'n> Engine<'n> { } } + fn _projects_logs_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().logs_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _projects_metrics_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -359,10 +640,11 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "version" => Some(("version", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["description", "filter", "name"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["description", "filter", "name", "version"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -372,7 +654,7 @@ impl<'n> Engine<'n> { } } let mut request: api::LogMetric = json::value::from_value(object).unwrap(); - let mut call = self.hub.projects().metrics_create(request, opt.value_of("project-name").unwrap_or("")); + let mut call = self.hub.projects().metrics_create(request, opt.value_of("parent").unwrap_or("")); for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { @@ -528,7 +810,7 @@ impl<'n> Engine<'n> { fn _projects_metrics_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { - let mut call = self.hub.projects().metrics_list(opt.value_of("project-name").unwrap_or("")); + let mut call = self.hub.projects().metrics_list(opt.value_of("parent").unwrap_or("")); for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { @@ -609,10 +891,11 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "version" => Some(("version", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["description", "filter", "name"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["description", "filter", "name", "version"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -695,12 +978,15 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "destination" => Some(("destination", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "end-time" => Some(("endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "destination" => Some(("destination", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "start-time" => Some(("startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "output-version-format" => Some(("outputVersionFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "writer-identity" => Some(("writerIdentity", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["destination", "filter", "name", "output-version-format"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["destination", "end-time", "filter", "name", "output-version-format", "start-time", "writer-identity"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -710,10 +996,13 @@ impl<'n> Engine<'n> { } } let mut request: api::LogSink = json::value::from_value(object).unwrap(); - let mut call = self.hub.projects().sinks_create(request, opt.value_of("project-name").unwrap_or("")); + let mut call = self.hub.projects().sinks_create(request, opt.value_of("parent").unwrap_or("")); for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { + "unique-writer-identity" => { + call = call.unique_writer_identity(arg_from_str(value.unwrap_or("false"), err, "unique-writer-identity", "boolean")); + }, _ => { let mut found = false; for param in &self.gp { @@ -727,6 +1016,7 @@ impl<'n> Engine<'n> { err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); + v.extend(["unique-writer-identity"].iter().map(|v|*v)); v } )); } } @@ -866,7 +1156,7 @@ impl<'n> Engine<'n> { fn _projects_sinks_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { - let mut call = self.hub.projects().sinks_list(opt.value_of("project-name").unwrap_or("")); + let mut call = self.hub.projects().sinks_list(opt.value_of("parent").unwrap_or("")); for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { @@ -946,12 +1236,15 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "destination" => Some(("destination", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "end-time" => Some(("endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "destination" => Some(("destination", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "start-time" => Some(("startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "output-version-format" => Some(("outputVersionFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "writer-identity" => Some(("writerIdentity", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["destination", "filter", "name", "output-version-format"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["destination", "end-time", "filter", "name", "output-version-format", "start-time", "writer-identity"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -965,6 +1258,9 @@ impl<'n> Engine<'n> { for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { + "unique-writer-identity" => { + call = call.unique_writer_identity(arg_from_str(value.unwrap_or("false"), err, "unique-writer-identity", "boolean")); + }, _ => { let mut found = false; for param in &self.gp { @@ -978,6 +1274,7 @@ impl<'n> Engine<'n> { err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); + v.extend(["unique-writer-identity"].iter().map(|v|*v)); v } )); } } @@ -1016,6 +1313,20 @@ impl<'n> Engine<'n> { let mut call_result: Result<(), DoitError> = Ok(()); let mut err_opt: Option = None; match self.opt.subcommand() { + ("billing-accounts", Some(opt)) => { + match opt.subcommand() { + ("logs-delete", Some(opt)) => { + call_result = self._billing_accounts_logs_delete(opt, dry_run, &mut err); + }, + ("logs-list", Some(opt)) => { + call_result = self._billing_accounts_logs_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("billing-accounts".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, ("entries", Some(opt)) => { match opt.subcommand() { ("list", Some(opt)) => { @@ -1041,11 +1352,28 @@ impl<'n> Engine<'n> { } } }, + ("organizations", Some(opt)) => { + match opt.subcommand() { + ("logs-delete", Some(opt)) => { + call_result = self._organizations_logs_delete(opt, dry_run, &mut err); + }, + ("logs-list", Some(opt)) => { + call_result = self._organizations_logs_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("organizations".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, ("projects", Some(opt)) => { match opt.subcommand() { ("logs-delete", Some(opt)) => { call_result = self._projects_logs_delete(opt, dry_run, &mut err); }, + ("logs-list", Some(opt)) => { + call_result = self._projects_logs_list(opt, dry_run, &mut err); + }, ("metrics-create", Some(opt)) => { call_result = self._projects_metrics_create(opt, dry_run, &mut err); }, @@ -1168,9 +1496,62 @@ impl<'n> Engine<'n> { fn main() { let mut exit_status = 0i32; let arg_data = [ + ("billing-accounts", "methods: 'logs-delete' and 'logs-list'", vec![ + ("logs-delete", + Some(r##"Deletes all the log entries in a log. The log reappears if it receives new entries."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_beta1_cli/billing-accounts_logs-delete", + vec![ + (Some(r##"log-name"##), + None, + Some(r##"Required. The resource name of the log to delete: + "projects/[PROJECT_ID]/logs/[LOG_ID]" + "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" + [LOG_ID] must be URL-encoded. For example, "projects/my-project-id/logs/syslog", "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity". For more information about log names, see LogEntry."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("logs-list", + Some(r##"Lists the logs in projects or organizations. Only logs that have entries are listed."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_beta1_cli/billing-accounts_logs-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Required. The resource name that owns the logs: + "projects/[PROJECT_ID]" + "organizations/[ORGANIZATION_ID]" + "##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + ("entries", "methods: 'list' and 'write'", vec![ ("list", - Some(r##"Lists log entries. Use this method to retrieve log entries from Cloud Logging. For ways to export log entries, see [Exporting Logs](/logging/docs/export)."##), + Some(r##"Lists log entries. Use this method to retrieve log entries from Stackdriver Logging. For ways to export log entries, see Exporting Logs."##), "Details at http://byron.github.io/google-apis-rs/google_logging2_beta1_cli/entries_list", vec![ (Some(r##"kv"##), @@ -1192,7 +1573,7 @@ fn main() { Some(false)), ]), ("write", - Some(r##"Writes log entries to Cloud Logging. All log entries in Cloud Logging are written by this method."##), + Some(r##"Writes log entries to Stackdriver Logging. All log entries are written by this method."##), "Details at http://byron.github.io/google-apis-rs/google_logging2_beta1_cli/entries_write", vec![ (Some(r##"kv"##), @@ -1217,7 +1598,7 @@ fn main() { ("monitored-resource-descriptors", "methods: 'list'", vec![ ("list", - Some(r##"Lists monitored resource descriptors that are used by Cloud Logging."##), + Some(r##"Lists the descriptors for monitored resource types used by Stackdriver Logging."##), "Details at http://byron.github.io/google-apis-rs/google_logging2_beta1_cli/monitored-resource-descriptors_list", vec![ (Some(r##"v"##), @@ -1234,14 +1615,95 @@ fn main() { ]), ]), - ("projects", "methods: 'logs-delete', 'metrics-create', 'metrics-delete', 'metrics-get', 'metrics-list', 'metrics-update', 'sinks-create', 'sinks-delete', 'sinks-get', 'sinks-list' and 'sinks-update'", vec![ + ("organizations", "methods: 'logs-delete' and 'logs-list'", vec![ ("logs-delete", - Some(r##"Deletes a log and all its log entries. The log will reappear if it receives new entries."##), + Some(r##"Deletes all the log entries in a log. The log reappears if it receives new entries."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_beta1_cli/organizations_logs-delete", + vec![ + (Some(r##"log-name"##), + None, + Some(r##"Required. The resource name of the log to delete: + "projects/[PROJECT_ID]/logs/[LOG_ID]" + "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" + [LOG_ID] must be URL-encoded. For example, "projects/my-project-id/logs/syslog", "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity". For more information about log names, see LogEntry."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("logs-list", + Some(r##"Lists the logs in projects or organizations. Only logs that have entries are listed."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_beta1_cli/organizations_logs-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Required. The resource name that owns the logs: + "projects/[PROJECT_ID]" + "organizations/[ORGANIZATION_ID]" + "##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("projects", "methods: 'logs-delete', 'logs-list', 'metrics-create', 'metrics-delete', 'metrics-get', 'metrics-list', 'metrics-update', 'sinks-create', 'sinks-delete', 'sinks-get', 'sinks-list' and 'sinks-update'", vec![ + ("logs-delete", + Some(r##"Deletes all the log entries in a log. The log reappears if it receives new entries."##), "Details at http://byron.github.io/google-apis-rs/google_logging2_beta1_cli/projects_logs-delete", vec![ (Some(r##"log-name"##), None, - Some(r##"Required. The resource name of the log to delete. Example: `"projects/my-project/logs/syslog"`."##), + Some(r##"Required. The resource name of the log to delete: + "projects/[PROJECT_ID]/logs/[LOG_ID]" + "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" + [LOG_ID] must be URL-encoded. For example, "projects/my-project-id/logs/syslog", "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity". For more information about log names, see LogEntry."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("logs-list", + Some(r##"Lists the logs in projects or organizations. Only logs that have entries are listed."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_beta1_cli/projects_logs-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Required. The resource name that owns the logs: + "projects/[PROJECT_ID]" + "organizations/[ORGANIZATION_ID]" + "##), Some(true), Some(false)), @@ -1261,9 +1723,11 @@ fn main() { Some(r##"Creates a logs-based metric."##), "Details at http://byron.github.io/google-apis-rs/google_logging2_beta1_cli/projects_metrics-create", vec![ - (Some(r##"project-name"##), + (Some(r##"parent"##), None, - Some(r##"The resource name of the project in which to create the metric. Example: `"projects/my-project-id"`. The new metric must be provided in the request."##), + Some(r##"The resource name of the project in which to create the metric: + "projects/[PROJECT_ID]" + The new metric must be provided in the request."##), Some(true), Some(false)), @@ -1291,7 +1755,9 @@ fn main() { vec![ (Some(r##"metric-name"##), None, - Some(r##"The resource name of the metric to delete. Example: `"projects/my-project-id/metrics/my-metric-id"`."##), + Some(r##"The resource name of the metric to delete: + "projects/[PROJECT_ID]/metrics/[METRIC_ID]" + "##), Some(true), Some(false)), @@ -1313,7 +1779,9 @@ fn main() { vec![ (Some(r##"metric-name"##), None, - Some(r##"The resource name of the desired metric. Example: `"projects/my-project-id/metrics/my-metric-id"`."##), + Some(r##"The resource name of the desired metric: + "projects/[PROJECT_ID]/metrics/[METRIC_ID]" + "##), Some(true), Some(false)), @@ -1333,9 +1801,11 @@ fn main() { Some(r##"Lists logs-based metrics."##), "Details at http://byron.github.io/google-apis-rs/google_logging2_beta1_cli/projects_metrics-list", vec![ - (Some(r##"project-name"##), + (Some(r##"parent"##), None, - Some(r##"Required. The resource name of the project containing the metrics. Example: `"projects/my-project-id"`."##), + Some(r##"Required. The name of the project containing the metrics: + "projects/[PROJECT_ID]" + "##), Some(true), Some(false)), @@ -1357,7 +1827,9 @@ fn main() { vec![ (Some(r##"metric-name"##), None, - Some(r##"The resource name of the metric to update. Example: `"projects/my-project-id/metrics/my-metric-id"`. The updated metric must be provided in the request and have the same identifier that is specified in `metricName`. If the metric does not exist, it is created."##), + Some(r##"The resource name of the metric to update: + "projects/[PROJECT_ID]/metrics/[METRIC_ID]" + The updated metric must be provided in the request and it's name field must be the same as [METRIC_ID] If the metric does not exist in [PROJECT_ID], then a new metric is created."##), Some(true), Some(false)), @@ -1380,12 +1852,15 @@ fn main() { Some(false)), ]), ("sinks-create", - Some(r##"Creates a sink."##), + Some(r##"Creates a sink that exports specified log entries to a destination. The export of newly-ingested log entries begins immediately, unless the current time is outside the sink's start and end times or the sink's writer_identity is not permitted to write to the destination. A sink can export log entries only from the resource owning the sink."##), "Details at http://byron.github.io/google-apis-rs/google_logging2_beta1_cli/projects_sinks-create", vec![ - (Some(r##"project-name"##), + (Some(r##"parent"##), None, - Some(r##"The resource name of the project in which to create the sink. Example: `"projects/my-project-id"`. The new sink must be provided in the request."##), + Some(r##"Required. The resource in which to create the sink: + "projects/[PROJECT_ID]" + "organizations/[ORGANIZATION_ID]" + Examples: "projects/my-logging-project", "organizations/123456789"."##), Some(true), Some(false)), @@ -1408,12 +1883,15 @@ fn main() { Some(false)), ]), ("sinks-delete", - Some(r##"Deletes a sink."##), + Some(r##"Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted."##), "Details at http://byron.github.io/google-apis-rs/google_logging2_beta1_cli/projects_sinks-delete", vec![ (Some(r##"sink-name"##), None, - Some(r##"The resource name of the sink to delete. Example: `"projects/my-project-id/sinks/my-sink-id"`."##), + Some(r##"Required. The full resource name of the sink to delete, including the parent resource and the sink identifier: + "projects/[PROJECT_ID]/sinks/[SINK_ID]" + "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + It is an error if the sink does not exist. Example: "projects/my-project-id/sinks/my-sink-id". It is an error if the sink does not exist."##), Some(true), Some(false)), @@ -1435,7 +1913,10 @@ fn main() { vec![ (Some(r##"sink-name"##), None, - Some(r##"The resource name of the sink to return. Example: `"projects/my-project-id/sinks/my-sink-id"`."##), + Some(r##"Required. The parent resource name of the sink: + "projects/[PROJECT_ID]/sinks/[SINK_ID]" + "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + Example: "projects/my-project-id/sinks/my-sink-id"."##), Some(true), Some(false)), @@ -1455,9 +1936,9 @@ fn main() { Some(r##"Lists sinks."##), "Details at http://byron.github.io/google-apis-rs/google_logging2_beta1_cli/projects_sinks-list", vec![ - (Some(r##"project-name"##), + (Some(r##"parent"##), None, - Some(r##"Required. The resource name of the project containing the sinks. Example: `"projects/my-logging-project"`."##), + Some(r##"Required. The parent resource whose sinks are to be listed. Examples: "projects/my-logging-project", "organizations/123456789"."##), Some(true), Some(false)), @@ -1474,12 +1955,15 @@ fn main() { Some(false)), ]), ("sinks-update", - Some(r##"Creates or updates a sink."##), + Some(r##"Updates a sink. If the named sink doesn't exist, then this method is identical to sinks.create. If the named sink does exist, then this method replaces the following fields in the existing sink with values from the new sink: destination, filter, output_version_format, start_time, and end_time. The updated filter might also have a new writer_identity; see the unique_writer_identity field."##), "Details at http://byron.github.io/google-apis-rs/google_logging2_beta1_cli/projects_sinks-update", vec![ (Some(r##"sink-name"##), None, - Some(r##"The resource name of the sink to update. Example: `"projects/my-project-id/sinks/my-sink-id"`. The updated sink must be provided in the request and have the same name that is specified in `sinkName`. If the sink does not exist, it is created."##), + Some(r##"Required. The full resource name of the sink to update, including the parent resource and the sink identifier: + "projects/[PROJECT_ID]/sinks/[SINK_ID]" + "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + Example: "projects/my-project-id/sinks/my-sink-id"."##), Some(true), Some(false)), @@ -1507,8 +1991,8 @@ fn main() { let mut app = App::new("logging2-beta1") .author("Sebastian Thiel ") - .version("1.0.0+20160322") - .about("Writes log entries and manages your logs, log sinks, and logs-based metrics.") + .version("1.0.0+20161206") + .about("Writes log entries and manages your Stackdriver Logging configuration.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_logging2_beta1_cli") .arg(Arg::with_name("url") .long("scope") diff --git a/gen/logging2_beta1/Cargo.toml b/gen/logging2_beta1/Cargo.toml index 3137a0201a..feed27bbb8 100644 --- a/gen/logging2_beta1/Cargo.toml +++ b/gen/logging2_beta1/Cargo.toml @@ -4,9 +4,9 @@ [package] name = "google-logging2_beta1" -version = "1.0.0+20160322" +version = "1.0.0+20161206" authors = ["Sebastian Thiel "] -description = "A complete library to interact with logging (protocol v2beta1)" +description = "A complete library to interact with Logging (protocol v2beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/logging2_beta1" homepage = "https://cloud.google.com/logging/docs/" documentation = "http://byron.github.io/google-apis-rs/google_logging2_beta1" diff --git a/gen/logging2_beta1/README.md b/gen/logging2_beta1/README.md index 112e04dfb8..87246bd40a 100644 --- a/gen/logging2_beta1/README.md +++ b/gen/logging2_beta1/README.md @@ -3,22 +3,26 @@ DO NOT EDIT ! This file was generated automatically from 'src/mako/api/README.md.mako' DO NOT EDIT ! --> -The `google-logging2_beta1` library allows access to all features of the *Google logging* service. +The `google-logging2_beta1` library allows access to all features of the *Google Logging* service. -This documentation was generated from *logging* crate version *1.0.0+20160322*, where *20160322* is the exact revision of the *logging:v2beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *Logging* crate version *1.0.0+20161206*, where *20161206* is the exact revision of the *logging:v2beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. -Everything else about the *logging* *v2_beta1* API can be found at the +Everything else about the *Logging* *v2_beta1* API can be found at the [official documentation site](https://cloud.google.com/logging/docs/). # Features Handle the following *Resources* with ease from the central [hub](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.Logging.html) ... +* billing accounts + * [*logs delete*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.BillingAccountLogDeleteCall.html) and [*logs list*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.BillingAccountLogListCall.html) * entries * [*list*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.EntryListCall.html) and [*write*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.EntryWriteCall.html) * [monitored resource descriptors](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.MonitoredResourceDescriptor.html) * [*list*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.MonitoredResourceDescriptorListCall.html) +* organizations + * [*logs delete*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.OrganizationLogDeleteCall.html) and [*logs list*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.OrganizationLogListCall.html) * projects - * [*logs delete*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectLogDeleteCall.html), [*metrics create*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectMetricCreateCall.html), [*metrics delete*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectMetricDeleteCall.html), [*metrics get*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectMetricGetCall.html), [*metrics list*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectMetricListCall.html), [*metrics update*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectMetricUpdateCall.html), [*sinks create*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectSinkCreateCall.html), [*sinks delete*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectSinkDeleteCall.html), [*sinks get*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectSinkGetCall.html), [*sinks list*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectSinkListCall.html) and [*sinks update*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectSinkUpdateCall.html) + * [*logs delete*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectLogDeleteCall.html), [*logs list*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectLogListCall.html), [*metrics create*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectMetricCreateCall.html), [*metrics delete*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectMetricDeleteCall.html), [*metrics get*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectMetricGetCall.html), [*metrics list*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectMetricListCall.html), [*metrics update*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectMetricUpdateCall.html), [*sinks create*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectSinkCreateCall.html), [*sinks delete*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectSinkDeleteCall.html), [*sinks get*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectSinkGetCall.html), [*sinks list*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectSinkListCall.html) and [*sinks update*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectSinkUpdateCall.html) @@ -51,9 +55,11 @@ let r = hub.resource().activity(...).doit() Or specifically ... ```ignore -let r = hub.projects().sinks_get(...).doit() -let r = hub.projects().sinks_update(...).doit() -let r = hub.projects().sinks_create(...).doit() +let r = hub.organizations().logs_delete(...).doit() +let r = hub.projects().logs_delete(...).doit() +let r = hub.projects().metrics_delete(...).doit() +let r = hub.billing_accounts().logs_delete(...).doit() +let r = hub.projects().sinks_delete(...).doit() ``` The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -78,7 +84,6 @@ google-logging2_beta1 = "*" extern crate hyper; extern crate yup_oauth2 as oauth2; extern crate google_logging2_beta1 as logging2_beta1; -use logging2_beta1::LogSink; use logging2_beta1::{Result, Error}; use std::default::Default; use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -96,15 +101,10 @@ let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, hyper::Client::new(), ::default(), None); let mut hub = Logging::new(hyper::Client::new(), auth); -// As the method needs a request, you would usually fill it with the desired information -// into the respective structure. Some of the parts shown here might not be applicable ! -// Values shown here are possibly random and not representative ! -let mut req = LogSink::default(); - // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! -let result = hub.projects().sinks_update(req, "sinkName") +let result = hub.organizations().logs_delete("logName") .doit(); match result { diff --git a/gen/logging2_beta1/src/lib.rs b/gen/logging2_beta1/src/lib.rs index 2ba8a61a3a..7675eb93ab 100644 --- a/gen/logging2_beta1/src/lib.rs +++ b/gen/logging2_beta1/src/lib.rs @@ -2,21 +2,25 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *logging* crate version *1.0.0+20160322*, where *20160322* is the exact revision of the *logging:v2beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *Logging* crate version *1.0.0+20161206*, where *20161206* is the exact revision of the *logging:v2beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! -//! Everything else about the *logging* *v2_beta1* API can be found at the +//! Everything else about the *Logging* *v2_beta1* API can be found at the //! [official documentation site](https://cloud.google.com/logging/docs/). //! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/logging2_beta1). //! # Features //! //! Handle the following *Resources* with ease from the central [hub](struct.Logging.html) ... //! +//! * billing accounts +//! * [*logs delete*](struct.BillingAccountLogDeleteCall.html) and [*logs list*](struct.BillingAccountLogListCall.html) //! * entries //! * [*list*](struct.EntryListCall.html) and [*write*](struct.EntryWriteCall.html) //! * [monitored resource descriptors](struct.MonitoredResourceDescriptor.html) //! * [*list*](struct.MonitoredResourceDescriptorListCall.html) +//! * organizations +//! * [*logs delete*](struct.OrganizationLogDeleteCall.html) and [*logs list*](struct.OrganizationLogListCall.html) //! * projects -//! * [*logs delete*](struct.ProjectLogDeleteCall.html), [*metrics create*](struct.ProjectMetricCreateCall.html), [*metrics delete*](struct.ProjectMetricDeleteCall.html), [*metrics get*](struct.ProjectMetricGetCall.html), [*metrics list*](struct.ProjectMetricListCall.html), [*metrics update*](struct.ProjectMetricUpdateCall.html), [*sinks create*](struct.ProjectSinkCreateCall.html), [*sinks delete*](struct.ProjectSinkDeleteCall.html), [*sinks get*](struct.ProjectSinkGetCall.html), [*sinks list*](struct.ProjectSinkListCall.html) and [*sinks update*](struct.ProjectSinkUpdateCall.html) +//! * [*logs delete*](struct.ProjectLogDeleteCall.html), [*logs list*](struct.ProjectLogListCall.html), [*metrics create*](struct.ProjectMetricCreateCall.html), [*metrics delete*](struct.ProjectMetricDeleteCall.html), [*metrics get*](struct.ProjectMetricGetCall.html), [*metrics list*](struct.ProjectMetricListCall.html), [*metrics update*](struct.ProjectMetricUpdateCall.html), [*sinks create*](struct.ProjectSinkCreateCall.html), [*sinks delete*](struct.ProjectSinkDeleteCall.html), [*sinks get*](struct.ProjectSinkGetCall.html), [*sinks list*](struct.ProjectSinkListCall.html) and [*sinks update*](struct.ProjectSinkUpdateCall.html) //! //! //! @@ -51,9 +55,11 @@ //! Or specifically ... //! //! ```ignore -//! let r = hub.projects().sinks_get(...).doit() -//! let r = hub.projects().sinks_update(...).doit() -//! let r = hub.projects().sinks_create(...).doit() +//! let r = hub.organizations().logs_delete(...).doit() +//! let r = hub.projects().logs_delete(...).doit() +//! let r = hub.projects().metrics_delete(...).doit() +//! let r = hub.billing_accounts().logs_delete(...).doit() +//! let r = hub.projects().sinks_delete(...).doit() //! ``` //! //! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -78,7 +84,6 @@ //! extern crate hyper; //! extern crate yup_oauth2 as oauth2; //! extern crate google_logging2_beta1 as logging2_beta1; -//! use logging2_beta1::LogSink; //! use logging2_beta1::{Result, Error}; //! # #[test] fn egal() { //! use std::default::Default; @@ -97,15 +102,10 @@ //! hyper::Client::new(), //! ::default(), None); //! let mut hub = Logging::new(hyper::Client::new(), auth); -//! // As the method needs a request, you would usually fill it with the desired information -//! // into the respective structure. Some of the parts shown here might not be applicable ! -//! // Values shown here are possibly random and not representative ! -//! let mut req = LogSink::default(); -//! //! // You can configure optional parameters by calling the respective setters at will, and //! // execute the final call using `doit()`. //! // Values shown here are possibly random and not representative ! -//! let result = hub.projects().sinks_update(req, "sinkName") +//! let result = hub.organizations().logs_delete("logName") //! .doit(); //! //! match result { diff --git a/gen/logging2_beta1/src/lib.rs.in b/gen/logging2_beta1/src/lib.rs.in index ece94a3ca8..f7196e312d 100644 --- a/gen/logging2_beta1/src/lib.rs.in +++ b/gen/logging2_beta1/src/lib.rs.in @@ -40,15 +40,15 @@ pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, /// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). #[derive(PartialEq, Eq, Hash)] pub enum Scope { - /// Administrate log data for your projects - Admin, - /// View log data for your projects Read, /// Submit log data for your projects Write, + /// Administrate log data for your projects + Admin, + /// View and manage your data across Google Cloud Platform services CloudPlatform, @@ -59,9 +59,9 @@ pub enum Scope { impl AsRef for Scope { fn as_ref(&self) -> &str { match *self { - Scope::Admin => "https://www.googleapis.com/auth/logging.admin", Scope::Read => "https://www.googleapis.com/auth/logging.read", Scope::Write => "https://www.googleapis.com/auth/logging.write", + Scope::Admin => "https://www.googleapis.com/auth/logging.admin", Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform", Scope::CloudPlatformReadOnly => "https://www.googleapis.com/auth/cloud-platform.read-only", } @@ -90,7 +90,6 @@ impl Default for Scope { /// extern crate hyper; /// extern crate yup_oauth2 as oauth2; /// extern crate google_logging2_beta1 as logging2_beta1; -/// use logging2_beta1::LogSink; /// use logging2_beta1::{Result, Error}; /// # #[test] fn egal() { /// use std::default::Default; @@ -109,15 +108,10 @@ impl Default for Scope { /// hyper::Client::new(), /// ::default(), None); /// let mut hub = Logging::new(hyper::Client::new(), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = LogSink::default(); -/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().sinks_update(req, "sinkName") +/// let result = hub.organizations().logs_delete("logName") /// .doit(); /// /// match result { @@ -157,12 +151,18 @@ impl<'a, C, A> Logging } } + pub fn billing_accounts(&'a self) -> BillingAccountMethods<'a, C, A> { + BillingAccountMethods { hub: &self } + } pub fn entries(&'a self) -> EntryMethods<'a, C, A> { EntryMethods { hub: &self } } pub fn monitored_resource_descriptors(&'a self) -> MonitoredResourceDescriptorMethods<'a, C, A> { MonitoredResourceDescriptorMethods { hub: &self } } + pub fn organizations(&'a self) -> OrganizationMethods<'a, C, A> { + OrganizationMethods { hub: &self } + } pub fn projects(&'a self) -> ProjectMethods<'a, C, A> { ProjectMethods { hub: &self } } @@ -182,7 +182,7 @@ impl<'a, C, A> Logging // ############ // SCHEMAS ### // ########## -/// Result returned from `ListLogEntries`. +/// Result returned from ListLogEntries. /// /// # Activities /// @@ -193,12 +193,9 @@ impl<'a, C, A> Logging /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListLogEntriesResponse { - /// If there are more results than were returned, then `nextPageToken` is included in the response. To get the next set of results, call this method again using the value of `nextPageToken` as `pageToken`. + /// If there might be more results than those appearing in this response, then nextPageToken is included. To get the next set of results, call this method again using the value of nextPageToken as pageToken.If a value for next_page_token appears and the entries field is empty, it means that the search found no log entries so far but it did not have time to search all the possible log entries. Retry the method with this value for page_token to continue the search. Alternatively, consider speeding up the search by changing your filter to specify a single log name or resource type, or to narrow the time range of the search. #[serde(rename="nextPageToken")] pub next_page_token: Option, - /// If partial_success is true, contains the project ids that had errors and the associated errors. - #[serde(rename="projectIdErrors")] - pub project_id_errors: Option>, /// A list of log entries. pub entries: Option>, } @@ -206,6 +203,47 @@ pub struct ListLogEntriesResponse { impl ResponseResult for ListLogEntriesResponse {} +/// Additional information about the source code location that produced the log entry. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LogEntrySourceLocation { + /// Optional. Human-readable name of the function or method being invoked, with optional context such as the class or package name. This information may be used in contexts such as the logs viewer, where a file and line number are less meaningful. The format can vary by language. For example: qual.if.ied.Class.method (Java), dir/package.func (Go), function (Python). + pub function: Option, + /// Optional. Line within the source file. 1-based; 0 indicates no line number available. + pub line: Option, + /// Optional. Source file name. Depending on the runtime environment, this might be a simple name or a fully-qualified name. + pub file: Option, +} + +impl Part for LogEntrySourceLocation {} + + +/// Result returned from ListLogs. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [logs list projects](struct.ProjectLogListCall.html) (response) +/// * [logs list organizations](struct.OrganizationLogListCall.html) (response) +/// * [logs list billing accounts](struct.BillingAccountLogListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListLogsResponse { + /// If there might be more results than those appearing in this response, then nextPageToken is included. To get the next set of results, call this method again using the value of nextPageToken as pageToken. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// A list of log names. For example, "projects/my-project/syslog" or "organizations/123/cloudresourcemanager.googleapis.com%2Factivity". + #[serde(rename="logNames")] + pub log_names: Option>, +} + +impl ResponseResult for ListLogsResponse {} + + /// Result returned from ListLogMetrics. /// /// # Activities @@ -219,7 +257,7 @@ impl ResponseResult for ListLogEntriesResponse {} pub struct ListLogMetricsResponse { /// A list of logs-based metrics. pub metrics: Option>, - /// If there are more results than were returned, then `nextPageToken` is included in the response. To get the next set of results, call this method again using the value of `nextPageToken` as `pageToken`. + /// If there might be more results than appear in this response, then nextPageToken is included. To get the next set of results, call this method again using the value of nextPageToken as pageToken. #[serde(rename="nextPageToken")] pub next_page_token: Option, } @@ -227,15 +265,19 @@ pub struct ListLogMetricsResponse { impl ResponseResult for ListLogMetricsResponse {} -/// An object representing a resource that can be used for monitoring, logging, billing, or other purposes. Examples include virtual machine instances, databases, and storage devices such as disks. The `type` field identifies a MonitoredResourceDescriptor object that describes the resource's schema. Information in the `labels` field identifies the actual resource and its attributes according to the schema. For example, a particular Compute Engine VM instance could be represented by the following object, because the MonitoredResourceDescriptor for `"gce_instance"` has labels `"instance_id"` and `"zone"`: { "type": "gce_instance", "labels": { "instance_id": "my-instance", "zone": "us-central1-a" }} +/// An object representing a resource that can be used for monitoring, logging, billing, or other purposes. Examples include virtual machine instances, databases, and storage devices such as disks. The type field identifies a MonitoredResourceDescriptor object that describes the resource's schema. Information in the labels field identifies the actual resource and its attributes according to the schema. For example, a particular Compute Engine VM instance could be represented by the following object, because the MonitoredResourceDescriptor for "gce_instance" has labels "instance_id" and "zone": +/// { "type": "gce_instance", +/// "labels": { "instance_id": "12345678901234", +/// "zone": "us-central1-a" }} +/// /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct MonitoredResource { - /// Required. Values for all of the labels listed in the associated monitored resource descriptor. For example, Cloud SQL databases use the labels `"database_id"` and `"zone"`. + /// Required. Values for all of the labels listed in the associated monitored resource descriptor. For example, Cloud SQL databases use the labels "database_id" and "zone". pub labels: Option>, - /// Required. The monitored resource type. This field must match the `type` field of a MonitoredResourceDescriptor object. For example, the type of a Cloud SQL database is `"cloudsql_database"`. + /// Required. The monitored resource type. This field must match the type field of a MonitoredResourceDescriptor object. For example, the type of a Cloud SQL database is "cloudsql_database". #[serde(rename="type")] pub type_: Option, } @@ -251,9 +293,9 @@ impl Part for MonitoredResource {} pub struct LogEntryOperation { /// Optional. Set this to True if this is the last log entry in the operation. pub last: Option, - /// Required. An arbitrary operation identifier. Log entries with the same identifier are assumed to be part of the same operation. + /// Optional. An arbitrary operation identifier. Log entries with the same identifier are assumed to be part of the same operation. pub id: Option, - /// Required. An arbitrary producer identifier. The combination of `id` and `producer` must be globally unique. Examples for `producer`: `"MyDivision.MyBigCompany.com"`, "github.com/MyProject/MyApplication"`. + /// Optional. An arbitrary producer identifier. The combination of id and producer must be globally unique. Examples for producer: "MyDivision.MyBigCompany.com", "github.com/MyProject/MyApplication". pub producer: Option, /// Optional. Set this to True if this is the first log entry in the operation. pub first: Option, @@ -262,7 +304,109 @@ pub struct LogEntryOperation { impl Part for LogEntryOperation {} -/// A common proto for logging HTTP requests. +/// Describes a sink used to export log entries to one of the following destinations in any project: a Cloud Storage bucket, a BigQuery dataset, or a Cloud Pub/Sub topic. A logs filter controls which log entries are exported. The sink must be created within a project or organization. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [sinks get projects](struct.ProjectSinkGetCall.html) (response) +/// * [sinks update projects](struct.ProjectSinkUpdateCall.html) (request|response) +/// * [sinks create projects](struct.ProjectSinkCreateCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LogSink { + /// Optional. An advanced logs filter. The only exported log entries are those that are in the resource owning the sink and that match the filter. The filter must use the log entry format specified by the output_version_format parameter. For example, in the v2 format: + /// logName="projects/[PROJECT_ID]/logs/[LOG_ID]" AND severity>=ERROR + /// + pub filter: Option, + /// Required. The export destination: + /// "storage.googleapis.com/[GCS_BUCKET]" + /// "bigquery.googleapis.com/projects/[PROJECT_ID]/datasets/[DATASET]" + /// "pubsub.googleapis.com/projects/[PROJECT_ID]/topics/[TOPIC_ID]" + /// The sink's writer_identity, set when the sink is created, must have permission to write to the destination or else the log entries are not exported. For more information, see Exporting Logs With Sinks. + pub destination: Option, + /// Required. The client-assigned sink identifier, unique within the project. Example: "my-syslog-errors-to-pubsub". Sink identifiers are limited to 100 characters and can include only the following characters: upper and lower-case alphanumeric characters, underscores, hyphens, and periods. + pub name: Option, + /// Optional. The time at which this sink will begin exporting log entries. Log entries are exported only if their timestamp is not earlier than the start time. The default value of this field is the time the sink is created or updated. + #[serde(rename="startTime")] + pub start_time: Option, + /// Optional. The log entry format to use for this sink's exported log entries. The v2 format is used by default. The v1 format is deprecated and should be used only as part of a migration effort to v2. See Migration to the v2 API. + #[serde(rename="outputVersionFormat")] + pub output_version_format: Option, + /// Output only. An IAM identity—a service account or group—under which Stackdriver Logging writes the exported log entries to the sink's destination. This field is set by sinks.create and sinks.update, based on the setting of unique_writer_identity in those methods.Until you grant this identity write-access to the destination, log entry exports from this sink will fail. For more information, see Granting access for a resource. Consult the destination service's documentation to determine the appropriate IAM roles to assign to the identity. + #[serde(rename="writerIdentity")] + pub writer_identity: Option, + /// Optional. The time at which this sink will stop exporting log entries. Log entries are exported only if their timestamp is earlier than the end time. If this field is not supplied, there is no end time. If both a start time and an end time are provided, then the end time must be later than the start time. + #[serde(rename="endTime")] + pub end_time: Option, +} + +impl RequestValue for LogSink {} +impl ResponseResult for LogSink {} + + +/// The parameters to ListLogEntries. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list entries](struct.EntryListCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListLogEntriesRequest { + /// Optional. How the results should be sorted. Presently, the only permitted values are "timestamp asc" (default) and "timestamp desc". The first option returns entries in order of increasing values of LogEntry.timestamp (oldest first), and the second option returns entries in order of decreasing timestamps (newest first). Entries with equal timestamps are returned in order of LogEntry.insertId. + #[serde(rename="orderBy")] + pub order_by: Option, + /// Required. Names of one or more resources from which to retrieve log entries: + /// "projects/[PROJECT_ID]" + /// "organizations/[ORGANIZATION_ID]" + /// Projects listed in the project_ids field are added to this list. + #[serde(rename="resourceNames")] + pub resource_names: Option>, + /// Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available. + #[serde(rename="pageSize")] + pub page_size: Option, + /// Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call. + #[serde(rename="pageToken")] + pub page_token: Option, + /// Deprecated. Use resource_names instead. One or more project identifiers or project numbers from which to retrieve log entries. Example: "my-project-1A". If present, these project identifiers are converted to resource name format and added to the list of resources in resource_names. + #[serde(rename="projectIds")] + pub project_ids: Option>, + /// Optional. A filter that chooses which log entries to return. See Advanced Logs Filters. Only log entries that match the filter are returned. An empty filter matches all log entries in the resources listed in resource_names. Referencing a parent resource that is not listed in resource_names will cause the filter to return no results. The maximum length of the filter is 20000 characters. + pub filter: Option, +} + +impl RequestValue for ListLogEntriesRequest {} + + +/// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: +/// service Foo { +/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); +/// } +/// The JSON representation for Empty is empty JSON object {}. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [logs delete organizations](struct.OrganizationLogDeleteCall.html) (response) +/// * [logs delete projects](struct.ProjectLogDeleteCall.html) (response) +/// * [metrics delete projects](struct.ProjectMetricDeleteCall.html) (response) +/// * [logs delete billing accounts](struct.BillingAccountLogDeleteCall.html) (response) +/// * [sinks delete projects](struct.ProjectSinkDeleteCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Empty { _never_set: Option } + +impl ResponseResult for Empty {} + + +/// A common proto for logging HTTP requests. Only contains semantics defined by the HTTP specification. Product-specific logging information MUST be defined in a separate message. /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -270,30 +414,35 @@ impl Part for LogEntryOperation {} pub struct HttpRequest { /// The response code indicating the status of response. Examples: 200, 404. pub status: Option, - /// Whether or not the response was validated with the origin server before being served from cache. This field is only meaningful if `cache_hit` is True. + /// Whether or not the response was validated with the origin server before being served from cache. This field is only meaningful if cache_hit is True. #[serde(rename="cacheValidatedWithOriginServer")] pub cache_validated_with_origin_server: Option, - /// The request method. Examples: `"GET"`, `"HEAD"`, `"PUT"`, `"POST"`. - #[serde(rename="requestMethod")] - pub request_method: Option, + /// The request processing latency on the server, from the time the request was received until the response was sent. + pub latency: Option, /// The number of HTTP response bytes inserted into cache. Set only when a cache fill was attempted. #[serde(rename="cacheFillBytes")] pub cache_fill_bytes: Option, - /// The scheme (http, https), the host name, the path and the query portion of the URL that was requested. Example: `"http://example.com/some/info?color=red"`. + /// The scheme (http, https), the host name, the path and the query portion of the URL that was requested. Example: "http://example.com/some/info?color=red". #[serde(rename="requestUrl")] pub request_url: Option, - /// Whether or not a cache lookup was attempted. - #[serde(rename="cacheLookup")] - pub cache_lookup: Option, /// Whether or not an entity was served from cache (with or without validation). #[serde(rename="cacheHit")] pub cache_hit: Option, - /// The referer URL of the request, as defined in [HTTP/1.1 Header Field Definitions](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). + /// The IP address (IPv4 or IPv6) of the origin server that the request was sent to. + #[serde(rename="serverIp")] + pub server_ip: Option, + /// Whether or not a cache lookup was attempted. + #[serde(rename="cacheLookup")] + pub cache_lookup: Option, + /// The request method. Examples: "GET", "HEAD", "PUT", "POST". + #[serde(rename="requestMethod")] + pub request_method: Option, + /// The referer URL of the request, as defined in HTTP/1.1 Header Field Definitions (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). pub referer: Option, - /// The IP address (IPv4 or IPv6) of the client that issued the HTTP request. Examples: `"192.168.1.1"`, `"FE80::0202:B3FF:FE1E:8329"`. + /// The IP address (IPv4 or IPv6) of the client that issued the HTTP request. Examples: "192.168.1.1", "FE80::0202:B3FF:FE1E:8329". #[serde(rename="remoteIp")] pub remote_ip: Option, - /// The user agent sent by the client. Example: `"Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET CLR 1.0.3705)"`. + /// The user agent sent by the client. Example: "Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET CLR 1.0.3705)". #[serde(rename="userAgent")] pub user_agent: Option, /// The size of the HTTP request message in bytes, including the request headers and the request body. @@ -307,101 +456,6 @@ pub struct HttpRequest { impl Part for HttpRequest {} -/// Describes a sink used to export log entries outside Cloud Logging. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [sinks get projects](struct.ProjectSinkGetCall.html) (response) -/// * [sinks update projects](struct.ProjectSinkUpdateCall.html) (request|response) -/// * [sinks create projects](struct.ProjectSinkCreateCall.html) (request|response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct LogSink { - /// An [advanced logs filter](/logging/docs/view/advanced_filters). Only log entries matching that filter are exported. The filter must be consistent with the log entry format specified by the `outputVersionFormat` parameter, regardless of the format of the log entry that was originally written to Cloud Logging. Example (V2 format): `"logName=projects/my-projectid/logs/syslog AND severity>=ERROR"`. - pub filter: Option, - /// The export destination. See [Exporting Logs With Sinks](/logging/docs/api/tasks/exporting-logs). Examples: `"storage.googleapis.com/a-bucket"`, `"bigquery.googleapis.com/projects/a-project-id/datasets/a-dataset"`. - pub destination: Option, - /// Required. The client-assigned sink identifier. Example: `"my-severe-errors-to-pubsub"`. Sink identifiers are limited to 1000 characters and can include only the following characters: `A-Z`, `a-z`, `0-9`, and the special characters `_-.`. - pub name: Option, - /// The log entry version to use for this sink's exported log entries. This version does not have to correspond to the version of the log entry when it was written to Cloud Logging. - #[serde(rename="outputVersionFormat")] - pub output_version_format: Option, -} - -impl RequestValue for LogSink {} -impl ResponseResult for LogSink {} - - -/// The parameters to `ListLogEntries`. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [list entries](struct.EntryListCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListLogEntriesRequest { - /// Optional. How the results should be sorted. Presently, the only permitted values are `"timestamp asc"` (default) and `"timestamp desc"`. The first option returns entries in order of increasing values of `LogEntry.timestamp` (oldest first), and the second option returns entries in order of decreasing timestamps (newest first). Entries with equal timestamps are returned in order of `LogEntry.insertId`. - #[serde(rename="orderBy")] - pub order_by: Option, - /// Optional. An [advanced logs filter](/logging/docs/view/advanced_filters). The filter is compared against all log entries in the projects specified by `projectIds`. Only entries that match the filter are retrieved. An empty filter matches all log entries. - pub filter: Option, - /// Optional. The maximum number of results to return from this request. You must check for presence of `nextPageToken` to determine if additional results are available, which you can retrieve by passing the `nextPageToken` value as the `pageToken` parameter in the next request. - #[serde(rename="pageSize")] - pub page_size: Option, - /// Optional. If the `pageToken` parameter is supplied, then the next page of results is retrieved. The `pageToken` parameter must be set to the value of the `nextPageToken` from the previous response. The values of `projectIds`, `filter`, and `orderBy` must be the same as in the previous request. - #[serde(rename="pageToken")] - pub page_token: Option, - /// Required. One or more project IDs or project numbers from which to retrieve log entries. Examples of a project ID: `"my-project-1A"`, `"1234567890"`. - #[serde(rename="projectIds")] - pub project_ids: Option>, - /// Optional. If true, read access to all projects is not required and results will be returned for the subset of projects for which read access is permitted (empty subset is permitted). - #[serde(rename="partialSuccess")] - pub partial_success: Option, -} - -impl RequestValue for ListLogEntriesRequest {} - - -/// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON representation for `Empty` is empty JSON object `{}`. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [logs delete projects](struct.ProjectLogDeleteCall.html) (response) -/// * [metrics delete projects](struct.ProjectMetricDeleteCall.html) (response) -/// * [sinks delete projects](struct.ProjectSinkDeleteCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Empty { _never_set: Option } - -impl ResponseResult for Empty {} - - -/// The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). The error model is designed to be: - Simple to use and understand for most users - Flexible enough to meet unexpected needs # Overview The `Status` message contains three pieces of data: error code, error message, and error details. The error code should be an enum value of google.rpc.Code, but it may accept additional error codes if needed. The error message should be a developer-facing English message that helps developers *understand* and *resolve* the error. If a localized user-facing error message is needed, put the localized message in the error details or localize it in the client. The optional error details may contain arbitrary information about the error. There is a predefined set of error detail types in the package `google.rpc` which can be used for common error conditions. # Language mapping The `Status` message is the logical representation of the error model, but it is not necessarily the actual wire format. When the `Status` message is exposed in different client libraries and different wire protocols, it can be mapped differently. For example, it will likely be mapped to some exceptions in Java, but more likely mapped to some error codes in C. # Other uses The error model and the `Status` message can be used in a variety of environments, either with or without APIs, to provide a consistent developer experience across different environments. Example uses of this error model include: - Partial errors. If a service needs to return partial errors to the client, it may embed the `Status` in the normal response to indicate the partial errors. - Workflow errors. A typical workflow has multiple steps. Each step may have a `Status` message for error reporting purpose. - Batch operations. If a client uses batch request and batch response, the `Status` message should be used directly inside batch response, one for each error sub-response. - Asynchronous operations. If an API call embeds asynchronous operation results in its response, the status of those operations should be represented directly using the `Status` message. - Logging. If some API errors are stored in logs, the message `Status` could be used directly after any stripping needed for security/privacy reasons. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Status { - /// A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client. - pub message: Option, - /// The status code, which should be an enum value of google.rpc.Code. - pub code: Option, - /// A list of messages that carry the error details. There will be a common set of message types for APIs to use. - pub details: Option>>, -} - -impl Part for Status {} - - /// Result returned from ListMonitoredResourceDescriptors. /// /// # Activities @@ -413,7 +467,7 @@ impl Part for Status {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListMonitoredResourceDescriptorsResponse { - /// If there are more results than were returned, then `nextPageToken` is included in the response. To get the next set of results, call this method again using the value of `nextPageToken` as `pageToken`. + /// If there might be more results than those appearing in this response, then nextPageToken is included. To get the next set of results, call this method again using the value of nextPageToken as pageToken. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// A list of resource descriptors. @@ -424,7 +478,7 @@ pub struct ListMonitoredResourceDescriptorsResponse { impl ResponseResult for ListMonitoredResourceDescriptorsResponse {} -/// Result returned from `ListSinks`. +/// Result returned from ListSinks. /// /// # Activities /// @@ -435,7 +489,7 @@ impl ResponseResult for ListMonitoredResourceDescriptorsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListSinksResponse { - /// If there are more results than were returned, then `nextPageToken` is included in the response. To get the next set of results, call this method again using the value of `nextPageToken` as `pageToken`. + /// If there might be more results than appear in this response, then nextPageToken is included. To get the next set of results, call the same method again using the value of nextPageToken as pageToken. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// A list of sinks. @@ -471,17 +525,24 @@ impl ResponseResult for WriteLogEntriesResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct WriteLogEntriesRequest { - /// Optional. A default log resource name for those log entries in `entries` that do not specify their own `logName`. Example: `"projects/my-project/logs/syslog"`. See LogEntry. + /// Optional. A default log resource name that is assigned to all log entries in entries that do not specify a value for log_name: + /// "projects/[PROJECT_ID]/logs/[LOG_ID]" + /// "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" + /// [LOG_ID] must be URL-encoded. For example, "projects/my-project-id/logs/syslog" or "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity". For more information about log names, see LogEntry. #[serde(rename="logName")] pub log_name: Option, /// Optional. Whether valid entries should be written even if some other entries fail due to INVALID_ARGUMENT or PERMISSION_DENIED errors. If any entry is not written, the response status will be the error associated with one of the failed entries and include error details in the form of WriteLogEntriesPartialErrors. #[serde(rename="partialSuccess")] pub partial_success: Option, - /// Optional. User-defined `key:value` items that are added to the `labels` field of each log entry in `entries`, except when a log entry specifies its own `key:value` item with the same key. Example: `{ "size": "large", "color":"red" }` + /// Optional. Default labels that are added to the labels field of all log entries in entries. If a log entry already has a label with the same key as a label in this parameter, then the log entry's label is not changed. See LogEntry. pub labels: Option>, - /// Optional. A default monitored resource for those log entries in `entries` that do not specify their own `resource`. + /// Optional. A default monitored resource object that is assigned to all log entries in entries that do not specify a value for resource. Example: + /// { "type": "gce_instance", + /// "labels": { + /// "zone": "us-central1-a", "instance_id": "00000000000000000000" }} + /// See LogEntry. pub resource: Option, - /// Required. The log entries to write. The log entries must have values for all required fields. + /// Required. The log entries to write. Values supplied for the fields log_name, resource, and labels in this entries.write request are added to those log entries that do not provide their own values for the fields.To improve throughput and to avoid exceeding the quota limit for calls to entries.write, you should write multiple log entries at once rather than calling this method for each individual log entry. pub entries: Option>, } @@ -517,36 +578,43 @@ pub struct LogEntry { pub http_request: Option, /// Required. The monitored resource associated with this log entry. Example: a log entry that reports a database error would be associated with the monitored resource designating the particular database that reported the error. pub resource: Option, - /// Optional. The severity of the log entry. The default value is `LogSeverity.DEFAULT`. - pub severity: Option, /// The log entry payload, represented as a Unicode string (UTF-8). #[serde(rename="textPayload")] pub text_payload: Option, - /// Optional. The time the event described by the log entry occurred. If omitted, Cloud Logging will use the time the log entry is written. + /// Optional. Resource name of the trace associated with the log entry, if any. If it contains a relative resource name, the name is assumed to be relative to //tracing.googleapis.com. Example: projects/my-projectid/traces/06796866738c859f2f19b7cfb3214824 + pub trace: Option, + /// Optional. The time the event described by the log entry occurred. If omitted, Stackdriver Logging will use the time the log entry is received. pub timestamp: Option, /// Optional. A set of user-defined (key, value) data that provides additional information about the log entry. pub labels: Option>, - /// The log entry payload, represented as a protocol buffer. You can only use `protoPayload` values that belong to a set of approved types. + /// The log entry payload, represented as a protocol buffer. Some Google Cloud Platform services use this field for their log entry payloads. #[serde(rename="protoPayload")] pub proto_payload: Option>, /// The log entry payload, represented as a structure that is expressed as a JSON object. #[serde(rename="jsonPayload")] pub json_payload: Option>, - /// Required. The resource name of the log to which this log entry belongs. The format of the name is `"projects/ - /// /logs/"`. Examples: `"projects/my-projectid/logs/syslog"`, `"projects/1234567890/logs/library.googleapis.com%2Fbook_log"`. The log ID part of resource name must be less than 512 characters long and can only include the following characters: upper and lower case alphanumeric characters: [A-Za-z0-9]; and punctuation characters: forward-slash, underscore, hyphen, and period. Forward-slash (`/`) characters in the log ID must be URL-encoded. + /// Required. The resource name of the log to which this log entry belongs: + /// "projects/[PROJECT_ID]/logs/[LOG_ID]" + /// "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" + /// [LOG_ID] must be URL-encoded within log_name. Example: "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity". [LOG_ID] must be less than 512 characters long and can only include the following characters: upper and lower case alphanumeric characters, forward-slash, underscore, hyphen, and period.For backward compatibility, if log_name begins with a forward-slash, such as /projects/..., then the log entry is ingested as usual but the forward-slash is removed. Listing the log entry will not show the leading slash and filtering for a log name with a leading slash will never return any results. #[serde(rename="logName")] pub log_name: Option, - /// Optional. A unique ID for the log entry. If you provide this field, the logging service considers other log entries in the same log with the same ID as duplicates which can be removed. If omitted, Cloud Logging will generate a unique ID for this log entry. + /// Optional. A unique ID for the log entry. If you provide this field, the logging service considers other log entries in the same project with the same ID as duplicates which can be removed. If omitted, Stackdriver Logging will generate a unique ID for this log entry. #[serde(rename="insertId")] pub insert_id: Option, /// Optional. Information about an operation associated with the log entry, if applicable. pub operation: Option, + /// Optional. Source code location information associated with the log entry, if any. + #[serde(rename="sourceLocation")] + pub source_location: Option, + /// Optional. The severity of the log entry. The default value is LogSeverity.DEFAULT. + pub severity: Option, } impl Part for LogEntry {} -/// Describes a logs-based metric. The value of the metric is the number of log entries that match a logs filter. +/// Describes a logs-based metric. The value of the metric is the number of log entries that match a logs filter in a given time interval. /// /// # Activities /// @@ -559,19 +627,23 @@ impl Part for LogEntry {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct LogMetric { - /// An [advanced logs filter](/logging/docs/view/advanced_filters). Example: `"logName:syslog AND severity>=ERROR"`. + /// Required. An advanced logs filter which is used to match log entries. Example: + /// "resource.type=gae_app AND severity>=ERROR" + /// The maximum length of the filter is 20000 characters. pub filter: Option, - /// Required. The client-assigned metric identifier. Example: `"severe_errors"`. Metric identifiers are limited to 1000 characters and can include only the following characters: `A-Z`, `a-z`, `0-9`, and the special characters `_-.,+!*',()%/\`. The forward-slash character (`/`) denotes a hierarchy of name pieces, and it cannot be the first character of the name. - pub name: Option, - /// A description of this metric, which is used in documentation. + /// Output only. The API version that created or updated this metric. The version also dictates the syntax of the filter expression. When a value for this field is missing, the default value of V2 should be assumed. + pub version: Option, + /// Optional. A description of this metric, which is used in documentation. pub description: Option, + /// Required. The client-assigned metric identifier. Examples: "error_count", "nginx/requests".Metric identifiers are limited to 100 characters and can include only the following characters: A-Z, a-z, 0-9, and the special characters _-.,+!*',()%/. The forward-slash character (/) denotes a hierarchy of name pieces, and it cannot be the first character of the name.The metric identifier in this field must not be URL-encoded (https://en.wikipedia.org/wiki/Percent-encoding). However, when the metric identifier appears as the [METRIC_ID] part of a metric_name API parameter, then the metric identifier must be URL-encoded. Example: "projects/my-project/metrics/nginx%2Frequests". + pub name: Option, } impl RequestValue for LogMetric {} impl ResponseResult for LogMetric {} -/// An object that describes the schema of a MonitoredResource object using a type name and a set of labels. For example, the monitored resource descriptor for Google Compute Engine VM instances has a type of `"gce_instance"` and specifies the use of the labels `"instance_id"` and `"zone"` to identify particular VM instances. Different APIs can support different monitored resource types. APIs generally provide a `list` method that returns the monitored resource descriptors used by the API. +/// An object that describes the schema of a MonitoredResource object using a type name and a set of labels. For example, the monitored resource descriptor for Google Compute Engine VM instances has a type of "gce_instance" and specifies the use of the labels "instance_id" and "zone" to identify particular VM instances.Different APIs can support different monitored resource types. APIs generally provide a list method that returns the monitored resource descriptors used by the API. /// /// # Activities /// @@ -582,18 +654,18 @@ impl ResponseResult for LogMetric {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct MonitoredResourceDescriptor { - /// Required. The monitored resource type. For example, the type `"cloudsql_database"` represents databases in Google Cloud SQL. - #[serde(rename="type")] - pub type_: Option, - /// Required. A set of labels used to describe instances of this monitored resource type. For example, an individual Google Cloud SQL database is identified by values for the labels `"database_id"` and `"zone"`. - pub labels: Option>, - /// Optional. A concise name for the monitored resource type that might be displayed in user interfaces. For example, `"Google Cloud SQL Database"`. + /// Optional. A concise name for the monitored resource type that might be displayed in user interfaces. It should be a Title Cased Noun Phrase, without any article or other determiners. For example, "Google Cloud SQL Database". #[serde(rename="displayName")] pub display_name: Option, - /// Optional. The resource name of the monitored resource descriptor: `"projects/{project_id}/monitoredResourceDescriptors/{type}"` where {type} is the value of the `type` field in this object and {project_id} is a project ID that provides API-specific context for accessing the type. APIs that do not use project information can use the resource name format `"monitoredResourceDescriptors/{type}"`. - pub name: Option, + /// Required. A set of labels used to describe instances of this monitored resource type. For example, an individual Google Cloud SQL database is identified by values for the labels "database_id" and "zone". + pub labels: Option>, + /// Required. The monitored resource type. For example, the type "cloudsql_database" represents databases in Google Cloud SQL. The maximum length of this value is 256 characters. + #[serde(rename="type")] + pub type_: Option, /// Optional. A detailed description of the monitored resource type that might be used in documentation. pub description: Option, + /// Optional. The resource name of the monitored resource descriptor: "projects/{project_id}/monitoredResourceDescriptors/{type}" where {type} is the value of the type field in this object and {project_id} is a project ID that provides API-specific context for accessing the type. APIs that do not use project information can use the resource name format "monitoredResourceDescriptors/{type}". + pub name: Option, } impl Resource for MonitoredResourceDescriptor {} @@ -604,6 +676,172 @@ impl Resource for MonitoredResourceDescriptor {} // MethodBuilders ### // ################# +/// A builder providing access to all methods supported on *organization* resources. +/// It is not used directly, but through the `Logging` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_logging2_beta1 as logging2_beta1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use logging2_beta1::Logging; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Logging::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `logs_delete(...)` and `logs_list(...)` +/// // to build up your call. +/// let rb = hub.organizations(); +/// # } +/// ``` +pub struct OrganizationMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, +} + +impl<'a, C, A> MethodsBuilder for OrganizationMethods<'a, C, A> {} + +impl<'a, C, A> OrganizationMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Deletes all the log entries in a log. The log reappears if it receives new entries. + /// + /// # Arguments + /// + /// * `logName` - Required. The resource name of the log to delete: + /// "projects/[PROJECT_ID]/logs/[LOG_ID]" + /// "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" + /// [LOG_ID] must be URL-encoded. For example, "projects/my-project-id/logs/syslog", "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity". For more information about log names, see LogEntry. + pub fn logs_delete(&self, log_name: &str) -> OrganizationLogDeleteCall<'a, C, A> { + OrganizationLogDeleteCall { + hub: self.hub, + _log_name: log_name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists the logs in projects or organizations. Only logs that have entries are listed. + /// + /// # Arguments + /// + /// * `parent` - Required. The resource name that owns the logs: + /// "projects/[PROJECT_ID]" + /// "organizations/[ORGANIZATION_ID]" + /// + pub fn logs_list(&self, parent: &str) -> OrganizationLogListCall<'a, C, A> { + OrganizationLogListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *billingAccount* resources. +/// It is not used directly, but through the `Logging` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_logging2_beta1 as logging2_beta1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use logging2_beta1::Logging; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Logging::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `logs_delete(...)` and `logs_list(...)` +/// // to build up your call. +/// let rb = hub.billing_accounts(); +/// # } +/// ``` +pub struct BillingAccountMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, +} + +impl<'a, C, A> MethodsBuilder for BillingAccountMethods<'a, C, A> {} + +impl<'a, C, A> BillingAccountMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Deletes all the log entries in a log. The log reappears if it receives new entries. + /// + /// # Arguments + /// + /// * `logName` - Required. The resource name of the log to delete: + /// "projects/[PROJECT_ID]/logs/[LOG_ID]" + /// "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" + /// [LOG_ID] must be URL-encoded. For example, "projects/my-project-id/logs/syslog", "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity". For more information about log names, see LogEntry. + pub fn logs_delete(&self, log_name: &str) -> BillingAccountLogDeleteCall<'a, C, A> { + BillingAccountLogDeleteCall { + hub: self.hub, + _log_name: log_name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists the logs in projects or organizations. Only logs that have entries are listed. + /// + /// # Arguments + /// + /// * `parent` - Required. The resource name that owns the logs: + /// "projects/[PROJECT_ID]" + /// "organizations/[ORGANIZATION_ID]" + /// + pub fn logs_list(&self, parent: &str) -> BillingAccountLogListCall<'a, C, A> { + BillingAccountLogListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + /// A builder providing access to all methods supported on *monitoredResourceDescriptor* resources. /// It is not used directly, but through the `Logging` hub. /// @@ -644,7 +882,7 @@ impl<'a, C, A> MonitoredResourceDescriptorMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists monitored resource descriptors that are used by Cloud Logging. + /// Lists the descriptors for monitored resource types used by Stackdriver Logging. pub fn list(&self) -> MonitoredResourceDescriptorListCall<'a, C, A> { MonitoredResourceDescriptorListCall { hub: self.hub, @@ -682,7 +920,7 @@ impl<'a, C, A> MonitoredResourceDescriptorMethods<'a, C, A> { /// ::default(), None); /// let mut hub = Logging::new(hyper::Client::new(), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `logs_delete(...)`, `metrics_create(...)`, `metrics_delete(...)`, `metrics_get(...)`, `metrics_list(...)`, `metrics_update(...)`, `sinks_create(...)`, `sinks_delete(...)`, `sinks_get(...)`, `sinks_list(...)` and `sinks_update(...)` +/// // like `logs_delete(...)`, `logs_list(...)`, `metrics_create(...)`, `metrics_delete(...)`, `metrics_get(...)`, `metrics_list(...)`, `metrics_update(...)`, `sinks_create(...)`, `sinks_delete(...)`, `sinks_get(...)`, `sinks_list(...)` and `sinks_update(...)` /// // to build up your call. /// let rb = hub.projects(); /// # } @@ -703,11 +941,11 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// /// # Arguments /// - /// * `projectName` - Required. The resource name of the project containing the sinks. Example: `"projects/my-logging-project"`. - pub fn sinks_list(&self, project_name: &str) -> ProjectSinkListCall<'a, C, A> { + /// * `parent` - Required. The parent resource whose sinks are to be listed. Examples: "projects/my-logging-project", "organizations/123456789". + pub fn sinks_list(&self, parent: &str) -> ProjectSinkListCall<'a, C, A> { ProjectSinkListCall { hub: self.hub, - _project_name: project_name.to_string(), + _parent: parent.to_string(), _page_token: Default::default(), _page_size: Default::default(), _delegate: Default::default(), @@ -718,11 +956,14 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Deletes a log and all its log entries. The log will reappear if it receives new entries. + /// Deletes all the log entries in a log. The log reappears if it receives new entries. /// /// # Arguments /// - /// * `logName` - Required. The resource name of the log to delete. Example: `"projects/my-project/logs/syslog"`. + /// * `logName` - Required. The resource name of the log to delete: + /// "projects/[PROJECT_ID]/logs/[LOG_ID]" + /// "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" + /// [LOG_ID] must be URL-encoded. For example, "projects/my-project-id/logs/syslog", "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity". For more information about log names, see LogEntry. pub fn logs_delete(&self, log_name: &str) -> ProjectLogDeleteCall<'a, C, A> { ProjectLogDeleteCall { hub: self.hub, @@ -739,7 +980,10 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// /// # Arguments /// - /// * `sinkName` - The resource name of the sink to return. Example: `"projects/my-project-id/sinks/my-sink-id"`. + /// * `sinkName` - Required. The parent resource name of the sink: + /// "projects/[PROJECT_ID]/sinks/[SINK_ID]" + /// "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + /// Example: "projects/my-project-id/sinks/my-sink-id". pub fn sinks_get(&self, sink_name: &str) -> ProjectSinkGetCall<'a, C, A> { ProjectSinkGetCall { hub: self.hub, @@ -750,133 +994,6 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { } } - /// Create a builder to help you perform the following task: - /// - /// Gets a logs-based metric. - /// - /// # Arguments - /// - /// * `metricName` - The resource name of the desired metric. Example: `"projects/my-project-id/metrics/my-metric-id"`. - pub fn metrics_get(&self, metric_name: &str) -> ProjectMetricGetCall<'a, C, A> { - ProjectMetricGetCall { - hub: self.hub, - _metric_name: metric_name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Creates or updates a sink. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `sinkName` - The resource name of the sink to update. Example: `"projects/my-project-id/sinks/my-sink-id"`. The updated sink must be provided in the request and have the same name that is specified in `sinkName`. If the sink does not exist, it is created. - pub fn sinks_update(&self, request: LogSink, sink_name: &str) -> ProjectSinkUpdateCall<'a, C, A> { - ProjectSinkUpdateCall { - hub: self.hub, - _request: request, - _sink_name: sink_name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Deletes a logs-based metric. - /// - /// # Arguments - /// - /// * `metricName` - The resource name of the metric to delete. Example: `"projects/my-project-id/metrics/my-metric-id"`. - pub fn metrics_delete(&self, metric_name: &str) -> ProjectMetricDeleteCall<'a, C, A> { - ProjectMetricDeleteCall { - hub: self.hub, - _metric_name: metric_name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Creates a sink. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `projectName` - The resource name of the project in which to create the sink. Example: `"projects/my-project-id"`. The new sink must be provided in the request. - pub fn sinks_create(&self, request: LogSink, project_name: &str) -> ProjectSinkCreateCall<'a, C, A> { - ProjectSinkCreateCall { - hub: self.hub, - _request: request, - _project_name: project_name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Creates a logs-based metric. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `projectName` - The resource name of the project in which to create the metric. Example: `"projects/my-project-id"`. The new metric must be provided in the request. - pub fn metrics_create(&self, request: LogMetric, project_name: &str) -> ProjectMetricCreateCall<'a, C, A> { - ProjectMetricCreateCall { - hub: self.hub, - _request: request, - _project_name: project_name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Deletes a sink. - /// - /// # Arguments - /// - /// * `sinkName` - The resource name of the sink to delete. Example: `"projects/my-project-id/sinks/my-sink-id"`. - pub fn sinks_delete(&self, sink_name: &str) -> ProjectSinkDeleteCall<'a, C, A> { - ProjectSinkDeleteCall { - hub: self.hub, - _sink_name: sink_name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Lists logs-based metrics. - /// - /// # Arguments - /// - /// * `projectName` - Required. The resource name of the project containing the metrics. Example: `"projects/my-project-id"`. - pub fn metrics_list(&self, project_name: &str) -> ProjectMetricListCall<'a, C, A> { - ProjectMetricListCall { - hub: self.hub, - _project_name: project_name.to_string(), - _page_token: Default::default(), - _page_size: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - /// Create a builder to help you perform the following task: /// /// Creates or updates a logs-based metric. @@ -884,7 +1001,9 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `metricName` - The resource name of the metric to update. Example: `"projects/my-project-id/metrics/my-metric-id"`. The updated metric must be provided in the request and have the same identifier that is specified in `metricName`. If the metric does not exist, it is created. + /// * `metricName` - The resource name of the metric to update: + /// "projects/[PROJECT_ID]/metrics/[METRIC_ID]" + /// The updated metric must be provided in the request and it's name field must be the same as [METRIC_ID] If the metric does not exist in [PROJECT_ID], then a new metric is created. pub fn metrics_update(&self, request: LogMetric, metric_name: &str) -> ProjectMetricUpdateCall<'a, C, A> { ProjectMetricUpdateCall { hub: self.hub, @@ -895,6 +1014,174 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { _additional_params: Default::default(), } } + + /// Create a builder to help you perform the following task: + /// + /// Gets a logs-based metric. + /// + /// # Arguments + /// + /// * `metricName` - The resource name of the desired metric: + /// "projects/[PROJECT_ID]/metrics/[METRIC_ID]" + /// + pub fn metrics_get(&self, metric_name: &str) -> ProjectMetricGetCall<'a, C, A> { + ProjectMetricGetCall { + hub: self.hub, + _metric_name: metric_name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates a sink. If the named sink doesn't exist, then this method is identical to sinks.create. If the named sink does exist, then this method replaces the following fields in the existing sink with values from the new sink: destination, filter, output_version_format, start_time, and end_time. The updated filter might also have a new writer_identity; see the unique_writer_identity field. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `sinkName` - Required. The full resource name of the sink to update, including the parent resource and the sink identifier: + /// "projects/[PROJECT_ID]/sinks/[SINK_ID]" + /// "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + /// Example: "projects/my-project-id/sinks/my-sink-id". + pub fn sinks_update(&self, request: LogSink, sink_name: &str) -> ProjectSinkUpdateCall<'a, C, A> { + ProjectSinkUpdateCall { + hub: self.hub, + _request: request, + _sink_name: sink_name.to_string(), + _unique_writer_identity: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists the logs in projects or organizations. Only logs that have entries are listed. + /// + /// # Arguments + /// + /// * `parent` - Required. The resource name that owns the logs: + /// "projects/[PROJECT_ID]" + /// "organizations/[ORGANIZATION_ID]" + /// + pub fn logs_list(&self, parent: &str) -> ProjectLogListCall<'a, C, A> { + ProjectLogListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a logs-based metric. + /// + /// # Arguments + /// + /// * `metricName` - The resource name of the metric to delete: + /// "projects/[PROJECT_ID]/metrics/[METRIC_ID]" + /// + pub fn metrics_delete(&self, metric_name: &str) -> ProjectMetricDeleteCall<'a, C, A> { + ProjectMetricDeleteCall { + hub: self.hub, + _metric_name: metric_name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a sink that exports specified log entries to a destination. The export of newly-ingested log entries begins immediately, unless the current time is outside the sink's start and end times or the sink's writer_identity is not permitted to write to the destination. A sink can export log entries only from the resource owning the sink. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - Required. The resource in which to create the sink: + /// "projects/[PROJECT_ID]" + /// "organizations/[ORGANIZATION_ID]" + /// Examples: "projects/my-logging-project", "organizations/123456789". + pub fn sinks_create(&self, request: LogSink, parent: &str) -> ProjectSinkCreateCall<'a, C, A> { + ProjectSinkCreateCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _unique_writer_identity: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a logs-based metric. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - The resource name of the project in which to create the metric: + /// "projects/[PROJECT_ID]" + /// The new metric must be provided in the request. + pub fn metrics_create(&self, request: LogMetric, parent: &str) -> ProjectMetricCreateCall<'a, C, A> { + ProjectMetricCreateCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists logs-based metrics. + /// + /// # Arguments + /// + /// * `parent` - Required. The name of the project containing the metrics: + /// "projects/[PROJECT_ID]" + /// + pub fn metrics_list(&self, parent: &str) -> ProjectMetricListCall<'a, C, A> { + ProjectMetricListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted. + /// + /// # Arguments + /// + /// * `sinkName` - Required. The full resource name of the sink to delete, including the parent resource and the sink identifier: + /// "projects/[PROJECT_ID]/sinks/[SINK_ID]" + /// "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + /// It is an error if the sink does not exist. Example: "projects/my-project-id/sinks/my-sink-id". It is an error if the sink does not exist. + pub fn sinks_delete(&self, sink_name: &str) -> ProjectSinkDeleteCall<'a, C, A> { + ProjectSinkDeleteCall { + hub: self.hub, + _sink_name: sink_name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } } @@ -939,7 +1226,7 @@ impl<'a, C, A> EntryMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists log entries. Use this method to retrieve log entries from Cloud Logging. For ways to export log entries, see [Exporting Logs](/logging/docs/export). + /// Lists log entries. Use this method to retrieve log entries from Stackdriver Logging. For ways to export log entries, see Exporting Logs. /// /// # Arguments /// @@ -956,7 +1243,7 @@ impl<'a, C, A> EntryMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Writes log entries to Cloud Logging. All log entries in Cloud Logging are written by this method. + /// Writes log entries to Stackdriver Logging. All log entries are written by this method. /// /// # Arguments /// @@ -980,7 +1267,1047 @@ impl<'a, C, A> EntryMethods<'a, C, A> { // CallBuilders ### // ################# -/// Lists monitored resource descriptors that are used by Cloud Logging. +/// Deletes all the log entries in a log. The log reappears if it receives new entries. +/// +/// A builder for the *logs.delete* method supported by a *organization* resource. +/// It is not used directly, but through a `OrganizationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2_beta1 as logging2_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2_beta1::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.organizations().logs_delete("logName") +/// .doit(); +/// # } +/// ``` +pub struct OrganizationLogDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _log_name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrganizationLogDeleteCall<'a, C, A> {} + +impl<'a, C, A> OrganizationLogDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.organizations.logs.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("logName", self._log_name.to_string())); + for &field in ["alt", "logName"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2beta1/{+logName}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+logName}", "logName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["logName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The resource name of the log to delete: + /// "projects/[PROJECT_ID]/logs/[LOG_ID]" + /// "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" + /// [LOG_ID] must be URL-encoded. For example, "projects/my-project-id/logs/syslog", "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity". For more information about log names, see LogEntry. + /// + /// Sets the *log name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn log_name(mut self, new_value: &str) -> OrganizationLogDeleteCall<'a, C, A> { + self._log_name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationLogDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OrganizationLogDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrganizationLogDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Lists the logs in projects or organizations. Only logs that have entries are listed. +/// +/// A builder for the *logs.list* method supported by a *organization* resource. +/// It is not used directly, but through a `OrganizationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2_beta1 as logging2_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2_beta1::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.organizations().logs_list("parent") +/// .page_token("et") +/// .page_size(-18) +/// .doit(); +/// # } +/// ``` +pub struct OrganizationLogListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _parent: String, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrganizationLogListCall<'a, C, A> {} + +impl<'a, C, A> OrganizationLogListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListLogsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.organizations.logs.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2beta1/{+parent}/logs".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The resource name that owns the logs: + /// "projects/[PROJECT_ID]" + /// "organizations/[ORGANIZATION_ID]" + /// + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> OrganizationLogListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> OrganizationLogListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> OrganizationLogListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationLogListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OrganizationLogListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrganizationLogListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes all the log entries in a log. The log reappears if it receives new entries. +/// +/// A builder for the *logs.delete* method supported by a *billingAccount* resource. +/// It is not used directly, but through a `BillingAccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2_beta1 as logging2_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2_beta1::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.billing_accounts().logs_delete("logName") +/// .doit(); +/// # } +/// ``` +pub struct BillingAccountLogDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _log_name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for BillingAccountLogDeleteCall<'a, C, A> {} + +impl<'a, C, A> BillingAccountLogDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.billingAccounts.logs.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("logName", self._log_name.to_string())); + for &field in ["alt", "logName"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2beta1/{+logName}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+logName}", "logName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["logName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The resource name of the log to delete: + /// "projects/[PROJECT_ID]/logs/[LOG_ID]" + /// "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" + /// [LOG_ID] must be URL-encoded. For example, "projects/my-project-id/logs/syslog", "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity". For more information about log names, see LogEntry. + /// + /// Sets the *log name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn log_name(mut self, new_value: &str) -> BillingAccountLogDeleteCall<'a, C, A> { + self._log_name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> BillingAccountLogDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> BillingAccountLogDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> BillingAccountLogDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Lists the logs in projects or organizations. Only logs that have entries are listed. +/// +/// A builder for the *logs.list* method supported by a *billingAccount* resource. +/// It is not used directly, but through a `BillingAccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2_beta1 as logging2_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2_beta1::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.billing_accounts().logs_list("parent") +/// .page_token("takimata") +/// .page_size(-70) +/// .doit(); +/// # } +/// ``` +pub struct BillingAccountLogListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _parent: String, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for BillingAccountLogListCall<'a, C, A> {} + +impl<'a, C, A> BillingAccountLogListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListLogsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.billingAccounts.logs.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2beta1/{+parent}/logs".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The resource name that owns the logs: + /// "projects/[PROJECT_ID]" + /// "organizations/[ORGANIZATION_ID]" + /// + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> BillingAccountLogListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> BillingAccountLogListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> BillingAccountLogListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> BillingAccountLogListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> BillingAccountLogListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> BillingAccountLogListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Lists the descriptors for monitored resource types used by Stackdriver Logging. /// /// A builder for the *list* method supported by a *monitoredResourceDescriptor* resource. /// It is not used directly, but through a `MonitoredResourceDescriptorMethods` instance. @@ -1007,8 +2334,8 @@ impl<'a, C, A> EntryMethods<'a, C, A> { /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.monitored_resource_descriptors().list() -/// .page_token("Stet") -/// .page_size(-42) +/// .page_token("amet.") +/// .page_size(-81) /// .doit(); /// # } /// ``` @@ -1140,14 +2467,14 @@ impl<'a, C, A> MonitoredResourceDescriptorListCall<'a, C, A> where C: BorrowMut< } - /// Optional. If the `pageToken` parameter is supplied, then the next page of results is retrieved. The `pageToken` parameter must be set to the value of the `nextPageToken` from the previous response. + /// Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> MonitoredResourceDescriptorListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Optional. The maximum number of results to return from this request. You must check for presence of `nextPageToken` to determine if additional results are available, which you can retrieve by passing the `nextPageToken` value as the `pageToken` parameter in the next request. + /// Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available. /// /// Sets the *page size* query property to the given value. pub fn page_size(mut self, new_value: i32) -> MonitoredResourceDescriptorListCall<'a, C, A> { @@ -1238,9 +2565,9 @@ impl<'a, C, A> MonitoredResourceDescriptorListCall<'a, C, A> where C: BorrowMut< /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().sinks_list("projectName") -/// .page_token("dolores") -/// .page_size(-63) +/// let result = hub.projects().sinks_list("parent") +/// .page_token("sea") +/// .page_size(-90) /// .doit(); /// # } /// ``` @@ -1248,7 +2575,7 @@ pub struct ProjectSinkListCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Logging, - _project_name: String, + _parent: String, _page_token: Option, _page_size: Option, _delegate: Option<&'a mut Delegate>, @@ -1274,14 +2601,14 @@ impl<'a, C, A> ProjectSinkListCall<'a, C, A> where C: BorrowMut, dlg.begin(MethodInfo { id: "logging.projects.sinks.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); - params.push(("projectName", self._project_name.to_string())); + params.push(("parent", self._parent.to_string())); if let Some(value) = self._page_token { params.push(("pageToken", value.to_string())); } if let Some(value) = self._page_size { params.push(("pageSize", value.to_string())); } - for &field in ["alt", "projectName", "pageToken", "pageSize"].iter() { + for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -1293,12 +2620,12 @@ impl<'a, C, A> ProjectSinkListCall<'a, C, A> where C: BorrowMut, params.push(("alt", "json".to_string())); - let mut url = "https://logging.googleapis.com/v2beta1/{+projectName}/sinks".to_string(); + let mut url = "https://logging.googleapis.com/v2beta1/{+parent}/sinks".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } - for &(find_this, param_name) in [("{+projectName}", "projectName")].iter() { + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { let mut replace_with = String::new(); for &(name, ref value) in params.iter() { if name == param_name { @@ -1313,7 +2640,7 @@ impl<'a, C, A> ProjectSinkListCall<'a, C, A> where C: BorrowMut, } { let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["projectName"].iter() { + for param_name in ["parent"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -1399,24 +2726,24 @@ impl<'a, C, A> ProjectSinkListCall<'a, C, A> where C: BorrowMut, } - /// Required. The resource name of the project containing the sinks. Example: `"projects/my-logging-project"`. + /// Required. The parent resource whose sinks are to be listed. Examples: "projects/my-logging-project", "organizations/123456789". /// - /// Sets the *project name* path property to the given value. + /// Sets the *parent* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn project_name(mut self, new_value: &str) -> ProjectSinkListCall<'a, C, A> { - self._project_name = new_value.to_string(); + pub fn parent(mut self, new_value: &str) -> ProjectSinkListCall<'a, C, A> { + self._parent = new_value.to_string(); self } - /// Optional. If the `pageToken` parameter is supplied, then the next page of results is retrieved. The `pageToken` parameter must be set to the value of the `nextPageToken` from the previous response. The value of `projectName` must be the same as in the previous request. + /// Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> ProjectSinkListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Optional. The maximum number of results to return from this request. You must check for presence of `nextPageToken` to determine if additional results are available, which you can retrieve by passing the `nextPageToken` value as the `pageToken` parameter in the next request. + /// Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available. /// /// Sets the *page size* query property to the given value. pub fn page_size(mut self, new_value: i32) -> ProjectSinkListCall<'a, C, A> { @@ -1481,7 +2808,7 @@ impl<'a, C, A> ProjectSinkListCall<'a, C, A> where C: BorrowMut, } -/// Deletes a log and all its log entries. The log will reappear if it receives new entries. +/// Deletes all the log entries in a log. The log reappears if it receives new entries. /// /// A builder for the *logs.delete* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -1658,7 +2985,10 @@ impl<'a, C, A> ProjectLogDeleteCall<'a, C, A> where C: BorrowMut, } - /// Required. The resource name of the log to delete. Example: `"projects/my-project/logs/syslog"`. + /// Required. The resource name of the log to delete: + /// "projects/[PROJECT_ID]/logs/[LOG_ID]" + /// "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" + /// [LOG_ID] must be URL-encoded. For example, "projects/my-project-id/logs/syslog", "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity". For more information about log names, see LogEntry. /// /// Sets the *log name* path property to the given value. /// @@ -1903,7 +3233,10 @@ impl<'a, C, A> ProjectSinkGetCall<'a, C, A> where C: BorrowMut, A } - /// The resource name of the sink to return. Example: `"projects/my-project-id/sinks/my-sink-id"`. + /// Required. The parent resource name of the sink: + /// "projects/[PROJECT_ID]/sinks/[SINK_ID]" + /// "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + /// Example: "projects/my-project-id/sinks/my-sink-id". /// /// Sets the *sink name* path property to the given value. /// @@ -1971,1838 +3304,6 @@ impl<'a, C, A> ProjectSinkGetCall<'a, C, A> where C: BorrowMut, A } -/// Gets a logs-based metric. -/// -/// A builder for the *metrics.get* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_logging2_beta1 as logging2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use logging2_beta1::Logging; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Logging::new(hyper::Client::new(), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().metrics_get("metricName") -/// .doit(); -/// # } -/// ``` -pub struct ProjectMetricGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Logging, - _metric_name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectMetricGetCall<'a, C, A> {} - -impl<'a, C, A> ProjectMetricGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, LogMetric)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "logging.projects.metrics.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("metricName", self._metric_name.to_string())); - for &field in ["alt", "metricName"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://logging.googleapis.com/v2beta1/{+metricName}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+metricName}", "metricName")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["metricName"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The resource name of the desired metric. Example: `"projects/my-project-id/metrics/my-metric-id"`. - /// - /// Sets the *metric name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn metric_name(mut self, new_value: &str) -> ProjectMetricGetCall<'a, C, A> { - self._metric_name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectMetricGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *bearer_token* (query-string) - OAuth bearer token. - /// * *pp* (query-boolean) - Pretty-print response. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectMetricGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectMetricGetCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Creates or updates a sink. -/// -/// A builder for the *sinks.update* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_logging2_beta1 as logging2_beta1; -/// use logging2_beta1::LogSink; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use logging2_beta1::Logging; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Logging::new(hyper::Client::new(), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = LogSink::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().sinks_update(req, "sinkName") -/// .doit(); -/// # } -/// ``` -pub struct ProjectSinkUpdateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Logging, - _request: LogSink, - _sink_name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectSinkUpdateCall<'a, C, A> {} - -impl<'a, C, A> ProjectSinkUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, LogSink)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "logging.projects.sinks.update", - http_method: hyper::method::Method::Put }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("sinkName", self._sink_name.to_string())); - for &field in ["alt", "sinkName"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://logging.googleapis.com/v2beta1/{+sinkName}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+sinkName}", "sinkName")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["sinkName"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: LogSink) -> ProjectSinkUpdateCall<'a, C, A> { - self._request = new_value; - self - } - /// The resource name of the sink to update. Example: `"projects/my-project-id/sinks/my-sink-id"`. The updated sink must be provided in the request and have the same name that is specified in `sinkName`. If the sink does not exist, it is created. - /// - /// Sets the *sink name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn sink_name(mut self, new_value: &str) -> ProjectSinkUpdateCall<'a, C, A> { - self._sink_name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectSinkUpdateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *bearer_token* (query-string) - OAuth bearer token. - /// * *pp* (query-boolean) - Pretty-print response. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectSinkUpdateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectSinkUpdateCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Deletes a logs-based metric. -/// -/// A builder for the *metrics.delete* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_logging2_beta1 as logging2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use logging2_beta1::Logging; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Logging::new(hyper::Client::new(), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().metrics_delete("metricName") -/// .doit(); -/// # } -/// ``` -pub struct ProjectMetricDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Logging, - _metric_name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectMetricDeleteCall<'a, C, A> {} - -impl<'a, C, A> ProjectMetricDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "logging.projects.metrics.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("metricName", self._metric_name.to_string())); - for &field in ["alt", "metricName"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://logging.googleapis.com/v2beta1/{+metricName}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+metricName}", "metricName")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["metricName"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The resource name of the metric to delete. Example: `"projects/my-project-id/metrics/my-metric-id"`. - /// - /// Sets the *metric name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn metric_name(mut self, new_value: &str) -> ProjectMetricDeleteCall<'a, C, A> { - self._metric_name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectMetricDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *bearer_token* (query-string) - OAuth bearer token. - /// * *pp* (query-boolean) - Pretty-print response. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectMetricDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectMetricDeleteCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Creates a sink. -/// -/// A builder for the *sinks.create* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_logging2_beta1 as logging2_beta1; -/// use logging2_beta1::LogSink; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use logging2_beta1::Logging; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Logging::new(hyper::Client::new(), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = LogSink::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().sinks_create(req, "projectName") -/// .doit(); -/// # } -/// ``` -pub struct ProjectSinkCreateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Logging, - _request: LogSink, - _project_name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectSinkCreateCall<'a, C, A> {} - -impl<'a, C, A> ProjectSinkCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, LogSink)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "logging.projects.sinks.create", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("projectName", self._project_name.to_string())); - for &field in ["alt", "projectName"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://logging.googleapis.com/v2beta1/{+projectName}/sinks".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+projectName}", "projectName")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["projectName"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: LogSink) -> ProjectSinkCreateCall<'a, C, A> { - self._request = new_value; - self - } - /// The resource name of the project in which to create the sink. Example: `"projects/my-project-id"`. The new sink must be provided in the request. - /// - /// Sets the *project name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn project_name(mut self, new_value: &str) -> ProjectSinkCreateCall<'a, C, A> { - self._project_name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectSinkCreateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *bearer_token* (query-string) - OAuth bearer token. - /// * *pp* (query-boolean) - Pretty-print response. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectSinkCreateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectSinkCreateCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Creates a logs-based metric. -/// -/// A builder for the *metrics.create* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_logging2_beta1 as logging2_beta1; -/// use logging2_beta1::LogMetric; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use logging2_beta1::Logging; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Logging::new(hyper::Client::new(), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = LogMetric::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().metrics_create(req, "projectName") -/// .doit(); -/// # } -/// ``` -pub struct ProjectMetricCreateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Logging, - _request: LogMetric, - _project_name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectMetricCreateCall<'a, C, A> {} - -impl<'a, C, A> ProjectMetricCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, LogMetric)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "logging.projects.metrics.create", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("projectName", self._project_name.to_string())); - for &field in ["alt", "projectName"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://logging.googleapis.com/v2beta1/{+projectName}/metrics".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+projectName}", "projectName")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["projectName"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: LogMetric) -> ProjectMetricCreateCall<'a, C, A> { - self._request = new_value; - self - } - /// The resource name of the project in which to create the metric. Example: `"projects/my-project-id"`. The new metric must be provided in the request. - /// - /// Sets the *project name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn project_name(mut self, new_value: &str) -> ProjectMetricCreateCall<'a, C, A> { - self._project_name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectMetricCreateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *bearer_token* (query-string) - OAuth bearer token. - /// * *pp* (query-boolean) - Pretty-print response. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectMetricCreateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectMetricCreateCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Deletes a sink. -/// -/// A builder for the *sinks.delete* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_logging2_beta1 as logging2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use logging2_beta1::Logging; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Logging::new(hyper::Client::new(), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().sinks_delete("sinkName") -/// .doit(); -/// # } -/// ``` -pub struct ProjectSinkDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Logging, - _sink_name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectSinkDeleteCall<'a, C, A> {} - -impl<'a, C, A> ProjectSinkDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "logging.projects.sinks.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("sinkName", self._sink_name.to_string())); - for &field in ["alt", "sinkName"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://logging.googleapis.com/v2beta1/{+sinkName}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+sinkName}", "sinkName")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["sinkName"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The resource name of the sink to delete. Example: `"projects/my-project-id/sinks/my-sink-id"`. - /// - /// Sets the *sink name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn sink_name(mut self, new_value: &str) -> ProjectSinkDeleteCall<'a, C, A> { - self._sink_name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectSinkDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *bearer_token* (query-string) - OAuth bearer token. - /// * *pp* (query-boolean) - Pretty-print response. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectSinkDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectSinkDeleteCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Lists logs-based metrics. -/// -/// A builder for the *metrics.list* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_logging2_beta1 as logging2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use logging2_beta1::Logging; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Logging::new(hyper::Client::new(), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().metrics_list("projectName") -/// .page_token("gubergren") -/// .page_size(-95) -/// .doit(); -/// # } -/// ``` -pub struct ProjectMetricListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Logging, - _project_name: String, - _page_token: Option, - _page_size: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectMetricListCall<'a, C, A> {} - -impl<'a, C, A> ProjectMetricListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ListLogMetricsResponse)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "logging.projects.metrics.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); - params.push(("projectName", self._project_name.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._page_size { - params.push(("pageSize", value.to_string())); - } - for &field in ["alt", "projectName", "pageToken", "pageSize"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://logging.googleapis.com/v2beta1/{+projectName}/metrics".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+projectName}", "projectName")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["projectName"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The resource name of the project containing the metrics. Example: `"projects/my-project-id"`. - /// - /// Sets the *project name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn project_name(mut self, new_value: &str) -> ProjectMetricListCall<'a, C, A> { - self._project_name = new_value.to_string(); - self - } - /// Optional. If the `pageToken` parameter is supplied, then the next page of results is retrieved. The `pageToken` parameter must be set to the value of the `nextPageToken` from the previous response. The value of `projectName` must be the same as in the previous request. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> ProjectMetricListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Optional. The maximum number of results to return from this request. You must check for presence of `nextPageToken` to determine if additional results are available, which you can retrieve by passing the `nextPageToken` value as the `pageToken` parameter in the next request. - /// - /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> ProjectMetricListCall<'a, C, A> { - self._page_size = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectMetricListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *bearer_token* (query-string) - OAuth bearer token. - /// * *pp* (query-boolean) - Pretty-print response. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectMetricListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectMetricListCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - /// Creates or updates a logs-based metric. /// /// A builder for the *metrics.update* method supported by a *project* resource. @@ -4011,7 +3512,9 @@ impl<'a, C, A> ProjectMetricUpdateCall<'a, C, A> where C: BorrowMut ProjectMetricUpdateCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().metrics_get("metricName") +/// .doit(); +/// # } +/// ``` +pub struct ProjectMetricGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _metric_name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectMetricGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectMetricGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LogMetric)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.projects.metrics.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("metricName", self._metric_name.to_string())); + for &field in ["alt", "metricName"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2beta1/{+metricName}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+metricName}", "metricName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["metricName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The resource name of the desired metric: + /// "projects/[PROJECT_ID]/metrics/[METRIC_ID]" + /// + /// + /// Sets the *metric name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn metric_name(mut self, new_value: &str) -> ProjectMetricGetCall<'a, C, A> { + self._metric_name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectMetricGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectMetricGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectMetricGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates a sink. If the named sink doesn't exist, then this method is identical to sinks.create. If the named sink does exist, then this method replaces the following fields in the existing sink with values from the new sink: destination, filter, output_version_format, start_time, and end_time. The updated filter might also have a new writer_identity; see the unique_writer_identity field. +/// +/// A builder for the *sinks.update* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2_beta1 as logging2_beta1; +/// use logging2_beta1::LogSink; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2_beta1::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = LogSink::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().sinks_update(req, "sinkName") +/// .unique_writer_identity(false) +/// .doit(); +/// # } +/// ``` +pub struct ProjectSinkUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _request: LogSink, + _sink_name: String, + _unique_writer_identity: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectSinkUpdateCall<'a, C, A> {} + +impl<'a, C, A> ProjectSinkUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LogSink)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.projects.sinks.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("sinkName", self._sink_name.to_string())); + if let Some(value) = self._unique_writer_identity { + params.push(("uniqueWriterIdentity", value.to_string())); + } + for &field in ["alt", "sinkName", "uniqueWriterIdentity"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2beta1/{+sinkName}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+sinkName}", "sinkName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["sinkName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: LogSink) -> ProjectSinkUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. The full resource name of the sink to update, including the parent resource and the sink identifier: + /// "projects/[PROJECT_ID]/sinks/[SINK_ID]" + /// "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + /// Example: "projects/my-project-id/sinks/my-sink-id". + /// + /// Sets the *sink name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn sink_name(mut self, new_value: &str) -> ProjectSinkUpdateCall<'a, C, A> { + self._sink_name = new_value.to_string(); + self + } + /// Optional. See sinks.create for a description of this field. When updating a sink, the effect of this field on the value of writer_identity in the updated sink depends on both the old and new values of this field: + /// If the old and new values of this field are both false or both true, then there is no change to the sink's writer_identity. + /// If the old value was false and the new value is true, then writer_identity is changed to a unique service account. + /// It is an error if the old value was true and the new value is false. + /// + /// Sets the *unique writer identity* query property to the given value. + pub fn unique_writer_identity(mut self, new_value: bool) -> ProjectSinkUpdateCall<'a, C, A> { + self._unique_writer_identity = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectSinkUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectSinkUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectSinkUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Lists the logs in projects or organizations. Only logs that have entries are listed. +/// +/// A builder for the *logs.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2_beta1 as logging2_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2_beta1::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().logs_list("parent") +/// .page_token("justo") +/// .page_size(-34) +/// .doit(); +/// # } +/// ``` +pub struct ProjectLogListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _parent: String, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLogListCall<'a, C, A> {} + +impl<'a, C, A> ProjectLogListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListLogsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.projects.logs.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2beta1/{+parent}/logs".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The resource name that owns the logs: + /// "projects/[PROJECT_ID]" + /// "organizations/[ORGANIZATION_ID]" + /// + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLogListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectLogListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectLogListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLogListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLogListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLogListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes a logs-based metric. +/// +/// A builder for the *metrics.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2_beta1 as logging2_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2_beta1::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().metrics_delete("metricName") +/// .doit(); +/// # } +/// ``` +pub struct ProjectMetricDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _metric_name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectMetricDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectMetricDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.projects.metrics.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("metricName", self._metric_name.to_string())); + for &field in ["alt", "metricName"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2beta1/{+metricName}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+metricName}", "metricName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["metricName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The resource name of the metric to delete: + /// "projects/[PROJECT_ID]/metrics/[METRIC_ID]" + /// + /// + /// Sets the *metric name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn metric_name(mut self, new_value: &str) -> ProjectMetricDeleteCall<'a, C, A> { + self._metric_name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectMetricDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectMetricDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectMetricDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Creates a sink that exports specified log entries to a destination. The export of newly-ingested log entries begins immediately, unless the current time is outside the sink's start and end times or the sink's writer_identity is not permitted to write to the destination. A sink can export log entries only from the resource owning the sink. +/// +/// A builder for the *sinks.create* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2_beta1 as logging2_beta1; +/// use logging2_beta1::LogSink; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2_beta1::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = LogSink::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().sinks_create(req, "parent") +/// .unique_writer_identity(false) +/// .doit(); +/// # } +/// ``` +pub struct ProjectSinkCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _request: LogSink, + _parent: String, + _unique_writer_identity: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectSinkCreateCall<'a, C, A> {} + +impl<'a, C, A> ProjectSinkCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LogSink)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.projects.sinks.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._unique_writer_identity { + params.push(("uniqueWriterIdentity", value.to_string())); + } + for &field in ["alt", "parent", "uniqueWriterIdentity"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2beta1/{+parent}/sinks".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: LogSink) -> ProjectSinkCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. The resource in which to create the sink: + /// "projects/[PROJECT_ID]" + /// "organizations/[ORGANIZATION_ID]" + /// Examples: "projects/my-logging-project", "organizations/123456789". + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectSinkCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Optional. Determines the kind of IAM identity returned as writer_identity in the new sink. If this value is omitted or set to false, and if the sink's parent is a project, then the value returned as writer_identity is cloud-logs@google.com, the same identity used before the addition of writer identities to this API. The sink's destination must be in the same project as the sink itself.If this field is set to true, or if the sink is owned by a non-project resource such as an organization, then the value of writer_identity will be a unique service account used only for exports from the new sink. For more information, see writer_identity in LogSink. + /// + /// Sets the *unique writer identity* query property to the given value. + pub fn unique_writer_identity(mut self, new_value: bool) -> ProjectSinkCreateCall<'a, C, A> { + self._unique_writer_identity = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectSinkCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectSinkCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectSinkCreateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Creates a logs-based metric. +/// +/// A builder for the *metrics.create* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2_beta1 as logging2_beta1; +/// use logging2_beta1::LogMetric; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2_beta1::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = LogMetric::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().metrics_create(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct ProjectMetricCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _request: LogMetric, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectMetricCreateCall<'a, C, A> {} + +impl<'a, C, A> ProjectMetricCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LogMetric)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.projects.metrics.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2beta1/{+parent}/metrics".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: LogMetric) -> ProjectMetricCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// The resource name of the project in which to create the metric: + /// "projects/[PROJECT_ID]" + /// The new metric must be provided in the request. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectMetricCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectMetricCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectMetricCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectMetricCreateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Lists logs-based metrics. +/// +/// A builder for the *metrics.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2_beta1 as logging2_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2_beta1::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().metrics_list("parent") +/// .page_token("duo") +/// .page_size(-32) +/// .doit(); +/// # } +/// ``` +pub struct ProjectMetricListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _parent: String, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectMetricListCall<'a, C, A> {} + +impl<'a, C, A> ProjectMetricListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListLogMetricsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.projects.metrics.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2beta1/{+parent}/metrics".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The name of the project containing the metrics: + /// "projects/[PROJECT_ID]" + /// + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectMetricListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectMetricListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectMetricListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectMetricListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectMetricListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectMetricListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted. +/// +/// A builder for the *sinks.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2_beta1 as logging2_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2_beta1::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().sinks_delete("sinkName") +/// .doit(); +/// # } +/// ``` +pub struct ProjectSinkDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _sink_name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectSinkDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectSinkDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.projects.sinks.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("sinkName", self._sink_name.to_string())); + for &field in ["alt", "sinkName"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2beta1/{+sinkName}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+sinkName}", "sinkName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["sinkName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The full resource name of the sink to delete, including the parent resource and the sink identifier: + /// "projects/[PROJECT_ID]/sinks/[SINK_ID]" + /// "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + /// It is an error if the sink does not exist. Example: "projects/my-project-id/sinks/my-sink-id". It is an error if the sink does not exist. + /// + /// Sets the *sink name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn sink_name(mut self, new_value: &str) -> ProjectSinkDeleteCall<'a, C, A> { + self._sink_name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectSinkDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectSinkDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectSinkDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Lists log entries. Use this method to retrieve log entries from Stackdriver Logging. For ways to export log entries, see Exporting Logs. /// /// A builder for the *list* method supported by a *entry* resource. /// It is not used directly, but through a `EntryMethods` instance. @@ -4318,7 +5969,7 @@ impl<'a, C, A> EntryListCall<'a, C, A> where C: BorrowMut, A: oau } -/// Writes log entries to Cloud Logging. All log entries in Cloud Logging are written by this method. +/// Writes log entries to Stackdriver Logging. All log entries are written by this method. /// /// A builder for the *write* method supported by a *entry* resource. /// It is not used directly, but through a `EntryMethods` instance. diff --git a/gen/manufacturers1-cli/Cargo.toml b/gen/manufacturers1-cli/Cargo.toml new file mode 100644 index 0000000000..063cb80aa8 --- /dev/null +++ b/gen/manufacturers1-cli/Cargo.toml @@ -0,0 +1,43 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-manufacturers1-cli" +version = "1.0.0+20161028" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Manufacturer Center (protocol v1)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/manufacturers1-cli" +homepage = "https://developers.google.com/manufacturers/" +documentation = "http://byron.github.io/google-apis-rs/google_manufacturers1_cli" +license = "MIT" +keywords = ["manufacturers", "google", "cli"] + +[[bin]] +name = "manufacturers1" + +[dependencies] +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.8" +serde_json = "^ 0.8" +yup-oauth2 = { version = "^ 1.0", optional = true, default-features = false } +serde_derive = { version = "^ 0.8", optional = true } +strsim = "^0.5" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-serde-codegen"] +nightly = ["serde_derive","yup-oauth2/nightly","google-manufacturers1/nightly"] +with-serde-codegen = ["serde_codegen","yup-oauth2/with-serde-codegen","google-manufacturers1/with-serde-codegen"] + +[build-dependencies] +serde_codegen = { version = "^ 0.8", optional = true } + + +[dependencies.google-manufacturers1] +path = "../manufacturers1" +version = "1.0.0" +optional = true +default-features = false diff --git a/gen/manufacturers1-cli/LICENSE.md b/gen/manufacturers1-cli/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/manufacturers1-cli/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/manufacturers1-cli/README.md b/gen/manufacturers1-cli/README.md new file mode 100644 index 0000000000..2b0f55a31f --- /dev/null +++ b/gen/manufacturers1-cli/README.md @@ -0,0 +1,114 @@ + +The `manufacturers1` command-line interface *(CLI)* allows to use most features of the *Google Manufacturer Center* service from the comfort of your terminal. + +By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's +capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero. + +If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. + +Everything else about the *Manufacturer Center* API can be found at the +[official documentation site](https://developers.google.com/manufacturers/). + +# Downloads + +You can download the pre-compiled 64bit binaries for the following platforms: + +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/1.0.0/ubuntu/manufacturers1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/1.0.0/osx/manufacturers1.tar.gz) + +Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/manufacturers1-cli). + +# Usage + +This documentation was generated from the *Manufacturer Center* API at revision *20161028*. The CLI is at version *1.0.0*. + +```bash +manufacturers1 [options] + accounts + products-get [-p ]... [-o ] + products-list [-p ]... [-o ] + manufacturers1 --help + +Configuration: + [--scope ]... + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. + If unset, it defaults to the shortest scope url for a particular method. + --config-dir + A directory into which we will store our persistent data. Defaults to + a user-writable directory that we will create during the first invocation. + [default: ~/.google-service-cli] + --debug + Output all server communication to standard error. `tx` and `rx` are placed + into the same stream. + --debug-auth + Output all communication related to authentication to standard error. `tx` + and `rx` are placed into the same stream. + +``` + +# Configuration + +The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `manufacturers1-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis. + +More information about the various kinds of persistent data are given in the following paragraphs. + +# Authentication + +Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the +set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*. + +If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a +method that is read-only, it will ask only for a read-only scope. +You may use the `--scope` flag to specify a scope directly. +All applicable scopes are documented in the respective method's CLI documentation. + +The first time a scope is used, the user is asked for permission. Follow the instructions given +by the CLI to grant permissions, or to decline. + +If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration +directory, e.g. `~/.google-service-cli/manufacturers1-token-.json`. No manual management of these tokens +is necessary. + +To revoke granted authentication, please refer to the [official documentation][revoke-access]. + +# Application Secrets + +In order to allow any application to use Google services, it will need to be registered using the +[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it +one by one. Most APIs can be used for free and have a daily quota. + +To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI +comes with a default application secret that is configured accordingly. This also means that heavy usage +all around the world may deplete the daily quota. + +You can workaround this limitation by putting your own secrets file at this location: +`~/.google-service-cli/manufacturers1-secret.json`, assuming that the required *manufacturers* API +was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at +*APIs & auth -> Credentials -> Download JSON* and used as is. + +Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new]. + + +# Debugging + +Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know +what exactly led to a particular issue. This is done by allowing all client-server communication to be +output to standard error *as-is*. + +The `--debug` flag will print all client-server communication to standard error, whereas the `--debug-auth` flag +will cause all communication related to authentication to standard error. +If the `--debug` flag is set, error-results will be debug-printed, possibly yielding more information about the +issue at hand. + +You may consider redirecting standard error into a file for ease of use, e.g. `manufacturers1 --debug [options] 2>debug.txt`. + + +[scopes]: https://developers.google.com/+/api/oauth#scopes +[revoke-access]: http://webapps.stackexchange.com/a/30849 +[google-dev-console]: https://console.developers.google.com/ +[google-project-new]: https://developers.google.com/console/help/new/ \ No newline at end of file diff --git a/gen/manufacturers1-cli/mkdocs.yml b/gen/manufacturers1-cli/mkdocs.yml new file mode 100644 index 0000000000..6f8fa6550f --- /dev/null +++ b/gen/manufacturers1-cli/mkdocs.yml @@ -0,0 +1,18 @@ +site_name: Manufacturer Center v1.0.0+20161028 +site_url: http://byron.github.io/google-apis-rs/google-manufacturers1-cli +site_description: Write integrating applications with bcore + +repo_url: https://github.com/Byron/google-apis-rs/tree/master/gen/manufacturers1-cli + +docs_dir: docs +site_dir: build_html + +pages: +- ['index.md', 'Home'] +- ['accounts_products-get.md', 'Accounts', 'Products Get'] +- ['accounts_products-list.md', 'Accounts', 'Products List'] + +theme: readthedocs + +copyright: Copyright © 2015-2016, `Sebastian Thiel` + diff --git a/gen/manufacturers1-cli/src/cmn.rs b/gen/manufacturers1-cli/src/cmn.rs new file mode 100644 index 0000000000..779c1dc086 --- /dev/null +++ b/gen/manufacturers1-cli/src/cmn.rs @@ -0,0 +1,721 @@ +// COPY OF 'src/rust/cli/cmn.rs' +// DO NOT EDIT +use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token}; +use serde_json as json; +use serde_json::value::Value; +use mime::Mime; +use clap::{App, SubCommand}; +use strsim; + +use std::fs; +use std::env; +use std::io; +use std::fmt; +use std::path::{Path, PathBuf}; +use std::str::FromStr; +use std::string::ToString; +use std::io::{Write, Read, stdout}; + +use std::default::Default; + +const FIELD_SEP: char = '.'; + + +pub enum ComplexType { + Pod, + Vec, + Map, +} + + // Null, + // Bool(bool), + // I64(i64), + // U64(u64), + // F64(f64), + // String(String), + +pub enum JsonType { + Boolean, + Int, + Uint, + Float, + String, +} + +pub struct JsonTypeInfo { + pub jtype: JsonType, + pub ctype: ComplexType, +} + +// Based on @erickt user comment. Thanks for the idea ! +// Remove all keys whose values are null from given value (changed in place) +pub fn remove_json_null_values(value: &mut Value) { + match *value { + Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} + +fn did_you_mean<'a>(v: &str, possible_values: &[&'a str]) -> Option<&'a str> { + + let mut candidate: Option<(f64, &str)> = None; + for pv in possible_values { + let confidence = strsim::jaro_winkler(v, pv); + if confidence > 0.8 && (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { + candidate = Some((confidence, pv)); + } + } + match candidate { + None => None, + Some((_, candidate)) => Some(candidate), + } +} + +pub enum CallType { + Upload(UploadProtocol), + Standard, +} + +arg_enum!{ + pub enum UploadProtocol { + Simple, + Resumable + } +} + +impl AsRef for UploadProtocol { + fn as_ref(&self) -> &str { + match *self { + UploadProtocol::Simple => "simple", + UploadProtocol::Resumable => "resumable" + } + } +} + +impl AsRef for CallType { + fn as_ref(&self) -> &str { + match *self { + CallType::Upload(ref proto) => proto.as_ref(), + CallType::Standard => "standard-request" + } + } +} + +#[derive(Clone, Default)] +pub struct FieldCursor(Vec); + +impl ToString for FieldCursor { + fn to_string(&self) -> String { + self.0.join(".") + } +} + +impl From<&'static str> for FieldCursor { + fn from(value: &'static str) -> FieldCursor { + let mut res = FieldCursor::default(); + res.set(value).unwrap(); + res + } +} + +impl FieldCursor { + pub fn set(&mut self, value: &str) -> Result<(), CLIError> { + if value.len() == 0 { + return Err(CLIError::Field(FieldError::Empty)) + } + + let mut first_is_field_sep = false; + let mut char_count: usize = 0; + let mut last_c = FIELD_SEP; + let mut num_conscutive_field_seps = 0; + + let mut field = String::new(); + let mut fields = self.0.clone(); + + let push_field = |fs: &mut Vec, f: &mut String| { + if f.len() > 0 { + fs.push(f.clone()); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + char_count += 1; + + if c == FIELD_SEP { + if cid == 0 { + first_is_field_sep = true; + } + num_conscutive_field_seps += 1; + if cid > 0 && last_c == FIELD_SEP { + if fields.pop().is_none() { + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))) + } + } else { + push_field(&mut fields, &mut field); + } + } else { + num_conscutive_field_seps = 0; + if cid == 1 { + if first_is_field_sep { + fields.truncate(0); + } + } + field.push(c); + } + + last_c = c; + } + + push_field(&mut fields, &mut field); + + if char_count == 1 && first_is_field_sep { + fields.truncate(0); + } + if char_count > 1 && num_conscutive_field_seps == 1 { + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + } + + self.0 = fields; + Ok(()) + } + + pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { + if value.len() == 0 { + return None + } + + let mut last_c = FIELD_SEP; + + let mut field = String::new(); + let mut output = String::new(); + + let push_field = |fs: &mut String, f: &mut String| { + if f.len() > 0 { + fs.push_str( + match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + if c == FIELD_SEP { + if last_c != FIELD_SEP { + push_field(&mut output, &mut field); + } + output.push(c); + } else { + field.push(c); + } + + last_c = c; + } + + push_field(&mut output, &mut field); + + if &output == value { + None + } else { + Some(output) + } + } + + pub fn set_json_value(&self, mut object: &mut Value, + value: &str, type_info: JsonTypeInfo, + err: &mut InvalidOptionsError, + orig_cursor: &FieldCursor) { + assert!(self.0.len() > 0); + + for field in &self.0[..self.0.len()-1] { + let tmp = object; + object = + match *tmp { + Value::Object(ref mut mapping) => { + mapping.entry(field.to_owned()).or_insert( + Value::Object(Default::default()) + ) + }, + _ => panic!("We don't expect non-object Values here ...") + }; + } + + match *object { + Value::Object(ref mut mapping) => { + let field = &self.0[self.0.len()-1]; + let to_jval = + |value: &str, jtype: JsonType, err: &mut InvalidOptionsError| + -> Value { + match jtype { + JsonType::Boolean => + Value::Bool(arg_from_str(value, err, &field, "boolean")), + JsonType::Int => + Value::I64(arg_from_str(value, err, &field, "int")), + JsonType::Uint => + Value::U64(arg_from_str(value, err, &field, "uint")), + JsonType::Float => + Value::F64(arg_from_str(value, err, &field, "float")), + JsonType::String => + Value::String(value.to_owned()), + } + }; + + match type_info.ctype { + ComplexType::Pod => { + if mapping.insert(field.to_owned(), to_jval(value, type_info.jtype, err)).is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + }, + ComplexType::Vec => { + match *mapping.entry(field.to_owned()) + .or_insert(Value::Array(Default::default())) { + Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), + _ => unreachable!() + } + }, + ComplexType::Map => { + let (key, value) = parse_kv_arg(value, err, true); + let jval = to_jval(value.unwrap_or(""), type_info.jtype, err); + + match *mapping.entry(field.to_owned()) + .or_insert(Value::Object(Default::default())) { + Value::Object(ref mut value_map) => { + if value_map.insert(key.to_owned(), jval).is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + _ => unreachable!() + } + } + } + }, + _ => unreachable!() + } + } + + pub fn num_fields(&self) -> usize { + self.0.len() + } +} + +pub fn parse_kv_arg<'a>(kv: &'a str, err: &mut InvalidOptionsError, for_hashmap: bool) + -> (&'a str, Option<&'a str>) { + let mut add_err = || err.issues.push(CLIError::InvalidKeyValueSyntax(kv.to_string(),for_hashmap)); + match kv.find('=') { + None => { + add_err(); + return (kv, None) + }, + Some(pos) => { + let key = &kv[..pos]; + if kv.len() <= pos + 1 { + add_err(); + return (key, Some("")) + } + (key, Some(&kv[pos+1..])) + } + } +} + +pub fn calltype_from_str(name: &str, valid_protocols: Vec, err: &mut InvalidOptionsError) -> CallType { + CallType::Upload( + match UploadProtocol::from_str(name) { + Ok(up) => up, + Err(msg) => { + err.issues.push(CLIError::InvalidUploadProtocol(name.to_string(), valid_protocols)); + UploadProtocol::Simple + } + }) +} + +pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> Option { + match fs::File::open(file_path) { + Ok(f) => Some(f), + Err(io_err) => { + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); + None + } + } +} + +pub fn input_mime_from_opts(mime: &str, err: &mut InvalidOptionsError) -> Option { + match mime.parse() { + Ok(m) => Some(m), + Err(_) => { + err.issues.push(CLIError::Input(InputError::Mime(mime.to_string()))); + None + } + } +} + +pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { + let f = arg.unwrap_or("-"); + match f { + "-" => Ok(Box::new(stdout())), + _ => match fs::OpenOptions::new().create(true).write(true).open(f) { + Ok(f) => Ok(Box::new(f)), + Err(io_err) => Err(io_err), + } + } +} + + +pub fn arg_from_str<'a, T>(arg: &str, err: &mut InvalidOptionsError, + arg_name: &'a str, + arg_type: &'a str) -> T + where T: FromStr + Default, + ::Err: fmt::Display { + match FromStr::from_str(arg) { + Err(perr) => { + err.issues.push( + CLIError::ParseError(arg_name.to_owned(), arg_type.to_owned(), arg.to_string(), format!("{}", perr)) + ); + Default::default() + }, + Ok(v) => v, + } +} + +pub struct JsonTokenStorage { + pub program_name: &'static str, + pub db_dir: String, +} + +impl JsonTokenStorage { + fn path(&self, scope_hash: u64) -> PathBuf { + Path::new(&self.db_dir).join(&format!("{}-token-{}.json", self.program_name, scope_hash)) + } +} + +impl TokenStorage for JsonTokenStorage { + type Error = json::Error; + + // NOTE: logging might be interesting, currently we swallow all errors + fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), json::Error> { + match token { + None => { + match fs::remove_file(self.path(scope_hash)) { + Err(err) => + match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(json::Error::Io(err)) + }, + Ok(_) => Ok(()), + } + } + Some(token) => { + match fs::OpenOptions::new().create(true).write(true).open(&self.path(scope_hash)) { + Ok(mut f) => { + match json::to_writer_pretty(&mut f, &token) { + Ok(_) => Ok(()), + Err(serde_err) => Err(serde_err), + } + }, + Err(io_err) => Err(json::Error::Io(io_err)) + } + } + } + } + + fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result, json::Error> { + match fs::File::open(&self.path(scope_hash)) { + Ok(f) => { + match json::de::from_reader(f) { + Ok(token) => Ok(Some(token)), + Err(err) => Err(err), + } + }, + Err(io_err) => { + match io_err.kind() { + io::ErrorKind::NotFound => Ok(None), + _ => Err(json::Error::Io(io_err)) + } + } + } + } +} + + +#[derive(Debug)] +pub enum ApplicationSecretError { + DecoderError((String, json::Error)), + FormatError(String), +} + +impl fmt::Display for ApplicationSecretError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ApplicationSecretError::DecoderError((ref path, ref err)) + => writeln!(f, "Could not decode file at '{}' with error: {}.", + path, err), + ApplicationSecretError::FormatError(ref path) + => writeln!(f, "'installed' field is unset in secret file at '{}'.", + path), + } + } +} + +#[derive(Debug)] +pub enum ConfigurationError { + DirectoryCreationFailed((String, io::Error)), + DirectoryUnset, + HomeExpansionFailed(String), + Secret(ApplicationSecretError), + Io((String, io::Error)), +} + +impl fmt::Display for ConfigurationError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ConfigurationError::DirectoryCreationFailed((ref dir, ref err)) + => writeln!(f, "Directory '{}' could not be created with error: {}.", dir, err), + ConfigurationError::DirectoryUnset + => writeln!(f, "--config-dir was unset or empty."), + ConfigurationError::HomeExpansionFailed(ref dir) + => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), + ConfigurationError::Secret(ref err) + => writeln!(f, "Secret -> {}", err), + ConfigurationError::Io((ref path, ref err)) + => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + } + } +} + +#[derive(Debug)] +pub enum InputError { + Io((String, io::Error)), + Mime(String), +} + +impl fmt::Display for InputError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + InputError::Io((ref file_path, ref io_err)) + => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), + InputError::Mime(ref mime) + => writeln!(f, "'{}' is not a known mime-type.", mime), + } + } +} + +#[derive(Debug)] +pub enum FieldError { + PopOnEmpty(String), + TrailingFieldSep(String), + Unknown(String, Option, Option), + Duplicate(String), + Empty, +} + + +impl fmt::Display for FieldError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + FieldError::PopOnEmpty(ref field) + => writeln!(f, "'{}': Cannot move up on empty field cursor.", field), + FieldError::TrailingFieldSep(ref field) + => writeln!(f, "'{}': Single field separator may not be last character.", field), + FieldError::Unknown(ref field, ref suggestion, ref value) => { + let suffix = + match *suggestion { + Some(ref s) => { + let kv = + match *value { + Some(ref v) => format!("{}={}", s, v), + None => s.clone(), + }; + format!(" Did you mean '{}' ?", kv) + }, + None => String::new(), + }; + writeln!(f, "Field '{}' does not exist.{}", field, suffix) + }, + FieldError::Duplicate(ref cursor) + => writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty + => writeln!(f, "Field names must not be empty."), + } + } +} + + +#[derive(Debug)] +pub enum CLIError { + Configuration(ConfigurationError), + ParseError(String, String, String, String), + UnknownParameter(String, Vec<&'static str>), + InvalidUploadProtocol(String, Vec), + InvalidKeyValueSyntax(String, bool), + Input(InputError), + Field(FieldError), + MissingCommandError, + MissingMethodError(String), +} + +impl fmt::Display for CLIError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + CLIError::Configuration(ref err) => write!(f, "Configuration -> {}", err), + CLIError::Input(ref err) => write!(f, "Input -> {}", err), + CLIError::Field(ref err) => write!(f, "Field -> {}", err), + CLIError::InvalidUploadProtocol(ref proto_name, ref valid_names) + => writeln!(f, "'{}' is not a valid upload protocol. Choose from one of {}.", proto_name, valid_names.join(", ")), + CLIError::ParseError(ref arg_name, ref type_name, ref value, ref err_desc) + => writeln!(f, "Failed to parse argument '{}' with value '{}' as {} with error: {}.", + arg_name, value, type_name, err_desc), + CLIError::UnknownParameter(ref param_name, ref possible_values) => { + let suffix = + match did_you_mean(param_name, &possible_values) { + Some(v) => format!(" Did you mean '{}' ?", v), + None => String::new(), + }; + write!(f, "Parameter '{}' is unknown.{}\n", param_name, suffix) + }, + CLIError::InvalidKeyValueSyntax(ref kv, is_hashmap) => { + let hashmap_info = if is_hashmap { "hashmap " } else { "" }; + writeln!(f, "'{}' does not match {}pattern =.", kv, hashmap_info) + }, + CLIError::MissingCommandError => writeln!(f, "Please specify the main sub-command."), + CLIError::MissingMethodError(ref cmd) => writeln!(f, "Please specify the method to call on the '{}' command.", cmd), + } + } +} + +#[derive(Debug)] +pub struct InvalidOptionsError { + pub issues: Vec, + pub exit_code: i32, +} + +impl fmt::Display for InvalidOptionsError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + for issue in &self.issues { + try!(issue.fmt(f)); + } + Ok(()) + } +} + +impl InvalidOptionsError { + pub fn single(err: CLIError, exit_code: i32) -> InvalidOptionsError { + InvalidOptionsError { + issues: vec![err], + exit_code: exit_code, + } + } + + pub fn new() -> InvalidOptionsError { + InvalidOptionsError { + issues: Vec::new(), + exit_code: 1, + } + } +} + +pub fn assure_config_dir_exists(dir: &str) -> Result { + let trdir = dir.trim(); + if trdir.len() == 0 { + return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + } + + let expanded_config_dir = + if trdir.as_bytes()[0] == b'~' { + match env::var("HOME").ok().or(env::var("UserProfile").ok()) { + None => return Err(CLIError::Configuration(ConfigurationError::HomeExpansionFailed(trdir.to_string()))), + Some(mut user) => { + user.push_str(&trdir[1..]); + user + } + } + } else { + trdir.to_string() + }; + + if let Err(err) = fs::create_dir(&expanded_config_dir) { + if err.kind() != io::ErrorKind::AlreadyExists { + return Err(CLIError::Configuration( + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))) + } + } + + Ok(expanded_config_dir) +} + +pub fn application_secret_from_directory(dir: &str, + secret_basename: &str, + json_console_secret: &str) + -> Result { + let secret_path = Path::new(dir).join(secret_basename); + let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); + let secret_io_error = |io_err: io::Error| { + Err(CLIError::Configuration(ConfigurationError::Io( + (secret_str(), io_err) + ))) + }; + + for _ in 0..2 { + match fs::File::open(&secret_path) { + Err(mut err) => { + if err.kind() == io::ErrorKind::NotFound { + // Write our built-in one - user may adjust the written file at will + + err = match fs::OpenOptions::new().create(true).write(true).open(&secret_path) { + Err(cfe) => cfe, + Ok(mut f) => { + // Assure we convert 'ugly' json string into pretty one + let console_secret: ConsoleApplicationSecret + = json::from_str(json_console_secret).unwrap(); + match json::to_writer_pretty(&mut f, &console_secret) { + Err(serde_err) => match serde_err { + json::Error::Io(err) => err, + _ => panic!("Unexpected serde error: {:#?}", serde_err) + }, + Ok(_) => continue, + } + } + }; + // fall through to IO error handling + } + return secret_io_error(err) + }, + Ok(f) => { + match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { + Err(json::Error::Io(err)) => + return secret_io_error(err), + Err(json_err) => + return Err(CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::DecoderError( + (secret_str(), json_err) + )))), + Ok(console_secret) => + match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( + CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::FormatError(secret_str()) + ))) + }, + } + } + } + } + unreachable!(); +} diff --git a/gen/manufacturers1-cli/src/main.rs b/gen/manufacturers1-cli/src/main.rs new file mode 100644 index 0000000000..2315e8557b --- /dev/null +++ b/gen/manufacturers1-cli/src/main.rs @@ -0,0 +1,428 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/cli/main.rs.mako' +// DO NOT EDIT ! +#![allow(unused_variables, unused_imports, dead_code, unused_mut)] + +#[macro_use] +extern crate clap; +extern crate yup_oauth2 as oauth2; +extern crate yup_hyper_mock as mock; +extern crate serde; +extern crate serde_json; +extern crate hyper; +extern crate mime; +extern crate strsim; +extern crate google_manufacturers1 as api; + +use std::env; +use std::io::{self, Write}; +use clap::{App, SubCommand, Arg}; + +mod cmn; + +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, + input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, + calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; + +use std::default::Default; +use std::str::FromStr; + +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; +use serde_json as json; +use clap::ArgMatches; + +enum DoitError { + IoError(String, io::Error), + ApiError(api::Error), +} + +struct Engine<'n> { + opt: ArgMatches<'n>, + hub: api::ManufacturerCenter>, + gp: Vec<&'static str>, + gpm: Vec<(&'static str, &'static str)>, +} + + +impl<'n> Engine<'n> { + fn _accounts_products_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.accounts().products_get(opt.value_of("parent").unwrap_or(""), opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _accounts_products_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.accounts().products_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _doit(&self, dry_run: bool) -> Result, Option> { + let mut err = InvalidOptionsError::new(); + let mut call_result: Result<(), DoitError> = Ok(()); + let mut err_opt: Option = None; + match self.opt.subcommand() { + ("accounts", Some(opt)) => { + match opt.subcommand() { + ("products-get", Some(opt)) => { + call_result = self._accounts_products_get(opt, dry_run, &mut err); + }, + ("products-list", Some(opt)) => { + call_result = self._accounts_products_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("accounts".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + _ => { + err.issues.push(CLIError::MissingCommandError); + writeln!(io::stderr(), "{}\n", self.opt.usage()).ok(); + } + } + + if dry_run { + if err.issues.len() > 0 { + err_opt = Some(err); + } + Err(err_opt) + } else { + Ok(call_result) + } + } + + // Please note that this call will fail if any part of the opt can't be handled + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { + let (config_dir, secret) = { + let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { + Err(e) => return Err(InvalidOptionsError::single(e, 3)), + Ok(p) => p, + }; + + match cmn::application_secret_from_directory(&config_dir, "manufacturers1-secret.json", + "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { + Ok(secret) => (config_dir, secret), + Err(e) => return Err(InvalidOptionsError::single(e, 4)) + } + }; + + let auth = Authenticator::new( &secret, DefaultAuthenticatorDelegate, + if opt.is_present("debug-auth") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::::default() + }) + } else { + hyper::Client::new() + }, + JsonTokenStorage { + program_name: "manufacturers1", + db_dir: config_dir.clone(), + }, Some(FlowType::InstalledRedirect(54324))); + + let client = + if opt.is_present("debug") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::::default() + }) + } else { + hyper::Client::new() + }; + let engine = Engine { + opt: opt, + hub: api::ManufacturerCenter::new(client, auth), + gp: vec!["$-xgafv", "access-token", "alt", "bearer-token", "callback", "fields", "key", "oauth-token", "pp", "pretty-print", "quota-user", "upload-type", "upload-protocol"], + gpm: vec![ + ("$-xgafv", "$.xgafv"), + ("access-token", "access_token"), + ("bearer-token", "bearer_token"), + ("oauth-token", "oauth_token"), + ("pretty-print", "prettyPrint"), + ("quota-user", "quotaUser"), + ("upload-type", "uploadType"), + ("upload-protocol", "upload_protocol"), + ] + }; + + match engine._doit(true) { + Err(Some(err)) => Err(err), + Err(None) => Ok(engine), + Ok(_) => unreachable!(), + } + } + + fn doit(&self) -> Result<(), DoitError> { + match self._doit(false) { + Ok(res) => res, + Err(_) => unreachable!(), + } + } +} + +fn main() { + let mut exit_status = 0i32; + let arg_data = [ + ("accounts", "methods: 'products-get' and 'products-list'", vec![ + ("products-get", + Some(r##"Gets the product from a Manufacturer Center account, including product + issues."##), + "Details at http://byron.github.io/google-apis-rs/google_manufacturers1_cli/accounts_products-get", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Parent ID in the format `accounts/{account_id}`. + + `account_id` - The ID of the Manufacturer Center account."##), + Some(true), + Some(false)), + + (Some(r##"name"##), + None, + Some(r##"Name in the format `{target_country}:{content_language}:{product_id}`. + + `target_country` - The target country of the product as a CLDR territory + code (for example, US). + + `content_language` - The content language of the product as a two-letter + ISO 639-1 language code (for example, en). + + `product_id` - The ID of the product. For more information, see + https://support.google.com/manufacturers/answer/6124116#id."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("products-list", + Some(r##"Lists all the products in a Manufacturer Center account."##), + "Details at http://byron.github.io/google-apis-rs/google_manufacturers1_cli/accounts_products-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Parent ID in the format `accounts/{account_id}`. + + `account_id` - The ID of the Manufacturer Center account."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ]; + + let mut app = App::new("manufacturers1") + .author("Sebastian Thiel ") + .version("1.0.0+20161028") + .about("Public API for managing Manufacturer Center related data.") + .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_manufacturers1_cli") + .arg(Arg::with_name("url") + .long("scope") + .help("Specify the authentication a method should be executed in. Each scope requires the user to grant this application permission to use it.If unset, it defaults to the shortest scope url for a particular method.") + .multiple(true) + .takes_value(true)) + .arg(Arg::with_name("folder") + .long("config-dir") + .help("A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation.[default: ~/.google-service-cli") + .multiple(false) + .takes_value(true)) + .arg(Arg::with_name("debug") + .long("debug") + .help("Output all server communication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)) + .arg(Arg::with_name("debug-auth") + .long("debug-auth") + .help("Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)); + + for &(main_command_name, about, ref subcommands) in arg_data.iter() { + let mut mcmd = SubCommand::with_name(main_command_name).about(about); + + for &(sub_command_name, ref desc, url_info, ref args) in subcommands { + let mut scmd = SubCommand::with_name(sub_command_name); + if let &Some(desc) = desc { + scmd = scmd.about(desc); + } + scmd = scmd.after_help(url_info); + + for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { + let arg_name_str = + match (arg_name, flag) { + (&Some(an), _ ) => an, + (_ , &Some(f)) => f, + _ => unreachable!(), + }; + let mut arg = Arg::with_name(arg_name_str) + .empty_values(false); + if let &Some(short_flag) = flag { + arg = arg.short(short_flag); + } + if let &Some(desc) = desc { + arg = arg.help(desc); + } + if arg_name.is_some() && flag.is_some() { + arg = arg.takes_value(true); + } + if let &Some(required) = required { + arg = arg.required(required); + } + if let &Some(multi) = multi { + arg = arg.multiple(multi); + } + scmd = scmd.arg(arg); + } + mcmd = mcmd.subcommand(scmd); + } + app = app.subcommand(mcmd); + } + + let matches = app.get_matches(); + + let debug = matches.is_present("debug"); + match Engine::new(matches) { + Err(err) => { + exit_status = err.exit_code; + writeln!(io::stderr(), "{}", err).ok(); + }, + Ok(engine) => { + if let Err(doit_err) = engine.doit() { + exit_status = 1; + match doit_err { + DoitError::IoError(path, err) => { + writeln!(io::stderr(), "Failed to open output file '{}': {}", path, err).ok(); + }, + DoitError::ApiError(err) => { + if debug { + writeln!(io::stderr(), "{:#?}", err).ok(); + } else { + writeln!(io::stderr(), "{}", err).ok(); + } + } + } + } + } + } + + std::process::exit(exit_status); +} \ No newline at end of file diff --git a/gen/manufacturers1/Cargo.toml b/gen/manufacturers1/Cargo.toml new file mode 100644 index 0000000000..782a82a88e --- /dev/null +++ b/gen/manufacturers1/Cargo.toml @@ -0,0 +1,34 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-manufacturers1" +version = "1.0.0+20161028" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Manufacturer Center (protocol v1)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/manufacturers1" +homepage = "https://developers.google.com/manufacturers/" +documentation = "http://byron.github.io/google-apis-rs/google_manufacturers1" +license = "MIT" +keywords = ["manufacturers", "google", "protocol", "web", "api"] +build = "src/build.rs" + + +[dependencies] +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.8" +serde_json = "^ 0.8" +yup-oauth2 = { version = "^ 1.0", optional = true, default-features = false } +serde_derive = { version = "^ 0.8", optional = true } +url = "= 0.5" + +[features] +default = ["with-serde-codegen"] +nightly = ["serde_derive","yup-oauth2/nightly"] +with-serde-codegen = ["serde_codegen","yup-oauth2/with-serde-codegen"] + +[build-dependencies] +serde_codegen = { version = "^ 0.8", optional = true } + diff --git a/gen/manufacturers1/LICENSE.md b/gen/manufacturers1/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/manufacturers1/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/manufacturers1/README.md b/gen/manufacturers1/README.md new file mode 100644 index 0000000000..1c63feea27 --- /dev/null +++ b/gen/manufacturers1/README.md @@ -0,0 +1,173 @@ + +The `google-manufacturers1` library allows access to all features of the *Google Manufacturer Center* service. + +This documentation was generated from *Manufacturer Center* crate version *1.0.0+20161028*, where *20161028* is the exact revision of the *manufacturers:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. + +Everything else about the *Manufacturer Center* *v1* API can be found at the +[official documentation site](https://developers.google.com/manufacturers/). +# Features + +Handle the following *Resources* with ease from the central [hub](http://byron.github.io/google-apis-rs/google_manufacturers1/struct.ManufacturerCenter.html) ... + +* accounts + * [*products get*](http://byron.github.io/google-apis-rs/google_manufacturers1/struct.AccountProductGetCall.html) and [*products list*](http://byron.github.io/google-apis-rs/google_manufacturers1/struct.AccountProductListCall.html) + + + + +# Structure of this Library + +The API is structured into the following primary items: + +* **[Hub](http://byron.github.io/google-apis-rs/google_manufacturers1/struct.ManufacturerCenter.html)** + * a central object to maintain state and allow accessing all *Activities* + * creates [*Method Builders*](http://byron.github.io/google-apis-rs/google_manufacturers1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](http://byron.github.io/google-apis-rs/google_manufacturers1/trait.CallBuilder.html) +* **[Resources](http://byron.github.io/google-apis-rs/google_manufacturers1/trait.Resource.html)** + * primary types that you can apply *Activities* to + * a collection of properties and *Parts* + * **[Parts](http://byron.github.io/google-apis-rs/google_manufacturers1/trait.Part.html)** + * a collection of properties + * never directly used in *Activities* +* **[Activities](http://byron.github.io/google-apis-rs/google_manufacturers1/trait.CallBuilder.html)** + * operations to apply to *Resources* + +All *structures* are marked with applicable traits to further categorize them and ease browsing. + +Generally speaking, you can invoke *Activities* like this: + +```Rust,ignore +let r = hub.resource().activity(...).doit() +``` + +Or specifically ... + +```ignore +let r = hub.accounts().products_get(...).doit() +``` + +The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +The `doit()` method performs the actual communication with the server and returns the respective result. + +# Usage + +## Setting up your Project + +To use this library, you would put the following lines into your `Cargo.toml` file: + +```toml +[dependencies] +google-manufacturers1 = "*" +``` + +## A complete example + +```Rust +extern crate hyper; +extern crate yup_oauth2 as oauth2; +extern crate google_manufacturers1 as manufacturers1; +use manufacturers1::{Result, Error}; +use std::default::Default; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +use manufacturers1::ManufacturerCenter; + +// Get an ApplicationSecret instance by some means. It contains the `client_id` and +// `client_secret`, among other things. +let secret: ApplicationSecret = Default::default(); +// Instantiate the authenticator. It will choose a suitable authentication flow for you, +// unless you replace `None` with the desired Flow. +// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +// retrieve them from storage. +let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, + hyper::Client::new(), + ::default(), None); +let mut hub = ManufacturerCenter::new(hyper::Client::new(), auth); +// You can configure optional parameters by calling the respective setters at will, and +// execute the final call using `doit()`. +// Values shown here are possibly random and not representative ! +let result = hub.accounts().products_get("parent", "name") + .doit(); + +match result { + Err(e) => match e { + // The Error enum provides details about what exactly happened. + // You can also just use its `Debug`, `Display` or `Error` traits + Error::HttpError(_) + |Error::MissingAPIKey + |Error::MissingToken(_) + |Error::Cancelled + |Error::UploadSizeLimitExceeded(_, _) + |Error::Failure(_) + |Error::BadRequest(_) + |Error::FieldClash(_) + |Error::JsonDecodeError(_, _) => println!("{}", e), + }, + Ok(res) => println!("Success: {:?}", res), +} + +``` +## Handling Errors + +All errors produced by the system are provided either as [Result](http://byron.github.io/google-apis-rs/google_manufacturers1/enum.Result.html) enumeration as return value of +the doit() methods, or handed as possibly intermediate results to either the +[Hub Delegate](http://byron.github.io/google-apis-rs/google_manufacturers1/trait.Delegate.html), or the [Authenticator Delegate](http://byron.github.io/google-apis-rs/google_manufacturers1/../yup-oauth2/trait.AuthenticatorDelegate.html). + +When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +makes the system potentially resilient to all kinds of errors. + +## Uploads and Downloads +If a method supports downloads, the response body, which is part of the [Result](http://byron.github.io/google-apis-rs/google_manufacturers1/enum.Result.html), should be +read by you to obtain the media. +If such a method also supports a [Response Result](http://byron.github.io/google-apis-rs/google_manufacturers1/trait.ResponseResult.html), it will return that by default. +You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +this call: `.param("alt", "media")`. + +Methods supporting uploads can do so using up to 2 different protocols: +*simple* and *resumable*. The distinctiveness of each is represented by customized +`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. + +## Customization and Callbacks + +You may alter the way an `doit()` method is called by providing a [delegate](http://byron.github.io/google-apis-rs/google_manufacturers1/trait.Delegate.html) to the +[Method Builder](http://byron.github.io/google-apis-rs/google_manufacturers1/trait.CallBuilder.html) before making the final `doit()` call. +Respective methods will be called to provide progress information, as well as determine whether the system should +retry on failure. + +The [delegate trait](http://byron.github.io/google-apis-rs/google_manufacturers1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. + +## Optional Parts in Server-Requests + +All structures provided by this library are made to be [enocodable](http://byron.github.io/google-apis-rs/google_manufacturers1/trait.RequestValue.html) and +[decodable](http://byron.github.io/google-apis-rs/google_manufacturers1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +are valid. +Most optionals are are considered [Parts](http://byron.github.io/google-apis-rs/google_manufacturers1/trait.Part.html) which are identifiable by name, which will be sent to +the server to indicate either the set parts of the request or the desired parts in the response. + +## Builder Arguments + +Using [method builders](http://byron.github.io/google-apis-rs/google_manufacturers1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +These will always take a single argument, for which the following statements are true. + +* [PODs][wiki-pod] are handed by copy +* strings are passed as `&str` +* [request values](http://byron.github.io/google-apis-rs/google_manufacturers1/trait.RequestValue.html) are moved + +Arguments will always be copied or cloned into the builder, to make them independent of their original life times. + +[wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +[google-go-api]: https://github.com/google/google-api-go-client + +# License +The **manufacturers1** library was generated by Sebastian Thiel, and is placed +under the *MIT* license. +You can read the full text at the repository's [license file][repo-license]. + +[repo-license]: https://github.com/Byron/google-apis-rs/LICENSE.md diff --git a/gen/manufacturers1/src/build.rs b/gen/manufacturers1/src/build.rs new file mode 100644 index 0000000000..0bebaf0bf0 --- /dev/null +++ b/gen/manufacturers1/src/build.rs @@ -0,0 +1,25 @@ +#[cfg(feature = "with-serde-codegen")] +mod inner { + extern crate serde_codegen; + + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + serde_codegen::expand(&src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-serde-codegen"))] +mod inner { + pub fn main() {} +} + +pub fn main() { + inner::main() +} \ No newline at end of file diff --git a/gen/manufacturers1/src/cmn.rs b/gen/manufacturers1/src/cmn.rs new file mode 100644 index 0000000000..d75063e466 --- /dev/null +++ b/gen/manufacturers1/src/cmn.rs @@ -0,0 +1,753 @@ +// COPY OF 'src/rust/api/cmn.rs' +// DO NOT EDIT +use std::io::{self, Read, Seek, Cursor, Write, SeekFrom}; +use std; +use std::fmt::{self, Display}; +use std::str::FromStr; +use std::error; +use std::thread::sleep; +use std::time::Duration; + +use mime::{Mime, TopLevel, SubLevel, Attr, Value}; +use oauth2::{TokenType, Retry, self}; +use hyper; +use hyper::header::{ContentType, ContentLength, Headers, UserAgent, Authorization, Header, + HeaderFormat, Bearer}; +use hyper::http::h1::LINE_ENDING; +use hyper::method::Method; +use hyper::status::StatusCode; + +use serde_json as json; + +/// Identifies the Hub. There is only one per library, this trait is supposed +/// to make intended use more explicit. +/// The hub allows to access all resource methods more easily. +pub trait Hub {} + +/// Identifies types for building methods of a particular resource type +pub trait MethodsBuilder {} + +/// Identifies types which represent builders for a particular resource method +pub trait CallBuilder {} + +/// Identifies types which can be inserted and deleted. +/// Types with this trait are most commonly used by clients of this API. +pub trait Resource {} + +/// Identifies types which are used in API responses. +pub trait ResponseResult {} + +/// Identifies types which are used in API requests. +pub trait RequestValue {} + +/// Identifies types which are not actually used by the API +/// This might be a bug within the google API schema. +pub trait UnusedType {} + +/// Identifies types which are only used as part of other types, which +/// usually are carrying the `Resource` trait. +pub trait Part {} + +/// Identifies types which are only used by other types internally. +/// They have no special meaning, this trait just marks them for completeness. +pub trait NestedType {} + +/// A utility to specify reader types which provide seeking capabilities too +pub trait ReadSeek: Seek + Read {} +impl ReadSeek for T {} + +/// A trait for all types that can convert themselves into a *parts* string +pub trait ToParts { + fn to_parts(&self) -> String; +} + +/// A utility type which can decode a server response that indicates error +#[derive(Deserialize)] +pub struct JsonServerError { + pub error: String, + pub error_description: Option +} + +/// A utility to represent detailed errors we might see in case there are BadRequests. +/// The latter happen if the sent parameters or request structures are unsound +#[derive(Deserialize, Serialize, Debug)] +pub struct ErrorResponse { + error: ServerError, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerError { + errors: Vec, + code: u16, + message: String, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerMessage { + domain: String, + reason: String, + message: String, + #[serde(rename="locationType")] + location_type: Option, + location: Option +} + +#[derive(Copy, Clone)] +pub struct DummyNetworkStream; + +impl Read for DummyNetworkStream { + fn read(&mut self, _: &mut [u8]) -> io::Result { + Ok(0) + } +} + +impl Write for DummyNetworkStream { + fn write(&mut self, _: &[u8]) -> io::Result { + Ok(0) + } + + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} + +impl hyper::net::NetworkStream for DummyNetworkStream { + fn peer_addr(&mut self) -> io::Result { + Ok("127.0.0.1:1337".parse().unwrap()) + } + + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } + + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } +} + + +/// A trait specifying functionality to help controlling any request performed by the API. +/// The trait has a conservative default implementation. +/// +/// It contains methods to deal with all common issues, as well with the ones related to +/// uploading media +pub trait Delegate { + + /// Called at the beginning of any API request. The delegate should store the method + /// information if he is interesting in knowing more context when further calls to it + /// are made. + /// The matching `finished()` call will always be made, no matter whether or not the API + /// request was successful. That way, the delegate may easily maintain a clean state + /// between various API calls. + fn begin(&mut self, MethodInfo) {} + + /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + /// + /// Return retry information. + fn http_error(&mut self, &hyper::Error) -> Retry { + Retry::Abort + } + + /// Called whenever there is the need for your applications API key after + /// the official authenticator implementation didn't provide one, for some reason. + /// If this method returns None as well, the underlying operation will fail + fn api_key(&mut self) -> Option { + None + } + + /// Called whenever the Authenticator didn't yield a token. The delegate + /// may attempt to provide one, or just take it as a general information about the + /// impending failure. + /// The given Error provides information about why the token couldn't be acquired in the + /// first place + fn token(&mut self, err: &error::Error) -> Option { + let _ = err; + None + } + + /// Called during resumable uploads to provide a URL for the impending upload. + /// It was saved after a previous call to `store_upload_url(...)`, and if not None, + /// will be used instead of asking the server for a new upload URL. + /// This is useful in case a previous resumable upload was aborted/canceled, but should now + /// be resumed. + /// The returned URL will be used exactly once - if it fails again and the delegate allows + /// to retry, we will ask the server for a new upload URL. + fn upload_url(&mut self) -> Option { + None + } + + /// Called after we have retrieved a new upload URL for a resumable upload to store it + /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// see `upload_url()`. + /// It will also be called with None after a successful upload, which allows the delegate + /// to forget the URL. That way, we will not attempt to resume an upload that has already + /// finished. + fn store_upload_url(&mut self, url: Option<&str>) { + let _ = url; + } + + /// Called whenever a server response could not be decoded from json. + /// It's for informational purposes only, the caller will return with an error + /// accordingly. + /// + /// # Arguments + /// + /// * `json_encoded_value` - The json-encoded value which failed to decode. + /// * `json_decode_error` - The decoder error + fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &json::Error) { + let _ = json_encoded_value; + let _ = json_decode_error; + } + + /// Called whenever the http request returns with a non-success status code. + /// This can involve authentication issues, or anything else that very much + /// depends on the used API method. + /// The delegate should check the status, header and decoded json error to decide + /// whether to retry or not. In the latter case, the underlying call will fail. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + fn http_failure(&mut self, _: &hyper::client::Response, Option, _: Option) -> Retry { + Retry::Abort + } + + /// Called prior to sending the main request of the given method. It can be used to time + /// the call or to print progress information. + /// It's also useful as you can be sure that a request will definitely be made. + fn pre_request(&mut self) { } + + /// Return the size of each chunk of a resumable upload. + /// Must be a power of two, with 1<<18 being the smallest allowed chunk size. + /// Will be called once before starting any resumable upload. + fn chunk_size(&mut self) -> u64 { + 1 << 23 + } + + /// Called before the given chunk is uploaded to the server. + /// If true is returned, the upload will be interrupted. + /// However, it may be resumable if you stored the upload URL in a previous call + /// to `store_upload_url()` + fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { + let _ = chunk; + false + } + + /// Called before the API request method returns, in every case. It can be used to clean up + /// internal state between calls to the API. + /// This call always has a matching call to `begin(...)`. + /// + /// # Arguments + /// + /// * `is_success` - a true value indicates the operation was successful. If false, you should + /// discard all values stored during `store_upload_url`. + fn finished(&mut self, is_success: bool) { + let _ = is_success; + } +} + +/// A delegate with a conservative default implementation, which is used if no other delegate is +/// set. +#[derive(Default)] +pub struct DefaultDelegate; + +impl Delegate for DefaultDelegate {} + + +#[derive(Debug)] +pub enum Error { + /// The http connection failed + HttpError(hyper::Error), + + /// An attempt was made to upload a resource with size stored in field `.0` + /// even though the maximum upload size is what is stored in field `.1`. + UploadSizeLimitExceeded(u64, u64), + + /// Represents information about a request that was not understood by the server. + /// Details are included. + BadRequest(ErrorResponse), + + /// We needed an API key for authentication, but didn't obtain one. + /// Neither through the authenticator, nor through the Delegate. + MissingAPIKey, + + /// We required a Token, but didn't get one from the Authenticator + MissingToken(Box), + + /// The delgate instructed to cancel the operation + Cancelled, + + /// An additional, free form field clashed with one of the built-in optional ones + FieldClash(&'static str), + + /// Shows that we failed to decode the server response. + /// This can happen if the protocol changes in conjunction with strict json decoding. + JsonDecodeError(String, json::Error), + + /// Indicates an HTTP repsonse with a non-success status code + Failure(hyper::client::Response), +} + + +impl Display for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + Error::HttpError(ref err) => err.fmt(f), + Error::UploadSizeLimitExceeded(ref resource_size, ref max_size) => + writeln!(f, "The media size {} exceeds the maximum allowed upload size of {}" + , resource_size, max_size), + Error::MissingAPIKey => { + (writeln!(f, "The application's API key was not found in the configuration")).ok(); + writeln!(f, "It is used as there are no Scopes defined for this method.") + }, + Error::BadRequest(ref err) => { + try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); + for err in err.error.errors.iter() { + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, + err.reason, + match &err.location { + &Some(ref loc) => format!("@{}", loc), + &None => String::new(), + })); + } + Ok(()) + }, + Error::MissingToken(ref err) => + writeln!(f, "Token retrieval failed with error: {}", err), + Error::Cancelled => + writeln!(f, "Operation cancelled by delegate"), + Error::FieldClash(field) => + writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), + Error::JsonDecodeError(ref json_str, ref err) + => writeln!(f, "{}: {}", err, json_str), + Error::Failure(ref response) => + writeln!(f, "Http status indicates failure: {:?}", response), + } + } +} + +impl error::Error for Error { + fn description(&self) -> &str { + match *self { + Error::HttpError(ref err) => err.description(), + Error::JsonDecodeError(_, ref err) => err.description(), + _ => "NO DESCRIPTION POSSIBLE - use `Display.fmt()` instead" + } + } + + fn cause(&self) -> Option<&error::Error> { + match *self { + Error::HttpError(ref err) => err.cause(), + Error::JsonDecodeError(_, ref err) => err.cause(), + _ => None + } + } +} + +/// A universal result type used as return for all calls. +pub type Result = std::result::Result; + +/// Contains information about an API request. +pub struct MethodInfo { + pub id: &'static str, + pub http_method: Method, +} + +const BOUNDARY: &'static str = "MDuXWGyeE33QFXGchb2VFWc4Z7945d"; + +/// Provides a `Read` interface that converts multiple parts into the protocol +/// identified by [RFC2387](https://tools.ietf.org/html/rfc2387). +/// **Note**: This implementation is just as rich as it needs to be to perform uploads +/// to google APIs, and might not be a fully-featured implementation. +#[derive(Default)] +pub struct MultiPartReader<'a> { + raw_parts: Vec<(Headers, &'a mut Read)>, + current_part: Option<(Cursor>, &'a mut Read)>, + last_part_boundary: Option>>, +} + +impl<'a> MultiPartReader<'a> { + + /// Reserve memory for exactly the given amount of parts + pub fn reserve_exact(&mut self, cap: usize) { + self.raw_parts.reserve_exact(cap); + } + + /// Add a new part to the queue of parts to be read on the first `read` call. + /// + /// # Arguments + /// + /// `headers` - identifying the body of the part. It's similar to the header + /// in an ordinary single-part call, and should thus contain the + /// same information. + /// `reader` - a reader providing the part's body + /// `size` - the amount of bytes provided by the reader. It will be put onto the header as + /// content-size. + /// `mime` - It will be put onto the content type + pub fn add_part(&mut self, reader: &'a mut Read, size: u64, mime_type: Mime) -> &mut MultiPartReader<'a> { + let mut headers = Headers::new(); + headers.set(ContentType(mime_type)); + headers.set(ContentLength(size)); + self.raw_parts.push((headers, reader)); + self + } + + /// Returns the mime-type representing our multi-part message. + /// Use it with the ContentType header. + pub fn mime_type(&self) -> Mime { + Mime( + TopLevel::Multipart, + SubLevel::Ext("Related".to_string()), + vec![(Attr::Ext("boundary".to_string()), Value::Ext(BOUNDARY.to_string()))], + ) + } + + /// Returns true if we are totally used + fn is_depleted(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_none() && self.last_part_boundary.is_none() + } + + /// Returns true if we are handling our last part + fn is_last_part(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_some() + } +} + +impl<'a> Read for MultiPartReader<'a> { + fn read(&mut self, buf: &mut [u8]) -> io::Result { + match (self.raw_parts.len(), + self.current_part.is_none(), + self.last_part_boundary.is_none()) { + (_, _, false) => { + let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); + if br < buf.len() { + self.last_part_boundary = None; + } + return Ok(br) + }, + (0, true, true) => return Ok(0), + (n, true, _) if n > 0 => { + let (headers, reader) = self.raw_parts.remove(0); + let mut c = Cursor::new(Vec::::new()); + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + headers, LINE_ENDING)).unwrap(); + c.seek(SeekFrom::Start(0)).unwrap(); + self.current_part = Some((c, reader)); + } + _ => {}, + } + + // read headers as long as possible + let (hb, rr) = { + let &mut (ref mut c, ref mut reader) = self.current_part.as_mut().unwrap(); + let b = c.read(buf).unwrap_or(0); + (b, reader.read(&mut buf[b..])) + }; + + match rr { + Ok(bytes_read) => { + if hb < buf.len() && bytes_read == 0 { + if self.is_last_part() { + // before clearing the last part, we will add the boundary that + // will be written last + self.last_part_boundary = Some(Cursor::new( + format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) + } + // We are depleted - this can trigger the next part to come in + self.current_part = None; + } + let mut total_bytes_read = hb + bytes_read; + while total_bytes_read < buf.len() && !self.is_depleted() { + match self.read(&mut buf[total_bytes_read ..]) { + Ok(br) => total_bytes_read += br, + Err(err) => return Err(err), + } + } + Ok(total_bytes_read) + } + Err(err) => { + // fail permanently + self.current_part = None; + self.last_part_boundary = None; + self.raw_parts.clear(); + Err(err) + } + } + } +} + +/// The `X-Upload-Content-Type` header. +/// +/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// processed to be more readable. +#[derive(PartialEq, Debug, Clone)] +pub struct XUploadContentType(pub Mime); + +impl ::std::ops::Deref for XUploadContentType { + type Target = Mime; + fn deref<'a>(&'a self) -> &'a Mime { &self.0 } +} +impl ::std::ops::DerefMut for XUploadContentType { + fn deref_mut<'a>(&'a mut self) -> &'a mut Mime { &mut self.0 } +} +impl Header for XUploadContentType { + fn header_name() -> &'static str { "X-Upload-Content-Type" } + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + hyper::header::parsing::from_one_raw_str(raw).map(XUploadContentType) + } +} +impl HeaderFormat for XUploadContentType { + fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result { + Display::fmt(&**self, f) + } +} +impl Display for XUploadContentType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(&**self, f) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct Chunk { + pub first: u64, + pub last: u64 +} + +impl fmt::Display for Chunk { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + (write!(fmt, "{}-{}", self.first, self.last)).ok(); + Ok(()) + } +} + +impl FromStr for Chunk { + type Err = &'static str; + + /// NOTE: only implements `%i-%i`, not `*` + fn from_str(s: &str) -> std::result::Result { + let parts: Vec<&str> = s.split('-').collect(); + if parts.len() != 2 { + return Err("Expected two parts: %i-%i") + } + Ok( + Chunk { + first: match FromStr::from_str(parts[0]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'first' as digit") + }, + last: match FromStr::from_str(parts[1]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'last' as digit") + } + } + ) + } +} + +/// Implements the Content-Range header, for serialization only +#[derive(Clone, PartialEq, Debug)] +pub struct ContentRange { + pub range: Option, + pub total_length: u64, +} + +impl Header for ContentRange { + fn header_name() -> &'static str { + "Content-Range" + } + + /// We are not parsable, as parsing is done by the `Range` header + fn parse_header(_: &[Vec]) -> hyper::error::Result { + Err(hyper::error::Error::Method) + } +} + + +impl HeaderFormat for ContentRange { + fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + try!(fmt.write_str("bytes ")); + match self.range { + Some(ref c) => try!(c.fmt(fmt)), + None => try!(fmt.write_str("*")) + } + (write!(fmt, "/{}", self.total_length)).ok(); + Ok(()) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct RangeResponseHeader(pub Chunk); + +impl Header for RangeResponseHeader { + fn header_name() -> &'static str { + "Range" + } + + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + if raw.len() > 0 { + let v = &raw[0]; + if let Ok(s) = std::str::from_utf8(v) { + const PREFIX: &'static str = "bytes "; + if s.starts_with(PREFIX) { + if let Ok(c) = ::from_str(&s[PREFIX.len()..]) { + return Ok(RangeResponseHeader(c)) + } + } + } + } + Err(hyper::error::Error::Method) + } +} + +impl HeaderFormat for RangeResponseHeader { + /// No implmentation necessary, we just need to parse + fn fmt_header(&self, _: &mut fmt::Formatter) -> fmt::Result { + Err(fmt::Error) + } +} + +/// A utility type to perform a resumable upload from start to end. +pub struct ResumableUploadHelper<'a, A: 'a> { + pub client: &'a mut hyper::client::Client, + pub delegate: &'a mut Delegate, + pub start_at: Option, + pub auth: &'a mut A, + pub user_agent: &'a str, + pub auth_header: Authorization, + pub url: &'a str, + pub reader: &'a mut ReadSeek, + pub media_type: Mime, + pub content_length: u64 +} + +impl<'a, A> ResumableUploadHelper<'a, A> + where A: oauth2::GetToken { + + fn query_transfer_status(&mut self) -> std::result::Result> { + loop { + match self.client.post(self.url) + .header(UserAgent(self.user_agent.to_string())) + .header(ContentRange { range: None, total_length: self.content_length }) + .header(self.auth_header.clone()) + .send() { + Ok(r) => { + // 308 = resume-incomplete == PermanentRedirect + let headers = r.headers.clone(); + let h: &RangeResponseHeader = match headers.get() { + Some(hh) if r.status == StatusCode::PermanentRedirect => hh, + None|Some(_) => { + if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { + sleep(d); + continue; + } + return Err(Ok(r)) + } + }; + return Ok(h.0.last) + } + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Err(Err(err)) + } + } + } + } + + /// returns None if operation was cancelled by delegate, or the HttpResult. + /// It can be that we return the result just because we didn't understand the status code - + /// caller should check for status himself before assuming it's OK to use + pub fn upload(&mut self) -> Option> { + let mut start = match self.start_at { + Some(s) => s, + None => match self.query_transfer_status() { + Ok(s) => s, + Err(result) => return Some(result) + } + }; + + const MIN_CHUNK_SIZE: u64 = 1 << 18; + let chunk_size = match self.delegate.chunk_size() { + cs if cs > MIN_CHUNK_SIZE => cs, + _ => MIN_CHUNK_SIZE + }; + + self.reader.seek(SeekFrom::Start(start)).unwrap(); + loop { + let request_size = match self.content_length - start { + rs if rs > chunk_size => chunk_size, + rs => rs + }; + + let mut section_reader = self.reader.take(request_size); + let range_header = ContentRange { + range: Some(Chunk {first: start, last: start + request_size - 1}), + total_length: self.content_length + }; + start += request_size; + if self.delegate.cancel_chunk_upload(&range_header) { + return None + } + let res = self.client.post(self.url) + .header(range_header) + .header(ContentType(self.media_type.clone())) + .header(UserAgent(self.user_agent.to_string())) + .body(&mut section_reader) + .send(); + match res { + Ok(mut res) => { + if res.status == StatusCode::PermanentRedirect { + continue + } + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let Retry::After(d) = self.delegate.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + } + return Some(Ok(res)) + }, + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Some(Err(err)) + } + } + } + } +} + +// Copy of src/rust/cli/cmn.rs +// TODO(ST): Allow sharing common code between program types +pub fn remove_json_null_values(value: &mut json::value::Value) { + match *value { + json::value::Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} diff --git a/gen/manufacturers1/src/lib.rs b/gen/manufacturers1/src/lib.rs new file mode 100644 index 0000000000..abd2986b32 --- /dev/null +++ b/gen/manufacturers1/src/lib.rs @@ -0,0 +1,182 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +//! This documentation was generated from *Manufacturer Center* crate version *1.0.0+20161028*, where *20161028* is the exact revision of the *manufacturers:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! +//! Everything else about the *Manufacturer Center* *v1* API can be found at the +//! [official documentation site](https://developers.google.com/manufacturers/). +//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/manufacturers1). +//! # Features +//! +//! Handle the following *Resources* with ease from the central [hub](struct.ManufacturerCenter.html) ... +//! +//! * accounts +//! * [*products get*](struct.AccountProductGetCall.html) and [*products list*](struct.AccountProductListCall.html) +//! +//! +//! +//! +//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](../index.html). +//! +//! # Structure of this Library +//! +//! The API is structured into the following primary items: +//! +//! * **[Hub](struct.ManufacturerCenter.html)** +//! * a central object to maintain state and allow accessing all *Activities* +//! * creates [*Method Builders*](trait.MethodsBuilder.html) which in turn +//! allow access to individual [*Call Builders*](trait.CallBuilder.html) +//! * **[Resources](trait.Resource.html)** +//! * primary types that you can apply *Activities* to +//! * a collection of properties and *Parts* +//! * **[Parts](trait.Part.html)** +//! * a collection of properties +//! * never directly used in *Activities* +//! * **[Activities](trait.CallBuilder.html)** +//! * operations to apply to *Resources* +//! +//! All *structures* are marked with applicable traits to further categorize them and ease browsing. +//! +//! Generally speaking, you can invoke *Activities* like this: +//! +//! ```Rust,ignore +//! let r = hub.resource().activity(...).doit() +//! ``` +//! +//! Or specifically ... +//! +//! ```ignore +//! let r = hub.accounts().products_get(...).doit() +//! ``` +//! +//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +//! The `doit()` method performs the actual communication with the server and returns the respective result. +//! +//! # Usage +//! +//! ## Setting up your Project +//! +//! To use this library, you would put the following lines into your `Cargo.toml` file: +//! +//! ```toml +//! [dependencies] +//! google-manufacturers1 = "*" +//! ``` +//! +//! ## A complete example +//! +//! ```test_harness,no_run +//! extern crate hyper; +//! extern crate yup_oauth2 as oauth2; +//! extern crate google_manufacturers1 as manufacturers1; +//! use manufacturers1::{Result, Error}; +//! # #[test] fn egal() { +//! use std::default::Default; +//! use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +//! use manufacturers1::ManufacturerCenter; +//! +//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and +//! // `client_secret`, among other things. +//! let secret: ApplicationSecret = Default::default(); +//! // Instantiate the authenticator. It will choose a suitable authentication flow for you, +//! // unless you replace `None` with the desired Flow. +//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +//! // retrieve them from storage. +//! let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +//! hyper::Client::new(), +//! ::default(), None); +//! let mut hub = ManufacturerCenter::new(hyper::Client::new(), auth); +//! // You can configure optional parameters by calling the respective setters at will, and +//! // execute the final call using `doit()`. +//! // Values shown here are possibly random and not representative ! +//! let result = hub.accounts().products_get("parent", "name") +//! .doit(); +//! +//! match result { +//! Err(e) => match e { +//! // The Error enum provides details about what exactly happened. +//! // You can also just use its `Debug`, `Display` or `Error` traits +//! Error::HttpError(_) +//! |Error::MissingAPIKey +//! |Error::MissingToken(_) +//! |Error::Cancelled +//! |Error::UploadSizeLimitExceeded(_, _) +//! |Error::Failure(_) +//! |Error::BadRequest(_) +//! |Error::FieldClash(_) +//! |Error::JsonDecodeError(_, _) => println!("{}", e), +//! }, +//! Ok(res) => println!("Success: {:?}", res), +//! } +//! # } +//! ``` +//! ## Handling Errors +//! +//! All errors produced by the system are provided either as [Result](enum.Result.html) enumeration as return value of +//! the doit() methods, or handed as possibly intermediate results to either the +//! [Hub Delegate](trait.Delegate.html), or the [Authenticator Delegate](../yup-oauth2/trait.AuthenticatorDelegate.html). +//! +//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +//! makes the system potentially resilient to all kinds of errors. +//! +//! ## Uploads and Downloads +//! If a method supports downloads, the response body, which is part of the [Result](enum.Result.html), should be +//! read by you to obtain the media. +//! If such a method also supports a [Response Result](trait.ResponseResult.html), it will return that by default. +//! You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +//! this call: `.param("alt", "media")`. +//! +//! Methods supporting uploads can do so using up to 2 different protocols: +//! *simple* and *resumable*. The distinctiveness of each is represented by customized +//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. +//! +//! ## Customization and Callbacks +//! +//! You may alter the way an `doit()` method is called by providing a [delegate](trait.Delegate.html) to the +//! [Method Builder](trait.CallBuilder.html) before making the final `doit()` call. +//! Respective methods will be called to provide progress information, as well as determine whether the system should +//! retry on failure. +//! +//! The [delegate trait](trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +//! +//! ## Optional Parts in Server-Requests +//! +//! All structures provided by this library are made to be [enocodable](trait.RequestValue.html) and +//! [decodable](trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +//! are valid. +//! Most optionals are are considered [Parts](trait.Part.html) which are identifiable by name, which will be sent to +//! the server to indicate either the set parts of the request or the desired parts in the response. +//! +//! ## Builder Arguments +//! +//! Using [method builders](trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +//! These will always take a single argument, for which the following statements are true. +//! +//! * [PODs][wiki-pod] are handed by copy +//! * strings are passed as `&str` +//! * [request values](trait.RequestValue.html) are moved +//! +//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times. +//! +//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +//! [google-go-api]: https://github.com/google/google-api-go-client +//! +//! + +// Unused attributes happen thanks to defined, but unused structures +// We don't warn about this, as depending on the API, some data structures or facilities are never used. +// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any +// unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(proc_macro))] +#![allow(unused_imports, unused_mut, dead_code)] + +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-serde-codegen")] +include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/manufacturers1/src/lib.rs.in b/gen/manufacturers1/src/lib.rs.in new file mode 100644 index 0000000000..819b70f699 --- /dev/null +++ b/gen/manufacturers1/src/lib.rs.in @@ -0,0 +1,953 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.in.mako' +// DO NOT EDIT ! + +#[cfg(feature = "nightly")] +#[macro_use] +extern crate serde_derive; + +extern crate hyper; +extern crate serde; +extern crate serde_json; +extern crate yup_oauth2 as oauth2; +extern crate mime; +extern crate url; + +mod cmn; + +use std::collections::HashMap; +use std::cell::RefCell; +use std::borrow::BorrowMut; +use std::default::Default; +use std::collections::BTreeMap; +use serde_json as json; +use std::io; +use std::fs; +use std::thread::sleep; +use std::time::Duration; + +pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + Resource, ErrorResponse, remove_json_null_values}; + + +// ############## +// UTILITIES ### +// ############ + +/// Identifies the an OAuth2 authorization scope. +/// A scope is needed when requesting an +/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). +#[derive(PartialEq, Eq, Hash)] +pub enum Scope { + /// Manage your product listings for Google Manufacturer Center + Manufacturercenter, +} + +impl AsRef for Scope { + fn as_ref(&self) -> &str { + match *self { + Scope::Manufacturercenter => "https://www.googleapis.com/auth/manufacturercenter", + } + } +} + +impl Default for Scope { + fn default() -> Scope { + Scope::Manufacturercenter + } +} + + + +// ######## +// HUB ### +// ###### + +/// Central instance to access all ManufacturerCenter related resource activities +/// +/// # Examples +/// +/// Instantiate a new hub +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_manufacturers1 as manufacturers1; +/// use manufacturers1::{Result, Error}; +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use manufacturers1::ManufacturerCenter; +/// +/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and +/// // `client_secret`, among other things. +/// let secret: ApplicationSecret = Default::default(); +/// // Instantiate the authenticator. It will choose a suitable authentication flow for you, +/// // unless you replace `None` with the desired Flow. +/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +/// // retrieve them from storage. +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = ManufacturerCenter::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.accounts().products_get("parent", "name") +/// .doit(); +/// +/// match result { +/// Err(e) => match e { +/// // The Error enum provides details about what exactly happened. +/// // You can also just use its `Debug`, `Display` or `Error` traits +/// Error::HttpError(_) +/// |Error::MissingAPIKey +/// |Error::MissingToken(_) +/// |Error::Cancelled +/// |Error::UploadSizeLimitExceeded(_, _) +/// |Error::Failure(_) +/// |Error::BadRequest(_) +/// |Error::FieldClash(_) +/// |Error::JsonDecodeError(_, _) => println!("{}", e), +/// }, +/// Ok(res) => println!("Success: {:?}", res), +/// } +/// # } +/// ``` +pub struct ManufacturerCenter { + client: RefCell, + auth: RefCell, + _user_agent: String, +} + +impl<'a, C, A> Hub for ManufacturerCenter {} + +impl<'a, C, A> ManufacturerCenter + where C: BorrowMut, A: oauth2::GetToken { + + pub fn new(client: C, authenticator: A) -> ManufacturerCenter { + ManufacturerCenter { + client: RefCell::new(client), + auth: RefCell::new(authenticator), + _user_agent: "google-api-rust-client/1.0.0".to_string(), + } + } + + pub fn accounts(&'a self) -> AccountMethods<'a, C, A> { + AccountMethods { hub: &self } + } + + /// Set the user-agent header field to use in all requests to the server. + /// It defaults to `google-api-rust-client/1.0.0`. + /// + /// Returns the previously set user-agent. + pub fn user_agent(&mut self, agent_name: String) -> String { + let prev = self._user_agent.clone(); + self._user_agent = agent_name; + prev + } +} + + +// ############ +// SCHEMAS ### +// ########## +/// Attributes of the product. For more information, see +/// https://support.google.com/manufacturers/answer/6124116. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Attributes { + /// The name of the group of products related to the product. For more + /// information, see + /// https://support.google.com/manufacturers/answer/6124116#productline. + #[serde(rename="productLine")] + pub product_line: Option, + /// The title of the product. For more information, see + /// https://support.google.com/manufacturers/answer/6124116#title. + pub title: Option, + /// The Manufacturer Part Number (MPN) of the product. For more information, + /// see https://support.google.com/manufacturers/answer/6124116#mpn. + pub mpn: Option, + /// The brand name of the product. For more information, see + /// https://support.google.com/manufacturers/answer/6124116#brand. + pub brand: Option, + /// The canonical name of the product. For more information, see + /// https://support.google.com/manufacturers/answer/6124116#productname. + #[serde(rename="productName")] + pub product_name: Option, + /// The URL of the manufacturer's detail page of the product. For more + /// information, see + /// https://support.google.com/manufacturers/answer/6124116#productpage. + #[serde(rename="productPageUrl")] + pub product_page_url: Option, + /// The Global Trade Item Number (GTIN) of the product. For more information, + /// see https://support.google.com/manufacturers/answer/6124116#gtin. + pub gtin: Option>, + /// The manufacturer's category of the product. For more information, see + /// https://support.google.com/manufacturers/answer/6124116#producttype. + #[serde(rename="productType")] + pub product_type: Option>, +} + +impl Part for Attributes {} + + +/// Product data. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [products get accounts](struct.AccountProductGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Product { + /// The target country of the product as a CLDR territory code (for example, + /// US). + /// @OutputOnly + #[serde(rename="targetCountry")] + pub target_country: Option, + /// Names of the attributes of the product deleted manually via the + /// Manufacturer Center UI. + /// @OutputOnly + #[serde(rename="manuallyDeletedAttributes")] + pub manually_deleted_attributes: Option>, + /// Parent ID in the format `accounts/{account_id}`. + /// + /// `account_id` - The ID of the Manufacturer Center account. + /// @OutputOnly + pub parent: Option, + /// The content language of the product as a two-letter ISO 639-1 language code + /// (for example, en). + /// @OutputOnly + #[serde(rename="contentLanguage")] + pub content_language: Option, + /// Attributes of the product provided manually via the Manufacturer Center UI. + /// @OutputOnly + #[serde(rename="manuallyProvidedAttributes")] + pub manually_provided_attributes: Option, + /// Final attributes of the product. The final attributes are obtained by + /// overriding the uploaded attributes with the manually provided and deleted + /// attributes. Google systems only process, evaluate, review, and/or use final + /// attributes. + /// @OutputOnly + #[serde(rename="finalAttributes")] + pub final_attributes: Option, + /// Attributes of the product uploaded via the Manufacturer Center API or via + /// feeds. + #[serde(rename="uploadedAttributes")] + pub uploaded_attributes: Option, + /// The ID of the product. For more information, see + /// https://support.google.com/manufacturers/answer/6124116#id. + /// @OutputOnly + #[serde(rename="productId")] + pub product_id: Option, + /// A server-generated list of issues associated with the product. + /// @OutputOnly + pub issues: Option>, + /// Name in the format `{target_country}:{content_language}:{product_id}`. + /// + /// `target_country` - The target country of the product as a CLDR territory + /// code (for example, US). + /// + /// `content_language` - The content language of the product as a two-letter + /// ISO 639-1 language code (for example, en). + /// + /// `product_id` - The ID of the product. For more information, see + /// https://support.google.com/manufacturers/answer/6124116#id. + /// @OutputOnly + pub name: Option, +} + +impl ResponseResult for Product {} + + +/// Product issue. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Issue { + /// If present, the attribute that triggered the issue. For more information + /// about attributes, see + /// https://support.google.com/manufacturers/answer/6124116. + pub attribute: Option, + /// The server-generated type of the issue, for example, + /// “INCORRECT_TEXT_FORMATTING”, “IMAGE_NOT_SERVEABLE”, etc. + #[serde(rename="type")] + pub type_: Option, + /// The severity of the issue. + pub severity: Option, + /// Description of the issue. + pub description: Option, +} + +impl Part for Issue {} + + +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [products list accounts](struct.AccountProductListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListProductsResponse { + /// The token for the retrieval of the next page of product statuses. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// List of the products. + pub products: Option>, +} + +impl ResponseResult for ListProductsResponse {} + + + +// ################### +// MethodBuilders ### +// ################# + +/// A builder providing access to all methods supported on *account* resources. +/// It is not used directly, but through the `ManufacturerCenter` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_manufacturers1 as manufacturers1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use manufacturers1::ManufacturerCenter; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = ManufacturerCenter::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `products_get(...)` and `products_list(...)` +/// // to build up your call. +/// let rb = hub.accounts(); +/// # } +/// ``` +pub struct AccountMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a ManufacturerCenter, +} + +impl<'a, C, A> MethodsBuilder for AccountMethods<'a, C, A> {} + +impl<'a, C, A> AccountMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Lists all the products in a Manufacturer Center account. + /// + /// # Arguments + /// + /// * `parent` - Parent ID in the format `accounts/{account_id}`. + /// `account_id` - The ID of the Manufacturer Center account. + pub fn products_list(&self, parent: &str) -> AccountProductListCall<'a, C, A> { + AccountProductListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets the product from a Manufacturer Center account, including product + /// issues. + /// + /// # Arguments + /// + /// * `parent` - Parent ID in the format `accounts/{account_id}`. + /// `account_id` - The ID of the Manufacturer Center account. + /// * `name` - Name in the format `{target_country}:{content_language}:{product_id}`. + /// `target_country` - The target country of the product as a CLDR territory + /// code (for example, US). + /// `content_language` - The content language of the product as a two-letter + /// ISO 639-1 language code (for example, en). + /// `product_id` - The ID of the product. For more information, see + /// https://support.google.com/manufacturers/answer/6124116#id. + pub fn products_get(&self, parent: &str, name: &str) -> AccountProductGetCall<'a, C, A> { + AccountProductGetCall { + hub: self.hub, + _parent: parent.to_string(), + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + + + +// ################### +// CallBuilders ### +// ################# + +/// Lists all the products in a Manufacturer Center account. +/// +/// A builder for the *products.list* method supported by a *account* resource. +/// It is not used directly, but through a `AccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_manufacturers1 as manufacturers1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use manufacturers1::ManufacturerCenter; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = ManufacturerCenter::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.accounts().products_list("parent") +/// .page_token("dolores") +/// .page_size(-63) +/// .doit(); +/// # } +/// ``` +pub struct AccountProductListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a ManufacturerCenter, + _parent: String, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountProductListCall<'a, C, A> {} + +impl<'a, C, A> AccountProductListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListProductsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "manufacturers.accounts.products.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://manufacturers.googleapis.com/v1/{+parent}/products".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Manufacturercenter.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Parent ID in the format `accounts/{account_id}`. + /// + /// `account_id` - The ID of the Manufacturer Center account. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> AccountProductListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The token returned by the previous request. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> AccountProductListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of product statuses to return in the response, used for + /// paging. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> AccountProductListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountProductListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AccountProductListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Manufacturercenter`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccountProductListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets the product from a Manufacturer Center account, including product +/// issues. +/// +/// A builder for the *products.get* method supported by a *account* resource. +/// It is not used directly, but through a `AccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_manufacturers1 as manufacturers1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use manufacturers1::ManufacturerCenter; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = ManufacturerCenter::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.accounts().products_get("parent", "name") +/// .doit(); +/// # } +/// ``` +pub struct AccountProductGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a ManufacturerCenter, + _parent: String, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountProductGetCall<'a, C, A> {} + +impl<'a, C, A> AccountProductGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Product)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "manufacturers.accounts.products.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("parent", self._parent.to_string())); + params.push(("name", self._name.to_string())); + for &field in ["alt", "parent", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://manufacturers.googleapis.com/v1/{+parent}/products/{+name}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Manufacturercenter.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent"), ("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["name", "parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Parent ID in the format `accounts/{account_id}`. + /// + /// `account_id` - The ID of the Manufacturer Center account. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> AccountProductGetCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Name in the format `{target_country}:{content_language}:{product_id}`. + /// + /// `target_country` - The target country of the product as a CLDR territory + /// code (for example, US). + /// + /// `content_language` - The content language of the product as a two-letter + /// ISO 639-1 language code (for example, en). + /// + /// `product_id` - The ID of the product. For more information, see + /// https://support.google.com/manufacturers/answer/6124116#id. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> AccountProductGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountProductGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AccountProductGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Manufacturercenter`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccountProductGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + diff --git a/gen/ml1_beta1-cli/Cargo.toml b/gen/ml1_beta1-cli/Cargo.toml new file mode 100644 index 0000000000..7def4b71f6 --- /dev/null +++ b/gen/ml1_beta1-cli/Cargo.toml @@ -0,0 +1,43 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-ml1_beta1-cli" +version = "1.0.0+20161212" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Cloud Machine Learning (protocol v1beta1)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/ml1_beta1-cli" +homepage = "https://cloud.google.com/ml/" +documentation = "http://byron.github.io/google-apis-rs/google_ml1_beta1_cli" +license = "MIT" +keywords = ["ml", "google", "cli"] + +[[bin]] +name = "ml1-beta1" + +[dependencies] +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.8" +serde_json = "^ 0.8" +yup-oauth2 = { version = "^ 1.0", optional = true, default-features = false } +serde_derive = { version = "^ 0.8", optional = true } +strsim = "^0.5" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-serde-codegen"] +nightly = ["serde_derive","yup-oauth2/nightly","google-ml1_beta1/nightly"] +with-serde-codegen = ["serde_codegen","yup-oauth2/with-serde-codegen","google-ml1_beta1/with-serde-codegen"] + +[build-dependencies] +serde_codegen = { version = "^ 0.8", optional = true } + + +[dependencies.google-ml1_beta1] +path = "../ml1_beta1" +version = "1.0.0" +optional = true +default-features = false diff --git a/gen/ml1_beta1-cli/LICENSE.md b/gen/ml1_beta1-cli/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/ml1_beta1-cli/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/ml1_beta1-cli/README.md b/gen/ml1_beta1-cli/README.md new file mode 100644 index 0000000000..a02959e134 --- /dev/null +++ b/gen/ml1_beta1-cli/README.md @@ -0,0 +1,131 @@ + +The `ml1-beta1` command-line interface *(CLI)* allows to use most features of the *Google Cloud Machine Learning* service from the comfort of your terminal. + +By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's +capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero. + +If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. + +Everything else about the *Cloud Machine Learning* API can be found at the +[official documentation site](https://cloud.google.com/ml/). + +# Downloads + +You can download the pre-compiled 64bit binaries for the following platforms: + +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/1.0.0/ubuntu/ml1-beta1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/1.0.0/osx/ml1-beta1.tar.gz) + +Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/ml1_beta1-cli). + +# Usage + +This documentation was generated from the *Cloud Machine Learning* API at revision *20161212*. The CLI is at version *1.0.0*. + +```bash +ml1-beta1 [options] + projects + get-config [-p ]... [-o ] + jobs-cancel (-r )... [-p ]... [-o ] + jobs-create (-r )... [-p ]... [-o ] + jobs-get [-p ]... [-o ] + jobs-list [-p ]... [-o ] + models-create (-r )... [-p ]... [-o ] + models-delete [-p ]... [-o ] + models-get [-p ]... [-o ] + models-list [-p ]... [-o ] + models-versions-create (-r )... [-p ]... [-o ] + models-versions-delete [-p ]... [-o ] + models-versions-get [-p ]... [-o ] + models-versions-list [-p ]... [-o ] + models-versions-set-default (-r )... [-p ]... [-o ] + operations-cancel [-p ]... [-o ] + operations-delete [-p ]... [-o ] + operations-get [-p ]... [-o ] + operations-list [-p ]... [-o ] + predict (-r )... [-p ]... [-o ] + ml1-beta1 --help + +Configuration: + [--scope ]... + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. + If unset, it defaults to the shortest scope url for a particular method. + --config-dir + A directory into which we will store our persistent data. Defaults to + a user-writable directory that we will create during the first invocation. + [default: ~/.google-service-cli] + --debug + Output all server communication to standard error. `tx` and `rx` are placed + into the same stream. + --debug-auth + Output all communication related to authentication to standard error. `tx` + and `rx` are placed into the same stream. + +``` + +# Configuration + +The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `ml1-beta1-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis. + +More information about the various kinds of persistent data are given in the following paragraphs. + +# Authentication + +Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the +set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*. + +If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a +method that is read-only, it will ask only for a read-only scope. +You may use the `--scope` flag to specify a scope directly. +All applicable scopes are documented in the respective method's CLI documentation. + +The first time a scope is used, the user is asked for permission. Follow the instructions given +by the CLI to grant permissions, or to decline. + +If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration +directory, e.g. `~/.google-service-cli/ml1-beta1-token-.json`. No manual management of these tokens +is necessary. + +To revoke granted authentication, please refer to the [official documentation][revoke-access]. + +# Application Secrets + +In order to allow any application to use Google services, it will need to be registered using the +[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it +one by one. Most APIs can be used for free and have a daily quota. + +To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI +comes with a default application secret that is configured accordingly. This also means that heavy usage +all around the world may deplete the daily quota. + +You can workaround this limitation by putting your own secrets file at this location: +`~/.google-service-cli/ml1-beta1-secret.json`, assuming that the required *ml* API +was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at +*APIs & auth -> Credentials -> Download JSON* and used as is. + +Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new]. + + +# Debugging + +Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know +what exactly led to a particular issue. This is done by allowing all client-server communication to be +output to standard error *as-is*. + +The `--debug` flag will print all client-server communication to standard error, whereas the `--debug-auth` flag +will cause all communication related to authentication to standard error. +If the `--debug` flag is set, error-results will be debug-printed, possibly yielding more information about the +issue at hand. + +You may consider redirecting standard error into a file for ease of use, e.g. `ml1-beta1 --debug [options] 2>debug.txt`. + + +[scopes]: https://developers.google.com/+/api/oauth#scopes +[revoke-access]: http://webapps.stackexchange.com/a/30849 +[google-dev-console]: https://console.developers.google.com/ +[google-project-new]: https://developers.google.com/console/help/new/ \ No newline at end of file diff --git a/gen/ml1_beta1-cli/mkdocs.yml b/gen/ml1_beta1-cli/mkdocs.yml new file mode 100644 index 0000000000..60b1c958b0 --- /dev/null +++ b/gen/ml1_beta1-cli/mkdocs.yml @@ -0,0 +1,35 @@ +site_name: Cloud Machine Learning v1.0.0+20161212 +site_url: http://byron.github.io/google-apis-rs/google-ml1_beta1-cli +site_description: Write integrating applications with bcore + +repo_url: https://github.com/Byron/google-apis-rs/tree/master/gen/ml1_beta1-cli + +docs_dir: docs +site_dir: build_html + +pages: +- ['index.md', 'Home'] +- ['projects_get-config.md', 'Projects', 'Get Config'] +- ['projects_jobs-cancel.md', 'Projects', 'Jobs Cancel'] +- ['projects_jobs-create.md', 'Projects', 'Jobs Create'] +- ['projects_jobs-get.md', 'Projects', 'Jobs Get'] +- ['projects_jobs-list.md', 'Projects', 'Jobs List'] +- ['projects_models-create.md', 'Projects', 'Models Create'] +- ['projects_models-delete.md', 'Projects', 'Models Delete'] +- ['projects_models-get.md', 'Projects', 'Models Get'] +- ['projects_models-list.md', 'Projects', 'Models List'] +- ['projects_models-versions-create.md', 'Projects', 'Models Versions Create'] +- ['projects_models-versions-delete.md', 'Projects', 'Models Versions Delete'] +- ['projects_models-versions-get.md', 'Projects', 'Models Versions Get'] +- ['projects_models-versions-list.md', 'Projects', 'Models Versions List'] +- ['projects_models-versions-set-default.md', 'Projects', 'Models Versions Set Default'] +- ['projects_operations-cancel.md', 'Projects', 'Operations Cancel'] +- ['projects_operations-delete.md', 'Projects', 'Operations Delete'] +- ['projects_operations-get.md', 'Projects', 'Operations Get'] +- ['projects_operations-list.md', 'Projects', 'Operations List'] +- ['projects_predict.md', 'Projects', 'Predict'] + +theme: readthedocs + +copyright: Copyright © 2015-2016, `Sebastian Thiel` + diff --git a/gen/ml1_beta1-cli/src/cmn.rs b/gen/ml1_beta1-cli/src/cmn.rs new file mode 100644 index 0000000000..779c1dc086 --- /dev/null +++ b/gen/ml1_beta1-cli/src/cmn.rs @@ -0,0 +1,721 @@ +// COPY OF 'src/rust/cli/cmn.rs' +// DO NOT EDIT +use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token}; +use serde_json as json; +use serde_json::value::Value; +use mime::Mime; +use clap::{App, SubCommand}; +use strsim; + +use std::fs; +use std::env; +use std::io; +use std::fmt; +use std::path::{Path, PathBuf}; +use std::str::FromStr; +use std::string::ToString; +use std::io::{Write, Read, stdout}; + +use std::default::Default; + +const FIELD_SEP: char = '.'; + + +pub enum ComplexType { + Pod, + Vec, + Map, +} + + // Null, + // Bool(bool), + // I64(i64), + // U64(u64), + // F64(f64), + // String(String), + +pub enum JsonType { + Boolean, + Int, + Uint, + Float, + String, +} + +pub struct JsonTypeInfo { + pub jtype: JsonType, + pub ctype: ComplexType, +} + +// Based on @erickt user comment. Thanks for the idea ! +// Remove all keys whose values are null from given value (changed in place) +pub fn remove_json_null_values(value: &mut Value) { + match *value { + Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} + +fn did_you_mean<'a>(v: &str, possible_values: &[&'a str]) -> Option<&'a str> { + + let mut candidate: Option<(f64, &str)> = None; + for pv in possible_values { + let confidence = strsim::jaro_winkler(v, pv); + if confidence > 0.8 && (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { + candidate = Some((confidence, pv)); + } + } + match candidate { + None => None, + Some((_, candidate)) => Some(candidate), + } +} + +pub enum CallType { + Upload(UploadProtocol), + Standard, +} + +arg_enum!{ + pub enum UploadProtocol { + Simple, + Resumable + } +} + +impl AsRef for UploadProtocol { + fn as_ref(&self) -> &str { + match *self { + UploadProtocol::Simple => "simple", + UploadProtocol::Resumable => "resumable" + } + } +} + +impl AsRef for CallType { + fn as_ref(&self) -> &str { + match *self { + CallType::Upload(ref proto) => proto.as_ref(), + CallType::Standard => "standard-request" + } + } +} + +#[derive(Clone, Default)] +pub struct FieldCursor(Vec); + +impl ToString for FieldCursor { + fn to_string(&self) -> String { + self.0.join(".") + } +} + +impl From<&'static str> for FieldCursor { + fn from(value: &'static str) -> FieldCursor { + let mut res = FieldCursor::default(); + res.set(value).unwrap(); + res + } +} + +impl FieldCursor { + pub fn set(&mut self, value: &str) -> Result<(), CLIError> { + if value.len() == 0 { + return Err(CLIError::Field(FieldError::Empty)) + } + + let mut first_is_field_sep = false; + let mut char_count: usize = 0; + let mut last_c = FIELD_SEP; + let mut num_conscutive_field_seps = 0; + + let mut field = String::new(); + let mut fields = self.0.clone(); + + let push_field = |fs: &mut Vec, f: &mut String| { + if f.len() > 0 { + fs.push(f.clone()); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + char_count += 1; + + if c == FIELD_SEP { + if cid == 0 { + first_is_field_sep = true; + } + num_conscutive_field_seps += 1; + if cid > 0 && last_c == FIELD_SEP { + if fields.pop().is_none() { + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))) + } + } else { + push_field(&mut fields, &mut field); + } + } else { + num_conscutive_field_seps = 0; + if cid == 1 { + if first_is_field_sep { + fields.truncate(0); + } + } + field.push(c); + } + + last_c = c; + } + + push_field(&mut fields, &mut field); + + if char_count == 1 && first_is_field_sep { + fields.truncate(0); + } + if char_count > 1 && num_conscutive_field_seps == 1 { + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + } + + self.0 = fields; + Ok(()) + } + + pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { + if value.len() == 0 { + return None + } + + let mut last_c = FIELD_SEP; + + let mut field = String::new(); + let mut output = String::new(); + + let push_field = |fs: &mut String, f: &mut String| { + if f.len() > 0 { + fs.push_str( + match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + if c == FIELD_SEP { + if last_c != FIELD_SEP { + push_field(&mut output, &mut field); + } + output.push(c); + } else { + field.push(c); + } + + last_c = c; + } + + push_field(&mut output, &mut field); + + if &output == value { + None + } else { + Some(output) + } + } + + pub fn set_json_value(&self, mut object: &mut Value, + value: &str, type_info: JsonTypeInfo, + err: &mut InvalidOptionsError, + orig_cursor: &FieldCursor) { + assert!(self.0.len() > 0); + + for field in &self.0[..self.0.len()-1] { + let tmp = object; + object = + match *tmp { + Value::Object(ref mut mapping) => { + mapping.entry(field.to_owned()).or_insert( + Value::Object(Default::default()) + ) + }, + _ => panic!("We don't expect non-object Values here ...") + }; + } + + match *object { + Value::Object(ref mut mapping) => { + let field = &self.0[self.0.len()-1]; + let to_jval = + |value: &str, jtype: JsonType, err: &mut InvalidOptionsError| + -> Value { + match jtype { + JsonType::Boolean => + Value::Bool(arg_from_str(value, err, &field, "boolean")), + JsonType::Int => + Value::I64(arg_from_str(value, err, &field, "int")), + JsonType::Uint => + Value::U64(arg_from_str(value, err, &field, "uint")), + JsonType::Float => + Value::F64(arg_from_str(value, err, &field, "float")), + JsonType::String => + Value::String(value.to_owned()), + } + }; + + match type_info.ctype { + ComplexType::Pod => { + if mapping.insert(field.to_owned(), to_jval(value, type_info.jtype, err)).is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + }, + ComplexType::Vec => { + match *mapping.entry(field.to_owned()) + .or_insert(Value::Array(Default::default())) { + Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), + _ => unreachable!() + } + }, + ComplexType::Map => { + let (key, value) = parse_kv_arg(value, err, true); + let jval = to_jval(value.unwrap_or(""), type_info.jtype, err); + + match *mapping.entry(field.to_owned()) + .or_insert(Value::Object(Default::default())) { + Value::Object(ref mut value_map) => { + if value_map.insert(key.to_owned(), jval).is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + _ => unreachable!() + } + } + } + }, + _ => unreachable!() + } + } + + pub fn num_fields(&self) -> usize { + self.0.len() + } +} + +pub fn parse_kv_arg<'a>(kv: &'a str, err: &mut InvalidOptionsError, for_hashmap: bool) + -> (&'a str, Option<&'a str>) { + let mut add_err = || err.issues.push(CLIError::InvalidKeyValueSyntax(kv.to_string(),for_hashmap)); + match kv.find('=') { + None => { + add_err(); + return (kv, None) + }, + Some(pos) => { + let key = &kv[..pos]; + if kv.len() <= pos + 1 { + add_err(); + return (key, Some("")) + } + (key, Some(&kv[pos+1..])) + } + } +} + +pub fn calltype_from_str(name: &str, valid_protocols: Vec, err: &mut InvalidOptionsError) -> CallType { + CallType::Upload( + match UploadProtocol::from_str(name) { + Ok(up) => up, + Err(msg) => { + err.issues.push(CLIError::InvalidUploadProtocol(name.to_string(), valid_protocols)); + UploadProtocol::Simple + } + }) +} + +pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> Option { + match fs::File::open(file_path) { + Ok(f) => Some(f), + Err(io_err) => { + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); + None + } + } +} + +pub fn input_mime_from_opts(mime: &str, err: &mut InvalidOptionsError) -> Option { + match mime.parse() { + Ok(m) => Some(m), + Err(_) => { + err.issues.push(CLIError::Input(InputError::Mime(mime.to_string()))); + None + } + } +} + +pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { + let f = arg.unwrap_or("-"); + match f { + "-" => Ok(Box::new(stdout())), + _ => match fs::OpenOptions::new().create(true).write(true).open(f) { + Ok(f) => Ok(Box::new(f)), + Err(io_err) => Err(io_err), + } + } +} + + +pub fn arg_from_str<'a, T>(arg: &str, err: &mut InvalidOptionsError, + arg_name: &'a str, + arg_type: &'a str) -> T + where T: FromStr + Default, + ::Err: fmt::Display { + match FromStr::from_str(arg) { + Err(perr) => { + err.issues.push( + CLIError::ParseError(arg_name.to_owned(), arg_type.to_owned(), arg.to_string(), format!("{}", perr)) + ); + Default::default() + }, + Ok(v) => v, + } +} + +pub struct JsonTokenStorage { + pub program_name: &'static str, + pub db_dir: String, +} + +impl JsonTokenStorage { + fn path(&self, scope_hash: u64) -> PathBuf { + Path::new(&self.db_dir).join(&format!("{}-token-{}.json", self.program_name, scope_hash)) + } +} + +impl TokenStorage for JsonTokenStorage { + type Error = json::Error; + + // NOTE: logging might be interesting, currently we swallow all errors + fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), json::Error> { + match token { + None => { + match fs::remove_file(self.path(scope_hash)) { + Err(err) => + match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(json::Error::Io(err)) + }, + Ok(_) => Ok(()), + } + } + Some(token) => { + match fs::OpenOptions::new().create(true).write(true).open(&self.path(scope_hash)) { + Ok(mut f) => { + match json::to_writer_pretty(&mut f, &token) { + Ok(_) => Ok(()), + Err(serde_err) => Err(serde_err), + } + }, + Err(io_err) => Err(json::Error::Io(io_err)) + } + } + } + } + + fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result, json::Error> { + match fs::File::open(&self.path(scope_hash)) { + Ok(f) => { + match json::de::from_reader(f) { + Ok(token) => Ok(Some(token)), + Err(err) => Err(err), + } + }, + Err(io_err) => { + match io_err.kind() { + io::ErrorKind::NotFound => Ok(None), + _ => Err(json::Error::Io(io_err)) + } + } + } + } +} + + +#[derive(Debug)] +pub enum ApplicationSecretError { + DecoderError((String, json::Error)), + FormatError(String), +} + +impl fmt::Display for ApplicationSecretError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ApplicationSecretError::DecoderError((ref path, ref err)) + => writeln!(f, "Could not decode file at '{}' with error: {}.", + path, err), + ApplicationSecretError::FormatError(ref path) + => writeln!(f, "'installed' field is unset in secret file at '{}'.", + path), + } + } +} + +#[derive(Debug)] +pub enum ConfigurationError { + DirectoryCreationFailed((String, io::Error)), + DirectoryUnset, + HomeExpansionFailed(String), + Secret(ApplicationSecretError), + Io((String, io::Error)), +} + +impl fmt::Display for ConfigurationError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ConfigurationError::DirectoryCreationFailed((ref dir, ref err)) + => writeln!(f, "Directory '{}' could not be created with error: {}.", dir, err), + ConfigurationError::DirectoryUnset + => writeln!(f, "--config-dir was unset or empty."), + ConfigurationError::HomeExpansionFailed(ref dir) + => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), + ConfigurationError::Secret(ref err) + => writeln!(f, "Secret -> {}", err), + ConfigurationError::Io((ref path, ref err)) + => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + } + } +} + +#[derive(Debug)] +pub enum InputError { + Io((String, io::Error)), + Mime(String), +} + +impl fmt::Display for InputError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + InputError::Io((ref file_path, ref io_err)) + => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), + InputError::Mime(ref mime) + => writeln!(f, "'{}' is not a known mime-type.", mime), + } + } +} + +#[derive(Debug)] +pub enum FieldError { + PopOnEmpty(String), + TrailingFieldSep(String), + Unknown(String, Option, Option), + Duplicate(String), + Empty, +} + + +impl fmt::Display for FieldError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + FieldError::PopOnEmpty(ref field) + => writeln!(f, "'{}': Cannot move up on empty field cursor.", field), + FieldError::TrailingFieldSep(ref field) + => writeln!(f, "'{}': Single field separator may not be last character.", field), + FieldError::Unknown(ref field, ref suggestion, ref value) => { + let suffix = + match *suggestion { + Some(ref s) => { + let kv = + match *value { + Some(ref v) => format!("{}={}", s, v), + None => s.clone(), + }; + format!(" Did you mean '{}' ?", kv) + }, + None => String::new(), + }; + writeln!(f, "Field '{}' does not exist.{}", field, suffix) + }, + FieldError::Duplicate(ref cursor) + => writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty + => writeln!(f, "Field names must not be empty."), + } + } +} + + +#[derive(Debug)] +pub enum CLIError { + Configuration(ConfigurationError), + ParseError(String, String, String, String), + UnknownParameter(String, Vec<&'static str>), + InvalidUploadProtocol(String, Vec), + InvalidKeyValueSyntax(String, bool), + Input(InputError), + Field(FieldError), + MissingCommandError, + MissingMethodError(String), +} + +impl fmt::Display for CLIError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + CLIError::Configuration(ref err) => write!(f, "Configuration -> {}", err), + CLIError::Input(ref err) => write!(f, "Input -> {}", err), + CLIError::Field(ref err) => write!(f, "Field -> {}", err), + CLIError::InvalidUploadProtocol(ref proto_name, ref valid_names) + => writeln!(f, "'{}' is not a valid upload protocol. Choose from one of {}.", proto_name, valid_names.join(", ")), + CLIError::ParseError(ref arg_name, ref type_name, ref value, ref err_desc) + => writeln!(f, "Failed to parse argument '{}' with value '{}' as {} with error: {}.", + arg_name, value, type_name, err_desc), + CLIError::UnknownParameter(ref param_name, ref possible_values) => { + let suffix = + match did_you_mean(param_name, &possible_values) { + Some(v) => format!(" Did you mean '{}' ?", v), + None => String::new(), + }; + write!(f, "Parameter '{}' is unknown.{}\n", param_name, suffix) + }, + CLIError::InvalidKeyValueSyntax(ref kv, is_hashmap) => { + let hashmap_info = if is_hashmap { "hashmap " } else { "" }; + writeln!(f, "'{}' does not match {}pattern =.", kv, hashmap_info) + }, + CLIError::MissingCommandError => writeln!(f, "Please specify the main sub-command."), + CLIError::MissingMethodError(ref cmd) => writeln!(f, "Please specify the method to call on the '{}' command.", cmd), + } + } +} + +#[derive(Debug)] +pub struct InvalidOptionsError { + pub issues: Vec, + pub exit_code: i32, +} + +impl fmt::Display for InvalidOptionsError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + for issue in &self.issues { + try!(issue.fmt(f)); + } + Ok(()) + } +} + +impl InvalidOptionsError { + pub fn single(err: CLIError, exit_code: i32) -> InvalidOptionsError { + InvalidOptionsError { + issues: vec![err], + exit_code: exit_code, + } + } + + pub fn new() -> InvalidOptionsError { + InvalidOptionsError { + issues: Vec::new(), + exit_code: 1, + } + } +} + +pub fn assure_config_dir_exists(dir: &str) -> Result { + let trdir = dir.trim(); + if trdir.len() == 0 { + return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + } + + let expanded_config_dir = + if trdir.as_bytes()[0] == b'~' { + match env::var("HOME").ok().or(env::var("UserProfile").ok()) { + None => return Err(CLIError::Configuration(ConfigurationError::HomeExpansionFailed(trdir.to_string()))), + Some(mut user) => { + user.push_str(&trdir[1..]); + user + } + } + } else { + trdir.to_string() + }; + + if let Err(err) = fs::create_dir(&expanded_config_dir) { + if err.kind() != io::ErrorKind::AlreadyExists { + return Err(CLIError::Configuration( + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))) + } + } + + Ok(expanded_config_dir) +} + +pub fn application_secret_from_directory(dir: &str, + secret_basename: &str, + json_console_secret: &str) + -> Result { + let secret_path = Path::new(dir).join(secret_basename); + let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); + let secret_io_error = |io_err: io::Error| { + Err(CLIError::Configuration(ConfigurationError::Io( + (secret_str(), io_err) + ))) + }; + + for _ in 0..2 { + match fs::File::open(&secret_path) { + Err(mut err) => { + if err.kind() == io::ErrorKind::NotFound { + // Write our built-in one - user may adjust the written file at will + + err = match fs::OpenOptions::new().create(true).write(true).open(&secret_path) { + Err(cfe) => cfe, + Ok(mut f) => { + // Assure we convert 'ugly' json string into pretty one + let console_secret: ConsoleApplicationSecret + = json::from_str(json_console_secret).unwrap(); + match json::to_writer_pretty(&mut f, &console_secret) { + Err(serde_err) => match serde_err { + json::Error::Io(err) => err, + _ => panic!("Unexpected serde error: {:#?}", serde_err) + }, + Ok(_) => continue, + } + } + }; + // fall through to IO error handling + } + return secret_io_error(err) + }, + Ok(f) => { + match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { + Err(json::Error::Io(err)) => + return secret_io_error(err), + Err(json_err) => + return Err(CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::DecoderError( + (secret_str(), json_err) + )))), + Ok(console_secret) => + match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( + CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::FormatError(secret_str()) + ))) + }, + } + } + } + } + unreachable!(); +} diff --git a/gen/ml1_beta1-cli/src/main.rs b/gen/ml1_beta1-cli/src/main.rs new file mode 100644 index 0000000000..566c05a05a --- /dev/null +++ b/gen/ml1_beta1-cli/src/main.rs @@ -0,0 +1,2162 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/cli/main.rs.mako' +// DO NOT EDIT ! +#![allow(unused_variables, unused_imports, dead_code, unused_mut)] + +#[macro_use] +extern crate clap; +extern crate yup_oauth2 as oauth2; +extern crate yup_hyper_mock as mock; +extern crate serde; +extern crate serde_json; +extern crate hyper; +extern crate mime; +extern crate strsim; +extern crate google_ml1_beta1 as api; + +use std::env; +use std::io::{self, Write}; +use clap::{App, SubCommand, Arg}; + +mod cmn; + +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, + input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, + calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; + +use std::default::Default; +use std::str::FromStr; + +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; +use serde_json as json; +use clap::ArgMatches; + +enum DoitError { + IoError(String, io::Error), + ApiError(api::Error), +} + +struct Engine<'n> { + opt: ArgMatches<'n>, + hub: api::CloudMachineLearning>, + gp: Vec<&'static str>, + gpm: Vec<(&'static str, &'static str)>, +} + + +impl<'n> Engine<'n> { + fn _projects_get_config(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().get_config(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_jobs_cancel(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec![]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GoogleCloudMlV1beta1__CancelJobRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().jobs_cancel(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_jobs_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "training-output.consumed-ml-units" => Some(("trainingOutput.consumedMlUnits", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "training-output.completed-trial-count" => Some(("trainingOutput.completedTrialCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "start-time" => Some(("startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "error-message" => Some(("errorMessage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "job-id" => Some(("jobId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "prediction-input.model-name" => Some(("predictionInput.modelName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "prediction-input.input-paths" => Some(("predictionInput.inputPaths", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "prediction-input.max-worker-count" => Some(("predictionInput.maxWorkerCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "prediction-input.output-path" => Some(("predictionInput.outputPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "prediction-input.data-format" => Some(("predictionInput.dataFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "prediction-input.version-name" => Some(("predictionInput.versionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "prediction-input.region" => Some(("predictionInput.region", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "training-input.worker-type" => Some(("trainingInput.workerType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "training-input.scale-tier" => Some(("trainingInput.scaleTier", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "training-input.master-type" => Some(("trainingInput.masterType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "training-input.hyperparameters.max-trials" => Some(("trainingInput.hyperparameters.maxTrials", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "training-input.hyperparameters.max-parallel-trials" => Some(("trainingInput.hyperparameters.maxParallelTrials", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "training-input.hyperparameters.goal" => Some(("trainingInput.hyperparameters.goal", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "training-input.region" => Some(("trainingInput.region", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "training-input.args" => Some(("trainingInput.args", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "training-input.python-module" => Some(("trainingInput.pythonModule", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "training-input.package-uris" => Some(("trainingInput.packageUris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "training-input.worker-count" => Some(("trainingInput.workerCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "training-input.parameter-server-type" => Some(("trainingInput.parameterServerType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "training-input.parameter-server-count" => Some(("trainingInput.parameterServerCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "end-time" => Some(("endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "prediction-output.output-path" => Some(("predictionOutput.outputPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "prediction-output.prediction-count" => Some(("predictionOutput.predictionCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "prediction-output.error-count" => Some(("predictionOutput.errorCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["args", "completed-trial-count", "consumed-ml-units", "create-time", "data-format", "end-time", "error-count", "error-message", "goal", "hyperparameters", "input-paths", "job-id", "master-type", "max-parallel-trials", "max-trials", "max-worker-count", "model-name", "output-path", "package-uris", "parameter-server-count", "parameter-server-type", "prediction-count", "prediction-input", "prediction-output", "python-module", "region", "scale-tier", "start-time", "state", "training-input", "training-output", "version-name", "worker-count", "worker-type"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GoogleCloudMlV1beta1__Job = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().jobs_create(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_jobs_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().jobs_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_jobs_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().jobs_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + "filter" => { + call = call.filter(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["filter", "page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_models_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "default-version.description" => Some(("defaultVersion.description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-version.last-use-time" => Some(("defaultVersion.lastUseTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-version.deployment-uri" => Some(("defaultVersion.deploymentUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-version.create-time" => Some(("defaultVersion.createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-version.is-default" => Some(("defaultVersion.isDefault", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "default-version.name" => Some(("defaultVersion.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "default-version", "deployment-uri", "description", "is-default", "last-use-time", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GoogleCloudMlV1beta1__Model = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().models_create(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_models_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().models_delete(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_models_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().models_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_models_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().models_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_models_versions_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-use-time" => Some(("lastUseTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "deployment-uri" => Some(("deploymentUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "is-default" => Some(("isDefault", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "deployment-uri", "description", "is-default", "last-use-time", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GoogleCloudMlV1beta1__Version = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().models_versions_create(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_models_versions_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().models_versions_delete(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_models_versions_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().models_versions_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_models_versions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().models_versions_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_models_versions_set_default(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec![]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GoogleCloudMlV1beta1__SetDefaultVersionRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().models_versions_set_default(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_operations_cancel(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().operations_cancel(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_operations_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().operations_delete(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_operations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().operations_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_operations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().operations_list(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + "filter" => { + call = call.filter(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["filter", "page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_predict(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "http-body.content-type" => Some(("httpBody.contentType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "http-body.data" => Some(("httpBody.data", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["content-type", "data", "http-body"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GoogleCloudMlV1beta1__PredictRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().predict(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _doit(&self, dry_run: bool) -> Result, Option> { + let mut err = InvalidOptionsError::new(); + let mut call_result: Result<(), DoitError> = Ok(()); + let mut err_opt: Option = None; + match self.opt.subcommand() { + ("projects", Some(opt)) => { + match opt.subcommand() { + ("get-config", Some(opt)) => { + call_result = self._projects_get_config(opt, dry_run, &mut err); + }, + ("jobs-cancel", Some(opt)) => { + call_result = self._projects_jobs_cancel(opt, dry_run, &mut err); + }, + ("jobs-create", Some(opt)) => { + call_result = self._projects_jobs_create(opt, dry_run, &mut err); + }, + ("jobs-get", Some(opt)) => { + call_result = self._projects_jobs_get(opt, dry_run, &mut err); + }, + ("jobs-list", Some(opt)) => { + call_result = self._projects_jobs_list(opt, dry_run, &mut err); + }, + ("models-create", Some(opt)) => { + call_result = self._projects_models_create(opt, dry_run, &mut err); + }, + ("models-delete", Some(opt)) => { + call_result = self._projects_models_delete(opt, dry_run, &mut err); + }, + ("models-get", Some(opt)) => { + call_result = self._projects_models_get(opt, dry_run, &mut err); + }, + ("models-list", Some(opt)) => { + call_result = self._projects_models_list(opt, dry_run, &mut err); + }, + ("models-versions-create", Some(opt)) => { + call_result = self._projects_models_versions_create(opt, dry_run, &mut err); + }, + ("models-versions-delete", Some(opt)) => { + call_result = self._projects_models_versions_delete(opt, dry_run, &mut err); + }, + ("models-versions-get", Some(opt)) => { + call_result = self._projects_models_versions_get(opt, dry_run, &mut err); + }, + ("models-versions-list", Some(opt)) => { + call_result = self._projects_models_versions_list(opt, dry_run, &mut err); + }, + ("models-versions-set-default", Some(opt)) => { + call_result = self._projects_models_versions_set_default(opt, dry_run, &mut err); + }, + ("operations-cancel", Some(opt)) => { + call_result = self._projects_operations_cancel(opt, dry_run, &mut err); + }, + ("operations-delete", Some(opt)) => { + call_result = self._projects_operations_delete(opt, dry_run, &mut err); + }, + ("operations-get", Some(opt)) => { + call_result = self._projects_operations_get(opt, dry_run, &mut err); + }, + ("operations-list", Some(opt)) => { + call_result = self._projects_operations_list(opt, dry_run, &mut err); + }, + ("predict", Some(opt)) => { + call_result = self._projects_predict(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("projects".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + _ => { + err.issues.push(CLIError::MissingCommandError); + writeln!(io::stderr(), "{}\n", self.opt.usage()).ok(); + } + } + + if dry_run { + if err.issues.len() > 0 { + err_opt = Some(err); + } + Err(err_opt) + } else { + Ok(call_result) + } + } + + // Please note that this call will fail if any part of the opt can't be handled + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { + let (config_dir, secret) = { + let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { + Err(e) => return Err(InvalidOptionsError::single(e, 3)), + Ok(p) => p, + }; + + match cmn::application_secret_from_directory(&config_dir, "ml1-beta1-secret.json", + "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { + Ok(secret) => (config_dir, secret), + Err(e) => return Err(InvalidOptionsError::single(e, 4)) + } + }; + + let auth = Authenticator::new( &secret, DefaultAuthenticatorDelegate, + if opt.is_present("debug-auth") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::::default() + }) + } else { + hyper::Client::new() + }, + JsonTokenStorage { + program_name: "ml1-beta1", + db_dir: config_dir.clone(), + }, Some(FlowType::InstalledRedirect(54324))); + + let client = + if opt.is_present("debug") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::::default() + }) + } else { + hyper::Client::new() + }; + let engine = Engine { + opt: opt, + hub: api::CloudMachineLearning::new(client, auth), + gp: vec!["$-xgafv", "access-token", "alt", "bearer-token", "callback", "fields", "key", "oauth-token", "pp", "pretty-print", "quota-user", "upload-type", "upload-protocol"], + gpm: vec![ + ("$-xgafv", "$.xgafv"), + ("access-token", "access_token"), + ("bearer-token", "bearer_token"), + ("oauth-token", "oauth_token"), + ("pretty-print", "prettyPrint"), + ("quota-user", "quotaUser"), + ("upload-type", "uploadType"), + ("upload-protocol", "upload_protocol"), + ] + }; + + match engine._doit(true) { + Err(Some(err)) => Err(err), + Err(None) => Ok(engine), + Ok(_) => unreachable!(), + } + } + + fn doit(&self) -> Result<(), DoitError> { + match self._doit(false) { + Ok(res) => res, + Err(_) => unreachable!(), + } + } +} + +fn main() { + let mut exit_status = 0i32; + let arg_data = [ + ("projects", "methods: 'get-config', 'jobs-cancel', 'jobs-create', 'jobs-get', 'jobs-list', 'models-create', 'models-delete', 'models-get', 'models-list', 'models-versions-create', 'models-versions-delete', 'models-versions-get', 'models-versions-list', 'models-versions-set-default', 'operations-cancel', 'operations-delete', 'operations-get', 'operations-list' and 'predict'", vec![ + ("get-config", + Some(r##"Get the service account information associated with your project. You need + this information in order to grant the service account persmissions for + the Google Cloud Storage location where you put your model training code + for training the model with Google Cloud Machine Learning."##), + "Details at http://byron.github.io/google-apis-rs/google_ml1_beta1_cli/projects_get-config", + vec![ + (Some(r##"name"##), + None, + Some(r##"Required. The project name. + + Authorization: requires `Viewer` role on the specified project."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("jobs-cancel", + Some(r##"Cancels a running job."##), + "Details at http://byron.github.io/google-apis-rs/google_ml1_beta1_cli/projects_jobs-cancel", + vec![ + (Some(r##"name"##), + None, + Some(r##"Required. The name of the job to cancel. + + Authorization: requires `Editor` role on the parent project."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("jobs-create", + Some(r##"Creates a training or a batch prediction job."##), + "Details at http://byron.github.io/google-apis-rs/google_ml1_beta1_cli/projects_jobs-create", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Required. The project name. + + Authorization: requires `Editor` role on the specified project."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("jobs-get", + Some(r##"Describes a job."##), + "Details at http://byron.github.io/google-apis-rs/google_ml1_beta1_cli/projects_jobs-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"Required. The name of the job to get the description of. + + Authorization: requires `Viewer` role on the parent project."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("jobs-list", + Some(r##"Lists the jobs in the project."##), + "Details at http://byron.github.io/google-apis-rs/google_ml1_beta1_cli/projects_jobs-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Required. The name of the project for which to list jobs. + + Authorization: requires `Viewer` role on the specified project."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("models-create", + Some(r##"Creates a model which will later contain one or more versions. + + You must add at least one version before you can request predictions from + the model. Add versions by calling + [projects.models.versions.create](/ml/reference/rest/v1beta1/projects.models.versions/create)."##), + "Details at http://byron.github.io/google-apis-rs/google_ml1_beta1_cli/projects_models-create", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Required. The project name. + + Authorization: requires `Editor` role on the specified project."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("models-delete", + Some(r##"Deletes a model. + + You can only delete a model if there are no versions in it. You can delete + versions by calling + [projects.models.versions.delete](/ml/reference/rest/v1beta1/projects.models.versions/delete)."##), + "Details at http://byron.github.io/google-apis-rs/google_ml1_beta1_cli/projects_models-delete", + vec![ + (Some(r##"name"##), + None, + Some(r##"Required. The name of the model. + + Authorization: requires `Editor` role on the parent project."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("models-get", + Some(r##"Gets information about a model, including its name, the description (if + set), and the default version (if at least one version of the model has + been deployed)."##), + "Details at http://byron.github.io/google-apis-rs/google_ml1_beta1_cli/projects_models-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"Required. The name of the model. + + Authorization: requires `Viewer` role on the parent project."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("models-list", + Some(r##"Lists the models in a project. + + Each project can contain multiple models, and each model can have multiple + versions."##), + "Details at http://byron.github.io/google-apis-rs/google_ml1_beta1_cli/projects_models-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Required. The name of the project whose models are to be listed. + + Authorization: requires `Viewer` role on the specified project."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("models-versions-create", + Some(r##"Creates a new version of a model from a trained TensorFlow model. + + If the version created in the cloud by this call is the first deployed + version of the specified model, it will be made the default version of the + model. When you add a version to a model that already has one or more + versions, the default version does not automatically change. If you want a + new version to be the default, you must call + [projects.models.versions.setDefault](/ml/reference/rest/v1beta1/projects.models.versions/setDefault)."##), + "Details at http://byron.github.io/google-apis-rs/google_ml1_beta1_cli/projects_models-versions-create", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Required. The name of the model. + + Authorization: requires `Editor` role on the parent project."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("models-versions-delete", + Some(r##"Deletes a model version. + + Each model can have multiple versions deployed and in use at any given + time. Use this method to remove a single version. + + Note: You cannot delete the version that is set as the default version + of the model unless it is the only remaining version."##), + "Details at http://byron.github.io/google-apis-rs/google_ml1_beta1_cli/projects_models-versions-delete", + vec![ + (Some(r##"name"##), + None, + Some(r##"Required. The name of the version. You can get the names of all the + versions of a model by calling + [projects.models.versions.list](/ml/reference/rest/v1beta1/projects.models.versions/list). + + Authorization: requires `Editor` role on the parent project."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("models-versions-get", + Some(r##"Gets information about a model version. + + Models can have multiple versions. You can call + [projects.models.versions.list](/ml/reference/rest/v1beta1/projects.models.versions/list) + to get the same information that this method returns for all of the + versions of a model."##), + "Details at http://byron.github.io/google-apis-rs/google_ml1_beta1_cli/projects_models-versions-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"Required. The name of the version. + + Authorization: requires `Viewer` role on the parent project."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("models-versions-list", + Some(r##"Gets basic information about all the versions of a model. + + If you expect that a model has a lot of versions, or if you need to handle + only a limited number of results at a time, you can request that the list + be retrieved in batches (called pages):"##), + "Details at http://byron.github.io/google-apis-rs/google_ml1_beta1_cli/projects_models-versions-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Required. The name of the model for which to list the version. + + Authorization: requires `Viewer` role on the parent project."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("models-versions-set-default", + Some(r##"Designates a version to be the default for the model. + + The default version is used for prediction requests made against the model + that don't specify a version. + + The first version to be created for a model is automatically set as the + default. You must make any subsequent changes to the default version + setting manually using this method."##), + "Details at http://byron.github.io/google-apis-rs/google_ml1_beta1_cli/projects_models-versions-set-default", + vec![ + (Some(r##"name"##), + None, + Some(r##"Required. The name of the version to make the default for the model. You + can get the names of all the versions of a model by calling + [projects.models.versions.list](/ml/reference/rest/v1beta1/projects.models.versions/list). + + Authorization: requires `Editor` role on the parent project."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("operations-cancel", + Some(r##"Starts asynchronous cancellation on a long-running operation. The server + makes a best effort to cancel the operation, but success is not + guaranteed. If the server doesn't support this method, it returns + `google.rpc.Code.UNIMPLEMENTED`. Clients can use + Operations.GetOperation or + other methods to check whether the cancellation succeeded or whether the + operation completed despite cancellation. On successful cancellation, + the operation is not deleted; instead, it becomes an operation with + an Operation.error value with a google.rpc.Status.code of 1, + corresponding to `Code.CANCELLED`."##), + "Details at http://byron.github.io/google-apis-rs/google_ml1_beta1_cli/projects_operations-cancel", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the operation resource to be cancelled."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("operations-delete", + Some(r##"Deletes a long-running operation. This method indicates that the client is + no longer interested in the operation result. It does not cancel the + operation. If the server doesn't support this method, it returns + `google.rpc.Code.UNIMPLEMENTED`."##), + "Details at http://byron.github.io/google-apis-rs/google_ml1_beta1_cli/projects_operations-delete", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the operation resource to be deleted."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("operations-get", + Some(r##"Gets the latest state of a long-running operation. Clients can use this + method to poll the operation result at intervals as recommended by the API + service."##), + "Details at http://byron.github.io/google-apis-rs/google_ml1_beta1_cli/projects_operations-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the operation resource."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("operations-list", + Some(r##"Lists operations that match the specified filter in the request. If the + server doesn't support this method, it returns `UNIMPLEMENTED`. + + NOTE: the `name` binding below allows API services to override the binding + to use different resource name schemes, such as `users/*/operations`."##), + "Details at http://byron.github.io/google-apis-rs/google_ml1_beta1_cli/projects_operations-list", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the operation collection."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("predict", + Some(r##"Performs prediction on the data in the request. + + Responses are very similar to requests. There are two top-level fields, + each of which are JSON lists: + +
+
predictions
+
The list of predictions, one per instance in the request.
+
error
+
An error message returned instead of a prediction list if any + instance produced an error.
+
+ + If the call is successful, the response body will contain one prediction + entry per instance in the request body. If prediction fails for any + instance, the response body will contain no predictions and will contian + a single error entry instead. + + Even though there is one prediction per instance, the format of a + prediction is not directly related to the format of an instance. + Predictions take whatever format is specified in the outputs collection + defined in the model. The collection of predictions is returned in a JSON + list. Each member of the list can be a simple value, a list, or a JSON + object of any complexity. If your model has more than one output tensor, + each prediction will be a JSON object containing a name/value pair for each + output. The names identify the output aliases in the graph. + + The following examples show some possible responses: + + A simple set of predictions for three input instances, where each + prediction is an integer value: +
+        {"predictions": [5, 4, 3]}
+        
+ A more complex set of predictions, each containing two named values that + correspond to output tensors, named **label** and **scores** respectively. + The value of **label** is the predicted category ("car" or "beach") and + **scores** contains a list of probabilities for that instance across the + possible categories. +
+        {"predictions": [{"label": "beach", "scores": [0.1, 0.9]},
+                         {"label": "car", "scores": [0.75, 0.25]}]}
+        
+ A response when there is an error processing an input instance: +
+        {"error": "Divide by zero"}
+        
"##), + "Details at http://byron.github.io/google-apis-rs/google_ml1_beta1_cli/projects_predict", + vec![ + (Some(r##"name"##), + None, + Some(r##"Required. The resource name of a model or a version. + + Authorization: requires `Viewer` role on the parent project."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ]; + + let mut app = App::new("ml1-beta1") + .author("Sebastian Thiel ") + .version("1.0.0+20161212") + .about("An API to enable creating and using machine learning models.") + .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_ml1_beta1_cli") + .arg(Arg::with_name("url") + .long("scope") + .help("Specify the authentication a method should be executed in. Each scope requires the user to grant this application permission to use it.If unset, it defaults to the shortest scope url for a particular method.") + .multiple(true) + .takes_value(true)) + .arg(Arg::with_name("folder") + .long("config-dir") + .help("A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation.[default: ~/.google-service-cli") + .multiple(false) + .takes_value(true)) + .arg(Arg::with_name("debug") + .long("debug") + .help("Output all server communication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)) + .arg(Arg::with_name("debug-auth") + .long("debug-auth") + .help("Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)); + + for &(main_command_name, about, ref subcommands) in arg_data.iter() { + let mut mcmd = SubCommand::with_name(main_command_name).about(about); + + for &(sub_command_name, ref desc, url_info, ref args) in subcommands { + let mut scmd = SubCommand::with_name(sub_command_name); + if let &Some(desc) = desc { + scmd = scmd.about(desc); + } + scmd = scmd.after_help(url_info); + + for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { + let arg_name_str = + match (arg_name, flag) { + (&Some(an), _ ) => an, + (_ , &Some(f)) => f, + _ => unreachable!(), + }; + let mut arg = Arg::with_name(arg_name_str) + .empty_values(false); + if let &Some(short_flag) = flag { + arg = arg.short(short_flag); + } + if let &Some(desc) = desc { + arg = arg.help(desc); + } + if arg_name.is_some() && flag.is_some() { + arg = arg.takes_value(true); + } + if let &Some(required) = required { + arg = arg.required(required); + } + if let &Some(multi) = multi { + arg = arg.multiple(multi); + } + scmd = scmd.arg(arg); + } + mcmd = mcmd.subcommand(scmd); + } + app = app.subcommand(mcmd); + } + + let matches = app.get_matches(); + + let debug = matches.is_present("debug"); + match Engine::new(matches) { + Err(err) => { + exit_status = err.exit_code; + writeln!(io::stderr(), "{}", err).ok(); + }, + Ok(engine) => { + if let Err(doit_err) = engine.doit() { + exit_status = 1; + match doit_err { + DoitError::IoError(path, err) => { + writeln!(io::stderr(), "Failed to open output file '{}': {}", path, err).ok(); + }, + DoitError::ApiError(err) => { + if debug { + writeln!(io::stderr(), "{:#?}", err).ok(); + } else { + writeln!(io::stderr(), "{}", err).ok(); + } + } + } + } + } + } + + std::process::exit(exit_status); +} \ No newline at end of file diff --git a/gen/ml1_beta1/Cargo.toml b/gen/ml1_beta1/Cargo.toml new file mode 100644 index 0000000000..1542fd6f57 --- /dev/null +++ b/gen/ml1_beta1/Cargo.toml @@ -0,0 +1,34 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-ml1_beta1" +version = "1.0.0+20161212" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Cloud Machine Learning (protocol v1beta1)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/ml1_beta1" +homepage = "https://cloud.google.com/ml/" +documentation = "http://byron.github.io/google-apis-rs/google_ml1_beta1" +license = "MIT" +keywords = ["ml", "google", "protocol", "web", "api"] +build = "src/build.rs" + + +[dependencies] +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.8" +serde_json = "^ 0.8" +yup-oauth2 = { version = "^ 1.0", optional = true, default-features = false } +serde_derive = { version = "^ 0.8", optional = true } +url = "= 0.5" + +[features] +default = ["with-serde-codegen"] +nightly = ["serde_derive","yup-oauth2/nightly"] +with-serde-codegen = ["serde_codegen","yup-oauth2/with-serde-codegen"] + +[build-dependencies] +serde_codegen = { version = "^ 0.8", optional = true } + diff --git a/gen/ml1_beta1/LICENSE.md b/gen/ml1_beta1/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/ml1_beta1/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/ml1_beta1/README.md b/gen/ml1_beta1/README.md new file mode 100644 index 0000000000..970335ad00 --- /dev/null +++ b/gen/ml1_beta1/README.md @@ -0,0 +1,182 @@ + +The `google-ml1_beta1` library allows access to all features of the *Google Cloud Machine Learning* service. + +This documentation was generated from *Cloud Machine Learning* crate version *1.0.0+20161212*, where *20161212* is the exact revision of the *ml:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. + +Everything else about the *Cloud Machine Learning* *v1_beta1* API can be found at the +[official documentation site](https://cloud.google.com/ml/). +# Features + +Handle the following *Resources* with ease from the central [hub](http://byron.github.io/google-apis-rs/google_ml1_beta1/struct.CloudMachineLearning.html) ... + +* projects + * [*get config*](http://byron.github.io/google-apis-rs/google_ml1_beta1/struct.ProjectGetConfigCall.html), [*jobs cancel*](http://byron.github.io/google-apis-rs/google_ml1_beta1/struct.ProjectJobCancelCall.html), [*jobs create*](http://byron.github.io/google-apis-rs/google_ml1_beta1/struct.ProjectJobCreateCall.html), [*jobs get*](http://byron.github.io/google-apis-rs/google_ml1_beta1/struct.ProjectJobGetCall.html), [*jobs list*](http://byron.github.io/google-apis-rs/google_ml1_beta1/struct.ProjectJobListCall.html), [*models create*](http://byron.github.io/google-apis-rs/google_ml1_beta1/struct.ProjectModelCreateCall.html), [*models delete*](http://byron.github.io/google-apis-rs/google_ml1_beta1/struct.ProjectModelDeleteCall.html), [*models get*](http://byron.github.io/google-apis-rs/google_ml1_beta1/struct.ProjectModelGetCall.html), [*models list*](http://byron.github.io/google-apis-rs/google_ml1_beta1/struct.ProjectModelListCall.html), [*models versions create*](http://byron.github.io/google-apis-rs/google_ml1_beta1/struct.ProjectModelVersionCreateCall.html), [*models versions delete*](http://byron.github.io/google-apis-rs/google_ml1_beta1/struct.ProjectModelVersionDeleteCall.html), [*models versions get*](http://byron.github.io/google-apis-rs/google_ml1_beta1/struct.ProjectModelVersionGetCall.html), [*models versions list*](http://byron.github.io/google-apis-rs/google_ml1_beta1/struct.ProjectModelVersionListCall.html), [*models versions set default*](http://byron.github.io/google-apis-rs/google_ml1_beta1/struct.ProjectModelVersionSetDefaultCall.html), [*operations cancel*](http://byron.github.io/google-apis-rs/google_ml1_beta1/struct.ProjectOperationCancelCall.html), [*operations delete*](http://byron.github.io/google-apis-rs/google_ml1_beta1/struct.ProjectOperationDeleteCall.html), [*operations get*](http://byron.github.io/google-apis-rs/google_ml1_beta1/struct.ProjectOperationGetCall.html), [*operations list*](http://byron.github.io/google-apis-rs/google_ml1_beta1/struct.ProjectOperationListCall.html) and [*predict*](http://byron.github.io/google-apis-rs/google_ml1_beta1/struct.ProjectPredictCall.html) + + + + +# Structure of this Library + +The API is structured into the following primary items: + +* **[Hub](http://byron.github.io/google-apis-rs/google_ml1_beta1/struct.CloudMachineLearning.html)** + * a central object to maintain state and allow accessing all *Activities* + * creates [*Method Builders*](http://byron.github.io/google-apis-rs/google_ml1_beta1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](http://byron.github.io/google-apis-rs/google_ml1_beta1/trait.CallBuilder.html) +* **[Resources](http://byron.github.io/google-apis-rs/google_ml1_beta1/trait.Resource.html)** + * primary types that you can apply *Activities* to + * a collection of properties and *Parts* + * **[Parts](http://byron.github.io/google-apis-rs/google_ml1_beta1/trait.Part.html)** + * a collection of properties + * never directly used in *Activities* +* **[Activities](http://byron.github.io/google-apis-rs/google_ml1_beta1/trait.CallBuilder.html)** + * operations to apply to *Resources* + +All *structures* are marked with applicable traits to further categorize them and ease browsing. + +Generally speaking, you can invoke *Activities* like this: + +```Rust,ignore +let r = hub.resource().activity(...).doit() +``` + +Or specifically ... + +```ignore +let r = hub.projects().models_versions_delete(...).doit() +let r = hub.projects().operations_get(...).doit() +let r = hub.projects().models_versions_create(...).doit() +let r = hub.projects().models_delete(...).doit() +``` + +The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +The `doit()` method performs the actual communication with the server and returns the respective result. + +# Usage + +## Setting up your Project + +To use this library, you would put the following lines into your `Cargo.toml` file: + +```toml +[dependencies] +google-ml1_beta1 = "*" +``` + +## A complete example + +```Rust +extern crate hyper; +extern crate yup_oauth2 as oauth2; +extern crate google_ml1_beta1 as ml1_beta1; +use ml1_beta1::GoogleCloudMlV1beta1__Version; +use ml1_beta1::{Result, Error}; +use std::default::Default; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +use ml1_beta1::CloudMachineLearning; + +// Get an ApplicationSecret instance by some means. It contains the `client_id` and +// `client_secret`, among other things. +let secret: ApplicationSecret = Default::default(); +// Instantiate the authenticator. It will choose a suitable authentication flow for you, +// unless you replace `None` with the desired Flow. +// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +// retrieve them from storage. +let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, + hyper::Client::new(), + ::default(), None); +let mut hub = CloudMachineLearning::new(hyper::Client::new(), auth); +// As the method needs a request, you would usually fill it with the desired information +// into the respective structure. Some of the parts shown here might not be applicable ! +// Values shown here are possibly random and not representative ! +let mut req = GoogleCloudMlV1beta1__Version::default(); + +// You can configure optional parameters by calling the respective setters at will, and +// execute the final call using `doit()`. +// Values shown here are possibly random and not representative ! +let result = hub.projects().models_versions_create(req, "parent") + .doit(); + +match result { + Err(e) => match e { + // The Error enum provides details about what exactly happened. + // You can also just use its `Debug`, `Display` or `Error` traits + Error::HttpError(_) + |Error::MissingAPIKey + |Error::MissingToken(_) + |Error::Cancelled + |Error::UploadSizeLimitExceeded(_, _) + |Error::Failure(_) + |Error::BadRequest(_) + |Error::FieldClash(_) + |Error::JsonDecodeError(_, _) => println!("{}", e), + }, + Ok(res) => println!("Success: {:?}", res), +} + +``` +## Handling Errors + +All errors produced by the system are provided either as [Result](http://byron.github.io/google-apis-rs/google_ml1_beta1/enum.Result.html) enumeration as return value of +the doit() methods, or handed as possibly intermediate results to either the +[Hub Delegate](http://byron.github.io/google-apis-rs/google_ml1_beta1/trait.Delegate.html), or the [Authenticator Delegate](http://byron.github.io/google-apis-rs/google_ml1_beta1/../yup-oauth2/trait.AuthenticatorDelegate.html). + +When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +makes the system potentially resilient to all kinds of errors. + +## Uploads and Downloads +If a method supports downloads, the response body, which is part of the [Result](http://byron.github.io/google-apis-rs/google_ml1_beta1/enum.Result.html), should be +read by you to obtain the media. +If such a method also supports a [Response Result](http://byron.github.io/google-apis-rs/google_ml1_beta1/trait.ResponseResult.html), it will return that by default. +You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +this call: `.param("alt", "media")`. + +Methods supporting uploads can do so using up to 2 different protocols: +*simple* and *resumable*. The distinctiveness of each is represented by customized +`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. + +## Customization and Callbacks + +You may alter the way an `doit()` method is called by providing a [delegate](http://byron.github.io/google-apis-rs/google_ml1_beta1/trait.Delegate.html) to the +[Method Builder](http://byron.github.io/google-apis-rs/google_ml1_beta1/trait.CallBuilder.html) before making the final `doit()` call. +Respective methods will be called to provide progress information, as well as determine whether the system should +retry on failure. + +The [delegate trait](http://byron.github.io/google-apis-rs/google_ml1_beta1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. + +## Optional Parts in Server-Requests + +All structures provided by this library are made to be [enocodable](http://byron.github.io/google-apis-rs/google_ml1_beta1/trait.RequestValue.html) and +[decodable](http://byron.github.io/google-apis-rs/google_ml1_beta1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +are valid. +Most optionals are are considered [Parts](http://byron.github.io/google-apis-rs/google_ml1_beta1/trait.Part.html) which are identifiable by name, which will be sent to +the server to indicate either the set parts of the request or the desired parts in the response. + +## Builder Arguments + +Using [method builders](http://byron.github.io/google-apis-rs/google_ml1_beta1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +These will always take a single argument, for which the following statements are true. + +* [PODs][wiki-pod] are handed by copy +* strings are passed as `&str` +* [request values](http://byron.github.io/google-apis-rs/google_ml1_beta1/trait.RequestValue.html) are moved + +Arguments will always be copied or cloned into the builder, to make them independent of their original life times. + +[wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +[google-go-api]: https://github.com/google/google-api-go-client + +# License +The **ml1_beta1** library was generated by Sebastian Thiel, and is placed +under the *MIT* license. +You can read the full text at the repository's [license file][repo-license]. + +[repo-license]: https://github.com/Byron/google-apis-rs/LICENSE.md diff --git a/gen/ml1_beta1/src/build.rs b/gen/ml1_beta1/src/build.rs new file mode 100644 index 0000000000..0bebaf0bf0 --- /dev/null +++ b/gen/ml1_beta1/src/build.rs @@ -0,0 +1,25 @@ +#[cfg(feature = "with-serde-codegen")] +mod inner { + extern crate serde_codegen; + + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + serde_codegen::expand(&src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-serde-codegen"))] +mod inner { + pub fn main() {} +} + +pub fn main() { + inner::main() +} \ No newline at end of file diff --git a/gen/ml1_beta1/src/cmn.rs b/gen/ml1_beta1/src/cmn.rs new file mode 100644 index 0000000000..d75063e466 --- /dev/null +++ b/gen/ml1_beta1/src/cmn.rs @@ -0,0 +1,753 @@ +// COPY OF 'src/rust/api/cmn.rs' +// DO NOT EDIT +use std::io::{self, Read, Seek, Cursor, Write, SeekFrom}; +use std; +use std::fmt::{self, Display}; +use std::str::FromStr; +use std::error; +use std::thread::sleep; +use std::time::Duration; + +use mime::{Mime, TopLevel, SubLevel, Attr, Value}; +use oauth2::{TokenType, Retry, self}; +use hyper; +use hyper::header::{ContentType, ContentLength, Headers, UserAgent, Authorization, Header, + HeaderFormat, Bearer}; +use hyper::http::h1::LINE_ENDING; +use hyper::method::Method; +use hyper::status::StatusCode; + +use serde_json as json; + +/// Identifies the Hub. There is only one per library, this trait is supposed +/// to make intended use more explicit. +/// The hub allows to access all resource methods more easily. +pub trait Hub {} + +/// Identifies types for building methods of a particular resource type +pub trait MethodsBuilder {} + +/// Identifies types which represent builders for a particular resource method +pub trait CallBuilder {} + +/// Identifies types which can be inserted and deleted. +/// Types with this trait are most commonly used by clients of this API. +pub trait Resource {} + +/// Identifies types which are used in API responses. +pub trait ResponseResult {} + +/// Identifies types which are used in API requests. +pub trait RequestValue {} + +/// Identifies types which are not actually used by the API +/// This might be a bug within the google API schema. +pub trait UnusedType {} + +/// Identifies types which are only used as part of other types, which +/// usually are carrying the `Resource` trait. +pub trait Part {} + +/// Identifies types which are only used by other types internally. +/// They have no special meaning, this trait just marks them for completeness. +pub trait NestedType {} + +/// A utility to specify reader types which provide seeking capabilities too +pub trait ReadSeek: Seek + Read {} +impl ReadSeek for T {} + +/// A trait for all types that can convert themselves into a *parts* string +pub trait ToParts { + fn to_parts(&self) -> String; +} + +/// A utility type which can decode a server response that indicates error +#[derive(Deserialize)] +pub struct JsonServerError { + pub error: String, + pub error_description: Option +} + +/// A utility to represent detailed errors we might see in case there are BadRequests. +/// The latter happen if the sent parameters or request structures are unsound +#[derive(Deserialize, Serialize, Debug)] +pub struct ErrorResponse { + error: ServerError, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerError { + errors: Vec, + code: u16, + message: String, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerMessage { + domain: String, + reason: String, + message: String, + #[serde(rename="locationType")] + location_type: Option, + location: Option +} + +#[derive(Copy, Clone)] +pub struct DummyNetworkStream; + +impl Read for DummyNetworkStream { + fn read(&mut self, _: &mut [u8]) -> io::Result { + Ok(0) + } +} + +impl Write for DummyNetworkStream { + fn write(&mut self, _: &[u8]) -> io::Result { + Ok(0) + } + + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} + +impl hyper::net::NetworkStream for DummyNetworkStream { + fn peer_addr(&mut self) -> io::Result { + Ok("127.0.0.1:1337".parse().unwrap()) + } + + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } + + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } +} + + +/// A trait specifying functionality to help controlling any request performed by the API. +/// The trait has a conservative default implementation. +/// +/// It contains methods to deal with all common issues, as well with the ones related to +/// uploading media +pub trait Delegate { + + /// Called at the beginning of any API request. The delegate should store the method + /// information if he is interesting in knowing more context when further calls to it + /// are made. + /// The matching `finished()` call will always be made, no matter whether or not the API + /// request was successful. That way, the delegate may easily maintain a clean state + /// between various API calls. + fn begin(&mut self, MethodInfo) {} + + /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + /// + /// Return retry information. + fn http_error(&mut self, &hyper::Error) -> Retry { + Retry::Abort + } + + /// Called whenever there is the need for your applications API key after + /// the official authenticator implementation didn't provide one, for some reason. + /// If this method returns None as well, the underlying operation will fail + fn api_key(&mut self) -> Option { + None + } + + /// Called whenever the Authenticator didn't yield a token. The delegate + /// may attempt to provide one, or just take it as a general information about the + /// impending failure. + /// The given Error provides information about why the token couldn't be acquired in the + /// first place + fn token(&mut self, err: &error::Error) -> Option { + let _ = err; + None + } + + /// Called during resumable uploads to provide a URL for the impending upload. + /// It was saved after a previous call to `store_upload_url(...)`, and if not None, + /// will be used instead of asking the server for a new upload URL. + /// This is useful in case a previous resumable upload was aborted/canceled, but should now + /// be resumed. + /// The returned URL will be used exactly once - if it fails again and the delegate allows + /// to retry, we will ask the server for a new upload URL. + fn upload_url(&mut self) -> Option { + None + } + + /// Called after we have retrieved a new upload URL for a resumable upload to store it + /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// see `upload_url()`. + /// It will also be called with None after a successful upload, which allows the delegate + /// to forget the URL. That way, we will not attempt to resume an upload that has already + /// finished. + fn store_upload_url(&mut self, url: Option<&str>) { + let _ = url; + } + + /// Called whenever a server response could not be decoded from json. + /// It's for informational purposes only, the caller will return with an error + /// accordingly. + /// + /// # Arguments + /// + /// * `json_encoded_value` - The json-encoded value which failed to decode. + /// * `json_decode_error` - The decoder error + fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &json::Error) { + let _ = json_encoded_value; + let _ = json_decode_error; + } + + /// Called whenever the http request returns with a non-success status code. + /// This can involve authentication issues, or anything else that very much + /// depends on the used API method. + /// The delegate should check the status, header and decoded json error to decide + /// whether to retry or not. In the latter case, the underlying call will fail. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + fn http_failure(&mut self, _: &hyper::client::Response, Option, _: Option) -> Retry { + Retry::Abort + } + + /// Called prior to sending the main request of the given method. It can be used to time + /// the call or to print progress information. + /// It's also useful as you can be sure that a request will definitely be made. + fn pre_request(&mut self) { } + + /// Return the size of each chunk of a resumable upload. + /// Must be a power of two, with 1<<18 being the smallest allowed chunk size. + /// Will be called once before starting any resumable upload. + fn chunk_size(&mut self) -> u64 { + 1 << 23 + } + + /// Called before the given chunk is uploaded to the server. + /// If true is returned, the upload will be interrupted. + /// However, it may be resumable if you stored the upload URL in a previous call + /// to `store_upload_url()` + fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { + let _ = chunk; + false + } + + /// Called before the API request method returns, in every case. It can be used to clean up + /// internal state between calls to the API. + /// This call always has a matching call to `begin(...)`. + /// + /// # Arguments + /// + /// * `is_success` - a true value indicates the operation was successful. If false, you should + /// discard all values stored during `store_upload_url`. + fn finished(&mut self, is_success: bool) { + let _ = is_success; + } +} + +/// A delegate with a conservative default implementation, which is used if no other delegate is +/// set. +#[derive(Default)] +pub struct DefaultDelegate; + +impl Delegate for DefaultDelegate {} + + +#[derive(Debug)] +pub enum Error { + /// The http connection failed + HttpError(hyper::Error), + + /// An attempt was made to upload a resource with size stored in field `.0` + /// even though the maximum upload size is what is stored in field `.1`. + UploadSizeLimitExceeded(u64, u64), + + /// Represents information about a request that was not understood by the server. + /// Details are included. + BadRequest(ErrorResponse), + + /// We needed an API key for authentication, but didn't obtain one. + /// Neither through the authenticator, nor through the Delegate. + MissingAPIKey, + + /// We required a Token, but didn't get one from the Authenticator + MissingToken(Box), + + /// The delgate instructed to cancel the operation + Cancelled, + + /// An additional, free form field clashed with one of the built-in optional ones + FieldClash(&'static str), + + /// Shows that we failed to decode the server response. + /// This can happen if the protocol changes in conjunction with strict json decoding. + JsonDecodeError(String, json::Error), + + /// Indicates an HTTP repsonse with a non-success status code + Failure(hyper::client::Response), +} + + +impl Display for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + Error::HttpError(ref err) => err.fmt(f), + Error::UploadSizeLimitExceeded(ref resource_size, ref max_size) => + writeln!(f, "The media size {} exceeds the maximum allowed upload size of {}" + , resource_size, max_size), + Error::MissingAPIKey => { + (writeln!(f, "The application's API key was not found in the configuration")).ok(); + writeln!(f, "It is used as there are no Scopes defined for this method.") + }, + Error::BadRequest(ref err) => { + try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); + for err in err.error.errors.iter() { + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, + err.reason, + match &err.location { + &Some(ref loc) => format!("@{}", loc), + &None => String::new(), + })); + } + Ok(()) + }, + Error::MissingToken(ref err) => + writeln!(f, "Token retrieval failed with error: {}", err), + Error::Cancelled => + writeln!(f, "Operation cancelled by delegate"), + Error::FieldClash(field) => + writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), + Error::JsonDecodeError(ref json_str, ref err) + => writeln!(f, "{}: {}", err, json_str), + Error::Failure(ref response) => + writeln!(f, "Http status indicates failure: {:?}", response), + } + } +} + +impl error::Error for Error { + fn description(&self) -> &str { + match *self { + Error::HttpError(ref err) => err.description(), + Error::JsonDecodeError(_, ref err) => err.description(), + _ => "NO DESCRIPTION POSSIBLE - use `Display.fmt()` instead" + } + } + + fn cause(&self) -> Option<&error::Error> { + match *self { + Error::HttpError(ref err) => err.cause(), + Error::JsonDecodeError(_, ref err) => err.cause(), + _ => None + } + } +} + +/// A universal result type used as return for all calls. +pub type Result = std::result::Result; + +/// Contains information about an API request. +pub struct MethodInfo { + pub id: &'static str, + pub http_method: Method, +} + +const BOUNDARY: &'static str = "MDuXWGyeE33QFXGchb2VFWc4Z7945d"; + +/// Provides a `Read` interface that converts multiple parts into the protocol +/// identified by [RFC2387](https://tools.ietf.org/html/rfc2387). +/// **Note**: This implementation is just as rich as it needs to be to perform uploads +/// to google APIs, and might not be a fully-featured implementation. +#[derive(Default)] +pub struct MultiPartReader<'a> { + raw_parts: Vec<(Headers, &'a mut Read)>, + current_part: Option<(Cursor>, &'a mut Read)>, + last_part_boundary: Option>>, +} + +impl<'a> MultiPartReader<'a> { + + /// Reserve memory for exactly the given amount of parts + pub fn reserve_exact(&mut self, cap: usize) { + self.raw_parts.reserve_exact(cap); + } + + /// Add a new part to the queue of parts to be read on the first `read` call. + /// + /// # Arguments + /// + /// `headers` - identifying the body of the part. It's similar to the header + /// in an ordinary single-part call, and should thus contain the + /// same information. + /// `reader` - a reader providing the part's body + /// `size` - the amount of bytes provided by the reader. It will be put onto the header as + /// content-size. + /// `mime` - It will be put onto the content type + pub fn add_part(&mut self, reader: &'a mut Read, size: u64, mime_type: Mime) -> &mut MultiPartReader<'a> { + let mut headers = Headers::new(); + headers.set(ContentType(mime_type)); + headers.set(ContentLength(size)); + self.raw_parts.push((headers, reader)); + self + } + + /// Returns the mime-type representing our multi-part message. + /// Use it with the ContentType header. + pub fn mime_type(&self) -> Mime { + Mime( + TopLevel::Multipart, + SubLevel::Ext("Related".to_string()), + vec![(Attr::Ext("boundary".to_string()), Value::Ext(BOUNDARY.to_string()))], + ) + } + + /// Returns true if we are totally used + fn is_depleted(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_none() && self.last_part_boundary.is_none() + } + + /// Returns true if we are handling our last part + fn is_last_part(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_some() + } +} + +impl<'a> Read for MultiPartReader<'a> { + fn read(&mut self, buf: &mut [u8]) -> io::Result { + match (self.raw_parts.len(), + self.current_part.is_none(), + self.last_part_boundary.is_none()) { + (_, _, false) => { + let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); + if br < buf.len() { + self.last_part_boundary = None; + } + return Ok(br) + }, + (0, true, true) => return Ok(0), + (n, true, _) if n > 0 => { + let (headers, reader) = self.raw_parts.remove(0); + let mut c = Cursor::new(Vec::::new()); + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + headers, LINE_ENDING)).unwrap(); + c.seek(SeekFrom::Start(0)).unwrap(); + self.current_part = Some((c, reader)); + } + _ => {}, + } + + // read headers as long as possible + let (hb, rr) = { + let &mut (ref mut c, ref mut reader) = self.current_part.as_mut().unwrap(); + let b = c.read(buf).unwrap_or(0); + (b, reader.read(&mut buf[b..])) + }; + + match rr { + Ok(bytes_read) => { + if hb < buf.len() && bytes_read == 0 { + if self.is_last_part() { + // before clearing the last part, we will add the boundary that + // will be written last + self.last_part_boundary = Some(Cursor::new( + format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) + } + // We are depleted - this can trigger the next part to come in + self.current_part = None; + } + let mut total_bytes_read = hb + bytes_read; + while total_bytes_read < buf.len() && !self.is_depleted() { + match self.read(&mut buf[total_bytes_read ..]) { + Ok(br) => total_bytes_read += br, + Err(err) => return Err(err), + } + } + Ok(total_bytes_read) + } + Err(err) => { + // fail permanently + self.current_part = None; + self.last_part_boundary = None; + self.raw_parts.clear(); + Err(err) + } + } + } +} + +/// The `X-Upload-Content-Type` header. +/// +/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// processed to be more readable. +#[derive(PartialEq, Debug, Clone)] +pub struct XUploadContentType(pub Mime); + +impl ::std::ops::Deref for XUploadContentType { + type Target = Mime; + fn deref<'a>(&'a self) -> &'a Mime { &self.0 } +} +impl ::std::ops::DerefMut for XUploadContentType { + fn deref_mut<'a>(&'a mut self) -> &'a mut Mime { &mut self.0 } +} +impl Header for XUploadContentType { + fn header_name() -> &'static str { "X-Upload-Content-Type" } + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + hyper::header::parsing::from_one_raw_str(raw).map(XUploadContentType) + } +} +impl HeaderFormat for XUploadContentType { + fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result { + Display::fmt(&**self, f) + } +} +impl Display for XUploadContentType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(&**self, f) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct Chunk { + pub first: u64, + pub last: u64 +} + +impl fmt::Display for Chunk { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + (write!(fmt, "{}-{}", self.first, self.last)).ok(); + Ok(()) + } +} + +impl FromStr for Chunk { + type Err = &'static str; + + /// NOTE: only implements `%i-%i`, not `*` + fn from_str(s: &str) -> std::result::Result { + let parts: Vec<&str> = s.split('-').collect(); + if parts.len() != 2 { + return Err("Expected two parts: %i-%i") + } + Ok( + Chunk { + first: match FromStr::from_str(parts[0]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'first' as digit") + }, + last: match FromStr::from_str(parts[1]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'last' as digit") + } + } + ) + } +} + +/// Implements the Content-Range header, for serialization only +#[derive(Clone, PartialEq, Debug)] +pub struct ContentRange { + pub range: Option, + pub total_length: u64, +} + +impl Header for ContentRange { + fn header_name() -> &'static str { + "Content-Range" + } + + /// We are not parsable, as parsing is done by the `Range` header + fn parse_header(_: &[Vec]) -> hyper::error::Result { + Err(hyper::error::Error::Method) + } +} + + +impl HeaderFormat for ContentRange { + fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + try!(fmt.write_str("bytes ")); + match self.range { + Some(ref c) => try!(c.fmt(fmt)), + None => try!(fmt.write_str("*")) + } + (write!(fmt, "/{}", self.total_length)).ok(); + Ok(()) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct RangeResponseHeader(pub Chunk); + +impl Header for RangeResponseHeader { + fn header_name() -> &'static str { + "Range" + } + + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + if raw.len() > 0 { + let v = &raw[0]; + if let Ok(s) = std::str::from_utf8(v) { + const PREFIX: &'static str = "bytes "; + if s.starts_with(PREFIX) { + if let Ok(c) = ::from_str(&s[PREFIX.len()..]) { + return Ok(RangeResponseHeader(c)) + } + } + } + } + Err(hyper::error::Error::Method) + } +} + +impl HeaderFormat for RangeResponseHeader { + /// No implmentation necessary, we just need to parse + fn fmt_header(&self, _: &mut fmt::Formatter) -> fmt::Result { + Err(fmt::Error) + } +} + +/// A utility type to perform a resumable upload from start to end. +pub struct ResumableUploadHelper<'a, A: 'a> { + pub client: &'a mut hyper::client::Client, + pub delegate: &'a mut Delegate, + pub start_at: Option, + pub auth: &'a mut A, + pub user_agent: &'a str, + pub auth_header: Authorization, + pub url: &'a str, + pub reader: &'a mut ReadSeek, + pub media_type: Mime, + pub content_length: u64 +} + +impl<'a, A> ResumableUploadHelper<'a, A> + where A: oauth2::GetToken { + + fn query_transfer_status(&mut self) -> std::result::Result> { + loop { + match self.client.post(self.url) + .header(UserAgent(self.user_agent.to_string())) + .header(ContentRange { range: None, total_length: self.content_length }) + .header(self.auth_header.clone()) + .send() { + Ok(r) => { + // 308 = resume-incomplete == PermanentRedirect + let headers = r.headers.clone(); + let h: &RangeResponseHeader = match headers.get() { + Some(hh) if r.status == StatusCode::PermanentRedirect => hh, + None|Some(_) => { + if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { + sleep(d); + continue; + } + return Err(Ok(r)) + } + }; + return Ok(h.0.last) + } + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Err(Err(err)) + } + } + } + } + + /// returns None if operation was cancelled by delegate, or the HttpResult. + /// It can be that we return the result just because we didn't understand the status code - + /// caller should check for status himself before assuming it's OK to use + pub fn upload(&mut self) -> Option> { + let mut start = match self.start_at { + Some(s) => s, + None => match self.query_transfer_status() { + Ok(s) => s, + Err(result) => return Some(result) + } + }; + + const MIN_CHUNK_SIZE: u64 = 1 << 18; + let chunk_size = match self.delegate.chunk_size() { + cs if cs > MIN_CHUNK_SIZE => cs, + _ => MIN_CHUNK_SIZE + }; + + self.reader.seek(SeekFrom::Start(start)).unwrap(); + loop { + let request_size = match self.content_length - start { + rs if rs > chunk_size => chunk_size, + rs => rs + }; + + let mut section_reader = self.reader.take(request_size); + let range_header = ContentRange { + range: Some(Chunk {first: start, last: start + request_size - 1}), + total_length: self.content_length + }; + start += request_size; + if self.delegate.cancel_chunk_upload(&range_header) { + return None + } + let res = self.client.post(self.url) + .header(range_header) + .header(ContentType(self.media_type.clone())) + .header(UserAgent(self.user_agent.to_string())) + .body(&mut section_reader) + .send(); + match res { + Ok(mut res) => { + if res.status == StatusCode::PermanentRedirect { + continue + } + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let Retry::After(d) = self.delegate.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + } + return Some(Ok(res)) + }, + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Some(Err(err)) + } + } + } + } +} + +// Copy of src/rust/cli/cmn.rs +// TODO(ST): Allow sharing common code between program types +pub fn remove_json_null_values(value: &mut json::value::Value) { + match *value { + json::value::Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} diff --git a/gen/ml1_beta1/src/lib.rs b/gen/ml1_beta1/src/lib.rs new file mode 100644 index 0000000000..a2ec0d69c1 --- /dev/null +++ b/gen/ml1_beta1/src/lib.rs @@ -0,0 +1,191 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +//! This documentation was generated from *Cloud Machine Learning* crate version *1.0.0+20161212*, where *20161212* is the exact revision of the *ml:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! +//! Everything else about the *Cloud Machine Learning* *v1_beta1* API can be found at the +//! [official documentation site](https://cloud.google.com/ml/). +//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/ml1_beta1). +//! # Features +//! +//! Handle the following *Resources* with ease from the central [hub](struct.CloudMachineLearning.html) ... +//! +//! * projects +//! * [*get config*](struct.ProjectGetConfigCall.html), [*jobs cancel*](struct.ProjectJobCancelCall.html), [*jobs create*](struct.ProjectJobCreateCall.html), [*jobs get*](struct.ProjectJobGetCall.html), [*jobs list*](struct.ProjectJobListCall.html), [*models create*](struct.ProjectModelCreateCall.html), [*models delete*](struct.ProjectModelDeleteCall.html), [*models get*](struct.ProjectModelGetCall.html), [*models list*](struct.ProjectModelListCall.html), [*models versions create*](struct.ProjectModelVersionCreateCall.html), [*models versions delete*](struct.ProjectModelVersionDeleteCall.html), [*models versions get*](struct.ProjectModelVersionGetCall.html), [*models versions list*](struct.ProjectModelVersionListCall.html), [*models versions set default*](struct.ProjectModelVersionSetDefaultCall.html), [*operations cancel*](struct.ProjectOperationCancelCall.html), [*operations delete*](struct.ProjectOperationDeleteCall.html), [*operations get*](struct.ProjectOperationGetCall.html), [*operations list*](struct.ProjectOperationListCall.html) and [*predict*](struct.ProjectPredictCall.html) +//! +//! +//! +//! +//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](../index.html). +//! +//! # Structure of this Library +//! +//! The API is structured into the following primary items: +//! +//! * **[Hub](struct.CloudMachineLearning.html)** +//! * a central object to maintain state and allow accessing all *Activities* +//! * creates [*Method Builders*](trait.MethodsBuilder.html) which in turn +//! allow access to individual [*Call Builders*](trait.CallBuilder.html) +//! * **[Resources](trait.Resource.html)** +//! * primary types that you can apply *Activities* to +//! * a collection of properties and *Parts* +//! * **[Parts](trait.Part.html)** +//! * a collection of properties +//! * never directly used in *Activities* +//! * **[Activities](trait.CallBuilder.html)** +//! * operations to apply to *Resources* +//! +//! All *structures* are marked with applicable traits to further categorize them and ease browsing. +//! +//! Generally speaking, you can invoke *Activities* like this: +//! +//! ```Rust,ignore +//! let r = hub.resource().activity(...).doit() +//! ``` +//! +//! Or specifically ... +//! +//! ```ignore +//! let r = hub.projects().models_versions_delete(...).doit() +//! let r = hub.projects().operations_get(...).doit() +//! let r = hub.projects().models_versions_create(...).doit() +//! let r = hub.projects().models_delete(...).doit() +//! ``` +//! +//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +//! The `doit()` method performs the actual communication with the server and returns the respective result. +//! +//! # Usage +//! +//! ## Setting up your Project +//! +//! To use this library, you would put the following lines into your `Cargo.toml` file: +//! +//! ```toml +//! [dependencies] +//! google-ml1_beta1 = "*" +//! ``` +//! +//! ## A complete example +//! +//! ```test_harness,no_run +//! extern crate hyper; +//! extern crate yup_oauth2 as oauth2; +//! extern crate google_ml1_beta1 as ml1_beta1; +//! use ml1_beta1::GoogleCloudMlV1beta1__Version; +//! use ml1_beta1::{Result, Error}; +//! # #[test] fn egal() { +//! use std::default::Default; +//! use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +//! use ml1_beta1::CloudMachineLearning; +//! +//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and +//! // `client_secret`, among other things. +//! let secret: ApplicationSecret = Default::default(); +//! // Instantiate the authenticator. It will choose a suitable authentication flow for you, +//! // unless you replace `None` with the desired Flow. +//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +//! // retrieve them from storage. +//! let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +//! hyper::Client::new(), +//! ::default(), None); +//! let mut hub = CloudMachineLearning::new(hyper::Client::new(), auth); +//! // As the method needs a request, you would usually fill it with the desired information +//! // into the respective structure. Some of the parts shown here might not be applicable ! +//! // Values shown here are possibly random and not representative ! +//! let mut req = GoogleCloudMlV1beta1__Version::default(); +//! +//! // You can configure optional parameters by calling the respective setters at will, and +//! // execute the final call using `doit()`. +//! // Values shown here are possibly random and not representative ! +//! let result = hub.projects().models_versions_create(req, "parent") +//! .doit(); +//! +//! match result { +//! Err(e) => match e { +//! // The Error enum provides details about what exactly happened. +//! // You can also just use its `Debug`, `Display` or `Error` traits +//! Error::HttpError(_) +//! |Error::MissingAPIKey +//! |Error::MissingToken(_) +//! |Error::Cancelled +//! |Error::UploadSizeLimitExceeded(_, _) +//! |Error::Failure(_) +//! |Error::BadRequest(_) +//! |Error::FieldClash(_) +//! |Error::JsonDecodeError(_, _) => println!("{}", e), +//! }, +//! Ok(res) => println!("Success: {:?}", res), +//! } +//! # } +//! ``` +//! ## Handling Errors +//! +//! All errors produced by the system are provided either as [Result](enum.Result.html) enumeration as return value of +//! the doit() methods, or handed as possibly intermediate results to either the +//! [Hub Delegate](trait.Delegate.html), or the [Authenticator Delegate](../yup-oauth2/trait.AuthenticatorDelegate.html). +//! +//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +//! makes the system potentially resilient to all kinds of errors. +//! +//! ## Uploads and Downloads +//! If a method supports downloads, the response body, which is part of the [Result](enum.Result.html), should be +//! read by you to obtain the media. +//! If such a method also supports a [Response Result](trait.ResponseResult.html), it will return that by default. +//! You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +//! this call: `.param("alt", "media")`. +//! +//! Methods supporting uploads can do so using up to 2 different protocols: +//! *simple* and *resumable*. The distinctiveness of each is represented by customized +//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. +//! +//! ## Customization and Callbacks +//! +//! You may alter the way an `doit()` method is called by providing a [delegate](trait.Delegate.html) to the +//! [Method Builder](trait.CallBuilder.html) before making the final `doit()` call. +//! Respective methods will be called to provide progress information, as well as determine whether the system should +//! retry on failure. +//! +//! The [delegate trait](trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +//! +//! ## Optional Parts in Server-Requests +//! +//! All structures provided by this library are made to be [enocodable](trait.RequestValue.html) and +//! [decodable](trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +//! are valid. +//! Most optionals are are considered [Parts](trait.Part.html) which are identifiable by name, which will be sent to +//! the server to indicate either the set parts of the request or the desired parts in the response. +//! +//! ## Builder Arguments +//! +//! Using [method builders](trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +//! These will always take a single argument, for which the following statements are true. +//! +//! * [PODs][wiki-pod] are handed by copy +//! * strings are passed as `&str` +//! * [request values](trait.RequestValue.html) are moved +//! +//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times. +//! +//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +//! [google-go-api]: https://github.com/google/google-api-go-client +//! +//! + +// Unused attributes happen thanks to defined, but unused structures +// We don't warn about this, as depending on the API, some data structures or facilities are never used. +// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any +// unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(proc_macro))] +#![allow(unused_imports, unused_mut, dead_code)] + +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-serde-codegen")] +include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/ml1_beta1/src/lib.rs.in b/gen/ml1_beta1/src/lib.rs.in new file mode 100644 index 0000000000..94fc58883a --- /dev/null +++ b/gen/ml1_beta1/src/lib.rs.in @@ -0,0 +1,6699 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.in.mako' +// DO NOT EDIT ! + +#[cfg(feature = "nightly")] +#[macro_use] +extern crate serde_derive; + +extern crate hyper; +extern crate serde; +extern crate serde_json; +extern crate yup_oauth2 as oauth2; +extern crate mime; +extern crate url; + +mod cmn; + +use std::collections::HashMap; +use std::cell::RefCell; +use std::borrow::BorrowMut; +use std::default::Default; +use std::collections::BTreeMap; +use serde_json as json; +use std::io; +use std::fs; +use std::thread::sleep; +use std::time::Duration; + +pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + Resource, ErrorResponse, remove_json_null_values}; + + +// ############## +// UTILITIES ### +// ############ + +/// Identifies the an OAuth2 authorization scope. +/// A scope is needed when requesting an +/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). +#[derive(PartialEq, Eq, Hash)] +pub enum Scope { + /// View and manage your data across Google Cloud Platform services + CloudPlatform, +} + +impl AsRef for Scope { + fn as_ref(&self) -> &str { + match *self { + Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform", + } + } +} + +impl Default for Scope { + fn default() -> Scope { + Scope::CloudPlatform + } +} + + + +// ######## +// HUB ### +// ###### + +/// Central instance to access all CloudMachineLearning related resource activities +/// +/// # Examples +/// +/// Instantiate a new hub +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_ml1_beta1 as ml1_beta1; +/// use ml1_beta1::GoogleCloudMlV1beta1__Version; +/// use ml1_beta1::{Result, Error}; +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use ml1_beta1::CloudMachineLearning; +/// +/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and +/// // `client_secret`, among other things. +/// let secret: ApplicationSecret = Default::default(); +/// // Instantiate the authenticator. It will choose a suitable authentication flow for you, +/// // unless you replace `None` with the desired Flow. +/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +/// // retrieve them from storage. +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = CloudMachineLearning::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleCloudMlV1beta1__Version::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().models_versions_create(req, "parent") +/// .doit(); +/// +/// match result { +/// Err(e) => match e { +/// // The Error enum provides details about what exactly happened. +/// // You can also just use its `Debug`, `Display` or `Error` traits +/// Error::HttpError(_) +/// |Error::MissingAPIKey +/// |Error::MissingToken(_) +/// |Error::Cancelled +/// |Error::UploadSizeLimitExceeded(_, _) +/// |Error::Failure(_) +/// |Error::BadRequest(_) +/// |Error::FieldClash(_) +/// |Error::JsonDecodeError(_, _) => println!("{}", e), +/// }, +/// Ok(res) => println!("Success: {:?}", res), +/// } +/// # } +/// ``` +pub struct CloudMachineLearning { + client: RefCell, + auth: RefCell
, + _user_agent: String, +} + +impl<'a, C, A> Hub for CloudMachineLearning {} + +impl<'a, C, A> CloudMachineLearning + where C: BorrowMut, A: oauth2::GetToken { + + pub fn new(client: C, authenticator: A) -> CloudMachineLearning { + CloudMachineLearning { + client: RefCell::new(client), + auth: RefCell::new(authenticator), + _user_agent: "google-api-rust-client/1.0.0".to_string(), + } + } + + pub fn projects(&'a self) -> ProjectMethods<'a, C, A> { + ProjectMethods { hub: &self } + } + + /// Set the user-agent header field to use in all requests to the server. + /// It defaults to `google-api-rust-client/1.0.0`. + /// + /// Returns the previously set user-agent. + pub fn user_agent(&mut self, agent_name: String) -> String { + let prev = self._user_agent.clone(); + self._user_agent = agent_name; + prev + } +} + + +// ############ +// SCHEMAS ### +// ########## +/// The response message for Operations.ListOperations. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [operations list projects](struct.ProjectOperationListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleLongrunning__ListOperationsResponse { + /// The standard List next-page token. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// A list of operations that matches the specified filter in the request. + pub operations: Option>, +} + +impl ResponseResult for GoogleLongrunning__ListOperationsResponse {} + + +/// Response message for the ListJobs method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [jobs list projects](struct.ProjectJobListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudMlV1beta1__ListJobsResponse { + /// Optional. Pass this token as the `page_token` field of the request for a + /// subsequent call. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The list of jobs. + pub jobs: Option>, +} + +impl ResponseResult for GoogleCloudMlV1beta1__ListJobsResponse {} + + +/// Represents results of a prediction job. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudMlV1beta1__PredictionOutput { + /// The output Google Cloud Storage location provided at the job creation time. + #[serde(rename="outputPath")] + pub output_path: Option, + /// The number of generated predictions. + #[serde(rename="predictionCount")] + pub prediction_count: Option, + /// The number of data instances which resulted in errors. + #[serde(rename="errorCount")] + pub error_count: Option, +} + +impl Part for GoogleCloudMlV1beta1__PredictionOutput {} + + +/// Represents the result of a single hyperparameter tuning trial from a +/// training job. The TrainingOutput object that is returned on successful +/// completion of a training job with hyperparameter tuning includes a list +/// of HyperparameterOutput objects, one for each successful trial. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudMlV1beta1__HyperparameterOutput { + /// The hyperparameters given to this trial. + pub hyperparameters: Option>, + /// The trial id for these results. + #[serde(rename="trialId")] + pub trial_id: Option, + /// All recorded object metrics for this trial. + #[serde(rename="allMetrics")] + pub all_metrics: Option>, + /// The final objective metric seen for this trial. + #[serde(rename="finalMetric")] + pub final_metric: Option, +} + +impl Part for GoogleCloudMlV1beta1__HyperparameterOutput {} + + +/// Represents a machine learning solution. +/// +/// A model can have multiple versions, each of which is a deployed, trained +/// model ready to receive prediction requests. The model itself is just a +/// container. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [models get projects](struct.ProjectModelGetCall.html) (response) +/// * [models create projects](struct.ProjectModelCreateCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudMlV1beta1__Model { + /// Output only. The default version of the model. This version will be used to + /// handle prediction requests that do not specify a version. + /// + /// You can change the default version by calling + /// [projects.methods.versions.setDefault](/ml/reference/rest/v1beta1/projects.models.versions/setDefault). + #[serde(rename="defaultVersion")] + pub default_version: Option, + /// Optional. The description specified for the model when it was created. + pub description: Option, + /// Required. The name specified for the model when it was created. + /// + /// The model name must be unique within the project it is created in. + pub name: Option, +} + +impl RequestValue for GoogleCloudMlV1beta1__Model {} +impl ResponseResult for GoogleCloudMlV1beta1__Model {} + + +/// An observed value of a metric. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudMlV1beta1_HyperparameterOutput_HyperparameterMetric { + /// The global training step for this metric. + #[serde(rename="trainingStep")] + pub training_step: Option, + /// The objective value at this training step. + #[serde(rename="objectiveValue")] + pub objective_value: Option, +} + +impl Part for GoogleCloudMlV1beta1_HyperparameterOutput_HyperparameterMetric {} + + +/// Returns service account information associated with a project. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get config projects](struct.ProjectGetConfigCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudMlV1beta1__GetConfigResponse { + /// The project number for `service_account`. + #[serde(rename="serviceAccountProject")] + pub service_account_project: Option, + /// The service account Cloud ML uses to access resources in the project. + #[serde(rename="serviceAccount")] + pub service_account: Option, +} + +impl ResponseResult for GoogleCloudMlV1beta1__GetConfigResponse {} + + +/// Request message for the SetDefaultVersion request. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [models versions set default projects](struct.ProjectModelVersionSetDefaultCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudMlV1beta1__SetDefaultVersionRequest { _never_set: Option } + +impl RequestValue for GoogleCloudMlV1beta1__SetDefaultVersionRequest {} + + +/// Represents a set of hyperparameters to optimize. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudMlV1beta1__HyperparameterSpec { + /// Optional. How many training trials should be attempted to optimize + /// the specified hyperparameters. + /// + /// Defaults to one. + #[serde(rename="maxTrials")] + pub max_trials: Option, + /// Required. The set of parameters to tune. + pub params: Option>, + /// Optional. The number of training trials to run concurrently. + /// You can reduce the time it takes to perform hyperparameter tuning by adding + /// trials in parallel. However, each trail only benefits from the information + /// gained in completed trials. That means that a trial does not get access to + /// the results of trials running at the same time, which could reduce the + /// quality of the overall optimization. + /// + /// Each trial will use the same scale tier and machine types. + /// + /// Defaults to one. + #[serde(rename="maxParallelTrials")] + pub max_parallel_trials: Option, + /// Required. The type of goal to use for tuning. Available types are + /// `MAXIMIZE` and `MINIMIZE`. + /// + /// Defaults to `MAXIMIZE`. + pub goal: Option, +} + +impl Part for GoogleCloudMlV1beta1__HyperparameterSpec {} + + +/// Message that represents an arbitrary HTTP body. It should only be used for +/// payload formats that can't be represented as JSON, such as raw binary or +/// an HTML page. +/// +/// +/// This message can be used both in streaming and non-streaming API methods in +/// the request as well as the response. +/// +/// It can be used as a top-level request field, which is convenient if one +/// wants to extract parameters from either the URL or HTTP template into the +/// request fields and also want access to the raw HTTP body. +/// +/// Example: +/// +/// message GetResourceRequest { +/// // A unique request id. +/// string request_id = 1; +/// +/// // The raw HTTP body is bound to this field. +/// google.api.HttpBody http_body = 2; +/// } +/// +/// service ResourceService { +/// rpc GetResource(GetResourceRequest) returns (google.api.HttpBody); +/// rpc UpdateResource(google.api.HttpBody) returns (google.protobuf.Empty); +/// } +/// +/// Example with streaming methods: +/// +/// service CaldavService { +/// rpc GetCalendar(stream google.api.HttpBody) +/// returns (stream google.api.HttpBody); +/// rpc UpdateCalendar(stream google.api.HttpBody) +/// returns (stream google.api.HttpBody); +/// } +/// +/// Use of this type only changes how the request and response bodies are +/// handled, all other features will continue to work unchanged. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [predict projects](struct.ProjectPredictCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleApi__HttpBody { + /// HTTP body binary data. + pub data: Option, + /// The HTTP Content-Type string representing the content type of the body. + #[serde(rename="contentType")] + pub content_type: Option, +} + +impl ResponseResult for GoogleApi__HttpBody {} + + +/// Represents input parameters for a prediction job. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudMlV1beta1__PredictionInput { + /// Required. The output Google Cloud Storage location. + #[serde(rename="outputPath")] + pub output_path: Option, + /// Use this field if you want to use the default version for the specified + /// model. The string must use the following format: + /// + /// `"projects/[YOUR_PROJECT]/models/[YOUR_MODEL]"` + #[serde(rename="modelName")] + pub model_name: Option, + /// Required. The format of the input data files. + #[serde(rename="dataFormat")] + pub data_format: Option, + /// Use this field if you want to specify a version of the model to use. The + /// string is formatted the same way as `model_version`, with the addition + /// of the version information: + /// + /// `"projects/[YOUR_PROJECT]/models/YOUR_MODEL/versions/[YOUR_VERSION]"` + #[serde(rename="versionName")] + pub version_name: Option, + /// Required. The Google Cloud Storage location of the input data files. + /// May contain wildcards. + #[serde(rename="inputPaths")] + pub input_paths: Option>, + /// Optional. The maximum number of workers to be used for parallel processing. + /// Defaults to 10 if not specified. + #[serde(rename="maxWorkerCount")] + pub max_worker_count: Option, + /// Required. The Google Compute Engine region to run the prediction job in. + pub region: Option, +} + +impl Part for GoogleCloudMlV1beta1__PredictionInput {} + + +/// Response message for the ListModels method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [models list projects](struct.ProjectModelListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudMlV1beta1__ListModelsResponse { + /// The list of models. + pub models: Option>, + /// Optional. Pass this token as the `page_token` field of the request for a + /// subsequent call. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, +} + +impl ResponseResult for GoogleCloudMlV1beta1__ListModelsResponse {} + + +/// A generic empty message that you can re-use to avoid defining duplicated +/// empty messages in your APIs. A typical example is to use it as the request +/// or the response type of an API method. For instance: +/// +/// service Foo { +/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); +/// } +/// +/// The JSON representation for `Empty` is empty JSON object `{}`. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [jobs cancel projects](struct.ProjectJobCancelCall.html) (response) +/// * [operations delete projects](struct.ProjectOperationDeleteCall.html) (response) +/// * [operations cancel projects](struct.ProjectOperationCancelCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleProtobuf__Empty { _never_set: Option } + +impl ResponseResult for GoogleProtobuf__Empty {} + + +/// Represents results of a training job. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudMlV1beta1__TrainingOutput { + /// The amount of ML units consumed by the job. + #[serde(rename="consumedMlUnits")] + pub consumed_ml_units: Option, + /// The number of hyperparameter tuning trials that completed successfully. + #[serde(rename="completedTrialCount")] + pub completed_trial_count: Option, + /// Results for individual Hyperparameter trials. + pub trials: Option>, +} + +impl Part for GoogleCloudMlV1beta1__TrainingOutput {} + + +/// This resource represents a long-running operation that is the result of a +/// network API call. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [models versions delete projects](struct.ProjectModelVersionDeleteCall.html) (response) +/// * [operations get projects](struct.ProjectOperationGetCall.html) (response) +/// * [models versions create projects](struct.ProjectModelVersionCreateCall.html) (response) +/// * [models delete projects](struct.ProjectModelDeleteCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleLongrunning__Operation { + /// The error result of the operation in case of failure or cancellation. + pub error: Option, + /// If the value is `false`, it means the operation is still in progress. + /// If true, the operation is completed, and either `error` or `response` is + /// available. + pub done: Option, + /// The normal response of the operation in case of success. If the original + /// method returns no data on success, such as `Delete`, the response is + /// `google.protobuf.Empty`. If the original method is standard + /// `Get`/`Create`/`Update`, the response should be the resource. For other + /// methods, the response should have the type `XxxResponse`, where `Xxx` + /// is the original method name. For example, if the original method name + /// is `TakeSnapshot()`, the inferred response type is + /// `TakeSnapshotResponse`. + pub response: Option>, + /// The server-assigned name, which is only unique within the same service that + /// originally returns it. If you use the default HTTP mapping, the + /// `name` should have the format of `operations/some/unique/name`. + pub name: Option, + /// Service-specific metadata associated with the operation. It typically + /// contains progress information and common metadata such as create time. + /// Some services might not provide such metadata. Any method that returns a + /// long-running operation should document the metadata type, if any. + pub metadata: Option>, +} + +impl ResponseResult for GoogleLongrunning__Operation {} + + +/// Response message for the ListVersions method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [models versions list projects](struct.ProjectModelVersionListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudMlV1beta1__ListVersionsResponse { + /// Optional. Pass this token as the `page_token` field of the request for a + /// subsequent call. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The list of versions. + pub versions: Option>, +} + +impl ResponseResult for GoogleCloudMlV1beta1__ListVersionsResponse {} + + +/// Represents a version of the model. +/// +/// Each version is a trained model deployed in the cloud, ready to handle +/// prediction requests. A model can have multiple versions. You can get +/// information about all of the versions of a given model by calling +/// [projects.models.versions.list](/ml/reference/rest/v1beta1/projects.models.versions/list). +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [models versions get projects](struct.ProjectModelVersionGetCall.html) (response) +/// * [models versions create projects](struct.ProjectModelVersionCreateCall.html) (request) +/// * [models versions set default projects](struct.ProjectModelVersionSetDefaultCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudMlV1beta1__Version { + /// Optional. The description specified for the version when it was created. + pub description: Option, + /// Required.The name specified for the version when it was created. + /// + /// The version name must be unique within the model it is created in. + pub name: Option, + /// Required. The Google Cloud Storage location of the trained model used to + /// create the version. See the + /// [overview of model deployment](/ml/docs/concepts/deployment-overview) for + /// more informaiton. + /// + /// When passing Version to + /// [projects.models.versions.create](/ml/reference/rest/v1beta1/projects.models.versions/create) + /// the model service uses the specified location as the source of the model. + /// Once deployed, the model version is hosted by the prediction service, so + /// this location is useful only as a historical record. + #[serde(rename="deploymentUri")] + pub deployment_uri: Option, + /// Output only. The time the version was created. + #[serde(rename="createTime")] + pub create_time: Option, + /// Output only. If true, this version will be used to handle prediction + /// requests that do not specify a version. + /// + /// You can change the default version by calling + /// [projects.methods.versions.setDefault](/ml/reference/rest/v1beta1/projects.models.versions/setDefault). + #[serde(rename="isDefault")] + pub is_default: Option, + /// Output only. The time the version was last used for prediction. + #[serde(rename="lastUseTime")] + pub last_use_time: Option, +} + +impl RequestValue for GoogleCloudMlV1beta1__Version {} +impl ResponseResult for GoogleCloudMlV1beta1__Version {} + + +/// Request for predictions to be issued against a trained model. +/// +/// The body of the request is a single JSON object with a single top-level +/// field: +/// +///
+///
instances
+///
A JSON array containing values representing the instances to use for +/// prediction.
+///
+/// +/// The structure of each element of the instances list is determined by your +/// model's input definition. Instances can include named inputs or can contain +/// only unlabeled values. +/// +/// Most data does not include named inputs. Some instances will be simple +/// JSON values (boolean, number, or string). However, instances are often lists +/// of simple values, or complex nested lists. Here are some examples of request +/// bodies: +/// +/// CSV data with each row encoded as a string value: +///
+/// {"instances": ["1.0,true,\\"x\\"", "-2.0,false,\\"y\\""]}
+/// 
+/// Plain text: +///
+/// {"instances": ["the quick brown fox", "la bruja le dio"]}
+/// 
+/// Sentences encoded as lists of words (vectors of strings): +///
+/// {"instances": [["the","quick","brown"], ["la","bruja","le"]]}
+/// 
+/// Floating point scalar values: +///
+/// {"instances": [0.0, 1.1, 2.2]}
+/// 
+/// Vectors of integers: +///
+/// {"instances": [[0, 1, 2], [3, 4, 5],...]}
+/// 
+/// Tensors (in this case, two-dimensional tensors): +///
+/// {"instances": [[[0, 1, 2], [3, 4, 5]], ...]}
+/// 
+/// Images represented as a three-dimensional list. In this encoding scheme the +/// first two dimensions represent the rows and columns of the image, and the +/// third contains the R, G, and B values for each pixel. +///
+/// {"instances": [[[[138, 30, 66], [130, 20, 56], ...]]]]}
+/// 
+/// Data must be encoded as UTF-8. If your data uses another character encoding, +/// you must base64 encode the data and mark it as binary. To mark a JSON string +/// as binary, replace it with an object with a single attribute named `b`: +///
{"b": "..."} 
+/// For example: +/// +/// Two Serialized tf.Examples (fake data, for illustrative purposes only): +///
+/// {"instances": [{"b64": "X5ad6u"}, {"b64": "IA9j4nx"}]}
+/// 
+/// Two JPEG image byte strings (fake data, for illustrative purposes only): +///
+/// {"instances": [{"b64": "ASa8asdf"}, {"b64": "JLK7ljk3"}]}
+/// 
+/// If your data includes named references, format each instance as a JSON object +/// with the named references as the keys: +/// +/// JSON input data to be preprocessed: +///
+/// {"instances": [{"a": 1.0,  "b": true,  "c": "x"},
+///                {"a": -2.0, "b": false, "c": "y"}]}
+/// 
+/// Some models have an underlying TensorFlow graph that accepts multiple input +/// tensors. In this case, you should use the names of JSON name/value pairs to +/// identify the input tensors, as shown in the following exmaples: +/// +/// For a graph with input tensor aliases "tag" (string) and "image" +/// (base64-encoded string): +///
+/// {"instances": [{"tag": "beach", "image": {"b64": "ASa8asdf"}},
+///                {"tag": "car", "image": {"b64": "JLK7ljk3"}}]}
+/// 
+/// For a graph with input tensor aliases "tag" (string) and "image" +/// (3-dimensional array of 8-bit ints): +///
+/// {"instances": [{"tag": "beach", "image": [[[263, 1, 10], [262, 2, 11], ...]]},
+///                {"tag": "car", "image": [[[10, 11, 24], [23, 10, 15], ...]]}]}
+/// 
+/// If the call is successful, the response body will contain one prediction +/// entry per instance in the request body. If prediction fails for any +/// instance, the response body will contain no predictions and will contian +/// a single error entry instead. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [predict projects](struct.ProjectPredictCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudMlV1beta1__PredictRequest { + /// + /// Required. The prediction request body. + #[serde(rename="httpBody")] + pub http_body: Option, +} + +impl RequestValue for GoogleCloudMlV1beta1__PredictRequest {} + + +/// Represents a single hyperparameter to optimize. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudMlV1beta1__ParameterSpec { + /// Required if type is `DISCRETE`. + /// A list of feasible points. + /// The list should be in strictly increasing order. For instance, this + /// parameter might have possible settings of 1.5, 2.5, and 4.0. This list + /// should not contain more than 1,000 values. + #[serde(rename="discreteValues")] + pub discrete_values: Option>, + /// Optional. How the parameter should be scaled to the hypercube. + /// Leave unset for categorical parameters. + /// Some kind of scaling is strongly recommended for real or integral + /// parameters (e.g., `UNIT_LINEAR_SCALE`). + #[serde(rename="scaleType")] + pub scale_type: Option, + /// Required. The parameter name must be unique amongst all ParameterConfigs in + /// a HyperparameterSpec message. E.g., "learning_rate". + #[serde(rename="parameterName")] + pub parameter_name: Option, + /// Required if type is `DOUBLE` or `INTEGER`. This field + /// should be unset if type is `CATEGORICAL`. This value should be integers if + /// type is INTEGER. + #[serde(rename="minValue")] + pub min_value: Option, + /// Required. The type of the parameter. + #[serde(rename="type")] + pub type_: Option, + /// Required if typeis `DOUBLE` or `INTEGER`. This field + /// should be unset if type is `CATEGORICAL`. This value should be integers if + /// type is `INTEGER`. + #[serde(rename="maxValue")] + pub max_value: Option, + /// Required if type is `CATEGORICAL`. The list of possible categories. + #[serde(rename="categoricalValues")] + pub categorical_values: Option>, +} + +impl Part for GoogleCloudMlV1beta1__ParameterSpec {} + + +/// Represents a training or prediction job. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [jobs create projects](struct.ProjectJobCreateCall.html) (request|response) +/// * [jobs get projects](struct.ProjectJobGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudMlV1beta1__Job { + /// The current training job result. + #[serde(rename="trainingOutput")] + pub training_output: Option, + /// Output only. When the job processing was started. + #[serde(rename="startTime")] + pub start_time: Option, + /// Output only. The details of a failure or a cancellation. + #[serde(rename="errorMessage")] + pub error_message: Option, + /// Required. The user-specified id of the job. + #[serde(rename="jobId")] + pub job_id: Option, + /// Output only. The detailed state of a job. + pub state: Option, + /// Input parameters to create a prediction job. + #[serde(rename="predictionInput")] + pub prediction_input: Option, + /// Input parameters to create a training job. + #[serde(rename="trainingInput")] + pub training_input: Option, + /// Output only. When the job processing was completed. + #[serde(rename="endTime")] + pub end_time: Option, + /// The current prediction job result. + #[serde(rename="predictionOutput")] + pub prediction_output: Option, + /// Output only. When the job was created. + #[serde(rename="createTime")] + pub create_time: Option, +} + +impl RequestValue for GoogleCloudMlV1beta1__Job {} +impl ResponseResult for GoogleCloudMlV1beta1__Job {} + + +/// Request message for the CancelJob method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [jobs cancel projects](struct.ProjectJobCancelCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudMlV1beta1__CancelJobRequest { _never_set: Option } + +impl RequestValue for GoogleCloudMlV1beta1__CancelJobRequest {} + + +/// Represents input parameters for a training job. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudMlV1beta1__TrainingInput { + /// Optional. Specifies the type of virtual machine to use for your training + /// job's worker nodes. + /// + /// The supported values are the same as those described in the entry for + /// `masterType`. + /// + /// This value must be present when `scaleTier` is set to `CUSTOM` and + /// `workerCount` is greater than zero. + #[serde(rename="workerType")] + pub worker_type: Option, + /// Required. Specifies the machine types, the number of replicas for workers + /// and parameter servers. + #[serde(rename="scaleTier")] + pub scale_tier: Option, + /// Optional. Specifies the type of virtual machine to use for your training + /// job's master worker. + /// + /// The following types are supported: + /// + ///
+ ///
standard
+ ///
+ /// A basic machine configuration suitable for training simple models with + /// small to moderate datasets. + ///
+ ///
large_model
+ ///
+ /// A machine with a lot of memory, specially suited for parameter servers + /// when your model is large (having many hidden layers or layers with very + /// large numbers of nodes). + ///
+ ///
complex_model_s
+ ///
+ /// A machine suitable for the master and workers of the cluster when your + /// model requires more computation than the standard machine can handle + /// satisfactorily. + ///
+ ///
complex_model_m
+ ///
+ /// A machine with roughly twice the number of cores and roughly double the + /// memory of complex_model_s. + ///
+ ///
complex_model_l
+ ///
+ /// A machine with roughly twice the number of cores and roughly double the + /// memory of complex_model_m. + ///
+ ///
+ /// + /// You must set this value when `scaleTier` is set to `CUSTOM`. + #[serde(rename="masterType")] + pub master_type: Option, + /// Optional. The set of Hyperparameters to tune. + pub hyperparameters: Option, + /// Required. The Google Compute Engine region to run the training job in. + pub region: Option, + /// Optional. Command line arguments to pass to the program. + pub args: Option>, + /// Required. The Python module name to run after installing the packages. + #[serde(rename="pythonModule")] + pub python_module: Option, + /// Required. The Google Cloud Storage location of the packages with + /// the training program and any additional dependencies. + #[serde(rename="packageUris")] + pub package_uris: Option>, + /// Optional. The number of worker replicas to use for the training job. Each + /// replica in the cluster will be of the type specified in `worker_type`. + /// + /// This value can only be used when `scale_tier` is set to `CUSTOM`. If you + /// set this value, you must also set `worker_type`. + #[serde(rename="workerCount")] + pub worker_count: Option, + /// Optional. Specifies the type of virtual machine to use for your training + /// job's parameter server. + /// + /// The supported values are the same as those described in the entry for + /// `master_type`. + /// + /// This value must be present when `scaleTier` is set to `CUSTOM` and + /// `parameter_server_count` is greater than zero. + #[serde(rename="parameterServerType")] + pub parameter_server_type: Option, + /// Optional. The number of parameter server replicas to use for the training + /// job. Each replica in the cluster will be of the type specified in + /// `parameter_server_type`. + /// + /// This value can only be used when `scale_tier` is set to `CUSTOM`.If you + /// set this value, you must also set `parameter_server_type`. + #[serde(rename="parameterServerCount")] + pub parameter_server_count: Option, +} + +impl Part for GoogleCloudMlV1beta1__TrainingInput {} + + +/// The `Status` type defines a logical error model that is suitable for different +/// programming environments, including REST APIs and RPC APIs. It is used by +/// [gRPC](https://github.com/grpc). The error model is designed to be: +/// +/// - Simple to use and understand for most users +/// - Flexible enough to meet unexpected needs +/// +/// # Overview +/// +/// The `Status` message contains three pieces of data: error code, error message, +/// and error details. The error code should be an enum value of +/// google.rpc.Code, but it may accept additional error codes if needed. The +/// error message should be a developer-facing English message that helps +/// developers *understand* and *resolve* the error. If a localized user-facing +/// error message is needed, put the localized message in the error details or +/// localize it in the client. The optional error details may contain arbitrary +/// information about the error. There is a predefined set of error detail types +/// in the package `google.rpc` which can be used for common error conditions. +/// +/// # Language mapping +/// +/// The `Status` message is the logical representation of the error model, but it +/// is not necessarily the actual wire format. When the `Status` message is +/// exposed in different client libraries and different wire protocols, it can be +/// mapped differently. For example, it will likely be mapped to some exceptions +/// in Java, but more likely mapped to some error codes in C. +/// +/// # Other uses +/// +/// The error model and the `Status` message can be used in a variety of +/// environments, either with or without APIs, to provide a +/// consistent developer experience across different environments. +/// +/// Example uses of this error model include: +/// +/// - Partial errors. If a service needs to return partial errors to the client, +/// it may embed the `Status` in the normal response to indicate the partial +/// errors. +/// +/// - Workflow errors. A typical workflow has multiple steps. Each step may +/// have a `Status` message for error reporting purpose. +/// +/// - Batch operations. If a client uses batch request and batch response, the +/// `Status` message should be used directly inside batch response, one for +/// each error sub-response. +/// +/// - Asynchronous operations. If an API call embeds asynchronous operation +/// results in its response, the status of those operations should be +/// represented directly using the `Status` message. +/// +/// - Logging. If some API errors are stored in logs, the message `Status` could +/// be used directly after any stripping needed for security/privacy reasons. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleRpc__Status { + /// A developer-facing error message, which should be in English. Any + /// user-facing error message should be localized and sent in the + /// google.rpc.Status.details field, or localized by the client. + pub message: Option, + /// The status code, which should be an enum value of google.rpc.Code. + pub code: Option, + /// A list of messages that carry the error details. There will be a + /// common set of message types for APIs to use. + pub details: Option>>, +} + +impl Part for GoogleRpc__Status {} + + + +// ################### +// MethodBuilders ### +// ################# + +/// A builder providing access to all methods supported on *project* resources. +/// It is not used directly, but through the `CloudMachineLearning` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_ml1_beta1 as ml1_beta1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use ml1_beta1::CloudMachineLearning; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = CloudMachineLearning::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get_config(...)`, `jobs_cancel(...)`, `jobs_create(...)`, `jobs_get(...)`, `jobs_list(...)`, `models_create(...)`, `models_delete(...)`, `models_get(...)`, `models_list(...)`, `models_versions_create(...)`, `models_versions_delete(...)`, `models_versions_get(...)`, `models_versions_list(...)`, `models_versions_set_default(...)`, `operations_cancel(...)`, `operations_delete(...)`, `operations_get(...)`, `operations_list(...)` and `predict(...)` +/// // to build up your call. +/// let rb = hub.projects(); +/// # } +/// ``` +pub struct ProjectMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudMachineLearning, +} + +impl<'a, C, A> MethodsBuilder for ProjectMethods<'a, C, A> {} + +impl<'a, C, A> ProjectMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Lists operations that match the specified filter in the request. If the + /// server doesn't support this method, it returns `UNIMPLEMENTED`. + /// + /// NOTE: the `name` binding below allows API services to override the binding + /// to use different resource name schemes, such as `users/*/operations`. + /// + /// # Arguments + /// + /// * `name` - The name of the operation collection. + pub fn operations_list(&self, name: &str) -> ProjectOperationListCall<'a, C, A> { + ProjectOperationListCall { + hub: self.hub, + _name: name.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _filter: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a long-running operation. This method indicates that the client is + /// no longer interested in the operation result. It does not cancel the + /// operation. If the server doesn't support this method, it returns + /// `google.rpc.Code.UNIMPLEMENTED`. + /// + /// # Arguments + /// + /// * `name` - The name of the operation resource to be deleted. + pub fn operations_delete(&self, name: &str) -> ProjectOperationDeleteCall<'a, C, A> { + ProjectOperationDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a new version of a model from a trained TensorFlow model. + /// + /// If the version created in the cloud by this call is the first deployed + /// version of the specified model, it will be made the default version of the + /// model. When you add a version to a model that already has one or more + /// versions, the default version does not automatically change. If you want a + /// new version to be the default, you must call + /// [projects.models.versions.setDefault](/ml/reference/rest/v1beta1/projects.models.versions/setDefault). + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - Required. The name of the model. + /// Authorization: requires `Editor` role on the parent project. + pub fn models_versions_create(&self, request: GoogleCloudMlV1beta1__Version, parent: &str) -> ProjectModelVersionCreateCall<'a, C, A> { + ProjectModelVersionCreateCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets basic information about all the versions of a model. + /// + /// If you expect that a model has a lot of versions, or if you need to handle + /// only a limited number of results at a time, you can request that the list + /// be retrieved in batches (called pages): + /// + /// # Arguments + /// + /// * `parent` - Required. The name of the model for which to list the version. + /// Authorization: requires `Viewer` role on the parent project. + pub fn models_versions_list(&self, parent: &str) -> ProjectModelVersionListCall<'a, C, A> { + ProjectModelVersionListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets the latest state of a long-running operation. Clients can use this + /// method to poll the operation result at intervals as recommended by the API + /// service. + /// + /// # Arguments + /// + /// * `name` - The name of the operation resource. + pub fn operations_get(&self, name: &str) -> ProjectOperationGetCall<'a, C, A> { + ProjectOperationGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a model version. + /// + /// Each model can have multiple versions deployed and in use at any given + /// time. Use this method to remove a single version. + /// + /// Note: You cannot delete the version that is set as the default version + /// of the model unless it is the only remaining version. + /// + /// # Arguments + /// + /// * `name` - Required. The name of the version. You can get the names of all the + /// versions of a model by calling + /// [projects.models.versions.list](/ml/reference/rest/v1beta1/projects.models.versions/list). + /// Authorization: requires `Editor` role on the parent project. + pub fn models_versions_delete(&self, name: &str) -> ProjectModelVersionDeleteCall<'a, C, A> { + ProjectModelVersionDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a training or a batch prediction job. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - Required. The project name. + /// Authorization: requires `Editor` role on the specified project. + pub fn jobs_create(&self, request: GoogleCloudMlV1beta1__Job, parent: &str) -> ProjectJobCreateCall<'a, C, A> { + ProjectJobCreateCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Designates a version to be the default for the model. + /// + /// The default version is used for prediction requests made against the model + /// that don't specify a version. + /// + /// The first version to be created for a model is automatically set as the + /// default. You must make any subsequent changes to the default version + /// setting manually using this method. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - Required. The name of the version to make the default for the model. You + /// can get the names of all the versions of a model by calling + /// [projects.models.versions.list](/ml/reference/rest/v1beta1/projects.models.versions/list). + /// Authorization: requires `Editor` role on the parent project. + pub fn models_versions_set_default(&self, request: GoogleCloudMlV1beta1__SetDefaultVersionRequest, name: &str) -> ProjectModelVersionSetDefaultCall<'a, C, A> { + ProjectModelVersionSetDefaultCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Performs prediction on the data in the request. + /// + /// Responses are very similar to requests. There are two top-level fields, + /// each of which are JSON lists: + /// + ///
+ ///
predictions
+ ///
The list of predictions, one per instance in the request.
+ ///
error
+ ///
An error message returned instead of a prediction list if any + /// instance produced an error.
+ ///
+ /// + /// If the call is successful, the response body will contain one prediction + /// entry per instance in the request body. If prediction fails for any + /// instance, the response body will contain no predictions and will contian + /// a single error entry instead. + /// + /// Even though there is one prediction per instance, the format of a + /// prediction is not directly related to the format of an instance. + /// Predictions take whatever format is specified in the outputs collection + /// defined in the model. The collection of predictions is returned in a JSON + /// list. Each member of the list can be a simple value, a list, or a JSON + /// object of any complexity. If your model has more than one output tensor, + /// each prediction will be a JSON object containing a name/value pair for each + /// output. The names identify the output aliases in the graph. + /// + /// The following examples show some possible responses: + /// + /// A simple set of predictions for three input instances, where each + /// prediction is an integer value: + ///
+    /// {"predictions": [5, 4, 3]}
+    /// 
+ /// A more complex set of predictions, each containing two named values that + /// correspond to output tensors, named **label** and **scores** respectively. + /// The value of **label** is the predicted category ("car" or "beach") and + /// **scores** contains a list of probabilities for that instance across the + /// possible categories. + ///
+    /// {"predictions": [{"label": "beach", "scores": [0.1, 0.9]},
+    ///                  {"label": "car", "scores": [0.75, 0.25]}]}
+    /// 
+ /// A response when there is an error processing an input instance: + ///
+    /// {"error": "Divide by zero"}
+    /// 
+ /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - Required. The resource name of a model or a version. + /// Authorization: requires `Viewer` role on the parent project. + pub fn predict(&self, request: GoogleCloudMlV1beta1__PredictRequest, name: &str) -> ProjectPredictCall<'a, C, A> { + ProjectPredictCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a model. + /// + /// You can only delete a model if there are no versions in it. You can delete + /// versions by calling + /// [projects.models.versions.delete](/ml/reference/rest/v1beta1/projects.models.versions/delete). + /// + /// # Arguments + /// + /// * `name` - Required. The name of the model. + /// Authorization: requires `Editor` role on the parent project. + pub fn models_delete(&self, name: &str) -> ProjectModelDeleteCall<'a, C, A> { + ProjectModelDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Get the service account information associated with your project. You need + /// this information in order to grant the service account persmissions for + /// the Google Cloud Storage location where you put your model training code + /// for training the model with Google Cloud Machine Learning. + /// + /// # Arguments + /// + /// * `name` - Required. The project name. + /// Authorization: requires `Viewer` role on the specified project. + pub fn get_config(&self, name: &str) -> ProjectGetConfigCall<'a, C, A> { + ProjectGetConfigCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Describes a job. + /// + /// # Arguments + /// + /// * `name` - Required. The name of the job to get the description of. + /// Authorization: requires `Viewer` role on the parent project. + pub fn jobs_get(&self, name: &str) -> ProjectJobGetCall<'a, C, A> { + ProjectJobGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Starts asynchronous cancellation on a long-running operation. The server + /// makes a best effort to cancel the operation, but success is not + /// guaranteed. If the server doesn't support this method, it returns + /// `google.rpc.Code.UNIMPLEMENTED`. Clients can use + /// Operations.GetOperation or + /// other methods to check whether the cancellation succeeded or whether the + /// operation completed despite cancellation. On successful cancellation, + /// the operation is not deleted; instead, it becomes an operation with + /// an Operation.error value with a google.rpc.Status.code of 1, + /// corresponding to `Code.CANCELLED`. + /// + /// # Arguments + /// + /// * `name` - The name of the operation resource to be cancelled. + pub fn operations_cancel(&self, name: &str) -> ProjectOperationCancelCall<'a, C, A> { + ProjectOperationCancelCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a model which will later contain one or more versions. + /// + /// You must add at least one version before you can request predictions from + /// the model. Add versions by calling + /// [projects.models.versions.create](/ml/reference/rest/v1beta1/projects.models.versions/create). + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - Required. The project name. + /// Authorization: requires `Editor` role on the specified project. + pub fn models_create(&self, request: GoogleCloudMlV1beta1__Model, parent: &str) -> ProjectModelCreateCall<'a, C, A> { + ProjectModelCreateCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets information about a model version. + /// + /// Models can have multiple versions. You can call + /// [projects.models.versions.list](/ml/reference/rest/v1beta1/projects.models.versions/list) + /// to get the same information that this method returns for all of the + /// versions of a model. + /// + /// # Arguments + /// + /// * `name` - Required. The name of the version. + /// Authorization: requires `Viewer` role on the parent project. + pub fn models_versions_get(&self, name: &str) -> ProjectModelVersionGetCall<'a, C, A> { + ProjectModelVersionGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists the jobs in the project. + /// + /// # Arguments + /// + /// * `parent` - Required. The name of the project for which to list jobs. + /// Authorization: requires `Viewer` role on the specified project. + pub fn jobs_list(&self, parent: &str) -> ProjectJobListCall<'a, C, A> { + ProjectJobListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _filter: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Cancels a running job. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - Required. The name of the job to cancel. + /// Authorization: requires `Editor` role on the parent project. + pub fn jobs_cancel(&self, request: GoogleCloudMlV1beta1__CancelJobRequest, name: &str) -> ProjectJobCancelCall<'a, C, A> { + ProjectJobCancelCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets information about a model, including its name, the description (if + /// set), and the default version (if at least one version of the model has + /// been deployed). + /// + /// # Arguments + /// + /// * `name` - Required. The name of the model. + /// Authorization: requires `Viewer` role on the parent project. + pub fn models_get(&self, name: &str) -> ProjectModelGetCall<'a, C, A> { + ProjectModelGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists the models in a project. + /// + /// Each project can contain multiple models, and each model can have multiple + /// versions. + /// + /// # Arguments + /// + /// * `parent` - Required. The name of the project whose models are to be listed. + /// Authorization: requires `Viewer` role on the specified project. + pub fn models_list(&self, parent: &str) -> ProjectModelListCall<'a, C, A> { + ProjectModelListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + + + +// ################### +// CallBuilders ### +// ################# + +/// Lists operations that match the specified filter in the request. If the +/// server doesn't support this method, it returns `UNIMPLEMENTED`. +/// +/// NOTE: the `name` binding below allows API services to override the binding +/// to use different resource name schemes, such as `users/*/operations`. +/// +/// A builder for the *operations.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_ml1_beta1 as ml1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use ml1_beta1::CloudMachineLearning; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = CloudMachineLearning::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().operations_list("name") +/// .page_token("sed") +/// .page_size(-85) +/// .filter("dolores") +/// .doit(); +/// # } +/// ``` +pub struct ProjectOperationListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudMachineLearning, + _name: String, + _page_token: Option, + _page_size: Option, + _filter: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectOperationListCall<'a, C, A> {} + +impl<'a, C, A> ProjectOperationListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleLongrunning__ListOperationsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "ml.projects.operations.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + params.push(("name", self._name.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://ml.googleapis.com/v1beta1/{+name}/operations".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the operation collection. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectOperationListCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The standard list page token. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectOperationListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The standard list page size. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectOperationListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The standard list filter. + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> ProjectOperationListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectOperationListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectOperationListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectOperationListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes a long-running operation. This method indicates that the client is +/// no longer interested in the operation result. It does not cancel the +/// operation. If the server doesn't support this method, it returns +/// `google.rpc.Code.UNIMPLEMENTED`. +/// +/// A builder for the *operations.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_ml1_beta1 as ml1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use ml1_beta1::CloudMachineLearning; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = CloudMachineLearning::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().operations_delete("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectOperationDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudMachineLearning, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectOperationDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectOperationDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleProtobuf__Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "ml.projects.operations.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://ml.googleapis.com/v1beta1/{+name}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the operation resource to be deleted. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectOperationDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectOperationDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectOperationDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectOperationDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Creates a new version of a model from a trained TensorFlow model. +/// +/// If the version created in the cloud by this call is the first deployed +/// version of the specified model, it will be made the default version of the +/// model. When you add a version to a model that already has one or more +/// versions, the default version does not automatically change. If you want a +/// new version to be the default, you must call +/// [projects.models.versions.setDefault](/ml/reference/rest/v1beta1/projects.models.versions/setDefault). +/// +/// A builder for the *models.versions.create* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_ml1_beta1 as ml1_beta1; +/// use ml1_beta1::GoogleCloudMlV1beta1__Version; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use ml1_beta1::CloudMachineLearning; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = CloudMachineLearning::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleCloudMlV1beta1__Version::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().models_versions_create(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct ProjectModelVersionCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudMachineLearning, + _request: GoogleCloudMlV1beta1__Version, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectModelVersionCreateCall<'a, C, A> {} + +impl<'a, C, A> ProjectModelVersionCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleLongrunning__Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "ml.projects.models.versions.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://ml.googleapis.com/v1beta1/{+parent}/versions".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GoogleCloudMlV1beta1__Version) -> ProjectModelVersionCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. The name of the model. + /// + /// Authorization: requires `Editor` role on the parent project. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectModelVersionCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectModelVersionCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectModelVersionCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectModelVersionCreateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets basic information about all the versions of a model. +/// +/// If you expect that a model has a lot of versions, or if you need to handle +/// only a limited number of results at a time, you can request that the list +/// be retrieved in batches (called pages): +/// +/// A builder for the *models.versions.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_ml1_beta1 as ml1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use ml1_beta1::CloudMachineLearning; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = CloudMachineLearning::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().models_versions_list("parent") +/// .page_token("justo") +/// .page_size(-1) +/// .doit(); +/// # } +/// ``` +pub struct ProjectModelVersionListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudMachineLearning, + _parent: String, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectModelVersionListCall<'a, C, A> {} + +impl<'a, C, A> ProjectModelVersionListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudMlV1beta1__ListVersionsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "ml.projects.models.versions.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://ml.googleapis.com/v1beta1/{+parent}/versions".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The name of the model for which to list the version. + /// + /// Authorization: requires `Viewer` role on the parent project. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectModelVersionListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Optional. A page token to request the next page of results. + /// + /// You get the token from the `next_page_token` field of the response from + /// the previous call. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectModelVersionListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Optional. The number of versions to retrieve per "page" of results. If + /// there are more remaining results than this number, the response message + /// will contain a valid value in the `next_page_token` field. + /// + /// The default value is 20, and the maximum page size is 100. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectModelVersionListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectModelVersionListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectModelVersionListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectModelVersionListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets the latest state of a long-running operation. Clients can use this +/// method to poll the operation result at intervals as recommended by the API +/// service. +/// +/// A builder for the *operations.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_ml1_beta1 as ml1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use ml1_beta1::CloudMachineLearning; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = CloudMachineLearning::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().operations_get("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectOperationGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudMachineLearning, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectOperationGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectOperationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleLongrunning__Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "ml.projects.operations.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://ml.googleapis.com/v1beta1/{+name}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the operation resource. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectOperationGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectOperationGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectOperationGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectOperationGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes a model version. +/// +/// Each model can have multiple versions deployed and in use at any given +/// time. Use this method to remove a single version. +/// +/// Note: You cannot delete the version that is set as the default version +/// of the model unless it is the only remaining version. +/// +/// A builder for the *models.versions.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_ml1_beta1 as ml1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use ml1_beta1::CloudMachineLearning; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = CloudMachineLearning::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().models_versions_delete("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectModelVersionDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudMachineLearning, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectModelVersionDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectModelVersionDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleLongrunning__Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "ml.projects.models.versions.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://ml.googleapis.com/v1beta1/{+name}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The name of the version. You can get the names of all the + /// versions of a model by calling + /// [projects.models.versions.list](/ml/reference/rest/v1beta1/projects.models.versions/list). + /// + /// Authorization: requires `Editor` role on the parent project. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectModelVersionDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectModelVersionDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectModelVersionDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectModelVersionDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Creates a training or a batch prediction job. +/// +/// A builder for the *jobs.create* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_ml1_beta1 as ml1_beta1; +/// use ml1_beta1::GoogleCloudMlV1beta1__Job; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use ml1_beta1::CloudMachineLearning; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = CloudMachineLearning::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleCloudMlV1beta1__Job::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().jobs_create(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct ProjectJobCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudMachineLearning, + _request: GoogleCloudMlV1beta1__Job, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectJobCreateCall<'a, C, A> {} + +impl<'a, C, A> ProjectJobCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudMlV1beta1__Job)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "ml.projects.jobs.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://ml.googleapis.com/v1beta1/{+parent}/jobs".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GoogleCloudMlV1beta1__Job) -> ProjectJobCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. The project name. + /// + /// Authorization: requires `Editor` role on the specified project. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectJobCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectJobCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectJobCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectJobCreateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Designates a version to be the default for the model. +/// +/// The default version is used for prediction requests made against the model +/// that don't specify a version. +/// +/// The first version to be created for a model is automatically set as the +/// default. You must make any subsequent changes to the default version +/// setting manually using this method. +/// +/// A builder for the *models.versions.setDefault* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_ml1_beta1 as ml1_beta1; +/// use ml1_beta1::GoogleCloudMlV1beta1__SetDefaultVersionRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use ml1_beta1::CloudMachineLearning; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = CloudMachineLearning::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleCloudMlV1beta1__SetDefaultVersionRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().models_versions_set_default(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectModelVersionSetDefaultCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudMachineLearning, + _request: GoogleCloudMlV1beta1__SetDefaultVersionRequest, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectModelVersionSetDefaultCall<'a, C, A> {} + +impl<'a, C, A> ProjectModelVersionSetDefaultCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudMlV1beta1__Version)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "ml.projects.models.versions.setDefault", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://ml.googleapis.com/v1beta1/{+name}:setDefault".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GoogleCloudMlV1beta1__SetDefaultVersionRequest) -> ProjectModelVersionSetDefaultCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. The name of the version to make the default for the model. You + /// can get the names of all the versions of a model by calling + /// [projects.models.versions.list](/ml/reference/rest/v1beta1/projects.models.versions/list). + /// + /// Authorization: requires `Editor` role on the parent project. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectModelVersionSetDefaultCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectModelVersionSetDefaultCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectModelVersionSetDefaultCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectModelVersionSetDefaultCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Performs prediction on the data in the request. +/// +/// Responses are very similar to requests. There are two top-level fields, +/// each of which are JSON lists: +/// +///
+///
predictions
+///
The list of predictions, one per instance in the request.
+///
error
+///
An error message returned instead of a prediction list if any +/// instance produced an error.
+///
+/// +/// If the call is successful, the response body will contain one prediction +/// entry per instance in the request body. If prediction fails for any +/// instance, the response body will contain no predictions and will contian +/// a single error entry instead. +/// +/// Even though there is one prediction per instance, the format of a +/// prediction is not directly related to the format of an instance. +/// Predictions take whatever format is specified in the outputs collection +/// defined in the model. The collection of predictions is returned in a JSON +/// list. Each member of the list can be a simple value, a list, or a JSON +/// object of any complexity. If your model has more than one output tensor, +/// each prediction will be a JSON object containing a name/value pair for each +/// output. The names identify the output aliases in the graph. +/// +/// The following examples show some possible responses: +/// +/// A simple set of predictions for three input instances, where each +/// prediction is an integer value: +///
+/// {"predictions": [5, 4, 3]}
+/// 
+/// A more complex set of predictions, each containing two named values that +/// correspond to output tensors, named **label** and **scores** respectively. +/// The value of **label** is the predicted category ("car" or "beach") and +/// **scores** contains a list of probabilities for that instance across the +/// possible categories. +///
+/// {"predictions": [{"label": "beach", "scores": [0.1, 0.9]},
+///                  {"label": "car", "scores": [0.75, 0.25]}]}
+/// 
+/// A response when there is an error processing an input instance: +///
+/// {"error": "Divide by zero"}
+/// 
+/// +/// A builder for the *predict* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_ml1_beta1 as ml1_beta1; +/// use ml1_beta1::GoogleCloudMlV1beta1__PredictRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use ml1_beta1::CloudMachineLearning; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = CloudMachineLearning::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleCloudMlV1beta1__PredictRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().predict(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectPredictCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudMachineLearning, + _request: GoogleCloudMlV1beta1__PredictRequest, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectPredictCall<'a, C, A> {} + +impl<'a, C, A> ProjectPredictCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleApi__HttpBody)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "ml.projects.predict", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://ml.googleapis.com/v1beta1/{+name}:predict".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GoogleCloudMlV1beta1__PredictRequest) -> ProjectPredictCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. The resource name of a model or a version. + /// + /// Authorization: requires `Viewer` role on the parent project. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectPredictCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectPredictCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectPredictCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectPredictCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes a model. +/// +/// You can only delete a model if there are no versions in it. You can delete +/// versions by calling +/// [projects.models.versions.delete](/ml/reference/rest/v1beta1/projects.models.versions/delete). +/// +/// A builder for the *models.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_ml1_beta1 as ml1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use ml1_beta1::CloudMachineLearning; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = CloudMachineLearning::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().models_delete("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectModelDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudMachineLearning, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectModelDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectModelDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleLongrunning__Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "ml.projects.models.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://ml.googleapis.com/v1beta1/{+name}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The name of the model. + /// + /// Authorization: requires `Editor` role on the parent project. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectModelDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectModelDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectModelDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectModelDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Get the service account information associated with your project. You need +/// this information in order to grant the service account persmissions for +/// the Google Cloud Storage location where you put your model training code +/// for training the model with Google Cloud Machine Learning. +/// +/// A builder for the *getConfig* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_ml1_beta1 as ml1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use ml1_beta1::CloudMachineLearning; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = CloudMachineLearning::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().get_config("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectGetConfigCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudMachineLearning, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectGetConfigCall<'a, C, A> {} + +impl<'a, C, A> ProjectGetConfigCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudMlV1beta1__GetConfigResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "ml.projects.getConfig", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://ml.googleapis.com/v1beta1/{+name}:getConfig".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The project name. + /// + /// Authorization: requires `Viewer` role on the specified project. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectGetConfigCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectGetConfigCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectGetConfigCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectGetConfigCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Describes a job. +/// +/// A builder for the *jobs.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_ml1_beta1 as ml1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use ml1_beta1::CloudMachineLearning; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = CloudMachineLearning::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().jobs_get("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectJobGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudMachineLearning, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectJobGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectJobGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudMlV1beta1__Job)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "ml.projects.jobs.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://ml.googleapis.com/v1beta1/{+name}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The name of the job to get the description of. + /// + /// Authorization: requires `Viewer` role on the parent project. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectJobGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectJobGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectJobGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectJobGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Starts asynchronous cancellation on a long-running operation. The server +/// makes a best effort to cancel the operation, but success is not +/// guaranteed. If the server doesn't support this method, it returns +/// `google.rpc.Code.UNIMPLEMENTED`. Clients can use +/// Operations.GetOperation or +/// other methods to check whether the cancellation succeeded or whether the +/// operation completed despite cancellation. On successful cancellation, +/// the operation is not deleted; instead, it becomes an operation with +/// an Operation.error value with a google.rpc.Status.code of 1, +/// corresponding to `Code.CANCELLED`. +/// +/// A builder for the *operations.cancel* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_ml1_beta1 as ml1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use ml1_beta1::CloudMachineLearning; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = CloudMachineLearning::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().operations_cancel("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectOperationCancelCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudMachineLearning, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectOperationCancelCall<'a, C, A> {} + +impl<'a, C, A> ProjectOperationCancelCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleProtobuf__Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "ml.projects.operations.cancel", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://ml.googleapis.com/v1beta1/{+name}:cancel".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the operation resource to be cancelled. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectOperationCancelCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectOperationCancelCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectOperationCancelCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectOperationCancelCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Creates a model which will later contain one or more versions. +/// +/// You must add at least one version before you can request predictions from +/// the model. Add versions by calling +/// [projects.models.versions.create](/ml/reference/rest/v1beta1/projects.models.versions/create). +/// +/// A builder for the *models.create* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_ml1_beta1 as ml1_beta1; +/// use ml1_beta1::GoogleCloudMlV1beta1__Model; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use ml1_beta1::CloudMachineLearning; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = CloudMachineLearning::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleCloudMlV1beta1__Model::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().models_create(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct ProjectModelCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudMachineLearning, + _request: GoogleCloudMlV1beta1__Model, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectModelCreateCall<'a, C, A> {} + +impl<'a, C, A> ProjectModelCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudMlV1beta1__Model)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "ml.projects.models.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://ml.googleapis.com/v1beta1/{+parent}/models".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GoogleCloudMlV1beta1__Model) -> ProjectModelCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. The project name. + /// + /// Authorization: requires `Editor` role on the specified project. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectModelCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectModelCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectModelCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectModelCreateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets information about a model version. +/// +/// Models can have multiple versions. You can call +/// [projects.models.versions.list](/ml/reference/rest/v1beta1/projects.models.versions/list) +/// to get the same information that this method returns for all of the +/// versions of a model. +/// +/// A builder for the *models.versions.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_ml1_beta1 as ml1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use ml1_beta1::CloudMachineLearning; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = CloudMachineLearning::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().models_versions_get("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectModelVersionGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudMachineLearning, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectModelVersionGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectModelVersionGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudMlV1beta1__Version)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "ml.projects.models.versions.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://ml.googleapis.com/v1beta1/{+name}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The name of the version. + /// + /// Authorization: requires `Viewer` role on the parent project. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectModelVersionGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectModelVersionGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectModelVersionGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectModelVersionGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Lists the jobs in the project. +/// +/// A builder for the *jobs.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_ml1_beta1 as ml1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use ml1_beta1::CloudMachineLearning; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = CloudMachineLearning::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().jobs_list("parent") +/// .page_token("et") +/// .page_size(-17) +/// .filter("diam") +/// .doit(); +/// # } +/// ``` +pub struct ProjectJobListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudMachineLearning, + _parent: String, + _page_token: Option, + _page_size: Option, + _filter: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectJobListCall<'a, C, A> {} + +impl<'a, C, A> ProjectJobListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudMlV1beta1__ListJobsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "ml.projects.jobs.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://ml.googleapis.com/v1beta1/{+parent}/jobs".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The name of the project for which to list jobs. + /// + /// Authorization: requires `Viewer` role on the specified project. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectJobListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Optional. A page token to request the next page of results. + /// + /// You get the token from the `next_page_token` field of the response from + /// the previous call. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectJobListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Optional. The number of jobs to retrieve per "page" of results. If there + /// are more remaining results than this number, the response message will + /// contain a valid value in the `next_page_token` field. + /// + /// The default value is 20, and the maximum page size is 100. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectJobListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// Optional. Specifies the subset of jobs to retrieve. + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> ProjectJobListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectJobListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectJobListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectJobListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Cancels a running job. +/// +/// A builder for the *jobs.cancel* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_ml1_beta1 as ml1_beta1; +/// use ml1_beta1::GoogleCloudMlV1beta1__CancelJobRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use ml1_beta1::CloudMachineLearning; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = CloudMachineLearning::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleCloudMlV1beta1__CancelJobRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().jobs_cancel(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectJobCancelCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudMachineLearning, + _request: GoogleCloudMlV1beta1__CancelJobRequest, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectJobCancelCall<'a, C, A> {} + +impl<'a, C, A> ProjectJobCancelCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleProtobuf__Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "ml.projects.jobs.cancel", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://ml.googleapis.com/v1beta1/{+name}:cancel".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GoogleCloudMlV1beta1__CancelJobRequest) -> ProjectJobCancelCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. The name of the job to cancel. + /// + /// Authorization: requires `Editor` role on the parent project. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectJobCancelCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectJobCancelCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectJobCancelCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectJobCancelCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets information about a model, including its name, the description (if +/// set), and the default version (if at least one version of the model has +/// been deployed). +/// +/// A builder for the *models.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_ml1_beta1 as ml1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use ml1_beta1::CloudMachineLearning; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = CloudMachineLearning::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().models_get("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectModelGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudMachineLearning, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectModelGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectModelGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudMlV1beta1__Model)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "ml.projects.models.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://ml.googleapis.com/v1beta1/{+name}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The name of the model. + /// + /// Authorization: requires `Viewer` role on the parent project. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectModelGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectModelGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectModelGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectModelGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Lists the models in a project. +/// +/// Each project can contain multiple models, and each model can have multiple +/// versions. +/// +/// A builder for the *models.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_ml1_beta1 as ml1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use ml1_beta1::CloudMachineLearning; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = CloudMachineLearning::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().models_list("parent") +/// .page_token("duo") +/// .page_size(-32) +/// .doit(); +/// # } +/// ``` +pub struct ProjectModelListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudMachineLearning, + _parent: String, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectModelListCall<'a, C, A> {} + +impl<'a, C, A> ProjectModelListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudMlV1beta1__ListModelsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "ml.projects.models.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://ml.googleapis.com/v1beta1/{+parent}/models".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The name of the project whose models are to be listed. + /// + /// Authorization: requires `Viewer` role on the specified project. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectModelListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Optional. A page token to request the next page of results. + /// + /// You get the token from the `next_page_token` field of the response from + /// the previous call. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectModelListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Optional. The number of models to retrieve per "page" of results. If there + /// are more remaining results than this number, the response message will + /// contain a valid value in the `next_page_token` field. + /// + /// The default value is 20, and the maximum page size is 100. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectModelListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectModelListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectModelListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectModelListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + diff --git a/gen/monitoring3-cli/Cargo.toml b/gen/monitoring3-cli/Cargo.toml index 4ef93ccc29..c8da2040f8 100644 --- a/gen/monitoring3-cli/Cargo.toml +++ b/gen/monitoring3-cli/Cargo.toml @@ -4,9 +4,9 @@ [package] name = "google-monitoring3-cli" -version = "1.0.0+20160425" +version = "1.0.0+20161212" authors = ["Sebastian Thiel "] -description = "A complete library to interact with monitoring (protocol v3)" +description = "A complete library to interact with Monitoring (protocol v3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/monitoring3-cli" homepage = "https://cloud.google.com/monitoring/api/" documentation = "http://byron.github.io/google-apis-rs/google_monitoring3_cli" diff --git a/gen/monitoring3-cli/README.md b/gen/monitoring3-cli/README.md index 141e7ea79f..53672a3e14 100644 --- a/gen/monitoring3-cli/README.md +++ b/gen/monitoring3-cli/README.md @@ -3,14 +3,14 @@ DO NOT EDIT ! This file was generated automatically from 'src/mako/cli/README.md.mako' DO NOT EDIT ! --> -The `monitoring3` command-line interface *(CLI)* allows to use most features of the *Google monitoring* service from the comfort of your terminal. +The `monitoring3` command-line interface *(CLI)* allows to use most features of the *Google Monitoring* service from the comfort of your terminal. By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero. If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. -Everything else about the *monitoring* API can be found at the +Everything else about the *Monitoring* API can be found at the [official documentation site](https://cloud.google.com/monitoring/api/). # Downloads @@ -24,7 +24,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *monitoring* API at revision *20160425*. The CLI is at version *1.0.0*. +This documentation was generated from the *Monitoring* API at revision *20161212*. The CLI is at version *1.0.0*. ```bash monitoring3 [options] diff --git a/gen/monitoring3-cli/mkdocs.yml b/gen/monitoring3-cli/mkdocs.yml index 991ecfcfac..05fb1b345e 100644 --- a/gen/monitoring3-cli/mkdocs.yml +++ b/gen/monitoring3-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: monitoring v1.0.0+20160425 +site_name: Monitoring v1.0.0+20161212 site_url: http://byron.github.io/google-apis-rs/google-monitoring3-cli site_description: Write integrating applications with bcore diff --git a/gen/monitoring3-cli/src/main.rs b/gen/monitoring3-cli/src/main.rs index a3468fb353..21d56dac18 100644 --- a/gen/monitoring3-cli/src/main.rs +++ b/gen/monitoring3-cli/src/main.rs @@ -582,12 +582,12 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "metric-kind" => Some(("metricKind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "value-type" => Some(("valueType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "unit" => Some(("unit", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["description", "display-name", "metric-kind", "name", "type", "unit", "value-type"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -1245,12 +1245,12 @@ fn main() { let arg_data = [ ("projects", "methods: 'collectd-time-series-create', 'groups-create', 'groups-delete', 'groups-get', 'groups-list', 'groups-members-list', 'groups-update', 'metric-descriptors-create', 'metric-descriptors-delete', 'metric-descriptors-get', 'metric-descriptors-list', 'monitored-resource-descriptors-get', 'monitored-resource-descriptors-list', 'time-series-create' and 'time-series-list'", vec![ ("collectd-time-series-create", - Some(r##"Creates a new time series with the given data points. This method is only for use in `collectd`-related code, including the Google Monitoring Agent. See [google.monitoring.v3.MetricService.CreateTimeSeries] instead."##), + Some(r##"Stackdriver Monitoring Agent only: Creates a new time series."##), "Details at http://byron.github.io/google-apis-rs/google_monitoring3_cli/projects_collectd-time-series-create", vec![ (Some(r##"name"##), None, - Some(r##"The project in which to create the time series. The format is `"projects/PROJECT_ID_OR_NUMBER"`."##), + Some(r##"The project in which to create the time series. The format is "projects/PROJECT_ID_OR_NUMBER"."##), Some(true), Some(false)), @@ -1278,7 +1278,7 @@ fn main() { vec![ (Some(r##"name"##), None, - Some(r##"The project in which to create the group. The format is `"projects/{project_id_or_number}"`."##), + Some(r##"The project in which to create the group. The format is "projects/{project_id_or_number}"."##), Some(true), Some(false)), @@ -1306,7 +1306,7 @@ fn main() { vec![ (Some(r##"name"##), None, - Some(r##"The group to delete. The format is `"projects/{project_id_or_number}/groups/{group_id}"`."##), + Some(r##"The group to delete. The format is "projects/{project_id_or_number}/groups/{group_id}"."##), Some(true), Some(false)), @@ -1328,7 +1328,7 @@ fn main() { vec![ (Some(r##"name"##), None, - Some(r##"The group to retrieve. The format is `"projects/{project_id_or_number}/groups/{group_id}"`."##), + Some(r##"The group to retrieve. The format is "projects/{project_id_or_number}/groups/{group_id}"."##), Some(true), Some(false)), @@ -1350,7 +1350,7 @@ fn main() { vec![ (Some(r##"name"##), None, - Some(r##"The project whose groups are to be listed. The format is `"projects/{project_id_or_number}"`."##), + Some(r##"The project whose groups are to be listed. The format is "projects/{project_id_or_number}"."##), Some(true), Some(false)), @@ -1372,7 +1372,7 @@ fn main() { vec![ (Some(r##"name"##), None, - Some(r##"The group whose members are listed. The format is `"projects/{project_id_or_number}/groups/{group_id}"`."##), + Some(r##"The group whose members are listed. The format is "projects/{project_id_or_number}/groups/{group_id}"."##), Some(true), Some(false)), @@ -1389,12 +1389,12 @@ fn main() { Some(false)), ]), ("groups-update", - Some(r##"Updates an existing group. You can change any group attributes except `name`."##), + Some(r##"Updates an existing group. You can change any group attributes except name."##), "Details at http://byron.github.io/google-apis-rs/google_monitoring3_cli/projects_groups-update", vec![ (Some(r##"name"##), None, - Some(r##"The name of this group. The format is `"projects/{project_id_or_number}/groups/{group_id}"`. When creating a group, this field is ignored and a new name is created consisting of the project specified in the call to `CreateGroup` and a unique `{group_id}` that is generated automatically. @OutputOnly"##), + Some(r##"Output only. The name of this group. The format is "projects/{project_id_or_number}/groups/{group_id}". When creating a group, this field is ignored and a new name is created consisting of the project specified in the call to CreateGroup and a unique {group_id} that is generated automatically."##), Some(true), Some(false)), @@ -1417,12 +1417,12 @@ fn main() { Some(false)), ]), ("metric-descriptors-create", - Some(r##"Creates a new metric descriptor. User-created metric descriptors define [custom metrics](/monitoring/custom-metrics)."##), + Some(r##"Creates a new metric descriptor. User-created metric descriptors define custom metrics."##), "Details at http://byron.github.io/google-apis-rs/google_monitoring3_cli/projects_metric-descriptors-create", vec![ (Some(r##"name"##), None, - Some(r##"The project on which to execute the request. The format is `"projects/{project_id_or_number}"`."##), + Some(r##"The project on which to execute the request. The format is "projects/{project_id_or_number}"."##), Some(true), Some(false)), @@ -1445,12 +1445,12 @@ fn main() { Some(false)), ]), ("metric-descriptors-delete", - Some(r##"Deletes a metric descriptor. Only user-created [custom metrics](/monitoring/custom-metrics) can be deleted."##), + Some(r##"Deletes a metric descriptor. Only user-created custom metrics can be deleted."##), "Details at http://byron.github.io/google-apis-rs/google_monitoring3_cli/projects_metric-descriptors-delete", vec![ (Some(r##"name"##), None, - Some(r##"The metric descriptor on which to execute the request. The format is `"projects/{project_id_or_number}/metricDescriptors/{metric_id}"`. An example of `{metric_id}` is: `"custom.googleapis.com/my_test_metric"`."##), + Some(r##"The metric descriptor on which to execute the request. The format is "projects/{project_id_or_number}/metricDescriptors/{metric_id}". An example of {metric_id} is: "custom.googleapis.com/my_test_metric"."##), Some(true), Some(false)), @@ -1472,7 +1472,7 @@ fn main() { vec![ (Some(r##"name"##), None, - Some(r##"The metric descriptor on which to execute the request. The format is `"projects/{project_id_or_number}/metricDescriptors/{metric_id}"`. An example value of `{metric_id}` is `"compute.googleapis.com/instance/disk/read_bytes_count"`."##), + Some(r##"The metric descriptor on which to execute the request. The format is "projects/{project_id_or_number}/metricDescriptors/{metric_id}". An example value of {metric_id} is "compute.googleapis.com/instance/disk/read_bytes_count"."##), Some(true), Some(false)), @@ -1494,7 +1494,7 @@ fn main() { vec![ (Some(r##"name"##), None, - Some(r##"The project on which to execute the request. The format is `"projects/{project_id_or_number}"`."##), + Some(r##"The project on which to execute the request. The format is "projects/{project_id_or_number}"."##), Some(true), Some(false)), @@ -1516,7 +1516,7 @@ fn main() { vec![ (Some(r##"name"##), None, - Some(r##"The monitored resource descriptor to get. The format is `"projects/{project_id_or_number}/monitoredResourceDescriptors/{resource_type}"`. The `{resource_type}` is a predefined type, such as `cloudsql_database`."##), + Some(r##"The monitored resource descriptor to get. The format is "projects/{project_id_or_number}/monitoredResourceDescriptors/{resource_type}". The {resource_type} is a predefined type, such as cloudsql_database."##), Some(true), Some(false)), @@ -1538,7 +1538,7 @@ fn main() { vec![ (Some(r##"name"##), None, - Some(r##"The project on which to execute the request. The format is `"projects/{project_id_or_number}"`."##), + Some(r##"The project on which to execute the request. The format is "projects/{project_id_or_number}"."##), Some(true), Some(false)), @@ -1560,7 +1560,7 @@ fn main() { vec![ (Some(r##"name"##), None, - Some(r##"The project on which to execute the request. The format is `"projects/{project_id_or_number}"`."##), + Some(r##"The project on which to execute the request. The format is "projects/{project_id_or_number}"."##), Some(true), Some(false)), @@ -1610,8 +1610,8 @@ fn main() { let mut app = App::new("monitoring3") .author("Sebastian Thiel ") - .version("1.0.0+20160425") - .about("Manages your Stackdriver monitoring data and configurations. Projects must be associated with a Stackdriver account, except for the following methods: [monitoredResourceDescriptors.list](v3/projects.monitoredResourceDescriptors/list), [monitoredResourceDescriptors.get](v3/projects.monitoredResourceDescriptors/get), [metricDescriptors.list](v3/projects.metricDescriptors/list), [metricDescriptors.get](v3/projects.metricDescriptors/get), and [timeSeries.list](v3/projects.timeSeries/list).") + .version("1.0.0+20161212") + .about("Manages your Stackdriver Monitoring data and configurations. Most projects must be associated with a Stackdriver account, with a few exceptions as noted on the individual method pages.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_monitoring3_cli") .arg(Arg::with_name("url") .long("scope") diff --git a/gen/monitoring3/Cargo.toml b/gen/monitoring3/Cargo.toml index 146d46f835..01114d5374 100644 --- a/gen/monitoring3/Cargo.toml +++ b/gen/monitoring3/Cargo.toml @@ -4,9 +4,9 @@ [package] name = "google-monitoring3" -version = "1.0.0+20160425" +version = "1.0.0+20161212" authors = ["Sebastian Thiel "] -description = "A complete library to interact with monitoring (protocol v3)" +description = "A complete library to interact with Monitoring (protocol v3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/monitoring3" homepage = "https://cloud.google.com/monitoring/api/" documentation = "http://byron.github.io/google-apis-rs/google_monitoring3" diff --git a/gen/monitoring3/README.md b/gen/monitoring3/README.md index 30f55ff487..591ce33719 100644 --- a/gen/monitoring3/README.md +++ b/gen/monitoring3/README.md @@ -3,11 +3,11 @@ DO NOT EDIT ! This file was generated automatically from 'src/mako/api/README.md.mako' DO NOT EDIT ! --> -The `google-monitoring3` library allows access to all features of the *Google monitoring* service. +The `google-monitoring3` library allows access to all features of the *Google Monitoring* service. -This documentation was generated from *monitoring* crate version *1.0.0+20160425*, where *20160425* is the exact revision of the *monitoring:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *Monitoring* crate version *1.0.0+20161212*, where *20161212* is the exact revision of the *monitoring:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. -Everything else about the *monitoring* *v3* API can be found at the +Everything else about the *Monitoring* *v3* API can be found at the [official documentation site](https://cloud.google.com/monitoring/api/). # Features diff --git a/gen/monitoring3/src/lib.rs b/gen/monitoring3/src/lib.rs index 30719456e9..db33bddd28 100644 --- a/gen/monitoring3/src/lib.rs +++ b/gen/monitoring3/src/lib.rs @@ -2,9 +2,9 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *monitoring* crate version *1.0.0+20160425*, where *20160425* is the exact revision of the *monitoring:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *Monitoring* crate version *1.0.0+20161212*, where *20161212* is the exact revision of the *monitoring:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! -//! Everything else about the *monitoring* *v3* API can be found at the +//! Everything else about the *Monitoring* *v3* API can be found at the //! [official documentation site](https://cloud.google.com/monitoring/api/). //! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/monitoring3). //! # Features diff --git a/gen/monitoring3/src/lib.rs.in b/gen/monitoring3/src/lib.rs.in index 077def7fa5..9bd479f9c9 100644 --- a/gen/monitoring3/src/lib.rs.in +++ b/gen/monitoring3/src/lib.rs.in @@ -172,16 +172,16 @@ impl<'a, C, A> Monitoring // ############ // SCHEMAS ### // ########## -/// A time interval extending from after `startTime` through `endTime`. If `startTime` is omitted, the interval is the single point in time, `endTime`. +/// A time interval extending just after a start time through an end time. If the start time is the same as the end time, then the interval represents a single point in time. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TimeInterval { - /// Required. The end of the interval. The interval includes this time. + /// Required. The end of the time interval. #[serde(rename="endTime")] pub end_time: Option, - /// If this value is omitted, the interval is a point in time, `endTime`. If `startTime` is present, it must be earlier than (less than) `endTime`. The interval begins after `startTime`—it does not include `startTime`. + /// Optional. The beginning of the time interval. The default value for the start time is the end time. The start time must not be later than the end time. #[serde(rename="startTime")] pub start_time: Option, } @@ -189,7 +189,7 @@ pub struct TimeInterval { impl Part for TimeInterval {} -/// The `ListMetricDescriptors` response. +/// The ListMetricDescriptors response. /// /// # Activities /// @@ -200,10 +200,10 @@ impl Part for TimeInterval {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListMetricDescriptorsResponse { - /// If there are more results than have been returned, then this field is set to a non-empty value. To see the additional results, use that value as `pageToken` in the next call to this method. + /// If there are more results than have been returned, then this field is set to a non-empty value. To see the additional results, use that value as pageToken in the next call to this method. #[serde(rename="nextPageToken")] pub next_page_token: Option, - /// The metric descriptors that are available to the project and that match the value of `filter`, if present. + /// The metric descriptors that are available to the project and that match the value of filter, if present. #[serde(rename="metricDescriptors")] pub metric_descriptors: Option>, } @@ -211,7 +211,7 @@ pub struct ListMetricDescriptorsResponse { impl ResponseResult for ListMetricDescriptorsResponse {} -/// The `ListGroupMembers` response. +/// The ListGroupMembers response. /// /// # Activities /// @@ -222,7 +222,7 @@ impl ResponseResult for ListMetricDescriptorsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListGroupMembersResponse { - /// If there are more results than have been returned, then this field is set to a non-empty value. To see the additional results, use that value as `pageToken` in the next call to this method. + /// If there are more results than have been returned, then this field is set to a non-empty value. To see the additional results, use that value as pageToken in the next call to this method. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// The total number of elements matching this request. @@ -235,7 +235,7 @@ pub struct ListGroupMembersResponse { impl ResponseResult for ListGroupMembersResponse {} -/// The description of a dynamic collection of monitored resources. Each group has a filter that is matched against monitored resources and their associated metadata. If a group's filter matches an available monitored resource, then that resource is a member of that group. Groups can contain any number of monitored resources, and each monitored resource can be a member of any number of groups. Groups can be nested in parent-child hierarchies. The `parentName` field identifies an optional parent for each group. If a group has a parent, then the only monitored resources available to be matched by the group's filter are the resources contained in the parent group. In other words, a group contains the monitored resources that match its filter and the filters of all the group's ancestors. A group without a parent can contain any monitored resource. For example, consider an infrastructure running a set of instances with two user-defined tags: `"environment"` and `"role"`. A parent group has a filter, `environment="production"`. A child of that parent group has a filter, `role="transcoder"`. The parent group contains all instances in the production environment, regardless of their roles. The child group contains instances that have the transcoder role *and* are in the production environment. The monitored resources contained in a group can change at any moment, depending on what resources exist and what filters are associated with the group and its ancestors. +/// The description of a dynamic collection of monitored resources. Each group has a filter that is matched against monitored resources and their associated metadata. If a group's filter matches an available monitored resource, then that resource is a member of that group. Groups can contain any number of monitored resources, and each monitored resource can be a member of any number of groups.Groups can be nested in parent-child hierarchies. The parentName field identifies an optional parent for each group. If a group has a parent, then the only monitored resources available to be matched by the group's filter are the resources contained in the parent group. In other words, a group contains the monitored resources that match its filter and the filters of all the group's ancestors. A group without a parent can contain any monitored resource.For example, consider an infrastructure running a set of instances with two user-defined tags: "environment" and "role". A parent group has a filter, environment="production". A child of that parent group has a filter, role="transcoder". The parent group contains all instances in the production environment, regardless of their roles. The child group contains instances that have the transcoder role and are in the production environment.The monitored resources contained in a group can change at any moment, depending on what resources exist and what filters are associated with the group and its ancestors. /// /// # Activities /// @@ -250,13 +250,13 @@ impl ResponseResult for ListGroupMembersResponse {} pub struct Group { /// The filter used to determine which monitored resources belong to this group. pub filter: Option, - /// The name of the group's parent, if it has one. The format is `"projects/{project_id_or_number}/groups/{group_id}"`. For groups with no parent, `parentName` is the empty string, `""`. + /// The name of the group's parent, if it has one. The format is "projects/{project_id_or_number}/groups/{group_id}". For groups with no parent, parentName is the empty string, "". #[serde(rename="parentName")] pub parent_name: Option, /// A user-assigned name for this group, used only for display purposes. #[serde(rename="displayName")] pub display_name: Option, - /// The name of this group. The format is `"projects/{project_id_or_number}/groups/{group_id}"`. When creating a group, this field is ignored and a new name is created consisting of the project specified in the call to `CreateGroup` and a unique `{group_id}` that is generated automatically. @OutputOnly + /// Output only. The name of this group. The format is "projects/{project_id_or_number}/groups/{group_id}". When creating a group, this field is ignored and a new name is created consisting of the project specified in the call to CreateGroup and a unique {group_id} that is generated automatically. pub name: Option, /// If true, the members of this group are considered to be a cluster. The system can perform additional analysis on groups that are clusters. #[serde(rename="isCluster")] @@ -279,13 +279,13 @@ pub struct TypedValue { /// A variable-length string value. #[serde(rename="stringValue")] pub string_value: Option, - /// A Boolean value: `true` or `false`. + /// A Boolean value: true or false. #[serde(rename="boolValue")] pub bool_value: Option, - /// A 64-bit integer. Its range is approximately ±9.2x1018. + /// A 64-bit integer. Its range is approximately ±9.2x1018. #[serde(rename="int64Value")] pub int64_value: Option, - /// A 64-bit double-precision floating-point number. Its magnitude is approximately ±10±300 and it has 16 significant digits of precision. + /// A 64-bit double-precision floating-point number. Its magnitude is approximately ±10±300 and it has 16 significant digits of precision. #[serde(rename="doubleValue")] pub double_value: Option, } @@ -293,18 +293,18 @@ pub struct TypedValue { impl Part for TypedValue {} -/// Specify a sequence of buckets that have a width that is proportional to the value of the lower bound. Each bucket represents a constant relative uncertainty on a specific value in the bucket. Defines `num_finite_buckets + 2` (= N) buckets with these boundaries for bucket i: Upper bound (0 <= i < N-1): scale * (growth_factor ^ i). Lower bound (1 <= i < N): scale * (growth_factor ^ (i - 1)). +/// Specify a sequence of buckets that have a width that is proportional to the value of the lower bound. Each bucket represents a constant relative uncertainty on a specific value in the bucket.Defines num_finite_buckets + 2 (= N) buckets with these boundaries for bucket i:Upper bound (0 <= i < N-1): scale * (growth_factor ^ i). Lower bound (1 <= i < N): scale * (growth_factor ^ (i - 1)). /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Exponential { - /// Must be greater than 0 + /// Must be greater than 0. pub scale: Option, - /// Must be greater than 1 + /// Must be greater than 1. #[serde(rename="growthFactor")] pub growth_factor: Option, - /// must be greater than 0 + /// Must be greater than 0. #[serde(rename="numFiniteBuckets")] pub num_finite_buckets: Option, } @@ -312,18 +312,18 @@ pub struct Exponential { impl Part for Exponential {} -/// A collection of data points sent from a `collectd`-based plugin. See the `collectd` documentation for more information. +/// A collection of data points sent from a collectd-based plugin. See the collectd documentation for more information. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct CollectdPayload { - /// The name of the plugin. Example: `"disk"`. + /// The name of the plugin. Example: "disk". pub plugin: Option, - /// The measurement type instance. Example: `"used"`. + /// The measurement type instance. Example: "used". #[serde(rename="typeInstance")] pub type_instance: Option, - /// The measured values during this time interval. Each value must have a different `dataSourceName`. + /// The measured values during this time interval. Each value must have a different dataSourceName. pub values: Option>, /// The start time of the interval. #[serde(rename="startTime")] @@ -331,20 +331,20 @@ pub struct CollectdPayload { /// The end time of the interval. #[serde(rename="endTime")] pub end_time: Option, - /// The measurement type. Example: `"memory"`. + /// The measurement type. Example: "memory". #[serde(rename="type")] pub type_: Option, - /// The instance name of the plugin Example: `"hdcl"`. + /// The instance name of the plugin Example: "hdcl". #[serde(rename="pluginInstance")] pub plugin_instance: Option, - /// The measurement metadata. Example: `"process_id" -> 12345` + /// The measurement metadata. Example: "process_id" -> 12345 pub metadata: Option>, } impl Part for CollectdPayload {} -/// A set of buckets with arbitrary widths. Defines `size(bounds) + 1` (= N) buckets with these boundaries for bucket i: Upper bound (0 <= i < N-1): bounds[i] Lower bound (1 <= i < N); bounds[i - 1] There must be at least one element in `bounds`. If `bounds` has only one element, there are no finite buckets, and that single element is the common boundary of the overflow and underflow buckets. +/// A set of buckets with arbitrary widths.Defines size(bounds) + 1 (= N) buckets with these boundaries for bucket i:Upper bound (0 <= i < N-1): boundsi Lower bound (1 <= i < N); boundsi - 1There must be at least one element in bounds. If bounds has only one element, there are no finite buckets, and that single element is the common boundary of the overflow and underflow buckets. /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -357,15 +357,19 @@ pub struct Explicit { impl Part for Explicit {} -/// An object representing a resource that can be used for monitoring, logging, billing, or other purposes. Examples include virtual machine instances, databases, and storage devices such as disks. The `type` field identifies a MonitoredResourceDescriptor object that describes the resource's schema. Information in the `labels` field identifies the actual resource and its attributes according to the schema. For example, a particular Compute Engine VM instance could be represented by the following object, because the MonitoredResourceDescriptor for `"gce_instance"` has labels `"instance_id"` and `"zone"`: { "type": "gce_instance", "labels": { "instance_id": "my-instance", "zone": "us-central1-a" }} +/// An object representing a resource that can be used for monitoring, logging, billing, or other purposes. Examples include virtual machine instances, databases, and storage devices such as disks. The type field identifies a MonitoredResourceDescriptor object that describes the resource's schema. Information in the labels field identifies the actual resource and its attributes according to the schema. For example, a particular Compute Engine VM instance could be represented by the following object, because the MonitoredResourceDescriptor for "gce_instance" has labels "instance_id" and "zone": +/// { "type": "gce_instance", +/// "labels": { "instance_id": "12345678901234", +/// "zone": "us-central1-a" }} +/// /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct MonitoredResource { - /// Required. Values for all of the labels listed in the associated monitored resource descriptor. For example, Cloud SQL databases use the labels `"database_id"` and `"zone"`. + /// Required. Values for all of the labels listed in the associated monitored resource descriptor. For example, Cloud SQL databases use the labels "database_id" and "zone". pub labels: Option>, - /// Required. The monitored resource type. This field must match the `type` field of a MonitoredResourceDescriptor object. For example, the type of a Cloud SQL database is `"cloudsql_database"`. + /// Required. The monitored resource type. This field must match the type field of a MonitoredResourceDescriptor object. For example, the type of a Cloud SQL database is "cloudsql_database". #[serde(rename="type")] pub type_: Option, } @@ -388,7 +392,7 @@ pub struct Range { impl Part for Range {} -/// A single data point from a `collectd`-based plugin. +/// A single data point from a collectd-based plugin. /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -397,7 +401,7 @@ pub struct CollectdValue { /// The type of measurement. #[serde(rename="dataSourceType")] pub data_source_type: Option, - /// The data source for the `collectd` value. For example there are two data sources for network measurements: `"rx"` and `"tx"`. + /// The data source for the collectd value. For example there are two data sources for network measurements: "rx" and "tx". #[serde(rename="dataSourceName")] pub data_source_name: Option, /// The measurement value. @@ -407,22 +411,22 @@ pub struct CollectdValue { impl Part for CollectdValue {} -/// A collection of data points that describes the time-varying nature of a metric. A time series is identified by a combination of a fully-specified monitored resource and a fully-specified metric. +/// A collection of data points that describes the time-varying values of a metric. A time series is identified by a combination of a fully-specified monitored resource and a fully-specified metric. This type is used for both listing and creating time series. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TimeSeries { - /// The metric kind of the time series. This can be different than the metric kind specified in [google.api.MetricDescriptor] because of alignment and reduction operations on the data. This field is ignored when writing data; the value specified in the descriptor is used instead. @OutputOnly + /// The metric kind of the time series. When listing time series, this metric kind might be different from the metric kind of the associated metric if this time series is an alignment or reduction of other time series.When creating a time series, this field is optional. If present, it must be the same as the metric kind of the associated metric. If the associated metric's descriptor must be auto-created, then this field specifies the metric kind of the new descriptor and must be either GAUGE (the default) or CUMULATIVE. #[serde(rename="metricKind")] pub metric_kind: Option, - /// The fully-specified metric used to identify the time series. + /// The associated metric. A fully-specified metric used to identify the time series. pub metric: Option, - /// The data points of this time series. When used as output, points will be sorted by decreasing time order. When used as input, points could be written in any orders. + /// The data points of this time series. When listing time series, the order of the points is specified by the list method.When creating a time series, this field must contain exactly one point and the point's type must be the same as the value type of the associated metric. If the associated metric's descriptor must be auto-created, then the value type of the descriptor is determined by the point's type, which must be BOOL, INT64, DOUBLE, or DISTRIBUTION. pub points: Option>, - /// The fully-specified monitored resource used to identify the time series. + /// The associated resource. A fully-specified monitored resource used to identify the time series. pub resource: Option, - /// The value type of the time series. This can be different than the value type specified in [google.api.MetricDescriptor] because of alignment and reduction operations on the data. This field is ignored when writing data; the value specified in the descriptor is used instead. @OutputOnly + /// The value type of the time series. When listing time series, this value type might be different from the value type of the associated metric if this time series is an alignment or reduction of other time series.When creating a time series, this field is optional. If present, it must be the same as the type of the data in the points field. #[serde(rename="valueType")] pub value_type: Option, } @@ -430,7 +434,7 @@ pub struct TimeSeries { impl Part for TimeSeries {} -/// Distribution contains summary statistics for a population of values and, optionally, a histogram representing the distribution of those values across a specified set of histogram buckets. The summary statistics are the count, mean, sum of the squared deviation from the mean, the minimum, and the maximum of the set of population of values. The histogram is based on a sequence of buckets and gives a count of values that fall into each bucket. The boundaries of the buckets are given either explicitly or by specifying parameters for a method of computing them (buckets of fixed width or buckets of exponentially increasing width). Although it is not forbidden, it is generally a bad idea to include non-finite values (infinities or NaNs) in the population of values, as this will render the `mean` and `sum_of_squared_deviation` fields meaningless. +/// Distribution contains summary statistics for a population of values and, optionally, a histogram representing the distribution of those values across a specified set of histogram buckets.The summary statistics are the count, mean, sum of the squared deviation from the mean, the minimum, and the maximum of the set of population of values.The histogram is based on a sequence of buckets and gives a count of values that fall into each bucket. The boundaries of the buckets are given either explicitly or by specifying parameters for a method of computing them (buckets of fixed width or buckets of exponentially increasing width).Although it is not forbidden, it is generally a bad idea to include non-finite values (infinities or NaNs) in the population of values, as this will render the mean and sum_of_squared_deviation fields meaningless. /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -438,25 +442,31 @@ impl Part for TimeSeries {} pub struct Distribution { /// The number of values in the population. Must be non-negative. pub count: Option, - /// If `bucket_options` is given, then the sum of the values in `bucket_counts` must equal the value in `count`. If `bucket_options` is not given, no `bucket_counts` fields may be given. Bucket counts are given in order under the numbering scheme described above (the underflow bucket has number 0; the finite buckets, if any, have numbers 1 through N-2; the overflow bucket has number N-1). The size of `bucket_counts` must be no greater than N as defined in `bucket_options`. Any suffix of trailing zero bucket_count fields may be omitted. + /// If bucket_options is given, then the sum of the values in bucket_counts must equal the value in count. If bucket_options is not given, no bucket_counts fields may be given.Bucket counts are given in order under the numbering scheme described above (the underflow bucket has number 0; the finite buckets, if any, have numbers 1 through N-2; the overflow bucket has number N-1).The size of bucket_counts must be no greater than N as defined in bucket_options.Any suffix of trailing zero bucket_count fields may be omitted. #[serde(rename="bucketCounts")] pub bucket_counts: Option>, - /// The sum of squared deviations from the mean of the values in the population. For values x_i this is: Sum[i=1..n]((x_i - mean)^2) Knuth, "The Art of Computer Programming", Vol. 2, page 323, 3rd edition describes Welford's method for accumulating this sum in one pass. If `count` is zero then this field must be zero. + /// The sum of squared deviations from the mean of the values in the population. For values x_i this is: + /// Sum[i=1..n]((x_i - mean)^2) + /// Knuth, "The Art of Computer Programming", Vol. 2, page 323, 3rd edition describes Welford's method for accumulating this sum in one pass.If count is zero then this field must be zero. #[serde(rename="sumOfSquaredDeviation")] pub sum_of_squared_deviation: Option, - /// If specified, contains the range of the population values. The field must not be present if the `count` is zero. + /// If specified, contains the range of the population values. The field must not be present if the count is zero. This field is presently ignored by the Stackdriver Monitoring API v3. pub range: Option, /// Defines the histogram bucket boundaries. #[serde(rename="bucketOptions")] pub bucket_options: Option, - /// The arithmetic mean of the values in the population. If `count` is zero then this field must be zero. + /// The arithmetic mean of the values in the population. If count is zero then this field must be zero. pub mean: Option, } impl Part for Distribution {} -/// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON representation for `Empty` is empty JSON object `{}`. +/// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: +/// service Foo { +/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); +/// } +/// The JSON representation for Empty is empty JSON object {}. /// /// # Activities /// @@ -474,7 +484,7 @@ pub struct Empty { _never_set: Option } impl ResponseResult for Empty {} -/// The `ListTimeSeries` response. +/// The ListTimeSeries response. /// /// # Activities /// @@ -485,7 +495,7 @@ impl ResponseResult for Empty {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListTimeSeriesResponse { - /// If there are more results than have been returned, then this field is set to a non-empty value. To see the additional results, use that value as `pageToken` in the next call to this method. + /// If there are more results than have been returned, then this field is set to a non-empty value. To see the additional results, use that value as pageToken in the next call to this method. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// One or more time series that match the filter included in the request. @@ -496,7 +506,7 @@ pub struct ListTimeSeriesResponse { impl ResponseResult for ListTimeSeriesResponse {} -/// Specify a sequence of buckets that all have the same width (except overflow and underflow). Each bucket represents a constant absolute uncertainty on the specific value in the bucket. Defines `num_finite_buckets + 2` (= N) buckets with these boundaries for bucket `i`: Upper bound (0 <= i < N-1): offset + (width * i). Lower bound (1 <= i < N): offset + (width * (i - 1)). +/// Specify a sequence of buckets that all have the same width (except overflow and underflow). Each bucket represents a constant absolute uncertainty on the specific value in the bucket.Defines num_finite_buckets + 2 (= N) buckets with these boundaries for bucket i:Upper bound (0 <= i < N-1): offset + (width * i). Lower bound (1 <= i < N): offset + (width * (i - 1)). /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -514,7 +524,7 @@ pub struct Linear { impl Part for Linear {} -/// Defines a metric type and its schema. +/// Defines a metric type and its schema. Once a metric descriptor is created, deleting or altering it stops data collection and makes the metric type's existing data unusable. /// /// # Activities /// @@ -529,38 +539,82 @@ pub struct MetricDescriptor { /// A concise name for the metric, which can be displayed in user interfaces. Use sentence case without an ending period, for example "Request count". #[serde(rename="displayName")] pub display_name: Option, - /// Resource name. The format of the name may vary between different implementations. For examples: projects/{project_id}/metricDescriptors/{type=**} metricDescriptors/{type=**} - pub name: Option, - /// Whether the metric records instantaneous values, changes to a value, etc. - #[serde(rename="metricKind")] - pub metric_kind: Option, - /// Whether the measurement is an integer, a floating-point number, etc. - #[serde(rename="valueType")] - pub value_type: Option, - /// The set of labels that can be used to describe a specific instance of this metric type. For example, the `compute.googleapis.com/instance/network/received_bytes_count` metric type has a label, `loadbalanced`, that specifies whether the traffic was received through a load balanced IP address. - pub labels: Option>, - /// The metric type including a DNS name prefix, for example `"compute.googleapis.com/instance/cpu/utilization"`. Metric types should use a natural hierarchical grouping such as the following: compute.googleapis.com/instance/cpu/utilization compute.googleapis.com/instance/disk/read_ops_count compute.googleapis.com/instance/network/received_bytes_count Note that if the metric type changes, the monitoring data will be discontinued, and anything depends on it will break, such as monitoring dashboards, alerting rules and quota limits. Therefore, once a metric has been published, its type should be immutable. - #[serde(rename="type")] - pub type_: Option, - /// The unit in which the metric value is reported. It is only applicable if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The supported units are a subset of [The Unified Code for Units of Measure](http://unitsofmeasure.org/ucum.html) standard: **Basic units (UNIT)** * `bit` bit * `By` byte * `s` second * `min` minute * `h` hour * `d` day **Prefixes (PREFIX)** * `k` kilo (10**3) * `M` mega (10**6) * `G` giga (10**9) * `T` tera (10**12) * `P` peta (10**15) * `E` exa (10**18) * `Z` zetta (10**21) * `Y` yotta (10**24) * `m` milli (10**-3) * `u` micro (10**-6) * `n` nano (10**-9) * `p` pico (10**-12) * `f` femto (10**-15) * `a` atto (10**-18) * `z` zepto (10**-21) * `y` yocto (10**-24) * `Ki` kibi (2**10) * `Mi` mebi (2**20) * `Gi` gibi (2**30) * `Ti` tebi (2**40) **Grammar** The grammar includes the dimensionless unit `1`, such as `1/s`. The grammar also includes these connectors: * `/` division (as an infix operator, e.g. `1/s`). * `.` multiplication (as an infix operator, e.g. `GBy.d`) The grammar for a unit is as follows: Expression = Component { "." Component } { "/" Component } ; Component = [ PREFIX ] UNIT [ Annotation ] | Annotation | "1" ; Annotation = "{" NAME "}" ; Notes: * `Annotation` is just a comment if it follows a `UNIT` and is equivalent to `1` if it is used alone. For examples, `{requests}/s == 1/s`, `By{transmitted}/s == By/s`. * `NAME` is a sequence of non-blank printable ASCII characters not containing '{' or '}'. - pub unit: Option, /// A detailed description of the metric, which can be used in documentation. pub description: Option, + /// Whether the metric records instantaneous values, changes to a value, etc. Some combinations of metric_kind and value_type might not be supported. + #[serde(rename="metricKind")] + pub metric_kind: Option, + /// Whether the measurement is an integer, a floating-point number, etc. Some combinations of metric_kind and value_type might not be supported. + #[serde(rename="valueType")] + pub value_type: Option, + /// The set of labels that can be used to describe a specific instance of this metric type. For example, the appengine.googleapis.com/http/server/response_latencies metric type has a label for the HTTP response code, response_code, so you can look at latencies for successful responses or just for responses that failed. + pub labels: Option>, + /// The metric type, including its DNS name prefix. The type is not URL-encoded. All user-defined metric types have the DNS name custom.googleapis.com. Metric types should use a natural hierarchical grouping. For example: + /// "custom.googleapis.com/invoice/paid/amount" + /// "appengine.googleapis.com/http/server/response_latencies" + /// + #[serde(rename="type")] + pub type_: Option, + /// The unit in which the metric value is reported. It is only applicable if the value_type is INT64, DOUBLE, or DISTRIBUTION. The supported units are a subset of The Unified Code for Units of Measure (http://unitsofmeasure.org/ucum.html) standard:Basic units (UNIT) + /// bit bit + /// By byte + /// s second + /// min minute + /// h hour + /// d dayPrefixes (PREFIX) + /// k kilo (10**3) + /// M mega (10**6) + /// G giga (10**9) + /// T tera (10**12) + /// P peta (10**15) + /// E exa (10**18) + /// Z zetta (10**21) + /// Y yotta (10**24) + /// m milli (10**-3) + /// u micro (10**-6) + /// n nano (10**-9) + /// p pico (10**-12) + /// f femto (10**-15) + /// a atto (10**-18) + /// z zepto (10**-21) + /// y yocto (10**-24) + /// Ki kibi (2**10) + /// Mi mebi (2**20) + /// Gi gibi (2**30) + /// Ti tebi (2**40)GrammarThe grammar includes the dimensionless unit 1, such as 1/s.The grammar also includes these connectors: + /// / division (as an infix operator, e.g. 1/s). + /// . multiplication (as an infix operator, e.g. GBy.d)The grammar for a unit is as follows: + /// Expression = Component { "." Component } { "/" Component } ; + /// + /// Component = [ PREFIX ] UNIT [ Annotation ] + /// | Annotation + /// | "1" + /// ; + /// + /// Annotation = "{" NAME "}" ; + /// Notes: + /// Annotation is just a comment if it follows a UNIT and is equivalent to 1 if it is used alone. For examples, {requests}/s == 1/s, By{transmitted}/s == By/s. + /// NAME is a sequence of non-blank printable ASCII characters not containing '{' or '}'. + pub unit: Option, + /// The resource name of the metric descriptor. Depending on the implementation, the name typically includes: (1) the parent resource name that defines the scope of the metric type or of its data; and (2) the metric's URL-encoded type, which also appears in the type field of this descriptor. For example, following is the resource name of a custom metric within the GCP project 123456789: + /// "projects/123456789/metricDescriptors/custom.googleapis.com%2Finvoice%2Fpaid%2Famount" + /// + pub name: Option, } impl RequestValue for MetricDescriptor {} impl ResponseResult for MetricDescriptor {} -/// A specific metric identified by specifying values for all of the labels of a `MetricDescriptor`. +/// A specific metric, identified by specifying values for all of the labels of a MetricDescriptor. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Metric { - /// The set of labels that uniquely identify a metric. To specify a metric, all labels enumerated in the `MetricDescriptor` must be assigned values. + /// The set of label values that uniquely identify this metric. All labels listed in the MetricDescriptor must be assigned values. pub labels: Option>, - /// An existing metric type, see google.api.MetricDescriptor. For example, `compute.googleapis.com/instance/cpu/usage_time`. + /// An existing metric type, see google.api.MetricDescriptor. For example, custom.googleapis.com/invoice/paid/amount. #[serde(rename="type")] pub type_: Option, } @@ -574,7 +628,7 @@ impl Part for Metric {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Point { - /// The time interval to which the value applies. + /// The time interval to which the data point applies. For GAUGE metrics, only the end time of the interval is used. For DELTA metrics, the start and end time should specify a non-zero interval, with subsequent points specifying contiguous and non-overlapping intervals. For CUMULATIVE metrics, the start and end time should specify a non-zero interval, with subsequent points specifying the same start time and increasing end times, until an event resets the cumulative value to zero and sets a new start time for the following points. pub interval: Option, /// The value of the data point. pub value: Option, @@ -583,7 +637,7 @@ pub struct Point { impl Part for Point {} -/// A Distribution may optionally contain a histogram of the values in the population. The histogram is given in `bucket_counts` as counts of values that fall into one of a sequence of non-overlapping buckets. The sequence of buckets is described by `bucket_options`. A bucket specifies an inclusive lower bound and exclusive upper bound for the values that are counted for that bucket. The upper bound of a bucket is strictly greater than the lower bound. The sequence of N buckets for a Distribution consists of an underflow bucket (number 0), zero or more finite buckets (number 1 through N - 2) and an overflow bucket (number N - 1). The buckets are contiguous: the lower bound of bucket i (i > 0) is the same as the upper bound of bucket i - 1. The buckets span the whole range of finite values: lower bound of the underflow bucket is -infinity and the upper bound of the overflow bucket is +infinity. The finite buckets are so-called because both bounds are finite. `BucketOptions` describes bucket boundaries in one of three ways. Two describe the boundaries by giving parameters for a formula to generate boundaries and one gives the bucket boundaries explicitly. If `bucket_boundaries` is not given, then no `bucket_counts` may be given. +/// A Distribution may optionally contain a histogram of the values in the population. The histogram is given in bucket_counts as counts of values that fall into one of a sequence of non-overlapping buckets. The sequence of buckets is described by bucket_options.A bucket specifies an inclusive lower bound and exclusive upper bound for the values that are counted for that bucket. The upper bound of a bucket is strictly greater than the lower bound.The sequence of N buckets for a Distribution consists of an underflow bucket (number 0), zero or more finite buckets (number 1 through N - 2) and an overflow bucket (number N - 1). The buckets are contiguous: the lower bound of bucket i (i > 0) is the same as the upper bound of bucket i - 1. The buckets span the whole range of finite values: lower bound of the underflow bucket is -infinity and the upper bound of the overflow bucket is +infinity. The finite buckets are so-called because both bounds are finite.BucketOptions describes bucket boundaries in one of three ways. Two describe the boundaries by giving parameters for a formula to generate boundaries and one gives the bucket boundaries explicitly.If bucket_options is not given, then no bucket_counts may be given. /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -603,7 +657,7 @@ pub struct BucketOptions { impl Part for BucketOptions {} -/// The `ListGroups` response. +/// The ListGroups response. /// /// # Activities /// @@ -614,7 +668,7 @@ impl Part for BucketOptions {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListGroupsResponse { - /// If there are more results than have been returned, then this field is set to a non-empty value. To see the additional results, use that value as `pageToken` in the next call to this method. + /// If there are more results than have been returned, then this field is set to a non-empty value. To see the additional results, use that value as pageToken in the next call to this method. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// The groups that match the specified filters. @@ -624,7 +678,7 @@ pub struct ListGroupsResponse { impl ResponseResult for ListGroupsResponse {} -/// The `ListMonitoredResourcDescriptors` response. +/// The ListMonitoredResourcDescriptors response. /// /// # Activities /// @@ -635,10 +689,10 @@ impl ResponseResult for ListGroupsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListMonitoredResourceDescriptorsResponse { - /// If there are more results than have been returned, then this field is set to a non-empty value. To see the additional results, use that value as `pageToken` in the next call to this method. + /// If there are more results than have been returned, then this field is set to a non-empty value. To see the additional results, use that value as pageToken in the next call to this method. #[serde(rename="nextPageToken")] pub next_page_token: Option, - /// The monitored resource descriptors that are available to this project and that match `filter`, if present. + /// The monitored resource descriptors that are available to this project and that match filter, if present. #[serde(rename="resourceDescriptors")] pub resource_descriptors: Option>, } @@ -664,7 +718,7 @@ pub struct LabelDescriptor { impl Part for LabelDescriptor {} -/// The `CreateCollectdTimeSeries` request. +/// The CreateCollectdTimeSeries request. /// /// # Activities /// @@ -675,12 +729,12 @@ impl Part for LabelDescriptor {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct CreateCollectdTimeSeriesRequest { - /// The `collectd` payloads representing the time series data. You must not include more than a single point for each time series, so no two payloads can have the same values for all of the fields `plugin`, `plugin_instance`, `type`, and `type_instance`. + /// The collectd payloads representing the time series data. You must not include more than a single point for each time series, so no two payloads can have the same values for all of the fields plugin, plugin_instance, type, and type_instance. #[serde(rename="collectdPayloads")] pub collectd_payloads: Option>, /// The monitored resource associated with the time series. pub resource: Option, - /// The version of `collectd` that collected the data. Example: `"5.3.0-192.el6"`. + /// The version of collectd that collected the data. Example: "5.3.0-192.el6". #[serde(rename="collectdVersion")] pub collectd_version: Option, } @@ -688,7 +742,7 @@ pub struct CreateCollectdTimeSeriesRequest { impl RequestValue for CreateCollectdTimeSeriesRequest {} -/// The `CreateTimeSeries` request. +/// The CreateTimeSeries request. /// /// # Activities /// @@ -699,7 +753,7 @@ impl RequestValue for CreateCollectdTimeSeriesRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct CreateTimeSeriesRequest { - /// The new data to be added to a list of time series. Adds at most one data point to each of several time series. The new data point must be more recent than any other point in its time series. Each `TimeSeries` value must fully specify a unique time series by supplying all label values for the metric and the monitored resource. + /// The new data to be added to a list of time series. Adds at most one data point to each of several time series. The new data point must be more recent than any other point in its time series. Each TimeSeries value must fully specify a unique time series by supplying all label values for the metric and the monitored resource. #[serde(rename="timeSeries")] pub time_series: Option>, } @@ -707,7 +761,7 @@ pub struct CreateTimeSeriesRequest { impl RequestValue for CreateTimeSeriesRequest {} -/// An object that describes the schema of a MonitoredResource object using a type name and a set of labels. For example, the monitored resource descriptor for Google Compute Engine VM instances has a type of `"gce_instance"` and specifies the use of the labels `"instance_id"` and `"zone"` to identify particular VM instances. Different APIs can support different monitored resource types. APIs generally provide a `list` method that returns the monitored resource descriptors used by the API. +/// An object that describes the schema of a MonitoredResource object using a type name and a set of labels. For example, the monitored resource descriptor for Google Compute Engine VM instances has a type of "gce_instance" and specifies the use of the labels "instance_id" and "zone" to identify particular VM instances.Different APIs can support different monitored resource types. APIs generally provide a list method that returns the monitored resource descriptors used by the API. /// /// # Activities /// @@ -718,18 +772,18 @@ impl RequestValue for CreateTimeSeriesRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct MonitoredResourceDescriptor { - /// Required. The monitored resource type. For example, the type `"cloudsql_database"` represents databases in Google Cloud SQL. - #[serde(rename="type")] - pub type_: Option, - /// Required. A set of labels used to describe instances of this monitored resource type. For example, an individual Google Cloud SQL database is identified by values for the labels `"database_id"` and `"zone"`. - pub labels: Option>, - /// Optional. A concise name for the monitored resource type that might be displayed in user interfaces. For example, `"Google Cloud SQL Database"`. + /// Optional. A concise name for the monitored resource type that might be displayed in user interfaces. It should be a Title Cased Noun Phrase, without any article or other determiners. For example, "Google Cloud SQL Database". #[serde(rename="displayName")] pub display_name: Option, - /// Optional. The resource name of the monitored resource descriptor: `"projects/{project_id}/monitoredResourceDescriptors/{type}"` where {type} is the value of the `type` field in this object and {project_id} is a project ID that provides API-specific context for accessing the type. APIs that do not use project information can use the resource name format `"monitoredResourceDescriptors/{type}"`. - pub name: Option, + /// Required. A set of labels used to describe instances of this monitored resource type. For example, an individual Google Cloud SQL database is identified by values for the labels "database_id" and "zone". + pub labels: Option>, + /// Required. The monitored resource type. For example, the type "cloudsql_database" represents databases in Google Cloud SQL. The maximum length of this value is 256 characters. + #[serde(rename="type")] + pub type_: Option, /// Optional. A detailed description of the monitored resource type that might be used in documentation. pub description: Option, + /// Optional. The resource name of the monitored resource descriptor: "projects/{project_id}/monitoredResourceDescriptors/{type}" where {type} is the value of the type field in this object and {project_id} is a project ID that provides API-specific context for accessing the type. APIs that do not use project information can use the resource name format "monitoredResourceDescriptors/{type}". + pub name: Option, } impl ResponseResult for MonitoredResourceDescriptor {} @@ -784,7 +838,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// /// # Arguments /// - /// * `name` - The metric descriptor on which to execute the request. The format is `"projects/{project_id_or_number}/metricDescriptors/{metric_id}"`. An example value of `{metric_id}` is `"compute.googleapis.com/instance/disk/read_bytes_count"`. + /// * `name` - The metric descriptor on which to execute the request. The format is "projects/{project_id_or_number}/metricDescriptors/{metric_id}". An example value of {metric_id} is "compute.googleapis.com/instance/disk/read_bytes_count". pub fn metric_descriptors_get(&self, name: &str) -> ProjectMetricDescriptorGetCall<'a, C, A> { ProjectMetricDescriptorGetCall { hub: self.hub, @@ -802,7 +856,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `name` - The project in which to create the group. The format is `"projects/{project_id_or_number}"`. + /// * `name` - The project in which to create the group. The format is "projects/{project_id_or_number}". pub fn groups_create(&self, request: Group, name: &str) -> ProjectGroupCreateCall<'a, C, A> { ProjectGroupCreateCall { hub: self.hub, @@ -821,7 +875,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// /// # Arguments /// - /// * `name` - The group to retrieve. The format is `"projects/{project_id_or_number}/groups/{group_id}"`. + /// * `name` - The group to retrieve. The format is "projects/{project_id_or_number}/groups/{group_id}". pub fn groups_get(&self, name: &str) -> ProjectGroupGetCall<'a, C, A> { ProjectGroupGetCall { hub: self.hub, @@ -834,11 +888,11 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Deletes a metric descriptor. Only user-created [custom metrics](/monitoring/custom-metrics) can be deleted. + /// Deletes a metric descriptor. Only user-created custom metrics can be deleted. /// /// # Arguments /// - /// * `name` - The metric descriptor on which to execute the request. The format is `"projects/{project_id_or_number}/metricDescriptors/{metric_id}"`. An example of `{metric_id}` is: `"custom.googleapis.com/my_test_metric"`. + /// * `name` - The metric descriptor on which to execute the request. The format is "projects/{project_id_or_number}/metricDescriptors/{metric_id}". An example of {metric_id} is: "custom.googleapis.com/my_test_metric". pub fn metric_descriptors_delete(&self, name: &str) -> ProjectMetricDescriptorDeleteCall<'a, C, A> { ProjectMetricDescriptorDeleteCall { hub: self.hub, @@ -851,12 +905,12 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Creates a new time series with the given data points. This method is only for use in `collectd`-related code, including the Google Monitoring Agent. See [google.monitoring.v3.MetricService.CreateTimeSeries] instead. + /// Stackdriver Monitoring Agent only: Creates a new time series. /// /// # Arguments /// /// * `request` - No description provided. - /// * `name` - The project in which to create the time series. The format is `"projects/PROJECT_ID_OR_NUMBER"`. + /// * `name` - The project in which to create the time series. The format is "projects/PROJECT_ID_OR_NUMBER". pub fn collectd_time_series_create(&self, request: CreateCollectdTimeSeriesRequest, name: &str) -> ProjectCollectdTimeSeryCreateCall<'a, C, A> { ProjectCollectdTimeSeryCreateCall { hub: self.hub, @@ -874,7 +928,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// /// # Arguments /// - /// * `name` - The group whose members are listed. The format is `"projects/{project_id_or_number}/groups/{group_id}"`. + /// * `name` - The group whose members are listed. The format is "projects/{project_id_or_number}/groups/{group_id}". pub fn groups_members_list(&self, name: &str) -> ProjectGroupMemberListCall<'a, C, A> { ProjectGroupMemberListCall { hub: self.hub, @@ -896,7 +950,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// /// # Arguments /// - /// * `name` - The project on which to execute the request. The format is `"projects/{project_id_or_number}"`. + /// * `name` - The project on which to execute the request. The format is "projects/{project_id_or_number}". pub fn monitored_resource_descriptors_list(&self, name: &str) -> ProjectMonitoredResourceDescriptorListCall<'a, C, A> { ProjectMonitoredResourceDescriptorListCall { hub: self.hub, @@ -917,7 +971,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `name` - The project on which to execute the request. The format is `"projects/{project_id_or_number}"`. + /// * `name` - The project on which to execute the request. The format is "projects/{project_id_or_number}". pub fn time_series_create(&self, request: CreateTimeSeriesRequest, name: &str) -> ProjectTimeSeryCreateCall<'a, C, A> { ProjectTimeSeryCreateCall { hub: self.hub, @@ -931,12 +985,12 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Creates a new metric descriptor. User-created metric descriptors define [custom metrics](/monitoring/custom-metrics). + /// Creates a new metric descriptor. User-created metric descriptors define custom metrics. /// /// # Arguments /// /// * `request` - No description provided. - /// * `name` - The project on which to execute the request. The format is `"projects/{project_id_or_number}"`. + /// * `name` - The project on which to execute the request. The format is "projects/{project_id_or_number}". pub fn metric_descriptors_create(&self, request: MetricDescriptor, name: &str) -> ProjectMetricDescriptorCreateCall<'a, C, A> { ProjectMetricDescriptorCreateCall { hub: self.hub, @@ -954,7 +1008,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// /// # Arguments /// - /// * `name` - The project whose groups are to be listed. The format is `"projects/{project_id_or_number}"`. + /// * `name` - The project whose groups are to be listed. The format is "projects/{project_id_or_number}". pub fn groups_list(&self, name: &str) -> ProjectGroupListCall<'a, C, A> { ProjectGroupListCall { hub: self.hub, @@ -976,7 +1030,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// /// # Arguments /// - /// * `name` - The project on which to execute the request. The format is `"projects/{project_id_or_number}"`. + /// * `name` - The project on which to execute the request. The format is "projects/{project_id_or_number}". pub fn metric_descriptors_list(&self, name: &str) -> ProjectMetricDescriptorListCall<'a, C, A> { ProjectMetricDescriptorListCall { hub: self.hub, @@ -996,7 +1050,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// /// # Arguments /// - /// * `name` - The monitored resource descriptor to get. The format is `"projects/{project_id_or_number}/monitoredResourceDescriptors/{resource_type}"`. The `{resource_type}` is a predefined type, such as `cloudsql_database`. + /// * `name` - The monitored resource descriptor to get. The format is "projects/{project_id_or_number}/monitoredResourceDescriptors/{resource_type}". The {resource_type} is a predefined type, such as cloudsql_database. pub fn monitored_resource_descriptors_get(&self, name: &str) -> ProjectMonitoredResourceDescriptorGetCall<'a, C, A> { ProjectMonitoredResourceDescriptorGetCall { hub: self.hub, @@ -1009,12 +1063,12 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates an existing group. You can change any group attributes except `name`. + /// Updates an existing group. You can change any group attributes except name. /// /// # Arguments /// /// * `request` - No description provided. - /// * `name` - The name of this group. The format is `"projects/{project_id_or_number}/groups/{group_id}"`. When creating a group, this field is ignored and a new name is created consisting of the project specified in the call to `CreateGroup` and a unique `{group_id}` that is generated automatically. @OutputOnly + /// * `name` - Output only. The name of this group. The format is "projects/{project_id_or_number}/groups/{group_id}". When creating a group, this field is ignored and a new name is created consisting of the project specified in the call to CreateGroup and a unique {group_id} that is generated automatically. pub fn groups_update(&self, request: Group, name: &str) -> ProjectGroupUpdateCall<'a, C, A> { ProjectGroupUpdateCall { hub: self.hub, @@ -1033,7 +1087,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// /// # Arguments /// - /// * `name` - The group to delete. The format is `"projects/{project_id_or_number}/groups/{group_id}"`. + /// * `name` - The group to delete. The format is "projects/{project_id_or_number}/groups/{group_id}". pub fn groups_delete(&self, name: &str) -> ProjectGroupDeleteCall<'a, C, A> { ProjectGroupDeleteCall { hub: self.hub, @@ -1258,7 +1312,7 @@ impl<'a, C, A> ProjectMetricDescriptorGetCall<'a, C, A> where C: BorrowMut ProjectGroupCreateCall<'a, C, A> where C: BorrowMut ProjectGroupGetCall<'a, C, A> where C: BorrowMut, } - /// The group to retrieve. The format is `"projects/{project_id_or_number}/groups/{group_id}"`. + /// The group to retrieve. The format is "projects/{project_id_or_number}/groups/{group_id}". /// /// Sets the *name* path property to the given value. /// @@ -1859,7 +1913,7 @@ impl<'a, C, A> ProjectGroupGetCall<'a, C, A> where C: BorrowMut, } -/// Deletes a metric descriptor. Only user-created [custom metrics](/monitoring/custom-metrics) can be deleted. +/// Deletes a metric descriptor. Only user-created custom metrics can be deleted. /// /// A builder for the *metricDescriptors.delete* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -2036,7 +2090,7 @@ impl<'a, C, A> ProjectMetricDescriptorDeleteCall<'a, C, A> where C: BorrowMut ProjectMetricDescriptorDeleteCall<'a, C, A> where C: BorrowMutThis method is only for use by the Stackdriver Monitoring Agent. Use projects.timeSeries.create instead. /// /// A builder for the *collectdTimeSeries.create* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -2312,7 +2366,7 @@ impl<'a, C, A> ProjectCollectdTimeSeryCreateCall<'a, C, A> where C: BorrowMut ProjectGroupMemberListCall<'a, C, A> where C: BorrowMut ProjectGroupMemberListCall<'a, C, A> where C: BorrowMut ProjectGroupMemberListCall<'a, C, A> { @@ -2606,21 +2660,23 @@ impl<'a, C, A> ProjectGroupMemberListCall<'a, C, A> where C: BorrowMut ProjectGroupMemberListCall<'a, C, A> { self._interval_start_time = Some(new_value.to_string()); self } - /// Required. The end of the interval. The interval includes this time. + /// Required. The end of the time interval. /// /// Sets the *interval.end time* query property to the given value. pub fn interval_end_time(mut self, new_value: &str) -> ProjectGroupMemberListCall<'a, C, A> { self._interval_end_time = Some(new_value.to_string()); self } - /// An optional [list filter](/monitoring/api/learn_more#filtering) describing the members to be returned. The filter may reference the type, labels, and metadata of monitored resources that comprise the group. For example, to return only resources representing Compute Engine VM instances, use this filter: resource.type = "gce_instance" + /// An optional list filter describing the members to be returned. The filter may reference the type, labels, and metadata of monitored resources that comprise the group. For example, to return only resources representing Compute Engine VM instances, use this filter: + /// resource.type = "gce_instance" + /// /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> ProjectGroupMemberListCall<'a, C, A> { @@ -2877,7 +2933,7 @@ impl<'a, C, A> ProjectMonitoredResourceDescriptorListCall<'a, C, A> where C: Bor } - /// The project on which to execute the request. The format is `"projects/{project_id_or_number}"`. + /// The project on which to execute the request. The format is "projects/{project_id_or_number}". /// /// Sets the *name* path property to the given value. /// @@ -2887,7 +2943,7 @@ impl<'a, C, A> ProjectMonitoredResourceDescriptorListCall<'a, C, A> where C: Bor self._name = new_value.to_string(); self } - /// If this field is not empty then it must contain the `nextPageToken` value returned by a previous call to this method. Using this field causes the method to return additional results from the previous method call. + /// If this field is not empty then it must contain the nextPageToken value returned by a previous call to this method. Using this field causes the method to return additional results from the previous method call. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> ProjectMonitoredResourceDescriptorListCall<'a, C, A> { @@ -2901,7 +2957,9 @@ impl<'a, C, A> ProjectMonitoredResourceDescriptorListCall<'a, C, A> where C: Bor self._page_size = Some(new_value); self } - /// An optional [filter](/monitoring/api/v3/filters) describing the descriptors to be returned. The filter can reference the descriptor's type and labels. For example, the following filter returns only Google Compute Engine descriptors that have an `id` label: resource.type = starts_with("gce_") AND resource.label:id + /// An optional filter describing the descriptors to be returned. The filter can reference the descriptor's type and labels. For example, the following filter returns only Google Compute Engine descriptors that have an id label: + /// resource.type = starts_with("gce_") AND resource.label:id + /// /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> ProjectMonitoredResourceDescriptorListCall<'a, C, A> { @@ -3174,7 +3232,7 @@ impl<'a, C, A> ProjectTimeSeryCreateCall<'a, C, A> where C: BorrowMut ProjectTimeSeryCreateCall<'a, C, A> where C: BorrowMut ProjectMetricDescriptorCreateCall<'a, C, A> where C: BorrowMut ProjectGroupListCall<'a, C, A> where C: BorrowMut, } - /// The project whose groups are to be listed. The format is `"projects/{project_id_or_number}"`. + /// The project whose groups are to be listed. The format is "projects/{project_id_or_number}". /// /// Sets the *name* path property to the given value. /// @@ -3730,7 +3788,7 @@ impl<'a, C, A> ProjectGroupListCall<'a, C, A> where C: BorrowMut, self._name = new_value.to_string(); self } - /// If this field is not empty then it must contain the `nextPageToken` value returned by a previous call to this method. Using this field causes the method to return additional results from the previous method call. + /// If this field is not empty then it must contain the nextPageToken value returned by a previous call to this method. Using this field causes the method to return additional results from the previous method call. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> ProjectGroupListCall<'a, C, A> { @@ -3744,21 +3802,21 @@ impl<'a, C, A> ProjectGroupListCall<'a, C, A> where C: BorrowMut, self._page_size = Some(new_value); self } - /// A group name: `"projects/{project_id_or_number}/groups/{group_id}"`. Returns the descendants of the specified group. This is a superset of the results returned by the `childrenOfGroup` filter, and includes children-of-children, and so forth. + /// A group name: "projects/{project_id_or_number}/groups/{group_id}". Returns the descendants of the specified group. This is a superset of the results returned by the childrenOfGroup filter, and includes children-of-children, and so forth. /// /// Sets the *descendants of group* query property to the given value. pub fn descendants_of_group(mut self, new_value: &str) -> ProjectGroupListCall<'a, C, A> { self._descendants_of_group = Some(new_value.to_string()); self } - /// A group name: `"projects/{project_id_or_number}/groups/{group_id}"`. Returns groups whose `parentName` field contains the group name. If no groups have this parent, the results are empty. + /// A group name: "projects/{project_id_or_number}/groups/{group_id}". Returns groups whose parentName field contains the group name. If no groups have this parent, the results are empty. /// /// Sets the *children of group* query property to the given value. pub fn children_of_group(mut self, new_value: &str) -> ProjectGroupListCall<'a, C, A> { self._children_of_group = Some(new_value.to_string()); self } - /// A group name: `"projects/{project_id_or_number}/groups/{group_id}"`. Returns groups that are ancestors of the specified group. The groups are returned in order, starting with the immediate parent and ending with the most distant ancestor. If the specified group has no immediate parent, the results are empty. + /// A group name: "projects/{project_id_or_number}/groups/{group_id}". Returns groups that are ancestors of the specified group. The groups are returned in order, starting with the immediate parent and ending with the most distant ancestor. If the specified group has no immediate parent, the results are empty. /// /// Sets the *ancestors of group* query property to the given value. pub fn ancestors_of_group(mut self, new_value: &str) -> ProjectGroupListCall<'a, C, A> { @@ -4015,7 +4073,7 @@ impl<'a, C, A> ProjectMetricDescriptorListCall<'a, C, A> where C: BorrowMut ProjectMetricDescriptorListCall<'a, C, A> where C: BorrowMut ProjectMetricDescriptorListCall<'a, C, A> { @@ -4039,7 +4097,9 @@ impl<'a, C, A> ProjectMetricDescriptorListCall<'a, C, A> where C: BorrowMut ProjectMetricDescriptorListCall<'a, C, A> { @@ -4281,7 +4341,7 @@ impl<'a, C, A> ProjectMonitoredResourceDescriptorGetCall<'a, C, A> where C: Borr } - /// The monitored resource descriptor to get. The format is `"projects/{project_id_or_number}/monitoredResourceDescriptors/{resource_type}"`. The `{resource_type}` is a predefined type, such as `cloudsql_database`. + /// The monitored resource descriptor to get. The format is "projects/{project_id_or_number}/monitoredResourceDescriptors/{resource_type}". The {resource_type} is a predefined type, such as cloudsql_database. /// /// Sets the *name* path property to the given value. /// @@ -4349,7 +4409,7 @@ impl<'a, C, A> ProjectMonitoredResourceDescriptorGetCall<'a, C, A> where C: Borr } -/// Updates an existing group. You can change any group attributes except `name`. +/// Updates an existing group. You can change any group attributes except name. /// /// A builder for the *groups.update* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -4562,7 +4622,7 @@ impl<'a, C, A> ProjectGroupUpdateCall<'a, C, A> where C: BorrowMut ProjectGroupDeleteCall<'a, C, A> where C: BorrowMut ProjectTimeSeryListCall<'a, C, A> where C: BorrowMut ProjectTimeSeryListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// A positive number that is the maximum number of results to return. When `view` field sets to `FULL`, it limits the number of `Points` server will return; if `view` field is `HEADERS`, it limits the number of `TimeSeries` server will return. + /// A positive number that is the maximum number of results to return. When view field sets to FULL, it limits the number of Points server will return; if view field is HEADERS, it limits the number of TimeSeries server will return. /// /// Sets the *page size* query property to the given value. pub fn page_size(mut self, new_value: i32) -> ProjectTimeSeryListCall<'a, C, A> { @@ -5154,35 +5214,38 @@ impl<'a, C, A> ProjectTimeSeryListCall<'a, C, A> where C: BorrowMut ProjectTimeSeryListCall<'a, C, A> { self._interval_start_time = Some(new_value.to_string()); self } - /// Required. The end of the interval. The interval includes this time. + /// Required. The end of the time interval. /// /// Sets the *interval.end time* query property to the given value. pub fn interval_end_time(mut self, new_value: &str) -> ProjectTimeSeryListCall<'a, C, A> { self._interval_end_time = Some(new_value.to_string()); self } - /// A [monitoring filter](/monitoring/api/v3/filters) that specifies which time series should be returned. The filter must specify a single metric type, and can additionally specify metric labels and other information. For example: metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND metric.label.instance_name = "my-instance-name" + /// A monitoring filter that specifies which time series should be returned. The filter must specify a single metric type, and can additionally specify metric labels and other information. For example: + /// metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND + /// metric.label.instance_name = "my-instance-name" + /// /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> ProjectTimeSeryListCall<'a, C, A> { self._filter = Some(new_value.to_string()); self } - /// The approach to be used to align individual time series. Not all alignment functions may be applied to all time series, depending on the metric type and value type of the original time series. Alignment may change the metric type or the value type of the time series. Time series data must be aligned in order to perform cross-time series reduction. If `crossSeriesReducer` is specified, then `perSeriesAligner` must be specified and not equal `ALIGN_NONE` and `alignmentPeriod` must be specified; otherwise, an error is returned. + /// The approach to be used to align individual time series. Not all alignment functions may be applied to all time series, depending on the metric type and value type of the original time series. Alignment may change the metric type or the value type of the time series.Time series data must be aligned in order to perform cross-time series reduction. If crossSeriesReducer is specified, then perSeriesAligner must be specified and not equal ALIGN_NONE and alignmentPeriod must be specified; otherwise, an error is returned. /// /// Sets the *aggregation.per series aligner* query property to the given value. pub fn aggregation_per_series_aligner(mut self, new_value: &str) -> ProjectTimeSeryListCall<'a, C, A> { self._aggregation_per_series_aligner = Some(new_value.to_string()); self } - /// The set of fields to preserve when `crossSeriesReducer` is specified. The `groupByFields` determine how the time series are partitioned into subsets prior to applying the aggregation function. Each subset contains time series that have the same value for each of the grouping fields. Each individual time series is a member of exactly one subset. The `crossSeriesReducer` is applied to each subset of time series. Fields not specified in `groupByFields` are aggregated away. If `groupByFields` is not specified, the time series are aggregated into a single output time series. If `crossSeriesReducer` is not defined, this field is ignored. + /// The set of fields to preserve when crossSeriesReducer is specified. The groupByFields determine how the time series are partitioned into subsets prior to applying the aggregation function. Each subset contains time series that have the same value for each of the grouping fields. Each individual time series is a member of exactly one subset. The crossSeriesReducer is applied to each subset of time series. It is not possible to reduce across different resource types, so this field implicitly contains resource.type. Fields not specified in groupByFields are aggregated away. If groupByFields is not specified and all the time series have the same resource type, then the time series are aggregated into a single output time series. If crossSeriesReducer is not defined, this field is ignored. /// /// Append the given value to the *aggregation.group by fields* query property. /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. @@ -5190,14 +5253,14 @@ impl<'a, C, A> ProjectTimeSeryListCall<'a, C, A> where C: BorrowMut ProjectTimeSeryListCall<'a, C, A> { self._aggregation_cross_series_reducer = Some(new_value.to_string()); self } - /// The alignment period for per-[time series](TimeSeries) alignment. If present, `alignmentPeriod` must be at least 60 seconds. After per-time series alignment, each time series will contain data points only on the period boundaries. If `perSeriesAligner` is not specified or equals `ALIGN_NONE`, then this field is ignored. If `perSeriesAligner` is specified and does not equal `ALIGN_NONE`, then this field must be defined; otherwise an error is returned. + /// The alignment period for per-time series alignment. If present, alignmentPeriod must be at least 60 seconds. After per-time series alignment, each time series will contain data points only on the period boundaries. If perSeriesAligner is not specified or equals ALIGN_NONE, then this field is ignored. If perSeriesAligner is specified and does not equal ALIGN_NONE, then this field must be defined; otherwise an error is returned. /// /// Sets the *aggregation.alignment period* query property to the given value. pub fn aggregation_alignment_period(mut self, new_value: &str) -> ProjectTimeSeryListCall<'a, C, A> { diff --git a/gen/pagespeedonline2-cli/Cargo.toml b/gen/pagespeedonline2-cli/Cargo.toml index d26d79aead..008aef4be4 100644 --- a/gen/pagespeedonline2-cli/Cargo.toml +++ b/gen/pagespeedonline2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-pagespeedonline2-cli" -version = "1.0.0+20160811" +version = "1.0.0+20161204" authors = ["Sebastian Thiel "] description = "A complete library to interact with pagespeedonline (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/pagespeedonline2-cli" diff --git a/gen/pagespeedonline2-cli/README.md b/gen/pagespeedonline2-cli/README.md index 8f83087fb8..c4f60d2e2e 100644 --- a/gen/pagespeedonline2-cli/README.md +++ b/gen/pagespeedonline2-cli/README.md @@ -24,7 +24,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *pagespeedonline* API at revision *20160811*. The CLI is at version *1.0.0*. +This documentation was generated from the *pagespeedonline* API at revision *20161204*. The CLI is at version *1.0.0*. ```bash pagespeedonline2 [options] diff --git a/gen/pagespeedonline2-cli/mkdocs.yml b/gen/pagespeedonline2-cli/mkdocs.yml index 65d9de54d1..ed37c7bca4 100644 --- a/gen/pagespeedonline2-cli/mkdocs.yml +++ b/gen/pagespeedonline2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: pagespeedonline v1.0.0+20160811 +site_name: pagespeedonline v1.0.0+20161204 site_url: http://byron.github.io/google-apis-rs/google-pagespeedonline2-cli site_description: Write integrating applications with bcore diff --git a/gen/pagespeedonline2-cli/src/main.rs b/gen/pagespeedonline2-cli/src/main.rs index 6806d9054c..05fb1290d9 100644 --- a/gen/pagespeedonline2-cli/src/main.rs +++ b/gen/pagespeedonline2-cli/src/main.rs @@ -237,7 +237,7 @@ fn main() { let mut app = App::new("pagespeedonline2") .author("Sebastian Thiel ") - .version("1.0.0+20160811") + .version("1.0.0+20161204") .about("Analyzes the performance of a web page and provides tailored suggestions to make that page faster.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_pagespeedonline2_cli") .arg(Arg::with_name("folder") diff --git a/gen/pagespeedonline2/Cargo.toml b/gen/pagespeedonline2/Cargo.toml index e8ee1c1cf4..a22e8e2a9f 100644 --- a/gen/pagespeedonline2/Cargo.toml +++ b/gen/pagespeedonline2/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-pagespeedonline2" -version = "1.0.0+20160811" +version = "1.0.0+20161204" authors = ["Sebastian Thiel "] description = "A complete library to interact with pagespeedonline (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/pagespeedonline2" diff --git a/gen/pagespeedonline2/README.md b/gen/pagespeedonline2/README.md index c7072c8639..75fe5b1043 100644 --- a/gen/pagespeedonline2/README.md +++ b/gen/pagespeedonline2/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-pagespeedonline2` library allows access to all features of the *Google pagespeedonline* service. -This documentation was generated from *pagespeedonline* crate version *1.0.0+20160811*, where *20160811* is the exact revision of the *pagespeedonline:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *pagespeedonline* crate version *1.0.0+20161204*, where *20161204* is the exact revision of the *pagespeedonline:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *pagespeedonline* *v2* API can be found at the [official documentation site](https://developers.google.com/speed/docs/insights/v2/getting-started). diff --git a/gen/pagespeedonline2/src/lib.rs b/gen/pagespeedonline2/src/lib.rs index 809675dae7..cb46296f20 100644 --- a/gen/pagespeedonline2/src/lib.rs +++ b/gen/pagespeedonline2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *pagespeedonline* crate version *1.0.0+20160811*, where *20160811* is the exact revision of the *pagespeedonline:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *pagespeedonline* crate version *1.0.0+20161204*, where *20161204* is the exact revision of the *pagespeedonline:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *pagespeedonline* *v2* API can be found at the //! [official documentation site](https://developers.google.com/speed/docs/insights/v2/getting-started). diff --git a/gen/plus1-cli/Cargo.toml b/gen/plus1-cli/Cargo.toml index 2f3e784146..b4c81e1385 100644 --- a/gen/plus1-cli/Cargo.toml +++ b/gen/plus1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-plus1-cli" -version = "1.0.0+20160907" +version = "1.0.0+20161214" authors = ["Sebastian Thiel "] description = "A complete library to interact with plus (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/plus1-cli" diff --git a/gen/plus1-cli/README.md b/gen/plus1-cli/README.md index 10ba76290d..dd175110ab 100644 --- a/gen/plus1-cli/README.md +++ b/gen/plus1-cli/README.md @@ -24,7 +24,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *plus* API at revision *20160907*. The CLI is at version *1.0.0*. +This documentation was generated from the *plus* API at revision *20161214*. The CLI is at version *1.0.0*. ```bash plus1 [options] diff --git a/gen/plus1-cli/mkdocs.yml b/gen/plus1-cli/mkdocs.yml index 22f5ee8fec..df99415d96 100644 --- a/gen/plus1-cli/mkdocs.yml +++ b/gen/plus1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: plus v1.0.0+20160907 +site_name: plus v1.0.0+20161214 site_url: http://byron.github.io/google-apis-rs/google-plus1-cli site_description: Write integrating applications with bcore diff --git a/gen/plus1-cli/src/main.rs b/gen/plus1-cli/src/main.rs index 79e27760d3..321c600bc3 100644 --- a/gen/plus1-cli/src/main.rs +++ b/gen/plus1-cli/src/main.rs @@ -937,7 +937,7 @@ fn main() { let mut app = App::new("plus1") .author("Sebastian Thiel ") - .version("1.0.0+20160907") + .version("1.0.0+20161214") .about("Builds on top of the Google+ platform.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_plus1_cli") .arg(Arg::with_name("url") diff --git a/gen/plus1/Cargo.toml b/gen/plus1/Cargo.toml index f75479294f..360497382a 100644 --- a/gen/plus1/Cargo.toml +++ b/gen/plus1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-plus1" -version = "1.0.0+20160907" +version = "1.0.0+20161214" authors = ["Sebastian Thiel "] description = "A complete library to interact with plus (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/plus1" diff --git a/gen/plus1/README.md b/gen/plus1/README.md index 40e6e21171..98c9c3ef93 100644 --- a/gen/plus1/README.md +++ b/gen/plus1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-plus1` library allows access to all features of the *Google plus* service. -This documentation was generated from *plus* crate version *1.0.0+20160907*, where *20160907* is the exact revision of the *plus:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *plus* crate version *1.0.0+20161214*, where *20161214* is the exact revision of the *plus:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *plus* *v1* API can be found at the [official documentation site](https://developers.google.com/+/api/). diff --git a/gen/plus1/src/lib.rs b/gen/plus1/src/lib.rs index f5d938cf40..00a8ad9605 100644 --- a/gen/plus1/src/lib.rs +++ b/gen/plus1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *plus* crate version *1.0.0+20160907*, where *20160907* is the exact revision of the *plus:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *plus* crate version *1.0.0+20161214*, where *20161214* is the exact revision of the *plus:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *plus* *v1* API can be found at the //! [official documentation site](https://developers.google.com/+/api/). diff --git a/gen/plusdomains1-cli/Cargo.toml b/gen/plusdomains1-cli/Cargo.toml index 856ae9f793..0b3b1cb2ee 100644 --- a/gen/plusdomains1-cli/Cargo.toml +++ b/gen/plusdomains1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-plusdomains1-cli" -version = "1.0.0+20160907" +version = "1.0.0+20161214" authors = ["Sebastian Thiel "] description = "A complete library to interact with plusDomains (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/plusdomains1-cli" diff --git a/gen/plusdomains1-cli/README.md b/gen/plusdomains1-cli/README.md index 98e64e56b8..2b956f2da1 100644 --- a/gen/plusdomains1-cli/README.md +++ b/gen/plusdomains1-cli/README.md @@ -24,7 +24,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *plusDomains* API at revision *20160907*. The CLI is at version *1.0.0*. +This documentation was generated from the *plusDomains* API at revision *20161214*. The CLI is at version *1.0.0*. ```bash plusdomains1 [options] diff --git a/gen/plusdomains1-cli/mkdocs.yml b/gen/plusdomains1-cli/mkdocs.yml index da13356bf3..42b3b1135c 100644 --- a/gen/plusdomains1-cli/mkdocs.yml +++ b/gen/plusdomains1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: plusDomains v1.0.0+20160907 +site_name: plusDomains v1.0.0+20161214 site_url: http://byron.github.io/google-apis-rs/google-plusdomains1-cli site_description: Write integrating applications with bcore diff --git a/gen/plusdomains1-cli/src/main.rs b/gen/plusdomains1-cli/src/main.rs index a738d81fb4..27fda15212 100644 --- a/gen/plusdomains1-cli/src/main.rs +++ b/gen/plusdomains1-cli/src/main.rs @@ -2163,7 +2163,7 @@ fn main() { let mut app = App::new("plusdomains1") .author("Sebastian Thiel ") - .version("1.0.0+20160907") + .version("1.0.0+20161214") .about("Builds on top of the Google+ platform for Google Apps Domains.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_plusdomains1_cli") .arg(Arg::with_name("url") diff --git a/gen/plusdomains1/Cargo.toml b/gen/plusdomains1/Cargo.toml index 545d441d79..fe6e9db58e 100644 --- a/gen/plusdomains1/Cargo.toml +++ b/gen/plusdomains1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-plusdomains1" -version = "1.0.0+20160907" +version = "1.0.0+20161214" authors = ["Sebastian Thiel "] description = "A complete library to interact with plusDomains (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/plusdomains1" diff --git a/gen/plusdomains1/README.md b/gen/plusdomains1/README.md index 93bd32d9fd..9e8345dcb0 100644 --- a/gen/plusdomains1/README.md +++ b/gen/plusdomains1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-plusdomains1` library allows access to all features of the *Google plusDomains* service. -This documentation was generated from *plusDomains* crate version *1.0.0+20160907*, where *20160907* is the exact revision of the *plusDomains:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *plusDomains* crate version *1.0.0+20161214*, where *20161214* is the exact revision of the *plusDomains:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *plusDomains* *v1* API can be found at the [official documentation site](https://developers.google.com/+/domains/). diff --git a/gen/plusdomains1/src/lib.rs b/gen/plusdomains1/src/lib.rs index 667e53e1bf..3fa55d343a 100644 --- a/gen/plusdomains1/src/lib.rs +++ b/gen/plusdomains1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *plusDomains* crate version *1.0.0+20160907*, where *20160907* is the exact revision of the *plusDomains:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *plusDomains* crate version *1.0.0+20161214*, where *20161214* is the exact revision of the *plusDomains:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *plusDomains* *v1* API can be found at the //! [official documentation site](https://developers.google.com/+/domains/). diff --git a/gen/pubsub1-cli/Cargo.toml b/gen/pubsub1-cli/Cargo.toml index 1ac3234f86..b124cd8ac6 100644 --- a/gen/pubsub1-cli/Cargo.toml +++ b/gen/pubsub1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-pubsub1-cli" -version = "1.0.0+20160317" +version = "1.0.0+20161122" authors = ["Sebastian Thiel "] description = "A complete library to interact with pubsub (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/pubsub1-cli" diff --git a/gen/pubsub1-cli/README.md b/gen/pubsub1-cli/README.md index a33bd54c46..b0dff9d141 100644 --- a/gen/pubsub1-cli/README.md +++ b/gen/pubsub1-cli/README.md @@ -24,11 +24,14 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *pubsub* API at revision *20160317*. The CLI is at version *1.0.0*. +This documentation was generated from the *pubsub* API at revision *20161122*. The CLI is at version *1.0.0*. ```bash pubsub1 [options] projects + snapshots-get-iam-policy [-p ]... [-o ] + snapshots-set-iam-policy (-r )... [-p ]... [-o ] + snapshots-test-iam-permissions (-r )... [-p ]... [-o ] subscriptions-acknowledge (-r )... [-p ]... [-o ] subscriptions-create (-r )... [-p ]... [-o ] subscriptions-delete [-p ]... [-o ] diff --git a/gen/pubsub1-cli/mkdocs.yml b/gen/pubsub1-cli/mkdocs.yml index 2782d79689..add6dc18e1 100644 --- a/gen/pubsub1-cli/mkdocs.yml +++ b/gen/pubsub1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: pubsub v1.0.0+20160317 +site_name: pubsub v1.0.0+20161122 site_url: http://byron.github.io/google-apis-rs/google-pubsub1-cli site_description: Write integrating applications with bcore @@ -9,6 +9,9 @@ site_dir: build_html pages: - ['index.md', 'Home'] +- ['projects_snapshots-get-iam-policy.md', 'Projects', 'Snapshots Get Iam Policy'] +- ['projects_snapshots-set-iam-policy.md', 'Projects', 'Snapshots Set Iam Policy'] +- ['projects_snapshots-test-iam-permissions.md', 'Projects', 'Snapshots Test Iam Permissions'] - ['projects_subscriptions-acknowledge.md', 'Projects', 'Subscriptions Acknowledge'] - ['projects_subscriptions-create.md', 'Projects', 'Subscriptions Create'] - ['projects_subscriptions-delete.md', 'Projects', 'Subscriptions Delete'] diff --git a/gen/pubsub1-cli/src/main.rs b/gen/pubsub1-cli/src/main.rs index 1843b92de0..9d517795b4 100644 --- a/gen/pubsub1-cli/src/main.rs +++ b/gen/pubsub1-cli/src/main.rs @@ -45,6 +45,229 @@ struct Engine<'n> { impl<'n> Engine<'n> { + fn _projects_snapshots_get_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().snapshots_get_iam_policy(opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_snapshots_set_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["etag", "policy", "version"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::SetIamPolicyRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().snapshots_set_iam_policy(request, opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_snapshots_test_iam_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "permissions" => Some(("permissions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["permissions"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::TestIamPermissionsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().snapshots_test_iam_permissions(request, opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _projects_subscriptions_acknowledge(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -715,8 +938,8 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["etag", "policy", "version"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -1270,8 +1493,8 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["etag", "policy", "version"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -1484,6 +1707,15 @@ impl<'n> Engine<'n> { match self.opt.subcommand() { ("projects", Some(opt)) => { match opt.subcommand() { + ("snapshots-get-iam-policy", Some(opt)) => { + call_result = self._projects_snapshots_get_iam_policy(opt, dry_run, &mut err); + }, + ("snapshots-set-iam-policy", Some(opt)) => { + call_result = self._projects_snapshots_set_iam_policy(opt, dry_run, &mut err); + }, + ("snapshots-test-iam-permissions", Some(opt)) => { + call_result = self._projects_snapshots_test_iam_permissions(opt, dry_run, &mut err); + }, ("subscriptions-acknowledge", Some(opt)) => { call_result = self._projects_subscriptions_acknowledge(opt, dry_run, &mut err); }, @@ -1636,14 +1868,108 @@ impl<'n> Engine<'n> { fn main() { let mut exit_status = 0i32; let arg_data = [ - ("projects", "methods: 'subscriptions-acknowledge', 'subscriptions-create', 'subscriptions-delete', 'subscriptions-get', 'subscriptions-get-iam-policy', 'subscriptions-list', 'subscriptions-modify-ack-deadline', 'subscriptions-modify-push-config', 'subscriptions-pull', 'subscriptions-set-iam-policy', 'subscriptions-test-iam-permissions', 'topics-create', 'topics-delete', 'topics-get', 'topics-get-iam-policy', 'topics-list', 'topics-publish', 'topics-set-iam-policy', 'topics-subscriptions-list' and 'topics-test-iam-permissions'", vec![ + ("projects", "methods: 'snapshots-get-iam-policy', 'snapshots-set-iam-policy', 'snapshots-test-iam-permissions', 'subscriptions-acknowledge', 'subscriptions-create', 'subscriptions-delete', 'subscriptions-get', 'subscriptions-get-iam-policy', 'subscriptions-list', 'subscriptions-modify-ack-deadline', 'subscriptions-modify-push-config', 'subscriptions-pull', 'subscriptions-set-iam-policy', 'subscriptions-test-iam-permissions', 'topics-create', 'topics-delete', 'topics-get', 'topics-get-iam-policy', 'topics-list', 'topics-publish', 'topics-set-iam-policy', 'topics-subscriptions-list' and 'topics-test-iam-permissions'", vec![ + ("snapshots-get-iam-policy", + Some(r##"Gets the access control policy for a resource. + Returns an empty policy if the resource exists and does not have a policy + set."##), + "Details at http://byron.github.io/google-apis-rs/google_pubsub1_cli/projects_snapshots-get-iam-policy", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy is being requested. + `resource` is usually specified as a path. For example, a Project + resource is specified as `projects/{project}`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("snapshots-set-iam-policy", + Some(r##"Sets the access control policy on the specified resource. Replaces any + existing policy."##), + "Details at http://byron.github.io/google-apis-rs/google_pubsub1_cli/projects_snapshots-set-iam-policy", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy is being specified. + `resource` is usually specified as a path. For example, a Project + resource is specified as `projects/{project}`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("snapshots-test-iam-permissions", + Some(r##"Returns permissions that a caller has on the specified resource."##), + "Details at http://byron.github.io/google-apis-rs/google_pubsub1_cli/projects_snapshots-test-iam-permissions", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy detail is being requested. + `resource` is usually specified as a path. For example, a Project + resource is specified as `projects/{project}`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), ("subscriptions-acknowledge", - Some(r##"Acknowledges the messages associated with the `ack_ids` in the `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages from the subscription. Acknowledging a message whose ack deadline has expired may succeed, but such a message may be redelivered later. Acknowledging a message more than once will not result in an error."##), + Some(r##"Acknowledges the messages associated with the `ack_ids` in the + `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages + from the subscription. + + Acknowledging a message whose ack deadline has expired may succeed, + but such a message may be redelivered later. Acknowledging a message more + than once will not result in an error."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_cli/projects_subscriptions-acknowledge", vec![ (Some(r##"subscription"##), None, - Some(r##"The subscription whose message is being acknowledged."##), + Some(r##"The subscription whose message is being acknowledged. + Format is `projects/{project}/subscriptions/{sub}`."##), Some(true), Some(false)), @@ -1666,12 +1992,26 @@ fn main() { Some(false)), ]), ("subscriptions-create", - Some(r##"Creates a subscription to a given topic. If the subscription already exists, returns `ALREADY_EXISTS`. If the corresponding topic doesn't exist, returns `NOT_FOUND`. If the name is not provided in the request, the server will assign a random name for this subscription on the same project as the topic."##), + Some(r##"Creates a subscription to a given topic. + If the subscription already exists, returns `ALREADY_EXISTS`. + If the corresponding topic doesn't exist, returns `NOT_FOUND`. + + If the name is not provided in the request, the server will assign a random + name for this subscription on the same project as the topic, conforming + to the + [resource name format](https://cloud.google.com/pubsub/docs/overview#names). + The generated name is populated in the returned Subscription object. + Note that for REST API requests, you must specify a name in the request."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_cli/projects_subscriptions-create", vec![ (Some(r##"name"##), None, - Some(r##"The name of the subscription. It must have the format `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must start with a letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in length, and it must not start with `"goog"`."##), + Some(r##"The name of the subscription. It must have the format + `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must + start with a letter, and contain only letters (`[A-Za-z]`), numbers + (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), + plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters + in length, and it must not start with `"goog"`."##), Some(true), Some(false)), @@ -1694,12 +2034,17 @@ fn main() { Some(false)), ]), ("subscriptions-delete", - Some(r##"Deletes an existing subscription. All pending messages in the subscription are immediately dropped. Calls to `Pull` after deletion will return `NOT_FOUND`. After a subscription is deleted, a new one may be created with the same name, but the new one has no association with the old subscription, or its topic unless the same topic is specified."##), + Some(r##"Deletes an existing subscription. All messages retained in the subscription + are immediately dropped. Calls to `Pull` after deletion will return + `NOT_FOUND`. After a subscription is deleted, a new one may be created with + the same name, but the new one has no association with the old + subscription or its topic unless the same topic is specified."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_cli/projects_subscriptions-delete", vec![ (Some(r##"subscription"##), None, - Some(r##"The subscription to delete."##), + Some(r##"The subscription to delete. + Format is `projects/{project}/subscriptions/{sub}`."##), Some(true), Some(false)), @@ -1721,7 +2066,8 @@ fn main() { vec![ (Some(r##"subscription"##), None, - Some(r##"The name of the subscription to get."##), + Some(r##"The name of the subscription to get. + Format is `projects/{project}/subscriptions/{sub}`."##), Some(true), Some(false)), @@ -1738,12 +2084,16 @@ fn main() { Some(false)), ]), ("subscriptions-get-iam-policy", - Some(r##"Gets the access control policy for a `resource`. Returns an empty policy if the resource exists and does not have a policy set."##), + Some(r##"Gets the access control policy for a resource. + Returns an empty policy if the resource exists and does not have a policy + set."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_cli/projects_subscriptions-get-iam-policy", vec![ (Some(r##"resource"##), None, - Some(r##"REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation."##), + Some(r##"REQUIRED: The resource for which the policy is being requested. + `resource` is usually specified as a path. For example, a Project + resource is specified as `projects/{project}`."##), Some(true), Some(false)), @@ -1765,7 +2115,8 @@ fn main() { vec![ (Some(r##"project"##), None, - Some(r##"The name of the cloud project that subscriptions belong to."##), + Some(r##"The name of the cloud project that subscriptions belong to. + Format is `projects/{project}`."##), Some(true), Some(false)), @@ -1782,12 +2133,17 @@ fn main() { Some(false)), ]), ("subscriptions-modify-ack-deadline", - Some(r##"Modifies the ack deadline for a specific message. This method is useful to indicate that more time is needed to process a message by the subscriber, or to make the message available for redelivery if the processing was interrupted."##), + Some(r##"Modifies the ack deadline for a specific message. This method is useful + to indicate that more time is needed to process a message by the + subscriber, or to make the message available for redelivery if the + processing was interrupted. Note that this does not modify the + subscription-level `ackDeadlineSeconds` used for subsequent messages."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_cli/projects_subscriptions-modify-ack-deadline", vec![ (Some(r##"subscription"##), None, - Some(r##"The name of the subscription."##), + Some(r##"The name of the subscription. + Format is `projects/{project}/subscriptions/{sub}`."##), Some(true), Some(false)), @@ -1810,12 +2166,18 @@ fn main() { Some(false)), ]), ("subscriptions-modify-push-config", - Some(r##"Modifies the `PushConfig` for a specified subscription. This may be used to change a push subscription to a pull one (signified by an empty `PushConfig`) or vice versa, or change the endpoint URL and other attributes of a push subscription. Messages will accumulate for delivery continuously through the call regardless of changes to the `PushConfig`."##), + Some(r##"Modifies the `PushConfig` for a specified subscription. + + This may be used to change a push subscription to a pull one (signified by + an empty `PushConfig`) or vice versa, or change the endpoint URL and other + attributes of a push subscription. Messages will accumulate for delivery + continuously through the call regardless of changes to the `PushConfig`."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_cli/projects_subscriptions-modify-push-config", vec![ (Some(r##"subscription"##), None, - Some(r##"The name of the subscription."##), + Some(r##"The name of the subscription. + Format is `projects/{project}/subscriptions/{sub}`."##), Some(true), Some(false)), @@ -1838,12 +2200,16 @@ fn main() { Some(false)), ]), ("subscriptions-pull", - Some(r##"Pulls messages from the server. Returns an empty list if there are no messages available in the backlog. The server may return `UNAVAILABLE` if there are too many concurrent pull requests pending for the given subscription."##), + Some(r##"Pulls messages from the server. Returns an empty list if there are no + messages available in the backlog. The server may return `UNAVAILABLE` if + there are too many concurrent pull requests pending for the given + subscription."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_cli/projects_subscriptions-pull", vec![ (Some(r##"subscription"##), None, - Some(r##"The subscription from which messages should be pulled."##), + Some(r##"The subscription from which messages should be pulled. + Format is `projects/{project}/subscriptions/{sub}`."##), Some(true), Some(false)), @@ -1866,12 +2232,15 @@ fn main() { Some(false)), ]), ("subscriptions-set-iam-policy", - Some(r##"Sets the access control policy on the specified resource. Replaces any existing policy."##), + Some(r##"Sets the access control policy on the specified resource. Replaces any + existing policy."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_cli/projects_subscriptions-set-iam-policy", vec![ (Some(r##"resource"##), None, - Some(r##"REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `setIamPolicy` documentation."##), + Some(r##"REQUIRED: The resource for which the policy is being specified. + `resource` is usually specified as a path. For example, a Project + resource is specified as `projects/{project}`."##), Some(true), Some(false)), @@ -1899,7 +2268,9 @@ fn main() { vec![ (Some(r##"resource"##), None, - Some(r##"REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `testIamPermissions` documentation."##), + Some(r##"REQUIRED: The resource for which the policy detail is being requested. + `resource` is usually specified as a path. For example, a Project + resource is specified as `projects/{project}`."##), Some(true), Some(false)), @@ -1927,7 +2298,12 @@ fn main() { vec![ (Some(r##"name"##), None, - Some(r##"The name of the topic. It must have the format `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in length, and it must not start with `"goog"`."##), + Some(r##"The name of the topic. It must have the format + `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter, + and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), + underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent + signs (`%`). It must be between 3 and 255 characters in length, and it + must not start with `"goog"`."##), Some(true), Some(false)), @@ -1950,12 +2326,17 @@ fn main() { Some(false)), ]), ("topics-delete", - Some(r##"Deletes the topic with the given name. Returns `NOT_FOUND` if the topic does not exist. After a topic is deleted, a new topic may be created with the same name; this is an entirely new topic with none of the old configuration or subscriptions. Existing subscriptions to this topic are not deleted, but their `topic` field is set to `_deleted-topic_`."##), + Some(r##"Deletes the topic with the given name. Returns `NOT_FOUND` if the topic + does not exist. After a topic is deleted, a new topic may be created with + the same name; this is an entirely new topic with none of the old + configuration or subscriptions. Existing subscriptions to this topic are + not deleted, but their `topic` field is set to `_deleted-topic_`."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_cli/projects_topics-delete", vec![ (Some(r##"topic"##), None, - Some(r##"Name of the topic to delete."##), + Some(r##"Name of the topic to delete. + Format is `projects/{project}/topics/{topic}`."##), Some(true), Some(false)), @@ -1977,7 +2358,8 @@ fn main() { vec![ (Some(r##"topic"##), None, - Some(r##"The name of the topic to get."##), + Some(r##"The name of the topic to get. + Format is `projects/{project}/topics/{topic}`."##), Some(true), Some(false)), @@ -1994,12 +2376,16 @@ fn main() { Some(false)), ]), ("topics-get-iam-policy", - Some(r##"Gets the access control policy for a `resource`. Returns an empty policy if the resource exists and does not have a policy set."##), + Some(r##"Gets the access control policy for a resource. + Returns an empty policy if the resource exists and does not have a policy + set."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_cli/projects_topics-get-iam-policy", vec![ (Some(r##"resource"##), None, - Some(r##"REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation."##), + Some(r##"REQUIRED: The resource for which the policy is being requested. + `resource` is usually specified as a path. For example, a Project + resource is specified as `projects/{project}`."##), Some(true), Some(false)), @@ -2021,7 +2407,8 @@ fn main() { vec![ (Some(r##"project"##), None, - Some(r##"The name of the cloud project that topics belong to."##), + Some(r##"The name of the cloud project that topics belong to. + Format is `projects/{project}`."##), Some(true), Some(false)), @@ -2038,12 +2425,15 @@ fn main() { Some(false)), ]), ("topics-publish", - Some(r##"Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic does not exist. The message payload must not be empty; it must contain either a non-empty data field, or at least one attribute."##), + Some(r##"Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic + does not exist. The message payload must not be empty; it must contain + either a non-empty data field, or at least one attribute."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_cli/projects_topics-publish", vec![ (Some(r##"topic"##), None, - Some(r##"The messages in the request will be published on this topic."##), + Some(r##"The messages in the request will be published on this topic. + Format is `projects/{project}/topics/{topic}`."##), Some(true), Some(false)), @@ -2066,12 +2456,15 @@ fn main() { Some(false)), ]), ("topics-set-iam-policy", - Some(r##"Sets the access control policy on the specified resource. Replaces any existing policy."##), + Some(r##"Sets the access control policy on the specified resource. Replaces any + existing policy."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_cli/projects_topics-set-iam-policy", vec![ (Some(r##"resource"##), None, - Some(r##"REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `setIamPolicy` documentation."##), + Some(r##"REQUIRED: The resource for which the policy is being specified. + `resource` is usually specified as a path. For example, a Project + resource is specified as `projects/{project}`."##), Some(true), Some(false)), @@ -2099,7 +2492,8 @@ fn main() { vec![ (Some(r##"topic"##), None, - Some(r##"The name of the topic that subscriptions are attached to."##), + Some(r##"The name of the topic that subscriptions are attached to. + Format is `projects/{project}/topics/{topic}`."##), Some(true), Some(false)), @@ -2121,7 +2515,9 @@ fn main() { vec![ (Some(r##"resource"##), None, - Some(r##"REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `testIamPermissions` documentation."##), + Some(r##"REQUIRED: The resource for which the policy detail is being requested. + `resource` is usually specified as a path. For example, a Project + resource is specified as `projects/{project}`."##), Some(true), Some(false)), @@ -2149,8 +2545,9 @@ fn main() { let mut app = App::new("pubsub1") .author("Sebastian Thiel ") - .version("1.0.0+20160317") - .about("Provides reliable, many-to-many, asynchronous messaging between applications.") + .version("1.0.0+20161122") + .about("Provides reliable, many-to-many, asynchronous messaging between applications. + ") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_pubsub1_cli") .arg(Arg::with_name("url") .long("scope") diff --git a/gen/pubsub1/Cargo.toml b/gen/pubsub1/Cargo.toml index c51a6f41cf..76ca8b7346 100644 --- a/gen/pubsub1/Cargo.toml +++ b/gen/pubsub1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-pubsub1" -version = "1.0.0+20160317" +version = "1.0.0+20161122" authors = ["Sebastian Thiel "] description = "A complete library to interact with pubsub (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/pubsub1" diff --git a/gen/pubsub1/README.md b/gen/pubsub1/README.md index ae1dfada2f..4da25278b4 100644 --- a/gen/pubsub1/README.md +++ b/gen/pubsub1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-pubsub1` library allows access to all features of the *Google pubsub* service. -This documentation was generated from *pubsub* crate version *1.0.0+20160317*, where *20160317* is the exact revision of the *pubsub:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *pubsub* crate version *1.0.0+20161122*, where *20161122* is the exact revision of the *pubsub:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *pubsub* *v1* API can be found at the [official documentation site](https://cloud.google.com/pubsub/docs). @@ -14,7 +14,7 @@ Everything else about the *pubsub* *v1* API can be found at the Handle the following *Resources* with ease from the central [hub](http://byron.github.io/google-apis-rs/google_pubsub1/struct.Pubsub.html) ... * projects - * [*subscriptions acknowledge*](http://byron.github.io/google-apis-rs/google_pubsub1/struct.ProjectSubscriptionAcknowledgeCall.html), [*subscriptions create*](http://byron.github.io/google-apis-rs/google_pubsub1/struct.ProjectSubscriptionCreateCall.html), [*subscriptions delete*](http://byron.github.io/google-apis-rs/google_pubsub1/struct.ProjectSubscriptionDeleteCall.html), [*subscriptions get*](http://byron.github.io/google-apis-rs/google_pubsub1/struct.ProjectSubscriptionGetCall.html), [*subscriptions get iam policy*](http://byron.github.io/google-apis-rs/google_pubsub1/struct.ProjectSubscriptionGetIamPolicyCall.html), [*subscriptions list*](http://byron.github.io/google-apis-rs/google_pubsub1/struct.ProjectSubscriptionListCall.html), [*subscriptions modify ack deadline*](http://byron.github.io/google-apis-rs/google_pubsub1/struct.ProjectSubscriptionModifyAckDeadlineCall.html), [*subscriptions modify push config*](http://byron.github.io/google-apis-rs/google_pubsub1/struct.ProjectSubscriptionModifyPushConfigCall.html), [*subscriptions pull*](http://byron.github.io/google-apis-rs/google_pubsub1/struct.ProjectSubscriptionPullCall.html), [*subscriptions set iam policy*](http://byron.github.io/google-apis-rs/google_pubsub1/struct.ProjectSubscriptionSetIamPolicyCall.html), [*subscriptions test iam permissions*](http://byron.github.io/google-apis-rs/google_pubsub1/struct.ProjectSubscriptionTestIamPermissionCall.html), [*topics create*](http://byron.github.io/google-apis-rs/google_pubsub1/struct.ProjectTopicCreateCall.html), [*topics delete*](http://byron.github.io/google-apis-rs/google_pubsub1/struct.ProjectTopicDeleteCall.html), [*topics get*](http://byron.github.io/google-apis-rs/google_pubsub1/struct.ProjectTopicGetCall.html), [*topics get iam policy*](http://byron.github.io/google-apis-rs/google_pubsub1/struct.ProjectTopicGetIamPolicyCall.html), [*topics list*](http://byron.github.io/google-apis-rs/google_pubsub1/struct.ProjectTopicListCall.html), [*topics publish*](http://byron.github.io/google-apis-rs/google_pubsub1/struct.ProjectTopicPublishCall.html), [*topics set iam policy*](http://byron.github.io/google-apis-rs/google_pubsub1/struct.ProjectTopicSetIamPolicyCall.html), [*topics subscriptions list*](http://byron.github.io/google-apis-rs/google_pubsub1/struct.ProjectTopicSubscriptionListCall.html) and [*topics test iam permissions*](http://byron.github.io/google-apis-rs/google_pubsub1/struct.ProjectTopicTestIamPermissionCall.html) + * [*snapshots get iam policy*](http://byron.github.io/google-apis-rs/google_pubsub1/struct.ProjectSnapshotGetIamPolicyCall.html), [*snapshots set iam policy*](http://byron.github.io/google-apis-rs/google_pubsub1/struct.ProjectSnapshotSetIamPolicyCall.html), [*snapshots test iam permissions*](http://byron.github.io/google-apis-rs/google_pubsub1/struct.ProjectSnapshotTestIamPermissionCall.html), [*subscriptions acknowledge*](http://byron.github.io/google-apis-rs/google_pubsub1/struct.ProjectSubscriptionAcknowledgeCall.html), [*subscriptions create*](http://byron.github.io/google-apis-rs/google_pubsub1/struct.ProjectSubscriptionCreateCall.html), [*subscriptions delete*](http://byron.github.io/google-apis-rs/google_pubsub1/struct.ProjectSubscriptionDeleteCall.html), [*subscriptions get*](http://byron.github.io/google-apis-rs/google_pubsub1/struct.ProjectSubscriptionGetCall.html), [*subscriptions get iam policy*](http://byron.github.io/google-apis-rs/google_pubsub1/struct.ProjectSubscriptionGetIamPolicyCall.html), [*subscriptions list*](http://byron.github.io/google-apis-rs/google_pubsub1/struct.ProjectSubscriptionListCall.html), [*subscriptions modify ack deadline*](http://byron.github.io/google-apis-rs/google_pubsub1/struct.ProjectSubscriptionModifyAckDeadlineCall.html), [*subscriptions modify push config*](http://byron.github.io/google-apis-rs/google_pubsub1/struct.ProjectSubscriptionModifyPushConfigCall.html), [*subscriptions pull*](http://byron.github.io/google-apis-rs/google_pubsub1/struct.ProjectSubscriptionPullCall.html), [*subscriptions set iam policy*](http://byron.github.io/google-apis-rs/google_pubsub1/struct.ProjectSubscriptionSetIamPolicyCall.html), [*subscriptions test iam permissions*](http://byron.github.io/google-apis-rs/google_pubsub1/struct.ProjectSubscriptionTestIamPermissionCall.html), [*topics create*](http://byron.github.io/google-apis-rs/google_pubsub1/struct.ProjectTopicCreateCall.html), [*topics delete*](http://byron.github.io/google-apis-rs/google_pubsub1/struct.ProjectTopicDeleteCall.html), [*topics get*](http://byron.github.io/google-apis-rs/google_pubsub1/struct.ProjectTopicGetCall.html), [*topics get iam policy*](http://byron.github.io/google-apis-rs/google_pubsub1/struct.ProjectTopicGetIamPolicyCall.html), [*topics list*](http://byron.github.io/google-apis-rs/google_pubsub1/struct.ProjectTopicListCall.html), [*topics publish*](http://byron.github.io/google-apis-rs/google_pubsub1/struct.ProjectTopicPublishCall.html), [*topics set iam policy*](http://byron.github.io/google-apis-rs/google_pubsub1/struct.ProjectTopicSetIamPolicyCall.html), [*topics subscriptions list*](http://byron.github.io/google-apis-rs/google_pubsub1/struct.ProjectTopicSubscriptionListCall.html) and [*topics test iam permissions*](http://byron.github.io/google-apis-rs/google_pubsub1/struct.ProjectTopicTestIamPermissionCall.html) @@ -47,11 +47,12 @@ let r = hub.resource().activity(...).doit() Or specifically ... ```ignore -let r = hub.projects().subscriptions_acknowledge(...).doit() -let r = hub.projects().subscriptions_modify_push_config(...).doit() -let r = hub.projects().subscriptions_delete(...).doit() -let r = hub.projects().topics_delete(...).doit() -let r = hub.projects().subscriptions_modify_ack_deadline(...).doit() +let r = hub.projects().snapshots_get_iam_policy(...).doit() +let r = hub.projects().snapshots_set_iam_policy(...).doit() +let r = hub.projects().topics_get_iam_policy(...).doit() +let r = hub.projects().topics_set_iam_policy(...).doit() +let r = hub.projects().subscriptions_get_iam_policy(...).doit() +let r = hub.projects().subscriptions_set_iam_policy(...).doit() ``` The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -76,7 +77,7 @@ google-pubsub1 = "*" extern crate hyper; extern crate yup_oauth2 as oauth2; extern crate google_pubsub1 as pubsub1; -use pubsub1::AcknowledgeRequest; +use pubsub1::SetIamPolicyRequest; use pubsub1::{Result, Error}; use std::default::Default; use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -97,12 +98,12 @@ let mut hub = Pubsub::new(hyper::Client::new(), auth); // As the method needs a request, you would usually fill it with the desired information // into the respective structure. Some of the parts shown here might not be applicable ! // Values shown here are possibly random and not representative ! -let mut req = AcknowledgeRequest::default(); +let mut req = SetIamPolicyRequest::default(); // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! -let result = hub.projects().subscriptions_acknowledge(req, "subscription") +let result = hub.projects().snapshots_set_iam_policy(req, "resource") .doit(); match result { diff --git a/gen/pubsub1/src/lib.rs b/gen/pubsub1/src/lib.rs index febd3b7d31..078d45e1fc 100644 --- a/gen/pubsub1/src/lib.rs +++ b/gen/pubsub1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *pubsub* crate version *1.0.0+20160317*, where *20160317* is the exact revision of the *pubsub:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *pubsub* crate version *1.0.0+20161122*, where *20161122* is the exact revision of the *pubsub:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *pubsub* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/pubsub/docs). @@ -12,7 +12,7 @@ //! Handle the following *Resources* with ease from the central [hub](struct.Pubsub.html) ... //! //! * projects -//! * [*subscriptions acknowledge*](struct.ProjectSubscriptionAcknowledgeCall.html), [*subscriptions create*](struct.ProjectSubscriptionCreateCall.html), [*subscriptions delete*](struct.ProjectSubscriptionDeleteCall.html), [*subscriptions get*](struct.ProjectSubscriptionGetCall.html), [*subscriptions get iam policy*](struct.ProjectSubscriptionGetIamPolicyCall.html), [*subscriptions list*](struct.ProjectSubscriptionListCall.html), [*subscriptions modify ack deadline*](struct.ProjectSubscriptionModifyAckDeadlineCall.html), [*subscriptions modify push config*](struct.ProjectSubscriptionModifyPushConfigCall.html), [*subscriptions pull*](struct.ProjectSubscriptionPullCall.html), [*subscriptions set iam policy*](struct.ProjectSubscriptionSetIamPolicyCall.html), [*subscriptions test iam permissions*](struct.ProjectSubscriptionTestIamPermissionCall.html), [*topics create*](struct.ProjectTopicCreateCall.html), [*topics delete*](struct.ProjectTopicDeleteCall.html), [*topics get*](struct.ProjectTopicGetCall.html), [*topics get iam policy*](struct.ProjectTopicGetIamPolicyCall.html), [*topics list*](struct.ProjectTopicListCall.html), [*topics publish*](struct.ProjectTopicPublishCall.html), [*topics set iam policy*](struct.ProjectTopicSetIamPolicyCall.html), [*topics subscriptions list*](struct.ProjectTopicSubscriptionListCall.html) and [*topics test iam permissions*](struct.ProjectTopicTestIamPermissionCall.html) +//! * [*snapshots get iam policy*](struct.ProjectSnapshotGetIamPolicyCall.html), [*snapshots set iam policy*](struct.ProjectSnapshotSetIamPolicyCall.html), [*snapshots test iam permissions*](struct.ProjectSnapshotTestIamPermissionCall.html), [*subscriptions acknowledge*](struct.ProjectSubscriptionAcknowledgeCall.html), [*subscriptions create*](struct.ProjectSubscriptionCreateCall.html), [*subscriptions delete*](struct.ProjectSubscriptionDeleteCall.html), [*subscriptions get*](struct.ProjectSubscriptionGetCall.html), [*subscriptions get iam policy*](struct.ProjectSubscriptionGetIamPolicyCall.html), [*subscriptions list*](struct.ProjectSubscriptionListCall.html), [*subscriptions modify ack deadline*](struct.ProjectSubscriptionModifyAckDeadlineCall.html), [*subscriptions modify push config*](struct.ProjectSubscriptionModifyPushConfigCall.html), [*subscriptions pull*](struct.ProjectSubscriptionPullCall.html), [*subscriptions set iam policy*](struct.ProjectSubscriptionSetIamPolicyCall.html), [*subscriptions test iam permissions*](struct.ProjectSubscriptionTestIamPermissionCall.html), [*topics create*](struct.ProjectTopicCreateCall.html), [*topics delete*](struct.ProjectTopicDeleteCall.html), [*topics get*](struct.ProjectTopicGetCall.html), [*topics get iam policy*](struct.ProjectTopicGetIamPolicyCall.html), [*topics list*](struct.ProjectTopicListCall.html), [*topics publish*](struct.ProjectTopicPublishCall.html), [*topics set iam policy*](struct.ProjectTopicSetIamPolicyCall.html), [*topics subscriptions list*](struct.ProjectTopicSubscriptionListCall.html) and [*topics test iam permissions*](struct.ProjectTopicTestIamPermissionCall.html) //! //! //! @@ -47,11 +47,12 @@ //! Or specifically ... //! //! ```ignore -//! let r = hub.projects().subscriptions_acknowledge(...).doit() -//! let r = hub.projects().subscriptions_modify_push_config(...).doit() -//! let r = hub.projects().subscriptions_delete(...).doit() -//! let r = hub.projects().topics_delete(...).doit() -//! let r = hub.projects().subscriptions_modify_ack_deadline(...).doit() +//! let r = hub.projects().snapshots_get_iam_policy(...).doit() +//! let r = hub.projects().snapshots_set_iam_policy(...).doit() +//! let r = hub.projects().topics_get_iam_policy(...).doit() +//! let r = hub.projects().topics_set_iam_policy(...).doit() +//! let r = hub.projects().subscriptions_get_iam_policy(...).doit() +//! let r = hub.projects().subscriptions_set_iam_policy(...).doit() //! ``` //! //! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -76,7 +77,7 @@ //! extern crate hyper; //! extern crate yup_oauth2 as oauth2; //! extern crate google_pubsub1 as pubsub1; -//! use pubsub1::AcknowledgeRequest; +//! use pubsub1::SetIamPolicyRequest; //! use pubsub1::{Result, Error}; //! # #[test] fn egal() { //! use std::default::Default; @@ -98,12 +99,12 @@ //! // As the method needs a request, you would usually fill it with the desired information //! // into the respective structure. Some of the parts shown here might not be applicable ! //! // Values shown here are possibly random and not representative ! -//! let mut req = AcknowledgeRequest::default(); +//! let mut req = SetIamPolicyRequest::default(); //! //! // You can configure optional parameters by calling the respective setters at will, and //! // execute the final call using `doit()`. //! // Values shown here are possibly random and not representative ! -//! let result = hub.projects().subscriptions_acknowledge(req, "subscription") +//! let result = hub.projects().snapshots_set_iam_policy(req, "resource") //! .doit(); //! //! match result { diff --git a/gen/pubsub1/src/lib.rs.in b/gen/pubsub1/src/lib.rs.in index 9fe08f7414..9ff4cd94f1 100644 --- a/gen/pubsub1/src/lib.rs.in +++ b/gen/pubsub1/src/lib.rs.in @@ -78,7 +78,7 @@ impl Default for Scope { /// extern crate hyper; /// extern crate yup_oauth2 as oauth2; /// extern crate google_pubsub1 as pubsub1; -/// use pubsub1::AcknowledgeRequest; +/// use pubsub1::SetIamPolicyRequest; /// use pubsub1::{Result, Error}; /// # #[test] fn egal() { /// use std::default::Default; @@ -100,12 +100,12 @@ impl Default for Scope { /// // As the method needs a request, you would usually fill it with the desired information /// // into the respective structure. Some of the parts shown here might not be applicable ! /// // Values shown here are possibly random and not representative ! -/// let mut req = AcknowledgeRequest::default(); +/// let mut req = SetIamPolicyRequest::default(); /// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().subscriptions_acknowledge(req, "subscription") +/// let result = hub.projects().snapshots_set_iam_policy(req, "resource") /// .doit(); /// /// match result { @@ -173,10 +173,14 @@ impl<'a, C, A> Pubsub /// /// * [subscriptions test iam permissions projects](struct.ProjectSubscriptionTestIamPermissionCall.html) (request) /// * [topics test iam permissions projects](struct.ProjectTopicTestIamPermissionCall.html) (request) +/// * [snapshots test iam permissions projects](struct.ProjectSnapshotTestIamPermissionCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TestIamPermissionsRequest { - /// The set of permissions to check for the `resource`. Permissions with wildcards (such as '*' or 'storage.*') are not allowed. For more information see IAM Overview. + /// The set of permissions to check for the `resource`. Permissions with + /// wildcards (such as '*' or 'storage.*') are not allowed. For more + /// information see + /// [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). pub permissions: Option>, } @@ -194,7 +198,9 @@ impl RequestValue for TestIamPermissionsRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListTopicSubscriptionsResponse { - /// If not empty, indicates that there may be more subscriptions that match the request; this value should be passed in a new `ListTopicSubscriptionsRequest` to get more subscriptions. + /// If not empty, indicates that there may be more subscriptions that match + /// the request; this value should be passed in a new + /// `ListTopicSubscriptionsRequest` to get more subscriptions. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// The names of the subscriptions that match the request. @@ -213,10 +219,14 @@ impl ResponseResult for ListTopicSubscriptionsResponse {} /// /// * [subscriptions set iam policy projects](struct.ProjectSubscriptionSetIamPolicyCall.html) (request) /// * [topics set iam policy projects](struct.ProjectTopicSetIamPolicyCall.html) (request) +/// * [snapshots set iam policy projects](struct.ProjectSnapshotSetIamPolicyCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct SetIamPolicyRequest { - /// REQUIRED: The complete policy to be applied to the `resource`. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them. + /// REQUIRED: The complete policy to be applied to the `resource`. The size of + /// the policy is limited to a few 10s of KB. An empty policy is a + /// valid policy but certain Cloud Platform services (such as Projects) + /// might reject them. pub policy: Option, } @@ -250,7 +260,8 @@ impl Part for ReceivedMessage {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct AcknowledgeRequest { - /// The acknowledgment ID for the messages being acknowledged that was returned by the Pub/Sub system in the `Pull` response. Must not be empty. + /// The acknowledgment ID for the messages being acknowledged that was returned + /// by the Pub/Sub system in the `Pull` response. Must not be empty. #[serde(rename="ackIds")] pub ack_ids: Option>, } @@ -269,7 +280,11 @@ impl RequestValue for AcknowledgeRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ModifyAckDeadlineRequest { - /// The new ack deadline with respect to the time this request was sent to the Pub/Sub system. Must be >= 0. For example, if the value is 10, the new ack deadline will expire 10 seconds after the `ModifyAckDeadline` call was made. Specifying zero may immediately make the message available for another pull request. + /// The new ack deadline with respect to the time this request was sent to + /// the Pub/Sub system. Must be >= 0. For example, if the value is 10, the new + /// ack deadline will expire 10 seconds after the `ModifyAckDeadline` call + /// was made. Specifying zero may immediately make the message available for + /// another pull request. #[serde(rename="ackDeadlineSeconds")] pub ack_deadline_seconds: Option, /// List of acknowledgment IDs. @@ -298,26 +313,69 @@ pub struct PublishRequest { impl RequestValue for PublishRequest {} -/// Defines an Identity and Access Management (IAM) policy. It is used to specify access control policies for Cloud Platform resources. A `Policy` consists of a list of `bindings`. A `Binding` binds a list of `members` to a `role`, where the members can be user accounts, Google groups, Google domains, and service accounts. A `role` is a named list of permissions defined by IAM. **Example** { "bindings": [ { "role": "roles/owner", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-other-app@appspot.gserviceaccount.com", ] }, { "role": "roles/viewer", "members": ["user:sean@example.com"] } ] } For a description of IAM and its features, see the [IAM developer's guide](https://cloud.google.com/iam). +/// Defines an Identity and Access Management (IAM) policy. It is used to +/// specify access control policies for Cloud Platform resources. +/// +/// +/// A `Policy` consists of a list of `bindings`. A `Binding` binds a list of +/// `members` to a `role`, where the members can be user accounts, Google groups, +/// Google domains, and service accounts. A `role` is a named list of permissions +/// defined by IAM. +/// +/// **Example** +/// +/// { +/// "bindings": [ +/// { +/// "role": "roles/owner", +/// "members": [ +/// "user:mike@example.com", +/// "group:admins@example.com", +/// "domain:google.com", +/// "serviceAccount:my-other-app@appspot.gserviceaccount.com", +/// ] +/// }, +/// { +/// "role": "roles/viewer", +/// "members": ["user:sean@example.com"] +/// } +/// ] +/// } +/// +/// For a description of IAM and its features, see the +/// [IAM developer's guide](https://cloud.google.com/iam). /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [subscriptions get iam policy projects](struct.ProjectSubscriptionGetIamPolicyCall.html) (response) +/// * [snapshots get iam policy projects](struct.ProjectSnapshotGetIamPolicyCall.html) (response) +/// * [snapshots set iam policy projects](struct.ProjectSnapshotSetIamPolicyCall.html) (response) /// * [topics get iam policy projects](struct.ProjectTopicGetIamPolicyCall.html) (response) -/// * [subscriptions set iam policy projects](struct.ProjectSubscriptionSetIamPolicyCall.html) (response) /// * [topics set iam policy projects](struct.ProjectTopicSetIamPolicyCall.html) (response) +/// * [subscriptions get iam policy projects](struct.ProjectSubscriptionGetIamPolicyCall.html) (response) +/// * [subscriptions set iam policy projects](struct.ProjectSubscriptionSetIamPolicyCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Policy { - /// Associates a list of `members` to a `role`. Multiple `bindings` must not be specified for the same `role`. `bindings` with no members will result in an error. + /// Associates a list of `members` to a `role`. + /// Multiple `bindings` must not be specified for the same `role`. + /// `bindings` with no members will result in an error. pub bindings: Option>, + /// `etag` is used for optimistic concurrency control as a way to help + /// prevent simultaneous updates of a policy from overwriting each other. + /// It is strongly suggested that systems make use of the `etag` in the + /// read-modify-write cycle to perform policy updates in order to avoid race + /// conditions: An `etag` is returned in the response to `getIamPolicy`, and + /// systems are expected to put that etag in the request to `setIamPolicy` to + /// ensure that their change will be applied to the same version of the policy. + /// + /// If no `etag` is provided in the call to `setIamPolicy`, then the existing + /// policy is overwritten blindly. + pub etag: Option, /// Version of the `Policy`. The default version is 0. pub version: Option, - /// `etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other. It is strongly suggested that systems make use of the `etag` in the read-modify-write cycle to perform policy updates in order to avoid race conditions: An `etag` is returned in the response to `getIamPolicy`, and systems are expected to put that etag in the request to `setIamPolicy` to ensure that their change will be applied to the same version of the policy. If no `etag` is provided in the call to `setIamPolicy`, then the existing policy is overwritten blindly. - pub etag: Option, } impl ResponseResult for Policy {} @@ -334,7 +392,9 @@ impl ResponseResult for Policy {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListSubscriptionsResponse { - /// If not empty, indicates that there may be more subscriptions that match the request; this value should be passed in a new `ListSubscriptionsRequest` to get more subscriptions. + /// If not empty, indicates that there may be more subscriptions that match + /// the request; this value should be passed in a new + /// `ListSubscriptionsRequest` to get more subscriptions. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// The subscriptions that match the request. @@ -355,7 +415,8 @@ impl ResponseResult for ListSubscriptionsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListTopicsResponse { - /// If not empty, indicates that there may be more topics that match the request; this value should be passed in a new `ListTopicsRequest`. + /// If not empty, indicates that there may be more topics that match the + /// request; this value should be passed in a new `ListTopicsRequest`. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// The resulting topics. @@ -376,7 +437,12 @@ impl ResponseResult for ListTopicsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ModifyPushConfigRequest { - /// The push configuration for future deliveries. An empty `pushConfig` indicates that the Pub/Sub system should stop pushing messages from the given subscription and allow messages to be pulled and acknowledged - effectively pausing the subscription if `Pull` is not called. + /// The push configuration for future deliveries. + /// + /// An empty `pushConfig` indicates that the Pub/Sub system should + /// stop pushing messages from the given subscription and allow + /// messages to be pulled and acknowledged - effectively pausing + /// the subscription if `Pull` is not called. #[serde(rename="pushConfig")] pub push_config: Option, } @@ -384,7 +450,15 @@ pub struct ModifyPushConfigRequest { impl RequestValue for ModifyPushConfigRequest {} -/// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON representation for `Empty` is empty JSON object `{}`. +/// A generic empty message that you can re-use to avoid defining duplicated +/// empty messages in your APIs. A typical example is to use it as the request +/// or the response type of an API method. For instance: +/// +/// service Foo { +/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); +/// } +/// +/// The JSON representation for `Empty` is empty JSON object `{}`. /// /// # Activities /// @@ -412,10 +486,12 @@ impl ResponseResult for Empty {} /// /// * [subscriptions test iam permissions projects](struct.ProjectSubscriptionTestIamPermissionCall.html) (response) /// * [topics test iam permissions projects](struct.ProjectTopicTestIamPermissionCall.html) (response) +/// * [snapshots test iam permissions projects](struct.ProjectSnapshotTestIamPermissionCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TestIamPermissionsResponse { - /// A subset of `TestPermissionsRequest.permissions` that the caller is allowed. + /// A subset of `TestPermissionsRequest.permissions` that the caller is + /// allowed. pub permissions: Option>, } @@ -433,10 +509,15 @@ impl ResponseResult for TestIamPermissionsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct PullRequest { - /// If this is specified as true the system will respond immediately even if it is not able to return a message in the `Pull` response. Otherwise the system is allowed to wait until at least one message is available rather than returning no messages. The client may cancel the request if it does not wish to wait any longer for the response. + /// If this is specified as true the system will respond immediately even if + /// it is not able to return a message in the `Pull` response. Otherwise the + /// system is allowed to wait until at least one message is available rather + /// than returning no messages. The client may cancel the request if it does + /// not wish to wait any longer for the response. #[serde(rename="returnImmediately")] pub return_immediately: Option, - /// The maximum number of messages returned for this request. The Pub/Sub system may return fewer than the number specified. + /// The maximum number of messages returned for this request. The Pub/Sub + /// system may return fewer than the number specified. #[serde(rename="maxMessages")] pub max_messages: Option, } @@ -444,19 +525,42 @@ pub struct PullRequest { impl RequestValue for PullRequest {} -/// Associates `members` with a `role`. +/// Configuration for a push delivery endpoint. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Binding { - /// Role that is assigned to `members`. For example, `roles/viewer`, `roles/editor`, or `roles/owner`. Required - pub role: Option, - /// Specifies the identities requesting access for a Cloud Platform resource. `members` can have the following values: * `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account. * `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account. * `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@gmail.com` or `joe@example.com`. * `serviceAccount:{emailid}`: An email address that represents a service account. For example, `my-other-app@appspot.gserviceaccount.com`. * `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`. * `domain:{domain}`: A Google Apps domain name that represents all the users of that domain. For example, `google.com` or `example.com`. - pub members: Option>, +pub struct PushConfig { + /// Endpoint configuration attributes. + /// + /// Every endpoint has a set of API supported attributes that can be used to + /// control different aspects of the message delivery. + /// + /// The currently supported attribute is `x-goog-version`, which you can + /// use to change the format of the push message. This attribute + /// indicates the version of the data expected by the endpoint. This + /// controls the shape of the envelope (i.e. its fields and metadata). + /// The endpoint version is based on the version of the Pub/Sub + /// API. + /// + /// If not present during the `CreateSubscription` call, it will default to + /// the version of the API used to make such call. If not present during a + /// `ModifyPushConfig` call, its value will not be changed. `GetSubscription` + /// calls will always return a valid version, even if the subscription was + /// created without this attribute. + /// + /// The possible values for this attribute are: + /// + /// * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API. + /// * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API. + pub attributes: Option>, + /// A URL locating the endpoint to which messages should be pushed. + /// For example, a Webhook endpoint might use "https://example.com/push". + #[serde(rename="pushEndpoint")] + pub push_endpoint: Option, } -impl Part for Binding {} +impl Part for PushConfig {} /// A topic resource. @@ -471,7 +575,12 @@ impl Part for Binding {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Topic { - /// The name of the topic. It must have the format `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in length, and it must not start with `"goog"`. + /// The name of the topic. It must have the format + /// `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter, + /// and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), + /// underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent + /// signs (`%`). It must be between 3 and 255 characters in length, and it + /// must not start with `"goog"`. pub name: Option, } @@ -479,6 +588,45 @@ impl RequestValue for Topic {} impl ResponseResult for Topic {} +/// Associates `members` with a `role`. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Binding { + /// Role that is assigned to `members`. + /// For example, `roles/viewer`, `roles/editor`, or `roles/owner`. + /// Required + pub role: Option, + /// Specifies the identities requesting access for a Cloud Platform resource. + /// `members` can have the following values: + /// + /// * `allUsers`: A special identifier that represents anyone who is + /// on the internet; with or without a Google account. + /// + /// * `allAuthenticatedUsers`: A special identifier that represents anyone + /// who is authenticated with a Google account or a service account. + /// + /// * `user:{emailid}`: An email address that represents a specific Google + /// account. For example, `alice@gmail.com` or `joe@example.com`. + /// + /// + /// * `serviceAccount:{emailid}`: An email address that represents a service + /// account. For example, `my-other-app@appspot.gserviceaccount.com`. + /// + /// * `group:{emailid}`: An email address that represents a Google group. + /// For example, `admins@example.com`. + /// + /// * `domain:{domain}`: A Google Apps domain name that represents all the + /// users of that domain. For example, `google.com` or `example.com`. + /// + /// + pub members: Option>, +} + +impl Part for Binding {} + + /// Response for the `Publish` method. /// /// # Activities @@ -490,7 +638,9 @@ impl ResponseResult for Topic {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct PublishResponse { - /// The server-assigned ID of each published message, in the same order as the messages in the request. IDs are guaranteed to be unique within the topic. + /// The server-assigned ID of each published message, in the same order as + /// the messages in the request. IDs are guaranteed to be unique within + /// the topic. #[serde(rename="messageIds")] pub message_ids: Option>, } @@ -509,7 +659,10 @@ impl ResponseResult for PublishResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct PullResponse { - /// Received Pub/Sub messages. The Pub/Sub system will return zero messages if there are no more available in the backlog. The Pub/Sub system may return fewer than the `maxMessages` requested even if there are more messages available in the backlog. + /// Received Pub/Sub messages. The Pub/Sub system will return zero messages if + /// there are no more available in the backlog. The Pub/Sub system may return + /// fewer than the `maxMessages` requested even if there are more messages + /// available in the backlog. #[serde(rename="receivedMessages")] pub received_messages: Option>, } @@ -517,7 +670,8 @@ pub struct PullResponse { impl ResponseResult for PullResponse {} -/// A message data and its attributes. The message payload must not be empty; it must contain either a non-empty data field, or at least one attribute. +/// A message data and its attributes. The message payload must not be empty; +/// it must contain either a non-empty data field, or at least one attribute. /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -525,12 +679,17 @@ impl ResponseResult for PullResponse {} pub struct PubsubMessage { /// Optional attributes for this message. pub attributes: Option>, - /// The message payload. For JSON requests, the value of this field must be base64-encoded. + /// The message payload. pub data: Option, - /// The time at which the message was published, populated by the server when it receives the `Publish` call. It must not be populated by the publisher in a `Publish` call. + /// The time at which the message was published, populated by the server when + /// it receives the `Publish` call. It must not be populated by the + /// publisher in a `Publish` call. #[serde(rename="publishTime")] pub publish_time: Option, - /// ID of this message, assigned by the server when the message is published. Guaranteed to be unique within the topic. This value may be read by a subscriber that receives a `PubsubMessage` via a `Pull` call or a push delivery. It must not be populated by the publisher in a `Publish` call. + /// ID of this message, assigned by the server when the message is published. + /// Guaranteed to be unique within the topic. This value may be read by a + /// subscriber that receives a `PubsubMessage` via a `Pull` call or a push + /// delivery. It must not be populated by the publisher in a `Publish` call. #[serde(rename="messageId")] pub message_id: Option, } @@ -538,22 +697,6 @@ pub struct PubsubMessage { impl Part for PubsubMessage {} -/// Configuration for a push delivery endpoint. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct PushConfig { - /// Endpoint configuration attributes. Every endpoint has a set of API supported attributes that can be used to control different aspects of the message delivery. The currently supported attribute is `x-goog-version`, which you can use to change the format of the push message. This attribute indicates the version of the data expected by the endpoint. This controls the shape of the envelope (i.e. its fields and metadata). The endpoint version is based on the version of the Pub/Sub API. If not present during the `CreateSubscription` call, it will default to the version of the API used to make such call. If not present during a `ModifyPushConfig` call, its value will not be changed. `GetSubscription` calls will always return a valid version, even if the subscription was created without this attribute. The possible values for this attribute are: * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API. * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API. - pub attributes: Option>, - /// A URL locating the endpoint to which messages should be pushed. For example, a Webhook endpoint might use "https://example.com/push". - #[serde(rename="pushEndpoint")] - pub push_endpoint: Option, -} - -impl Part for PushConfig {} - - /// A subscription resource. /// /// # Activities @@ -566,15 +709,43 @@ impl Part for PushConfig {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Subscription { - /// The name of the topic from which this subscription is receiving messages. The value of this field will be `_deleted-topic_` if the topic has been deleted. + /// The name of the topic from which this subscription is receiving messages. + /// Format is `projects/{project}/topics/{topic}`. + /// The value of this field will be `_deleted-topic_` if the topic has been + /// deleted. pub topic: Option, - /// This value is the maximum time after a subscriber receives a message before the subscriber should acknowledge the message. After message delivery but before the ack deadline expires and before the message is acknowledged, it is an outstanding message and will not be delivered again during that time (on a best-effort basis). For pull subscriptions, this value is used as the initial value for the ack deadline. To override this value for a given message, call `ModifyAckDeadline` with the corresponding `ack_id` if using pull. For push delivery, this value is also used to set the request timeout for the call to the push endpoint. If the subscriber never acknowledges the message, the Pub/Sub system will eventually redeliver the message. If this parameter is not set, the default value of 10 seconds is used. + /// This value is the maximum time after a subscriber receives a message + /// before the subscriber should acknowledge the message. After message + /// delivery but before the ack deadline expires and before the message is + /// acknowledged, it is an outstanding message and will not be delivered + /// again during that time (on a best-effort basis). + /// + /// For pull subscriptions, this value is used as the initial value for the ack + /// deadline. To override this value for a given message, call + /// `ModifyAckDeadline` with the corresponding `ack_id` if using + /// pull. + /// The minimum custom deadline you can specify is 10 seconds. + /// The maximum custom deadline you can specify is 600 seconds (10 minutes). + /// If this parameter is 0, a default value of 10 seconds is used. + /// + /// For push delivery, this value is also used to set the request timeout for + /// the call to the push endpoint. + /// + /// If the subscriber never acknowledges the message, the Pub/Sub + /// system will eventually redeliver the message. #[serde(rename="ackDeadlineSeconds")] pub ack_deadline_seconds: Option, - /// If push delivery is used with this subscription, this field is used to configure it. An empty `pushConfig` signifies that the subscriber will pull and ack messages using API methods. + /// If push delivery is used with this subscription, this field is + /// used to configure it. An empty `pushConfig` signifies that the subscriber + /// will pull and ack messages using API methods. #[serde(rename="pushConfig")] pub push_config: Option, - /// The name of the subscription. It must have the format `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must start with a letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in length, and it must not start with `"goog"`. + /// The name of the subscription. It must have the format + /// `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must + /// start with a letter, and contain only letters (`[A-Za-z]`), numbers + /// (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), + /// plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters + /// in length, and it must not start with `"goog"`. pub name: Option, } @@ -610,7 +781,7 @@ impl ResponseResult for Subscription {} /// ::default(), None); /// let mut hub = Pubsub::new(hyper::Client::new(), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `subscriptions_acknowledge(...)`, `subscriptions_create(...)`, `subscriptions_delete(...)`, `subscriptions_get(...)`, `subscriptions_get_iam_policy(...)`, `subscriptions_list(...)`, `subscriptions_modify_ack_deadline(...)`, `subscriptions_modify_push_config(...)`, `subscriptions_pull(...)`, `subscriptions_set_iam_policy(...)`, `subscriptions_test_iam_permissions(...)`, `topics_create(...)`, `topics_delete(...)`, `topics_get(...)`, `topics_get_iam_policy(...)`, `topics_list(...)`, `topics_publish(...)`, `topics_set_iam_policy(...)`, `topics_subscriptions_list(...)` and `topics_test_iam_permissions(...)` +/// // like `snapshots_get_iam_policy(...)`, `snapshots_set_iam_policy(...)`, `snapshots_test_iam_permissions(...)`, `subscriptions_acknowledge(...)`, `subscriptions_create(...)`, `subscriptions_delete(...)`, `subscriptions_get(...)`, `subscriptions_get_iam_policy(...)`, `subscriptions_list(...)`, `subscriptions_modify_ack_deadline(...)`, `subscriptions_modify_push_config(...)`, `subscriptions_pull(...)`, `subscriptions_set_iam_policy(...)`, `subscriptions_test_iam_permissions(...)`, `topics_create(...)`, `topics_delete(...)`, `topics_get(...)`, `topics_get_iam_policy(...)`, `topics_list(...)`, `topics_publish(...)`, `topics_set_iam_policy(...)`, `topics_subscriptions_list(...)` and `topics_test_iam_permissions(...)` /// // to build up your call. /// let rb = hub.projects(); /// # } @@ -627,13 +798,14 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists matching topics. + /// Lists matching subscriptions. /// /// # Arguments /// - /// * `project` - The name of the cloud project that topics belong to. - pub fn topics_list(&self, project: &str) -> ProjectTopicListCall<'a, C, A> { - ProjectTopicListCall { + /// * `project` - The name of the cloud project that subscriptions belong to. + /// Format is `projects/{project}`. + pub fn subscriptions_list(&self, project: &str) -> ProjectSubscriptionListCall<'a, C, A> { + ProjectSubscriptionListCall { hub: self.hub, _project: project.to_string(), _page_token: Default::default(), @@ -644,25 +816,6 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { } } - /// Create a builder to help you perform the following task: - /// - /// Pulls messages from the server. Returns an empty list if there are no messages available in the backlog. The server may return `UNAVAILABLE` if there are too many concurrent pull requests pending for the given subscription. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `subscription` - The subscription from which messages should be pulled. - pub fn subscriptions_pull(&self, request: PullRequest, subscription: &str) -> ProjectSubscriptionPullCall<'a, C, A> { - ProjectSubscriptionPullCall { - hub: self.hub, - _request: request, - _subscription: subscription.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - /// Create a builder to help you perform the following task: /// /// Creates the given topic with the given name. @@ -670,7 +823,12 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `name` - The name of the topic. It must have the format `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in length, and it must not start with `"goog"`. + /// * `name` - The name of the topic. It must have the format + /// `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter, + /// and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), + /// underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent + /// signs (`%`). It must be between 3 and 255 characters in length, and it + /// must not start with `"goog"`. pub fn topics_create(&self, request: Topic, name: &str) -> ProjectTopicCreateCall<'a, C, A> { ProjectTopicCreateCall { hub: self.hub, @@ -689,7 +847,9 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `testIamPermissions` documentation. + /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. + /// `resource` is usually specified as a path. For example, a Project + /// resource is specified as `projects/{project}`. pub fn topics_test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> ProjectTopicTestIamPermissionCall<'a, C, A> { ProjectTopicTestIamPermissionCall { hub: self.hub, @@ -703,12 +863,83 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Modifies the `PushConfig` for a specified subscription. This may be used to change a push subscription to a pull one (signified by an empty `PushConfig`) or vice versa, or change the endpoint URL and other attributes of a push subscription. Messages will accumulate for delivery continuously through the call regardless of changes to the `PushConfig`. + /// Returns permissions that a caller has on the specified resource. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. + /// `resource` is usually specified as a path. For example, a Project + /// resource is specified as `projects/{project}`. + pub fn subscriptions_test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> ProjectSubscriptionTestIamPermissionCall<'a, C, A> { + ProjectSubscriptionTestIamPermissionCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Returns permissions that a caller has on the specified resource. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. + /// `resource` is usually specified as a path. For example, a Project + /// resource is specified as `projects/{project}`. + pub fn snapshots_test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> ProjectSnapshotTestIamPermissionCall<'a, C, A> { + ProjectSnapshotTestIamPermissionCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Pulls messages from the server. Returns an empty list if there are no + /// messages available in the backlog. The server may return `UNAVAILABLE` if + /// there are too many concurrent pull requests pending for the given + /// subscription. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `subscription` - The subscription from which messages should be pulled. + /// Format is `projects/{project}/subscriptions/{sub}`. + pub fn subscriptions_pull(&self, request: PullRequest, subscription: &str) -> ProjectSubscriptionPullCall<'a, C, A> { + ProjectSubscriptionPullCall { + hub: self.hub, + _request: request, + _subscription: subscription.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Modifies the `PushConfig` for a specified subscription. + /// + /// This may be used to change a push subscription to a pull one (signified by + /// an empty `PushConfig`) or vice versa, or change the endpoint URL and other + /// attributes of a push subscription. Messages will accumulate for delivery + /// continuously through the call regardless of changes to the `PushConfig`. /// /// # Arguments /// /// * `request` - No description provided. /// * `subscription` - The name of the subscription. + /// Format is `projects/{project}/subscriptions/{sub}`. pub fn subscriptions_modify_push_config(&self, request: ModifyPushConfigRequest, subscription: &str) -> ProjectSubscriptionModifyPushConfigCall<'a, C, A> { ProjectSubscriptionModifyPushConfigCall { hub: self.hub, @@ -722,12 +953,170 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic does not exist. The message payload must not be empty; it must contain either a non-empty data field, or at least one attribute. + /// Gets the access control policy for a resource. + /// Returns an empty policy if the resource exists and does not have a policy + /// set. + /// + /// # Arguments + /// + /// * `resource` - REQUIRED: The resource for which the policy is being requested. + /// `resource` is usually specified as a path. For example, a Project + /// resource is specified as `projects/{project}`. + pub fn snapshots_get_iam_policy(&self, resource: &str) -> ProjectSnapshotGetIamPolicyCall<'a, C, A> { + ProjectSnapshotGetIamPolicyCall { + hub: self.hub, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Modifies the ack deadline for a specific message. This method is useful + /// to indicate that more time is needed to process a message by the + /// subscriber, or to make the message available for redelivery if the + /// processing was interrupted. Note that this does not modify the + /// subscription-level `ackDeadlineSeconds` used for subsequent messages. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `subscription` - The name of the subscription. + /// Format is `projects/{project}/subscriptions/{sub}`. + pub fn subscriptions_modify_ack_deadline(&self, request: ModifyAckDeadlineRequest, subscription: &str) -> ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> { + ProjectSubscriptionModifyAckDeadlineCall { + hub: self.hub, + _request: request, + _subscription: subscription.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets the access control policy for a resource. + /// Returns an empty policy if the resource exists and does not have a policy + /// set. + /// + /// # Arguments + /// + /// * `resource` - REQUIRED: The resource for which the policy is being requested. + /// `resource` is usually specified as a path. For example, a Project + /// resource is specified as `projects/{project}`. + pub fn topics_get_iam_policy(&self, resource: &str) -> ProjectTopicGetIamPolicyCall<'a, C, A> { + ProjectTopicGetIamPolicyCall { + hub: self.hub, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Acknowledges the messages associated with the `ack_ids` in the + /// `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages + /// from the subscription. + /// + /// Acknowledging a message whose ack deadline has expired may succeed, + /// but such a message may be redelivered later. Acknowledging a message more + /// than once will not result in an error. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `subscription` - The subscription whose message is being acknowledged. + /// Format is `projects/{project}/subscriptions/{sub}`. + pub fn subscriptions_acknowledge(&self, request: AcknowledgeRequest, subscription: &str) -> ProjectSubscriptionAcknowledgeCall<'a, C, A> { + ProjectSubscriptionAcknowledgeCall { + hub: self.hub, + _request: request, + _subscription: subscription.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes an existing subscription. All messages retained in the subscription + /// are immediately dropped. Calls to `Pull` after deletion will return + /// `NOT_FOUND`. After a subscription is deleted, a new one may be created with + /// the same name, but the new one has no association with the old + /// subscription or its topic unless the same topic is specified. + /// + /// # Arguments + /// + /// * `subscription` - The subscription to delete. + /// Format is `projects/{project}/subscriptions/{sub}`. + pub fn subscriptions_delete(&self, subscription: &str) -> ProjectSubscriptionDeleteCall<'a, C, A> { + ProjectSubscriptionDeleteCall { + hub: self.hub, + _subscription: subscription.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets the access control policy for a resource. + /// Returns an empty policy if the resource exists and does not have a policy + /// set. + /// + /// # Arguments + /// + /// * `resource` - REQUIRED: The resource for which the policy is being requested. + /// `resource` is usually specified as a path. For example, a Project + /// resource is specified as `projects/{project}`. + pub fn subscriptions_get_iam_policy(&self, resource: &str) -> ProjectSubscriptionGetIamPolicyCall<'a, C, A> { + ProjectSubscriptionGetIamPolicyCall { + hub: self.hub, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists matching topics. + /// + /// # Arguments + /// + /// * `project` - The name of the cloud project that topics belong to. + /// Format is `projects/{project}`. + pub fn topics_list(&self, project: &str) -> ProjectTopicListCall<'a, C, A> { + ProjectTopicListCall { + hub: self.hub, + _project: project.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic + /// does not exist. The message payload must not be empty; it must contain + /// either a non-empty data field, or at least one attribute. /// /// # Arguments /// /// * `request` - No description provided. /// * `topic` - The messages in the request will be published on this topic. + /// Format is `projects/{project}/topics/{topic}`. pub fn topics_publish(&self, request: PublishRequest, topic: &str) -> ProjectTopicPublishCall<'a, C, A> { ProjectTopicPublishCall { hub: self.hub, @@ -746,6 +1135,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// # Arguments /// /// * `topic` - The name of the topic to get. + /// Format is `projects/{project}/topics/{topic}`. pub fn topics_get(&self, topic: &str) -> ProjectTopicGetCall<'a, C, A> { ProjectTopicGetCall { hub: self.hub, @@ -758,65 +1148,15 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets the access control policy for a `resource`. Returns an empty policy if the resource exists and does not have a policy set. - /// - /// # Arguments - /// - /// * `resource` - REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation. - pub fn topics_get_iam_policy(&self, resource: &str) -> ProjectTopicGetIamPolicyCall<'a, C, A> { - ProjectTopicGetIamPolicyCall { - hub: self.hub, - _resource: resource.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Modifies the ack deadline for a specific message. This method is useful to indicate that more time is needed to process a message by the subscriber, or to make the message available for redelivery if the processing was interrupted. + /// Sets the access control policy on the specified resource. Replaces any + /// existing policy. /// /// # Arguments /// /// * `request` - No description provided. - /// * `subscription` - The name of the subscription. - pub fn subscriptions_modify_ack_deadline(&self, request: ModifyAckDeadlineRequest, subscription: &str) -> ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> { - ProjectSubscriptionModifyAckDeadlineCall { - hub: self.hub, - _request: request, - _subscription: subscription.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Deletes an existing subscription. All pending messages in the subscription are immediately dropped. Calls to `Pull` after deletion will return `NOT_FOUND`. After a subscription is deleted, a new one may be created with the same name, but the new one has no association with the old subscription, or its topic unless the same topic is specified. - /// - /// # Arguments - /// - /// * `subscription` - The subscription to delete. - pub fn subscriptions_delete(&self, subscription: &str) -> ProjectSubscriptionDeleteCall<'a, C, A> { - ProjectSubscriptionDeleteCall { - hub: self.hub, - _subscription: subscription.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Sets the access control policy on the specified resource. Replaces any existing policy. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `setIamPolicy` documentation. + /// * `resource` - REQUIRED: The resource for which the policy is being specified. + /// `resource` is usually specified as a path. For example, a Project + /// resource is specified as `projects/{project}`. pub fn topics_set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> ProjectTopicSetIamPolicyCall<'a, C, A> { ProjectTopicSetIamPolicyCall { hub: self.hub, @@ -830,12 +1170,48 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Creates a subscription to a given topic. If the subscription already exists, returns `ALREADY_EXISTS`. If the corresponding topic doesn't exist, returns `NOT_FOUND`. If the name is not provided in the request, the server will assign a random name for this subscription on the same project as the topic. + /// Deletes the topic with the given name. Returns `NOT_FOUND` if the topic + /// does not exist. After a topic is deleted, a new topic may be created with + /// the same name; this is an entirely new topic with none of the old + /// configuration or subscriptions. Existing subscriptions to this topic are + /// not deleted, but their `topic` field is set to `_deleted-topic_`. + /// + /// # Arguments + /// + /// * `topic` - Name of the topic to delete. + /// Format is `projects/{project}/topics/{topic}`. + pub fn topics_delete(&self, topic: &str) -> ProjectTopicDeleteCall<'a, C, A> { + ProjectTopicDeleteCall { + hub: self.hub, + _topic: topic.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a subscription to a given topic. + /// If the subscription already exists, returns `ALREADY_EXISTS`. + /// If the corresponding topic doesn't exist, returns `NOT_FOUND`. + /// + /// If the name is not provided in the request, the server will assign a random + /// name for this subscription on the same project as the topic, conforming + /// to the + /// [resource name format](https://cloud.google.com/pubsub/docs/overview#names). + /// The generated name is populated in the returned Subscription object. + /// Note that for REST API requests, you must specify a name in the request. /// /// # Arguments /// /// * `request` - No description provided. - /// * `name` - The name of the subscription. It must have the format `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must start with a letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in length, and it must not start with `"goog"`. + /// * `name` - The name of the subscription. It must have the format + /// `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must + /// start with a letter, and contain only letters (`[A-Za-z]`), numbers + /// (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), + /// plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters + /// in length, and it must not start with `"goog"`. pub fn subscriptions_create(&self, request: Subscription, name: &str) -> ProjectSubscriptionCreateCall<'a, C, A> { ProjectSubscriptionCreateCall { hub: self.hub, @@ -849,50 +1225,17 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Acknowledges the messages associated with the `ack_ids` in the `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages from the subscription. Acknowledging a message whose ack deadline has expired may succeed, but such a message may be redelivered later. Acknowledging a message more than once will not result in an error. + /// Sets the access control policy on the specified resource. Replaces any + /// existing policy. /// /// # Arguments /// /// * `request` - No description provided. - /// * `subscription` - The subscription whose message is being acknowledged. - pub fn subscriptions_acknowledge(&self, request: AcknowledgeRequest, subscription: &str) -> ProjectSubscriptionAcknowledgeCall<'a, C, A> { - ProjectSubscriptionAcknowledgeCall { - hub: self.hub, - _request: request, - _subscription: subscription.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Gets the access control policy for a `resource`. Returns an empty policy if the resource exists and does not have a policy set. - /// - /// # Arguments - /// - /// * `resource` - REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation. - pub fn subscriptions_get_iam_policy(&self, resource: &str) -> ProjectSubscriptionGetIamPolicyCall<'a, C, A> { - ProjectSubscriptionGetIamPolicyCall { - hub: self.hub, - _resource: resource.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Returns permissions that a caller has on the specified resource. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `testIamPermissions` documentation. - pub fn subscriptions_test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> ProjectSubscriptionTestIamPermissionCall<'a, C, A> { - ProjectSubscriptionTestIamPermissionCall { + /// * `resource` - REQUIRED: The resource for which the policy is being specified. + /// `resource` is usually specified as a path. For example, a Project + /// resource is specified as `projects/{project}`. + pub fn snapshots_set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> ProjectSnapshotSetIamPolicyCall<'a, C, A> { + ProjectSnapshotSetIamPolicyCall { hub: self.hub, _request: request, _resource: resource.to_string(), @@ -902,23 +1245,6 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { } } - /// Create a builder to help you perform the following task: - /// - /// Deletes the topic with the given name. Returns `NOT_FOUND` if the topic does not exist. After a topic is deleted, a new topic may be created with the same name; this is an entirely new topic with none of the old configuration or subscriptions. Existing subscriptions to this topic are not deleted, but their `topic` field is set to `_deleted-topic_`. - /// - /// # Arguments - /// - /// * `topic` - Name of the topic to delete. - pub fn topics_delete(&self, topic: &str) -> ProjectTopicDeleteCall<'a, C, A> { - ProjectTopicDeleteCall { - hub: self.hub, - _topic: topic.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - /// Create a builder to help you perform the following task: /// /// Gets the configuration details of a subscription. @@ -926,6 +1252,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// # Arguments /// /// * `subscription` - The name of the subscription to get. + /// Format is `projects/{project}/subscriptions/{sub}`. pub fn subscriptions_get(&self, subscription: &str) -> ProjectSubscriptionGetCall<'a, C, A> { ProjectSubscriptionGetCall { hub: self.hub, @@ -943,6 +1270,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// # Arguments /// /// * `topic` - The name of the topic that subscriptions are attached to. + /// Format is `projects/{project}/topics/{topic}`. pub fn topics_subscriptions_list(&self, topic: &str) -> ProjectTopicSubscriptionListCall<'a, C, A> { ProjectTopicSubscriptionListCall { hub: self.hub, @@ -957,31 +1285,15 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists matching subscriptions. - /// - /// # Arguments - /// - /// * `project` - The name of the cloud project that subscriptions belong to. - pub fn subscriptions_list(&self, project: &str) -> ProjectSubscriptionListCall<'a, C, A> { - ProjectSubscriptionListCall { - hub: self.hub, - _project: project.to_string(), - _page_token: Default::default(), - _page_size: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Sets the access control policy on the specified resource. Replaces any existing policy. + /// Sets the access control policy on the specified resource. Replaces any + /// existing policy. /// /// # Arguments /// /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `setIamPolicy` documentation. + /// * `resource` - REQUIRED: The resource for which the policy is being specified. + /// `resource` is usually specified as a path. For example, a Project + /// resource is specified as `projects/{project}`. pub fn subscriptions_set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> ProjectSubscriptionSetIamPolicyCall<'a, C, A> { ProjectSubscriptionSetIamPolicyCall { hub: self.hub, @@ -1002,9 +1314,9 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { // CallBuilders ### // ################# -/// Lists matching topics. +/// Lists matching subscriptions. /// -/// A builder for the *topics.list* method supported by a *project* resource. +/// A builder for the *subscriptions.list* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. /// /// # Example @@ -1028,13 +1340,13 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().topics_list("project") +/// let result = hub.projects().subscriptions_list("project") /// .page_token("sed") /// .page_size(-85) /// .doit(); /// # } /// ``` -pub struct ProjectTopicListCall<'a, C, A> +pub struct ProjectSubscriptionListCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Pubsub, @@ -1046,13 +1358,13 @@ pub struct ProjectTopicListCall<'a, C, A> _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for ProjectTopicListCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for ProjectSubscriptionListCall<'a, C, A> {} -impl<'a, C, A> ProjectTopicListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> ProjectSubscriptionListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ListTopicsResponse)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, ListSubscriptionsResponse)> { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -1061,7 +1373,7 @@ impl<'a, C, A> ProjectTopicListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "pubsub.projects.topics.list", + dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -1083,7 +1395,7 @@ impl<'a, C, A> ProjectTopicListCall<'a, C, A> where C: BorrowMut, params.push(("alt", "json".to_string())); - let mut url = "https://pubsub.googleapis.com/v1/{+project}/topics".to_string(); + let mut url = "https://pubsub.googleapis.com/v1/{+project}/subscriptions".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } @@ -1189,27 +1501,30 @@ impl<'a, C, A> ProjectTopicListCall<'a, C, A> where C: BorrowMut, } - /// The name of the cloud project that topics belong to. + /// The name of the cloud project that subscriptions belong to. + /// Format is `projects/{project}`. /// /// Sets the *project* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn project(mut self, new_value: &str) -> ProjectTopicListCall<'a, C, A> { + pub fn project(mut self, new_value: &str) -> ProjectSubscriptionListCall<'a, C, A> { self._project = new_value.to_string(); self } - /// The value returned by the last `ListTopicsResponse`; indicates that this is a continuation of a prior `ListTopics` call, and that the system should return the next page of data. + /// The value returned by the last `ListSubscriptionsResponse`; indicates that + /// this is a continuation of a prior `ListSubscriptions` call, and that the + /// system should return the next page of data. /// /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> ProjectTopicListCall<'a, C, A> { + pub fn page_token(mut self, new_value: &str) -> ProjectSubscriptionListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum number of topics to return. + /// Maximum number of subscriptions to return. /// /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> ProjectTopicListCall<'a, C, A> { + pub fn page_size(mut self, new_value: i32) -> ProjectSubscriptionListCall<'a, C, A> { self._page_size = Some(new_value); self } @@ -1219,7 +1534,7 @@ impl<'a, C, A> ProjectTopicListCall<'a, C, A> where C: BorrowMut, /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectTopicListCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectSubscriptionListCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -1246,7 +1561,7 @@ impl<'a, C, A> ProjectTopicListCall<'a, C, A> where C: BorrowMut, /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectTopicListCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> ProjectSubscriptionListCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -1263,283 +1578,7 @@ impl<'a, C, A> ProjectTopicListCall<'a, C, A> where C: BorrowMut, /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectTopicListCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Pulls messages from the server. Returns an empty list if there are no messages available in the backlog. The server may return `UNAVAILABLE` if there are too many concurrent pull requests pending for the given subscription. -/// -/// A builder for the *subscriptions.pull* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_pubsub1 as pubsub1; -/// use pubsub1::PullRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use pubsub1::Pubsub; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Pubsub::new(hyper::Client::new(), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = PullRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().subscriptions_pull(req, "subscription") -/// .doit(); -/// # } -/// ``` -pub struct ProjectSubscriptionPullCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Pubsub, - _request: PullRequest, - _subscription: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectSubscriptionPullCall<'a, C, A> {} - -impl<'a, C, A> ProjectSubscriptionPullCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, PullResponse)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.pull", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("subscription", self._subscription.to_string())); - for &field in ["alt", "subscription"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://pubsub.googleapis.com/v1/{+subscription}:pull".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+subscription}", "subscription")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["subscription"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: PullRequest) -> ProjectSubscriptionPullCall<'a, C, A> { - self._request = new_value; - self - } - /// The subscription from which messages should be pulled. - /// - /// Sets the *subscription* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn subscription(mut self, new_value: &str) -> ProjectSubscriptionPullCall<'a, C, A> { - self._subscription = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectSubscriptionPullCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *bearer_token* (query-string) - OAuth bearer token. - /// * *pp* (query-boolean) - Pretty-print response. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectSubscriptionPullCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectSubscriptionPullCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectSubscriptionListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1755,7 +1794,12 @@ impl<'a, C, A> ProjectTopicCreateCall<'a, C, A> where C: BorrowMut ProjectTopicTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectTopicTestIamPermissionCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = Pubsub::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = TestIamPermissionsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().subscriptions_test_iam_permissions(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct ProjectSubscriptionTestIamPermissionCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Pubsub, + _request: TestIamPermissionsRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectSubscriptionTestIamPermissionCall<'a, C, A> {} + +impl<'a, C, A> ProjectSubscriptionTestIamPermissionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, TestIamPermissionsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.testIamPermissions", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://pubsub.googleapis.com/v1/{+resource}:testIamPermissions".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: TestIamPermissionsRequest) -> ProjectSubscriptionTestIamPermissionCall<'a, C, A> { + self._request = new_value; + self + } + /// REQUIRED: The resource for which the policy detail is being requested. + /// `resource` is usually specified as a path. For example, a Project + /// resource is specified as `projects/{project}`. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectSubscriptionTestIamPermissionCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectSubscriptionTestIamPermissionCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectSubscriptionTestIamPermissionCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectSubscriptionTestIamPermissionCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Returns permissions that a caller has on the specified resource. +/// +/// A builder for the *snapshots.testIamPermissions* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_pubsub1 as pubsub1; +/// use pubsub1::TestIamPermissionsRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use pubsub1::Pubsub; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Pubsub::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = TestIamPermissionsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().snapshots_test_iam_permissions(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct ProjectSnapshotTestIamPermissionCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Pubsub, + _request: TestIamPermissionsRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectSnapshotTestIamPermissionCall<'a, C, A> {} + +impl<'a, C, A> ProjectSnapshotTestIamPermissionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, TestIamPermissionsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "pubsub.projects.snapshots.testIamPermissions", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://pubsub.googleapis.com/v1/{+resource}:testIamPermissions".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: TestIamPermissionsRequest) -> ProjectSnapshotTestIamPermissionCall<'a, C, A> { + self._request = new_value; + self + } + /// REQUIRED: The resource for which the policy detail is being requested. + /// `resource` is usually specified as a path. For example, a Project + /// resource is specified as `projects/{project}`. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectSnapshotTestIamPermissionCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectSnapshotTestIamPermissionCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectSnapshotTestIamPermissionCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectSnapshotTestIamPermissionCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Pulls messages from the server. Returns an empty list if there are no +/// messages available in the backlog. The server may return `UNAVAILABLE` if +/// there are too many concurrent pull requests pending for the given +/// subscription. +/// +/// A builder for the *subscriptions.pull* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_pubsub1 as pubsub1; +/// use pubsub1::PullRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use pubsub1::Pubsub; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Pubsub::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = PullRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().subscriptions_pull(req, "subscription") +/// .doit(); +/// # } +/// ``` +pub struct ProjectSubscriptionPullCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Pubsub, + _request: PullRequest, + _subscription: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectSubscriptionPullCall<'a, C, A> {} + +impl<'a, C, A> ProjectSubscriptionPullCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PullResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.pull", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("subscription", self._subscription.to_string())); + for &field in ["alt", "subscription"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://pubsub.googleapis.com/v1/{+subscription}:pull".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+subscription}", "subscription")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["subscription"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: PullRequest) -> ProjectSubscriptionPullCall<'a, C, A> { + self._request = new_value; + self + } + /// The subscription from which messages should be pulled. + /// Format is `projects/{project}/subscriptions/{sub}`. + /// + /// Sets the *subscription* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn subscription(mut self, new_value: &str) -> ProjectSubscriptionPullCall<'a, C, A> { + self._subscription = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectSubscriptionPullCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectSubscriptionPullCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectSubscriptionPullCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Modifies the `PushConfig` for a specified subscription. +/// +/// This may be used to change a push subscription to a pull one (signified by +/// an empty `PushConfig`) or vice versa, or change the endpoint URL and other +/// attributes of a push subscription. Messages will accumulate for delivery +/// continuously through the call regardless of changes to the `PushConfig`. /// /// A builder for the *subscriptions.modifyPushConfig* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -2308,6 +3195,7 @@ impl<'a, C, A> ProjectSubscriptionModifyPushConfigCall<'a, C, A> where C: Borrow self } /// The name of the subscription. + /// Format is `projects/{project}/subscriptions/{sub}`. /// /// Sets the *subscription* path property to the given value. /// @@ -2375,7 +3263,1842 @@ impl<'a, C, A> ProjectSubscriptionModifyPushConfigCall<'a, C, A> where C: Borrow } -/// Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic does not exist. The message payload must not be empty; it must contain either a non-empty data field, or at least one attribute. +/// Gets the access control policy for a resource. +/// Returns an empty policy if the resource exists and does not have a policy +/// set. +/// +/// A builder for the *snapshots.getIamPolicy* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_pubsub1 as pubsub1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use pubsub1::Pubsub; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Pubsub::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().snapshots_get_iam_policy("resource") +/// .doit(); +/// # } +/// ``` +pub struct ProjectSnapshotGetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Pubsub, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectSnapshotGetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> ProjectSnapshotGetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "pubsub.projects.snapshots.getIamPolicy", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://pubsub.googleapis.com/v1/{+resource}:getIamPolicy".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// REQUIRED: The resource for which the policy is being requested. + /// `resource` is usually specified as a path. For example, a Project + /// resource is specified as `projects/{project}`. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectSnapshotGetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectSnapshotGetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectSnapshotGetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectSnapshotGetIamPolicyCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Modifies the ack deadline for a specific message. This method is useful +/// to indicate that more time is needed to process a message by the +/// subscriber, or to make the message available for redelivery if the +/// processing was interrupted. Note that this does not modify the +/// subscription-level `ackDeadlineSeconds` used for subsequent messages. +/// +/// A builder for the *subscriptions.modifyAckDeadline* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_pubsub1 as pubsub1; +/// use pubsub1::ModifyAckDeadlineRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use pubsub1::Pubsub; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Pubsub::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ModifyAckDeadlineRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().subscriptions_modify_ack_deadline(req, "subscription") +/// .doit(); +/// # } +/// ``` +pub struct ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Pubsub, + _request: ModifyAckDeadlineRequest, + _subscription: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> {} + +impl<'a, C, A> ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.modifyAckDeadline", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("subscription", self._subscription.to_string())); + for &field in ["alt", "subscription"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://pubsub.googleapis.com/v1/{+subscription}:modifyAckDeadline".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+subscription}", "subscription")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["subscription"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ModifyAckDeadlineRequest) -> ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> { + self._request = new_value; + self + } + /// The name of the subscription. + /// Format is `projects/{project}/subscriptions/{sub}`. + /// + /// Sets the *subscription* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn subscription(mut self, new_value: &str) -> ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> { + self._subscription = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets the access control policy for a resource. +/// Returns an empty policy if the resource exists and does not have a policy +/// set. +/// +/// A builder for the *topics.getIamPolicy* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_pubsub1 as pubsub1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use pubsub1::Pubsub; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Pubsub::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().topics_get_iam_policy("resource") +/// .doit(); +/// # } +/// ``` +pub struct ProjectTopicGetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Pubsub, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectTopicGetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> ProjectTopicGetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "pubsub.projects.topics.getIamPolicy", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://pubsub.googleapis.com/v1/{+resource}:getIamPolicy".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// REQUIRED: The resource for which the policy is being requested. + /// `resource` is usually specified as a path. For example, a Project + /// resource is specified as `projects/{project}`. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectTopicGetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectTopicGetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectTopicGetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectTopicGetIamPolicyCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Acknowledges the messages associated with the `ack_ids` in the +/// `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages +/// from the subscription. +/// +/// Acknowledging a message whose ack deadline has expired may succeed, +/// but such a message may be redelivered later. Acknowledging a message more +/// than once will not result in an error. +/// +/// A builder for the *subscriptions.acknowledge* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_pubsub1 as pubsub1; +/// use pubsub1::AcknowledgeRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use pubsub1::Pubsub; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Pubsub::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = AcknowledgeRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().subscriptions_acknowledge(req, "subscription") +/// .doit(); +/// # } +/// ``` +pub struct ProjectSubscriptionAcknowledgeCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Pubsub, + _request: AcknowledgeRequest, + _subscription: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectSubscriptionAcknowledgeCall<'a, C, A> {} + +impl<'a, C, A> ProjectSubscriptionAcknowledgeCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.acknowledge", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("subscription", self._subscription.to_string())); + for &field in ["alt", "subscription"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://pubsub.googleapis.com/v1/{+subscription}:acknowledge".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+subscription}", "subscription")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["subscription"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: AcknowledgeRequest) -> ProjectSubscriptionAcknowledgeCall<'a, C, A> { + self._request = new_value; + self + } + /// The subscription whose message is being acknowledged. + /// Format is `projects/{project}/subscriptions/{sub}`. + /// + /// Sets the *subscription* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn subscription(mut self, new_value: &str) -> ProjectSubscriptionAcknowledgeCall<'a, C, A> { + self._subscription = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectSubscriptionAcknowledgeCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectSubscriptionAcknowledgeCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectSubscriptionAcknowledgeCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes an existing subscription. All messages retained in the subscription +/// are immediately dropped. Calls to `Pull` after deletion will return +/// `NOT_FOUND`. After a subscription is deleted, a new one may be created with +/// the same name, but the new one has no association with the old +/// subscription or its topic unless the same topic is specified. +/// +/// A builder for the *subscriptions.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_pubsub1 as pubsub1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use pubsub1::Pubsub; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Pubsub::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().subscriptions_delete("subscription") +/// .doit(); +/// # } +/// ``` +pub struct ProjectSubscriptionDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Pubsub, + _subscription: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectSubscriptionDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectSubscriptionDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("subscription", self._subscription.to_string())); + for &field in ["alt", "subscription"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://pubsub.googleapis.com/v1/{+subscription}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+subscription}", "subscription")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["subscription"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The subscription to delete. + /// Format is `projects/{project}/subscriptions/{sub}`. + /// + /// Sets the *subscription* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn subscription(mut self, new_value: &str) -> ProjectSubscriptionDeleteCall<'a, C, A> { + self._subscription = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectSubscriptionDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectSubscriptionDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectSubscriptionDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets the access control policy for a resource. +/// Returns an empty policy if the resource exists and does not have a policy +/// set. +/// +/// A builder for the *subscriptions.getIamPolicy* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_pubsub1 as pubsub1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use pubsub1::Pubsub; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Pubsub::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().subscriptions_get_iam_policy("resource") +/// .doit(); +/// # } +/// ``` +pub struct ProjectSubscriptionGetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Pubsub, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectSubscriptionGetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> ProjectSubscriptionGetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.getIamPolicy", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://pubsub.googleapis.com/v1/{+resource}:getIamPolicy".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// REQUIRED: The resource for which the policy is being requested. + /// `resource` is usually specified as a path. For example, a Project + /// resource is specified as `projects/{project}`. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectSubscriptionGetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectSubscriptionGetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectSubscriptionGetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectSubscriptionGetIamPolicyCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Lists matching topics. +/// +/// A builder for the *topics.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_pubsub1 as pubsub1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use pubsub1::Pubsub; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Pubsub::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().topics_list("project") +/// .page_token("aliquyam") +/// .page_size(-66) +/// .doit(); +/// # } +/// ``` +pub struct ProjectTopicListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Pubsub, + _project: String, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectTopicListCall<'a, C, A> {} + +impl<'a, C, A> ProjectTopicListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListTopicsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "pubsub.projects.topics.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("project", self._project.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "project", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://pubsub.googleapis.com/v1/{+project}/topics".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+project}", "project")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the cloud project that topics belong to. + /// Format is `projects/{project}`. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> ProjectTopicListCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// The value returned by the last `ListTopicsResponse`; indicates that this is + /// a continuation of a prior `ListTopics` call, and that the system should + /// return the next page of data. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectTopicListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of topics to return. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectTopicListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectTopicListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectTopicListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectTopicListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic +/// does not exist. The message payload must not be empty; it must contain +/// either a non-empty data field, or at least one attribute. /// /// A builder for the *topics.publish* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -2584,6 +5307,7 @@ impl<'a, C, A> ProjectTopicPublishCall<'a, C, A> where C: BorrowMut ProjectTopicGetCall<'a, C, A> where C: BorrowMut, /// The name of the topic to get. + /// Format is `projects/{project}/topics/{topic}`. /// /// Sets the *topic* path property to the given value. /// @@ -2896,773 +5621,8 @@ impl<'a, C, A> ProjectTopicGetCall<'a, C, A> where C: BorrowMut, } -/// Gets the access control policy for a `resource`. Returns an empty policy if the resource exists and does not have a policy set. -/// -/// A builder for the *topics.getIamPolicy* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_pubsub1 as pubsub1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use pubsub1::Pubsub; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Pubsub::new(hyper::Client::new(), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().topics_get_iam_policy("resource") -/// .doit(); -/// # } -/// ``` -pub struct ProjectTopicGetIamPolicyCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Pubsub, - _resource: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectTopicGetIamPolicyCall<'a, C, A> {} - -impl<'a, C, A> ProjectTopicGetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "pubsub.projects.topics.getIamPolicy", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("resource", self._resource.to_string())); - for &field in ["alt", "resource"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://pubsub.googleapis.com/v1/{+resource}:getIamPolicy".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+resource}", "resource")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["resource"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation. - /// - /// Sets the *resource* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn resource(mut self, new_value: &str) -> ProjectTopicGetIamPolicyCall<'a, C, A> { - self._resource = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectTopicGetIamPolicyCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *bearer_token* (query-string) - OAuth bearer token. - /// * *pp* (query-boolean) - Pretty-print response. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectTopicGetIamPolicyCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectTopicGetIamPolicyCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Modifies the ack deadline for a specific message. This method is useful to indicate that more time is needed to process a message by the subscriber, or to make the message available for redelivery if the processing was interrupted. -/// -/// A builder for the *subscriptions.modifyAckDeadline* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_pubsub1 as pubsub1; -/// use pubsub1::ModifyAckDeadlineRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use pubsub1::Pubsub; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Pubsub::new(hyper::Client::new(), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = ModifyAckDeadlineRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().subscriptions_modify_ack_deadline(req, "subscription") -/// .doit(); -/// # } -/// ``` -pub struct ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Pubsub, - _request: ModifyAckDeadlineRequest, - _subscription: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> {} - -impl<'a, C, A> ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.modifyAckDeadline", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("subscription", self._subscription.to_string())); - for &field in ["alt", "subscription"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://pubsub.googleapis.com/v1/{+subscription}:modifyAckDeadline".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+subscription}", "subscription")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["subscription"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: ModifyAckDeadlineRequest) -> ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> { - self._request = new_value; - self - } - /// The name of the subscription. - /// - /// Sets the *subscription* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn subscription(mut self, new_value: &str) -> ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> { - self._subscription = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *bearer_token* (query-string) - OAuth bearer token. - /// * *pp* (query-boolean) - Pretty-print response. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Deletes an existing subscription. All pending messages in the subscription are immediately dropped. Calls to `Pull` after deletion will return `NOT_FOUND`. After a subscription is deleted, a new one may be created with the same name, but the new one has no association with the old subscription, or its topic unless the same topic is specified. -/// -/// A builder for the *subscriptions.delete* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_pubsub1 as pubsub1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use pubsub1::Pubsub; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Pubsub::new(hyper::Client::new(), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().subscriptions_delete("subscription") -/// .doit(); -/// # } -/// ``` -pub struct ProjectSubscriptionDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Pubsub, - _subscription: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectSubscriptionDeleteCall<'a, C, A> {} - -impl<'a, C, A> ProjectSubscriptionDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("subscription", self._subscription.to_string())); - for &field in ["alt", "subscription"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://pubsub.googleapis.com/v1/{+subscription}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+subscription}", "subscription")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["subscription"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The subscription to delete. - /// - /// Sets the *subscription* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn subscription(mut self, new_value: &str) -> ProjectSubscriptionDeleteCall<'a, C, A> { - self._subscription = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectSubscriptionDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *bearer_token* (query-string) - OAuth bearer token. - /// * *pp* (query-boolean) - Pretty-print response. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectSubscriptionDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectSubscriptionDeleteCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Sets the access control policy on the specified resource. Replaces any existing policy. +/// Sets the access control policy on the specified resource. Replaces any +/// existing policy. /// /// A builder for the *topics.setIamPolicy* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -3870,7 +5830,9 @@ impl<'a, C, A> ProjectTopicSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectTopicSetIamPolicyCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = Pubsub::new(hyper::Client::new(), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().topics_delete("topic") +/// .doit(); +/// # } +/// ``` +pub struct ProjectTopicDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Pubsub, + _topic: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectTopicDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectTopicDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "pubsub.projects.topics.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("topic", self._topic.to_string())); + for &field in ["alt", "topic"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://pubsub.googleapis.com/v1/{+topic}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+topic}", "topic")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["topic"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Name of the topic to delete. + /// Format is `projects/{project}/topics/{topic}`. + /// + /// Sets the *topic* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn topic(mut self, new_value: &str) -> ProjectTopicDeleteCall<'a, C, A> { + self._topic = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectTopicDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectTopicDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectTopicDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Creates a subscription to a given topic. +/// If the subscription already exists, returns `ALREADY_EXISTS`. +/// If the corresponding topic doesn't exist, returns `NOT_FOUND`. +/// +/// If the name is not provided in the request, the server will assign a random +/// name for this subscription on the same project as the topic, conforming +/// to the +/// [resource name format](https://cloud.google.com/pubsub/docs/overview#names). +/// The generated name is populated in the returned Subscription object. +/// Note that for REST API requests, you must specify a name in the request. /// /// A builder for the *subscriptions.create* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -4146,7 +6367,12 @@ impl<'a, C, A> ProjectSubscriptionCreateCall<'a, C, A> where C: BorrowMut ProjectSubscriptionCreateCall<'a, C, A> where C: BorrowMut ProjectSubscriptionCreateCall<'a, C, A> where C: BorrowMut ProjectSubscriptionCreateCall<'a, C, A> where C: BorrowMut - where C: 'a, A: 'a { - - hub: &'a Pubsub, - _request: AcknowledgeRequest, - _subscription: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectSubscriptionAcknowledgeCall<'a, C, A> {} - -impl<'a, C, A> ProjectSubscriptionAcknowledgeCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.acknowledge", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("subscription", self._subscription.to_string())); - for &field in ["alt", "subscription"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://pubsub.googleapis.com/v1/{+subscription}:acknowledge".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+subscription}", "subscription")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["subscription"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: AcknowledgeRequest) -> ProjectSubscriptionAcknowledgeCall<'a, C, A> { - self._request = new_value; - self - } - /// The subscription whose message is being acknowledged. - /// - /// Sets the *subscription* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn subscription(mut self, new_value: &str) -> ProjectSubscriptionAcknowledgeCall<'a, C, A> { - self._subscription = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectSubscriptionAcknowledgeCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *bearer_token* (query-string) - OAuth bearer token. - /// * *pp* (query-boolean) - Pretty-print response. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectSubscriptionAcknowledgeCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectSubscriptionAcknowledgeCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Gets the access control policy for a `resource`. Returns an empty policy if the resource exists and does not have a policy set. -/// -/// A builder for the *subscriptions.getIamPolicy* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_pubsub1 as pubsub1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use pubsub1::Pubsub; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Pubsub::new(hyper::Client::new(), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().subscriptions_get_iam_policy("resource") -/// .doit(); -/// # } -/// ``` -pub struct ProjectSubscriptionGetIamPolicyCall<'a, C, A> +pub struct ProjectSnapshotSetIamPolicyCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Pubsub, + _request: SetIamPolicyRequest, _resource: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for ProjectSubscriptionGetIamPolicyCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for ProjectSnapshotSetIamPolicyCall<'a, C, A> {} -impl<'a, C, A> ProjectSubscriptionGetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> ProjectSnapshotSetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. @@ -4545,259 +6503,7 @@ impl<'a, C, A> ProjectSubscriptionGetIamPolicyCall<'a, C, A> where C: BorrowMut< Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.getIamPolicy", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("resource", self._resource.to_string())); - for &field in ["alt", "resource"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://pubsub.googleapis.com/v1/{+resource}:getIamPolicy".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+resource}", "resource")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["resource"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation. - /// - /// Sets the *resource* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn resource(mut self, new_value: &str) -> ProjectSubscriptionGetIamPolicyCall<'a, C, A> { - self._resource = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectSubscriptionGetIamPolicyCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *bearer_token* (query-string) - OAuth bearer token. - /// * *pp* (query-boolean) - Pretty-print response. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectSubscriptionGetIamPolicyCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectSubscriptionGetIamPolicyCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Returns permissions that a caller has on the specified resource. -/// -/// A builder for the *subscriptions.testIamPermissions* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_pubsub1 as pubsub1; -/// use pubsub1::TestIamPermissionsRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use pubsub1::Pubsub; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Pubsub::new(hyper::Client::new(), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = TestIamPermissionsRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().subscriptions_test_iam_permissions(req, "resource") -/// .doit(); -/// # } -/// ``` -pub struct ProjectSubscriptionTestIamPermissionCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Pubsub, - _request: TestIamPermissionsRequest, - _resource: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectSubscriptionTestIamPermissionCall<'a, C, A> {} - -impl<'a, C, A> ProjectSubscriptionTestIamPermissionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, TestIamPermissionsResponse)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.testIamPermissions", + dlg.begin(MethodInfo { id: "pubsub.projects.snapshots.setIamPolicy", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("resource", self._resource.to_string())); @@ -4813,7 +6519,7 @@ impl<'a, C, A> ProjectSubscriptionTestIamPermissionCall<'a, C, A> where C: Borro params.push(("alt", "json".to_string())); - let mut url = "https://pubsub.googleapis.com/v1/{+resource}:testIamPermissions".to_string(); + let mut url = "https://pubsub.googleapis.com/v1/{+resource}:setIamPolicy".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } @@ -4939,17 +6645,19 @@ impl<'a, C, A> ProjectSubscriptionTestIamPermissionCall<'a, C, A> where C: Borro /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn request(mut self, new_value: TestIamPermissionsRequest) -> ProjectSubscriptionTestIamPermissionCall<'a, C, A> { + pub fn request(mut self, new_value: SetIamPolicyRequest) -> ProjectSnapshotSetIamPolicyCall<'a, C, A> { self._request = new_value; self } - /// REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `testIamPermissions` documentation. + /// REQUIRED: The resource for which the policy is being specified. + /// `resource` is usually specified as a path. For example, a Project + /// resource is specified as `projects/{project}`. /// /// Sets the *resource* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn resource(mut self, new_value: &str) -> ProjectSubscriptionTestIamPermissionCall<'a, C, A> { + pub fn resource(mut self, new_value: &str) -> ProjectSnapshotSetIamPolicyCall<'a, C, A> { self._resource = new_value.to_string(); self } @@ -4959,7 +6667,7 @@ impl<'a, C, A> ProjectSubscriptionTestIamPermissionCall<'a, C, A> where C: Borro /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectSubscriptionTestIamPermissionCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectSnapshotSetIamPolicyCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -4986,7 +6694,7 @@ impl<'a, C, A> ProjectSubscriptionTestIamPermissionCall<'a, C, A> where C: Borro /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectSubscriptionTestIamPermissionCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> ProjectSnapshotSetIamPolicyCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -5003,252 +6711,7 @@ impl<'a, C, A> ProjectSubscriptionTestIamPermissionCall<'a, C, A> where C: Borro /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectSubscriptionTestIamPermissionCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Deletes the topic with the given name. Returns `NOT_FOUND` if the topic does not exist. After a topic is deleted, a new topic may be created with the same name; this is an entirely new topic with none of the old configuration or subscriptions. Existing subscriptions to this topic are not deleted, but their `topic` field is set to `_deleted-topic_`. -/// -/// A builder for the *topics.delete* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_pubsub1 as pubsub1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use pubsub1::Pubsub; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Pubsub::new(hyper::Client::new(), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().topics_delete("topic") -/// .doit(); -/// # } -/// ``` -pub struct ProjectTopicDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Pubsub, - _topic: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectTopicDeleteCall<'a, C, A> {} - -impl<'a, C, A> ProjectTopicDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "pubsub.projects.topics.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("topic", self._topic.to_string())); - for &field in ["alt", "topic"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://pubsub.googleapis.com/v1/{+topic}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+topic}", "topic")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["topic"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Name of the topic to delete. - /// - /// Sets the *topic* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn topic(mut self, new_value: &str) -> ProjectTopicDeleteCall<'a, C, A> { - self._topic = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectTopicDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *bearer_token* (query-string) - OAuth bearer token. - /// * *pp* (query-boolean) - Pretty-print response. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectTopicDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectTopicDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectSnapshotSetIamPolicyCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5434,6 +6897,7 @@ impl<'a, C, A> ProjectSubscriptionGetCall<'a, C, A> where C: BorrowMut ProjectSubscriptionGetCall<'a, C, A> where C: BorrowMut ProjectTopicSubscriptionListCall<'a, C, A> where C: BorrowMut ProjectTopicSubscriptionListCall<'a, C, A> where C: BorrowMut ProjectTopicSubscriptionListCall<'a, C, A> { @@ -5770,276 +7237,8 @@ impl<'a, C, A> ProjectTopicSubscriptionListCall<'a, C, A> where C: BorrowMut::default(), None); -/// # let mut hub = Pubsub::new(hyper::Client::new(), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().subscriptions_list("project") -/// .page_token("diam") -/// .page_size(-55) -/// .doit(); -/// # } -/// ``` -pub struct ProjectSubscriptionListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Pubsub, - _project: String, - _page_token: Option, - _page_size: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectSubscriptionListCall<'a, C, A> {} - -impl<'a, C, A> ProjectSubscriptionListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ListSubscriptionsResponse)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); - params.push(("project", self._project.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._page_size { - params.push(("pageSize", value.to_string())); - } - for &field in ["alt", "project", "pageToken", "pageSize"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://pubsub.googleapis.com/v1/{+project}/subscriptions".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+project}", "project")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["project"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The name of the cloud project that subscriptions belong to. - /// - /// Sets the *project* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn project(mut self, new_value: &str) -> ProjectSubscriptionListCall<'a, C, A> { - self._project = new_value.to_string(); - self - } - /// The value returned by the last `ListSubscriptionsResponse`; indicates that this is a continuation of a prior `ListSubscriptions` call, and that the system should return the next page of data. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> ProjectSubscriptionListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Maximum number of subscriptions to return. - /// - /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> ProjectSubscriptionListCall<'a, C, A> { - self._page_size = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectSubscriptionListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *bearer_token* (query-string) - OAuth bearer token. - /// * *pp* (query-boolean) - Pretty-print response. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectSubscriptionListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectSubscriptionListCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Sets the access control policy on the specified resource. Replaces any existing policy. +/// Sets the access control policy on the specified resource. Replaces any +/// existing policy. /// /// A builder for the *subscriptions.setIamPolicy* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -6247,7 +7446,9 @@ impl<'a, C, A> ProjectSubscriptionSetIamPolicyCall<'a, C, A> where C: BorrowMut< self._request = new_value; self } - /// REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `setIamPolicy` documentation. + /// REQUIRED: The resource for which the policy is being specified. + /// `resource` is usually specified as a path. For example, a Project + /// resource is specified as `projects/{project}`. /// /// Sets the *resource* path property to the given value. /// diff --git a/gen/pubsub1_beta2-cli/Cargo.toml b/gen/pubsub1_beta2-cli/Cargo.toml index 0465529c14..6aa432667d 100644 --- a/gen/pubsub1_beta2-cli/Cargo.toml +++ b/gen/pubsub1_beta2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-pubsub1_beta2-cli" -version = "1.0.0+20160317" +version = "1.0.0+20161122" authors = ["Sebastian Thiel "] description = "A complete library to interact with pubsub (protocol v1beta2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/pubsub1_beta2-cli" diff --git a/gen/pubsub1_beta2-cli/README.md b/gen/pubsub1_beta2-cli/README.md index d3bcce20fd..58cdeb594c 100644 --- a/gen/pubsub1_beta2-cli/README.md +++ b/gen/pubsub1_beta2-cli/README.md @@ -24,7 +24,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *pubsub* API at revision *20160317*. The CLI is at version *1.0.0*. +This documentation was generated from the *pubsub* API at revision *20161122*. The CLI is at version *1.0.0*. ```bash pubsub1-beta2 [options] diff --git a/gen/pubsub1_beta2-cli/mkdocs.yml b/gen/pubsub1_beta2-cli/mkdocs.yml index 362a966268..72428d986e 100644 --- a/gen/pubsub1_beta2-cli/mkdocs.yml +++ b/gen/pubsub1_beta2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: pubsub v1.0.0+20160317 +site_name: pubsub v1.0.0+20161122 site_url: http://byron.github.io/google-apis-rs/google-pubsub1_beta2-cli site_description: Write integrating applications with bcore diff --git a/gen/pubsub1_beta2-cli/src/main.rs b/gen/pubsub1_beta2-cli/src/main.rs index 11376376b8..4fffb33d83 100644 --- a/gen/pubsub1_beta2-cli/src/main.rs +++ b/gen/pubsub1_beta2-cli/src/main.rs @@ -716,8 +716,8 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["etag", "policy", "version"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -1271,8 +1271,8 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["etag", "policy", "version"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -1639,7 +1639,13 @@ fn main() { let arg_data = [ ("projects", "methods: 'subscriptions-acknowledge', 'subscriptions-create', 'subscriptions-delete', 'subscriptions-get', 'subscriptions-get-iam-policy', 'subscriptions-list', 'subscriptions-modify-ack-deadline', 'subscriptions-modify-push-config', 'subscriptions-pull', 'subscriptions-set-iam-policy', 'subscriptions-test-iam-permissions', 'topics-create', 'topics-delete', 'topics-get', 'topics-get-iam-policy', 'topics-list', 'topics-publish', 'topics-set-iam-policy', 'topics-subscriptions-list' and 'topics-test-iam-permissions'", vec![ ("subscriptions-acknowledge", - Some(r##"Acknowledges the messages associated with the `ack_ids` in the `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages from the subscription. Acknowledging a message whose ack deadline has expired may succeed, but such a message may be redelivered later. Acknowledging a message more than once will not result in an error."##), + Some(r##"Acknowledges the messages associated with the `ack_ids` in the + `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages + from the subscription. + + Acknowledging a message whose ack deadline has expired may succeed, + but such a message may be redelivered later. Acknowledging a message more + than once will not result in an error."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_beta2_cli/projects_subscriptions-acknowledge", vec![ (Some(r##"subscription"##), @@ -1667,12 +1673,23 @@ fn main() { Some(false)), ]), ("subscriptions-create", - Some(r##"Creates a subscription to a given topic. If the subscription already exists, returns `ALREADY_EXISTS`. If the corresponding topic doesn't exist, returns `NOT_FOUND`. If the name is not provided in the request, the server will assign a random name for this subscription on the same project as the topic."##), + Some(r##"Creates a subscription to a given topic. + If the subscription already exists, returns `ALREADY_EXISTS`. + If the corresponding topic doesn't exist, returns `NOT_FOUND`. + + If the name is not provided in the request, the server will assign a random + name for this subscription on the same project as the topic. Note that + for REST API requests, you must specify a name."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_beta2_cli/projects_subscriptions-create", vec![ (Some(r##"name"##), None, - Some(r##"The name of the subscription. It must have the format `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must start with a letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in length, and it must not start with `"goog"`."##), + Some(r##"The name of the subscription. It must have the format + `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must + start with a letter, and contain only letters (`[A-Za-z]`), numbers + (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), + plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters + in length, and it must not start with `"goog"`."##), Some(true), Some(false)), @@ -1695,7 +1712,11 @@ fn main() { Some(false)), ]), ("subscriptions-delete", - Some(r##"Deletes an existing subscription. All pending messages in the subscription are immediately dropped. Calls to `Pull` after deletion will return `NOT_FOUND`. After a subscription is deleted, a new one may be created with the same name, but the new one has no association with the old subscription, or its topic unless the same topic is specified."##), + Some(r##"Deletes an existing subscription. All pending messages in the subscription + are immediately dropped. Calls to `Pull` after deletion will return + `NOT_FOUND`. After a subscription is deleted, a new one may be created with + the same name, but the new one has no association with the old + subscription, or its topic unless the same topic is specified."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_beta2_cli/projects_subscriptions-delete", vec![ (Some(r##"subscription"##), @@ -1739,12 +1760,16 @@ fn main() { Some(false)), ]), ("subscriptions-get-iam-policy", - Some(r##"Gets the access control policy for a `resource`. Returns an empty policy if the resource exists and does not have a policy set."##), + Some(r##"Gets the access control policy for a resource. + Returns an empty policy if the resource exists and does not have a policy + set."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_beta2_cli/projects_subscriptions-get-iam-policy", vec![ (Some(r##"resource"##), None, - Some(r##"REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation."##), + Some(r##"REQUIRED: The resource for which the policy is being requested. + `resource` is usually specified as a path. For example, a Project + resource is specified as `projects/{project}`."##), Some(true), Some(false)), @@ -1783,7 +1808,11 @@ fn main() { Some(false)), ]), ("subscriptions-modify-ack-deadline", - Some(r##"Modifies the ack deadline for a specific message. This method is useful to indicate that more time is needed to process a message by the subscriber, or to make the message available for redelivery if the processing was interrupted."##), + Some(r##"Modifies the ack deadline for a specific message. This method is useful + to indicate that more time is needed to process a message by the + subscriber, or to make the message available for redelivery if the + processing was interrupted. Note that this does not modify the + subscription-level `ackDeadlineSeconds` used for subsequent messages."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_beta2_cli/projects_subscriptions-modify-ack-deadline", vec![ (Some(r##"subscription"##), @@ -1811,7 +1840,12 @@ fn main() { Some(false)), ]), ("subscriptions-modify-push-config", - Some(r##"Modifies the `PushConfig` for a specified subscription. This may be used to change a push subscription to a pull one (signified by an empty `PushConfig`) or vice versa, or change the endpoint URL and other attributes of a push subscription. Messages will accumulate for delivery continuously through the call regardless of changes to the `PushConfig`."##), + Some(r##"Modifies the `PushConfig` for a specified subscription. + + This may be used to change a push subscription to a pull one (signified by + an empty `PushConfig`) or vice versa, or change the endpoint URL and other + attributes of a push subscription. Messages will accumulate for delivery + continuously through the call regardless of changes to the `PushConfig`."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_beta2_cli/projects_subscriptions-modify-push-config", vec![ (Some(r##"subscription"##), @@ -1839,7 +1873,10 @@ fn main() { Some(false)), ]), ("subscriptions-pull", - Some(r##"Pulls messages from the server. Returns an empty list if there are no messages available in the backlog. The server may return `UNAVAILABLE` if there are too many concurrent pull requests pending for the given subscription."##), + Some(r##"Pulls messages from the server. Returns an empty list if there are no + messages available in the backlog. The server may return `UNAVAILABLE` if + there are too many concurrent pull requests pending for the given + subscription."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_beta2_cli/projects_subscriptions-pull", vec![ (Some(r##"subscription"##), @@ -1867,12 +1904,15 @@ fn main() { Some(false)), ]), ("subscriptions-set-iam-policy", - Some(r##"Sets the access control policy on the specified resource. Replaces any existing policy."##), + Some(r##"Sets the access control policy on the specified resource. Replaces any + existing policy."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_beta2_cli/projects_subscriptions-set-iam-policy", vec![ (Some(r##"resource"##), None, - Some(r##"REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `setIamPolicy` documentation."##), + Some(r##"REQUIRED: The resource for which the policy is being specified. + `resource` is usually specified as a path. For example, a Project + resource is specified as `projects/{project}`."##), Some(true), Some(false)), @@ -1900,7 +1940,9 @@ fn main() { vec![ (Some(r##"resource"##), None, - Some(r##"REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `testIamPermissions` documentation."##), + Some(r##"REQUIRED: The resource for which the policy detail is being requested. + `resource` is usually specified as a path. For example, a Project + resource is specified as `projects/{project}`."##), Some(true), Some(false)), @@ -1928,7 +1970,12 @@ fn main() { vec![ (Some(r##"name"##), None, - Some(r##"The name of the topic. It must have the format `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in length, and it must not start with `"goog"`."##), + Some(r##"The name of the topic. It must have the format + `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter, + and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), + underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent + signs (`%`). It must be between 3 and 255 characters in length, and it + must not start with `"goog"`."##), Some(true), Some(false)), @@ -1951,7 +1998,11 @@ fn main() { Some(false)), ]), ("topics-delete", - Some(r##"Deletes the topic with the given name. Returns `NOT_FOUND` if the topic does not exist. After a topic is deleted, a new topic may be created with the same name; this is an entirely new topic with none of the old configuration or subscriptions. Existing subscriptions to this topic are not deleted, but their `topic` field is set to `_deleted-topic_`."##), + Some(r##"Deletes the topic with the given name. Returns `NOT_FOUND` if the topic + does not exist. After a topic is deleted, a new topic may be created with + the same name; this is an entirely new topic with none of the old + configuration or subscriptions. Existing subscriptions to this topic are + not deleted, but their `topic` field is set to `_deleted-topic_`."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_beta2_cli/projects_topics-delete", vec![ (Some(r##"topic"##), @@ -1995,12 +2046,16 @@ fn main() { Some(false)), ]), ("topics-get-iam-policy", - Some(r##"Gets the access control policy for a `resource`. Returns an empty policy if the resource exists and does not have a policy set."##), + Some(r##"Gets the access control policy for a resource. + Returns an empty policy if the resource exists and does not have a policy + set."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_beta2_cli/projects_topics-get-iam-policy", vec![ (Some(r##"resource"##), None, - Some(r##"REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation."##), + Some(r##"REQUIRED: The resource for which the policy is being requested. + `resource` is usually specified as a path. For example, a Project + resource is specified as `projects/{project}`."##), Some(true), Some(false)), @@ -2039,7 +2094,9 @@ fn main() { Some(false)), ]), ("topics-publish", - Some(r##"Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic does not exist. The message payload must not be empty; it must contain either a non-empty data field, or at least one attribute."##), + Some(r##"Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic + does not exist. The message payload must not be empty; it must contain + either a non-empty data field, or at least one attribute."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_beta2_cli/projects_topics-publish", vec![ (Some(r##"topic"##), @@ -2067,12 +2124,15 @@ fn main() { Some(false)), ]), ("topics-set-iam-policy", - Some(r##"Sets the access control policy on the specified resource. Replaces any existing policy."##), + Some(r##"Sets the access control policy on the specified resource. Replaces any + existing policy."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_beta2_cli/projects_topics-set-iam-policy", vec![ (Some(r##"resource"##), None, - Some(r##"REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `setIamPolicy` documentation."##), + Some(r##"REQUIRED: The resource for which the policy is being specified. + `resource` is usually specified as a path. For example, a Project + resource is specified as `projects/{project}`."##), Some(true), Some(false)), @@ -2122,7 +2182,9 @@ fn main() { vec![ (Some(r##"resource"##), None, - Some(r##"REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `testIamPermissions` documentation."##), + Some(r##"REQUIRED: The resource for which the policy detail is being requested. + `resource` is usually specified as a path. For example, a Project + resource is specified as `projects/{project}`."##), Some(true), Some(false)), @@ -2150,8 +2212,9 @@ fn main() { let mut app = App::new("pubsub1-beta2") .author("Sebastian Thiel ") - .version("1.0.0+20160317") - .about("Provides reliable, many-to-many, asynchronous messaging between applications.") + .version("1.0.0+20161122") + .about("Provides reliable, many-to-many, asynchronous messaging between applications. + ") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_pubsub1_beta2_cli") .arg(Arg::with_name("url") .long("scope") diff --git a/gen/pubsub1_beta2/Cargo.toml b/gen/pubsub1_beta2/Cargo.toml index be5e59abbd..3ea2654129 100644 --- a/gen/pubsub1_beta2/Cargo.toml +++ b/gen/pubsub1_beta2/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-pubsub1_beta2" -version = "1.0.0+20160317" +version = "1.0.0+20161122" authors = ["Sebastian Thiel "] description = "A complete library to interact with pubsub (protocol v1beta2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/pubsub1_beta2" diff --git a/gen/pubsub1_beta2/README.md b/gen/pubsub1_beta2/README.md index f8ac070437..b9f9d4bfed 100644 --- a/gen/pubsub1_beta2/README.md +++ b/gen/pubsub1_beta2/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-pubsub1_beta2` library allows access to all features of the *Google pubsub* service. -This documentation was generated from *pubsub* crate version *1.0.0+20160317*, where *20160317* is the exact revision of the *pubsub:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *pubsub* crate version *1.0.0+20161122*, where *20161122* is the exact revision of the *pubsub:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *pubsub* *v1_beta2* API can be found at the [official documentation site](https://cloud.google.com/pubsub/docs). diff --git a/gen/pubsub1_beta2/src/lib.rs b/gen/pubsub1_beta2/src/lib.rs index ca2d27a291..a11a0da358 100644 --- a/gen/pubsub1_beta2/src/lib.rs +++ b/gen/pubsub1_beta2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *pubsub* crate version *1.0.0+20160317*, where *20160317* is the exact revision of the *pubsub:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *pubsub* crate version *1.0.0+20161122*, where *20161122* is the exact revision of the *pubsub:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *pubsub* *v1_beta2* API can be found at the //! [official documentation site](https://cloud.google.com/pubsub/docs). diff --git a/gen/pubsub1_beta2/src/lib.rs.in b/gen/pubsub1_beta2/src/lib.rs.in index 6f5d9a10e2..4426f7387f 100644 --- a/gen/pubsub1_beta2/src/lib.rs.in +++ b/gen/pubsub1_beta2/src/lib.rs.in @@ -176,7 +176,10 @@ impl<'a, C, A> Pubsub /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TestIamPermissionsRequest { - /// The set of permissions to check for the `resource`. Permissions with wildcards (such as '*' or 'storage.*') are not allowed. For more information see IAM Overview. + /// The set of permissions to check for the `resource`. Permissions with + /// wildcards (such as '*' or 'storage.*') are not allowed. For more + /// information see + /// [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). pub permissions: Option>, } @@ -194,7 +197,9 @@ impl RequestValue for TestIamPermissionsRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListTopicSubscriptionsResponse { - /// If not empty, indicates that there may be more subscriptions that match the request; this value should be passed in a new `ListTopicSubscriptionsRequest` to get more subscriptions. + /// If not empty, indicates that there may be more subscriptions that match + /// the request; this value should be passed in a new + /// `ListTopicSubscriptionsRequest` to get more subscriptions. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// The names of the subscriptions that match the request. @@ -216,7 +221,10 @@ impl ResponseResult for ListTopicSubscriptionsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct SetIamPolicyRequest { - /// REQUIRED: The complete policy to be applied to the `resource`. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them. + /// REQUIRED: The complete policy to be applied to the `resource`. The size of + /// the policy is limited to a few 10s of KB. An empty policy is a + /// valid policy but certain Cloud Platform services (such as Projects) + /// might reject them. pub policy: Option, } @@ -250,7 +258,8 @@ impl Part for ReceivedMessage {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct AcknowledgeRequest { - /// The acknowledgment ID for the messages being acknowledged that was returned by the Pub/Sub system in the `Pull` response. Must not be empty. + /// The acknowledgment ID for the messages being acknowledged that was returned + /// by the Pub/Sub system in the `Pull` response. Must not be empty. #[serde(rename="ackIds")] pub ack_ids: Option>, } @@ -269,10 +278,15 @@ impl RequestValue for AcknowledgeRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ModifyAckDeadlineRequest { - /// The new ack deadline with respect to the time this request was sent to the Pub/Sub system. Must be >= 0. For example, if the value is 10, the new ack deadline will expire 10 seconds after the `ModifyAckDeadline` call was made. Specifying zero may immediately make the message available for another pull request. + /// The new ack deadline with respect to the time this request was sent to + /// the Pub/Sub system. Must be >= 0. For example, if the value is 10, the new + /// ack deadline will expire 10 seconds after the `ModifyAckDeadline` call + /// was made. Specifying zero may immediately make the message available for + /// another pull request. #[serde(rename="ackDeadlineSeconds")] pub ack_deadline_seconds: Option, - /// The acknowledgment ID. Either this or ack_ids must be populated, but not both. + /// The acknowledgment ID. Either this or ack_ids must be populated, but not + /// both. #[serde(rename="ackId")] pub ack_id: Option, /// List of acknowledgment IDs. @@ -301,7 +315,37 @@ pub struct PublishRequest { impl RequestValue for PublishRequest {} -/// Defines an Identity and Access Management (IAM) policy. It is used to specify access control policies for Cloud Platform resources. A `Policy` consists of a list of `bindings`. A `Binding` binds a list of `members` to a `role`, where the members can be user accounts, Google groups, Google domains, and service accounts. A `role` is a named list of permissions defined by IAM. **Example** { "bindings": [ { "role": "roles/owner", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-other-app@appspot.gserviceaccount.com", ] }, { "role": "roles/viewer", "members": ["user:sean@example.com"] } ] } For a description of IAM and its features, see the [IAM developer's guide](https://cloud.google.com/iam). +/// Defines an Identity and Access Management (IAM) policy. It is used to +/// specify access control policies for Cloud Platform resources. +/// +/// +/// A `Policy` consists of a list of `bindings`. A `Binding` binds a list of +/// `members` to a `role`, where the members can be user accounts, Google groups, +/// Google domains, and service accounts. A `role` is a named list of permissions +/// defined by IAM. +/// +/// **Example** +/// +/// { +/// "bindings": [ +/// { +/// "role": "roles/owner", +/// "members": [ +/// "user:mike@example.com", +/// "group:admins@example.com", +/// "domain:google.com", +/// "serviceAccount:my-other-app@appspot.gserviceaccount.com", +/// ] +/// }, +/// { +/// "role": "roles/viewer", +/// "members": ["user:sean@example.com"] +/// } +/// ] +/// } +/// +/// For a description of IAM and its features, see the +/// [IAM developer's guide](https://cloud.google.com/iam). /// /// # Activities /// @@ -315,12 +359,23 @@ impl RequestValue for PublishRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Policy { - /// Associates a list of `members` to a `role`. Multiple `bindings` must not be specified for the same `role`. `bindings` with no members will result in an error. + /// Associates a list of `members` to a `role`. + /// Multiple `bindings` must not be specified for the same `role`. + /// `bindings` with no members will result in an error. pub bindings: Option>, + /// `etag` is used for optimistic concurrency control as a way to help + /// prevent simultaneous updates of a policy from overwriting each other. + /// It is strongly suggested that systems make use of the `etag` in the + /// read-modify-write cycle to perform policy updates in order to avoid race + /// conditions: An `etag` is returned in the response to `getIamPolicy`, and + /// systems are expected to put that etag in the request to `setIamPolicy` to + /// ensure that their change will be applied to the same version of the policy. + /// + /// If no `etag` is provided in the call to `setIamPolicy`, then the existing + /// policy is overwritten blindly. + pub etag: Option, /// Version of the `Policy`. The default version is 0. pub version: Option, - /// `etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other. It is strongly suggested that systems make use of the `etag` in the read-modify-write cycle to perform policy updates in order to avoid race conditions: An `etag` is returned in the response to `getIamPolicy`, and systems are expected to put that etag in the request to `setIamPolicy` to ensure that their change will be applied to the same version of the policy. If no `etag` is provided in the call to `setIamPolicy`, then the existing policy is overwritten blindly. - pub etag: Option, } impl ResponseResult for Policy {} @@ -337,7 +392,9 @@ impl ResponseResult for Policy {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListSubscriptionsResponse { - /// If not empty, indicates that there may be more subscriptions that match the request; this value should be passed in a new `ListSubscriptionsRequest` to get more subscriptions. + /// If not empty, indicates that there may be more subscriptions that match + /// the request; this value should be passed in a new + /// `ListSubscriptionsRequest` to get more subscriptions. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// The subscriptions that match the request. @@ -358,7 +415,8 @@ impl ResponseResult for ListSubscriptionsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListTopicsResponse { - /// If not empty, indicates that there may be more topics that match the request; this value should be passed in a new `ListTopicsRequest`. + /// If not empty, indicates that there may be more topics that match the + /// request; this value should be passed in a new `ListTopicsRequest`. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// The resulting topics. @@ -379,7 +437,12 @@ impl ResponseResult for ListTopicsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ModifyPushConfigRequest { - /// The push configuration for future deliveries. An empty `pushConfig` indicates that the Pub/Sub system should stop pushing messages from the given subscription and allow messages to be pulled and acknowledged - effectively pausing the subscription if `Pull` is not called. + /// The push configuration for future deliveries. + /// + /// An empty `pushConfig` indicates that the Pub/Sub system should + /// stop pushing messages from the given subscription and allow + /// messages to be pulled and acknowledged - effectively pausing + /// the subscription if `Pull` is not called. #[serde(rename="pushConfig")] pub push_config: Option, } @@ -387,7 +450,15 @@ pub struct ModifyPushConfigRequest { impl RequestValue for ModifyPushConfigRequest {} -/// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON representation for `Empty` is empty JSON object `{}`. +/// A generic empty message that you can re-use to avoid defining duplicated +/// empty messages in your APIs. A typical example is to use it as the request +/// or the response type of an API method. For instance: +/// +/// service Foo { +/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); +/// } +/// +/// The JSON representation for `Empty` is empty JSON object `{}`. /// /// # Activities /// @@ -418,7 +489,8 @@ impl ResponseResult for Empty {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TestIamPermissionsResponse { - /// A subset of `TestPermissionsRequest.permissions` that the caller is allowed. + /// A subset of `TestPermissionsRequest.permissions` that the caller is + /// allowed. pub permissions: Option>, } @@ -436,10 +508,15 @@ impl ResponseResult for TestIamPermissionsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct PullRequest { - /// If this is specified as true the system will respond immediately even if it is not able to return a message in the `Pull` response. Otherwise the system is allowed to wait until at least one message is available rather than returning no messages. The client may cancel the request if it does not wish to wait any longer for the response. + /// If this is specified as true the system will respond immediately even if + /// it is not able to return a message in the `Pull` response. Otherwise the + /// system is allowed to wait until at least one message is available rather + /// than returning no messages. The client may cancel the request if it does + /// not wish to wait any longer for the response. #[serde(rename="returnImmediately")] pub return_immediately: Option, - /// The maximum number of messages returned for this request. The Pub/Sub system may return fewer than the number specified. + /// The maximum number of messages returned for this request. The Pub/Sub + /// system may return fewer than the number specified. #[serde(rename="maxMessages")] pub max_messages: Option, } @@ -447,19 +524,42 @@ pub struct PullRequest { impl RequestValue for PullRequest {} -/// Associates `members` with a `role`. +/// Configuration for a push delivery endpoint. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Binding { - /// Role that is assigned to `members`. For example, `roles/viewer`, `roles/editor`, or `roles/owner`. Required - pub role: Option, - /// Specifies the identities requesting access for a Cloud Platform resource. `members` can have the following values: * `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account. * `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account. * `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@gmail.com` or `joe@example.com`. * `serviceAccount:{emailid}`: An email address that represents a service account. For example, `my-other-app@appspot.gserviceaccount.com`. * `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`. * `domain:{domain}`: A Google Apps domain name that represents all the users of that domain. For example, `google.com` or `example.com`. - pub members: Option>, +pub struct PushConfig { + /// Endpoint configuration attributes. + /// + /// Every endpoint has a set of API supported attributes that can be used to + /// control different aspects of the message delivery. + /// + /// The currently supported attribute is `x-goog-version`, which you can + /// use to change the format of the push message. This attribute + /// indicates the version of the data expected by the endpoint. This + /// controls the shape of the envelope (i.e. its fields and metadata). + /// The endpoint version is based on the version of the Pub/Sub + /// API. + /// + /// If not present during the `CreateSubscription` call, it will default to + /// the version of the API used to make such call. If not present during a + /// `ModifyPushConfig` call, its value will not be changed. `GetSubscription` + /// calls will always return a valid version, even if the subscription was + /// created without this attribute. + /// + /// The possible values for this attribute are: + /// + /// * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API. + /// * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API. + pub attributes: Option>, + /// A URL locating the endpoint to which messages should be pushed. + /// For example, a Webhook endpoint might use "https://example.com/push". + #[serde(rename="pushEndpoint")] + pub push_endpoint: Option, } -impl Part for Binding {} +impl Part for PushConfig {} /// A topic resource. @@ -474,7 +574,12 @@ impl Part for Binding {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Topic { - /// The name of the topic. It must have the format `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in length, and it must not start with `"goog"`. + /// The name of the topic. It must have the format + /// `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter, + /// and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), + /// underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent + /// signs (`%`). It must be between 3 and 255 characters in length, and it + /// must not start with `"goog"`. pub name: Option, } @@ -482,6 +587,45 @@ impl RequestValue for Topic {} impl ResponseResult for Topic {} +/// Associates `members` with a `role`. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Binding { + /// Role that is assigned to `members`. + /// For example, `roles/viewer`, `roles/editor`, or `roles/owner`. + /// Required + pub role: Option, + /// Specifies the identities requesting access for a Cloud Platform resource. + /// `members` can have the following values: + /// + /// * `allUsers`: A special identifier that represents anyone who is + /// on the internet; with or without a Google account. + /// + /// * `allAuthenticatedUsers`: A special identifier that represents anyone + /// who is authenticated with a Google account or a service account. + /// + /// * `user:{emailid}`: An email address that represents a specific Google + /// account. For example, `alice@gmail.com` or `joe@example.com`. + /// + /// + /// * `serviceAccount:{emailid}`: An email address that represents a service + /// account. For example, `my-other-app@appspot.gserviceaccount.com`. + /// + /// * `group:{emailid}`: An email address that represents a Google group. + /// For example, `admins@example.com`. + /// + /// * `domain:{domain}`: A Google Apps domain name that represents all the + /// users of that domain. For example, `google.com` or `example.com`. + /// + /// + pub members: Option>, +} + +impl Part for Binding {} + + /// Response for the `Publish` method. /// /// # Activities @@ -493,7 +637,9 @@ impl ResponseResult for Topic {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct PublishResponse { - /// The server-assigned ID of each published message, in the same order as the messages in the request. IDs are guaranteed to be unique within the topic. + /// The server-assigned ID of each published message, in the same order as + /// the messages in the request. IDs are guaranteed to be unique within + /// the topic. #[serde(rename="messageIds")] pub message_ids: Option>, } @@ -512,7 +658,10 @@ impl ResponseResult for PublishResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct PullResponse { - /// Received Pub/Sub messages. The Pub/Sub system will return zero messages if there are no more available in the backlog. The Pub/Sub system may return fewer than the `maxMessages` requested even if there are more messages available in the backlog. + /// Received Pub/Sub messages. The Pub/Sub system will return zero messages if + /// there are no more available in the backlog. The Pub/Sub system may return + /// fewer than the `maxMessages` requested even if there are more messages + /// available in the backlog. #[serde(rename="receivedMessages")] pub received_messages: Option>, } @@ -520,7 +669,8 @@ pub struct PullResponse { impl ResponseResult for PullResponse {} -/// A message data and its attributes. The message payload must not be empty; it must contain either a non-empty data field, or at least one attribute. +/// A message data and its attributes. The message payload must not be empty; +/// it must contain either a non-empty data field, or at least one attribute. /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -528,12 +678,18 @@ impl ResponseResult for PullResponse {} pub struct PubsubMessage { /// Optional attributes for this message. pub attributes: Option>, - /// The message payload. For JSON requests, the value of this field must be base64-encoded. + /// The message payload. For JSON requests, the value of this field must be + /// [base64-encoded](https://tools.ietf.org/html/rfc4648). pub data: Option, - /// The time at which the message was published, populated by the server when it receives the `Publish` call. It must not be populated by the publisher in a `Publish` call. + /// The time at which the message was published, populated by the server when + /// it receives the `Publish` call. It must not be populated by the + /// publisher in a `Publish` call. #[serde(rename="publishTime")] pub publish_time: Option, - /// ID of this message, assigned by the server when the message is published. Guaranteed to be unique within the topic. This value may be read by a subscriber that receives a `PubsubMessage` via a `Pull` call or a push delivery. It must not be populated by the publisher in a `Publish` call. + /// ID of this message, assigned by the server when the message is published. + /// Guaranteed to be unique within the topic. This value may be read by a + /// subscriber that receives a `PubsubMessage` via a `Pull` call or a push + /// delivery. It must not be populated by the publisher in a `Publish` call. #[serde(rename="messageId")] pub message_id: Option, } @@ -541,22 +697,6 @@ pub struct PubsubMessage { impl Part for PubsubMessage {} -/// Configuration for a push delivery endpoint. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct PushConfig { - /// Endpoint configuration attributes. Every endpoint has a set of API supported attributes that can be used to control different aspects of the message delivery. The currently supported attribute is `x-goog-version`, which you can use to change the format of the push message. This attribute indicates the version of the data expected by the endpoint. This controls the shape of the envelope (i.e. its fields and metadata). The endpoint version is based on the version of the Pub/Sub API. If not present during the `CreateSubscription` call, it will default to the version of the API used to make such call. If not present during a `ModifyPushConfig` call, its value will not be changed. `GetSubscription` calls will always return a valid version, even if the subscription was created without this attribute. The possible values for this attribute are: * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API. * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API. - pub attributes: Option>, - /// A URL locating the endpoint to which messages should be pushed. For example, a Webhook endpoint might use "https://example.com/push". - #[serde(rename="pushEndpoint")] - pub push_endpoint: Option, -} - -impl Part for PushConfig {} - - /// A subscription resource. /// /// # Activities @@ -569,15 +709,41 @@ impl Part for PushConfig {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Subscription { - /// The name of the topic from which this subscription is receiving messages. The value of this field will be `_deleted-topic_` if the topic has been deleted. + /// The name of the topic from which this subscription is receiving messages. + /// The value of this field will be `_deleted-topic_` if the topic has been + /// deleted. pub topic: Option, - /// This value is the maximum time after a subscriber receives a message before the subscriber should acknowledge the message. After message delivery but before the ack deadline expires and before the message is acknowledged, it is an outstanding message and will not be delivered again during that time (on a best-effort basis). For pull subscriptions, this value is used as the initial value for the ack deadline. To override this value for a given message, call `ModifyAckDeadline` with the corresponding `ack_id` if using pull. For push delivery, this value is also used to set the request timeout for the call to the push endpoint. If the subscriber never acknowledges the message, the Pub/Sub system will eventually redeliver the message. If this parameter is not set, the default value of 10 seconds is used. + /// This value is the maximum time after a subscriber receives a message + /// before the subscriber should acknowledge the message. After message + /// delivery but before the ack deadline expires and before the message is + /// acknowledged, it is an outstanding message and will not be delivered + /// again during that time (on a best-effort basis). + /// + /// For pull subscriptions, this value is used as the initial value for the ack + /// deadline. To override this value for a given message, call + /// `ModifyAckDeadline` with the corresponding `ack_id` if using pull. + /// The maximum custom deadline you can specify is 600 seconds (10 minutes). + /// + /// For push delivery, this value is also used to set the request timeout for + /// the call to the push endpoint. + /// + /// If the subscriber never acknowledges the message, the Pub/Sub + /// system will eventually redeliver the message. + /// + /// If this parameter is 0, a default value of 10 seconds is used. #[serde(rename="ackDeadlineSeconds")] pub ack_deadline_seconds: Option, - /// If push delivery is used with this subscription, this field is used to configure it. An empty `pushConfig` signifies that the subscriber will pull and ack messages using API methods. + /// If push delivery is used with this subscription, this field is + /// used to configure it. An empty `pushConfig` signifies that the subscriber + /// will pull and ack messages using API methods. #[serde(rename="pushConfig")] pub push_config: Option, - /// The name of the subscription. It must have the format `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must start with a letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in length, and it must not start with `"goog"`. + /// The name of the subscription. It must have the format + /// `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must + /// start with a letter, and contain only letters (`[A-Za-z]`), numbers + /// (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), + /// plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters + /// in length, and it must not start with `"goog"`. pub name: Option, } @@ -649,7 +815,10 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Pulls messages from the server. Returns an empty list if there are no messages available in the backlog. The server may return `UNAVAILABLE` if there are too many concurrent pull requests pending for the given subscription. + /// Pulls messages from the server. Returns an empty list if there are no + /// messages available in the backlog. The server may return `UNAVAILABLE` if + /// there are too many concurrent pull requests pending for the given + /// subscription. /// /// # Arguments /// @@ -673,7 +842,12 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `name` - The name of the topic. It must have the format `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in length, and it must not start with `"goog"`. + /// * `name` - The name of the topic. It must have the format + /// `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter, + /// and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), + /// underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent + /// signs (`%`). It must be between 3 and 255 characters in length, and it + /// must not start with `"goog"`. pub fn topics_create(&self, request: Topic, name: &str) -> ProjectTopicCreateCall<'a, C, A> { ProjectTopicCreateCall { hub: self.hub, @@ -692,7 +866,9 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `testIamPermissions` documentation. + /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. + /// `resource` is usually specified as a path. For example, a Project + /// resource is specified as `projects/{project}`. pub fn topics_test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> ProjectTopicTestIamPermissionCall<'a, C, A> { ProjectTopicTestIamPermissionCall { hub: self.hub, @@ -706,7 +882,12 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Modifies the `PushConfig` for a specified subscription. This may be used to change a push subscription to a pull one (signified by an empty `PushConfig`) or vice versa, or change the endpoint URL and other attributes of a push subscription. Messages will accumulate for delivery continuously through the call regardless of changes to the `PushConfig`. + /// Modifies the `PushConfig` for a specified subscription. + /// + /// This may be used to change a push subscription to a pull one (signified by + /// an empty `PushConfig`) or vice versa, or change the endpoint URL and other + /// attributes of a push subscription. Messages will accumulate for delivery + /// continuously through the call regardless of changes to the `PushConfig`. /// /// # Arguments /// @@ -725,7 +906,9 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic does not exist. The message payload must not be empty; it must contain either a non-empty data field, or at least one attribute. + /// Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic + /// does not exist. The message payload must not be empty; it must contain + /// either a non-empty data field, or at least one attribute. /// /// # Arguments /// @@ -761,11 +944,15 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets the access control policy for a `resource`. Returns an empty policy if the resource exists and does not have a policy set. + /// Gets the access control policy for a resource. + /// Returns an empty policy if the resource exists and does not have a policy + /// set. /// /// # Arguments /// - /// * `resource` - REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation. + /// * `resource` - REQUIRED: The resource for which the policy is being requested. + /// `resource` is usually specified as a path. For example, a Project + /// resource is specified as `projects/{project}`. pub fn topics_get_iam_policy(&self, resource: &str) -> ProjectTopicGetIamPolicyCall<'a, C, A> { ProjectTopicGetIamPolicyCall { hub: self.hub, @@ -778,7 +965,11 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Modifies the ack deadline for a specific message. This method is useful to indicate that more time is needed to process a message by the subscriber, or to make the message available for redelivery if the processing was interrupted. + /// Modifies the ack deadline for a specific message. This method is useful + /// to indicate that more time is needed to process a message by the + /// subscriber, or to make the message available for redelivery if the + /// processing was interrupted. Note that this does not modify the + /// subscription-level `ackDeadlineSeconds` used for subsequent messages. /// /// # Arguments /// @@ -797,7 +988,11 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Deletes an existing subscription. All pending messages in the subscription are immediately dropped. Calls to `Pull` after deletion will return `NOT_FOUND`. After a subscription is deleted, a new one may be created with the same name, but the new one has no association with the old subscription, or its topic unless the same topic is specified. + /// Deletes an existing subscription. All pending messages in the subscription + /// are immediately dropped. Calls to `Pull` after deletion will return + /// `NOT_FOUND`. After a subscription is deleted, a new one may be created with + /// the same name, but the new one has no association with the old + /// subscription, or its topic unless the same topic is specified. /// /// # Arguments /// @@ -814,12 +1009,15 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Sets the access control policy on the specified resource. Replaces any existing policy. + /// Sets the access control policy on the specified resource. Replaces any + /// existing policy. /// /// # Arguments /// /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `setIamPolicy` documentation. + /// * `resource` - REQUIRED: The resource for which the policy is being specified. + /// `resource` is usually specified as a path. For example, a Project + /// resource is specified as `projects/{project}`. pub fn topics_set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> ProjectTopicSetIamPolicyCall<'a, C, A> { ProjectTopicSetIamPolicyCall { hub: self.hub, @@ -833,12 +1031,23 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Creates a subscription to a given topic. If the subscription already exists, returns `ALREADY_EXISTS`. If the corresponding topic doesn't exist, returns `NOT_FOUND`. If the name is not provided in the request, the server will assign a random name for this subscription on the same project as the topic. + /// Creates a subscription to a given topic. + /// If the subscription already exists, returns `ALREADY_EXISTS`. + /// If the corresponding topic doesn't exist, returns `NOT_FOUND`. + /// + /// If the name is not provided in the request, the server will assign a random + /// name for this subscription on the same project as the topic. Note that + /// for REST API requests, you must specify a name. /// /// # Arguments /// /// * `request` - No description provided. - /// * `name` - The name of the subscription. It must have the format `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must start with a letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in length, and it must not start with `"goog"`. + /// * `name` - The name of the subscription. It must have the format + /// `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must + /// start with a letter, and contain only letters (`[A-Za-z]`), numbers + /// (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), + /// plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters + /// in length, and it must not start with `"goog"`. pub fn subscriptions_create(&self, request: Subscription, name: &str) -> ProjectSubscriptionCreateCall<'a, C, A> { ProjectSubscriptionCreateCall { hub: self.hub, @@ -852,7 +1061,13 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Acknowledges the messages associated with the `ack_ids` in the `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages from the subscription. Acknowledging a message whose ack deadline has expired may succeed, but such a message may be redelivered later. Acknowledging a message more than once will not result in an error. + /// Acknowledges the messages associated with the `ack_ids` in the + /// `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages + /// from the subscription. + /// + /// Acknowledging a message whose ack deadline has expired may succeed, + /// but such a message may be redelivered later. Acknowledging a message more + /// than once will not result in an error. /// /// # Arguments /// @@ -871,11 +1086,15 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets the access control policy for a `resource`. Returns an empty policy if the resource exists and does not have a policy set. + /// Gets the access control policy for a resource. + /// Returns an empty policy if the resource exists and does not have a policy + /// set. /// /// # Arguments /// - /// * `resource` - REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation. + /// * `resource` - REQUIRED: The resource for which the policy is being requested. + /// `resource` is usually specified as a path. For example, a Project + /// resource is specified as `projects/{project}`. pub fn subscriptions_get_iam_policy(&self, resource: &str) -> ProjectSubscriptionGetIamPolicyCall<'a, C, A> { ProjectSubscriptionGetIamPolicyCall { hub: self.hub, @@ -893,7 +1112,9 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `testIamPermissions` documentation. + /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. + /// `resource` is usually specified as a path. For example, a Project + /// resource is specified as `projects/{project}`. pub fn subscriptions_test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> ProjectSubscriptionTestIamPermissionCall<'a, C, A> { ProjectSubscriptionTestIamPermissionCall { hub: self.hub, @@ -907,7 +1128,11 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Deletes the topic with the given name. Returns `NOT_FOUND` if the topic does not exist. After a topic is deleted, a new topic may be created with the same name; this is an entirely new topic with none of the old configuration or subscriptions. Existing subscriptions to this topic are not deleted, but their `topic` field is set to `_deleted-topic_`. + /// Deletes the topic with the given name. Returns `NOT_FOUND` if the topic + /// does not exist. After a topic is deleted, a new topic may be created with + /// the same name; this is an entirely new topic with none of the old + /// configuration or subscriptions. Existing subscriptions to this topic are + /// not deleted, but their `topic` field is set to `_deleted-topic_`. /// /// # Arguments /// @@ -979,12 +1204,15 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Sets the access control policy on the specified resource. Replaces any existing policy. + /// Sets the access control policy on the specified resource. Replaces any + /// existing policy. /// /// # Arguments /// /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `setIamPolicy` documentation. + /// * `resource` - REQUIRED: The resource for which the policy is being specified. + /// `resource` is usually specified as a path. For example, a Project + /// resource is specified as `projects/{project}`. pub fn subscriptions_set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> ProjectSubscriptionSetIamPolicyCall<'a, C, A> { ProjectSubscriptionSetIamPolicyCall { hub: self.hub, @@ -1202,7 +1430,9 @@ impl<'a, C, A> ProjectTopicListCall<'a, C, A> where C: BorrowMut, self._project = new_value.to_string(); self } - /// The value returned by the last `ListTopicsResponse`; indicates that this is a continuation of a prior `ListTopics` call, and that the system should return the next page of data. + /// The value returned by the last `ListTopicsResponse`; indicates that this is + /// a continuation of a prior `ListTopics` call, and that the system should + /// return the next page of data. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> ProjectTopicListCall<'a, C, A> { @@ -1274,7 +1504,10 @@ impl<'a, C, A> ProjectTopicListCall<'a, C, A> where C: BorrowMut, } -/// Pulls messages from the server. Returns an empty list if there are no messages available in the backlog. The server may return `UNAVAILABLE` if there are too many concurrent pull requests pending for the given subscription. +/// Pulls messages from the server. Returns an empty list if there are no +/// messages available in the backlog. The server may return `UNAVAILABLE` if +/// there are too many concurrent pull requests pending for the given +/// subscription. /// /// A builder for the *subscriptions.pull* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -1758,7 +1991,12 @@ impl<'a, C, A> ProjectTopicCreateCall<'a, C, A> where C: BorrowMut ProjectTopicTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectTopicTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectSubscriptionModifyPushConfigCall<'a, C, A> where C: Borrow } -/// Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic does not exist. The message payload must not be empty; it must contain either a non-empty data field, or at least one attribute. +/// Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic +/// does not exist. The message payload must not be empty; it must contain +/// either a non-empty data field, or at least one attribute. /// /// A builder for the *topics.publish* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -2899,7 +3146,9 @@ impl<'a, C, A> ProjectTopicGetCall<'a, C, A> where C: BorrowMut, } -/// Gets the access control policy for a `resource`. Returns an empty policy if the resource exists and does not have a policy set. +/// Gets the access control policy for a resource. +/// Returns an empty policy if the resource exists and does not have a policy +/// set. /// /// A builder for the *topics.getIamPolicy* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -3076,7 +3325,9 @@ impl<'a, C, A> ProjectTopicGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectTopicGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> where C: Borro } -/// Deletes an existing subscription. All pending messages in the subscription are immediately dropped. Calls to `Pull` after deletion will return `NOT_FOUND`. After a subscription is deleted, a new one may be created with the same name, but the new one has no association with the old subscription, or its topic unless the same topic is specified. +/// Deletes an existing subscription. All pending messages in the subscription +/// are immediately dropped. Calls to `Pull` after deletion will return +/// `NOT_FOUND`. After a subscription is deleted, a new one may be created with +/// the same name, but the new one has no association with the old +/// subscription, or its topic unless the same topic is specified. /// /// A builder for the *subscriptions.delete* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -3665,7 +3924,8 @@ impl<'a, C, A> ProjectSubscriptionDeleteCall<'a, C, A> where C: BorrowMut ProjectTopicSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectTopicSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectSubscriptionCreateCall<'a, C, A> where C: BorrowMut ProjectSubscriptionCreateCall<'a, C, A> where C: BorrowMut ProjectSubscriptionAcknowledgeCall<'a, C, A> where C: BorrowMut ProjectSubscriptionGetIamPolicyCall<'a, C, A> where C: BorrowMut< } - /// REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation. + /// REQUIRED: The resource for which the policy is being requested. + /// `resource` is usually specified as a path. For example, a Project + /// resource is specified as `projects/{project}`. /// /// Sets the *resource* path property to the given value. /// @@ -4946,7 +5229,9 @@ impl<'a, C, A> ProjectSubscriptionTestIamPermissionCall<'a, C, A> where C: Borro self._request = new_value; self } - /// REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `testIamPermissions` documentation. + /// REQUIRED: The resource for which the policy detail is being requested. + /// `resource` is usually specified as a path. For example, a Project + /// resource is specified as `projects/{project}`. /// /// Sets the *resource* path property to the given value. /// @@ -5014,7 +5299,11 @@ impl<'a, C, A> ProjectSubscriptionTestIamPermissionCall<'a, C, A> where C: Borro } -/// Deletes the topic with the given name. Returns `NOT_FOUND` if the topic does not exist. After a topic is deleted, a new topic may be created with the same name; this is an entirely new topic with none of the old configuration or subscriptions. Existing subscriptions to this topic are not deleted, but their `topic` field is set to `_deleted-topic_`. +/// Deletes the topic with the given name. Returns `NOT_FOUND` if the topic +/// does not exist. After a topic is deleted, a new topic may be created with +/// the same name; this is an entirely new topic with none of the old +/// configuration or subscriptions. Existing subscriptions to this topic are +/// not deleted, but their `topic` field is set to `_deleted-topic_`. /// /// A builder for the *topics.delete* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -5701,7 +5990,9 @@ impl<'a, C, A> ProjectTopicSubscriptionListCall<'a, C, A> where C: BorrowMut ProjectTopicSubscriptionListCall<'a, C, A> { @@ -5970,7 +6261,9 @@ impl<'a, C, A> ProjectSubscriptionListCall<'a, C, A> where C: BorrowMut ProjectSubscriptionListCall<'a, C, A> { @@ -6042,7 +6335,8 @@ impl<'a, C, A> ProjectSubscriptionListCall<'a, C, A> where C: BorrowMut ProjectSubscriptionSetIamPolicyCall<'a, C, A> where C: BorrowMut< self._request = new_value; self } - /// REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `setIamPolicy` documentation. + /// REQUIRED: The resource for which the policy is being specified. + /// `resource` is usually specified as a path. For example, a Project + /// resource is specified as `projects/{project}`. /// /// Sets the *resource* path property to the given value. /// diff --git a/gen/replicapoolupdater1_beta1-cli/Cargo.toml b/gen/replicapoolupdater1_beta1-cli/Cargo.toml index a22a2b5a7f..bc59fe152a 100644 --- a/gen/replicapoolupdater1_beta1-cli/Cargo.toml +++ b/gen/replicapoolupdater1_beta1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-replicapoolupdater1_beta1-cli" -version = "1.0.0+20160229" +version = "1.0.0+20161003" authors = ["Sebastian Thiel "] description = "A complete library to interact with replicapoolupdater (protocol v1beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/replicapoolupdater1_beta1-cli" diff --git a/gen/replicapoolupdater1_beta1-cli/README.md b/gen/replicapoolupdater1_beta1-cli/README.md index 71ac99b0ad..cea23a0ca2 100644 --- a/gen/replicapoolupdater1_beta1-cli/README.md +++ b/gen/replicapoolupdater1_beta1-cli/README.md @@ -24,7 +24,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *replicapoolupdater* API at revision *20160229*. The CLI is at version *1.0.0*. +This documentation was generated from the *replicapoolupdater* API at revision *20161003*. The CLI is at version *1.0.0*. ```bash replicapoolupdater1-beta1 [options] diff --git a/gen/replicapoolupdater1_beta1-cli/mkdocs.yml b/gen/replicapoolupdater1_beta1-cli/mkdocs.yml index e7024927c7..2ff9f402e5 100644 --- a/gen/replicapoolupdater1_beta1-cli/mkdocs.yml +++ b/gen/replicapoolupdater1_beta1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: replicapoolupdater v1.0.0+20160229 +site_name: replicapoolupdater v1.0.0+20161003 site_url: http://byron.github.io/google-apis-rs/google-replicapoolupdater1_beta1-cli site_description: Write integrating applications with bcore diff --git a/gen/replicapoolupdater1_beta1-cli/src/main.rs b/gen/replicapoolupdater1_beta1-cli/src/main.rs index 20dc68b745..3b5ab4e6b7 100644 --- a/gen/replicapoolupdater1_beta1-cli/src/main.rs +++ b/gen/replicapoolupdater1_beta1-cli/src/main.rs @@ -1117,8 +1117,8 @@ fn main() { let mut app = App::new("replicapoolupdater1-beta1") .author("Sebastian Thiel ") - .version("1.0.0+20160229") - .about("Updates groups of Compute Engine instances.") + .version("1.0.0+20161003") + .about("[Deprecated. Please use compute.instanceGroupManagers.update method. replicapoolupdater API will be disabled after December 30th, 2016] Updates groups of Compute Engine instances.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_replicapoolupdater1_beta1_cli") .arg(Arg::with_name("url") .long("scope") diff --git a/gen/replicapoolupdater1_beta1/Cargo.toml b/gen/replicapoolupdater1_beta1/Cargo.toml index 4dee9a547c..23c8492865 100644 --- a/gen/replicapoolupdater1_beta1/Cargo.toml +++ b/gen/replicapoolupdater1_beta1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-replicapoolupdater1_beta1" -version = "1.0.0+20160229" +version = "1.0.0+20161003" authors = ["Sebastian Thiel "] description = "A complete library to interact with replicapoolupdater (protocol v1beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/replicapoolupdater1_beta1" diff --git a/gen/replicapoolupdater1_beta1/README.md b/gen/replicapoolupdater1_beta1/README.md index d5027ca9bd..86a5960c2c 100644 --- a/gen/replicapoolupdater1_beta1/README.md +++ b/gen/replicapoolupdater1_beta1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-replicapoolupdater1_beta1` library allows access to all features of the *Google replicapoolupdater* service. -This documentation was generated from *replicapoolupdater* crate version *1.0.0+20160229*, where *20160229* is the exact revision of the *replicapoolupdater:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +This documentation was generated from *replicapoolupdater* crate version *1.0.0+20161003*, where *20161003* is the exact revision of the *replicapoolupdater:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. Everything else about the *replicapoolupdater* *v1_beta1* API can be found at the [official documentation site](https://cloud.google.com/compute/docs/instance-groups/manager/#applying_rolling_updates_using_the_updater_service). diff --git a/gen/replicapoolupdater1_beta1/src/lib.rs b/gen/replicapoolupdater1_beta1/src/lib.rs index ad1b66da64..d06c15e9dc 100644 --- a/gen/replicapoolupdater1_beta1/src/lib.rs +++ b/gen/replicapoolupdater1_beta1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *replicapoolupdater* crate version *1.0.0+20160229*, where *20160229* is the exact revision of the *replicapoolupdater:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! This documentation was generated from *replicapoolupdater* crate version *1.0.0+20161003*, where *20161003* is the exact revision of the *replicapoolupdater:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. //! //! Everything else about the *replicapoolupdater* *v1_beta1* API can be found at the //! [official documentation site](https://cloud.google.com/compute/docs/instance-groups/manager/#applying_rolling_updates_using_the_updater_service). diff --git a/gen/slides1-cli/Cargo.toml b/gen/slides1-cli/Cargo.toml new file mode 100644 index 0000000000..2ecf47774b --- /dev/null +++ b/gen/slides1-cli/Cargo.toml @@ -0,0 +1,43 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-slides1-cli" +version = "1.0.0+20161213" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Slides (protocol v1)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/slides1-cli" +homepage = "https://developers.google.com/slides/" +documentation = "http://byron.github.io/google-apis-rs/google_slides1_cli" +license = "MIT" +keywords = ["slides", "google", "cli"] + +[[bin]] +name = "slides1" + +[dependencies] +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.8" +serde_json = "^ 0.8" +yup-oauth2 = { version = "^ 1.0", optional = true, default-features = false } +serde_derive = { version = "^ 0.8", optional = true } +strsim = "^0.5" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-serde-codegen"] +nightly = ["serde_derive","yup-oauth2/nightly","google-slides1/nightly"] +with-serde-codegen = ["serde_codegen","yup-oauth2/with-serde-codegen","google-slides1/with-serde-codegen"] + +[build-dependencies] +serde_codegen = { version = "^ 0.8", optional = true } + + +[dependencies.google-slides1] +path = "../slides1" +version = "1.0.0" +optional = true +default-features = false diff --git a/gen/slides1-cli/LICENSE.md b/gen/slides1-cli/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/slides1-cli/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/slides1-cli/README.md b/gen/slides1-cli/README.md new file mode 100644 index 0000000000..c251e7f17b --- /dev/null +++ b/gen/slides1-cli/README.md @@ -0,0 +1,116 @@ + +The `slides1` command-line interface *(CLI)* allows to use most features of the *Google Slides* service from the comfort of your terminal. + +By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's +capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero. + +If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. + +Everything else about the *Slides* API can be found at the +[official documentation site](https://developers.google.com/slides/). + +# Downloads + +You can download the pre-compiled 64bit binaries for the following platforms: + +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/1.0.0/ubuntu/slides1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/1.0.0/osx/slides1.tar.gz) + +Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/slides1-cli). + +# Usage + +This documentation was generated from the *Slides* API at revision *20161213*. The CLI is at version *1.0.0*. + +```bash +slides1 [options] + presentations + batch-update (-r )... [-p ]... [-o ] + create (-r )... [-p ]... [-o ] + get [-p ]... [-o ] + pages-get [-p ]... [-o ] + slides1 --help + +Configuration: + [--scope ]... + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. + If unset, it defaults to the shortest scope url for a particular method. + --config-dir + A directory into which we will store our persistent data. Defaults to + a user-writable directory that we will create during the first invocation. + [default: ~/.google-service-cli] + --debug + Output all server communication to standard error. `tx` and `rx` are placed + into the same stream. + --debug-auth + Output all communication related to authentication to standard error. `tx` + and `rx` are placed into the same stream. + +``` + +# Configuration + +The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `slides1-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis. + +More information about the various kinds of persistent data are given in the following paragraphs. + +# Authentication + +Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the +set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*. + +If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a +method that is read-only, it will ask only for a read-only scope. +You may use the `--scope` flag to specify a scope directly. +All applicable scopes are documented in the respective method's CLI documentation. + +The first time a scope is used, the user is asked for permission. Follow the instructions given +by the CLI to grant permissions, or to decline. + +If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration +directory, e.g. `~/.google-service-cli/slides1-token-.json`. No manual management of these tokens +is necessary. + +To revoke granted authentication, please refer to the [official documentation][revoke-access]. + +# Application Secrets + +In order to allow any application to use Google services, it will need to be registered using the +[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it +one by one. Most APIs can be used for free and have a daily quota. + +To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI +comes with a default application secret that is configured accordingly. This also means that heavy usage +all around the world may deplete the daily quota. + +You can workaround this limitation by putting your own secrets file at this location: +`~/.google-service-cli/slides1-secret.json`, assuming that the required *slides* API +was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at +*APIs & auth -> Credentials -> Download JSON* and used as is. + +Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new]. + + +# Debugging + +Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know +what exactly led to a particular issue. This is done by allowing all client-server communication to be +output to standard error *as-is*. + +The `--debug` flag will print all client-server communication to standard error, whereas the `--debug-auth` flag +will cause all communication related to authentication to standard error. +If the `--debug` flag is set, error-results will be debug-printed, possibly yielding more information about the +issue at hand. + +You may consider redirecting standard error into a file for ease of use, e.g. `slides1 --debug [options] 2>debug.txt`. + + +[scopes]: https://developers.google.com/+/api/oauth#scopes +[revoke-access]: http://webapps.stackexchange.com/a/30849 +[google-dev-console]: https://console.developers.google.com/ +[google-project-new]: https://developers.google.com/console/help/new/ \ No newline at end of file diff --git a/gen/slides1-cli/mkdocs.yml b/gen/slides1-cli/mkdocs.yml new file mode 100644 index 0000000000..9199218eef --- /dev/null +++ b/gen/slides1-cli/mkdocs.yml @@ -0,0 +1,20 @@ +site_name: Slides v1.0.0+20161213 +site_url: http://byron.github.io/google-apis-rs/google-slides1-cli +site_description: Write integrating applications with bcore + +repo_url: https://github.com/Byron/google-apis-rs/tree/master/gen/slides1-cli + +docs_dir: docs +site_dir: build_html + +pages: +- ['index.md', 'Home'] +- ['presentations_batch-update.md', 'Presentations', 'Batch Update'] +- ['presentations_create.md', 'Presentations', 'Create'] +- ['presentations_get.md', 'Presentations', 'Get'] +- ['presentations_pages-get.md', 'Presentations', 'Pages Get'] + +theme: readthedocs + +copyright: Copyright © 2015-2016, `Sebastian Thiel` + diff --git a/gen/slides1-cli/src/cmn.rs b/gen/slides1-cli/src/cmn.rs new file mode 100644 index 0000000000..779c1dc086 --- /dev/null +++ b/gen/slides1-cli/src/cmn.rs @@ -0,0 +1,721 @@ +// COPY OF 'src/rust/cli/cmn.rs' +// DO NOT EDIT +use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token}; +use serde_json as json; +use serde_json::value::Value; +use mime::Mime; +use clap::{App, SubCommand}; +use strsim; + +use std::fs; +use std::env; +use std::io; +use std::fmt; +use std::path::{Path, PathBuf}; +use std::str::FromStr; +use std::string::ToString; +use std::io::{Write, Read, stdout}; + +use std::default::Default; + +const FIELD_SEP: char = '.'; + + +pub enum ComplexType { + Pod, + Vec, + Map, +} + + // Null, + // Bool(bool), + // I64(i64), + // U64(u64), + // F64(f64), + // String(String), + +pub enum JsonType { + Boolean, + Int, + Uint, + Float, + String, +} + +pub struct JsonTypeInfo { + pub jtype: JsonType, + pub ctype: ComplexType, +} + +// Based on @erickt user comment. Thanks for the idea ! +// Remove all keys whose values are null from given value (changed in place) +pub fn remove_json_null_values(value: &mut Value) { + match *value { + Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} + +fn did_you_mean<'a>(v: &str, possible_values: &[&'a str]) -> Option<&'a str> { + + let mut candidate: Option<(f64, &str)> = None; + for pv in possible_values { + let confidence = strsim::jaro_winkler(v, pv); + if confidence > 0.8 && (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { + candidate = Some((confidence, pv)); + } + } + match candidate { + None => None, + Some((_, candidate)) => Some(candidate), + } +} + +pub enum CallType { + Upload(UploadProtocol), + Standard, +} + +arg_enum!{ + pub enum UploadProtocol { + Simple, + Resumable + } +} + +impl AsRef for UploadProtocol { + fn as_ref(&self) -> &str { + match *self { + UploadProtocol::Simple => "simple", + UploadProtocol::Resumable => "resumable" + } + } +} + +impl AsRef for CallType { + fn as_ref(&self) -> &str { + match *self { + CallType::Upload(ref proto) => proto.as_ref(), + CallType::Standard => "standard-request" + } + } +} + +#[derive(Clone, Default)] +pub struct FieldCursor(Vec); + +impl ToString for FieldCursor { + fn to_string(&self) -> String { + self.0.join(".") + } +} + +impl From<&'static str> for FieldCursor { + fn from(value: &'static str) -> FieldCursor { + let mut res = FieldCursor::default(); + res.set(value).unwrap(); + res + } +} + +impl FieldCursor { + pub fn set(&mut self, value: &str) -> Result<(), CLIError> { + if value.len() == 0 { + return Err(CLIError::Field(FieldError::Empty)) + } + + let mut first_is_field_sep = false; + let mut char_count: usize = 0; + let mut last_c = FIELD_SEP; + let mut num_conscutive_field_seps = 0; + + let mut field = String::new(); + let mut fields = self.0.clone(); + + let push_field = |fs: &mut Vec, f: &mut String| { + if f.len() > 0 { + fs.push(f.clone()); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + char_count += 1; + + if c == FIELD_SEP { + if cid == 0 { + first_is_field_sep = true; + } + num_conscutive_field_seps += 1; + if cid > 0 && last_c == FIELD_SEP { + if fields.pop().is_none() { + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))) + } + } else { + push_field(&mut fields, &mut field); + } + } else { + num_conscutive_field_seps = 0; + if cid == 1 { + if first_is_field_sep { + fields.truncate(0); + } + } + field.push(c); + } + + last_c = c; + } + + push_field(&mut fields, &mut field); + + if char_count == 1 && first_is_field_sep { + fields.truncate(0); + } + if char_count > 1 && num_conscutive_field_seps == 1 { + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + } + + self.0 = fields; + Ok(()) + } + + pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { + if value.len() == 0 { + return None + } + + let mut last_c = FIELD_SEP; + + let mut field = String::new(); + let mut output = String::new(); + + let push_field = |fs: &mut String, f: &mut String| { + if f.len() > 0 { + fs.push_str( + match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + if c == FIELD_SEP { + if last_c != FIELD_SEP { + push_field(&mut output, &mut field); + } + output.push(c); + } else { + field.push(c); + } + + last_c = c; + } + + push_field(&mut output, &mut field); + + if &output == value { + None + } else { + Some(output) + } + } + + pub fn set_json_value(&self, mut object: &mut Value, + value: &str, type_info: JsonTypeInfo, + err: &mut InvalidOptionsError, + orig_cursor: &FieldCursor) { + assert!(self.0.len() > 0); + + for field in &self.0[..self.0.len()-1] { + let tmp = object; + object = + match *tmp { + Value::Object(ref mut mapping) => { + mapping.entry(field.to_owned()).or_insert( + Value::Object(Default::default()) + ) + }, + _ => panic!("We don't expect non-object Values here ...") + }; + } + + match *object { + Value::Object(ref mut mapping) => { + let field = &self.0[self.0.len()-1]; + let to_jval = + |value: &str, jtype: JsonType, err: &mut InvalidOptionsError| + -> Value { + match jtype { + JsonType::Boolean => + Value::Bool(arg_from_str(value, err, &field, "boolean")), + JsonType::Int => + Value::I64(arg_from_str(value, err, &field, "int")), + JsonType::Uint => + Value::U64(arg_from_str(value, err, &field, "uint")), + JsonType::Float => + Value::F64(arg_from_str(value, err, &field, "float")), + JsonType::String => + Value::String(value.to_owned()), + } + }; + + match type_info.ctype { + ComplexType::Pod => { + if mapping.insert(field.to_owned(), to_jval(value, type_info.jtype, err)).is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + }, + ComplexType::Vec => { + match *mapping.entry(field.to_owned()) + .or_insert(Value::Array(Default::default())) { + Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), + _ => unreachable!() + } + }, + ComplexType::Map => { + let (key, value) = parse_kv_arg(value, err, true); + let jval = to_jval(value.unwrap_or(""), type_info.jtype, err); + + match *mapping.entry(field.to_owned()) + .or_insert(Value::Object(Default::default())) { + Value::Object(ref mut value_map) => { + if value_map.insert(key.to_owned(), jval).is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + _ => unreachable!() + } + } + } + }, + _ => unreachable!() + } + } + + pub fn num_fields(&self) -> usize { + self.0.len() + } +} + +pub fn parse_kv_arg<'a>(kv: &'a str, err: &mut InvalidOptionsError, for_hashmap: bool) + -> (&'a str, Option<&'a str>) { + let mut add_err = || err.issues.push(CLIError::InvalidKeyValueSyntax(kv.to_string(),for_hashmap)); + match kv.find('=') { + None => { + add_err(); + return (kv, None) + }, + Some(pos) => { + let key = &kv[..pos]; + if kv.len() <= pos + 1 { + add_err(); + return (key, Some("")) + } + (key, Some(&kv[pos+1..])) + } + } +} + +pub fn calltype_from_str(name: &str, valid_protocols: Vec, err: &mut InvalidOptionsError) -> CallType { + CallType::Upload( + match UploadProtocol::from_str(name) { + Ok(up) => up, + Err(msg) => { + err.issues.push(CLIError::InvalidUploadProtocol(name.to_string(), valid_protocols)); + UploadProtocol::Simple + } + }) +} + +pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> Option { + match fs::File::open(file_path) { + Ok(f) => Some(f), + Err(io_err) => { + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); + None + } + } +} + +pub fn input_mime_from_opts(mime: &str, err: &mut InvalidOptionsError) -> Option { + match mime.parse() { + Ok(m) => Some(m), + Err(_) => { + err.issues.push(CLIError::Input(InputError::Mime(mime.to_string()))); + None + } + } +} + +pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { + let f = arg.unwrap_or("-"); + match f { + "-" => Ok(Box::new(stdout())), + _ => match fs::OpenOptions::new().create(true).write(true).open(f) { + Ok(f) => Ok(Box::new(f)), + Err(io_err) => Err(io_err), + } + } +} + + +pub fn arg_from_str<'a, T>(arg: &str, err: &mut InvalidOptionsError, + arg_name: &'a str, + arg_type: &'a str) -> T + where T: FromStr + Default, + ::Err: fmt::Display { + match FromStr::from_str(arg) { + Err(perr) => { + err.issues.push( + CLIError::ParseError(arg_name.to_owned(), arg_type.to_owned(), arg.to_string(), format!("{}", perr)) + ); + Default::default() + }, + Ok(v) => v, + } +} + +pub struct JsonTokenStorage { + pub program_name: &'static str, + pub db_dir: String, +} + +impl JsonTokenStorage { + fn path(&self, scope_hash: u64) -> PathBuf { + Path::new(&self.db_dir).join(&format!("{}-token-{}.json", self.program_name, scope_hash)) + } +} + +impl TokenStorage for JsonTokenStorage { + type Error = json::Error; + + // NOTE: logging might be interesting, currently we swallow all errors + fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), json::Error> { + match token { + None => { + match fs::remove_file(self.path(scope_hash)) { + Err(err) => + match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(json::Error::Io(err)) + }, + Ok(_) => Ok(()), + } + } + Some(token) => { + match fs::OpenOptions::new().create(true).write(true).open(&self.path(scope_hash)) { + Ok(mut f) => { + match json::to_writer_pretty(&mut f, &token) { + Ok(_) => Ok(()), + Err(serde_err) => Err(serde_err), + } + }, + Err(io_err) => Err(json::Error::Io(io_err)) + } + } + } + } + + fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result, json::Error> { + match fs::File::open(&self.path(scope_hash)) { + Ok(f) => { + match json::de::from_reader(f) { + Ok(token) => Ok(Some(token)), + Err(err) => Err(err), + } + }, + Err(io_err) => { + match io_err.kind() { + io::ErrorKind::NotFound => Ok(None), + _ => Err(json::Error::Io(io_err)) + } + } + } + } +} + + +#[derive(Debug)] +pub enum ApplicationSecretError { + DecoderError((String, json::Error)), + FormatError(String), +} + +impl fmt::Display for ApplicationSecretError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ApplicationSecretError::DecoderError((ref path, ref err)) + => writeln!(f, "Could not decode file at '{}' with error: {}.", + path, err), + ApplicationSecretError::FormatError(ref path) + => writeln!(f, "'installed' field is unset in secret file at '{}'.", + path), + } + } +} + +#[derive(Debug)] +pub enum ConfigurationError { + DirectoryCreationFailed((String, io::Error)), + DirectoryUnset, + HomeExpansionFailed(String), + Secret(ApplicationSecretError), + Io((String, io::Error)), +} + +impl fmt::Display for ConfigurationError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ConfigurationError::DirectoryCreationFailed((ref dir, ref err)) + => writeln!(f, "Directory '{}' could not be created with error: {}.", dir, err), + ConfigurationError::DirectoryUnset + => writeln!(f, "--config-dir was unset or empty."), + ConfigurationError::HomeExpansionFailed(ref dir) + => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), + ConfigurationError::Secret(ref err) + => writeln!(f, "Secret -> {}", err), + ConfigurationError::Io((ref path, ref err)) + => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + } + } +} + +#[derive(Debug)] +pub enum InputError { + Io((String, io::Error)), + Mime(String), +} + +impl fmt::Display for InputError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + InputError::Io((ref file_path, ref io_err)) + => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), + InputError::Mime(ref mime) + => writeln!(f, "'{}' is not a known mime-type.", mime), + } + } +} + +#[derive(Debug)] +pub enum FieldError { + PopOnEmpty(String), + TrailingFieldSep(String), + Unknown(String, Option, Option), + Duplicate(String), + Empty, +} + + +impl fmt::Display for FieldError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + FieldError::PopOnEmpty(ref field) + => writeln!(f, "'{}': Cannot move up on empty field cursor.", field), + FieldError::TrailingFieldSep(ref field) + => writeln!(f, "'{}': Single field separator may not be last character.", field), + FieldError::Unknown(ref field, ref suggestion, ref value) => { + let suffix = + match *suggestion { + Some(ref s) => { + let kv = + match *value { + Some(ref v) => format!("{}={}", s, v), + None => s.clone(), + }; + format!(" Did you mean '{}' ?", kv) + }, + None => String::new(), + }; + writeln!(f, "Field '{}' does not exist.{}", field, suffix) + }, + FieldError::Duplicate(ref cursor) + => writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty + => writeln!(f, "Field names must not be empty."), + } + } +} + + +#[derive(Debug)] +pub enum CLIError { + Configuration(ConfigurationError), + ParseError(String, String, String, String), + UnknownParameter(String, Vec<&'static str>), + InvalidUploadProtocol(String, Vec), + InvalidKeyValueSyntax(String, bool), + Input(InputError), + Field(FieldError), + MissingCommandError, + MissingMethodError(String), +} + +impl fmt::Display for CLIError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + CLIError::Configuration(ref err) => write!(f, "Configuration -> {}", err), + CLIError::Input(ref err) => write!(f, "Input -> {}", err), + CLIError::Field(ref err) => write!(f, "Field -> {}", err), + CLIError::InvalidUploadProtocol(ref proto_name, ref valid_names) + => writeln!(f, "'{}' is not a valid upload protocol. Choose from one of {}.", proto_name, valid_names.join(", ")), + CLIError::ParseError(ref arg_name, ref type_name, ref value, ref err_desc) + => writeln!(f, "Failed to parse argument '{}' with value '{}' as {} with error: {}.", + arg_name, value, type_name, err_desc), + CLIError::UnknownParameter(ref param_name, ref possible_values) => { + let suffix = + match did_you_mean(param_name, &possible_values) { + Some(v) => format!(" Did you mean '{}' ?", v), + None => String::new(), + }; + write!(f, "Parameter '{}' is unknown.{}\n", param_name, suffix) + }, + CLIError::InvalidKeyValueSyntax(ref kv, is_hashmap) => { + let hashmap_info = if is_hashmap { "hashmap " } else { "" }; + writeln!(f, "'{}' does not match {}pattern =.", kv, hashmap_info) + }, + CLIError::MissingCommandError => writeln!(f, "Please specify the main sub-command."), + CLIError::MissingMethodError(ref cmd) => writeln!(f, "Please specify the method to call on the '{}' command.", cmd), + } + } +} + +#[derive(Debug)] +pub struct InvalidOptionsError { + pub issues: Vec, + pub exit_code: i32, +} + +impl fmt::Display for InvalidOptionsError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + for issue in &self.issues { + try!(issue.fmt(f)); + } + Ok(()) + } +} + +impl InvalidOptionsError { + pub fn single(err: CLIError, exit_code: i32) -> InvalidOptionsError { + InvalidOptionsError { + issues: vec![err], + exit_code: exit_code, + } + } + + pub fn new() -> InvalidOptionsError { + InvalidOptionsError { + issues: Vec::new(), + exit_code: 1, + } + } +} + +pub fn assure_config_dir_exists(dir: &str) -> Result { + let trdir = dir.trim(); + if trdir.len() == 0 { + return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + } + + let expanded_config_dir = + if trdir.as_bytes()[0] == b'~' { + match env::var("HOME").ok().or(env::var("UserProfile").ok()) { + None => return Err(CLIError::Configuration(ConfigurationError::HomeExpansionFailed(trdir.to_string()))), + Some(mut user) => { + user.push_str(&trdir[1..]); + user + } + } + } else { + trdir.to_string() + }; + + if let Err(err) = fs::create_dir(&expanded_config_dir) { + if err.kind() != io::ErrorKind::AlreadyExists { + return Err(CLIError::Configuration( + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))) + } + } + + Ok(expanded_config_dir) +} + +pub fn application_secret_from_directory(dir: &str, + secret_basename: &str, + json_console_secret: &str) + -> Result { + let secret_path = Path::new(dir).join(secret_basename); + let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); + let secret_io_error = |io_err: io::Error| { + Err(CLIError::Configuration(ConfigurationError::Io( + (secret_str(), io_err) + ))) + }; + + for _ in 0..2 { + match fs::File::open(&secret_path) { + Err(mut err) => { + if err.kind() == io::ErrorKind::NotFound { + // Write our built-in one - user may adjust the written file at will + + err = match fs::OpenOptions::new().create(true).write(true).open(&secret_path) { + Err(cfe) => cfe, + Ok(mut f) => { + // Assure we convert 'ugly' json string into pretty one + let console_secret: ConsoleApplicationSecret + = json::from_str(json_console_secret).unwrap(); + match json::to_writer_pretty(&mut f, &console_secret) { + Err(serde_err) => match serde_err { + json::Error::Io(err) => err, + _ => panic!("Unexpected serde error: {:#?}", serde_err) + }, + Ok(_) => continue, + } + } + }; + // fall through to IO error handling + } + return secret_io_error(err) + }, + Ok(f) => { + match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { + Err(json::Error::Io(err)) => + return secret_io_error(err), + Err(json_err) => + return Err(CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::DecoderError( + (secret_str(), json_err) + )))), + Ok(console_secret) => + match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( + CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::FormatError(secret_str()) + ))) + }, + } + } + } + } + unreachable!(); +} diff --git a/gen/slides1-cli/src/main.rs b/gen/slides1-cli/src/main.rs new file mode 100644 index 0000000000..06e68a3596 --- /dev/null +++ b/gen/slides1-cli/src/main.rs @@ -0,0 +1,660 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/cli/main.rs.mako' +// DO NOT EDIT ! +#![allow(unused_variables, unused_imports, dead_code, unused_mut)] + +#[macro_use] +extern crate clap; +extern crate yup_oauth2 as oauth2; +extern crate yup_hyper_mock as mock; +extern crate serde; +extern crate serde_json; +extern crate hyper; +extern crate mime; +extern crate strsim; +extern crate google_slides1 as api; + +use std::env; +use std::io::{self, Write}; +use clap::{App, SubCommand, Arg}; + +mod cmn; + +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, + input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, + calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; + +use std::default::Default; +use std::str::FromStr; + +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; +use serde_json as json; +use clap::ArgMatches; + +enum DoitError { + IoError(String, io::Error), + ApiError(api::Error), +} + +struct Engine<'n> { + opt: ArgMatches<'n>, + hub: api::Slides>, + gp: Vec<&'static str>, + gpm: Vec<(&'static str, &'static str)>, +} + + +impl<'n> Engine<'n> { + fn _presentations_batch_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec![]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::BatchUpdatePresentationRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.presentations().batch_update(request, opt.value_of("presentation-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _presentations_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "locale" => Some(("locale", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "presentation-id" => Some(("presentationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "page-size.width.magnitude" => Some(("pageSize.width.magnitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "page-size.width.unit" => Some(("pageSize.width.unit", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "page-size.height.magnitude" => Some(("pageSize.height.magnitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "page-size.height.unit" => Some(("pageSize.height.unit", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "title" => Some(("title", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["height", "locale", "magnitude", "page-size", "presentation-id", "title", "unit", "width"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Presentation = json::value::from_value(object).unwrap(); + let mut call = self.hub.presentations().create(request); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _presentations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.presentations().get(opt.value_of("presentation-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _presentations_pages_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.presentations().pages_get(opt.value_of("presentation-id").unwrap_or(""), opt.value_of("page-object-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _doit(&self, dry_run: bool) -> Result, Option> { + let mut err = InvalidOptionsError::new(); + let mut call_result: Result<(), DoitError> = Ok(()); + let mut err_opt: Option = None; + match self.opt.subcommand() { + ("presentations", Some(opt)) => { + match opt.subcommand() { + ("batch-update", Some(opt)) => { + call_result = self._presentations_batch_update(opt, dry_run, &mut err); + }, + ("create", Some(opt)) => { + call_result = self._presentations_create(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._presentations_get(opt, dry_run, &mut err); + }, + ("pages-get", Some(opt)) => { + call_result = self._presentations_pages_get(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("presentations".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + _ => { + err.issues.push(CLIError::MissingCommandError); + writeln!(io::stderr(), "{}\n", self.opt.usage()).ok(); + } + } + + if dry_run { + if err.issues.len() > 0 { + err_opt = Some(err); + } + Err(err_opt) + } else { + Ok(call_result) + } + } + + // Please note that this call will fail if any part of the opt can't be handled + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { + let (config_dir, secret) = { + let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { + Err(e) => return Err(InvalidOptionsError::single(e, 3)), + Ok(p) => p, + }; + + match cmn::application_secret_from_directory(&config_dir, "slides1-secret.json", + "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { + Ok(secret) => (config_dir, secret), + Err(e) => return Err(InvalidOptionsError::single(e, 4)) + } + }; + + let auth = Authenticator::new( &secret, DefaultAuthenticatorDelegate, + if opt.is_present("debug-auth") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::::default() + }) + } else { + hyper::Client::new() + }, + JsonTokenStorage { + program_name: "slides1", + db_dir: config_dir.clone(), + }, Some(FlowType::InstalledRedirect(54324))); + + let client = + if opt.is_present("debug") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::::default() + }) + } else { + hyper::Client::new() + }; + let engine = Engine { + opt: opt, + hub: api::Slides::new(client, auth), + gp: vec!["$-xgafv", "access-token", "alt", "bearer-token", "callback", "fields", "key", "oauth-token", "pp", "pretty-print", "quota-user", "upload-type", "upload-protocol"], + gpm: vec![ + ("$-xgafv", "$.xgafv"), + ("access-token", "access_token"), + ("bearer-token", "bearer_token"), + ("oauth-token", "oauth_token"), + ("pretty-print", "prettyPrint"), + ("quota-user", "quotaUser"), + ("upload-type", "uploadType"), + ("upload-protocol", "upload_protocol"), + ] + }; + + match engine._doit(true) { + Err(Some(err)) => Err(err), + Err(None) => Ok(engine), + Ok(_) => unreachable!(), + } + } + + fn doit(&self) -> Result<(), DoitError> { + match self._doit(false) { + Ok(res) => res, + Err(_) => unreachable!(), + } + } +} + +fn main() { + let mut exit_status = 0i32; + let arg_data = [ + ("presentations", "methods: 'batch-update', 'create', 'get' and 'pages-get'", vec![ + ("batch-update", + Some(r##"Applies one or more updates to the presentation. + + Each request is validated before + being applied. If any request is not valid, then the entire request will + fail and nothing will be applied. + + Some requests have replies to + give you some information about how they are applied. Other requests do + not need to return information; these each return an empty reply. + The order of replies matches that of the requests. + + For example, suppose you call batchUpdate with four updates, and only the + third one returns information. The response would have two empty replies: + the reply to the third request, and another empty reply, in that order. + + Because other users may be editing the presentation, the presentation + might not exactly reflect your changes: your changes may + be altered with respect to collaborator changes. If there are no + collaborators, the presentation should reflect your changes. In any case, + the updates in your request are guaranteed to be applied together + atomically."##), + "Details at http://byron.github.io/google-apis-rs/google_slides1_cli/presentations_batch-update", + vec![ + (Some(r##"presentation-id"##), + None, + Some(r##"The presentation to apply the updates to."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("create", + Some(r##"Creates a new presentation using the title given in the request. Other + fields in the request are ignored. + Returns the created presentation."##), + "Details at http://byron.github.io/google-apis-rs/google_slides1_cli/presentations_create", + vec![ + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("get", + Some(r##"Gets the latest version of the specified presentation."##), + "Details at http://byron.github.io/google-apis-rs/google_slides1_cli/presentations_get", + vec![ + (Some(r##"presentation-id"##), + None, + Some(r##"The ID of the presentation to retrieve."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("pages-get", + Some(r##"Gets the latest version of the specified page in the presentation."##), + "Details at http://byron.github.io/google-apis-rs/google_slides1_cli/presentations_pages-get", + vec![ + (Some(r##"presentation-id"##), + None, + Some(r##"The ID of the presentation to retrieve."##), + Some(true), + Some(false)), + + (Some(r##"page-object-id"##), + None, + Some(r##"The object ID of the page to retrieve."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ]; + + let mut app = App::new("slides1") + .author("Sebastian Thiel ") + .version("1.0.0+20161213") + .about("An API for creating and editing Google Slides presentations.") + .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_slides1_cli") + .arg(Arg::with_name("url") + .long("scope") + .help("Specify the authentication a method should be executed in. Each scope requires the user to grant this application permission to use it.If unset, it defaults to the shortest scope url for a particular method.") + .multiple(true) + .takes_value(true)) + .arg(Arg::with_name("folder") + .long("config-dir") + .help("A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation.[default: ~/.google-service-cli") + .multiple(false) + .takes_value(true)) + .arg(Arg::with_name("debug") + .long("debug") + .help("Output all server communication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)) + .arg(Arg::with_name("debug-auth") + .long("debug-auth") + .help("Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)); + + for &(main_command_name, about, ref subcommands) in arg_data.iter() { + let mut mcmd = SubCommand::with_name(main_command_name).about(about); + + for &(sub_command_name, ref desc, url_info, ref args) in subcommands { + let mut scmd = SubCommand::with_name(sub_command_name); + if let &Some(desc) = desc { + scmd = scmd.about(desc); + } + scmd = scmd.after_help(url_info); + + for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { + let arg_name_str = + match (arg_name, flag) { + (&Some(an), _ ) => an, + (_ , &Some(f)) => f, + _ => unreachable!(), + }; + let mut arg = Arg::with_name(arg_name_str) + .empty_values(false); + if let &Some(short_flag) = flag { + arg = arg.short(short_flag); + } + if let &Some(desc) = desc { + arg = arg.help(desc); + } + if arg_name.is_some() && flag.is_some() { + arg = arg.takes_value(true); + } + if let &Some(required) = required { + arg = arg.required(required); + } + if let &Some(multi) = multi { + arg = arg.multiple(multi); + } + scmd = scmd.arg(arg); + } + mcmd = mcmd.subcommand(scmd); + } + app = app.subcommand(mcmd); + } + + let matches = app.get_matches(); + + let debug = matches.is_present("debug"); + match Engine::new(matches) { + Err(err) => { + exit_status = err.exit_code; + writeln!(io::stderr(), "{}", err).ok(); + }, + Ok(engine) => { + if let Err(doit_err) = engine.doit() { + exit_status = 1; + match doit_err { + DoitError::IoError(path, err) => { + writeln!(io::stderr(), "Failed to open output file '{}': {}", path, err).ok(); + }, + DoitError::ApiError(err) => { + if debug { + writeln!(io::stderr(), "{:#?}", err).ok(); + } else { + writeln!(io::stderr(), "{}", err).ok(); + } + } + } + } + } + } + + std::process::exit(exit_status); +} \ No newline at end of file diff --git a/gen/slides1/Cargo.toml b/gen/slides1/Cargo.toml new file mode 100644 index 0000000000..9611b86509 --- /dev/null +++ b/gen/slides1/Cargo.toml @@ -0,0 +1,34 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-slides1" +version = "1.0.0+20161213" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Slides (protocol v1)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/slides1" +homepage = "https://developers.google.com/slides/" +documentation = "http://byron.github.io/google-apis-rs/google_slides1" +license = "MIT" +keywords = ["slides", "google", "protocol", "web", "api"] +build = "src/build.rs" + + +[dependencies] +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.8" +serde_json = "^ 0.8" +yup-oauth2 = { version = "^ 1.0", optional = true, default-features = false } +serde_derive = { version = "^ 0.8", optional = true } +url = "= 0.5" + +[features] +default = ["with-serde-codegen"] +nightly = ["serde_derive","yup-oauth2/nightly"] +with-serde-codegen = ["serde_codegen","yup-oauth2/with-serde-codegen"] + +[build-dependencies] +serde_codegen = { version = "^ 0.8", optional = true } + diff --git a/gen/slides1/LICENSE.md b/gen/slides1/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/slides1/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/slides1/README.md b/gen/slides1/README.md new file mode 100644 index 0000000000..a8d3f26afe --- /dev/null +++ b/gen/slides1/README.md @@ -0,0 +1,182 @@ + +The `google-slides1` library allows access to all features of the *Google Slides* service. + +This documentation was generated from *Slides* crate version *1.0.0+20161213*, where *20161213* is the exact revision of the *slides:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. + +Everything else about the *Slides* *v1* API can be found at the +[official documentation site](https://developers.google.com/slides/). +# Features + +Handle the following *Resources* with ease from the central [hub](http://byron.github.io/google-apis-rs/google_slides1/struct.Slides.html) ... + +* [presentations](http://byron.github.io/google-apis-rs/google_slides1/struct.Presentation.html) + * [*batch update*](http://byron.github.io/google-apis-rs/google_slides1/struct.PresentationBatchUpdateCall.html), [*create*](http://byron.github.io/google-apis-rs/google_slides1/struct.PresentationCreateCall.html), [*get*](http://byron.github.io/google-apis-rs/google_slides1/struct.PresentationGetCall.html) and [*pages get*](http://byron.github.io/google-apis-rs/google_slides1/struct.PresentationPageGetCall.html) + + + + +# Structure of this Library + +The API is structured into the following primary items: + +* **[Hub](http://byron.github.io/google-apis-rs/google_slides1/struct.Slides.html)** + * a central object to maintain state and allow accessing all *Activities* + * creates [*Method Builders*](http://byron.github.io/google-apis-rs/google_slides1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](http://byron.github.io/google-apis-rs/google_slides1/trait.CallBuilder.html) +* **[Resources](http://byron.github.io/google-apis-rs/google_slides1/trait.Resource.html)** + * primary types that you can apply *Activities* to + * a collection of properties and *Parts* + * **[Parts](http://byron.github.io/google-apis-rs/google_slides1/trait.Part.html)** + * a collection of properties + * never directly used in *Activities* +* **[Activities](http://byron.github.io/google-apis-rs/google_slides1/trait.CallBuilder.html)** + * operations to apply to *Resources* + +All *structures* are marked with applicable traits to further categorize them and ease browsing. + +Generally speaking, you can invoke *Activities* like this: + +```Rust,ignore +let r = hub.resource().activity(...).doit() +``` + +Or specifically ... + +```ignore +let r = hub.presentations().create(...).doit() +let r = hub.presentations().get(...).doit() +let r = hub.presentations().batch_update(...).doit() +let r = hub.presentations().pages_get(...).doit() +``` + +The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +The `doit()` method performs the actual communication with the server and returns the respective result. + +# Usage + +## Setting up your Project + +To use this library, you would put the following lines into your `Cargo.toml` file: + +```toml +[dependencies] +google-slides1 = "*" +``` + +## A complete example + +```Rust +extern crate hyper; +extern crate yup_oauth2 as oauth2; +extern crate google_slides1 as slides1; +use slides1::BatchUpdatePresentationRequest; +use slides1::{Result, Error}; +use std::default::Default; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +use slides1::Slides; + +// Get an ApplicationSecret instance by some means. It contains the `client_id` and +// `client_secret`, among other things. +let secret: ApplicationSecret = Default::default(); +// Instantiate the authenticator. It will choose a suitable authentication flow for you, +// unless you replace `None` with the desired Flow. +// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +// retrieve them from storage. +let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, + hyper::Client::new(), + ::default(), None); +let mut hub = Slides::new(hyper::Client::new(), auth); +// As the method needs a request, you would usually fill it with the desired information +// into the respective structure. Some of the parts shown here might not be applicable ! +// Values shown here are possibly random and not representative ! +let mut req = BatchUpdatePresentationRequest::default(); + +// You can configure optional parameters by calling the respective setters at will, and +// execute the final call using `doit()`. +// Values shown here are possibly random and not representative ! +let result = hub.presentations().batch_update(req, "presentationId") + .doit(); + +match result { + Err(e) => match e { + // The Error enum provides details about what exactly happened. + // You can also just use its `Debug`, `Display` or `Error` traits + Error::HttpError(_) + |Error::MissingAPIKey + |Error::MissingToken(_) + |Error::Cancelled + |Error::UploadSizeLimitExceeded(_, _) + |Error::Failure(_) + |Error::BadRequest(_) + |Error::FieldClash(_) + |Error::JsonDecodeError(_, _) => println!("{}", e), + }, + Ok(res) => println!("Success: {:?}", res), +} + +``` +## Handling Errors + +All errors produced by the system are provided either as [Result](http://byron.github.io/google-apis-rs/google_slides1/enum.Result.html) enumeration as return value of +the doit() methods, or handed as possibly intermediate results to either the +[Hub Delegate](http://byron.github.io/google-apis-rs/google_slides1/trait.Delegate.html), or the [Authenticator Delegate](http://byron.github.io/google-apis-rs/google_slides1/../yup-oauth2/trait.AuthenticatorDelegate.html). + +When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +makes the system potentially resilient to all kinds of errors. + +## Uploads and Downloads +If a method supports downloads, the response body, which is part of the [Result](http://byron.github.io/google-apis-rs/google_slides1/enum.Result.html), should be +read by you to obtain the media. +If such a method also supports a [Response Result](http://byron.github.io/google-apis-rs/google_slides1/trait.ResponseResult.html), it will return that by default. +You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +this call: `.param("alt", "media")`. + +Methods supporting uploads can do so using up to 2 different protocols: +*simple* and *resumable*. The distinctiveness of each is represented by customized +`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. + +## Customization and Callbacks + +You may alter the way an `doit()` method is called by providing a [delegate](http://byron.github.io/google-apis-rs/google_slides1/trait.Delegate.html) to the +[Method Builder](http://byron.github.io/google-apis-rs/google_slides1/trait.CallBuilder.html) before making the final `doit()` call. +Respective methods will be called to provide progress information, as well as determine whether the system should +retry on failure. + +The [delegate trait](http://byron.github.io/google-apis-rs/google_slides1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. + +## Optional Parts in Server-Requests + +All structures provided by this library are made to be [enocodable](http://byron.github.io/google-apis-rs/google_slides1/trait.RequestValue.html) and +[decodable](http://byron.github.io/google-apis-rs/google_slides1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +are valid. +Most optionals are are considered [Parts](http://byron.github.io/google-apis-rs/google_slides1/trait.Part.html) which are identifiable by name, which will be sent to +the server to indicate either the set parts of the request or the desired parts in the response. + +## Builder Arguments + +Using [method builders](http://byron.github.io/google-apis-rs/google_slides1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +These will always take a single argument, for which the following statements are true. + +* [PODs][wiki-pod] are handed by copy +* strings are passed as `&str` +* [request values](http://byron.github.io/google-apis-rs/google_slides1/trait.RequestValue.html) are moved + +Arguments will always be copied or cloned into the builder, to make them independent of their original life times. + +[wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +[google-go-api]: https://github.com/google/google-api-go-client + +# License +The **slides1** library was generated by Sebastian Thiel, and is placed +under the *MIT* license. +You can read the full text at the repository's [license file][repo-license]. + +[repo-license]: https://github.com/Byron/google-apis-rs/LICENSE.md diff --git a/gen/slides1/src/build.rs b/gen/slides1/src/build.rs new file mode 100644 index 0000000000..0bebaf0bf0 --- /dev/null +++ b/gen/slides1/src/build.rs @@ -0,0 +1,25 @@ +#[cfg(feature = "with-serde-codegen")] +mod inner { + extern crate serde_codegen; + + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + serde_codegen::expand(&src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-serde-codegen"))] +mod inner { + pub fn main() {} +} + +pub fn main() { + inner::main() +} \ No newline at end of file diff --git a/gen/slides1/src/cmn.rs b/gen/slides1/src/cmn.rs new file mode 100644 index 0000000000..d75063e466 --- /dev/null +++ b/gen/slides1/src/cmn.rs @@ -0,0 +1,753 @@ +// COPY OF 'src/rust/api/cmn.rs' +// DO NOT EDIT +use std::io::{self, Read, Seek, Cursor, Write, SeekFrom}; +use std; +use std::fmt::{self, Display}; +use std::str::FromStr; +use std::error; +use std::thread::sleep; +use std::time::Duration; + +use mime::{Mime, TopLevel, SubLevel, Attr, Value}; +use oauth2::{TokenType, Retry, self}; +use hyper; +use hyper::header::{ContentType, ContentLength, Headers, UserAgent, Authorization, Header, + HeaderFormat, Bearer}; +use hyper::http::h1::LINE_ENDING; +use hyper::method::Method; +use hyper::status::StatusCode; + +use serde_json as json; + +/// Identifies the Hub. There is only one per library, this trait is supposed +/// to make intended use more explicit. +/// The hub allows to access all resource methods more easily. +pub trait Hub {} + +/// Identifies types for building methods of a particular resource type +pub trait MethodsBuilder {} + +/// Identifies types which represent builders for a particular resource method +pub trait CallBuilder {} + +/// Identifies types which can be inserted and deleted. +/// Types with this trait are most commonly used by clients of this API. +pub trait Resource {} + +/// Identifies types which are used in API responses. +pub trait ResponseResult {} + +/// Identifies types which are used in API requests. +pub trait RequestValue {} + +/// Identifies types which are not actually used by the API +/// This might be a bug within the google API schema. +pub trait UnusedType {} + +/// Identifies types which are only used as part of other types, which +/// usually are carrying the `Resource` trait. +pub trait Part {} + +/// Identifies types which are only used by other types internally. +/// They have no special meaning, this trait just marks them for completeness. +pub trait NestedType {} + +/// A utility to specify reader types which provide seeking capabilities too +pub trait ReadSeek: Seek + Read {} +impl ReadSeek for T {} + +/// A trait for all types that can convert themselves into a *parts* string +pub trait ToParts { + fn to_parts(&self) -> String; +} + +/// A utility type which can decode a server response that indicates error +#[derive(Deserialize)] +pub struct JsonServerError { + pub error: String, + pub error_description: Option +} + +/// A utility to represent detailed errors we might see in case there are BadRequests. +/// The latter happen if the sent parameters or request structures are unsound +#[derive(Deserialize, Serialize, Debug)] +pub struct ErrorResponse { + error: ServerError, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerError { + errors: Vec, + code: u16, + message: String, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerMessage { + domain: String, + reason: String, + message: String, + #[serde(rename="locationType")] + location_type: Option, + location: Option +} + +#[derive(Copy, Clone)] +pub struct DummyNetworkStream; + +impl Read for DummyNetworkStream { + fn read(&mut self, _: &mut [u8]) -> io::Result { + Ok(0) + } +} + +impl Write for DummyNetworkStream { + fn write(&mut self, _: &[u8]) -> io::Result { + Ok(0) + } + + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} + +impl hyper::net::NetworkStream for DummyNetworkStream { + fn peer_addr(&mut self) -> io::Result { + Ok("127.0.0.1:1337".parse().unwrap()) + } + + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } + + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } +} + + +/// A trait specifying functionality to help controlling any request performed by the API. +/// The trait has a conservative default implementation. +/// +/// It contains methods to deal with all common issues, as well with the ones related to +/// uploading media +pub trait Delegate { + + /// Called at the beginning of any API request. The delegate should store the method + /// information if he is interesting in knowing more context when further calls to it + /// are made. + /// The matching `finished()` call will always be made, no matter whether or not the API + /// request was successful. That way, the delegate may easily maintain a clean state + /// between various API calls. + fn begin(&mut self, MethodInfo) {} + + /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + /// + /// Return retry information. + fn http_error(&mut self, &hyper::Error) -> Retry { + Retry::Abort + } + + /// Called whenever there is the need for your applications API key after + /// the official authenticator implementation didn't provide one, for some reason. + /// If this method returns None as well, the underlying operation will fail + fn api_key(&mut self) -> Option { + None + } + + /// Called whenever the Authenticator didn't yield a token. The delegate + /// may attempt to provide one, or just take it as a general information about the + /// impending failure. + /// The given Error provides information about why the token couldn't be acquired in the + /// first place + fn token(&mut self, err: &error::Error) -> Option { + let _ = err; + None + } + + /// Called during resumable uploads to provide a URL for the impending upload. + /// It was saved after a previous call to `store_upload_url(...)`, and if not None, + /// will be used instead of asking the server for a new upload URL. + /// This is useful in case a previous resumable upload was aborted/canceled, but should now + /// be resumed. + /// The returned URL will be used exactly once - if it fails again and the delegate allows + /// to retry, we will ask the server for a new upload URL. + fn upload_url(&mut self) -> Option { + None + } + + /// Called after we have retrieved a new upload URL for a resumable upload to store it + /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// see `upload_url()`. + /// It will also be called with None after a successful upload, which allows the delegate + /// to forget the URL. That way, we will not attempt to resume an upload that has already + /// finished. + fn store_upload_url(&mut self, url: Option<&str>) { + let _ = url; + } + + /// Called whenever a server response could not be decoded from json. + /// It's for informational purposes only, the caller will return with an error + /// accordingly. + /// + /// # Arguments + /// + /// * `json_encoded_value` - The json-encoded value which failed to decode. + /// * `json_decode_error` - The decoder error + fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &json::Error) { + let _ = json_encoded_value; + let _ = json_decode_error; + } + + /// Called whenever the http request returns with a non-success status code. + /// This can involve authentication issues, or anything else that very much + /// depends on the used API method. + /// The delegate should check the status, header and decoded json error to decide + /// whether to retry or not. In the latter case, the underlying call will fail. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + fn http_failure(&mut self, _: &hyper::client::Response, Option, _: Option) -> Retry { + Retry::Abort + } + + /// Called prior to sending the main request of the given method. It can be used to time + /// the call or to print progress information. + /// It's also useful as you can be sure that a request will definitely be made. + fn pre_request(&mut self) { } + + /// Return the size of each chunk of a resumable upload. + /// Must be a power of two, with 1<<18 being the smallest allowed chunk size. + /// Will be called once before starting any resumable upload. + fn chunk_size(&mut self) -> u64 { + 1 << 23 + } + + /// Called before the given chunk is uploaded to the server. + /// If true is returned, the upload will be interrupted. + /// However, it may be resumable if you stored the upload URL in a previous call + /// to `store_upload_url()` + fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { + let _ = chunk; + false + } + + /// Called before the API request method returns, in every case. It can be used to clean up + /// internal state between calls to the API. + /// This call always has a matching call to `begin(...)`. + /// + /// # Arguments + /// + /// * `is_success` - a true value indicates the operation was successful. If false, you should + /// discard all values stored during `store_upload_url`. + fn finished(&mut self, is_success: bool) { + let _ = is_success; + } +} + +/// A delegate with a conservative default implementation, which is used if no other delegate is +/// set. +#[derive(Default)] +pub struct DefaultDelegate; + +impl Delegate for DefaultDelegate {} + + +#[derive(Debug)] +pub enum Error { + /// The http connection failed + HttpError(hyper::Error), + + /// An attempt was made to upload a resource with size stored in field `.0` + /// even though the maximum upload size is what is stored in field `.1`. + UploadSizeLimitExceeded(u64, u64), + + /// Represents information about a request that was not understood by the server. + /// Details are included. + BadRequest(ErrorResponse), + + /// We needed an API key for authentication, but didn't obtain one. + /// Neither through the authenticator, nor through the Delegate. + MissingAPIKey, + + /// We required a Token, but didn't get one from the Authenticator + MissingToken(Box), + + /// The delgate instructed to cancel the operation + Cancelled, + + /// An additional, free form field clashed with one of the built-in optional ones + FieldClash(&'static str), + + /// Shows that we failed to decode the server response. + /// This can happen if the protocol changes in conjunction with strict json decoding. + JsonDecodeError(String, json::Error), + + /// Indicates an HTTP repsonse with a non-success status code + Failure(hyper::client::Response), +} + + +impl Display for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + Error::HttpError(ref err) => err.fmt(f), + Error::UploadSizeLimitExceeded(ref resource_size, ref max_size) => + writeln!(f, "The media size {} exceeds the maximum allowed upload size of {}" + , resource_size, max_size), + Error::MissingAPIKey => { + (writeln!(f, "The application's API key was not found in the configuration")).ok(); + writeln!(f, "It is used as there are no Scopes defined for this method.") + }, + Error::BadRequest(ref err) => { + try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); + for err in err.error.errors.iter() { + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, + err.reason, + match &err.location { + &Some(ref loc) => format!("@{}", loc), + &None => String::new(), + })); + } + Ok(()) + }, + Error::MissingToken(ref err) => + writeln!(f, "Token retrieval failed with error: {}", err), + Error::Cancelled => + writeln!(f, "Operation cancelled by delegate"), + Error::FieldClash(field) => + writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), + Error::JsonDecodeError(ref json_str, ref err) + => writeln!(f, "{}: {}", err, json_str), + Error::Failure(ref response) => + writeln!(f, "Http status indicates failure: {:?}", response), + } + } +} + +impl error::Error for Error { + fn description(&self) -> &str { + match *self { + Error::HttpError(ref err) => err.description(), + Error::JsonDecodeError(_, ref err) => err.description(), + _ => "NO DESCRIPTION POSSIBLE - use `Display.fmt()` instead" + } + } + + fn cause(&self) -> Option<&error::Error> { + match *self { + Error::HttpError(ref err) => err.cause(), + Error::JsonDecodeError(_, ref err) => err.cause(), + _ => None + } + } +} + +/// A universal result type used as return for all calls. +pub type Result = std::result::Result; + +/// Contains information about an API request. +pub struct MethodInfo { + pub id: &'static str, + pub http_method: Method, +} + +const BOUNDARY: &'static str = "MDuXWGyeE33QFXGchb2VFWc4Z7945d"; + +/// Provides a `Read` interface that converts multiple parts into the protocol +/// identified by [RFC2387](https://tools.ietf.org/html/rfc2387). +/// **Note**: This implementation is just as rich as it needs to be to perform uploads +/// to google APIs, and might not be a fully-featured implementation. +#[derive(Default)] +pub struct MultiPartReader<'a> { + raw_parts: Vec<(Headers, &'a mut Read)>, + current_part: Option<(Cursor>, &'a mut Read)>, + last_part_boundary: Option>>, +} + +impl<'a> MultiPartReader<'a> { + + /// Reserve memory for exactly the given amount of parts + pub fn reserve_exact(&mut self, cap: usize) { + self.raw_parts.reserve_exact(cap); + } + + /// Add a new part to the queue of parts to be read on the first `read` call. + /// + /// # Arguments + /// + /// `headers` - identifying the body of the part. It's similar to the header + /// in an ordinary single-part call, and should thus contain the + /// same information. + /// `reader` - a reader providing the part's body + /// `size` - the amount of bytes provided by the reader. It will be put onto the header as + /// content-size. + /// `mime` - It will be put onto the content type + pub fn add_part(&mut self, reader: &'a mut Read, size: u64, mime_type: Mime) -> &mut MultiPartReader<'a> { + let mut headers = Headers::new(); + headers.set(ContentType(mime_type)); + headers.set(ContentLength(size)); + self.raw_parts.push((headers, reader)); + self + } + + /// Returns the mime-type representing our multi-part message. + /// Use it with the ContentType header. + pub fn mime_type(&self) -> Mime { + Mime( + TopLevel::Multipart, + SubLevel::Ext("Related".to_string()), + vec![(Attr::Ext("boundary".to_string()), Value::Ext(BOUNDARY.to_string()))], + ) + } + + /// Returns true if we are totally used + fn is_depleted(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_none() && self.last_part_boundary.is_none() + } + + /// Returns true if we are handling our last part + fn is_last_part(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_some() + } +} + +impl<'a> Read for MultiPartReader<'a> { + fn read(&mut self, buf: &mut [u8]) -> io::Result { + match (self.raw_parts.len(), + self.current_part.is_none(), + self.last_part_boundary.is_none()) { + (_, _, false) => { + let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); + if br < buf.len() { + self.last_part_boundary = None; + } + return Ok(br) + }, + (0, true, true) => return Ok(0), + (n, true, _) if n > 0 => { + let (headers, reader) = self.raw_parts.remove(0); + let mut c = Cursor::new(Vec::::new()); + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + headers, LINE_ENDING)).unwrap(); + c.seek(SeekFrom::Start(0)).unwrap(); + self.current_part = Some((c, reader)); + } + _ => {}, + } + + // read headers as long as possible + let (hb, rr) = { + let &mut (ref mut c, ref mut reader) = self.current_part.as_mut().unwrap(); + let b = c.read(buf).unwrap_or(0); + (b, reader.read(&mut buf[b..])) + }; + + match rr { + Ok(bytes_read) => { + if hb < buf.len() && bytes_read == 0 { + if self.is_last_part() { + // before clearing the last part, we will add the boundary that + // will be written last + self.last_part_boundary = Some(Cursor::new( + format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) + } + // We are depleted - this can trigger the next part to come in + self.current_part = None; + } + let mut total_bytes_read = hb + bytes_read; + while total_bytes_read < buf.len() && !self.is_depleted() { + match self.read(&mut buf[total_bytes_read ..]) { + Ok(br) => total_bytes_read += br, + Err(err) => return Err(err), + } + } + Ok(total_bytes_read) + } + Err(err) => { + // fail permanently + self.current_part = None; + self.last_part_boundary = None; + self.raw_parts.clear(); + Err(err) + } + } + } +} + +/// The `X-Upload-Content-Type` header. +/// +/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// processed to be more readable. +#[derive(PartialEq, Debug, Clone)] +pub struct XUploadContentType(pub Mime); + +impl ::std::ops::Deref for XUploadContentType { + type Target = Mime; + fn deref<'a>(&'a self) -> &'a Mime { &self.0 } +} +impl ::std::ops::DerefMut for XUploadContentType { + fn deref_mut<'a>(&'a mut self) -> &'a mut Mime { &mut self.0 } +} +impl Header for XUploadContentType { + fn header_name() -> &'static str { "X-Upload-Content-Type" } + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + hyper::header::parsing::from_one_raw_str(raw).map(XUploadContentType) + } +} +impl HeaderFormat for XUploadContentType { + fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result { + Display::fmt(&**self, f) + } +} +impl Display for XUploadContentType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(&**self, f) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct Chunk { + pub first: u64, + pub last: u64 +} + +impl fmt::Display for Chunk { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + (write!(fmt, "{}-{}", self.first, self.last)).ok(); + Ok(()) + } +} + +impl FromStr for Chunk { + type Err = &'static str; + + /// NOTE: only implements `%i-%i`, not `*` + fn from_str(s: &str) -> std::result::Result { + let parts: Vec<&str> = s.split('-').collect(); + if parts.len() != 2 { + return Err("Expected two parts: %i-%i") + } + Ok( + Chunk { + first: match FromStr::from_str(parts[0]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'first' as digit") + }, + last: match FromStr::from_str(parts[1]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'last' as digit") + } + } + ) + } +} + +/// Implements the Content-Range header, for serialization only +#[derive(Clone, PartialEq, Debug)] +pub struct ContentRange { + pub range: Option, + pub total_length: u64, +} + +impl Header for ContentRange { + fn header_name() -> &'static str { + "Content-Range" + } + + /// We are not parsable, as parsing is done by the `Range` header + fn parse_header(_: &[Vec]) -> hyper::error::Result { + Err(hyper::error::Error::Method) + } +} + + +impl HeaderFormat for ContentRange { + fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + try!(fmt.write_str("bytes ")); + match self.range { + Some(ref c) => try!(c.fmt(fmt)), + None => try!(fmt.write_str("*")) + } + (write!(fmt, "/{}", self.total_length)).ok(); + Ok(()) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct RangeResponseHeader(pub Chunk); + +impl Header for RangeResponseHeader { + fn header_name() -> &'static str { + "Range" + } + + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + if raw.len() > 0 { + let v = &raw[0]; + if let Ok(s) = std::str::from_utf8(v) { + const PREFIX: &'static str = "bytes "; + if s.starts_with(PREFIX) { + if let Ok(c) = ::from_str(&s[PREFIX.len()..]) { + return Ok(RangeResponseHeader(c)) + } + } + } + } + Err(hyper::error::Error::Method) + } +} + +impl HeaderFormat for RangeResponseHeader { + /// No implmentation necessary, we just need to parse + fn fmt_header(&self, _: &mut fmt::Formatter) -> fmt::Result { + Err(fmt::Error) + } +} + +/// A utility type to perform a resumable upload from start to end. +pub struct ResumableUploadHelper<'a, A: 'a> { + pub client: &'a mut hyper::client::Client, + pub delegate: &'a mut Delegate, + pub start_at: Option, + pub auth: &'a mut A, + pub user_agent: &'a str, + pub auth_header: Authorization, + pub url: &'a str, + pub reader: &'a mut ReadSeek, + pub media_type: Mime, + pub content_length: u64 +} + +impl<'a, A> ResumableUploadHelper<'a, A> + where A: oauth2::GetToken { + + fn query_transfer_status(&mut self) -> std::result::Result> { + loop { + match self.client.post(self.url) + .header(UserAgent(self.user_agent.to_string())) + .header(ContentRange { range: None, total_length: self.content_length }) + .header(self.auth_header.clone()) + .send() { + Ok(r) => { + // 308 = resume-incomplete == PermanentRedirect + let headers = r.headers.clone(); + let h: &RangeResponseHeader = match headers.get() { + Some(hh) if r.status == StatusCode::PermanentRedirect => hh, + None|Some(_) => { + if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { + sleep(d); + continue; + } + return Err(Ok(r)) + } + }; + return Ok(h.0.last) + } + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Err(Err(err)) + } + } + } + } + + /// returns None if operation was cancelled by delegate, or the HttpResult. + /// It can be that we return the result just because we didn't understand the status code - + /// caller should check for status himself before assuming it's OK to use + pub fn upload(&mut self) -> Option> { + let mut start = match self.start_at { + Some(s) => s, + None => match self.query_transfer_status() { + Ok(s) => s, + Err(result) => return Some(result) + } + }; + + const MIN_CHUNK_SIZE: u64 = 1 << 18; + let chunk_size = match self.delegate.chunk_size() { + cs if cs > MIN_CHUNK_SIZE => cs, + _ => MIN_CHUNK_SIZE + }; + + self.reader.seek(SeekFrom::Start(start)).unwrap(); + loop { + let request_size = match self.content_length - start { + rs if rs > chunk_size => chunk_size, + rs => rs + }; + + let mut section_reader = self.reader.take(request_size); + let range_header = ContentRange { + range: Some(Chunk {first: start, last: start + request_size - 1}), + total_length: self.content_length + }; + start += request_size; + if self.delegate.cancel_chunk_upload(&range_header) { + return None + } + let res = self.client.post(self.url) + .header(range_header) + .header(ContentType(self.media_type.clone())) + .header(UserAgent(self.user_agent.to_string())) + .body(&mut section_reader) + .send(); + match res { + Ok(mut res) => { + if res.status == StatusCode::PermanentRedirect { + continue + } + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let Retry::After(d) = self.delegate.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + } + return Some(Ok(res)) + }, + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Some(Err(err)) + } + } + } + } +} + +// Copy of src/rust/cli/cmn.rs +// TODO(ST): Allow sharing common code between program types +pub fn remove_json_null_values(value: &mut json::value::Value) { + match *value { + json::value::Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} diff --git a/gen/slides1/src/lib.rs b/gen/slides1/src/lib.rs new file mode 100644 index 0000000000..c079edaaa3 --- /dev/null +++ b/gen/slides1/src/lib.rs @@ -0,0 +1,191 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +//! This documentation was generated from *Slides* crate version *1.0.0+20161213*, where *20161213* is the exact revision of the *slides:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.0*. +//! +//! Everything else about the *Slides* *v1* API can be found at the +//! [official documentation site](https://developers.google.com/slides/). +//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/slides1). +//! # Features +//! +//! Handle the following *Resources* with ease from the central [hub](struct.Slides.html) ... +//! +//! * [presentations](struct.Presentation.html) +//! * [*batch update*](struct.PresentationBatchUpdateCall.html), [*create*](struct.PresentationCreateCall.html), [*get*](struct.PresentationGetCall.html) and [*pages get*](struct.PresentationPageGetCall.html) +//! +//! +//! +//! +//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](../index.html). +//! +//! # Structure of this Library +//! +//! The API is structured into the following primary items: +//! +//! * **[Hub](struct.Slides.html)** +//! * a central object to maintain state and allow accessing all *Activities* +//! * creates [*Method Builders*](trait.MethodsBuilder.html) which in turn +//! allow access to individual [*Call Builders*](trait.CallBuilder.html) +//! * **[Resources](trait.Resource.html)** +//! * primary types that you can apply *Activities* to +//! * a collection of properties and *Parts* +//! * **[Parts](trait.Part.html)** +//! * a collection of properties +//! * never directly used in *Activities* +//! * **[Activities](trait.CallBuilder.html)** +//! * operations to apply to *Resources* +//! +//! All *structures* are marked with applicable traits to further categorize them and ease browsing. +//! +//! Generally speaking, you can invoke *Activities* like this: +//! +//! ```Rust,ignore +//! let r = hub.resource().activity(...).doit() +//! ``` +//! +//! Or specifically ... +//! +//! ```ignore +//! let r = hub.presentations().create(...).doit() +//! let r = hub.presentations().get(...).doit() +//! let r = hub.presentations().batch_update(...).doit() +//! let r = hub.presentations().pages_get(...).doit() +//! ``` +//! +//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +//! The `doit()` method performs the actual communication with the server and returns the respective result. +//! +//! # Usage +//! +//! ## Setting up your Project +//! +//! To use this library, you would put the following lines into your `Cargo.toml` file: +//! +//! ```toml +//! [dependencies] +//! google-slides1 = "*" +//! ``` +//! +//! ## A complete example +//! +//! ```test_harness,no_run +//! extern crate hyper; +//! extern crate yup_oauth2 as oauth2; +//! extern crate google_slides1 as slides1; +//! use slides1::BatchUpdatePresentationRequest; +//! use slides1::{Result, Error}; +//! # #[test] fn egal() { +//! use std::default::Default; +//! use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +//! use slides1::Slides; +//! +//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and +//! // `client_secret`, among other things. +//! let secret: ApplicationSecret = Default::default(); +//! // Instantiate the authenticator. It will choose a suitable authentication flow for you, +//! // unless you replace `None` with the desired Flow. +//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +//! // retrieve them from storage. +//! let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +//! hyper::Client::new(), +//! ::default(), None); +//! let mut hub = Slides::new(hyper::Client::new(), auth); +//! // As the method needs a request, you would usually fill it with the desired information +//! // into the respective structure. Some of the parts shown here might not be applicable ! +//! // Values shown here are possibly random and not representative ! +//! let mut req = BatchUpdatePresentationRequest::default(); +//! +//! // You can configure optional parameters by calling the respective setters at will, and +//! // execute the final call using `doit()`. +//! // Values shown here are possibly random and not representative ! +//! let result = hub.presentations().batch_update(req, "presentationId") +//! .doit(); +//! +//! match result { +//! Err(e) => match e { +//! // The Error enum provides details about what exactly happened. +//! // You can also just use its `Debug`, `Display` or `Error` traits +//! Error::HttpError(_) +//! |Error::MissingAPIKey +//! |Error::MissingToken(_) +//! |Error::Cancelled +//! |Error::UploadSizeLimitExceeded(_, _) +//! |Error::Failure(_) +//! |Error::BadRequest(_) +//! |Error::FieldClash(_) +//! |Error::JsonDecodeError(_, _) => println!("{}", e), +//! }, +//! Ok(res) => println!("Success: {:?}", res), +//! } +//! # } +//! ``` +//! ## Handling Errors +//! +//! All errors produced by the system are provided either as [Result](enum.Result.html) enumeration as return value of +//! the doit() methods, or handed as possibly intermediate results to either the +//! [Hub Delegate](trait.Delegate.html), or the [Authenticator Delegate](../yup-oauth2/trait.AuthenticatorDelegate.html). +//! +//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +//! makes the system potentially resilient to all kinds of errors. +//! +//! ## Uploads and Downloads +//! If a method supports downloads, the response body, which is part of the [Result](enum.Result.html), should be +//! read by you to obtain the media. +//! If such a method also supports a [Response Result](trait.ResponseResult.html), it will return that by default. +//! You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +//! this call: `.param("alt", "media")`. +//! +//! Methods supporting uploads can do so using up to 2 different protocols: +//! *simple* and *resumable*. The distinctiveness of each is represented by customized +//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. +//! +//! ## Customization and Callbacks +//! +//! You may alter the way an `doit()` method is called by providing a [delegate](trait.Delegate.html) to the +//! [Method Builder](trait.CallBuilder.html) before making the final `doit()` call. +//! Respective methods will be called to provide progress information, as well as determine whether the system should +//! retry on failure. +//! +//! The [delegate trait](trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +//! +//! ## Optional Parts in Server-Requests +//! +//! All structures provided by this library are made to be [enocodable](trait.RequestValue.html) and +//! [decodable](trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +//! are valid. +//! Most optionals are are considered [Parts](trait.Part.html) which are identifiable by name, which will be sent to +//! the server to indicate either the set parts of the request or the desired parts in the response. +//! +//! ## Builder Arguments +//! +//! Using [method builders](trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +//! These will always take a single argument, for which the following statements are true. +//! +//! * [PODs][wiki-pod] are handed by copy +//! * strings are passed as `&str` +//! * [request values](trait.RequestValue.html) are moved +//! +//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times. +//! +//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +//! [google-go-api]: https://github.com/google/google-api-go-client +//! +//! + +// Unused attributes happen thanks to defined, but unused structures +// We don't warn about this, as depending on the API, some data structures or facilities are never used. +// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any +// unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(proc_macro))] +#![allow(unused_imports, unused_mut, dead_code)] + +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-serde-codegen")] +include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/slides1/src/lib.rs.in b/gen/slides1/src/lib.rs.in new file mode 100644 index 0000000000..dff1fae6a2 --- /dev/null +++ b/gen/slides1/src/lib.rs.in @@ -0,0 +1,4056 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.in.mako' +// DO NOT EDIT ! + +#[cfg(feature = "nightly")] +#[macro_use] +extern crate serde_derive; + +extern crate hyper; +extern crate serde; +extern crate serde_json; +extern crate yup_oauth2 as oauth2; +extern crate mime; +extern crate url; + +mod cmn; + +use std::collections::HashMap; +use std::cell::RefCell; +use std::borrow::BorrowMut; +use std::default::Default; +use std::collections::BTreeMap; +use serde_json as json; +use std::io; +use std::fs; +use std::thread::sleep; +use std::time::Duration; + +pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + Resource, ErrorResponse, remove_json_null_values}; + + +// ############## +// UTILITIES ### +// ############ + +/// Identifies the an OAuth2 authorization scope. +/// A scope is needed when requesting an +/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). +#[derive(PartialEq, Eq, Hash)] +pub enum Scope { + /// View and manage the files in your Google Drive + Drive, + + /// View your Google Slides presentations + PresentationReadonly, + + /// View your Google Spreadsheets + SpreadsheetReadonly, + + /// View the files in your Google Drive + DriveReadonly, + + /// View and manage your spreadsheets in Google Drive + Spreadsheet, + + /// View and manage your Google Slides presentations + Presentation, +} + +impl AsRef for Scope { + fn as_ref(&self) -> &str { + match *self { + Scope::Drive => "https://www.googleapis.com/auth/drive", + Scope::PresentationReadonly => "https://www.googleapis.com/auth/presentations.readonly", + Scope::SpreadsheetReadonly => "https://www.googleapis.com/auth/spreadsheets.readonly", + Scope::DriveReadonly => "https://www.googleapis.com/auth/drive.readonly", + Scope::Spreadsheet => "https://www.googleapis.com/auth/spreadsheets", + Scope::Presentation => "https://www.googleapis.com/auth/presentations", + } + } +} + +impl Default for Scope { + fn default() -> Scope { + Scope::PresentationReadonly + } +} + + + +// ######## +// HUB ### +// ###### + +/// Central instance to access all Slides related resource activities +/// +/// # Examples +/// +/// Instantiate a new hub +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_slides1 as slides1; +/// use slides1::BatchUpdatePresentationRequest; +/// use slides1::{Result, Error}; +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use slides1::Slides; +/// +/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and +/// // `client_secret`, among other things. +/// let secret: ApplicationSecret = Default::default(); +/// // Instantiate the authenticator. It will choose a suitable authentication flow for you, +/// // unless you replace `None` with the desired Flow. +/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +/// // retrieve them from storage. +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Slides::new(hyper::Client::new(), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = BatchUpdatePresentationRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.presentations().batch_update(req, "presentationId") +/// .doit(); +/// +/// match result { +/// Err(e) => match e { +/// // The Error enum provides details about what exactly happened. +/// // You can also just use its `Debug`, `Display` or `Error` traits +/// Error::HttpError(_) +/// |Error::MissingAPIKey +/// |Error::MissingToken(_) +/// |Error::Cancelled +/// |Error::UploadSizeLimitExceeded(_, _) +/// |Error::Failure(_) +/// |Error::BadRequest(_) +/// |Error::FieldClash(_) +/// |Error::JsonDecodeError(_, _) => println!("{}", e), +/// }, +/// Ok(res) => println!("Success: {:?}", res), +/// } +/// # } +/// ``` +pub struct Slides { + client: RefCell, + auth: RefCell
, + _user_agent: String, +} + +impl<'a, C, A> Hub for Slides {} + +impl<'a, C, A> Slides + where C: BorrowMut, A: oauth2::GetToken { + + pub fn new(client: C, authenticator: A) -> Slides { + Slides { + client: RefCell::new(client), + auth: RefCell::new(authenticator), + _user_agent: "google-api-rust-client/1.0.0".to_string(), + } + } + + pub fn presentations(&'a self) -> PresentationMethods<'a, C, A> { + PresentationMethods { hub: &self } + } + + /// Set the user-agent header field to use in all requests to the server. + /// It defaults to `google-api-rust-client/1.0.0`. + /// + /// Returns the previously set user-agent. + pub fn user_agent(&mut self, agent_name: String) -> String { + let prev = self._user_agent.clone(); + self._user_agent = agent_name; + prev + } +} + + +// ############ +// SCHEMAS ### +// ########## +/// Replaces all shapes that match the given criteria with the provided image. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReplaceAllShapesWithImageRequest { + /// If set, this request will replace all of the shapes that contain the + /// given text. + #[serde(rename="containsText")] + pub contains_text: Option, + /// The image URL. + /// + /// The image is fetched once at insertion time and a copy is stored for + /// display inside the presentation. Images must be less than 50MB in size, + /// cannot exceed 25 megapixels, and must be in either in PNG, JPEG, or GIF + /// format. + #[serde(rename="imageUrl")] + pub image_url: Option, + /// The replace method. + #[serde(rename="replaceMethod")] + pub replace_method: Option, +} + +impl Part for ReplaceAllShapesWithImageRequest {} + + +/// A PageElement kind representing a +/// joined collection of PageElements. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Group { + /// The collection of elements in the group. The minimum size of a group is 2. + pub children: Option>, +} + +impl Part for Group {} + + +/// The general text content. The text must reside in a compatible shape (e.g. +/// text box or rectangle) or a table cell in a page. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TextContent { + /// The bulleted lists contained in this text, keyed by list ID. + pub lists: Option>, + /// The text contents broken down into its component parts, including styling + /// information. This property is read-only. + #[serde(rename="textElements")] + pub text_elements: Option>, +} + +impl Part for TextContent {} + + +/// The stretched picture fill. The page or page element is filled entirely with +/// the specified picture. The picture is stretched to fit its container. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct StretchedPictureFill { + /// Reading the content_url: + /// + /// An URL to a picture with a default lifetime of 30 minutes. + /// This URL is tagged with the account of the requester. Anyone with the URL + /// effectively accesses the picture as the original requester. Access to the + /// picture may be lost if the presentation's sharing settings change. + /// + /// Writing the content_url: + /// + /// The picture is fetched once at insertion time and a copy is stored for + /// display inside the presentation. Pictures must be less than 50MB in size, + /// cannot exceed 25 megapixels, and must be in either in PNG, JPEG, or GIF + /// format. + #[serde(rename="contentUrl")] + pub content_url: Option, + /// The original size of the picture fill. This field is read-only. + pub size: Option, +} + +impl Part for StretchedPictureFill {} + + +/// Creates an image. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreateImageRequest { + /// The image URL. + /// + /// The image is fetched once at insertion time and a copy is stored for + /// display inside the presentation. Images must be less than 50MB in size, + /// cannot exceed 25 megapixels, and must be in either in PNG, JPEG, or GIF + /// format. + pub url: Option, + /// A user-supplied object ID. + /// + /// If you specify an ID, it must be unique among all pages and page elements + /// in the presentation. The ID must start with an alphanumeric character or an + /// underscore (matches regex `[a-zA-Z0-9_]`); remaining characters + /// may include those as well as a hyphen or colon (matches regex + /// `[a-zA-Z0-9_-:]`). + /// The length of the ID must not be less than 5 or greater than 50. + /// + /// If you don't specify an ID, a unique one is generated. + #[serde(rename="objectId")] + pub object_id: Option, + /// The element properties for the image. + /// + /// When the aspect ratio of the provided size does not match the image aspect + /// ratio, the image is scaled and centered with respect to the size in order + /// to maintain aspect ratio. The provided transform is applied after this + /// operation. + #[serde(rename="elementProperties")] + pub element_properties: Option, +} + +impl Part for CreateImageRequest {} + + +/// Replaces all instances of text matching a criteria with replace text. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReplaceAllTextRequest { + /// Finds text in a shape matching this substring. + #[serde(rename="containsText")] + pub contains_text: Option, + /// The text that will replace the matched text. + #[serde(rename="replaceText")] + pub replace_text: Option, +} + +impl Part for ReplaceAllTextRequest {} + + +/// Response message from a batch update. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [batch update presentations](struct.PresentationBatchUpdateCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BatchUpdatePresentationResponse { + /// The presentation the updates were applied to. + #[serde(rename="presentationId")] + pub presentation_id: Option, + /// The reply of the updates. This maps 1:1 with the updates, although + /// replies to some requests may be empty. + pub replies: Option>, +} + +impl ResponseResult for BatchUpdatePresentationResponse {} + + +/// The crop properties of an object enclosed in a container. For example, an +/// Image. +/// +/// The crop properties is represented by the offsets of four edges which define +/// a crop rectangle. The offsets are measured in percentage from the +/// corresponding edges of the object's original bounding rectangle towards +/// inside, relative to the object's original dimensions. +/// +/// - If the offset is in the interval (0, 1), the corresponding edge of crop +/// rectangle is positioned inside of the object's original bounding rectangle. +/// - If the offset is negative or greater than 1, the corresponding edge of crop +/// rectangle is positioned outside of the object's original bounding rectangle. +/// - If the left edge of the crop rectangle is on the right side of its right +/// edge, the object will be flipped horizontally. +/// - If the top edge of the crop rectangle is below its bottom edge, the object +/// will be flipped vertically. +/// - If all offsets and rotation angle is 0, the object is not cropped. +/// +/// After cropping, the content in the crop rectangle will be stretched to fit +/// its container. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CropProperties { + /// The offset specifies the left edge of the crop rectangle that is located to + /// the right of the original bounding rectangle left edge, relative to the + /// object's original width. + #[serde(rename="leftOffset")] + pub left_offset: Option, + /// The rotation angle of the crop window around its center, in radians. + /// Rotation angle is applied after the offset. + pub angle: Option, + /// The offset specifies the bottom edge of the crop rectangle that is located + /// above the original bounding rectangle bottom edge, relative to the object's + /// original height. + #[serde(rename="bottomOffset")] + pub bottom_offset: Option, + /// The offset specifies the right edge of the crop rectangle that is located + /// to the left of the original bounding rectangle right edge, relative to the + /// object's original width. + #[serde(rename="rightOffset")] + pub right_offset: Option, + /// The offset specifies the top edge of the crop rectangle that is located + /// below the original bounding rectangle top edge, relative to the object's + /// original height. + #[serde(rename="topOffset")] + pub top_offset: Option, +} + +impl Part for CropProperties {} + + +/// The properties of the SheetsChart. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SheetsChartProperties { + /// The properties of the embedded chart image. + #[serde(rename="chartImageProperties")] + pub chart_image_properties: Option, +} + +impl Part for SheetsChartProperties {} + + +/// A criteria that matches a specific string of text in a shape or table. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SubstringMatchCriteria { + /// The text to search for in the shape or table. + pub text: Option, + /// Indicates whether the search should respect case: + /// + /// - `True`: the search is case sensitive. + /// - `False`: the search is case insensitive. + #[serde(rename="matchCase")] + pub match_case: Option, +} + +impl Part for SubstringMatchCriteria {} + + +/// Contains properties describing the look and feel of a list bullet at a given +/// level of nesting. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct NestingLevel { + /// The style of a bullet at this level of nesting. + #[serde(rename="bulletStyle")] + pub bullet_style: Option, +} + +impl Part for NestingLevel {} + + +/// The properties of the Video. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct VideoProperties { + /// The outline of the video. The default outline matches the defaults for new + /// videos created in the Slides editor. + pub outline: Option, +} + +impl Part for VideoProperties {} + + +/// The shape background fill. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ShapeBackgroundFill { + /// Solid color fill. + #[serde(rename="solidFill")] + pub solid_fill: Option, + /// The background fill property state. + /// + /// Updating the the fill on a shape will implicitly update this field to + /// `RENDERED`, unless another value is specified in the same request. To + /// have no fill on a shape, set this field to `NOT_RENDERED`. In this case, + /// any other fill fields set in the same request will be ignored. + #[serde(rename="propertyState")] + pub property_state: Option, +} + +impl Part for ShapeBackgroundFill {} + + +/// The palette of predefined colors for a page. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ColorScheme { + /// The ThemeColorType and corresponding concrete color pairs. + pub colors: Option>, +} + +impl Part for ColorScheme {} + + +/// The page background fill. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PageBackgroundFill { + /// Solid color fill. + #[serde(rename="solidFill")] + pub solid_fill: Option, + /// The background fill property state. + /// + /// Updating the the fill on a page will implicitly update this field to + /// `RENDERED`, unless another value is specified in the same request. To + /// have no fill on a page, set this field to `NOT_RENDERED`. In this case, + /// any other fill fields set in the same request will be ignored. + #[serde(rename="propertyState")] + pub property_state: Option, + /// Stretched picture fill. + #[serde(rename="stretchedPictureFill")] + pub stretched_picture_fill: Option, +} + +impl Part for PageBackgroundFill {} + + +/// Refreshes an embedded Google Sheets chart by replacing it with the latest +/// version of the chart from Google Sheets. +/// +/// NOTE: Refreshing charts requires at least one of the spreadsheets.readonly, +/// spreadsheets, drive.readonly, or drive OAuth scopes. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RefreshSheetsChartRequest { + /// The object ID of the chart to refresh. + #[serde(rename="objectId")] + pub object_id: Option, +} + +impl Part for RefreshSheetsChartRequest {} + + +/// A magnitude in a single direction in the specified units. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Dimension { + /// The magnitude. + pub magnitude: Option, + /// The units for magnitude. + pub unit: Option, +} + +impl Part for Dimension {} + + +/// A solid color fill. The page or page element is filled entirely with the +/// specified color value. +/// +/// If any field is unset, its value may be inherited from a parent placeholder +/// if it exists. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SolidFill { + /// The color value of the solid fill. + pub color: Option, + /// The fraction of this `color` that should be applied to the pixel. + /// That is, the final pixel color is defined by the equation: + /// + /// pixel color = alpha * (color) + (1.0 - alpha) * (background color) + /// + /// This means that a value of 1.0 corresponds to a solid color, whereas + /// a value of 0.0 corresponds to a completely transparent color. + pub alpha: Option, +} + +impl Part for SolidFill {} + + +/// Inserts columns into a table. +/// +/// Other columns in the table will be resized to fit the new column. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct InsertTableColumnsRequest { + /// The table to insert columns into. + #[serde(rename="tableObjectId")] + pub table_object_id: Option, + /// Whether to insert new columns to the right of the reference cell location. + /// + /// - `True`: insert to the right. + /// - `False`: insert to the left. + #[serde(rename="insertRight")] + pub insert_right: Option, + /// The number of columns to be inserted. Maximum 20 per request. + pub number: Option, + /// The reference table cell location from which columns will be inserted. + /// + /// A new column will be inserted to the left (or right) of the column where + /// the reference cell is. If the reference cell is a merged cell, a new + /// column will be inserted to the left (or right) of the merged cell. + #[serde(rename="cellLocation")] + pub cell_location: Option, +} + +impl Part for InsertTableColumnsRequest {} + + +/// Deletes a column from a table. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DeleteTableColumnRequest { + /// The reference table cell location from which a column will be deleted. + /// + /// The column this cell spans will be deleted. If this is a merged cell, + /// multiple columns will be deleted. If no columns remain in the table after + /// this deletion, the whole table is deleted. + #[serde(rename="cellLocation")] + pub cell_location: Option, + /// The table to delete columns from. + #[serde(rename="tableObjectId")] + pub table_object_id: Option, +} + +impl Part for DeleteTableColumnRequest {} + + +/// A visual element rendered on a page. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PageElement { + /// A word art page element. + #[serde(rename="wordArt")] + pub word_art: Option, + /// The description of the page element. Combined with title to display alt + /// text. + pub description: Option, + /// The object ID for this page element. Object IDs used by + /// google.apps.slides.v1.Page and + /// google.apps.slides.v1.PageElement share the same namespace. + #[serde(rename="objectId")] + pub object_id: Option, + /// The title of the page element. Combined with description to display alt + /// text. + pub title: Option, + /// An image page element. + pub image: Option, + /// The transform of the page element. + pub transform: Option, + /// A generic shape. + pub shape: Option, + /// A linked chart embedded from Google Sheets. Unlinked charts are + /// represented as images. + #[serde(rename="sheetsChart")] + pub sheets_chart: Option, + /// A video page element. + pub video: Option